[Marble-commits] KDE/kdeedu/marble
Utku Aydın
utkuaydin34 at gmail.com
Sun Jan 9 11:09:04 CET 2011
SVN commit 1213138 by aydin:
Add legend, section and item tag writers
M +6 -0 src/lib/geodata/scene/GeoSceneItem.cpp
M +2 -0 src/lib/geodata/scene/GeoSceneItem.h
M +11 -0 src/lib/geodata/scene/GeoSceneLegend.cpp
M +2 -0 src/lib/geodata/scene/GeoSceneLegend.h
M +6 -0 src/lib/geodata/scene/GeoSceneSection.cpp
M +2 -0 src/lib/geodata/scene/GeoSceneSection.h
M +7 -3 src/lib/geodata/writers/dgml/DgmlDocumentTagWriter.cpp
A src/lib/geodata/writers/dgml/DgmlItemTagWriter.cpp [License: LGPL]
A src/lib/geodata/writers/dgml/DgmlItemTagWriter.h [License: LGPL]
A src/lib/geodata/writers/dgml/DgmlLegendTagWriter.cpp [License: LGPL]
A src/lib/geodata/writers/dgml/DgmlLegendTagWriter.h [License: LGPL]
A src/lib/geodata/writers/dgml/DgmlSectionTagWriter.cpp [License: LGPL]
A src/lib/geodata/writers/dgml/DgmlSectionTagWriter.h [License: LGPL]
M +20 -0 tests/TestGeoSceneWriter.cpp
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneItem.cpp #1213137:1213138
@@ -22,6 +22,7 @@
#include "GeoSceneItem.h"
#include "GeoSceneIcon.h"
+#include "GeoSceneTypes.h"
namespace Marble
{
@@ -41,6 +42,11 @@
delete m_icon;
}
+const char* GeoSceneItem::nodeType() const
+{
+ return GeoSceneTypes::GeoSceneItemType;
+}
+
const GeoSceneIcon* GeoSceneItem::icon() const
{
return m_icon;
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneItem.h #1213137:1213138
@@ -41,6 +41,8 @@
explicit GeoSceneItem( const QString& name );
~GeoSceneItem();
+ virtual const char* nodeType() const;
+
QString name() const;
QString text() const;
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneLegend.cpp #1213137:1213138
@@ -21,6 +21,7 @@
#include "GeoSceneLegend.h"
+#include "GeoSceneTypes.h"
#include "GeoSceneSection.h"
namespace Marble
@@ -38,6 +39,11 @@
/// (We want to preserve the order and don't care
/// much about speed here), so we don't use a hash
QVector<GeoSceneSection*> m_sections;
+
+ const char* nodeType() const
+ {
+ return GeoSceneTypes::GeoSceneLegendType;
+ }
};
@@ -51,6 +57,11 @@
delete d;
}
+const char* GeoSceneLegend::nodeType() const
+{
+ return d->nodeType();
+}
+
void GeoSceneLegend::addSection( GeoSceneSection* section )
{
// Remove any section that has the same name
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneLegend.h #1213137:1213138
@@ -44,6 +44,8 @@
GeoSceneLegend();
~GeoSceneLegend();
+ virtual const char* nodeType() const;
+
/**
* @brief Add a section to the legend
* @param section the new section
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneSection.cpp #1213137:1213138
@@ -23,6 +23,7 @@
#include "MarbleDebug.h"
+#include "GeoSceneTypes.h"
#include "GeoSceneItem.h"
namespace Marble
@@ -42,6 +43,11 @@
qDeleteAll( m_items );
}
+const char* GeoSceneSection::nodeType() const
+{
+ return GeoSceneTypes::GeoSceneSectionType;
+}
+
void GeoSceneSection::addItem( GeoSceneItem* item )
{
// Remove any item that has the same name
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneSection.h #1213137:1213138
@@ -42,6 +42,8 @@
explicit GeoSceneSection( const QString& name );
~GeoSceneSection();
+ virtual const char* nodeType() const;
+
/**
* @brief Add an item to the legend section
* @param item the new item
--- trunk/KDE/kdeedu/marble/src/lib/geodata/writers/dgml/DgmlDocumentTagWriter.cpp #1213137:1213138
@@ -15,6 +15,7 @@
#include "GeoSceneHead.h"
#include "GeoSceneMap.h"
#include "GeoSceneSettings.h"
+#include "GeoSceneLegend.h"
#include "DgmlElementDictionary.h"
namespace Marble
@@ -29,15 +30,18 @@
writer.writeStartElement( dgml::dgmlTag_Document );
- const GeoSceneHead *head = static_cast<const GeoSceneHead*>( document->head() );
+ const GeoSceneHead *head = document->head();
writeElement( head, writer );
- const GeoSceneMap *map = static_cast<const GeoSceneMap*>( document->map() );
+ const GeoSceneMap *map = document->map() ;
writeElement( map, writer );
- const GeoSceneSettings *settings = static_cast<const GeoSceneSettings*>( document->settings() );
+ const GeoSceneSettings *settings = document->settings();
writeElement( settings, writer );
+ const GeoSceneLegend *legend = document->legend();
+ writeElement( legend, writer );
+
writer.writeEndDocument();
return true;
}
--- trunk/KDE/kdeedu/marble/tests/TestGeoSceneWriter.cpp #1213137:1213138
@@ -22,6 +22,9 @@
#include "GeoSceneTexture.h"
#include "GeoSceneSettings.h"
#include "GeoSceneProperty.h"
+#include "GeoSceneLegend.h"
+#include "GeoSceneSection.h"
+#include "GeoSceneItem.h"
#include "GeoWriter.h"
#include "GeoSceneParser.h"
@@ -94,6 +97,23 @@
scalebar->setAvailable( true );
settings->addProperty( scalebar );
+ GeoSceneLegend* legend = document->legend();
+ GeoSceneSection* section = new GeoSceneSection( "areas" );
+ section->setHeading( "Areas" );
+ legend->addSection( section );
+
+ GeoSceneItem* sportsPitch = new GeoSceneItem( "sports_pitch" );
+ sportsPitch->setText( "Sports pitch" );
+ GeoSceneIcon* sportsPitchIcon = sportsPitch->icon();
+ sportsPitchIcon->setPixmap( "maps/earth/testmap/legend/sports_pitch.png" );
+ section->addItem( sportsPitch );
+
+ GeoSceneItem* sportsCentre = new GeoSceneItem( "sports_centre" );
+ sportsCentre->setText( "Sports centre" );
+ GeoSceneIcon* sportsCentreIcon = sportsCentre->icon();
+ sportsCentreIcon->setColor( "#00FF00" );
+ section->addItem( sportsCentre );
+
QTemporaryFile tempFile;
tempFile.open();
More information about the Marble-commits
mailing list