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)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12160 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2011-07-07 16:41:02 +00:00
parent 2809bc30b5
commit fdd7843a6a
2 changed files with 10 additions and 3 deletions

View File

@@ -276,7 +276,7 @@ OpenLayers.Format.WKT = OpenLayers.Class(OpenLayers.Format, {
*/
'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');

View File

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