Update geom package to use new extent structure

This commit is contained in:
Tim Schaub
2013-09-03 17:40:34 -06:00
parent dbccb8b231
commit 60bf396e25
10 changed files with 35 additions and 45 deletions

View File

@@ -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;
};

View File

@@ -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_;
};

View File

@@ -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_;
};