Allow transforming geometries, lonlat, and bounds with strings.
This commit is contained in:
@@ -630,7 +630,7 @@
|
||||
|
||||
}
|
||||
function test_Bounds_transform(t) {
|
||||
t.plan( 3 );
|
||||
t.plan( 5 );
|
||||
bounds = new OpenLayers.Bounds(10, -10, 20, 10);
|
||||
bounds.transform(new OpenLayers.Projection("foo"), new OpenLayers.Projection("Bar"));
|
||||
t.eq(bounds.toBBOX(), "10,-10,20,10", "null transform okay");
|
||||
@@ -638,6 +638,14 @@
|
||||
t.eq(bounds.toBBOX(), "1113194.907778,-1118889.974702,2226389.815556,1118889.974702", "bounds for spherical mercator transform are correct");
|
||||
bounds.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
|
||||
t.eq(bounds.toBBOX(), "10,-10,20,10", "bounds for inverse spherical mercator transform are correct");
|
||||
|
||||
// transform with string
|
||||
bounds = new OpenLayers.Bounds(10, -10, 20, 10);
|
||||
bounds.transform("EPSG:4326", "EPSG:900913");
|
||||
t.eq(bounds.toBBOX(), "1113194.907778,-1118889.974702,2226389.815556,1118889.974702", "(string) bounds for spherical mercator transform are correct");
|
||||
bounds.transform("EPSG:900913", "EPSG:4326");
|
||||
t.eq(bounds.toBBOX(), "10,-10,20,10", "(string) bounds for inverse spherical mercator transform are correct");
|
||||
|
||||
}
|
||||
|
||||
function test_Bounds_add(t) {
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
}
|
||||
|
||||
function test_LonLat_transform(t) {
|
||||
t.plan( 6 );
|
||||
t.plan(10);
|
||||
lonlat = new OpenLayers.LonLat(10, -10);
|
||||
lonlat.transform(new OpenLayers.Projection("foo"), new OpenLayers.Projection("Bar"));
|
||||
t.eq(lonlat.lon, 10, "lon for null transform is the same")
|
||||
@@ -177,6 +177,16 @@
|
||||
lonlat.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
|
||||
t.eq(lonlat.lon, 10, "lon for inverse spherical mercator transform is correct");
|
||||
t.eq(Math.round(lonlat.lat), -10, "lat for inverse spherical mercator correct")
|
||||
|
||||
// transform with string
|
||||
lonlat = new OpenLayers.LonLat(10, -10);
|
||||
lonlat.transform("EPSG:4326", "EPSG:900913");
|
||||
t.eq(Math.round(lonlat.lon), 1113195, "(string) lon for spherical mercator transform is correct");
|
||||
t.eq(Math.round(lonlat.lat), -1118890, "(string) lat for spherical mercator correct")
|
||||
lonlat.transform("EPSG:900913", "EPSG:4326");
|
||||
t.eq(lonlat.lon, 10, "(string) lon for inverse spherical mercator transform is correct");
|
||||
t.eq(Math.round(lonlat.lat), -10, "(string) lat for inverse spherical mercator correct")
|
||||
|
||||
}
|
||||
|
||||
function test_LonLat_wrapDateLine(t) {
|
||||
|
||||
Reference in New Issue
Block a user