Skip to content

Commit

Permalink
Take endianness of feature type into account in GPX provider.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@5597 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
telwertowski committed Jul 14, 2006
1 parent bf4ca6f commit d325253
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/providers/gpx/qgsgpxprovider.cpp
Expand Up @@ -223,7 +223,7 @@ bool QgsGPXProvider::getNextFeature(QgsFeature* feature,
char* geo = new char[21];
std::memset(geo, 0, 21);
geo[0] = endian();
geo[1] = 1;
geo[geo[0] == NDR ? 1 : 4] = QGis::WKBPoint;
std::memcpy(geo+5, &wpt->lon, sizeof(double));
std::memcpy(geo+13, &wpt->lat, sizeof(double));
feature->setGeometryAndOwnership((unsigned char *)geo, sizeof(wkbPoint));
Expand Down Expand Up @@ -288,7 +288,7 @@ bool QgsGPXProvider::getNextFeature(QgsFeature* feature,
char* geo = new char[9 + 16 * nPoints];
std::memset(geo, 0, 9 + 16 * nPoints);
geo[0] = endian();
geo[1] = 2;
geo[geo[0] == NDR ? 1 : 4] = QGis::WKBLineString;
std::memcpy(geo + 5, &nPoints, 4);
for (int i = 0; i < rte->points.size(); ++i) {
std::memcpy(geo + 9 + 16 * i, &rte->points[i].lon, sizeof(double));
Expand Down Expand Up @@ -347,7 +347,7 @@ bool QgsGPXProvider::getNextFeature(QgsFeature* feature,
char* geo = new char[9 + 16 * nPoints];
std::memset(geo, 0, 9 + 16 * nPoints);
geo[0] = endian();
geo[1] = 2;
geo[geo[0] == NDR ? 1 : 4] = QGis::WKBLineString;
std::memcpy(geo + 5, &nPoints, 4);
for (int i = 0; i < nPoints; ++i) {
std::memcpy(geo + 9 + 16 * i, &trk->segments[0].points[i].lon, sizeof(double));
Expand Down Expand Up @@ -574,7 +574,7 @@ bool QgsGPXProvider::addFeature(QgsFeature* f) {
const std::vector<QgsFeatureAttribute>& attrs(f->attributeMap());

// is it a waypoint?
if (mFeatureType == WaypointType && geo != NULL && geo[1] == 1) {
if (mFeatureType == WaypointType && geo != NULL && geo[geo[0] == NDR ? 1 : 4] == QGis::WKBPoint) {

// add geometry
Waypoint wpt;
Expand All @@ -600,7 +600,7 @@ bool QgsGPXProvider::addFeature(QgsFeature* f) {
}

// is it a route?
if (mFeatureType == RouteType && geo != NULL && geo[1] == 2) {
if (mFeatureType == RouteType && geo != NULL && geo[geo[0] == NDR ? 1 : 4] == QGis::WKBLineString) {

Route rte;

Expand Down Expand Up @@ -643,7 +643,7 @@ bool QgsGPXProvider::addFeature(QgsFeature* f) {
}

// is it a track?
if (mFeatureType == TrackType && geo != NULL && geo[1] == 2) {
if (mFeatureType == TrackType && geo != NULL && geo[geo[0] == NDR ? 1 : 4] == QGis::WKBLineString) {

Track trk;
TrackSegment trkseg;
Expand Down

0 comments on commit d325253

Please sign in to comment.