[Commits] r306 - apps/opengeo/geoexplorer/trunk/lib
commits at geoext.org
commits at geoext.org
Tue Mar 31 20:21:12 CEST 2009
Author: dwins
Date: 2009-03-31 20:21:12 +0200 (Tue, 31 Mar 2009)
New Revision: 306
Modified:
apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
Log:
Delegate the 'update when layer visibility changes' functionality to the GFI control; some jslint-inspired code cleanup
Modified: apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js 2009-03-31 15:00:30 UTC (rev 305)
+++ apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js 2009-03-31 18:21:12 UTC (rev 306)
@@ -50,17 +50,6 @@
mapPanel: null,
/**
- * Property: wmsStore
- * {<GeoExt.data.WMSCapabilitiesStore>} A store of WMS Capabilities records from the url provided by configuration.
-
- /**
- * Property: toolbarItems
- * {Array} An array containing toolbar items suitable for passing as a tbar: property
- * on an Ext component
- */
- toolbarItems: null,
-
- /**
* Property: load
* Called at the end of construction. This initiates the sequence that
* prepares the application for use.
@@ -80,10 +69,8 @@
// create the layers store
this.initLayers();
- this.initWMSStore();
- this.initMapControls();
- this.initToolbar();
+ var toolbarItems = this.initMapControlsAndToolbar();
// place map in panel
var mapConfig = this.initialConfig.map || {};
@@ -138,7 +125,7 @@
var toolbar = new Ext.Toolbar({
region: 'north',
- items: this.toolbarItems
+ items: toolbarItems
});
var viewport = new Ext.Viewport({
@@ -168,7 +155,7 @@
evt.layer.mergeNewParams({
transparent: true,
format: "image/png"
- })
+ });
}
},
scope : this
@@ -238,56 +225,45 @@
text: "Done",
handler: function() {
win.close();
- }
- }]
+ })
+ ],
+ bbar: ["->",doneButton]
});
win.show();
},
- initMapControls: function() {
- this.mapControls = {
+ initMapControlsAndToolbar: function() {
+ var mapControls = {
getFeatureInfo: new OpenLayers.Control.WMSGetFeatureInfo(this.initialConfig.ows, {
+ queryVisible: true
})
};
- this.updateGFILayers();
+ mapControls.getFeatureInfo.events.register("getfeatureinfo", this, this.displayPopup);
- this.mapControls.getFeatureInfo.events.register("getfeatureinfo", this, this.displayPopup);
-
- for (var key in this.mapControls) {
- this.map.addControl(this.mapControls[key]);
+ for (var key in mapControls) {
+ this.map.addControl(mapControls[key]);
}
- },
- initToolbar: function() {
var toolGroup = "toolGroup";
- this.toolbarItems = [
+ var toolbarItems = [
new Ext.Button({
text: "GetFeatureInfo",
enableToggle: true,
toggleGroup: toolGroup,
handler: function(toggled, item) {
if (toggled){
- this.mapControls.getFeatureInfo.activate();
+ mapControls.getFeatureInfo.activate();
} else {
- this.mapControls.getFeatureInfo.deactivate();
+ mapControls.getFeatureInfo.deactivate();
}
},
scope: this
})
];
- },
- updateGFILayers: function() {
- var layers = [];
- for (var i = 0, len = this.map.layers.length; i < len; i++) {
- if (this.map.layers[i].params && this.map.layers[i].getVisibility()) {
- layers.push(this.map.layers[i]);
- }
- }
-
- this.mapControls.getFeatureInfo.layers = layers;
+ return toolbarItems;
},
displayPopup: function(evt){
@@ -308,4 +284,4 @@
this.mapPanel.add(win);
win.show();
}
-});
\ No newline at end of file
+});
More information about the Commits
mailing list