[OpenLayers-Commits] r12160 - in trunk/openlayers: lib/OpenLayers/Format tests/Format

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Jul 7 12:41:03 EDT 2011


Author: bartvde
Date: 2011-07-07 09:41:02 -0700 (Thu, 07 Jul 2011)
New Revision: 12160

Modified:
   trunk/openlayers/lib/OpenLayers/Format/WKT.js
   trunk/openlayers/tests/Format/WKT.html
Log:
WKT parser should still support the old signature of multipoints without separating parens, thanks to ronan for the patch, p=ronan,r=me (pullup #2670)

Modified: trunk/openlayers/lib/OpenLayers/Format/WKT.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Format/WKT.js	2011-07-07 14:55:09 UTC (rev 12159)
+++ trunk/openlayers/lib/OpenLayers/Format/WKT.js	2011-07-07 16:41:02 UTC (rev 12160)
@@ -276,7 +276,7 @@
          */
         'multipoint': function(str) {
             var point;
-            var points = OpenLayers.String.trim(str).split(this.regExes.parenComma);
+            var points = OpenLayers.String.trim(str).split(',');
             var components = [];
             for(var i=0, len=points.length; i<len; ++i) {
                 point = points[i].replace(this.regExes.trimParens, '$1');

Modified: trunk/openlayers/tests/Format/WKT.html
===================================================================
--- trunk/openlayers/tests/Format/WKT.html	2011-07-07 14:55:09 UTC (rev 12159)
+++ trunk/openlayers/tests/Format/WKT.html	2011-07-07 16:41:02 UTC (rev 12160)
@@ -188,7 +188,7 @@
     }
 
     function test_Format_WKT_read(t) { 
-        t.plan(12); 
+        t.plan(13); 
 
         var format = new OpenLayers.Format.WKT(); 
          
@@ -204,7 +204,14 @@
         // test a multipoint 
         t.ok(multipoint.geometry.equals(format.read(format.write(multipoint)).geometry), 
              "format correctly reads MultiPoint WKT"); 
- 
+
+        // test a multipoint without separating parens 
+        t.ok(multipoint.geometry.equals(format.read( 
+ 	        "MULTIPOINT(" + points[0].geometry.x + " " + points[0].geometry.y + "," +  
+                            points[1].geometry.x + " " + points[1].geometry.y + "," +  
+                            points[2].geometry.x + " " + points[2].geometry.y + ")").geometry), 
+            "format correctly reads MultiPoint WKT without parens");
+
         // test a linestring 
         t.ok(linestrings[0].geometry.equals(format.read(format.write(linestrings[0])).geometry), 
              "format correctly reads LineString WKT"); 



More information about the Commits mailing list