[Commits] r1911 - sandbox/cmoullet/ux/RoutingPanel/ux/widgets

commits at geoext.org commits at geoext.org
Tue Feb 23 09:29:16 CET 2010


Author: cmoullet
Date: 2010-02-23 09:29:15 +0100 (Tue, 23 Feb 2010)
New Revision: 1911

Modified:
   sandbox/cmoullet/ux/RoutingPanel/ux/widgets/RoutingPanel.js
Log:
add Google Itinerary links

Modified: sandbox/cmoullet/ux/RoutingPanel/ux/widgets/RoutingPanel.js
===================================================================
--- sandbox/cmoullet/ux/RoutingPanel/ux/widgets/RoutingPanel.js	2010-02-23 08:25:39 UTC (rev 1910)
+++ sandbox/cmoullet/ux/RoutingPanel/ux/widgets/RoutingPanel.js	2010-02-23 08:29:15 UTC (rev 1911)
@@ -193,6 +193,14 @@
      */
     geocodingUrl: null,
 
+    /** api: config[showGoogleItinerary]
+     *  Define if the google itinerary links are shown in the result panel
+     */
+    /** private: property[showGoogleItinerary]
+     *  Define if the google itinerary links are shown in the result panel
+     */
+    showGoogleItinerary: true,
+
     /** api: config[routingStyle]
      *  Vector style of the routing path
      */
@@ -727,7 +735,11 @@
                 }
                 if (this.routingStatusCloudmade == '0') {
                     this.drawRoute();
-                    this.routingResultPanel.html = OpenLayers.i18n('Total length: ') + Math.round(this.routingRouteSummaryCloudmade.total_distance / 1000) + ' [km]';
+                    var googleLinks = ''
+                    if (this.showGoogleItinerary) {
+                        var googleLinks = '<a href="http://maps.google.com/maps?source=s_d&saddr='+this.startLocationCombo.locationString+'&daddr='+this.endLocationCombo.locationString+'&dirflg=a" target="new">'+OpenLayers.i18n('Google Itinerary by car')+'</a><br><a href="http://maps.google.com/maps?source=s_d&saddr='+this.startLocationCombo.locationString+'&daddr='+this.endLocationCombo.locationString+'&dirflg=r" target="new">'+OpenLayers.i18n('Google Itinerary by public transport')+'</a><br><a href="http://maps.google.com/maps?source=s_d&saddr='+this.startLocationCombo.locationString+'&daddr='+this.endLocationCombo.locationString+'&dirflg=w" target="new">'+OpenLayers.i18n('Google Itinerary on foot')+'</a>';
+                    }
+                    this.routingResultPanel.html = OpenLayers.i18n('Total length: ') + Math.round(this.routingRouteSummaryCloudmade.total_distance / 1000) + ' [km]<br>' + googleLinks;
                     this.routingResultPanel.body.update(this.routingResultPanel.html);
                 } else {
                     this.routingResultPanel.html = this.routingStatusMessageCloudmade;



More information about the Commits mailing list