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

commits at geoext.org commits at geoext.org
Mon Mar 28 16:16:32 CEST 2011


Author: pgiraud
Date: 2011-03-28 16:16:32 +0200 (Mon, 28 Mar 2011)
New Revision: 2638

Added:
   sandbox/cmoullet/ux/GoogleEarthPanel/examples/eye.png
Modified:
   sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelWmsExample.js
   sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js
Log:
Adding (a quick and dirty) way to stylize the 2D map features for GoogleEarth

Modified: sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelWmsExample.js
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelWmsExample.js	2011-03-24 20:17:23 UTC (rev 2637)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/examples/GoogleEarthPanelWmsExample.js	2011-03-28 14:16:32 UTC (rev 2638)
@@ -78,6 +78,16 @@
         layers: [bluemarble, states]
     });
 
+    var features = [
+        new OpenLayers.Feature.Vector(null, {role: 'line'}, {strokeColor: '#39649C',
+            strokeWidth: 2}),
+        new OpenLayers.Feature.Vector(null, {role: 'lookAt'}, {pointRadius: 3,
+            fillColor: '#39649C'}),
+        new OpenLayers.Feature.Vector(null, {role: 'camera'}, {externalGraphic: 'eye.png',
+            graphicHeight: 20,
+            graphicWidth: 20,
+            graphicYOffset: -10,
+            rotation: 0})];
     var googleEarthPanelItem = {
         xtype: 'gxux_googleearthpanel',
         id: 'googleEarthPanelItem',
@@ -86,7 +96,8 @@
         altitude: 50,
         heading: 21.5,
         tilt: 70,
-        range: 1485370
+        range: 1485370,
+        features: features
     };
 
     var treeItem = new Ext.tree.TreePanel({
@@ -148,4 +159,4 @@
     treePanel.doLayout();
     GoogleEarthPanel.doLayout();
     viewport.doLayout();
-});
\ No newline at end of file
+});

Added: sandbox/cmoullet/ux/GoogleEarthPanel/examples/eye.png
===================================================================
(Binary files differ)


Property changes on: sandbox/cmoullet/ux/GoogleEarthPanel/examples/eye.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js	2011-03-24 20:17:23 UTC (rev 2637)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js	2011-03-28 14:16:32 UTC (rev 2638)
@@ -208,6 +208,12 @@
      */
     baseUrl: scriptSourceGoogleEarth.replace('/ux/widgets/GoogleEarthPanel.js', ''),
 
+    /** api: config[features]
+     *  ``Array(OpenLayers.Feature.Vector)``. The 3 features to be displayed on
+     *  the 2D map. Can be provided by the user for styling purpose.
+     */
+    features: null,
+
     /** private: method[initComponent]
      *  Private initComponent override.
      */
@@ -442,17 +448,19 @@
                 });
                 this.map.addLayer(this.earthLayer);
                 // Camera and lookAt points to display
-                this.features = [
-                    new OpenLayers.Feature.Vector(null, {role: 'line'}, {strokeColor: '#ff0000',
-                        strokeWidth: 3,
-                        pointRadius: 6}),
-                    new OpenLayers.Feature.Vector(null, {role: 'lookAt'}, {pointRadius: 8,
-                        fillColor: '#ff0000'}),
-                    new OpenLayers.Feature.Vector(null, {role: 'camera'}, {externalGraphic: this.baseUrl + '/resources/eye.png',
-                        graphicHeight: 18,
-                        graphicWidth: 31,
-                        graphicYOffset: -3,
-                        rotation: 0})];
+                if (!this.features) {
+                    this.features = [
+                        new OpenLayers.Feature.Vector(null, {role: 'line'}, {strokeColor: '#ff0000',
+                            strokeWidth: 3,
+                            pointRadius: 6}),
+                        new OpenLayers.Feature.Vector(null, {role: 'lookAt'}, {pointRadius: 8,
+                            fillColor: '#ff0000'}),
+                        new OpenLayers.Feature.Vector(null, {role: 'camera'}, {externalGraphic: this.baseUrl + '/resources/eye.png',
+                            graphicHeight: 18,
+                            graphicWidth: 31,
+                            graphicYOffset: -3,
+                            rotation: 0})];
+                }
 
                 // Drag control to move camera ans lookAt points
                 this.drag = new OpenLayers.Control.DragFeature(this.earthLayer, {



More information about the Commits mailing list