[Commits] r2135 - in sandbox/bartvde/playground/geoext.ux/ux/WMSTree: examples lib/GeoExt.ux

commits at geoext.org commits at geoext.org
Tue Apr 27 16:06:04 CEST 2010


Author: bartvde
Date: 2010-04-27 16:06:04 +0200 (Tue, 27 Apr 2010)
New Revision: 2135

Modified:
   sandbox/bartvde/playground/geoext.ux/ux/WMSTree/examples/WMSTree.html
   sandbox/bartvde/playground/geoext.ux/ux/WMSTree/examples/WMSTree.js
   sandbox/bartvde/playground/geoext.ux/ux/WMSTree/lib/GeoExt.ux/WMSLoader.js
Log:
fully functional example with adding layers to a map

Modified: sandbox/bartvde/playground/geoext.ux/ux/WMSTree/examples/WMSTree.html
===================================================================
--- sandbox/bartvde/playground/geoext.ux/ux/WMSTree/examples/WMSTree.html	2010-04-27 13:29:50 UTC (rev 2134)
+++ sandbox/bartvde/playground/geoext.ux/ux/WMSTree/examples/WMSTree.html	2010-04-27 14:06:04 UTC (rev 2135)
@@ -18,12 +18,10 @@
     </head>
     <body>
         <h1>Tree using a GeoExt.ux.WMSLoader</h1>
-        
-        <p>This example shows how to use GeoExt.ux.WMSLoader to populate a tree
-        with the hierarchical structure of a WMS GetCapabilities response.</p>
-        
-        <p>See <a href="WMSTree.js">WMSTree.js</a> for the source code.</p>
-        
-        <div id="content"></div>
+       <div id="desc"> 
+            <p>This example shows how to use GeoExt.ux.WMSLoader to populate a tree
+            with the hierarchical structure of a WMS GetCapabilities response.</p>
+            <p>See <a href="WMSTree.js">WMSTree.js</a> for the source code.</p>
+        </div>
     </body>
 </html>

Modified: sandbox/bartvde/playground/geoext.ux/ux/WMSTree/examples/WMSTree.js
===================================================================
--- sandbox/bartvde/playground/geoext.ux/ux/WMSTree/examples/WMSTree.js	2010-04-27 13:29:50 UTC (rev 2134)
+++ sandbox/bartvde/playground/geoext.ux/ux/WMSTree/examples/WMSTree.js	2010-04-27 14:06:04 UTC (rev 2135)
@@ -1,4 +1,4 @@
-var tree;
+var tree, mapPanel;
 
 Ext.onReady(function() {
 
@@ -6,9 +6,18 @@
 
     tree = new Ext.tree.TreePanel(
         {
+            region: 'west',
+            width: 250,
             loader: new GeoExt.ux.WMSLoader(
-                {url: 'http://ontwikkel.intranet.rws.nl/services/geoservices/bps?'}
-            )
+                {
+                    url: 'http://demo.opengeo.org/geoserver/wms?',
+                    layerOptions: {buffer: 0, singleTile: true, ratio: 1},
+                    layerParams: {'TRANSPARENT': 'TRUE'}
+                }
+            ),
+            listeners: {
+                'click': function(node) { mapPanel.map.addLayer(node.attributes.layer); }
+            }
         }
     );
 
@@ -17,6 +26,38 @@
     });
     tree.setRootNode(root); 
 
-    tree.render('content');
+    mapPanel = new GeoExt.MapPanel({
+        layers: [
+            new OpenLayers.Layer.WMS("Global Imagery",
+                "http://maps.opengeo.org/geowebcache/service/wms", {
+                    layers: "bluemarble"
+                }, {
+                    buffer: 0
+                }
+            )
+        ],
+        region: 'center'
+    });
+
+    new Ext.Viewport({
+        layout: "fit",
+        hideBorders: true,
+        items: {
+            layout: "border",
+            deferredRender: false,
+            items: [mapPanel, tree, {
+                contentEl: "desc",
+                region: "east",
+                bodyStyle: {"padding": "5px"},
+                collapsible: true,
+                collapseMode: "mini",
+                split: true,
+                width: 200,
+                title: "Description"
+            }]
+        }
+    });
+
+
     
 });

Modified: sandbox/bartvde/playground/geoext.ux/ux/WMSTree/lib/GeoExt.ux/WMSLoader.js
===================================================================
--- sandbox/bartvde/playground/geoext.ux/ux/WMSTree/lib/GeoExt.ux/WMSLoader.js	2010-04-27 13:29:50 UTC (rev 2134)
+++ sandbox/bartvde/playground/geoext.ux/ux/WMSTree/lib/GeoExt.ux/WMSLoader.js	2010-04-27 14:06:04 UTC (rev 2135)
@@ -23,7 +23,7 @@
 
     createWMSLayer: function(layer, url) {
         return new OpenLayers.Layer.WMS( layer.title, url,
-            OpenLayers.Util.extend({layers: layer.name}, this.layerParams),
+            OpenLayers.Util.extend({formats: layer.formats[0], layers: layer.name}, this.layerParams),
             OpenLayers.Util.extend({minScale: layer.minScale,
                 queryable: layer.queryable, maxScale: layer.maxScale,
                 metadata: layer



More information about the Commits mailing list