[Commits] r236 - in sandbox/opengeo/drake/trunk: apps/geoexplorer core core/examples core/lib/GeoExt/widgets

commits at geoext.org commits at geoext.org
Wed Mar 18 23:16:38 CET 2009


Author: dwins
Date: 2009-03-18 23:16:38 +0100 (Wed, 18 Mar 2009)
New Revision: 236

Added:
   sandbox/opengeo/drake/trunk/core/examples/
   sandbox/opengeo/drake/trunk/core/examples/mappanel-div.html
   sandbox/opengeo/drake/trunk/core/examples/mappanel-window.html
Modified:
   sandbox/opengeo/drake/trunk/apps/geoexplorer/index.html
   sandbox/opengeo/drake/trunk/core/lib/GeoExt/widgets/MapPanel.js
Log:
Deal with some rendering bugs in the new mappanel.


Modified: sandbox/opengeo/drake/trunk/apps/geoexplorer/index.html
===================================================================
--- sandbox/opengeo/drake/trunk/apps/geoexplorer/index.html	2009-03-18 21:11:16 UTC (rev 235)
+++ sandbox/opengeo/drake/trunk/apps/geoexplorer/index.html	2009-03-18 22:16:38 UTC (rev 236)
@@ -81,13 +81,22 @@
 
                     this.layerTree = new Ext.tree.TreePanel({
                         title: "Layers",
-                        width: 100,
+                        width: 250,
                         collapsible: true, 
                         region: 'west',
                         root: new GeoExt.tree.LayerContainer({
                             text: 'Map Layers',
                             map: this.map
-                        })
+                        }),
+                        bbar: ['->',new Ext.Button({
+                            text: "Add Layer...",
+                            handler: this.showLayerWindow,
+                            scope: this
+                        }), new Ext.Button({
+                            text: "Remove Layer",
+                            handler: this.removeLayers,
+                            scope: this
+                        })]
                     });
 
                     // TODO: Just a LegendPanel by itself caused some render issues,
@@ -108,6 +117,22 @@
                         items: [this.layerTree, this.legendPanel, this.mapPanel]
                     });
                 },
+
+                removeLayers: function(evt){
+                    var node = this.layerTree.getSelectionModel().getSelectedNode();
+                    this.map.removeLayer(node.layer)
+                },
+
+                showLayerWindow: function(evt){
+                    var layerWindow = new Ext.Window({
+                        title: "Add Layers!!",
+                        html: "here are some layers. enjoy them while you can",
+                        width: 100
+                    });
+
+                    mapPanel.add(layerWindow);
+                    layerWindow.show();
+                }
             };
 
             Ext.onReady(function() {

Added: sandbox/opengeo/drake/trunk/core/examples/mappanel-div.html
===================================================================
--- sandbox/opengeo/drake/trunk/core/examples/mappanel-div.html	                        (rev 0)
+++ sandbox/opengeo/drake/trunk/core/examples/mappanel-div.html	2009-03-18 22:16:38 UTC (rev 236)
@@ -0,0 +1,68 @@
+<html>
+  <head>
+    <script type="text/javascript" src="../../externals/openlayers/lib/OpenLayers.js"></script>
+    <script type="text/javascript" src="../../externals/ext/adapter/ext/ext-base.js"></script>
+    <script type="text/javascript" src="../../externals/ext/ext-all-debug.js"></script>
+    <script type="text/javascript" src="../lib/GeoExt.js"></script>
+
+    <link rel="stylesheet" type="text/css" href="../../externals/ext/resources/css/ext-all.css"></link>
+
+    <script type="text/javascript">
+
+        var mapPanel = null;
+        
+        function createMap() {
+            var map = new OpenLayers.Map();
+            var layer = new OpenLayers.Layer.WMS(
+                "vmap0",
+                "http://labs.metacarta.com/wms/vmap0",
+                {layers: 'basic'}
+            );
+            map.addLayer(layer);
+            return map;
+        }
+
+        function load() {
+            var map = createMap();
+
+            mapPanel = new GeoExt.MapPanel({
+                // panel options
+                id: "map-panel",
+                title: "GeoExt MapPanel",
+                renderTo: "mappanel",
+                height: 400,
+                width: 600,
+                // map panel-specific options
+                map: map,
+                center: new OpenLayers.LonLat(5, 45),
+                zoom: 4
+            });
+        }
+
+        function mapSizeUp() {
+            var size = mapPanel.getSize();
+            size.width += 40;
+            size.height += 40;
+            mapPanel.setSize(size);
+        }
+
+        function mapSizeDown() {
+            var size = mapPanel.getSize();
+            size.width -= 40;
+            size.height -= 40;
+            mapPanel.setSize(size);
+        }
+
+        Ext.onReady(function() {
+            load();
+        });
+    </script>
+        
+  </head>
+  <body>
+    <div id="mappanel"></div>
+    <input type="button" onclick="mapSizeUp()" value="bigger"></input>
+    <input type="button" onclick="mapSizeDown()" value="smaller"></input>
+  </body>
+</html>
+

Added: sandbox/opengeo/drake/trunk/core/examples/mappanel-window.html
===================================================================
--- sandbox/opengeo/drake/trunk/core/examples/mappanel-window.html	                        (rev 0)
+++ sandbox/opengeo/drake/trunk/core/examples/mappanel-window.html	2009-03-18 22:16:38 UTC (rev 236)
@@ -0,0 +1,55 @@
+<html>
+  <head>
+    <script type="text/javascript" src="../../externals/openlayers/lib/OpenLayers.js"></script>
+    <script type="text/javascript" src="../../externals/ext/adapter/ext/ext-base.js"></script>
+    <script type="text/javascript" src="../../externals/ext/ext-all-debug.js"></script>
+    <script type="text/javascript" src="../lib/GeoExt.js"></script>
+    
+    <link rel="stylesheet" type="text/css" href="../../externals/ext/resources/css/ext-all.css"></link>
+
+    <script type="text/javascript">
+        var app = (function() {
+
+            var mapPanel = null;
+            
+            var createMap = function() {
+                var map = new OpenLayers.Map();
+                var layer = new OpenLayers.Layer.WMS(
+                    "vmap0",
+                    "http://labs.metacarta.com/wms/vmap0",
+                    {layers: 'basic'}
+                );
+                map.addLayer(layer);
+                return map;
+            };
+
+            return {
+                load: function() {
+                    var map = createMap();
+
+                    new Ext.Window({
+                        id: "window",
+                        title: "GeoExt MapPanel Window",
+                        height: 400,
+                        width: 600,
+                        layout: "fit",
+                        items: [{
+                            xtype: "gx_mappanel",
+                            map: map,
+                            extent: new OpenLayers.Bounds(-165, 45, -90, 45)
+                        }]
+                    }).show();
+                }
+            }
+        })();
+
+        Ext.onReady(function() {
+            app.load();
+        });
+    </script>
+        
+  </head>
+  <body>
+  </body>
+</html>
+

Modified: sandbox/opengeo/drake/trunk/core/lib/GeoExt/widgets/MapPanel.js
===================================================================
--- sandbox/opengeo/drake/trunk/core/lib/GeoExt/widgets/MapPanel.js	2009-03-18 21:11:16 UTC (rev 235)
+++ sandbox/opengeo/drake/trunk/core/lib/GeoExt/widgets/MapPanel.js	2009-03-18 22:16:38 UTC (rev 236)
@@ -148,6 +148,7 @@
      *     resized.
      */
     gx_onBodyResize: function() {
+        this.map.render(this.body.dom);
         this.map.updateSize();
     }
 });



More information about the Commits mailing list