[Commits] r367 - apps/opengeo/geoexplorer/trunk/lib

commits at geoext.org commits at geoext.org
Wed Apr 8 01:53:44 CEST 2009


Author: tschaub
Date: 2009-04-08 01:53:44 +0200 (Wed, 08 Apr 2009)
New Revision: 367

Modified:
   apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
Log:
shuffle shuffle

Modified: apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js	2009-04-07 23:42:37 UTC (rev 366)
+++ apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js	2009-04-07 23:53:44 UTC (rev 367)
@@ -260,22 +260,31 @@
         var historyControl = new OpenLayers.Control.NavigationHistory();
         this.map.addControl(historyControl);
         
-        var mapControls = { 
-            getFeatureInfo: new OpenLayers.Control.WMSGetFeatureInfo(this.initialConfig.ows, {
-                queryVisible: true
-            }),
-            measureLength: this.createMeasureTool(OpenLayers.Handler.Path, 'Length'),
-            measureArea: this.createMeasureTool(OpenLayers.Handler.Polygon, 'Area')
-        };
+        // create a get feature info control
+        var infoControl = new OpenLayers.Control.WMSGetFeatureInfo(
+            this.initialConfig.ows, {
+                queryVisible: true,
+                eventListeners: {
+                    getfeatureinfo:  this.displayPopup,
+                    scope: this
+                }
+            }
+        );
+        this.map.addControl(infoControl);
+        
+        // create length measure control
+        var measureLength = this.createMeasureTool(
+            OpenLayers.Handler.Path, 'Length'
+        )
+        this.map.addControl(measureLength);
+        
+        // create area measure control
+        var measureArea = this.createMeasureTool(
+            OpenLayers.Handler.Polygon, 'Area'
+        );
+        this.map.addControl(measureArea);
 
-        mapControls.getFeatureInfo.events.register("getfeatureinfo", this, this.displayPopup);
-
-        for (var key in mapControls) {
-            this.map.addControl(mapControls[key]);
-        }
-
         var toolGroup = "toolGroup";
-
         var toolbarItems = [
             new Ext.Button({
                 tooltip: "Bookmark",
@@ -306,19 +315,19 @@
                 enableToggle: true,
                 toggleHandler: function(button, pressed) {
                     if(pressed) {
-                        mapControls.getFeatureInfo.activate();
+                        infoControl.activate();
                     } else {
-                        mapControls.getFeatureInfo.deactivate();
+                        infoControl.deactivate();
                     }
                 }
             }),
             new MapToolSplitToggle({
                 tooltip: "Measure",
                 iconCls: "icon-measure",
-                defaultTool: mapControls.measureLength,
+                defaultTool: measureLength,
                 tools: [
-                    {text: 'Length', tool: mapControls.measureLength, iconCls: null}, 
-                    {text: 'Area', tool: mapControls.measureArea, iconCls: null}
+                    {text: 'Length', tool: measureLength, iconCls: null}, 
+                    {text: 'Area', tool: measureArea, iconCls: null}
                 ],
                 enableToggle: true,
                 toggleGroup: toolGroup 



More information about the Commits mailing list