commented out route history
This commit is contained in:
parent
c0e86c47c2
commit
e7b3590352
@ -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); },
|
||||
|
@ -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; i<size; i++) {
|
||||
// var position = new OSRM.SimplePosition(markers[i].getLat(), markers[i].getLng(), markers[i].hint);
|
||||
//// lat:markers[i].getLat(),
|
||||
//// lng:markers[i].getLng(),
|
||||
//// hint:markers[i].hint
|
||||
//// };
|
||||
// this._history_data[0].push(position);
|
||||
// }
|
||||
// }
|
||||
if( document.getElementById('option-show-previous-routes').checked == false)
|
||||
return;
|
||||
console.log("store");
|
||||
this.fetchHistoryRoute();
|
||||
if(this.isShown() && this.isRoute()) {
|
||||
// store new route and positions in staging spot
|
||||
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; i<size; i++) {
|
||||
var position = {
|
||||
lat:markers[i].getLat(),
|
||||
lng:markers[i].getLng(),
|
||||
hint:markers[i].hint
|
||||
};
|
||||
this._history_data[0].push(position);
|
||||
}
|
||||
}
|
||||
},
|
||||
showHistoryRoutes: function() {
|
||||
// if( document.getElementById('option-show-previous-routes').checked == false)
|
||||
// return;
|
||||
// for(var i=1,size=this._history_routes; i<size; i++) {
|
||||
// this._history_route[i].setStyle( this._history_styles[i] );
|
||||
// this._history_route[i].show();
|
||||
// }
|
||||
if( document.getElementById('option-show-previous-routes').checked == false)
|
||||
return;
|
||||
console.log("show");
|
||||
for(var i=1,size=this._history_routes; i<size; i++) {
|
||||
this._history_route[i].setStyle( this._history_styles[i] );
|
||||
this._history_route[i].show();
|
||||
}
|
||||
},
|
||||
clearHistoryRoutes: function() {
|
||||
// for(var i=0,size=this._history_route.length; i<size; i++) {
|
||||
// this._history_route[i].hide();
|
||||
// this._history_route[i].setPositions( [] );
|
||||
// this._history_data[i] = [];
|
||||
// }
|
||||
for(var i=0,size=this._history_route.length; i<size; i++) {
|
||||
this._history_route[i].hide();
|
||||
this._history_route[i].setPositions( [] );
|
||||
this._history_data[i] = [];
|
||||
}
|
||||
},
|
||||
fetchHistoryRoute: function() {
|
||||
if( document.getElementById('option-show-previous-routes').checked == false)
|
||||
return;
|
||||
if( this._history_data[0].length == 0)
|
||||
return;
|
||||
console.log("fetch");
|
||||
// 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];
|
||||
}
|
||||
// reset staging spot
|
||||
this._history_route[0].setPositions( [] );
|
||||
this._history_data[0] = [];
|
||||
}
|
||||
});
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user