[fusion-commits] r1565 - in trunk: MapGuide lib
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Mon Sep 29 14:11:27 EDT 2008
Author: madair
Date: 2008-09-29 14:11:27 -0400 (Mon, 29 Sep 2008)
New Revision: 1565
Modified:
trunk/MapGuide/MapGuide.js
trunk/lib/Map.js
trunk/lib/fusion.js
Log:
closes #113: if maxScale is Infinity, set it to an actual value; set a maxExtent for panning in AppDef MapWIdget extension.
patch applied to trunk
Modified: trunk/MapGuide/MapGuide.js
===================================================================
--- trunk/MapGuide/MapGuide.js 2008-09-29 18:09:16 UTC (rev 1564)
+++ trunk/MapGuide/MapGuide.js 2008-09-29 18:11:27 UTC (rev 1565)
@@ -535,11 +535,10 @@
var layerOptions = {
units: this.units,
isBaseLayer: bIsBaseLayer,
- maxExtent: this._oMaxExtent,
+ maxExtent: this.mapWidget.maxExtent ? this.mapWidget.maxExtent : this._oMaxExtent,
maxResolution: 'auto',
useOverlay: this.selectionAsOverlay,
ratio: this.ratio
-// transitionEffect : 'resize'
};
if (!/WebKit/.test(navigator.userAgent)) {
layerOptions.transitionEffect = 'resize';
@@ -551,6 +550,8 @@
}
if (this.maxScale != Infinity) {
layerOptions.minScale = this.maxScale; //OL interpretation of min/max scale is reversed from Fusion
+ } else {
+ layerOptions.minScale = Fusion.REALLY_SMALL_SCALE;
}
//only set both max and min scale when not using scales array
if (!this.mapWidget.oMapOL.scales && !this.scales) {
Modified: trunk/lib/Map.js
===================================================================
--- trunk/lib/Map.js 2008-09-29 18:09:16 UTC (rev 1564)
+++ trunk/lib/Map.js 2008-09-29 18:11:27 UTC (rev 1565)
@@ -97,6 +97,11 @@
this.fractionalZoom = false;
}
+ var maxExtent = null;
+ if (widgetTag.extension.MaxExtent) {
+ maxExtent = OpenLayers.Bounds.fromString(widgetTag.extension.MaxExtent[0]);
+ }
+
OpenLayers.DOTS_PER_INCH = this._nDpi;
if (!this.oMapOL) {
var options = {
@@ -108,6 +113,10 @@
if (widgetTag.extension.ConstrainMapExtent) {
this.bRestrictExtent = widgetTag.extension.ConstrainMapExtent[0]=='true'?true:false;
}
+ if (maxExtent) {
+ options.maxExtent = maxExtent;
+ this.maxExtent = maxExtent;
+ }
this.oMapOL = new OpenLayers.Map(this._sDomObj, options );
}
@@ -299,7 +308,12 @@
this.singleTile = false;
}
this.projection = map.projection;
+ this.units = map.units;
this.maxExtent.extend(map._oMaxExtent);
+ this.oMapOL.setOptions({
+ maxExtent: this.maxExtent,
+ units: map.units,
+ projection: this.projection});
//if bRestrictExtent is null, use the default OL behaviour with somewhat restricted map navigation
//if bRestrictExtent is set to true, map navigation is limited to the map extent
@@ -564,6 +578,7 @@
initialExtents = this.maxExtent;
}
} else {
+ /*
var viewSize = this.oMapOL.getSize();
var oExtents = this.oMapOL.getMaxExtent();
var center = oExtents.getCenterLonLat();
@@ -575,6 +590,11 @@
center.lat - h_deg,
center.lon + w_deg,
center.lat + h_deg);
+ */
+ initialExtents = new OpenLayers.Bounds();
+ for (var i=0; i<this.aMaps.length; ++i) {
+ initialExtents.extend(this.aMaps[i]._oMaxExtent);
+ }
}
this.initialExtents = initialExtents;
return initialExtents;
Modified: trunk/lib/fusion.js
===================================================================
--- trunk/lib/fusion.js 2008-09-29 18:09:16 UTC (rev 1564)
+++ trunk/lib/fusion.js 2008-09-29 18:11:27 UTC (rev 1565)
@@ -211,6 +211,8 @@
aUnitAbbr: ['unk', 'in', 'ft', 'yd', 'mi', 'nm',
'mm', 'cm', 'm', 'km',
'°', '°', '°', 'px'],
+ REALLY_SMALL_SCALE: 1000000000,
+
/**
* Function: initialize
*
More information about the fusion-commits
mailing list