Add ol.Extent.transform
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user