[geos-commits] r2824 - in trunk/source: headers/geos/util io

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Dec 14 10:23:13 EST 2009


Author: mloskot
Date: 2009-12-14 10:23:12 -0500 (Mon, 14 Dec 2009)
New Revision: 2824

Modified:
   trunk/source/headers/geos/util/TopologyException.h
   trunk/source/io/WKTWriter.cpp
Log:
* Fixed bug in WKTWriter that was dropping geometry tag in string representation of geometry
* Improved message carried by TopologyException

Modified: trunk/source/headers/geos/util/TopologyException.h
===================================================================
--- trunk/source/headers/geos/util/TopologyException.h	2009-12-11 13:17:01 UTC (rev 2823)
+++ trunk/source/headers/geos/util/TopologyException.h	2009-12-14 15:23:12 UTC (rev 2824)
@@ -47,7 +47,7 @@
 
 	TopologyException(const std::string& msg, const geom::Coordinate& newPt)
 		:
-		GEOSException("TopologyException", msg+" "+newPt.toString()),
+		GEOSException("TopologyException", msg + " at " + newPt.toString()),
 		pt(newPt)
 	{}
 

Modified: trunk/source/io/WKTWriter.cpp
===================================================================
--- trunk/source/io/WKTWriter.cpp	2009-12-11 13:17:01 UTC (rev 2823)
+++ trunk/source/io/WKTWriter.cpp	2009-12-14 15:23:12 UTC (rev 2824)
@@ -58,7 +58,8 @@
 string
 WKTWriter::toLineString(const CoordinateSequence& seq)
 {
-	stringstream buf("LINESTRING ", ios_base::in|ios_base::out);
+	stringstream buf(ios_base::in|ios_base::out);
+    buf << "LINESTRING ";
 	unsigned int npts = seq.getSize();
 	if ( npts == 0 )
 	{
@@ -85,8 +86,8 @@
 string
 WKTWriter::toLineString(const Coordinate& p0, const Coordinate& p1)
 {
-	stringstream ret("LINESTRING (", ios_base::in|ios_base::out);
-	ret << p0.x << " " << p0.y;
+	stringstream ret(ios_base::in|ios_base::out);
+	ret << "LINESTRING (" << p0.x << " " << p0.y;
 #if PRINT_Z
 	ret << " " << p0.z;
 #endif
@@ -94,6 +95,7 @@
 #if PRINT_Z
 	ret << " " << p1.z;
 #endif
+    ret << ")";
 
 	return ret.str();
 }
@@ -102,7 +104,8 @@
 string
 WKTWriter::toPoint(const Coordinate& p0)
 {
-	stringstream ret("POINT (", ios_base::in|ios_base::out);
+	stringstream ret(ios_base::in|ios_base::out);
+    ret << "POINT (";
 #if PRINT_Z
 	ret << p0.x << " " << p0.y  << " " << p0.z << " )";
 #else



More information about the geos-commits mailing list