Skip to content

Commit

Permalink
fixed a bug in QgsGeometry wkt export and made QgsDataProvider::endia…
Browse files Browse the repository at this point in the history
…n() const

git-svn-id: http://svn.osgeo.org/qgis/trunk@5732 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Aug 24, 2006
1 parent f880882 commit 5891b1f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core/qgsdataprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class QgsDataProvider : public QObject
data as stored persistently instead of local hardware architecture
endian-ness.
*/
virtual endian_t endian()
virtual endian_t endian() const
{
return (htonl(1) == 1) ? XDR : NDR;
}
Expand Down
13 changes: 10 additions & 3 deletions src/core/qgsgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ email : morb at ozemail dot com dot au

#include "qgis.h"
#include "qgsgeometry.h"
#include "qgslogger.h"


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

bool QgsGeometry::exportToWkt(unsigned char * geom) const
{
#ifdef QGISDEBUG
std::cout << "QgsGeometry::exportToWkt: entered." << std::endl;
#endif
QgsDebugMsg("QgsGeometry::exportToWkt: entered");

if(geom)
{
Expand All @@ -2133,6 +2132,7 @@ bool QgsGeometry::exportToWkt(unsigned char * geom) const
}
case QGis::WKBLineString:
{
QgsDebugMsg("QgsGeometry::exportToWkt: LINESTRING found");
unsigned char *ptr;
int *nPoints;
int idx;
Expand Down Expand Up @@ -2161,6 +2161,7 @@ bool QgsGeometry::exportToWkt(unsigned char * geom) const
}
case QGis::WKBPolygon:
{
QgsDebugMsg("QgsGeometry::exportToWkt: POLYGON found");
unsigned char *ptr;
int idx, jdx;
int *numRings, *nPoints;
Expand Down Expand Up @@ -2240,6 +2241,7 @@ bool QgsGeometry::exportToWkt(unsigned char * geom) const

case QGis::WKBMultiLineString:
{
QgsDebugMsg("QgsGeometry::exportToWkt: MULTILINESTRING found");
unsigned char *ptr;
int idx, jdx, numLineStrings;
int *nPoints;
Expand Down Expand Up @@ -2279,6 +2281,7 @@ bool QgsGeometry::exportToWkt(unsigned char * geom) const

case QGis::WKBMultiPolygon:
{
QgsDebugMsg("QgsGeometry::exportToWkt: MULTIPOLYGON found");
unsigned char *ptr;
int idx, jdx, kdx;
int *numPolygons, *numRings, *nPoints;
Expand Down Expand Up @@ -2308,6 +2311,10 @@ bool QgsGeometry::exportToWkt(unsigned char * geom) const
ptr += 4;
for (jdx = 0; jdx < *nPoints; jdx++)
{
if(jdx!=0)
{
mWkt+=",";
}
x = (double *) ptr;
mWkt+=QString::number(*x,'f',6);
ptr += sizeof(double);
Expand Down

0 comments on commit 5891b1f

Please sign in to comment.