[fusion-commits] r2425 - in sandbox/adsk/2.3r: layers/MapGuide
widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Mon Aug 29 01:55:25 EDT 2011
Author: liuar
Date: 2011-08-28 22:55:25 -0700 (Sun, 28 Aug 2011)
New Revision: 2425
Modified:
sandbox/adsk/2.3r/layers/MapGuide/MapGuide.js
sandbox/adsk/2.3r/widgets/OverviewMap.js
Log:
Port the fix of Ticket #466 to adsk2.3r branch
Modified: sandbox/adsk/2.3r/layers/MapGuide/MapGuide.js
===================================================================
--- sandbox/adsk/2.3r/layers/MapGuide/MapGuide.js 2011-08-23 07:22:39 UTC (rev 2424)
+++ sandbox/adsk/2.3r/layers/MapGuide/MapGuide.js 2011-08-29 05:55:25 UTC (rev 2425)
@@ -44,7 +44,8 @@
selectionAsOverlay: true,
useAsyncOverlay: false,
defaultFormat: 'PNG',
- oLayerOL2: false, //a layer object for tiled maps that also contains dynamic layers
+ oLayersOLTile: null, //a list of baselayers
+ oLayerOLDynamic: false, //a layer object for tiled maps that also contains dynamic layers
initialize: function(map, mapTag, isMapWidgetLayer) {
// console.log('MapGuide.initialize');
@@ -101,7 +102,8 @@
this.keepAliveInterval = parseInt(mapTag.extension.KeepAliveInterval ? mapTag.extension.KeepAliveInterval[0] : 300);
this.noCache = true;
-
+ this.oLayersOLTile = [];
+
var sid = Fusion.sessionId;
if (sid) {
this.session[0] = sid;
@@ -292,18 +294,6 @@
this.bSingleTile = false;
}
- if (!this.bSingleTile) {
- if (o.groups.length >0) {
- this.bSingleTile = false;
- this.noCache = false;
- this.groupName = o.groups[0].groupName; //assumes only one group for now
- this.mapWidget.registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED,
- OpenLayers.Function.bind(this.mapExtentsChanged, this));
- } else {
- this.bSingleTile = true;
- }
- }
-
//set projection units and code if supplied
var wktProj;
if (o.epsg != 0) {
@@ -325,7 +315,25 @@
this.mapWidget.fractionalZoom = false;
this.mapWidget.oMapOL.fractionalZoom = false;
}
-
+
+ if (!this.bSingleTile) {
+ if (o.groups.length >0) {
+ var tiledLayerIndex = 0;
+ this.noCache = false;
+ this.mapWidget.registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED, OpenLayers.Function.bind(this.mapExtentsChanged, this));
+
+ for (var i=0; i<o.groups.length; i++) {
+ if(o.groups[i].isBaseMapGroup) {
+ this.oLayersOLTile[tiledLayerIndex] = this.createOLLayer(this._sMapname + "_Tiled[" + tiledLayerIndex + "]", false, 2, false, o.groups[i].groupName);
+ tiledLayerIndex++;
+ }
+ }
+ }
+ else {
+ this.bSingleTile = true;
+ }
+ }
+
//remove this layer if it was already created
if (this.oLayerOL) {
this.oLayerOL.events.unregister("loadstart", this, this.loadStart);
@@ -334,7 +342,12 @@
this.oLayerOL.destroy();
}
- this.oLayerOL = this.createOLLayer(this._sMapname, this.bSingleTile,2,false);
+ if (this.oLayersOLTile.length != 0) {
+ this.oLayerOL = this.oLayersOLTile[this.oLayersOLTile.length-1]; // The last baselayer at the bottom.
+ } else {
+ this.oLayerOL = this.createOLLayer(this._sMapname, this.bSingleTile, 2, false, "");
+ }
+
if (wktProj) {
this.oLayerOL.projection = wktProj;
}
@@ -353,10 +366,19 @@
if (this.bIsMapWidgetLayer) {
this.mapWidget.addMap(this);
+ if(this.oLayersOLTile.length > 1) {
+ for(var i=this.oLayersOLTile.length-2; i>=0; i--) {
+ // Workaround to make multiple baselayers display.
+ // Openlayers only supports single baselayer.
+ this.oLayersOLTile[i].isBaseLayer = false;
+ this.mapWidget.oMapOL.addLayer(this.oLayersOLTile[i]);
+ }
+ }
+
//if we have a tiled map that also contains dynamic layers, we need to create
//an additional overlay layer to render them on top of the tiles
if(!this.bSingleTile && o.hasDynamicLayers) {
- this.oLayerOL2 = this.createOLLayer(this._sMapname + "_DynamicOverlay",true,2,true);
+ this.oLayerOL2 = this.createOLLayer(this._sMapname + "_DynamicOverlay",true,2,true, "");
this.mapWidget.oMapOL.addLayer(this.oLayerOL2);
this.oLayerOL2.setVisibility(true);
}
@@ -579,7 +601,7 @@
*
* Returns an OpenLayers MapGuide layer object
*/
- createOLLayer: function(layerName, bSingleTile, behavior, forceAsOverlay) {
+ createOLLayer: function(layerName, bSingleTile, behavior, forceAsOverlay, baselayerGroupName) {
/* prevent the useOverlay flag based on MapGuide config element */
this.useAsyncOverlay = Fusion.getConfigurationItem('mapguide', 'useAsyncOverlay');
if (!this.useAsyncOverlay) { //v2.0.1 or earlier
@@ -643,7 +665,7 @@
} else {
params = { //tiled version
mapdefinition: this._sResourceId,
- basemaplayergroupname: this.groupName, //assumes only one group for now
+ basemaplayergroupname: baselayerGroupName,
session: this.getSessionID(),
clientagent: this.clientAgent
};
@@ -946,7 +968,7 @@
if (oNode.hasSelection) {
if (this.selectionAsOverlay) {
if (!this.queryLayer) {
- this.queryLayer = this.createOLLayer("query layer", true, 5, true);
+ this.queryLayer = this.createOLLayer("query layer", true, 5, true, "");
this.mapWidget.oMapOL.addLayer(this.queryLayer);
this.mapWidget.registerForEvent(Fusion.Event.MAP_LOADING,
OpenLayers.Function.bind(this.removeQueryLayer, this));
@@ -1042,7 +1064,11 @@
this.oLayerOL.setVisibility(true);
if (this.oLayerOL2) this.oLayerOL2.setVisibility(true);
} else if (group.isBaseMapGroup) {
- this.oLayerOL.setVisibility(true);
+ for(var i=0; i<this.oLayersOLTile.length; i++) {
+ if(this.oLayersOLTile[i].params.basemaplayergroupname == group.name) {
+ this.oLayersOLTile[i].setVisibility(true);
+ }
+ }
} else {
this.aShowGroups.push(group.uniqueId);
if (!noDraw) {
@@ -1056,7 +1082,11 @@
this.oLayerOL.setVisibility(false);
if (this.oLayerOL2) this.oLayerOL2.setVisibility(false);
} else if (group.isBaseMapGroup) {
- this.oLayerOL.setVisibility(false);
+ for(var i=0; i<this.oLayersOLTile.length; i++) {
+ if(this.oLayersOLTile[i].params.basemaplayergroupname == group.name) {
+ this.oLayersOLTile[i].setVisibility(false);
+ }
+ }
} else {
this.aHideGroups.push(group.uniqueId);
if (!noDraw) {
Modified: sandbox/adsk/2.3r/widgets/OverviewMap.js
===================================================================
--- sandbox/adsk/2.3r/widgets/OverviewMap.js 2011-08-23 07:22:39 UTC (rev 2424)
+++ sandbox/adsk/2.3r/widgets/OverviewMap.js 2011-08-29 05:55:25 UTC (rev 2425)
@@ -112,13 +112,26 @@
this.oMapOptions.numZoomLevels = 3; //TODO: make this configurable?
}
+ ovLayers = [layer]; // layers in Overview Map
+
+ // the last layer on the bottom
+ if(this.mapObject.oLayersOLTile && this.mapObject.oLayersOLTile.length > 1) {
+ for(var i=this.mapObject.oLayersOLTile.length-2; i>=0; i--) {
+ // Workaround to make multiple baselayers display.
+ // Openlayers only supports single baselayer.
+ this.mapObject.oLayersOLTile[i].isBaseLayer = false;
+
+ ovLayers.push(this.mapObject.oLayersOLTile[i]);
+ }
+ }
+
var options = {
div: this.domObj,
size: this.oSize,
minRatio: this.nMinRatio,
maxRatio: this.nMaxRatio,
mapOptions: this.oMapOptions,
- layers: [layer]
+ layers: ovLayers
};
this.control = new OpenLayers.Control.OverviewMap(options);
More information about the fusion-commits
mailing list