This commit is contained in:
DennisSchiefer 2012-05-10 12:52:55 +01:00
parent 224c55dec1
commit 47b2268504
4 changed files with 74 additions and 43 deletions

View File

@ -30,13 +30,28 @@ OSRM.Route = function() {
this._unnamed_route_style = {dashed:false, color:'#FF00FF', weight:10}; this._unnamed_route_style = {dashed:false, color:'#FF00FF', weight:10};
this._old_unnamed_route_style = {dashed:false, color:'#990099', weight:10}; this._old_unnamed_route_style = {dashed:false, color:'#990099', weight:10};
// this._route_history_styles = [{dashed:false, color:'#0033FF', weight:5}, this._route_history_styles = [{dashed:false, color:'#FF0000', weight:5},
// {dashed:false, color:'#0011DD', weight:5}, {dashed:false, color:'#00FF00', weight:5},
// {dashed:false, color:'#0000BB', weight:5}, {dashed:false, color:'#0000FF', weight:5},
// {dashed:false, color:'#000099', weight:5}, {dashed:false, color:'#FF00FF', weight:5},
// {dashed:false, color:'#000077', weight:5} {dashed:false, color:'#00FFFF', weight:5},
// ]; {dashed:false, color:'#770000', weight:5},
// this._route_history = []; {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; this._noroute = OSRM.Route.ROUTE;
}; };
@ -45,21 +60,12 @@ OSRM.Route.ROUTE = false;
OSRM.extend( OSRM.Route,{ OSRM.extend( OSRM.Route,{
showRoute: function(positions, noroute) { showRoute: function(positions, noroute) {
// console.log("show route", this._route_history.length); if( document.getElementById('option-show-previous-routes').checked == true) {
// if( document.getElementById('option-show-previous-routes').checked == true) { for(var i=0,size=this._route_history.length; i<size; i++) {
// if(!this._noroute && this.isShown()) { this._route_history[i].setStyle( this._route_history_styles[i] );
// this._route_history.push( this._current_route ); this._route_history[i].show();
// 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; i<size; i++) {
// this._route_history[i].setStyle( this._route_history_styles[i] );
// this._route_history[i].show();
// }
// this._current_route = new OSRM.SimpleRoute("current" , {dashed:false} );
// }
// }
this._noroute = noroute; this._noroute = noroute;
this._current_route.setPositions( positions ); this._current_route.setPositions( positions );
if ( this._noroute == OSRM.Route.NOROUTE ) if ( this._noroute == OSRM.Route.NOROUTE )
@ -68,24 +74,38 @@ OSRM.extend( OSRM.Route,{
this._current_route.setStyle( this._current_route_style ); this._current_route.setStyle( this._current_route_style );
this._current_route.show(); this._current_route.show();
//this._raiseUnnamedRoute(); //this._raiseUnnamedRoute();
// if( document.getElementById('option-show-previous-routes').checked == true) {
// if(this._noroute != OSRM.Route.NOROUTE) {
// for(var i=4; i>0; i--)
// this._route_history[i].setPositions( this._route_history[i-1].getPositions() );
// this._route_history[0].setPositions( this._current_route.getPositions() );
// }
// }
}, },
hideRoute: function() { hideRoute: function() {
if( document.getElementById('option-show-previous-routes').checked == true) {
for(var i=0,size=this._route_history.length; i<size; i++) {
this._route_history[i].setStyle( this._route_history_styles[i] );
this._route_history[i].show();
}
}
this._current_route.hide(); this._current_route.hide();
this._unnamed_route.hide(); this._unnamed_route.hide();
// activate printing // deactivate printing
OSRM.Printing.deactivate(); OSRM.Printing.deactivate();
}, },
hideAll: function() { hideAll: function() {
this.hideRoute(); this.hideRoute();
this._old_route.hide(); this._old_route.hide();
this._noroute = OSRM.Route.ROUTE; this._noroute = OSRM.Route.ROUTE;
// this.clearHistoryRoutes(); this.clearHistoryRoutes();
},
clearHistoryRoutes: function() {
for(var i=0,size=this._route_history.length; i<size; i++)
this._route_history[i].hide();
this._route_history = [];
}, },
// clearHistoryRoutes: function() {
// for(var i=0,size=this._route_history.length; i<size; i++)
// this._route_history[i].hide();
// this._route_history = [];
// },
showUnnamedRoute: function(positions) { showUnnamedRoute: function(positions) {
this._unnamed_route.clearRoutes(); this._unnamed_route.clearRoutes();

View File

@ -130,7 +130,7 @@ html, body {
width:410px; width:410px;
height:100px; height:100px;
bottom:25px; bottom:25px;
right:-410px; right:5px;
} }
#mapping-content #mapping-content
{ {
@ -142,7 +142,7 @@ html, body {
width:410px; width:410px;
height:100px; height:100px;
bottom:25px; bottom:25px;
right:-410px; right:5px;
} }
#config-content #config-content
{ {
@ -152,11 +152,16 @@ html, body {
/* general styles for gui box content */ /* general styles for gui box content */
div.label .label
{ {
font-weight:bold; font-weight:bold;
margin-bottom:10px; margin-bottom:10px;
} }
.inner-label
{
padding:0px 20px 0px 5px;
}
/* styles for main-input areas */ /* styles for main-input areas */
@ -183,11 +188,6 @@ div.label
#gui-language-toggle #gui-language-toggle
{ {
position:absolute; position:absolute;
border: 0px;
text-decoration:none;
opacity: 0;
filter: alpha(opacity=0);
z-index: 5;
} }
.top-left-button .top-left-button

View File

@ -87,16 +87,16 @@ or see http://www.gnu.org/licenses/agpl.txt.
<!-- config gui --> <!-- config gui -->
<div id="config-wrapper" class="box-wrapper not-selectable"> <div id="config-wrapper" class="box-wrapper not-selectable">
<div id="config-content" class="box-content"> <div id="config-content" class="box-content">
<div id="config-toggle" class="iconic-button cancel-marker top-right-button"></div>
<div id="config-toggle" class="iconic-button cancel-marker top-right-button"></div>
<div id="gui-config-label" class="label">Configuraion</div> <div id="gui-config-label" class="label">Configuraion</div>
<div class="full"> <div class="full">
<div class="row"> <div class="row">
<div id="gui-language-label" class="left">Language:</div> <div id="gui-language-label" class="left inner-label">Language:</div>
<div id="gui-language-area" class="left"><select id="gui-language-toggle-2" style="width:100px;"></select></div></div> <div id="gui-language-area" class="left stretch"><!-- <select id="gui-language-toggle-2" style="width:100px;"></select> --></div></div>
<div class="row"> <div class="row">
<div id="gui-units-label" class="left">Units:</div> <div id="gui-units-label" class="left inner-label">Units:</div>
<div id="gui-units-area" class="left"><select id="gui-units-toggle" style="width:100px;"></select></div> <div id="gui-units-area" class="left stretch"><select id="gui-units-toggle" style="width:100px;"></select></div>
</div> </div>
</div> </div>
@ -106,8 +106,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
<!-- mapping gui --> <!-- mapping gui -->
<div id="mapping-wrapper" class="box-wrapper not-selectable"> <div id="mapping-wrapper" class="box-wrapper not-selectable">
<div id="mapping-content" class="box-content"> <div id="mapping-content" class="box-content">
<div id="mapping-toggle" class="iconic-button cancel-marker top-right-button"></div>
<div id="mapping-toggle" class="iconic-button cancel-marker top-right-button"></div>
<div id="gui-mapping-label" class="label">Mapping Tools</div> <div id="gui-mapping-label" class="label">Mapping Tools</div>
<div class="full"> <div class="full">
<div class="row"> <div class="row">
@ -141,6 +141,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
<!-- header --> <!-- header -->
<div id="input-mask-header"> <div id="input-mask-header">
<select id="gui-language-toggle" class="top-left-button"></select> <select id="gui-language-toggle" class="top-left-button"></select>
<select id="gui-language-toggle-2" style="width:100px;"></select>
<div id="main-toggle" class="iconic-button cancel-marker top-right-button"></div> <div id="main-toggle" class="iconic-button cancel-marker top-right-button"></div>
</div> </div>

View File

@ -65,6 +65,16 @@ showRouteSimple: function(response) {
} else { } else {
OSRM.RoutingGeometry.show(response); OSRM.RoutingGeometry.show(response);
OSRM.RoutingDescription.showSimple(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); OSRM.Routing._updateHints(response);