Add ol.Extent.transform

This commit is contained in:
Tom Payne
2012-07-06 13:24:20 +02:00
committed by Tom Payne
parent 9368f05d1c
commit 4bdaf293b0
2 changed files with 28 additions and 0 deletions

16
src/ol/extent_test.js Normal file
View File

@@ -0,0 +1,16 @@
goog.require('goog.testing.jsunit');
goog.require('ol.Extent');
goog.require('ol.Projection');
function testTransform() {
var transform = ol.Projection.getTransformFromCodes('EPSG:4326', 'EPSG:3857');
var sourceExtent = new ol.Extent(60, 45, -30, -15);
var destinationExtent = sourceExtent.transform(transform);
assertNotNullNorUndefined(destinationExtent);
// FIXME check values with third-party tool
assertRoughlyEquals(8399737.889818361, destinationExtent.top, 1e-9);
assertRoughlyEquals(5009377.085697311, destinationExtent.right, 1e-9);
assertRoughlyEquals(-3503549.843504376, destinationExtent.bottom, 1e-9);
assertRoughlyEquals(-1669792.3618991037, destinationExtent.left, 1e-9);
}