[Commits] r1544 - in sandbox/cmoullet/ux/GoogleEarthPanel: examples ux/widgets

commits at geoext.org commits at geoext.org
Thu Dec 3 13:28:56 CET 2009


Author: cmoullet
Date: 2009-12-03 13:28:55 +0100 (Thu, 03 Dec 2009)
New Revision: 1544

Modified:
   sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelExample.html
   sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelExample.js
   sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js
Log:
Permalink support. Need test.


Modified: sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelExample.html
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelExample.html	2009-12-03 05:49:34 UTC (rev 1543)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelExample.html	2009-12-03 12:28:55 UTC (rev 1544)
@@ -13,7 +13,7 @@
     <script src='http://maps.google.com/maps?file=api&amp;key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRSIMweZSjbRtcUk2F5YNqLnri0MahTrQJRaRPWFP0OUB1b6unv37Jg7vQ'></script>
     <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRSIMweZSjbRtcUk2F5YNqLnri0MahTrQJRaRPWFP0OUB1b6unv37Jg7vQ"></script>
     -->
-    <!--
+    <!-- 10.27.10.44
     <script src='http://maps.google.com/maps?file=api&amp;key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRQg15vMUgV9rqK5U3tGsPdx8x_OsBTeBHQ0wK75MLc8dB7yu0cRx36VJQ'></script>
     <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRQg15vMUgV9rqK5U3tGsPdx8x_OsBTeBHQ0wK75MLc8dB7yu0cRx36VJQ"></script>
     -->

Modified: sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelExample.js
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelExample.js	2009-12-03 05:49:34 UTC (rev 1543)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelExample.js	2009-12-03 12:28:55 UTC (rev 1544)
@@ -124,7 +124,7 @@
     GoogleEarthPanel.doLayout();
     viewport.doLayout();
 
-    //var parameters = OpenLayers.Util.getParameters();
-    //var streetViewPanelItemObj = Ext.getCmp("googleEarthPanelItem");
-    //streetViewPanelItemObj.setPermalink(parameters);
+    var parameters = OpenLayers.Util.getParameters();
+    var googleEarthPanelItemObj = Ext.getCmp("googleEarthPanelItem");
+    googleEarthPanelItemObj.setPermalink(parameters);
 });
\ No newline at end of file

Modified: sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js	2009-12-03 05:49:34 UTC (rev 1543)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js	2009-12-03 12:28:55 UTC (rev 1544)
@@ -131,9 +131,23 @@
         GeoExt.ux.GoogleEarthPanel.superclass.afterRender.call(this);
 
         // http://code.google.com/apis/earth/documentation/reference/google_earth_namespace.html
-        google.earth.createInstance(this.body.dom, this.initCallback.createDelegate(this), this.failureCallback.createDelegate(this));
+        if (!this.ge) {
+            google.earth.createInstance(this.body.dom, this.initCallback.createDelegate(this), this.failureCallback.createDelegate(this));
+        }
     },
 
+    setLookAt: function (lat, lon, altitude, altitudeMode, heading, tilt, range) {
+        var lookAt = this.ge.createLookAt('');
+        lookAt.set(lat,
+                lon,
+                altitude,
+                altitudeMode,
+                heading,
+                tilt,
+                range);
+        this.ge.getView().setAbstractView(lookAt);
+    },
+
     // Init Google Earth
     initCallback: function(object) {
         this.ge = object;
@@ -141,15 +155,14 @@
         // Set Google Earth Properties
         this.ge.getWindow().setVisibility(true);
         this.geProperties.geProjection = new OpenLayers.Projection("EPSG:4326");
-        var lookAt = this.ge.createLookAt('');
-        lookAt.set(this.lookAt.lat,
+        this.altitudeMode=this.ge.ALTITUDE_RELATIVE_TO_GROUND;
+        this.setLookAt(this.lookAt.lat,
                 this.lookAt.lon,
                 this.altitude,
-                this.ge.ALTITUDE_RELATIVE_TO_GROUND,
+                this.altitudeMode,
                 this.heading,
                 this.tilt,
                 this.range);
-        this.ge.getView().setAbstractView(lookAt);
         this.ge.getNavigationControl().setVisibility(this.ge.VISIBILITY_SHOW);
         this.ge.getOptions().setFlyToSpeed(this.ge.SPEED_TELEPORT);
         this.showGeLayers();
@@ -296,8 +309,8 @@
         permalink = permalink + "&showBuildingsLowResolutionLayer=" + this.showBuildingsLowResolutionLayer;
         permalink = permalink + "&navigationMode2D=" + this.navigationMode2D;
         permalink = permalink + "&navigationModeFrom2D=" + this.navigationModeFrom2D;
-        permalink = permalink + "&navigationModeFrom2D=" + this.navigationMode3D;
-        permalink = permalink + "&navigationModeFrom2D=" + this.clickMode;
+        permalink = permalink + "&navigationMode3D=" + this.navigationMode3D;
+        permalink = permalink + "&clickMode=" + this.clickMode;
         if (this.map) {
             permalink = permalink + "&easting=" + this.map.getCenter().lon;
             permalink = permalink + "&northing=" + this.map.getCenter().lat;
@@ -308,7 +321,73 @@
 
     // Set the permalink
     setPermalink: function(parameters) {
-
+        if (parameters.easting && parameters.northing) {
+            var position = new OpenLayers.LonLat(parseFloat(parameters.easting), parseFloat(parameters.northing));
+            if (this.map) {
+                this.map.setCenter(position);
+            }
+        }
+        if (parameters.zoom) {
+            if (this.map) {
+                this.map.zoomTo(parseInt(parameters.zoom, 10));
+            }
+        }
+        if (parameters.lookAtLatitude && parameters.lookAtLongitude) {
+            this.lookAt = new OpenLayers.LonLat(parseFloat(parameters.lookAtLongitude), parseFloat(parameters.lookAtLatitude));
+        }
+        if (parameters.altitude) {
+            this.altitude = parseFloat(parameters.altitude);
+        }
+        if (parameters.heading) {
+            this.heading = parseFloat(parameters.heading);
+        }
+        if (parameters.tilt) {
+            this.tilt = parseFloat(parameters.tilt);
+        }
+        if (parameters.range) {
+            this.range = parseFloat(parameters.range);
+        }
+        if (parameters.altitudeMode) {
+            this.altitudeMode = parameters.altitudeMode;
+        }
+        if (parameters.showBordersLayer) {
+            this.showBordersLayer = parameters.showBordersLayer;
+        }
+        if (parameters.showTerrainLayer) {
+            this.showTerrainLayer = parameters.showTerrainLayer;
+        }
+        if (parameters.showRoadsLayer) {
+            this.showRoadsLayer = parameters.showRoadsLayer;
+        }
+        if (parameters.showBuildingsLayer) {
+            this.showBuildingsLayer = parameters.showBuildingsLayer;
+        }
+        if (parameters.showBuildingsLowResolutionLayer) {
+            this.showBuildingsLowResolutionLayer = parameters.showBuildingsLowResolutionLayer;
+        }
+        if (parameters.navigationMode2D) {
+            this.navigationMode2D = parameters.navigationMode2D;
+        }
+        if (parameters.navigationModeFrom2D) {
+            this.navigationModeFrom2D = parameters.navigationModeFrom2D;
+        }
+        if (parameters.navigationMode3D) {
+            this.navigationMode3D = parameters.navigationMode3D;
+        }
+        if (parameters.clickMode) {
+            this.clickMode = parameters.clickMode;
+        }
+        if (this.ge) {
+            google.earth.createInstance(this.body.dom, this.initCallback.createDelegate(this), this.failureCallback.createDelegate(this));
+        } else {
+            this.setLookAt(this.lookAt.lat,
+                this.lookAt.lon,
+                this.altitude,
+                this.altitudeMode,
+                this.heading,
+                this.tilt,
+                this.range);
+        }
     },
 
     beforeDestroy: function() {



More information about the Commits mailing list