[Commits] r1791 - sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets

commits at geoext.org commits at geoext.org
Thu Jan 21 11:17:40 CET 2010


Author: cmoullet
Date: 2010-01-21 11:17:40 +0100 (Thu, 21 Jan 2010)
New Revision: 1791

Modified:
   sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js
Log:
support multiple url

Modified: sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js	2010-01-21 09:15:47 UTC (rev 1790)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js	2010-01-21 10:17:40 UTC (rev 1791)
@@ -159,10 +159,10 @@
     kmlUrl: null,
 
     /** api: config[networkLinkUrl]
-     *  Url for network link (default: null)
+     *  `` String`` or `` Array `` Url for network link (default: null)
      */
     /** private: property[networkLinkUrl]
-     *  Url for network link
+     *  `` String`` or `` Array `` Url for network link
      */
     networkLinkUrl: null,
 
@@ -296,13 +296,13 @@
 
         // Use network link
         if (this.networkLinkUrl) {
-            var link = this.ge.createLink('');
-            var href = this.networkLinkUrl;
-            link.setHref(href);
-
-            var networkLink = this.ge.createNetworkLink('');
-            networkLink.set(link, true, false); // Sets the link, refreshVisibility, and flyToView
-            this.ge.getFeatures().appendChild(networkLink);
+            if (this.networkLinkUrl.constructor.toString().indexOf("Array") != -1) {
+                for (var i = 0; i < this.networkLinkUrl.length; i++) {
+                    this.addNetwokLink(this.networkLinkUrl[i]);
+                }
+            } else {
+                this.addNetwokLink(this.networkLinkUrl);
+            }
         }
 
         if (this.layers) {
@@ -332,6 +332,18 @@
         this.earthAvailable = false;
     },
 
+    /** method[addNetwokLink]
+     *  Add a network link to the google earth panel
+     */
+    addNetwokLink: function(url) {
+        var link = this.ge.createLink('');
+        link.setHref(url);
+
+        var networkLink = this.ge.createNetworkLink('');
+        networkLink.set(link, true, false); // Sets the link, refreshVisibility, and flyToView
+        this.ge.getFeatures().appendChild(networkLink);
+    },
+
     /** method[addLayer]
      *  Add a WMS layer supporting KML output format
      *  :param layer: ``OpenLayers.Layer.WMS`` OpenLayers WMS layer
@@ -403,7 +415,7 @@
                         strokeWidth: 3,
                         pointRadius: 6}),
                     new OpenLayers.Feature.Vector(null, {role: 'lookAt'}, {pointRadius: 8,
-                        fillColor: '#ff0000'}),    
+                        fillColor: '#ff0000'}),
                     new OpenLayers.Feature.Vector(null, {role: 'camera'}, {externalGraphic: this.baseUrl + '/resources/eye.png',
                         graphicHeight: 18,
                         graphicWidth: 31,



More information about the Commits mailing list