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

Bastian Holst bastianholst at gmx.de
Thu Aug 20 21:48:10 CEST 2009


SVN commit 1013814 by bholst:

Marbles GeoDataLod and GeoDataRegion getting copy constructor and assignment operator.


 M  +11 -0     GeoDataLod.cpp  
 M  +5 -0      GeoDataLod.h  
 M  +10 -0     GeoDataRegion.cpp  
 M  +5 -0      GeoDataRegion.h  
 M  +44 -0     GeoDataRegion_p.h  


--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataLod.cpp #1013813:1013814
@@ -21,6 +21,11 @@
 {
 }
 
+GeoDataLod::GeoDataLod( const GeoDataLod& other )
+    : GeoDataObject( other ),
+      d( new GeoDataLodPrivate( *other.d ) )
+{
+}
 
 GeoDataLod::~GeoDataLod()
 {
@@ -98,5 +103,11 @@
     stream >> d->m_minFadeExtent >> d->m_maxFadeExtent;
 }
 
+GeoDataLod &GeoDataLod::operator=( const GeoDataLod& other )
+{
+    *d = *other.d;
+    return *this;
 }
 
+}
+
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataLod.h #1013813:1013814
@@ -50,6 +50,10 @@
 */
     GeoDataLod();
 
+/*!
+    \brief Creates a new Level of Detail object as a copy of @p other.
+*/
+    GeoDataLod( const GeoDataLod& other );
     
 /*!
     \brief Destroys a Level of Detail object.
@@ -145,6 +149,7 @@
 */
     virtual void unpack( QDataStream& stream );
 
+    GeoDataLod &operator=( const GeoDataLod& other );
     
  protected:
     GeoDataLodPrivate  * const d;
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataRegion.cpp #1013813:1013814
@@ -29,6 +29,11 @@
 {
 }
 
+GeoDataRegion::GeoDataRegion( const GeoDataRegion& other )
+    : GeoDataObject( other ),
+      d( new GeoDataRegionPrivate( *other.d ) )
+{
+}
 
 GeoDataRegion::GeoDataRegion( GeoDataFeature * feature )
     : GeoDataObject(),
@@ -133,6 +138,11 @@
     d->m_latLonAltBox->unpack( stream );
 }
 
+GeoDataRegion &GeoDataRegion::operator=( const GeoDataRegion& other )
+{
+    *d = *other.d;
+    return *this;
+}
 
 }
 
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataRegion.h #1013813:1013814
@@ -59,6 +59,10 @@
 */
     GeoDataRegion();
 
+/*!
+    \brief Creates a new GeoDataRegion as a copy of \p other.
+*/
+    GeoDataRegion( const GeoDataRegion& other );
     
 /*!
     \brief Creates a new GeoDataRegion object that is associated to a \a feature.
@@ -138,6 +142,7 @@
 */
     virtual void unpack( QDataStream& stream );
 
+    GeoDataRegion &operator=( const GeoDataRegion& other );
 
  protected:
     GeoDataRegionPrivate  * const d;
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataRegion_p.h #1013813:1013814
@@ -26,7 +26,25 @@
     {
     }
 
+    GeoDataRegionPrivate( const GeoDataRegionPrivate& other )
+         : m_parent( other.m_parent )
+    {
+        if ( other.m_latLonAltBox ) {
+            m_latLonAltBox = new GeoDataLatLonAltBox( *other.m_latLonAltBox );
+        }
+        else {
+            m_latLonAltBox = 0;
+        }
 
+        if ( other.m_lod ) {
+            m_lod = new GeoDataLod( *other.m_lod );
+        }
+        else {
+            m_lod = 0;
+        }
+    }
+
+
     explicit GeoDataRegionPrivate( GeoDataFeature * feature )
          : m_parent( feature ),
            m_latLonAltBox( 0 ),
@@ -34,12 +52,38 @@
     {
     }
 
+    ~GeoDataRegionPrivate()
+    {
+        delete m_latLonAltBox;
+        delete m_lod;
+    }
 
+
     QString nodeType() const
     {
         return GeoDataTypes::GeoDataRegionType;
     }
 
+    GeoDataRegionPrivate &operator=( const GeoDataRegionPrivate other )
+    {
+        m_parent = other.m_parent;
+        if ( other.m_latLonAltBox ) {
+            m_latLonAltBox = new GeoDataLatLonAltBox( *other.m_latLonAltBox );
+        }
+        else {
+            m_latLonAltBox = 0;
+        }
+
+        if ( other.m_lod ) {
+            m_lod = new GeoDataLod( *other.m_lod );
+        }
+        else {
+            m_lod = 0;
+        }
+
+        return *this;
+    }
+
     GeoDataFeature * m_parent;
     GeoDataLatLonAltBox * m_latLonAltBox;
     GeoDataLod * m_lod;


More information about the Marble-commits mailing list