[QGIS Commit] r12355 - trunk/qgis/src/providers/gpx

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Dec 7 12:50:48 EST 2009


Author: wonder
Date: 2009-12-07 12:50:47 -0500 (Mon, 07 Dec 2009)
New Revision: 12355

Modified:
   trunk/qgis/src/providers/gpx/gpsdata.cpp
   trunk/qgis/src/providers/gpx/gpsdata.h
   trunk/qgis/src/providers/gpx/qgsgpxprovider.cpp
   trunk/qgis/src/providers/gpx/qgsgpxprovider.h
Log:
GPX provider: added "Qgs" prefix to Waypoint, Track and few more classes.
This avoids segfaults when loading GPX files due incorrectly assigned virtual destructors by dynamic linker.
This happens with GDAL trunk (will be 1.7) that adds a new OGR driver GTM that contains classes with the same names.


Modified: trunk/qgis/src/providers/gpx/gpsdata.cpp
===================================================================
--- trunk/qgis/src/providers/gpx/gpsdata.cpp	2009-12-07 17:42:55 UTC (rev 12354)
+++ trunk/qgis/src/providers/gpx/gpsdata.cpp	2009-12-07 17:50:47 UTC (rev 12355)
@@ -30,7 +30,7 @@
 
 #define OUTPUT_PRECISION 12
 
-QString GPSObject::xmlify( const QString& str )
+QString QgsGPSObject::xmlify( const QString& str )
 {
   QString tmp = str;
   tmp.replace( "&", "&" );
@@ -42,7 +42,7 @@
 }
 
 
-void GPSObject::writeXML( QTextStream& stream )
+void QgsGPSObject::writeXML( QTextStream& stream )
 {
   if ( !name.isEmpty() )
     stream << "<name>" << xmlify( name ) << "</name>\n";
@@ -59,15 +59,15 @@
 }
 
 
-GPSPoint::GPSPoint()
+QgsGPSPoint::QgsGPSPoint()
 {
   ele = -std::numeric_limits<double>::max();
 }
 
 
-void GPSPoint::writeXML( QTextStream& stream )
+void QgsGPSPoint::writeXML( QTextStream& stream )
 {
-  GPSObject::writeXML( stream );
+  QgsGPSObject::writeXML( stream );
   if ( ele != -std::numeric_limits<double>::max() )
     stream << "<ele>" << ele << "</ele>\n";
   if ( !sym.isEmpty() )
@@ -75,7 +75,7 @@
 }
 
 
-GPSExtended::GPSExtended()
+QgsGPSExtended::QgsGPSExtended()
     : xMin( std::numeric_limits<double>::max() ),
     xMax( -std::numeric_limits<double>::max() ),
     yMin( std::numeric_limits<double>::max() ),
@@ -86,27 +86,27 @@
 }
 
 
-void GPSExtended::writeXML( QTextStream& stream )
+void QgsGPSExtended::writeXML( QTextStream& stream )
 {
-  GPSObject::writeXML( stream );
+  QgsGPSObject::writeXML( stream );
   if ( number != std::numeric_limits<int>::max() )
     stream << "<number>" << number << "</number>\n";
 }
 
 
-void Waypoint::writeXML( QTextStream& stream )
+void QgsWaypoint::writeXML( QTextStream& stream )
 {
   stream << "<wpt lat=\"" << QString::number( lat, 'f', OUTPUT_PRECISION ) <<
   "\" lon=\"" << QString::number( lon, 'f', OUTPUT_PRECISION ) << "\">\n";
-  GPSPoint::writeXML( stream );
+  QgsGPSPoint::writeXML( stream );
   stream << "</wpt>\n";
 }
 
 
-void Route::writeXML( QTextStream& stream )
+void QgsRoute::writeXML( QTextStream& stream )
 {
   stream << "<rte>\n";
-  GPSExtended::writeXML( stream );
+  QgsGPSExtended::writeXML( stream );
   for ( unsigned int i = 0; i < points.size(); ++i )
   {
     stream << "<rtept lat=\"" << QString::number( points[i].lat, 'f', OUTPUT_PRECISION )
@@ -118,10 +118,10 @@
 }
 
 
-void Track::writeXML( QTextStream& stream )
+void QgsTrack::writeXML( QTextStream& stream )
 {
   stream << "<trk>\n";
-  GPSExtended::writeXML( stream );
+  QgsGPSExtended::writeXML( stream );
   for ( unsigned int i = 0; i < segments.size(); ++i )
   {
     stream << "<trkseg>\n";
@@ -140,7 +140,7 @@
 }
 
 
-GPSData::GPSData()
+QgsGPSData::QgsGPSData()
 {
   xMin = std::numeric_limits<double>::max();
   xMax = -std::numeric_limits<double>::max();
@@ -152,12 +152,12 @@
 }
 
 
-QgsRectangle GPSData::getExtent() const
+QgsRectangle QgsGPSData::getExtent() const
 {
   return QgsRectangle( xMin, yMin, xMax, yMax );
 }
 
-void GPSData::setNoDataExtent()
+void QgsGPSData::setNoDataExtent()
 {
   if ( getNumberOfWaypoints() + getNumberOfRoutes() + getNumberOfTracks() == 0 )
   {
@@ -168,64 +168,64 @@
   }
 }
 
-int GPSData::getNumberOfWaypoints() const
+int QgsGPSData::getNumberOfWaypoints() const
 {
   return waypoints.size();
 }
 
 
-int GPSData::getNumberOfRoutes() const
+int QgsGPSData::getNumberOfRoutes() const
 {
   return routes.size();
 }
 
 
-int GPSData::getNumberOfTracks() const
+int QgsGPSData::getNumberOfTracks() const
 {
   return tracks.size();
 }
 
 
-GPSData::WaypointIterator GPSData::waypointsBegin()
+QgsGPSData::WaypointIterator QgsGPSData::waypointsBegin()
 {
   return waypoints.begin();
 }
 
 
-GPSData::RouteIterator GPSData::routesBegin()
+QgsGPSData::RouteIterator QgsGPSData::routesBegin()
 {
   return routes.begin();
 }
 
 
-GPSData::TrackIterator GPSData::tracksBegin()
+QgsGPSData::TrackIterator QgsGPSData::tracksBegin()
 {
   return tracks.begin();
 }
 
 
-GPSData::WaypointIterator GPSData::waypointsEnd()
+QgsGPSData::WaypointIterator QgsGPSData::waypointsEnd()
 {
   return waypoints.end();
 }
 
 
-GPSData::RouteIterator GPSData::routesEnd()
+QgsGPSData::RouteIterator QgsGPSData::routesEnd()
 {
   return routes.end();
 }
 
 
-GPSData::TrackIterator GPSData::tracksEnd()
+QgsGPSData::TrackIterator QgsGPSData::tracksEnd()
 {
   return tracks.end();
 }
 
 
-GPSData::WaypointIterator GPSData::addWaypoint( double lat, double lon,
+QgsGPSData::WaypointIterator QgsGPSData::addWaypoint( double lat, double lon,
     QString name, double ele )
 {
-  Waypoint wpt;
+  QgsWaypoint wpt;
   wpt.lat = lat;
   wpt.lon = lon;
   wpt.name = name;
@@ -234,7 +234,7 @@
 }
 
 
-GPSData::WaypointIterator GPSData::addWaypoint( const Waypoint& wpt )
+QgsGPSData::WaypointIterator QgsGPSData::addWaypoint( const QgsWaypoint& wpt )
 {
   xMax = xMax > wpt.lon ? xMax : wpt.lon;
   xMin = xMin < wpt.lon ? xMin : wpt.lon;
@@ -246,15 +246,15 @@
 }
 
 
-GPSData::RouteIterator GPSData::addRoute( QString name )
+QgsGPSData::RouteIterator QgsGPSData::addRoute( QString name )
 {
-  Route rte;
+  QgsRoute rte;
   rte.name = name;
   return addRoute( rte );
 }
 
 
-GPSData::RouteIterator GPSData::addRoute( const Route& rte )
+QgsGPSData::RouteIterator QgsGPSData::addRoute( const QgsRoute& rte )
 {
   xMax = xMax > rte.xMax ? xMax : rte.xMax;
   xMin = xMin < rte.xMin ? xMin : rte.xMin;
@@ -266,15 +266,15 @@
 }
 
 
-GPSData::TrackIterator GPSData::addTrack( QString name )
+QgsGPSData::TrackIterator QgsGPSData::addTrack( QString name )
 {
-  Track trk;
+  QgsTrack trk;
   trk.name = name;
   return addTrack( trk );
 }
 
 
-GPSData::TrackIterator GPSData::addTrack( const Track& trk )
+QgsGPSData::TrackIterator QgsGPSData::addTrack( const QgsTrack& trk )
 {
   xMax = xMax > trk.xMax ? xMax : trk.xMax;
   xMin = xMin < trk.xMin ? xMin : trk.xMin;
@@ -286,7 +286,7 @@
 }
 
 
-void GPSData::removeWaypoints( const QgsFeatureIds & ids )
+void QgsGPSData::removeWaypoints( const QgsFeatureIds & ids )
 {
   QList<int> ids2 = ids.toList();
   qSort( ids2 );
@@ -307,7 +307,7 @@
 }
 
 
-void GPSData::removeRoutes( const QgsFeatureIds & ids )
+void QgsGPSData::removeRoutes( const QgsFeatureIds & ids )
 {
   QList<int> ids2 = ids.toList();
   qSort( ids2 );
@@ -327,7 +327,7 @@
 }
 
 
-void GPSData::removeTracks( const QgsFeatureIds & ids )
+void QgsGPSData::removeTracks( const QgsFeatureIds & ids )
 {
   QList<int> ids2 = ids.toList();
   qSort( ids2 );
@@ -347,7 +347,7 @@
 }
 
 
-void GPSData::writeXML( QTextStream& stream )
+void QgsGPSData::writeXML( QTextStream& stream )
 {
   stream.setCodec( QTextCodec::codecForName( "UTF8" ) );
   stream << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
@@ -364,7 +364,7 @@
 }
 
 
-GPSData* GPSData::getData( const QString& fileName )
+QgsGPSData* QgsGPSData::getData( const QString& fileName )
 {
   // if the data isn't there already, try to load it
   if ( dataObjects.find( fileName ) == dataObjects.end() )
@@ -375,16 +375,16 @@
       QgsLogger::warning( QObject::tr( "Couldn't open the data source: %1" ).arg( fileName ) );
       return 0;
     }
-    GPSData* data = new GPSData;
+    QgsGPSData* data = new QgsGPSData;
     QgsLogger::debug( "Loading file " + fileName );
-    GPXHandler handler( *data );
+    QgsGPXHandler handler( *data );
     bool failed = false;
 
     // SAX parsing
     XML_Parser p = XML_ParserCreate( NULL );
     XML_SetUserData( p, &handler );
-    XML_SetElementHandler( p, GPXHandler::start, GPXHandler::end );
-    XML_SetCharacterDataHandler( p, GPXHandler::chars );
+    XML_SetElementHandler( p, QgsGPXHandler::start, QgsGPXHandler::end );
+    XML_SetCharacterDataHandler( p, QgsGPXHandler::chars );
     long int bufsize = 10 * 1024 * 1024;
     char* buffer = new char[bufsize];
     int atEnd = 0;
@@ -409,7 +409,7 @@
 
     data->setNoDataExtent();
 
-    dataObjects[fileName] = std::pair<GPSData*, unsigned>( data, 0 );
+    dataObjects[fileName] = std::pair<QgsGPSData*, unsigned>( data, 0 );
   }
   else
     QgsLogger::debug( fileName + " is already loaded" );
@@ -417,11 +417,11 @@
   // return a pointer and increase the reference count for that file name
   DataMap::iterator iter = dataObjects.find( fileName );
   ++( iter->second.second );
-  return ( GPSData* )( iter->second.first );
+  return ( QgsGPSData* )( iter->second.first );
 }
 
 
-void GPSData::releaseData( const QString& fileName )
+void QgsGPSData::releaseData( const QString& fileName )
 {
 
   /* decrease the reference count for the file name (if it is used), and erase
@@ -441,25 +441,25 @@
 
 
 // we have to initialize the static member
-GPSData::DataMap GPSData::dataObjects;
+QgsGPSData::DataMap QgsGPSData::dataObjects;
 
 
 
 
-bool GPXHandler::startElement( const XML_Char* qName, const XML_Char** attr )
+bool QgsGPXHandler::startElement( const XML_Char* qName, const XML_Char** attr )
 {
 
   if ( !std::strcmp( qName, "gpx" ) )
   {
     parseModes.push( ParsingDocument );
-    mData = GPSData();
+    mData = QgsGPSData();
   }
 
   // top level objects
   else if ( !std::strcmp( qName, "wpt" ) )
   {
     parseModes.push( ParsingWaypoint );
-    mWpt = Waypoint();
+    mWpt = QgsWaypoint();
     for ( int i = 0; attr[2*i] != NULL; ++i )
     {
       if ( !std::strcmp( attr[2*i], "lat" ) )
@@ -472,13 +472,13 @@
   else if ( !std::strcmp( qName, "rte" ) )
   {
     parseModes.push( ParsingRoute );
-    mRte = Route();
+    mRte = QgsRoute();
     mObj = &mRte;
   }
   else if ( !std::strcmp( qName, "trk" ) )
   {
     parseModes.push( ParsingTrack );
-    mTrk = Track();
+    mTrk = QgsTrack();
     mObj = &mTrk;
   }
 
@@ -609,7 +609,7 @@
   {
     if ( parseModes.top() == ParsingRoute )
     {
-      mRtept = Routepoint();
+      mRtept = QgsRoutepoint();
       for ( int i = 0; attr[2*i] != NULL; ++i )
       {
         if ( !std::strcmp( attr[2*i], "lat" ) )
@@ -628,7 +628,7 @@
   {
     if ( parseModes.top() == ParsingTrack )
     {
-      mTrkseg = TrackSegment();
+      mTrkseg = QgsTrackSegment();
       parseModes.push( ParsingTrackSegment );
     }
     else
@@ -638,7 +638,7 @@
   {
     if ( parseModes.top() == ParsingTrackSegment )
     {
-      mTrkpt = Trackpoint();
+      mTrkpt = QgsTrackpoint();
       for ( int i = 0; attr[2*i] != NULL; ++i )
       {
         if ( !std::strcmp( attr[2*i], "lat" ) )
@@ -660,7 +660,7 @@
 }
 
 
-void GPXHandler::characters( const XML_Char* chars, int len )
+void QgsGPXHandler::characters( const XML_Char* chars, int len )
 {
   // This is horrible.
 #ifdef XML_UNICODE
@@ -672,7 +672,7 @@
 }
 
 
-bool GPXHandler::endElement( const std::string& qName )
+bool QgsGPXHandler::endElement( const std::string& qName )
 {
   if ( parseModes.top() == ParsingWaypoint )
   {

Modified: trunk/qgis/src/providers/gpx/gpsdata.h
===================================================================
--- trunk/qgis/src/providers/gpx/gpsdata.h	2009-12-07 17:42:55 UTC (rev 12354)
+++ trunk/qgis/src/providers/gpx/gpsdata.h	2009-12-07 17:50:47 UTC (rev 12355)
@@ -45,10 +45,10 @@
 /** This is the parent class for all GPS data classes (except tracksegment).
     It contains the variables that all GPS objects can have.
 */
-class GPSObject
+class QgsGPSObject
 {
   public:
-    virtual ~GPSObject() {};
+    virtual ~QgsGPSObject() {};
     QString xmlify( const QString& str );
     virtual void writeXML( QTextStream& stream );
     QString name, cmt, desc, src, url, urlname;
@@ -58,10 +58,10 @@
 /** This is the parent class for all GPS point classes. It contains common data
     members and common initialization code for all point classes.
 */
-class GPSPoint : public GPSObject
+class QgsGPSPoint : public QgsGPSObject
 {
   public:
-    GPSPoint();
+    QgsGPSPoint();
     virtual void writeXML( QTextStream& stream );
     double lat, lon, ele;
     QString sym;
@@ -71,10 +71,10 @@
 /** This is the parent class for all GPS object types that can have a nonempty
     bounding box (Route, Track). It contains common data members for all
     those classes. */
-class GPSExtended : public GPSObject
+class QgsGPSExtended : public QgsGPSObject
 {
   public:
-    GPSExtended();
+    QgsGPSExtended();
     virtual void writeXML( QTextStream& stream );
     double xMin, xMax, yMin, yMax;
     int number;
@@ -82,12 +82,12 @@
 
 
 // they both have the same data members in GPX, so...
-typedef GPSPoint Routepoint;
-typedef GPSPoint Trackpoint;
+typedef QgsGPSPoint QgsRoutepoint;
+typedef QgsGPSPoint QgsTrackpoint;
 
 
 /** This is the waypoint class. It is a GPSPoint with an ID. */
-class Waypoint : public GPSPoint
+class QgsWaypoint : public QgsGPSPoint
 {
   public:
     virtual void writeXML( QTextStream& stream );
@@ -97,11 +97,11 @@
 
 /** This class represents a GPS route.
  */
-class Route : public GPSExtended
+class QgsRoute : public QgsGPSExtended
 {
   public:
     virtual void writeXML( QTextStream& stream );
-    std::vector<Routepoint> points;
+    std::vector<QgsRoutepoint> points;
     int id;
 };
 
@@ -109,42 +109,42 @@
 /** This class represents a GPS track segment, which is a contiguous part of
     a track. See the GPX specification for a better explanation.
 */
-class TrackSegment
+class QgsTrackSegment
 {
   public:
-    std::vector<Trackpoint> points;
+    std::vector<QgsTrackpoint> points;
 };
 
 
 /** This class represents a GPS tracklog. It consists of 0 or more track
     segments.
 */
-class Track : public GPSExtended
+class QgsTrack : public QgsGPSExtended
 {
   public:
     virtual void writeXML( QTextStream& stream );
-    std::vector<TrackSegment> segments;
+    std::vector<QgsTrackSegment> segments;
     int id;
 };
 
 
 /** This class represents a set of GPS data, for example a GPS layer in QGIS.
  */
-class GPSData
+class QgsGPSData
 {
   public:
 
     /** This iterator type is used to iterate over waypoints. */
-    typedef std::list<Waypoint>::iterator WaypointIterator;
+    typedef std::list<QgsWaypoint>::iterator WaypointIterator;
     /** This iterator type is used to iterate over routes. */
-    typedef std::list<Route>::iterator RouteIterator;
+    typedef std::list<QgsRoute>::iterator RouteIterator;
     /** This iterator type is used to iterate over tracks. */
-    typedef std::list<Track>::iterator TrackIterator;
+    typedef std::list<QgsTrack>::iterator TrackIterator;
 
 
     /** This constructor initializes the extent to a nonsense value. Don't try
         to use a GPSData object in QGIS without parsing a datafile into it. */
-    GPSData();
+    QgsGPSData();
 
     /** This function returns a pointer to a dynamically allocated QgsRectangle
         which is the bounding box for this dataset. You'll have to deallocate it
@@ -190,19 +190,19 @@
     WaypointIterator addWaypoint( double lat, double lon, QString name = "",
                                   double ele = -std::numeric_limits<double>::max() );
 
-    WaypointIterator addWaypoint( const Waypoint& wpt );
+    WaypointIterator addWaypoint( const QgsWaypoint& wpt );
 
     /** This function tries to add a new route. It returns an iterator to the
         new route. */
     RouteIterator addRoute( QString name = "" );
 
-    RouteIterator addRoute( const Route& rte );
+    RouteIterator addRoute( const QgsRoute& rte );
 
     /** This function tries to add a new track. An iterator to the new track
         will be returned. */
     TrackIterator addTrack( QString name = "" );
 
-    TrackIterator addTrack( const Track& trk );
+    TrackIterator addTrack( const QgsTrack& trk );
 
     /** This function removes the waypoints whose IDs are in the list. */
     void removeWaypoints( const QgsFeatureIds & ids );
@@ -226,7 +226,7 @@
         function you should also call releaseData() with the same @c file name
         when you're done with the GPSData pointer, otherwise the data will stay
         in memory forever and you will get an ugly memory leak. */
-    static GPSData* getData( const QString& fileName );
+    static QgsGPSData* getData( const QString& fileName );
 
     /** Call this function when you're done with a GPSData pointer that you
         got earlier using getData(). Do NOT call this function if you haven't
@@ -240,15 +240,15 @@
 
   protected:
 
-    std::list<Waypoint> waypoints;
-    std::list<Route> routes;
-    std::list<Track> tracks;
+    std::list<QgsWaypoint> waypoints;
+    std::list<QgsRoute> routes;
+    std::list<QgsTrack> tracks;
     int nextWaypoint, nextRoute, nextTrack;
 
     double xMin, xMax, yMin, yMax;
 
     /** This is used internally to store GPS data objects (one per file). */
-    typedef std::map<QString, std::pair<GPSData*, unsigned> > DataMap;
+    typedef std::map<QString, std::pair<QgsGPSData*, unsigned> > DataMap;
 
     /** This is the static container that maps file names to GPSData objects and
         does reference counting, so several providers can use the same GPSData
@@ -259,11 +259,11 @@
 
 
 
-class GPXHandler
+class QgsGPXHandler
 {
   public:
 
-    GPXHandler( GPSData& data ) : mData( data ) { }
+    QgsGPXHandler( QgsGPSData& data ) : mData( data ) { }
 
     /** This function is called when expat encounters a new start element in
         the XML stream. */
@@ -281,15 +281,15 @@
     // it does not know about member functions)
     static void start( void* data, const XML_Char* el, const XML_Char** attr )
     {
-      static_cast<GPXHandler*>( data )->startElement( el, attr );
+      static_cast<QgsGPXHandler*>( data )->startElement( el, attr );
     }
     static void end( void* data, const XML_Char* el )
     {
-      static_cast<GPXHandler*>( data )->endElement( el );
+      static_cast<QgsGPXHandler*>( data )->endElement( el );
     }
     static void chars( void* data, const XML_Char* chars, int len )
     {
-      static_cast<GPXHandler*>( data )->characters( chars, len );
+      static_cast<QgsGPXHandler*>( data )->characters( chars, len );
     }
 
   private:
@@ -312,14 +312,14 @@
     /** This is used to keep track of what kind of data we are parsing. */
     std::stack<ParseMode> parseModes;
 
-    GPSData& mData;
-    Waypoint mWpt;
-    Route mRte;
-    Track mTrk;
-    Routepoint mRtept;
-    TrackSegment mTrkseg;
-    Trackpoint mTrkpt;
-    GPSObject* mObj;
+    QgsGPSData& mData;
+    QgsWaypoint mWpt;
+    QgsRoute mRte;
+    QgsTrack mTrk;
+    QgsRoutepoint mRtept;
+    QgsTrackSegment mTrkseg;
+    QgsTrackpoint mTrkpt;
+    QgsGPSObject* mObj;
     QString* mString;
     double* mDouble;
     int* mInt;

Modified: trunk/qgis/src/providers/gpx/qgsgpxprovider.cpp
===================================================================
--- trunk/qgis/src/providers/gpx/qgsgpxprovider.cpp	2009-12-07 17:42:55 UTC (rev 12354)
+++ trunk/qgis/src/providers/gpx/qgsgpxprovider.cpp	2009-12-07 17:50:47 UTC (rev 12355)
@@ -98,7 +98,7 @@
   mSelectionRectangle = 0;
 
   // parse the file
-  data = GPSData::getData( mFileName );
+  data = QgsGPSData::getData( mFileName );
   if ( data == 0 )
   {
     return;
@@ -110,7 +110,7 @@
 
 QgsGPXProvider::~QgsGPXProvider()
 {
-  GPSData::releaseData( mFileName );
+  QgsGPSData::releaseData( mFileName );
   delete mSelectionRectangle;
 }
 
@@ -140,7 +140,7 @@
     // the bounds rectangle
     for ( ; mWptIter != data->waypointsEnd(); ++mWptIter )
     {
-      const Waypoint* wpt;
+      const QgsWaypoint* wpt;
       wpt = &( *mWptIter );
       if ( boundsCheck( wpt->lon, wpt->lat ) )
       {
@@ -205,7 +205,7 @@
     // rectangle
     for ( ; mRteIter != data->routesEnd(); ++mRteIter )
     {
-      const Route* rte;
+      const QgsRoute* rte;
       rte = &( *mRteIter );
 
       if ( rte->points.size() == 0 )
@@ -298,7 +298,7 @@
     // rectangle
     for ( ; mTrkIter != data->tracksEnd(); ++mTrkIter )
     {
-      const Track* trk;
+      const QgsTrack* trk;
       trk = &( *mTrkIter );
 
       QgsLogger::debug( "GPX feature track segments: ", trk->segments.size(), __FILE__, __FUNCTION__, __LINE__ );
@@ -307,7 +307,7 @@
 
       // A track consists of several segments. Add all those segments into one.
       int totalPoints = 0;;
-      for ( std::vector<TrackSegment>::size_type i = 0; i < trk->segments.size(); i ++ )
+      for ( std::vector<QgsTrackSegment>::size_type i = 0; i < trk->segments.size(); i ++ )
       {
         totalPoints += trk->segments[i].points.size();
       }
@@ -331,7 +331,7 @@
         std::memcpy( geo + 5, &totalPoints, 4 );
 
         int thisPoint = 0;
-        for ( std::vector<TrackSegment>::size_type k = 0; k < trk->segments.size(); k++ )
+        for ( std::vector<QgsTrackSegment>::size_type k = 0; k < trk->segments.size(); k++ )
         {
           int nPoints = trk->segments[k].points.size();
           for ( int i = 0; i < nPoints; ++i )
@@ -530,7 +530,7 @@
   unsigned char* geo = f.geometry()->asWkb();
   QGis::WkbType wkbType = f.geometry()->wkbType();
   bool success = false;
-  GPSObject* obj = NULL;
+  QgsGPSObject* obj = NULL;
   const QgsAttributeMap& attrs( f.attributeMap() );
   QgsAttributeMap::const_iterator it;
 
@@ -539,7 +539,7 @@
   {
 
     // add geometry
-    Waypoint wpt;
+    QgsWaypoint wpt;
     std::memcpy( &wpt.lon, geo + 5, sizeof( double ) );
     std::memcpy( &wpt.lat, geo + 13, sizeof( double ) );
 
@@ -559,7 +559,7 @@
       }
     }
 
-    GPSData::WaypointIterator iter = data->addWaypoint( wpt );
+    QgsGPSData::WaypointIterator iter = data->addWaypoint( wpt );
     success = true;
     obj = &( *iter );
   }
@@ -568,7 +568,7 @@
   if ( mFeatureType == RouteType && geo != NULL && wkbType == QGis::WKBLineString )
   {
 
-    Route rte;
+    QgsRoute rte;
 
     // reset bounds
     rte.xMin = std::numeric_limits<double>::max();
@@ -584,7 +584,7 @@
       double lat, lon;
       std::memcpy( &lon, geo + 9 + 16 * i, sizeof( double ) );
       std::memcpy( &lat, geo + 9 + 16 * i + 8, sizeof( double ) );
-      Routepoint rtept;
+      QgsRoutepoint rtept;
       rtept.lat = lat;
       rtept.lon = lon;
       rte.points.push_back( rtept );
@@ -606,7 +606,7 @@
       }
     }
 
-    GPSData::RouteIterator iter = data->addRoute( rte );
+    QgsGPSData::RouteIterator iter = data->addRoute( rte );
     success = true;
     obj = &( *iter );
   }
@@ -615,8 +615,8 @@
   if ( mFeatureType == TrackType && geo != NULL && wkbType == QGis::WKBLineString )
   {
 
-    Track trk;
-    TrackSegment trkseg;
+    QgsTrack trk;
+    QgsTrackSegment trkseg;
 
     // reset bounds
     trk.xMin = std::numeric_limits<double>::max();
@@ -632,7 +632,7 @@
       double lat, lon;
       std::memcpy( &lon, geo + 9 + 16 * i, sizeof( double ) );
       std::memcpy( &lat, geo + 9 + 16 * i + 8, sizeof( double ) );
-      Trackpoint trkpt;
+      QgsTrackpoint trkpt;
       trkpt.lat = lat;
       trkpt.lon = lon;
       trkseg.points.push_back( trkpt );
@@ -655,7 +655,7 @@
     }
 
     trk.segments.push_back( trkseg );
-    GPSData::TrackIterator iter = data->addTrack( trk );
+    QgsGPSData::TrackIterator iter = data->addTrack( trk );
     success = true;
     obj = &( *iter );
   }
@@ -721,7 +721,7 @@
   QgsChangedAttributesMap::const_iterator aIter = attr_map.begin();
   if ( mFeatureType == WaypointType )
   {
-    GPSData::WaypointIterator wIter = data->waypointsBegin();
+    QgsGPSData::WaypointIterator wIter = data->waypointsBegin();
     for ( ; wIter != data->waypointsEnd() && aIter != attr_map.end(); ++wIter )
     {
       if ( wIter->id == aIter.key() )
@@ -733,7 +733,7 @@
   }
   else if ( mFeatureType == RouteType )
   {
-    GPSData::RouteIterator rIter = data->routesBegin();
+    QgsGPSData::RouteIterator rIter = data->routesBegin();
     for ( ; rIter != data->routesEnd() && aIter != attr_map.end(); ++rIter )
     {
       if ( rIter->id == aIter.key() )
@@ -745,7 +745,7 @@
   }
   if ( mFeatureType == TrackType )
   {
-    GPSData::TrackIterator tIter = data->tracksBegin();
+    QgsGPSData::TrackIterator tIter = data->tracksBegin();
     for ( ; tIter != data->tracksEnd() && aIter != attr_map.end(); ++tIter )
     {
       if ( tIter->id == aIter.key() )
@@ -766,7 +766,7 @@
 }
 
 
-void QgsGPXProvider::changeAttributeValues( GPSObject& obj, const QgsAttributeMap& attrs )
+void QgsGPXProvider::changeAttributeValues( QgsGPSObject& obj, const QgsAttributeMap& attrs )
 {
   QgsAttributeMap::const_iterator aIter;
 
@@ -785,7 +785,7 @@
     obj.urlname = attrs[URLNameAttr].toString();
 
   // waypoint-specific attributes
-  Waypoint* wpt = dynamic_cast<Waypoint*>( &obj );
+  QgsWaypoint* wpt = dynamic_cast<QgsWaypoint*>( &obj );
   if ( wpt != NULL )
   {
     if ( attrs.contains( SymAttr ) )
@@ -800,7 +800,7 @@
   }
 
   // route- and track-specific attributes
-  GPSExtended* ext = dynamic_cast<GPSExtended*>( &obj );
+  QgsGPSExtended* ext = dynamic_cast<QgsGPSExtended*>( &obj );
   if ( ext != NULL )
   {
     if ( attrs.contains( NumAttr ) )

Modified: trunk/qgis/src/providers/gpx/qgsgpxprovider.h
===================================================================
--- trunk/qgis/src/providers/gpx/qgsgpxprovider.h	2009-12-07 17:42:55 UTC (rev 12354)
+++ trunk/qgis/src/providers/gpx/qgsgpxprovider.h	2009-12-07 17:50:47 UTC (rev 12355)
@@ -26,7 +26,7 @@
 class QgsField;
 class QFile;
 class QDomDocument;
-class GPSData;
+class QgsGPSData;
 
 
 /**
@@ -144,7 +144,7 @@
 
     /* new functions */
 
-    void changeAttributeValues( GPSObject& obj,
+    void changeAttributeValues( QgsGPSObject& obj,
                                 const QgsAttributeMap& attrs );
 
     /** Adds one feature (used by addFeatures()) */
@@ -162,7 +162,7 @@
 
   private:
 
-    GPSData* data;
+    QgsGPSData* data;
 
     //! Fields
     QgsFieldMap attributeFields;
@@ -180,11 +180,11 @@
     long mNumberFeatures;
 
     //! Current waypoint iterator
-    GPSData::WaypointIterator mWptIter;
+    QgsGPSData::WaypointIterator mWptIter;
     //! Current route iterator
-    GPSData::RouteIterator mRteIter;
+    QgsGPSData::RouteIterator mRteIter;
     //! Current track iterator
-    GPSData::TrackIterator mTrkIter;
+    QgsGPSData::TrackIterator mTrkIter;
 
     struct wkbPoint
     {



More information about the QGIS-commit mailing list