1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
OpenLayers.Geometry.Collection.calculateBounds= function() {
this.bounds = null;
var bounds = new OpenLayers.Bounds();
var components = this.components;
if (components) {
for (var i=0, len=components.length; i<len; i++) {
if (components[i].getBounds) bounds.extend(components[i].getBounds());
}
}
// to preserve old behavior, we only set bounds if non-null
// in the future, we could add bounds.isEmpty()
if (bounds.left != null && bounds.bottom != null &&
bounds.right != null && bounds.top != null) {
this.setBounds(bounds);
}
}, |