[Commits] r2006 - in sandbox/mapgears/geoext.ux/ux/WMSBrowser: examples lib/GeoExt.ux/widgets

commits at geoext.org commits at geoext.org
Thu Mar 18 13:36:45 CET 2010


Author: adube
Date: 2010-03-18 13:36:45 +0100 (Thu, 18 Mar 2010)
New Revision: 2006

Modified:
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.js
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/widgets/WMSBrowser.js
Log:
wmsbrowser - onlayeradded options

Modified: sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.js	2010-03-18 10:05:57 UTC (rev 2005)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.js	2010-03-18 12:36:45 UTC (rev 2006)
@@ -65,6 +65,8 @@
             border: false,
             region: "east",
             gridPanelOptions: {'height': 260},
+            zoomOnLayerAdded: false,
+            closeOnLayerAdded: true,
             // comment the below line to have a 'textfield' instead of a 
             // 'combobox'.  oServerStore is in ./store.js
             serverStore: oServerStore,

Modified: sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/widgets/WMSBrowser.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/widgets/WMSBrowser.js	2010-03-18 10:05:57 UTC (rev 2005)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/widgets/WMSBrowser.js	2010-03-18 12:36:45 UTC (rev 2006)
@@ -54,6 +54,10 @@
         'height': 200
     },
 
+    zoomOnLayerAdded: false,
+
+    closeOnLayerAdded: false,
+
     /** private: method[constructor]
      */
     constructor: function(config) {
@@ -417,13 +421,21 @@
             });
             this.mapPanel.layers.add(copy);
 
-            // zoom to added layer extent (in the current map projection)
-            this.mapPanel.map.zoomToExtent(
-                OpenLayers.Bounds.fromArray(copy.get("llbbox")).transform(
-                    new OpenLayers.Projection("EPSG:4326"),
-                    new OpenLayers.Projection(
-                        this.mapPanel.map.getProjection()))
-            );
+            if(this.zoomOnLayerAdded) {
+                // zoom to added layer extent (in the current map projection)
+                this.mapPanel.map.zoomToExtent(
+                    OpenLayers.Bounds.fromArray(copy.get("llbbox")).transform(
+                        new OpenLayers.Projection("EPSG:4326"),
+                        new OpenLayers.Projection(
+                            this.mapPanel.map.getProjection()))
+                );
+            }
+
+            if(this.closeOnLayerAdded && 
+               this.ownerCt.getXType() == Ext.Window.xtype) {
+                this.closeWindow();
+            }
+
         } else {
             // means no record was selected
             if(grid.store.getTotalCount() > 0) {



More information about the Commits mailing list