Update geom package to use new extent structure
This commit is contained in:
@@ -38,22 +38,12 @@ goog.inherits(ol.geom.AbstractCollection, ol.geom.Geometry);
|
||||
*/
|
||||
ol.geom.AbstractCollection.prototype.getBounds = function() {
|
||||
if (goog.isNull(this.bounds)) {
|
||||
var minX,
|
||||
minY = minX = Infinity,
|
||||
maxX,
|
||||
maxY = maxX = -Infinity,
|
||||
components = this.components,
|
||||
len = components.length,
|
||||
bounds, i;
|
||||
|
||||
for (i = 0; i < len; ++i) {
|
||||
bounds = components[i].getBounds();
|
||||
minX = Math.min(bounds[0], minX);
|
||||
maxX = Math.max(bounds[1], maxX);
|
||||
minY = Math.min(bounds[2], minY);
|
||||
maxY = Math.max(bounds[3], maxY);
|
||||
var bounds = ol.extent.createEmpty();
|
||||
var components = this.components;
|
||||
for (var i = 0, ii = components.length; i < ii; ++i) {
|
||||
ol.extent.extend(bounds, components[i].getBounds());
|
||||
}
|
||||
this.bounds = [minX, maxX, minY, maxY];
|
||||
this.bounds = bounds;
|
||||
}
|
||||
return this.bounds;
|
||||
};
|
||||
|
||||
@@ -126,7 +126,7 @@ ol.geom.LineString.prototype.getBounds = function() {
|
||||
maxY = y;
|
||||
}
|
||||
}
|
||||
this.bounds_ = [minX, maxX, minY, maxY];
|
||||
this.bounds_ = [[minX, minY], [maxX, maxY]];
|
||||
}
|
||||
return this.bounds_;
|
||||
};
|
||||
|
||||
@@ -68,7 +68,7 @@ ol.geom.Point.prototype.getBounds = function() {
|
||||
if (goog.isNull(this.bounds_)) {
|
||||
var x = this.get(0),
|
||||
y = this.get(1);
|
||||
this.bounds_ = [x, x, y, y];
|
||||
this.bounds_ = [[x, y], [x, y]];
|
||||
}
|
||||
return this.bounds_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user