zoomToMaxExtent() and getMaxExtent() should be smarter if a 'restrictedExtent' property is set on the map. (Closes #1134)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@7596 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2008-07-30 00:36:26 +00:00
parent 27ce7fe099
commit 0b58117c06
2 changed files with 97 additions and 5 deletions

View File

@@ -1695,13 +1695,25 @@ OpenLayers.Map = OpenLayers.Class({
/**
* APIMethod: getMaxExtent
*
* Parameters:
* options - {Object}
*
* Allowed Options:
* restricted - {Boolean} If true, returns restricted extent (if it is
* available.)
*
* Returns:
* {<OpenLayers.Bounds>}
* {<OpenLayers.Bounds>} The maxExtent property as set on the current
* baselayer, unless the 'restricted' option is set, in which case
* the 'restrictedExtent' option from the map is returned (if it
* is set).
*/
getMaxExtent: function () {
getMaxExtent: function (options) {
var maxExtent = null;
if (this.baseLayer != null) {
if(options && options.restricted && this.restrictedExtent){
maxExtent = this.restrictedExtent;
} else if (this.baseLayer != null) {
maxExtent = this.baseLayer.maxExtent;
}
return maxExtent;
@@ -1942,9 +1954,22 @@ OpenLayers.Map = OpenLayers.Class({
/**
* APIMethod: zoomToMaxExtent
* Zoom to the full extent and recenter.
*
* Parameters:
* options -
*
* Allowed Options:
* restricted - {Boolean} True to zoom to restricted extent if it is
* set. Defaults to true.
*/
zoomToMaxExtent: function() {
this.zoomToExtent(this.getMaxExtent());
zoomToMaxExtent: function(options) {
//restricted is true by default
var restricted = (options) ? options.restricted : true;
var maxExtent = this.getMaxExtent({
'restricted': restricted
});
this.zoomToExtent(maxExtent);
},
/**