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

Dennis Nienhüser earthwings at gentoo.org
Thu Jan 14 20:54:04 CET 2010


SVN commit 1074812 by nienhueser:

Add the range element from kml (camera distance in meters). Change GeoDataCoordinate* coordinate() method signature to GeoDataCoordinate coordinates(). Implement assignment operator and copy constructor needed because of the d-pointer.


 M  +33 -17    GeoDataLookAt.cpp  
 M  +74 -61    GeoDataLookAt.h  
 M  +15 -13    GeoDataLookAt_p.h  


--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataLookAt.cpp #1074811:1074812
@@ -8,56 +8,72 @@
 
 namespace Marble
 {
-	
-GeoDataLookAt::GeoDataLookAt()
+
+GeoDataLookAt::GeoDataLookAt() : d (new GeoDataLookAtPrivate)
 {
-	d = new GeoDataLookAtPrivate();
-	d->m_coord = new GeoDataCoordinates();
+    // nothing to do
 }
 
+GeoDataLookAt::GeoDataLookAt(const GeoDataLookAt& other) : 
+        d (new GeoDataLookAtPrivate(*other.d))
+{
+    // nothing to do
+}
+
+GeoDataLookAt& GeoDataLookAt::operator=(const GeoDataLookAt &other)                                   
+{
+    *d = *other.d;
+    return *this;    
+}
+
 GeoDataLookAt::~GeoDataLookAt()
 {
-	if( !d )
-		delete d;
+    delete d;
 }
 
 void GeoDataLookAt::setAltitude( qreal altitude)
 {
-	d->m_coord->setAltitude(altitude);
+    d->m_coord.setAltitude(altitude);
 }
 
 qreal GeoDataLookAt::altitude() const
 {
-	return d->m_coord->altitude();
+    return d->m_coord.altitude();
 }
 
 void GeoDataLookAt::setLatitude( qreal latitude, GeoDataCoordinates::Unit unit)
 {
-	d->m_coord->setLatitude(latitude,unit);
-
+    d->m_coord.setLatitude(latitude,unit);
 }
 
 qreal GeoDataLookAt::latitude(GeoDataCoordinates::Unit unit) const
 {
-	return d->m_coord->latitude(unit);
-
+    return d->m_coord.latitude(unit);
 }
 
 void GeoDataLookAt::setLongitude( qreal longitude, GeoDataCoordinates::Unit unit)
 {
-	d->m_coord->setLongitude(longitude,unit);
+    d->m_coord.setLongitude(longitude,unit);
 }
 
 qreal GeoDataLookAt::longitude(GeoDataCoordinates::Unit unit) const
 {
-	return d->m_coord->longitude(unit);
+    return d->m_coord.longitude(unit);
+}
 
+GeoDataCoordinates GeoDataLookAt::coordinates() const
+{
+    return d->m_coord;
 }
 
-GeoDataCoordinates* GeoDataLookAt::coordinate() const
+void GeoDataLookAt::setRange( qreal range )
 {
-	return d->m_coord;
+    d->m_range = range;
 }
+
+qreal GeoDataLookAt::range() const
+{
+    return d->m_range;
 }
 
-
+}
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataLookAt.h #1074811:1074812
@@ -7,75 +7,88 @@
 
 namespace Marble
 {
-	class GeoDataLookAtPrivate;
+    class GeoDataLookAtPrivate;
 
-	class GEODATA_EXPORT GeoDataLookAt : public GeoDataAbstractView
-	{
-		public:
+    class GEODATA_EXPORT GeoDataLookAt : public GeoDataAbstractView
+    {
+    public:
+        GeoDataLookAt();
+        
+        GeoDataLookAt(const GeoDataLookAt& other);
+        
+        GeoDataLookAt& operator=(const GeoDataLookAt &other);
 
-			GeoDataLookAt();
+        ~GeoDataLookAt();
 
-			~GeoDataLookAt();
+        /**
+         * @brief set the altitude in a GeoDataLookAt object
+         * @param altitude latitude
+         *
+         */
+        void setAltitude( qreal altitude);
 
-			 
-			/**
-			 * @brief set the altitude in a GeoDataLookAt object
-			 * @param altitude latitude
-			 *
- 			*/
-			void setAltitude( qreal altitude);
-			
-			/**
-			 * @brief retrieves the altitude of the GeoDataLookAt object
-			 * @return latitude
- 			*/
-			qreal altitude( ) const;
-			
-			 /**
-			 * @brief set the latitude in a GeoDataLookAt object
-			 * @param latitude latitude
-			 * @param unit units that lon and lat get measured in
-			 * (default for Radian: north pole at pi/2, southpole at -pi/2)
-			  */
-			void setLatitude( qreal latitude,GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian );
+        /**
+         * @brief retrieves the altitude of the GeoDataLookAt object
+         * @return latitude
+         */
+        qreal altitude( ) const;
 
-			 /**
-			 * @brief retrieves the latitude of the GeoDataLookAt object
-			 * use the unit parameter to switch between Radian and DMS
-			 * @param unit units that lon and lat get measured in
-			 * (default for Radian: north pole at pi/2, southpole at -pi/2)
-			 * @return latitude
-			  */
-			qreal latitude( GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian ) const;
-			
-			/**
-			 * @brief set the longitude in a GeoDataLookAt object
-			 * @param longitude longitude
-			 * @param unit units that lon and lat get measured in
-			 * (default for Radian: north pole at pi/2, southpole at -pi/2)
- 			*/
-			void setLongitude( qreal longitude,GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian );
+        /**
+         * @brief set the latitude in a GeoDataLookAt object
+         * @param latitude latitude
+         * @param unit units that lon and lat get measured in
+         * (default for Radian: north pole at pi/2, southpole at -pi/2)
+         */
+        void setLatitude( qreal latitude,GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian );
 
-			/**
-			 * @brief retrieves the longitude of the GeoDataLookAt object
-			 * use the unit parameter to switch between Radian and DMS
-			 * @param unit units that lon and lat get measured in
-			 * (default for Radian: north pole at pi/2, southpole at -pi/2)
-			 * @return latitude
-			 */
-			qreal longitude( GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian ) const;
+        /**
+         * @brief retrieves the latitude of the GeoDataLookAt object
+         * use the unit parameter to switch between Radian and DMS
+         * @param unit units that lon and lat get measured in
+         * (default for Radian: north pole at pi/2, southpole at -pi/2)
+         * @return latitude
+         */
+        qreal latitude( GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian ) const;
 
-			/**
-			 * @brief retrieves the pointer to GeoDataCoordinates object of the GeoDataLookAt object
-			 * @return GeoDataCoordinates*
-			 */
-			GeoDataCoordinates* coordinate() const;
+        /**
+         * @brief set the longitude in a GeoDataLookAt object
+         * @param longitude longitude
+         * @param unit units that lon and lat get measured in
+         * (default for Radian: north pole at pi/2, southpole at -pi/2)
+         */
+        void setLongitude( qreal longitude,GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian );
 
-		private:
-			GeoDataLookAtPrivate *d;
+        /**
+         * @brief retrieves the longitude of the GeoDataLookAt object
+         * use the unit parameter to switch between Radian and DMS
+         * @param unit units that lon and lat get measured in
+         * (default for Radian: north pole at pi/2, southpole at -pi/2)
+         * @return latitude
+         */
+        qreal longitude( GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian ) const;
 
-	};
+        /**
+         * @brief retrieve the lat/lon/alt triple as a GeoDataCoordinates object
+         * @return GeoDataCoordinates
+         * @see longitude latitude altitude
+         */
+        GeoDataCoordinates coordinates() const;
+
+        /**
+          * @brief Change the distance (in meters) between the camera and the object looked at
+          * @see range
+          */
+        void setRange( qreal range );
+
+        /**
+          * @brief Retrieve the distance (in meters) between the camera and the object looked at
+          * @see setRange
+          */
+        qreal range() const;
+
+    private:
+        GeoDataLookAtPrivate *d;
+
+    };
 }
 #endif
-
-
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataLookAt_p.h #1074811:1074812
@@ -2,22 +2,24 @@
 #define GEODATALOOKAT_P_H
 
 #include "GeoDataCoordinates.h"
+
 namespace Marble
 {
-class GeoDataLookAtPrivate
-{
-	public :
 
-		GeoDataLookAtPrivate()
-		{
-		}
+    class GeoDataLookAtPrivate
+    {
+    public :
 
-		~GeoDataLookAtPrivate()
-		{
-		}
-		
-		GeoDataCoordinates *m_coord;
+    GeoDataLookAtPrivate() : m_range(0.0)
+    {
+        // nothing to do
+    }
+
+    GeoDataCoordinates m_coord;
+
+    qreal m_range;
 };
-} 
+
+}
+
 #endif
-


More information about the Marble-commits mailing list