Allow transforming geometries, lonlat, and bounds with strings.
This commit is contained in:
@@ -50,6 +50,21 @@
|
||||
new OpenLayers.Projection("EPSG:900913"));
|
||||
t.eq(point.bounds, null, "Point bounds cleared after transform");
|
||||
}
|
||||
|
||||
function test_Point_transform_string(t) {
|
||||
t.plan(4);
|
||||
|
||||
var x = 10;
|
||||
var y = 20;
|
||||
point = new OpenLayers.Geometry.Point(x, y);
|
||||
point.calculateBounds();
|
||||
t.ok( point.bounds != null, "bounds calculated by calcBounds" );
|
||||
point.transform("EPSG:4326", "EPSG:900913");
|
||||
t.eq(point.bounds, null, "Point bounds cleared after transform");
|
||||
t.eq(point.x.toFixed(2), "1113194.91", "transformed x");
|
||||
t.eq(point.y.toFixed(2), "2273030.93", "transformed y");
|
||||
|
||||
}
|
||||
|
||||
function test_Point_distanceTo(t) {
|
||||
t.plan(7);
|
||||
|
||||
@@ -46,6 +46,19 @@
|
||||
t.eq(polygon.getBounds().toBBOX(), "556597.453889,334111.171355,1113194.907778,1574216.547942", "Bounds are correct")
|
||||
}
|
||||
|
||||
function test_Polygon_transform_string (t) {
|
||||
t.plan(3);
|
||||
|
||||
var components = [new OpenLayers.Geometry.Point(10,14), new OpenLayers.Geometry.Point(5,3)];
|
||||
var linearRing = new OpenLayers.Geometry.LinearRing(components);
|
||||
polygon = new OpenLayers.Geometry.Polygon([linearRing.clone()]);
|
||||
polygon.calculateBounds();
|
||||
t.ok( polygon.bounds != null, "bounds calculated by calcBounds" );
|
||||
polygon.transform("EPSG:4326", "EPSG:900913");
|
||||
t.eq(polygon.bounds, null, "Point bounds cleared after transform");
|
||||
t.eq(polygon.getBounds().toBBOX(), "556597.453889,334111.171355,1113194.907778,1574216.547942", "Bounds are correct")
|
||||
}
|
||||
|
||||
function test_Polygon_getArea(t) {
|
||||
t.plan( 5 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user