WKT Format reprojects geometrycollection components twice. Fixed by anonymous

contributor. (Closes #1554) 


git-svn-id: http://svn.openlayers.org/trunk/openlayers@7413 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-06-21 13:09:23 +00:00
parent 96aa44f516
commit e4ada9ea2f
2 changed files with 25 additions and 2 deletions

View File

@@ -67,7 +67,9 @@ OpenLayers.Format.WKT = OpenLayers.Class(OpenLayers.Format, {
features.CLASS_NAME == "OpenLayers.Feature.Vector") {
features.geometry.transform(this.externalProjection,
this.internalProjection);
} else if (features && typeof features == "object") {
} else if (features &&
type != "geometrycollection" &&
typeof features == "object") {
for (var i = 0; i < features.length; i++) {
var component = features[i];
component.geometry.transform(this.externalProjection,

View File

@@ -216,8 +216,29 @@
}
function test_Format_WKT_read_projection(t) {
t.plan(1);
var projections = {
src: new OpenLayers.Projection("EPSG:4326"),
dest: new OpenLayers.Projection("EPSG:900913")
};
var points = {
src: new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(-87.9, 41.9)),
dest: new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(-9784983.239366667, 5146011.678566458))
};
var format = new OpenLayers.Format.WKT({
externalProjection: projections["src"],
internalProjection: projections["dest"],
});
var feature = format.read("GEOMETRYCOLLECTION(POINT(" + points["src"].geometry.x + " " + points["src"].geometry.y + "))")[0];
t.eq(feature.geometry.toString(), points["dest"].geometry.toString(),
"Geometry collections aren't transformed twice when reprojection.");
}
</script>
</head>
<body>
</body>
</html>
</html>