[Commits] r268 - sandbox/opengeo/geoexplorer/examples

commits at geoext.org commits at geoext.org
Wed Mar 25 00:09:00 CET 2009


Author: tschaub
Date: 2009-03-25 00:09:00 +0100 (Wed, 25 Mar 2009)
New Revision: 268

Modified:
   sandbox/opengeo/geoexplorer/examples/wms-capabilities.html
   sandbox/opengeo/geoexplorer/examples/wms-capabilities.js
Log:
adding handy map preview to capabilities grid

Modified: sandbox/opengeo/geoexplorer/examples/wms-capabilities.html
===================================================================
--- sandbox/opengeo/geoexplorer/examples/wms-capabilities.html	2009-03-24 23:01:58 UTC (rev 267)
+++ sandbox/opengeo/geoexplorer/examples/wms-capabilities.html	2009-03-24 23:09:00 UTC (rev 268)
@@ -14,7 +14,8 @@
     <body>
         <h1>WMS Capabilities Example</h1>
         <p>This example shows how to load a grid with data from a WMS
-        capabilities document.</p>
+        capabilities document.  You can double-click on a row to see
+        a map preview of the layer.</p>
 
         <p>Note that the js is not minified so it is readable.
         See <a href="wms-capabilities.js">wms-capabilities.js</a>.</p>

Modified: sandbox/opengeo/geoexplorer/examples/wms-capabilities.js
===================================================================
--- sandbox/opengeo/geoexplorer/examples/wms-capabilities.js	2009-03-24 23:01:58 UTC (rev 267)
+++ sandbox/opengeo/geoexplorer/examples/wms-capabilities.js	2009-03-24 23:09:00 UTC (rev 268)
@@ -20,7 +20,28 @@
         autoExpandColumn: "description",
         renderTo: "capgrid",
         height: 300,
-        width: 600
+        width: 600,
+        listeners: {
+            rowdblclick: mapPreview
+        }
     });
+    
+    function mapPreview(grid, index) {
+        var record = grid.getStore().getAt(index);
+        var layer = record.get("layer");
+        layer.isBaseLayer = true; // default is false
+        
+        var win = new Ext.Window({
+            title: "Preview: " + record.get("title"),
+            width: 512,
+            height: 256,
+            items: [{
+                xtype: "gx_mappanel",
+                layers: [layer],
+                extent: new OpenLayers.Bounds.fromArray(record.get("llbbox")) // simplify when #31 is addressed
+            }]
+        });
+        win.show();
+    }
 
 });



More information about the Commits mailing list