[geos-commits] r3767 - trunk/src/io

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Feb 21 02:29:19 PST 2013


Author: strk
Date: 2013-02-21 02:29:19 -0800 (Thu, 21 Feb 2013)
New Revision: 3767

Modified:
   trunk/src/io/WKTWriter.cpp
Log:
WKTWriter::appendCoordinate optimisation

Modified the WKTWriter::appendCoordinate method to not create an
intermediate std::string, but instead write directly into the Writer
object. The result is a small performance improvement.

Patch by Mats Taraldsvik <mats.taraldsvik at norkart.no>

Modified: trunk/src/io/WKTWriter.cpp
===================================================================
--- trunk/src/io/WKTWriter.cpp	2013-02-21 10:25:43 UTC (rev 3766)
+++ trunk/src/io/WKTWriter.cpp	2013-02-21 10:29:19 UTC (rev 3767)
@@ -313,24 +313,22 @@
 	}
 }
 
-/* pritected */
+/* protected */
 void
 WKTWriter::appendCoordinate(const Coordinate* coordinate,
 		Writer *writer)
 {
-	string out="";
-	out+=writeNumber(coordinate->x);
-	out+=" ";
-	out+=writeNumber(coordinate->y);
-    if( outputDimension == 3 )
-    {
-        out+=" ";
-        if( ISNAN(coordinate->z) )
-            out+=writeNumber(0.0);
-        else
-            out+=writeNumber(coordinate->z);
-    }
-	writer->write(out);
+	writer->write(writeNumber(coordinate->x));
+	writer->write(" ");
+	writer->write(writeNumber(coordinate->y));
+	if( outputDimension == 3 )
+	{
+		writer->write(" ");
+		if( ISNAN(coordinate->z) )
+			writer->write(writeNumber(0.0));
+		else
+			writer->write(writeNumber(coordinate->z));
+	}
 }
 
 /* protected */



More information about the geos-commits mailing list