[fusion-commits] r1995 - in trunk: lib widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Thu Nov 26 21:21:29 EST 2009
Author: liuar
Date: 2009-11-26 21:21:28 -0500 (Thu, 26 Nov 2009)
New Revision: 1995
Modified:
trunk/lib/Map.js
trunk/widgets/BasemapSwitcher.js
Log:
Fixed ticket http://trac.osgeo.org/fusion/ticket/338
Map returned to the default commercial layer after theme operation
Modified: trunk/lib/Map.js
===================================================================
--- trunk/lib/Map.js 2009-11-27 01:51:25 UTC (rev 1994)
+++ trunk/lib/Map.js 2009-11-27 02:21:28 UTC (rev 1995)
@@ -41,6 +41,7 @@
Fusion.Event.MAP_RELOADED = Fusion.Event.lastEventId++;
Fusion.Event.MAP_SESSION_CREATED = Fusion.Event.lastEventId++;
Fusion.Event.MAP_MAPTIP_REQ_FINISHED = Fusion.Event.lastEventId++;
+Fusion.Event.MAP_MAPGROUPLOADED = Fusion.Event.lastEventId++;
Fusion.Constant.LAYER_POINT_TYPE = 0;
@@ -168,6 +169,7 @@
this.registerEventID(Fusion.Event.MAP_SELECTION_ON);
this.registerEventID(Fusion.Event.MAP_SELECTION_OFF);
this.registerEventID(Fusion.Event.MAP_MAPTIP_REQ_FINISHED);
+ this.registerEventID(Fusion.Event.MAP_MapGroupLoaded);
this.registerForEvent(Fusion.Event.MAP_LOADED, OpenLayers.Function.bind(this.mapLoaded,this));
@@ -230,6 +232,7 @@
}
this.aMaps[i].registerForEvent(Fusion.Event.LAYER_LOADED, OpenLayers.Function.bind(this.layerLoaded,this));
}
+ this.triggerEvent(Fusion.Event.MAP_MapGroupLoaded);
},
layerLoaded: function() {
Modified: trunk/widgets/BasemapSwitcher.js
===================================================================
--- trunk/widgets/BasemapSwitcher.js 2009-11-27 01:51:25 UTC (rev 1994)
+++ trunk/widgets/BasemapSwitcher.js 2009-11-27 02:21:28 UTC (rev 1995)
@@ -22,34 +22,40 @@
Fusion.Widget.BasemapSwitcher = OpenLayers.Class(Fusion.Widget, {
uiClass: Jx.Menu,
- options: {
- 'G_NORMAL_MAP': null,
- 'G_SATELLITE_MAP': null,
- 'G_HYBRID_MAP': null,
- 'YAHOO_MAP_REG': null,
- 'YAHOO_MAP_SAT': null,
- 'YAHOO_MAP_HYB': null,
- 'Road': null,
- 'Aerial': null,
- 'Hybrid': null,
- 'None': null
- },
+
+ options: {},
+
baseMaps: {},
-
+
defaultBasemap: null,
menuItems: {},
initializeWidget: function(widgetTag) {
- this.getMap().registerForEvent(Fusion.Event.MAP_LOADED, OpenLayers.Function.bind(this.setDefaultBasemap, this));
+ this.getMap().registerForEvent(Fusion.Event.MAP_MAPGROUPLOADED, OpenLayers.Function.bind(this.setDefaultBasemap, this));
},
-
- generateOptions: function(){
- // Clear previous settings
- this.options = {};
+
+ refreshSettings: function(){
this.baseMaps = {};
this.defaultBasemap = null;
this.menuItems = {};
+ this.options = {
+ 'G_NORMAL_MAP': null,
+ 'G_SATELLITE_MAP': null,
+ 'G_HYBRID_MAP': null,
+ 'YAHOO_MAP_REG': null,
+ 'YAHOO_MAP_SAT': null,
+ 'YAHOO_MAP_HYB': null,
+ 'Road': null,
+ 'Aerial': null,
+ 'Hybrid': null,
+ 'None': null
+ };
+ },
+
+ generateOptions: function(){
+ // Clear previous settings
+ this.refreshSettings();
var maps = this.getMap().aMaps;
for (var i = 0, len = maps.length; i < len; i++) {
@@ -94,8 +100,6 @@
this.baseMaps['G_HYBRID_MAP'] = map;
break;
default:
- //this.options['G_NORMAL_MAP'] = map.mapTag.extension.Options[0].name[0];
- //this.baseMaps['G_NORMAL_MAP'] = map;
break;
}
@@ -141,8 +145,6 @@
this.baseMaps['YAHOO_MAP_HYB'] = map;
break;
default:
- //this.options['YAHOO_MAP_REG'] = map.mapTag.extension.Options[0].name[0];
- //this.baseMaps['YAHOO_MAP_REG'] = map;
break;
}
// The first non-MapGuide basemap will be the default basemap
@@ -186,8 +188,6 @@
this.baseMaps['Hybrid'] = map;
break;
default:
- //this.options['Road'] = map.mapTag.extension.Options[0].name[0];
- //this.baseMaps['Road'] = map;
break;
}
// The first non-MapGuide basemap will be the default basemap
@@ -200,6 +200,9 @@
break;
}
}
+ if (!this.defaultBasemap) {
+ this.defaultBasemap = "NONE";
+ }
},
setUiObject: function(uiObj) {
More information about the fusion-commits
mailing list