From e7b3590352046d39d0bd8d91f05e5e6b665f0f6f Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Fri, 11 May 2012 15:08:04 +0100 Subject: [PATCH] commented out route history --- WebContent/base/OSRM.Map.js | 2 +- WebContent/base/OSRM.Routes.js | 94 ++++++++++++++++-------------- WebContent/gui/OSRM.RoutingGUI.js | 10 ++-- WebContent/routing/OSRM.Routing.js | 6 +- 4 files changed, 58 insertions(+), 54 deletions(-) diff --git a/WebContent/base/OSRM.Map.js b/WebContent/base/OSRM.Map.js index 8cdb504d9..22625efd2 100644 --- a/WebContent/base/OSRM.Map.js +++ b/WebContent/base/OSRM.Map.js @@ -78,7 +78,7 @@ zoomed: function(e) { OSRM.Routing.getRoute_Dragging(); else OSRM.Routing.getRoute_Redraw(); -// OSRM.Routing.getRoute_History(); +// OSRM.Routing.getRoute_RedrawHistory(); }, contextmenu: function(e) {;}, mousemove: function(e) { OSRM.Via.drawDragMarker(e); }, diff --git a/WebContent/base/OSRM.Routes.js b/WebContent/base/OSRM.Routes.js index 6139263ca..933fc99ef 100644 --- a/WebContent/base/OSRM.Routes.js +++ b/WebContent/base/OSRM.Routes.js @@ -18,16 +18,6 @@ or see http://www.gnu.org/licenses/agpl.txt. // OSRM route management (handles drawing of route geometry - current route, old route, unnamed route, highlight unnamed streets) // [this holds the route geometry] -//OSRM.SimplePosition = function(lat, lng, hint) { -// this.lat = lat; -// this.lng = lng; -// this.hint = hint; -//}; -//OSRM.extend( OSRM.SimplePosition,{ -//getLat: function() { return this.lat; }, -//getLng: function() { return this.lng; } -//}); - OSRM.Route = function() { this._current_route = new OSRM.SimpleRoute("current" , {dashed:false} ); @@ -67,7 +57,7 @@ OSRM.Route.ROUTE = false; OSRM.extend( OSRM.Route,{ showRoute: function(positions, noroute) { - this.showHistoryRoutes(); +// this.showHistoryRoutes(); this._noroute = noroute; this._current_route.setPositions( positions ); if ( this._noroute == OSRM.Route.NOROUTE ) @@ -78,7 +68,8 @@ OSRM.extend( OSRM.Route,{ //this._raiseUnnamedRoute(); }, hideRoute: function() { - this.showHistoryRoutes(); +// this.fetchHistoryRoute(); +// this.showHistoryRoutes(); this._current_route.hide(); this._unnamed_route.hide(); // deactivate printing @@ -88,7 +79,7 @@ OSRM.extend( OSRM.Route,{ this.hideRoute(); this._old_route.hide(); this._noroute = OSRM.Route.ROUTE; - this.clearHistoryRoutes(); +// this.clearHistoryRoutes(); }, showUnnamedRoute: function(positions) { @@ -145,41 +136,54 @@ OSRM.extend( OSRM.Route,{ // history route handling storeHistoryRoute: function() { -// if( document.getElementById('option-show-previous-routes').checked == false) -// return; -// if(this.isShown() && this.isRoute()) { -// // move route and positions -// for(var i=this._history_routes-1; i>0; i--) { -// this._history_route[i].setPositions( this._history_route[i-1].getPositions() ); -// this._history_data[i] = this._history_data[i-1]; -// } -// // store new route and positions -// this._history_route[0].setPositions( this._current_route.getPositions() ); -// this._history_data[0] = []; -// var markers = OSRM.G.markers.route; -// for(var i=0,size=markers.length; i0; i--) { + this._history_route[i].setPositions( this._history_route[i-1].getPositions() ); + this._history_data[i] = this._history_data[i-1]; + } + // reset staging spot + this._history_route[0].setPositions( [] ); + this._history_data[0] = []; } }); diff --git a/WebContent/gui/OSRM.RoutingGUI.js b/WebContent/gui/OSRM.RoutingGUI.js index e1fa88216..13a1d34e1 100644 --- a/WebContent/gui/OSRM.RoutingGUI.js +++ b/WebContent/gui/OSRM.RoutingGUI.js @@ -80,7 +80,7 @@ reverseRouting: function() { // click: button "show" showMarker: function(marker_id) { - if( OSRM.JSONP.fences["geocoder_source"] || OSRM.JSONP.fences["geocoder_target"] ) + if( OSRM.JSONP.fences["geocoder_source"] || OSRM.JSONP.fences["geocoder_target"] ) // needed when focus was on input box and user clicked on button return; if( marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() ) @@ -140,10 +140,10 @@ deleteMarker: function(marker_id) { //click: checkbox "show previous routes" showPreviousRoutes: function(value) { - if( document.getElementById('option-show-previous-routes').checked == false) - OSRM.G.route.clearHistoryRoutes(); - else - OSRM.G.route.storeHistoryRoute(); +// if( document.getElementById('option-show-previous-routes').checked == false) +// OSRM.G.route.clearHistoryRoutes(); +// else +// OSRM.G.route.storeHistoryRoute(); } }); diff --git a/WebContent/routing/OSRM.Routing.js b/WebContent/routing/OSRM.Routing.js index 82550aff3..cee67dc5c 100644 --- a/WebContent/routing/OSRM.Routing.js +++ b/WebContent/routing/OSRM.Routing.js @@ -65,7 +65,7 @@ showRouteSimple: function(response) { } else { OSRM.RoutingGeometry.show(response); OSRM.RoutingDescription.showSimple(response); - OSRM.G.route.storeHistoryRoute(); +// OSRM.G.route.storeHistoryRoute(); } OSRM.Routing._updateHints(response); @@ -88,7 +88,7 @@ showRoute: function(response) { OSRM.RoutingNoNames.show(response); OSRM.RoutingDescription.show(response); OSRM.Routing._snapRoute(); - OSRM.G.route.storeHistoryRoute(); +// OSRM.G.route.storeHistoryRoute(); } OSRM.Routing._updateHints(response); }, @@ -146,7 +146,7 @@ getRoute_Redraw: function() { OSRM.JSONP.clear('redraw'); OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=true', OSRM.Routing.showRouteRedraw, OSRM.Routing.timeoutRoute, OSRM.DEFAULTS.JSONP_TIMEOUT, 'redraw'); }, -getRoute_History: function() { +getRoute_RedrawHistory: function() { for(var i=0; i<10; i++) if( OSRM.G.route._history_data[i].length > 0 ) { OSRM.JSONP.clear('history'+i);