add getDataExtent() method to layer (experimental) and to markers layer (api supported). thanks for the feature request and original patch, anonymous ol-er :-) (Closes #750)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@4051 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -723,6 +723,18 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
return this.getZoomForResolution(idealResolution);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: getDataExtent
|
||||
* Calculates the max extent which includes all of the data for the layer.
|
||||
* This function is to be implemented by subclasses.
|
||||
*
|
||||
* Returns:
|
||||
* {<OpenLayers.Bounds>}
|
||||
*/
|
||||
getDataExtent: function () {
|
||||
//to be implemented by subclasses
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: getZoomForResolution
|
||||
*
|
||||
|
||||
@@ -139,6 +139,27 @@ OpenLayers.Layer.Markers = OpenLayers.Class(OpenLayers.Layer, {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: getDataExtent
|
||||
* Calculates the max extent which includes all of the markers.
|
||||
*
|
||||
* Returns:
|
||||
* {<OpenLayers.Bounds>}
|
||||
*/
|
||||
getDataExtent: function () {
|
||||
var maxExtent = null;
|
||||
|
||||
if ( this.markers && (this.markers.length > 0)) {
|
||||
var maxExtent = new OpenLayers.Bounds();
|
||||
for(var i=0; i < this.markers.length; i++) {
|
||||
var marker = this.markers[i];
|
||||
maxExtent.extend(marker.lonlat);
|
||||
}
|
||||
}
|
||||
|
||||
return maxExtent;
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Layer.Markers"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user