Added normalizeScale and getResolutionFromScale to Util.js.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1160 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -6,9 +6,6 @@
|
||||
*/
|
||||
OpenLayers.Util = new Object();
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @class This class represents a screen coordinate, in x and y coordinates
|
||||
*/
|
||||
@@ -1130,3 +1127,18 @@ OpenLayers.INCHES_PER_UNIT = { // borrowed from MapServer mapscale.c
|
||||
|
||||
/** sensible default */
|
||||
OpenLayers.DOTS_PER_INCH = 72;
|
||||
|
||||
OpenLayers.Util.normalizeScale = function (scale) {
|
||||
if (scale > 1.0)
|
||||
return 1.0 / scale;
|
||||
else
|
||||
return scale;
|
||||
};
|
||||
|
||||
OpenLayers.Util.getResolutionFromScale = function (scale, units) {
|
||||
if (!units) units = "degrees";
|
||||
scale = OpenLayers.Util.normalizeScale(scale);
|
||||
return 1 / (scale * OpenLayers.INCHES_PER_UNIT[units]
|
||||
* OpenLayers.DOTS_PER_INCH);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user