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
This commit is contained in:
mhugent 2006-08-24 14:27:16 +00:00
parent f880882db4
commit 5891b1f964
2 changed files with 11 additions and 4 deletions

View File

@ -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;
}

View File

@ -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
@ -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)
{
@ -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;
@ -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;
@ -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;
@ -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;
@ -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);