[geos-commits] r3766 - in branches/3.3: . src/io

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Feb 21 02:25:43 PST 2013


Author: strk
Date: 2013-02-21 02:25:43 -0800 (Thu, 21 Feb 2013)
New Revision: 3766

Modified:
   branches/3.3/NEWS
   branches/3.3/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: branches/3.3/NEWS
===================================================================
--- branches/3.3/NEWS	2013-02-15 13:46:57 UTC (rev 3765)
+++ branches/3.3/NEWS	2013-02-21 10:25:43 UTC (rev 3766)
@@ -4,6 +4,7 @@
 - Bug fixes / improvements
     - IsValidOp: throw proper error on nested shells (#608)
     - Fix header guards (#617, #618, #619)
+    - WKTWriter::appendCoordinate optimisation
 
 Changes in 3.3.7
 2013-01-22 

Modified: branches/3.3/src/io/WKTWriter.cpp
===================================================================
--- branches/3.3/src/io/WKTWriter.cpp	2013-02-15 13:46:57 UTC (rev 3765)
+++ branches/3.3/src/io/WKTWriter.cpp	2013-02-21 10:25:43 UTC (rev 3766)
@@ -314,24 +314,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