Skip to content

Commit 5891b1f

Browse files
author
mhugent
committed
fixed a bug in QgsGeometry wkt export and made QgsDataProvider::endian() const
git-svn-id: http://svn.osgeo.org/qgis/trunk@5732 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent f880882 commit 5891b1f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/core/qgsdataprovider.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class QgsDataProvider : public QObject
153153
data as stored persistently instead of local hardware architecture
154154
endian-ness.
155155
*/
156-
virtual endian_t endian()
156+
virtual endian_t endian() const
157157
{
158158
return (htonl(1) == 1) ? XDR : NDR;
159159
}

src/core/qgsgeometry.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ email : morb at ozemail dot com dot au
1818

1919
#include "qgis.h"
2020
#include "qgsgeometry.h"
21+
#include "qgslogger.h"
2122

2223

2324
// Set up static GEOS geometry factory
@@ -2106,9 +2107,7 @@ bool QgsGeometry::contains(QgsPoint* p) const
21062107

21072108
bool QgsGeometry::exportToWkt(unsigned char * geom) const
21082109
{
2109-
#ifdef QGISDEBUG
2110-
std::cout << "QgsGeometry::exportToWkt: entered." << std::endl;
2111-
#endif
2110+
QgsDebugMsg("QgsGeometry::exportToWkt: entered");
21122111

21132112
if(geom)
21142113
{
@@ -2133,6 +2132,7 @@ bool QgsGeometry::exportToWkt(unsigned char * geom) const
21332132
}
21342133
case QGis::WKBLineString:
21352134
{
2135+
QgsDebugMsg("QgsGeometry::exportToWkt: LINESTRING found");
21362136
unsigned char *ptr;
21372137
int *nPoints;
21382138
int idx;
@@ -2161,6 +2161,7 @@ bool QgsGeometry::exportToWkt(unsigned char * geom) const
21612161
}
21622162
case QGis::WKBPolygon:
21632163
{
2164+
QgsDebugMsg("QgsGeometry::exportToWkt: POLYGON found");
21642165
unsigned char *ptr;
21652166
int idx, jdx;
21662167
int *numRings, *nPoints;
@@ -2240,6 +2241,7 @@ bool QgsGeometry::exportToWkt(unsigned char * geom) const
22402241

22412242
case QGis::WKBMultiLineString:
22422243
{
2244+
QgsDebugMsg("QgsGeometry::exportToWkt: MULTILINESTRING found");
22432245
unsigned char *ptr;
22442246
int idx, jdx, numLineStrings;
22452247
int *nPoints;
@@ -2279,6 +2281,7 @@ bool QgsGeometry::exportToWkt(unsigned char * geom) const
22792281

22802282
case QGis::WKBMultiPolygon:
22812283
{
2284+
QgsDebugMsg("QgsGeometry::exportToWkt: MULTIPOLYGON found");
22822285
unsigned char *ptr;
22832286
int idx, jdx, kdx;
22842287
int *numPolygons, *numRings, *nPoints;
@@ -2308,6 +2311,10 @@ bool QgsGeometry::exportToWkt(unsigned char * geom) const
23082311
ptr += 4;
23092312
for (jdx = 0; jdx < *nPoints; jdx++)
23102313
{
2314+
if(jdx!=0)
2315+
{
2316+
mWkt+=",";
2317+
}
23112318
x = (double *) ptr;
23122319
mWkt+=QString::number(*x,'f',6);
23132320
ptr += sizeof(double);

0 commit comments

Comments
 (0)