Hello list,
within a GeoExt project I used the ScaleStore due to the example at
http://api.geoext.org/1.0/examples/zoom-chooser.html.
The problem is that some scales are not shown correctly in the scale
chooser, for example 1:49999 instead of 1:50000. Some recherche
clarified that in the populateFromMap() function in
GeoExt.data.ScaleStore the scales are always calculated with
OpenLayers.Util.getScaleFromResolution(...), although they are defined
in this.map.scales.
To fix this problem for my project I modified the ScaleStore.js (see
attached patch). Maybe this modification could be interesting for the
general GeoExt code base.
Thanks for any review.
Best regards,
Chris
Index: lib/GeoExt/data/ScaleStore.js
===================================================================
--- lib/GeoExt/data/ScaleStore.js (revision 2443)
+++ lib/GeoExt/data/ScaleStore.js (working copy)
@@ -111,10 +111,17 @@
for (var i=resolutions.length-1; i >= 0; i--) {
var res = resolutions[i];
+ var scale;
+ if (this.map.scales && this.map.scales !== 'undefined') {
+ scale = this.map.scales[i];
+ }
+ else {
+ scale = OpenLayers.Util.getScaleFromResolution(res, units);
+ }
zooms.push({
level: i,
resolution: res,
- scale: OpenLayers.Util.getScaleFromResolution(res, units)
+ scale: scale
});
}
_______________________________________________
Dev mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/dev