Skip to content

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎src/providers/gpx/qgsgpxprovider.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ bool QgsGPXProvider::getNextFeature(QgsFeature* feature,
223223
char* geo = new char[21];
224224
std::memset(geo, 0, 21);
225225
geo[0] = endian();
226-
geo[1] = 1;
226+
geo[geo[0] == NDR ? 1 : 4] = QGis::WKBPoint;
227227
std::memcpy(geo+5, &wpt->lon, sizeof(double));
228228
std::memcpy(geo+13, &wpt->lat, sizeof(double));
229229
feature->setGeometryAndOwnership((unsigned char *)geo, sizeof(wkbPoint));
@@ -288,7 +288,7 @@ bool QgsGPXProvider::getNextFeature(QgsFeature* feature,
288288
char* geo = new char[9 + 16 * nPoints];
289289
std::memset(geo, 0, 9 + 16 * nPoints);
290290
geo[0] = endian();
291-
geo[1] = 2;
291+
geo[geo[0] == NDR ? 1 : 4] = QGis::WKBLineString;
292292
std::memcpy(geo + 5, &nPoints, 4);
293293
for (int i = 0; i < rte->points.size(); ++i) {
294294
std::memcpy(geo + 9 + 16 * i, &rte->points[i].lon, sizeof(double));
@@ -347,7 +347,7 @@ bool QgsGPXProvider::getNextFeature(QgsFeature* feature,
347347
char* geo = new char[9 + 16 * nPoints];
348348
std::memset(geo, 0, 9 + 16 * nPoints);
349349
geo[0] = endian();
350-
geo[1] = 2;
350+
geo[geo[0] == NDR ? 1 : 4] = QGis::WKBLineString;
351351
std::memcpy(geo + 5, &nPoints, 4);
352352
for (int i = 0; i < nPoints; ++i) {
353353
std::memcpy(geo + 9 + 16 * i, &trk->segments[0].points[i].lon, sizeof(double));
@@ -574,7 +574,7 @@ bool QgsGPXProvider::addFeature(QgsFeature* f) {
574574
const std::vector<QgsFeatureAttribute>& attrs(f->attributeMap());
575575

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

579579
// add geometry
580580
Waypoint wpt;
@@ -600,7 +600,7 @@ bool QgsGPXProvider::addFeature(QgsFeature* f) {
600600
}
601601

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

605605
Route rte;
606606

@@ -643,7 +643,7 @@ bool QgsGPXProvider::addFeature(QgsFeature* f) {
643643
}
644644

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

648648
Track trk;
649649
TrackSegment trkseg;

0 commit comments

Comments
 (0)
Please sign in to comment.