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

commits at geoext.org commits at geoext.org
Thu Apr 2 19:07:53 CEST 2009


Author: tschaub
Date: 2009-04-02 19:07:52 +0200 (Thu, 02 Apr 2009)
New Revision: 325

Modified:
   apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
Log:
Get rid of dummy layers and isBaseLayer setting.  Instead set map.allOverlays true.  (closes #131)

Modified: apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js	2009-04-01 22:20:34 UTC (rev 324)
+++ apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js	2009-04-02 17:07:52 UTC (rev 325)
@@ -155,7 +155,7 @@
      */
     initMap: function() {
         // TODO: check this.initialConfig.map for any map options
-        this.map = new OpenLayers.Map();
+        this.map = new OpenLayers.Map({allOverlays: true});
 
         //TODO: make this more configurable
         this.map.events.on({
@@ -181,33 +181,24 @@
         this.layers = new GeoExt.data.LayerStore({
             map: this.map
         });
-        
-        // create a record for the dummy layer that acts as the single baselayer
-        var dummy = new OpenLayers.Layer(null, {
-            isBaseLayer: true,
-            displayInLayerSwitcher: false
-        });
-        var records = [
-            new GeoExt.data.LayerRecord({layer: dummy}, dummy.id)
-        ];
 
         if(mapConfig && mapConfig.layers) {
-            var conf, layer;
-            for(var i=0, len=mapConfig.layers.length; i<len; ++i) {
+            var conf, layer, len = mapConfig.layers.length;
+            var records = new Array(len);
+            for(var i=0; i<len; ++i) {
                 conf = Ext.apply({}, mapConfig.layers[i]);
                 layer = new OpenLayers.Layer.WMS(
                     conf.title || conf.name,
                     this.ows,
-                    {layers: conf.name, transparent: true},
-                    {isBaseLayer: false}
+                    {layers: conf.name, transparent: true}
                 );
                 conf.layer = layer;
                 layer.events.register("visibilitychanged", this, this.updateGFILayers);
                 // we could extend the record type with conf fields here
-                records.push(new GeoExt.data.LayerRecord(conf, layer.id));
+                records[i] = new GeoExt.data.LayerRecord(conf, layer.id);
             }
+            this.layers.add(records);
         }
-        this.layers.add(records);
     },
 
     /**
@@ -369,10 +360,6 @@
         config.map.layers = [];
 
         this.layers.each(function(layerRecord){
-            //if it's the dummy layer, do nothing.
-            if(layerRecord.get("layer").isBaseLayer){
-                return;
-            }
 
             var c = {
                 title: layerRecord.get("title"),



More information about the Commits mailing list