diff --git a/WebContent/base/OSRM.Routes.js b/WebContent/base/OSRM.Routes.js index e95b563c4..8e603910b 100644 --- a/WebContent/base/OSRM.Routes.js +++ b/WebContent/base/OSRM.Routes.js @@ -30,13 +30,28 @@ 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._route_history_styles = [{dashed:false, color:'#0033FF', weight:5}, -// {dashed:false, color:'#0011DD', weight:5}, -// {dashed:false, color:'#0000BB', weight:5}, -// {dashed:false, color:'#000099', weight:5}, -// {dashed:false, color:'#000077', weight:5} -// ]; -// this._route_history = []; + this._route_history_styles = [{dashed:false, color:'#FF0000', weight:5}, + {dashed:false, color:'#00FF00', weight:5}, + {dashed:false, color:'#0000FF', weight:5}, + {dashed:false, color:'#FF00FF', weight:5}, + {dashed:false, color:'#00FFFF', weight:5}, + {dashed:false, color:'#770000', weight:5}, + {dashed:false, color:'#007700', weight:5}, + {dashed:false, color:'#000077', weight:5}, + {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; }; @@ -45,21 +60,12 @@ OSRM.Route.ROUTE = false; OSRM.extend( OSRM.Route,{ showRoute: function(positions, noroute) { -// console.log("show route", this._route_history.length); -// if( document.getElementById('option-show-previous-routes').checked == true) { -// if(!this._noroute && this.isShown()) { -// this._route_history.push( this._current_route ); -// if(this._route_history.length==6) { -// this._route_history[0].hide(); -// this._route_history.splice(0,1); -// } -// 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() ); +// } +// } }, hideRoute: function() { + if( document.getElementById('option-show-previous-routes').checked == true) { + for(var i=0,size=this._route_history.length; i
-
+
Configuraion
-
Language:
-
+
Language:
+
-
Units:
-
+
Units:
+
@@ -106,8 +106,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
-
+
Mapping Tools
@@ -141,6 +141,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
+
diff --git a/WebContent/routing/OSRM.Routing.js b/WebContent/routing/OSRM.Routing.js index 7d4a360cc..f1761989d 100644 --- a/WebContent/routing/OSRM.Routing.js +++ b/WebContent/routing/OSRM.Routing.js @@ -65,6 +65,16 @@ showRouteSimple: function(response) { } else { OSRM.RoutingGeometry.show(response); OSRM.RoutingDescription.showSimple(response); + + // store history route + var route = OSRM.G.route; + if( document.getElementById('option-show-previous-routes').checked == true) { + if(route._noroute != OSRM.Route.NOROUTE) { + for(var i=route._route_history.length-1; i>0; i--) + route._route_history[i].setPositions( route._route_history[i-1].getPositions() ); + route._route_history[0].setPositions( route._current_route.getPositions() ); + } + } } OSRM.Routing._updateHints(response);