[Marble-commits] KDE/kdeedu/marble/src/lib/geodata

Bernhard Beschow bbeschow at cs.tu-berlin.de
Sun Jun 20 11:11:25 CEST 2010


SVN commit 1140314 by beschow:

create GeoSceneTexture::Projection value in GeoSceneTexture instead of in the parser

TODO: remove the m_tileProjection from AbstractScanlineTextureMapper, then GeoSceneTexture will be the only place where GeoSceneTexture::Projection values are created

 M  +1 -9      handlers/dgml/DgmlProjectionTagHandler.cpp  
 M  +9 -2      scene/GeoSceneTexture.cpp  
 M  +1 -1      scene/GeoSceneTexture.h  


--- trunk/KDE/kdeedu/marble/src/lib/geodata/handlers/dgml/DgmlProjectionTagHandler.cpp #1140313:1140314
@@ -46,17 +46,9 @@
 
     // Attribute name, default to "Equirectangular"
     const QString nameStr = parser.attribute( dgmlAttr_name ).trimmed();
-    if ( !nameStr.isEmpty() ) {
-        GeoSceneTexture::Projection projection = GeoSceneTexture::Equirectangular;
-        if ( nameStr == "Equirectangular" )
-            projection = GeoSceneTexture::Equirectangular;
-        else if ( nameStr == "Mercator" )
-            projection = GeoSceneTexture::Mercator;
-        else
+    if ( !parentItem.nodeAs<GeoSceneTexture>()->setProjection( nameStr ) )
             parser.raiseWarning( QString( "Value not allowed for attribute name: %1" ).arg( nameStr ));
 
-        parentItem.nodeAs<GeoSceneTexture>()->setProjection( projection );
-    }
     return 0;
 }
 
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneTexture.cpp #1140313:1140314
@@ -118,9 +118,16 @@
     return m_projection;
 }
 
-void GeoSceneTexture::setProjection( const Projection projection )
+bool GeoSceneTexture::setProjection( const QString &name )
 {
-    m_projection = projection;
+    if ( name == "Equirectangular" )
+        m_projection = GeoSceneTexture::Equirectangular;
+    else if ( name == "Mercator" )
+        m_projection = GeoSceneTexture::Mercator;
+    else
+        return false;
+
+    return true;
 }
 
 QUrl GeoSceneTexture::downloadUrl( const TileId &id )
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneTexture.h #1140313:1140314
@@ -73,7 +73,7 @@
     void setMaximumTileLevel( const int );
 
     Projection projection() const;
-    void setProjection( const Projection );
+    bool setProjection( const QString &name );
 
     Blending const * blending() const;
     void setBlending( Blending const * const );


More information about the Marble-commits mailing list