From c33dbe67d82a344ee9fd3765827eb86d6e9d4c9c Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Tue, 3 Jul 2012 15:17:29 +0100 Subject: [PATCH] printing and alternatives works! --- WebContent/printing/OSRM.Printing.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/WebContent/printing/OSRM.Printing.js b/WebContent/printing/OSRM.Printing.js index 081f1b8bf..c71c167f7 100644 --- a/WebContent/printing/OSRM.Printing.js +++ b/WebContent/printing/OSRM.Printing.js @@ -187,13 +187,15 @@ show: function(response) { // draw route & query for better geometry print_window.OSRM.drawRoute( positions ); OSRM.JSONP.call(OSRM.Routing._buildCall()+'&z='+zoom+'&instructions=false', OSRM.Printing.drawRoute, OSRM.Printing.timeoutRoute, OSRM.DEFAULTS.JSONP_TIMEOUT, 'print'); - // NOTE: simply appended correct zoom level as second zoom parameter to JSONP call -> OSRM API only considers the last one! + // NOTE: correct zoom level was appended as second zoom parameter to JSONP call -> OSRM API only considers the last one! }, timeoutRoute: function() {}, drawRoute: function(response) { if(!response) return; - var positions = OSRM.RoutingGeometry._decode(response.route_geometry, 5); + + response.alternative_geometries.unshift( response.route_geometry ); + positions = OSRM.RoutingGeometry._decode( response.alternative_geometries[ OSRM.G.active_alternative ], 5 ); OSRM.G.printwindow.OSRM.drawRoute( positions ); },