add a map getUnits method, r=ahocevar (Closes 1591)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@7374 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -495,7 +495,7 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||
updateRectToMap: function() {
|
||||
// The base layer for overview map needs to be in the same projection
|
||||
// as the base layer for the main map. This should be made more robust.
|
||||
if(this.map.units != 'degrees') {
|
||||
if(this.map.getUnits() != 'degrees') {
|
||||
if(this.ovmap.getProjection() && (this.map.getProjection() != this.ovmap.getProjection())) {
|
||||
alert(OpenLayers.i18n("sameProjection"));
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ OpenLayers.Control.ScaleLine = OpenLayers.Class(OpenLayers.Control, {
|
||||
return;
|
||||
}
|
||||
|
||||
var curMapUnits = this.map.units;
|
||||
var curMapUnits = this.map.getUnits();
|
||||
var inches = OpenLayers.INCHES_PER_UNIT;
|
||||
|
||||
// convert maxWidth to map units
|
||||
|
||||
@@ -1763,6 +1763,21 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
return resolution;
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: getUnits
|
||||
*
|
||||
* Returns:
|
||||
* {Float} The current units of the map.
|
||||
* If no baselayer is set, returns null.
|
||||
*/
|
||||
getUnits: function () {
|
||||
var units = null;
|
||||
if (this.baseLayer != null) {
|
||||
units = this.baseLayer.units;
|
||||
}
|
||||
return units;
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: getScale
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user