Commit c8451776 authored by Torsten Rahn's avatar Torsten Rahn
Browse files

- Importing Murad's base classes and "re-namespacing" them to the

GeoData namespace. The Document and Folder stuff needs to get
merged later on.


svn path=/trunk/KDE/kdeedu/marble/; revision=726594
parent e8d8a788
//
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2007 Murad Tagirov <tmurad@gmail.com>
//
#include "KMLDocument.h"
#include <QtXml/QXmlInputSource>
#include <QtXml/QXmlSimpleReader>
#include "KMLDocumentParser.h"
#include "KMLPlaceMark.h"
#include "KMLStyle.h"
KMLDocument::KMLDocument()
{
}
KMLDocument::~KMLDocument()
{
foreach ( KMLStyle* style, m_styleHash ) {
delete style;
}
}
void KMLDocument::load( QIODevice& source )
{
/*
* 1. create KMLParser
* 2. create QXMLSimpleReader
* 3. start to parsing input stream
*/
KMLDocumentParser parser( *this );
QXmlInputSource xmlDocumentSource( &source );
QXmlSimpleReader reader;
reader.setContentHandler( &parser );
reader.setErrorHandler( &parser );
reader.setFeature( "http://trolltech.com/xml/features/report-whitespace-only-CharData", false );
bool result = reader.parse( &xmlDocumentSource );
if ( ! result ) {
qDebug("KMLDocument::load( QIODevice& ). Error while parsing xml source");
}
}
void KMLDocument::addStyle( KMLStyle* style )
{
qDebug("KMLDocument: Add new style");
m_styleHash.insert( style->styleId(), style );
}
const KMLStyle& KMLDocument::getStyle( QString styleId ) const
{
/*
* TODO: m_styleHash always should contain at least default KMLStyle element
*/
return *m_styleHash.value( styleId );
}
//
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2007 Murad Tagirov <tmurad@gmail.com>
//
#ifndef GEODATADOCUMENT_H
#define GEODATADOCUMENT_H
#include <QtCore/QHash>
#include "GeoDataFolder.h"
class QIODevice;
class GeoDataStyle;
class GeoDataDocument : public GeoDataFolder
{
public:
GeoDataDocument();
~GeoDataDocument();
void load( QIODevice& source );
void addStyle( GeoDataStyle* style );
const GeoDataStyle& getStyle( QString styleId ) const;
private:
QHash < QString, GeoDataStyle* > m_styleHash;
};
#endif // GEODATADOCUMENT_H
//
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2007 Murad Tagirov <tmurad@gmail.com>
//
#include "KMLFolder.h"
#include "PlaceMarkContainer.h"
KMLFolder::KMLFolder()
{
}
KMLFolder::~KMLFolder()
{
qDebug("KMLFolder::~KMLFolder(). Subfolders count: %d", m_folderVector.count());
foreach ( KMLFolder* folder, m_folderVector ) {
delete folder;
}
}
void KMLFolder::addFolder( KMLFolder* folder )
{
m_folderVector.append( folder );
}
//
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2007 Murad Tagirov <tmurad@gmail.com>
//
#ifndef GEODATAFOLDER_H
#define GEODATAFOLDER_H
#include <QtCore/QVector>
#include "GeoDataContainer.h"
class GeoDataFolder : public GeoDataContainer
{
public:
GeoDataFolder();
~GeoDataFolder();
void addFolder( GeoDataFolder* folder );
protected:
QVector <GeoDataFolder*> m_folderVector;
};
#endif // GEODATAFOLDER_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment