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

commits at geoext.org commits at geoext.org
Tue Apr 28 20:35:46 CEST 2009


Author: dwins
Date: 2009-04-28 20:35:45 +0200 (Tue, 28 Apr 2009)
New Revision: 502

Modified:
   apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
Log:
Only query layers advertised as queryable.


Modified: apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js	2009-04-28 18:30:36 UTC (rev 501)
+++ apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js	2009-04-28 18:35:45 UTC (rev 502)
@@ -144,10 +144,6 @@
             scope : this
         });
         
-        // create layer store
-        this.layers = new GeoExt.data.LayerStore({
-            map: this.map
-        });
 
         // place map in panel
         var mapConfig = this.initialConfig.map || {};
@@ -173,6 +169,9 @@
             ]
         });
         
+        // create layer store
+        this.layers = this.mapPanel.layers;
+
         var addLayerButton = new Ext.Button({
             tooltip : "Add Layers",
             disabled: true,
@@ -553,6 +552,21 @@
                 scope: this
             }
         });
+
+        var updateInfo = function() {
+            var queryableLayers = this.mapPanel.layers.queryBy(function(x){
+                return x.data.queryable;
+            });
+            //alert(queryableLayers.items.length);
+            var layerObjects = [];
+            queryableLayers.each(function(x){layerObjects.push(x.data.layer);});
+            infoControl.layers = layerObjects;
+        };
+
+        this.mapPanel.layers.on("update", updateInfo, this);
+        this.mapPanel.layers.on("add", updateInfo, this);
+        this.mapPanel.layers.on("remove", updateInfo, this);
+
         this.on({
             ready: function() {
                 var record = this.capabilities.getAt(0);



More information about the Commits mailing list