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
+12
View File
@@ -1,6 +1,7 @@
goog.provide('ol.Extent');
goog.require('goog.math.Box');
goog.require('ol.TransformFunction');
@@ -26,3 +27,14 @@ goog.inherits(ol.Extent, goog.math.Box);
ol.Extent.prototype.clone = function() {
return new ol.Extent(this.top, this.right, this.bottom, this.left);
};
/**
* @param {ol.TransformFunction} transform Transform.
* @return {ol.Extent} Extent.
*/
ol.Extent.prototype.transform = function(transform) {
var topRight = transform(new goog.math.Coordinate(this.right, this.top));
var bottomLeft = transform(new goog.math.Coordinate(this.left, this.bottom));
return new ol.Extent(topRight.y, topRight.x, bottomLeft.y, bottomLeft.x);
};