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:
Schuyler Erle
2006-08-09 14:55:32 +00:00
parent 3f5c2a8fb9
commit a6edeb64b5

View File

@@ -6,9 +6,6 @@
*/ */
OpenLayers.Util = new Object(); OpenLayers.Util = new Object();
/** /**
* @class This class represents a screen coordinate, in x and y coordinates * @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 */ /** sensible default */
OpenLayers.DOTS_PER_INCH = 72; 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);
};