[Commits] r1554 - in sandbox/cmoullet/ux/GoogleEarthPanel: examples ux/widgets
commits at geoext.org
commits at geoext.org
Fri Dec 4 20:48:56 CET 2009
Author: cmoullet
Date: 2009-12-04 20:48:56 +0100 (Fri, 04 Dec 2009)
New Revision: 1554
Added:
sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelWmsExample.html
sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelWmsExample.js
Modified:
sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelExample.html
sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js
Log:
initial kml support.... not finished at all
Modified: sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelExample.html
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelExample.html 2009-12-04 07:29:20 UTC (rev 1553)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelExample.html 2009-12-04 19:48:56 UTC (rev 1554)
@@ -9,19 +9,21 @@
<script src='http://maps.google.com/maps?file=api&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRTv_-xvSZ6KJmWSkQfCJoxbiB7tyBQ1ey_kgwA_p7sbTQSTOBeMyXtXkA"></script>
-->
- <!-- 192.168.1.44
+ <!-- 192.168.1.44 -->
+ <!-- -->
<script src='http://maps.google.com/maps?file=api&key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRSIMweZSjbRtcUk2F5YNqLnri0MahTrQJRaRPWFP0OUB1b6unv37Jg7vQ'></script>
<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRSIMweZSjbRtcUk2F5YNqLnri0MahTrQJRaRPWFP0OUB1b6unv37Jg7vQ"></script>
- -->
- <!-- 10.27.10.44
+
+ <!-- 10.27.10.44 -->
+ <!--
<script src='http://maps.google.com/maps?file=api&key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRQg15vMUgV9rqK5U3tGsPdx8x_OsBTeBHQ0wK75MLc8dB7yu0cRx36VJQ'></script>
<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRQg15vMUgV9rqK5U3tGsPdx8x_OsBTeBHQ0wK75MLc8dB7yu0cRx36VJQ"></script>
- -->
+ -->
- <!-- Google Maps API for "dev.geoext.org" -->
+ <!-- Google Maps API for "dev.geoext.org"
<script src='http://maps.google.com/maps?file=api&key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRTv_-xvSZ6KJmWSkQfCJoxbiB7tyBQ1ey_kgwA_p7sbTQSTOBeMyXtXkA'></script>
<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRTv_-xvSZ6KJmWSkQfCJoxbiB7tyBQ1ey_kgwA_p7sbTQSTOBeMyXtXkA"></script>
-
+ -->
<script src="http://openlayers.org/api/2.8/OpenLayers.js"></script>
<script type="text/javascript" src="../../../trunk/geoext/lib/GeoExt.js"></script>
Added: sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelWmsExample.html
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelWmsExample.html (rev 0)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelWmsExample.html 2009-12-04 19:48:56 UTC (rev 1554)
@@ -0,0 +1,37 @@
+<html>
+<head>
+ <title>GeoExt StreetView Panel UX Example</title>
+ <script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.js"></script>
+ <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/resources/css/ext-all.css" />
+ <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/examples/shared/examples.css" />
+ <!-- Google Maps API for "localhost" -->
+ <!--
+ <script src='http://maps.google.com/maps?file=api&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
+ <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRTv_-xvSZ6KJmWSkQfCJoxbiB7tyBQ1ey_kgwA_p7sbTQSTOBeMyXtXkA"></script>
+ -->
+ <!-- 192.168.1.44 -->
+ <!--
+ <script src='http://maps.google.com/maps?file=api&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&key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRQg15vMUgV9rqK5U3tGsPdx8x_OsBTeBHQ0wK75MLc8dB7yu0cRx36VJQ'></script>
+ <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRQg15vMUgV9rqK5U3tGsPdx8x_OsBTeBHQ0wK75MLc8dB7yu0cRx36VJQ"></script>
+ -->
+
+ <!-- Google Maps API for "dev.geoext.org" -->
+ <script src='http://maps.google.com/maps?file=api&key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRTv_-xvSZ6KJmWSkQfCJoxbiB7tyBQ1ey_kgwA_p7sbTQSTOBeMyXtXkA'></script>
+ <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRTv_-xvSZ6KJmWSkQfCJoxbiB7tyBQ1ey_kgwA_p7sbTQSTOBeMyXtXkA"></script>
+
+ <script src="http://openlayers.org/api/2.8/OpenLayers.js"></script>
+ <script type="text/javascript" src="../../../trunk/geoext/lib/GeoExt.js"></script>
+
+ <script type="text/javascript" src="../ux/widgets/GoogleEarthPanel.js"></script>
+ <script type="text/javascript" src="../ux/control/GoogleEarthClick.js"></script>
+ <script type="text/javascript" src="GoogleEarthPanelWmsExample.js"></script>
+
+</head>
+<body>
+</body>
+</html>
\ No newline at end of file
Added: sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelWmsExample.js
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelWmsExample.js (rev 0)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelWmsExample.js 2009-12-04 19:48:56 UTC (rev 1554)
@@ -0,0 +1,123 @@
+var mapPanel;
+
+var GoogleEarthPanel;
+
+var viewport;
+
+var layer;
+
+google.load("earth", "1");
+
+Ext.onReady(function() {
+
+ layer = new OpenLayers.Layer.WMS(
+ "GeoServer WMS",
+ "http://sigma.openplans.org/geoserver/ows?",
+ {layers: 'bluemarble'},
+ {singleTile: true}
+ );
+
+
+ var map = new OpenLayers.Map();
+
+ var center = new OpenLayers.LonLat(6.25, 46.38);
+
+ var mouse = new OpenLayers.Control.MousePosition();
+
+ map.addControl(mouse);
+ mouse.activate();
+
+ var toolbar = new Ext.Toolbar({
+ items: [
+ {
+ xtype: 'tbfill'
+ },
+ {
+ text: 'Google Earth',
+ id: "googleToggle",
+ enableToggle: true,
+ pressed: true,
+ handler: function() {
+ if (this.pressed) {
+ GoogleEarthPanel.add(googleEarthPanelItem);
+ GoogleEarthPanel.setSize('50%', 0);
+ GoogleEarthPanel.setVisible(true);
+ GoogleEarthPanel.doLayout();
+ viewport.doLayout();
+ } else {
+ GoogleEarthPanel.remove('googleEarthPanelItem');
+ GoogleEarthPanel.setWidth(0);
+ GoogleEarthPanel.setVisible(false);
+ GoogleEarthPanel.doLayout();
+ viewport.doLayout();
+ }
+ }
+ },
+ {
+ text: 'Permalink',
+ enableToggle: false,
+ handler: function() {
+ var googleEarthPanelItem = Ext.getCmp("googleEarthPanelItem");
+ if (googleEarthPanelItem) {
+ window.open(googleEarthPanelItem.getPermalink(true));
+ }
+ }
+ }
+ ]});
+
+ var googleEarthPanelItem = {
+ xtype: 'gxux_googleearthpanel',
+ id: 'googleEarthPanelItem',
+ map: map,
+ altitude: 50,
+ heading: -60,
+ tilt: 70,
+ range: 700
+ };
+
+ viewport = new Ext.Viewport({
+ layout: "border",
+ id: 'mainViewport',
+ items: [
+ {
+ region: "center",
+ id: "mappanel",
+ title: "Google Map",
+ xtype: "gx_mappanel",
+ map: map,
+ layers: [layer],
+ center: center,
+ zoom: 12,
+ split: true,
+ tbar: toolbar
+ },
+ {
+ region: "east",
+ layout: 'fit',
+ width: '50%',
+ id: "googleearthpanel",
+ title: 'Google Earth Panel',
+ closeAction: 'hide',
+ split: true
+ },
+ {
+ region: "south",
+ layout: 'fit',
+ id: "readme",
+ title: 'README',
+ margins: {left: 5,top: 5, bottom: 5, right: 5},
+ html: '<p style="font-size:12pt;color:#15428B;font-weight:bold;margin:5">Google Earth Panel in action. Enjoy !</p>'
+ }
+ ]
+ });
+
+ mapPanel = Ext.getCmp("mappanel");
+ GoogleEarthPanel = Ext.getCmp("googleearthpanel");
+ GoogleEarthPanel.add(googleEarthPanelItem);
+ GoogleEarthPanel.doLayout();
+ viewport.doLayout();
+
+ 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-04 07:29:20 UTC (rev 1553)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js 2009-12-04 19:48:56 UTC (rev 1554)
@@ -127,6 +127,10 @@
*/
kmlUrl: null,
+ layers: null,
+
+ layerCache: {},
+
initComponent: function() {
var defConfig = {
border: true
@@ -169,6 +173,10 @@
initCallback: function(object) {
this.ge = object;
+ if (this.map) {
+ this.layers = this.map.layers;
+ }
+
// Set Google Earth Properties
this.ge.getWindow().setVisibility(true);
@@ -176,7 +184,7 @@
this.lookAt = this.map.getCenter();
this.transformToGE(this.lookAt);
}
-
+
this.setLookAt(this.lookAt.lat,
this.lookAt.lon,
this.altitude,
@@ -201,6 +209,10 @@
});
}
+ for (var i = 0; i < this.layers.length; i++) {
+ this.addLayer(this.layers[i]);
+ }
+
// Adds listener to refresh camera and lookAt points on 2D map
var self = this;
google.earth.addEventListener(this.ge, "frameend", function() {
@@ -212,6 +224,37 @@
this.earthAvailable = false;
},
+ addLayer: function(layer, order) {
+ if (this.ge) {
+ if (layer.CLASS_NAME == 'OpenLayers.Layer.WMS') {
+ var name = layer.id;
+ var networkLink = null;
+
+ if (this.layerCache[name]) {
+ networkLink = this.layerCache[name];
+ } else {
+ var link = this.ge.createLink('kl_' + name);
+ var ows = layer.url;
+ ows = ows.replace(/\?.*/, '');
+ var kmlPath = '/kml?mode=refresh&layers=' + layer.params.LAYERS;
+ link.setHref(ows + kmlPath);
+ networkLink = this.ge.createNetworkLink('nl_' + name);
+ networkLink.setName(name);
+ networkLink.setLink(link);
+ this.layerCache[name] = networkLink;
+ }
+
+ networkLink.setVisibility(layer.getVisibility());
+
+ if (order !== undefined && order < this.ge.getFeatures().getChildNodes().getLength()) {
+ this.ge.getFeatures().insertBefore(this.ge.getFeatures().getChildNodes().item(order));
+ } else {
+ this.ge.getFeatures().appendChild(networkLink);
+ }
+ }
+ }
+ },
+
setNavigationMode2D: function(state) {
this.navigationMode2D = state;
if (state) {
@@ -538,13 +581,15 @@
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);
+ if (this.lookAt) {
+ this.setLookAt(this.lookAt.lat,
+ this.lookAt.lon,
+ this.altitude,
+ this.altitudeMode,
+ this.heading,
+ this.tilt,
+ this.range);
+ }
}
},
More information about the Commits
mailing list