[Marble-commits] KDE/kdeedu/marble/src/plugins/render/osmannotate

Andrew Manson g.real.ate at gmail.com
Mon Jul 13 20:11:28 CEST 2009


SVN commit 996027 by mansona:

still working on the GeoGraphicsItem implementation. Currently getting a crazy when trying 
to call the paint() method on the Item. Only occurs after loading OSM file. 


 M  +2 -1      OsmAnnotatePlugin.cpp  
 M  +3 -3      osm/OsmBoundsGraphicsItem.cpp  
 M  +7 -2      osm/OsmBoundsGraphicsItem.h  
 M  +7 -7      osm/OsmBoundsTagHandler.cpp  


--- trunk/KDE/kdeedu/marble/src/plugins/render/osmannotate/OsmAnnotatePlugin.cpp #996026:996027
@@ -179,7 +179,8 @@
         QListIterator<GeoGraphicsItem*> it( *m_itemModel );
 
         while( it.hasNext() ) {
-            it.next()->paint( painter, viewport, renderPos, layer );
+            GeoGraphicsItem* i = it.next();
+            i->paint( painter, viewport, renderPos, layer );
         }
 
 //        painter->drawPolygon( ring );
--- trunk/KDE/kdeedu/marble/src/plugins/render/osmannotate/osm/OsmBoundsGraphicsItem.cpp #996026:996027
@@ -14,13 +14,13 @@
 
 namespace Marble{
 
-OsmBoundsGraphicsItem::OsmBoundsGraphicsItem() : GeoDataLineString()
+OsmBoundsGraphicsItem::OsmBoundsGraphicsItem()
 {
 }
 
-OsmBoundsGraphicsItem::OsmBoundsGraphicsItem( GeoDataGeometry& other )
-//        : GeoDataLineString( other )
+void OsmBoundsGraphicsItem::append( const GeoDataCoordinates& value )
 {
+    m_lineString.append( value );
 }
 
 void OsmBoundsGraphicsItem::paint( GeoPainter* painter, ViewportParams * viewport,
--- trunk/KDE/kdeedu/marble/src/plugins/render/osmannotate/osm/OsmBoundsGraphicsItem.h #996026:996027
@@ -12,6 +12,7 @@
 #define OSMBOUNDSGRAPHICSITEM_H
 
 #include "GeoDataLineString.h"
+#include "GeoDataGeometry.h"
 
 namespace Marble{
 
@@ -19,14 +20,18 @@
 class ViewportParams;
 class GeoSceneLayer;
 
-class OsmBoundsGraphicsItem : public GeoDataLineString
+class OsmBoundsGraphicsItem
 {
 public:
     OsmBoundsGraphicsItem();
-    OsmBoundsGraphicsItem( GeoDataGeometry& other );
+    OsmBoundsGraphicsItem( const GeoDataLineString& other );
 
+    void append ( const GeoDataCoordinates& value );
+
     virtual void paint( GeoPainter* painter, ViewportParams *viewport,
                         const QString &renderPos, GeoSceneLayer *layer );
+private:
+    GeoDataLineString m_lineString;
 };
 
 }
--- trunk/KDE/kdeedu/marble/src/plugins/render/osmannotate/osm/OsmBoundsTagHandler.cpp #996026:996027
@@ -29,7 +29,7 @@
 {
     Q_ASSERT( parser.isStartElement() );
 
-    GeoDataLineString bound;
+    OsmBoundsGraphicsItem* item = new OsmBoundsGraphicsItem();
 
     qreal minlon = parser.attribute("minlon").toDouble();
     qreal minlat = parser.attribute("minlat").toDouble();
@@ -42,15 +42,15 @@
     GeoDataCoordinates bottomLeft( minlon, maxlat, 0 , GeoDataCoordinates::Degree );
     GeoDataCoordinates bottomRight( maxlon, maxlat, 0 , GeoDataCoordinates::Degree );
 
-    bound.append( topLeft );
-    bound.append( topRight );
-    bound.append( bottomRight );
-    bound.append( bottomLeft );
+    item->append( topLeft );
+    item->append( topRight );
+    item->append( bottomRight );
+    item->append( bottomLeft );
 
     QList<GeoGraphicsItem*>* model = parser.activeModel();
 
 
-    OsmBoundsGraphicsItem* item = new OsmBoundsGraphicsItem(bound);
+
 //
 //    GeoDataPlacemark* place = new GeoDataPlacemark;
 //
@@ -60,7 +60,7 @@
 //
 //    model->append( dynamic_cast<GeoGraphicsItem*>( place ) );
 
-    model->append( item );
+    model->append( dynamic_cast<GeoGraphicsItem*> (item) );
 
     return 0;
 


More information about the Marble-commits mailing list