diff --git a/WebContent/base/OSRM.Routes.js b/WebContent/base/OSRM.Routes.js index 8e603910b..b3919d518 100644 --- a/WebContent/base/OSRM.Routes.js +++ b/WebContent/base/OSRM.Routes.js @@ -30,6 +30,8 @@ OSRM.Route = function() { this._unnamed_route_style = {dashed:false, color:'#FF00FF', weight:10}; this._old_unnamed_route_style = {dashed:false, color:'#990099', weight:10}; + this._noroute = OSRM.Route.ROUTE; + this._route_history_styles = [{dashed:false, color:'#FF0000', weight:5}, {dashed:false, color:'#00FF00', weight:5}, {dashed:false, color:'#0000FF', weight:5}, @@ -41,31 +43,16 @@ OSRM.Route = function() { {dashed:false, color:'#770077', weight:5}, {dashed:false, color:'#007777', weight:5} ]; - this._route_history = [ new OSRM.SimpleRoute("current" , {dashed:false} ), - new OSRM.SimpleRoute("current" , {dashed:false} ), - new OSRM.SimpleRoute("current" , {dashed:false} ), - new OSRM.SimpleRoute("current" , {dashed:false} ), - new OSRM.SimpleRoute("current" , {dashed:false} ), - new OSRM.SimpleRoute("current" , {dashed:false} ), - new OSRM.SimpleRoute("current" , {dashed:false} ), - new OSRM.SimpleRoute("current" , {dashed:false} ), - new OSRM.SimpleRoute("current" , {dashed:false} ), - new OSRM.SimpleRoute("current" , {dashed:false} ) ]; - this._route_history_count = 0; - - this._noroute = OSRM.Route.ROUTE; + this._route_history = []; + for(var i=0, size=this._route_history_styles.length; i0; i--) -// this._route_history[i].setPositions( this._route_history[i-1].getPositions() ); -// this._route_history[0].setPositions( this._current_route.getPositions() ); -// } -// } }, hideRoute: function() { - if( document.getElementById('option-show-previous-routes').checked == true) { - for(var i=0,size=this._route_history.length; i0; i--) + this._route_history[i].setPositions( this._route_history[i-1].getPositions() ); + this._route_history[0].setPositions( this._current_route.getPositions() ); + } + }, + showHistoryRoutes: function() { + if( document.getElementById('option-show-previous-routes').checked == false) + return; + for(var i=1,size=this._route_history.length; i0; i--) - route._route_history[i].setPositions( route._route_history[i-1].getPositions() ); - route._route_history[0].setPositions( route._current_route.getPositions() ); - } - } + OSRM.G.route.storeHistoryRoute(); } OSRM.Routing._updateHints(response); @@ -97,6 +88,7 @@ showRoute: function(response) { OSRM.RoutingNoNames.show(response); OSRM.RoutingDescription.show(response); OSRM.Routing._snapRoute(); + OSRM.G.route.storeHistoryRoute(); } OSRM.Routing._updateHints(response); },