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

commits at geoext.org commits at geoext.org
Wed Mar 17 19:28:18 CET 2010


Author: adube
Date: 2010-03-17 19:28:18 +0100 (Wed, 17 Mar 2010)
New Revision: 2001

Modified:
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.html
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.js
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/widgets/WMSBrowser.js
Log:
wmsbrowser - zoomTo reprojected extent bug fix

Modified: sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.html
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.html	2010-03-17 17:31:45 UTC (rev 2000)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.html	2010-03-17 18:28:18 UTC (rev 2001)
@@ -17,6 +17,10 @@
         <link rel="stylesheet" type="text/css" href="../resources/css/WMSBrowser.css" />
         <script type="text/javascript" src="../lib/GeoExt.ux/SingleFile.js"></script>
 
+    <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
+        <script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
+
+
         <script type="text/javascript" src="./store.js"></script>
         <script type="text/javascript" src="WMSBrowserInWindowExample.js"></script>
         

Modified: sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.js	2010-03-17 17:31:45 UTC (rev 2000)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.js	2010-03-17 18:28:18 UTC (rev 2001)
@@ -16,13 +16,23 @@
     });
     actions.push(action);
 
+    var options = {
+        projection: new OpenLayers.Projection("EPSG:900913"),
+        displayProjection: new OpenLayers.Projection("EPSG:4326"),
+        units: "m",
+        numZoomLevels: 18,
+        maxResolution: 156543.0339,
+        maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
+                                         20037508, 20037508.34)
+    };
+    map = new OpenLayers.Map('map', options);
+
     mapPanel = new GeoExt.MapPanel({
         region: "center",
-        layers: [new OpenLayers.Layer.WMS("Global Imagery",
-            "http://labs.metacarta.com/wms/vmap0",
-            {layers: "basic"})] ,
-        center: [-68,52],
-        zoom: 4,
+        layers: [
+            new OpenLayers.Layer.Google("Google Physical",{'sphericalMercator': true, type: G_PHYSICAL_MAP})
+        ],
+        map: map,
         tbar: new Ext.Toolbar(actions)
     });
 
@@ -45,6 +55,8 @@
         height: 350,
         items: [mapPanel, tree]
     });
+
+    map.setCenter(new OpenLayers.LonLat(-10762333.581055,5968203.1676758), 2);
 });
 
 var openWindow = function() {

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-17 17:31:45 UTC (rev 2000)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/widgets/WMSBrowser.js	2010-03-17 18:28:18 UTC (rev 2001)
@@ -417,9 +417,12 @@
             });
             this.mapPanel.layers.add(copy);
 
-            // zoom to added layer extent
+            // zoom to added layer extent (in the current map projection)
             this.mapPanel.map.zoomToExtent(
-                OpenLayers.Bounds.fromArray(copy.get("llbbox"))
+                OpenLayers.Bounds.fromArray(copy.get("llbbox")).transform(
+                    new OpenLayers.Projection("EPSG:4326"),
+                    new OpenLayers.Projection(
+                        this.mapPanel.map.getProjection()))
             );
         } else {
             // means no record was selected



More information about the Commits mailing list