[Commits] r1192 - apps/opengeo/geoexplorer/branches/0.1.x/lib

commits at geoext.org commits at geoext.org
Wed Jul 1 05:18:43 CEST 2009


Author: tschaub
Date: 2009-07-01 05:18:43 +0200 (Wed, 01 Jul 2009)
New Revision: 1192

Modified:
   apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js
Log:
Same treatment for the branch.

Modified: apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js	2009-07-01 03:18:18 UTC (rev 1191)
+++ apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js	2009-07-01 03:18:43 UTC (rev 1192)
@@ -399,8 +399,21 @@
                 conf = mapConfig.layers[i];
                 id = this.capabilities.find("name", conf.name);
                 if(id >= 0) {
-                    record = this.capabilities.getAt(id).copy();
-                    layer = record.get("layer");
+                    /**
+                     * If the same layer is added twice, it will get replaced
+                     * unless we give each record a unique id.  In addition, we
+                     * need to clone the layer so that the map doesn't assume
+                     * the layer has already been added.  Finally, we can't
+                     * simply set the record layer to the cloned layer because
+                     * record.set compares String(value) to determine equality.
+                     * 
+                     * TODO: suggest record.clone
+                     */
+                    Ext.data.Record.AUTO_ID++;
+                    record = this.capabilities.getAt(id).copy(Ext.data.Record.AUTO_ID);
+                    layer = record.get("layer").clone();
+                    record.set("layer", null);
+                    record.set("layer", layer);
 
                     // set layer max extent from capabilities
                     // TODO: make this SRS independent



More information about the Commits mailing list