Add getBounds to geometry
This commit is contained in:
@@ -2,6 +2,7 @@ goog.provide('ol.geom.Point');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.vec.Float64Array');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.geom.Coordinate');
|
||||
goog.require('ol.geom.Geometry');
|
||||
|
||||
@@ -25,4 +26,23 @@ ol.geom.Point = function(coordinates) {
|
||||
this.dimension = coordinates.length;
|
||||
goog.asserts.assert(this.dimension >= 2);
|
||||
|
||||
/**
|
||||
* @type {ol.Extent}
|
||||
* @private
|
||||
*/
|
||||
this.bounds_ = null;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.Point.prototype.getBounds = function() {
|
||||
if (goog.isNull(this.bounds_)) {
|
||||
var x = this.coordinates[0],
|
||||
y = this.coordinates[1];
|
||||
this.bounds_ = new ol.Extent(x, y, x, y);
|
||||
}
|
||||
return this.bounds_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user