temporary commit
This commit is contained in:
parent
e1cb34cf38
commit
f8779e479e
@ -19,6 +19,23 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
// [has to be loaded directly after OSRM.base]
|
// [has to be loaded directly after OSRM.base]
|
||||||
|
|
||||||
OSRM.DEFAULTS = {
|
OSRM.DEFAULTS = {
|
||||||
|
ROUTING_ENGINES: [
|
||||||
|
{ url:'http://router.project-osrm.org/viaroute',
|
||||||
|
timestamp:'http://router.project-osrm.org/timestamp',
|
||||||
|
title:'car (fastest route)',
|
||||||
|
metric:0},
|
||||||
|
{ url:'http://mapa.ump.waw.pl/ump-www/viaroute',
|
||||||
|
timestamp:'http://mapa.ump.waw.pl/ump-www/timestamp',
|
||||||
|
title:'car (poland)',
|
||||||
|
metric:0
|
||||||
|
},
|
||||||
|
{ url:'http://mapa.ump.waw.pl/ump-www/rower/viaroute',
|
||||||
|
timestamp:'http://mapa.ump.waw.pl/ump-www/rower/timestamp',
|
||||||
|
title:'bike (poland)',
|
||||||
|
metric:0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
ONLOAD_ENGINE: 0,
|
||||||
HOST_ROUTING_URL: ['http://router.project-osrm.org/viaroute'],
|
HOST_ROUTING_URL: ['http://router.project-osrm.org/viaroute'],
|
||||||
HOST_SHORTENER_URL: 'http://map.project-osrm.org/shorten/',
|
HOST_SHORTENER_URL: 'http://map.project-osrm.org/shorten/',
|
||||||
HOST_TIMESTAMP_URL: 'http://router.project-osrm.org/timestamp',
|
HOST_TIMESTAMP_URL: 'http://router.project-osrm.org/timestamp',
|
||||||
|
@ -55,9 +55,9 @@ init: function() {
|
|||||||
fadeAnimation: false
|
fadeAnimation: false
|
||||||
});
|
});
|
||||||
|
|
||||||
// add locations control
|
// // add locations control
|
||||||
var locationsControl = new L.Control.Locations();
|
// var locationsControl = new L.Control.Locations();
|
||||||
OSRM.G.map.addControl(locationsControl);
|
// OSRM.G.map.addControl(locationsControl);
|
||||||
|
|
||||||
// add layer control
|
// add layer control
|
||||||
var layerControl = new L.Control.QueryableLayers(base_maps, {});
|
var layerControl = new L.Control.QueryableLayers(base_maps, {});
|
||||||
|
@ -46,7 +46,7 @@ init: function() {
|
|||||||
|
|
||||||
// query last update of data
|
// query last update of data
|
||||||
OSRM.G.data_timestamp = "n/a";
|
OSRM.G.data_timestamp = "n/a";
|
||||||
OSRM.JSONP.call(OSRM.DEFAULTS.HOST_TIMESTAMP_URL+"?jsonp=%jsonp", OSRM.GUI.setDataTimestamp, OSRM.JSONP.empty, OSRM.DEFAULTS.JSONP_TIMEOUT, 'data_timestamp');
|
OSRM.JSONP.call(OSRM.DEFAULTS.HOST_TIMESTAMP_URL+"?jsonp=%jsonp", OSRM.GUI.setDataTimestamp, OSRM.GUI.setDataTimestampTimeout, OSRM.DEFAULTS.JSONP_TIMEOUT, 'data_timestamp');
|
||||||
},
|
},
|
||||||
|
|
||||||
// set language dependent labels
|
// set language dependent labels
|
||||||
@ -54,7 +54,7 @@ setLabels: function() {
|
|||||||
document.getElementById("open-josm").innerHTML = OSRM.loc("OPEN_JOSM");
|
document.getElementById("open-josm").innerHTML = OSRM.loc("OPEN_JOSM");
|
||||||
document.getElementById("open-osmbugs").innerHTML = OSRM.loc("OPEN_OSMBUGS");
|
document.getElementById("open-osmbugs").innerHTML = OSRM.loc("OPEN_OSMBUGS");
|
||||||
document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET");
|
document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET");
|
||||||
document.getElementById("gui-zoom").innerHTML = OSRM.loc("GUI_ZOOM_ON_ROUTE");
|
// document.getElementById("gui-zoom").innerHTML = OSRM.loc("GUI_ZOOM_ON_ROUTE");
|
||||||
document.getElementById("gui-reverse").innerHTML = OSRM.loc("GUI_REVERSE");
|
document.getElementById("gui-reverse").innerHTML = OSRM.loc("GUI_REVERSE");
|
||||||
document.getElementById("gui-option-highlight-nonames-label").innerHTML = OSRM.loc("GUI_HIGHLIGHT_UNNAMED_ROADS");
|
document.getElementById("gui-option-highlight-nonames-label").innerHTML = OSRM.loc("GUI_HIGHLIGHT_UNNAMED_ROADS");
|
||||||
document.getElementById("gui-option-show-previous-routes-label").innerHTML = OSRM.loc("GUI_SHOW_PREVIOUS_ROUTES");
|
document.getElementById("gui-option-show-previous-routes-label").innerHTML = OSRM.loc("GUI_SHOW_PREVIOUS_ROUTES");
|
||||||
@ -133,10 +133,14 @@ changeDistanceFormat: function(type) {
|
|||||||
// set timestamp of data
|
// set timestamp of data
|
||||||
setDataTimestamp: function(response) {
|
setDataTimestamp: function(response) {
|
||||||
if(!response)
|
if(!response)
|
||||||
return;
|
OSRM.GUI.setDataTimestampTimeout();
|
||||||
|
|
||||||
OSRM.G.data_timestamp = response.timestamp.slice(0,25).replace(/<\/?[^>]+(>|$)/g ,""); // discard tags
|
OSRM.G.data_timestamp = response.timestamp.slice(0,25).replace(/<\/?[^>]+(>|$)/g ,""); // discard tags
|
||||||
document.getElementById('gui-data-timestamp').innerHTML = OSRM.G.data_timestamp;
|
document.getElementById('gui-data-timestamp').innerHTML = OSRM.G.data_timestamp;
|
||||||
|
},
|
||||||
|
setDataTimestampTimeout: function() {
|
||||||
|
OSRM.G.data_timestamp = "n/a";
|
||||||
|
document.getElementById('gui-data-timestamp').innerHTML = OSRM.G.data_timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
@ -36,24 +36,46 @@ init: function() {
|
|||||||
document.getElementById("gui-search-target").onclick = function() {OSRM.GUI.showMarker(OSRM.C.TARGET_LABEL);};
|
document.getElementById("gui-search-target").onclick = function() {OSRM.GUI.showMarker(OSRM.C.TARGET_LABEL);};
|
||||||
|
|
||||||
document.getElementById("gui-reset").onclick = OSRM.GUI.resetRouting;
|
document.getElementById("gui-reset").onclick = OSRM.GUI.resetRouting;
|
||||||
document.getElementById("gui-zoom").onclick = OSRM.GUI.zoomOnRoute;
|
// document.getElementById("gui-zoom").onclick = OSRM.GUI.zoomOnRoute;
|
||||||
document.getElementById("gui-reverse").onclick = OSRM.GUI.reverseRouting;
|
document.getElementById("gui-reverse").onclick = OSRM.GUI.reverseRouting;
|
||||||
document.getElementById("open-josm").onclick = OSRM.GUI.openJOSM;
|
document.getElementById("open-josm").onclick = OSRM.GUI.openJOSM;
|
||||||
document.getElementById("open-osmbugs").onclick = OSRM.GUI.openOSMBugs;
|
document.getElementById("open-osmbugs").onclick = OSRM.GUI.openOSMBugs;
|
||||||
document.getElementById("option-highlight-nonames").onclick = OSRM.GUI.hightlightNonames;
|
document.getElementById("option-highlight-nonames").onclick = OSRM.GUI.hightlightNonames;
|
||||||
document.getElementById("option-show-previous-routes").onclick = OSRM.GUI.showPreviousRoutes;
|
document.getElementById("option-show-previous-routes").onclick = OSRM.GUI.showPreviousRoutes;
|
||||||
|
|
||||||
|
// engine toggle
|
||||||
|
var engines = OSRM.DEFAULTS.ROUTING_ENGINES;
|
||||||
|
var options = [];
|
||||||
|
for(var i=0, size=engines.length; i<size; i++) {
|
||||||
|
options.push( {display:engines[i].title, value:i} );
|
||||||
|
}
|
||||||
|
|
||||||
|
// generate selectors
|
||||||
|
OSRM.GUI.selectorInit("gui-engine-toggle", options, OSRM.DEFAULTS.ONLOAD_ENGINE, OSRM.GUI.engineChanged);
|
||||||
|
},
|
||||||
|
|
||||||
|
engineChanged: function( engine ) {
|
||||||
|
OSRM.G.active_routing_engine = engine;
|
||||||
|
OSRM.G.active_routing_server_url = OSRM.DEFAULTS.ROUTING_ENGINES[ OSRM.G.active_routing_engine ].url;
|
||||||
|
|
||||||
|
// query route
|
||||||
|
if( OSRM.G.markers.route.length > 1 )
|
||||||
|
OSRM.Routing.getRoute();
|
||||||
|
|
||||||
|
// query timestamp of data
|
||||||
|
OSRM.JSONP.call( OSRM.DEFAULTS.ROUTING_ENGINES[ OSRM.G.active_routing_engine ].timestamp+"?jsonp=%jsonp", OSRM.GUI.setDataTimestamp, OSRM.GUI.setDataTimestampTimeout, OSRM.DEFAULTS.JSONP_TIMEOUT, 'data_timestamp');
|
||||||
},
|
},
|
||||||
|
|
||||||
// toggle GUI features that need a route to work
|
// toggle GUI features that need a route to work
|
||||||
activateRouteFeatures: function() {
|
activateRouteFeatures: function() {
|
||||||
OSRM.Printing.activate();
|
OSRM.Printing.activate();
|
||||||
document.getElementById("gui-zoom").className = "button";
|
// document.getElementById("gui-zoom").className = "button";
|
||||||
document.getElementById('leaflet-control-locations-route').className = "leaflet-control-locations-route";
|
// document.getElementById('leaflet-control-locations-route').className = "leaflet-control-locations-route";
|
||||||
},
|
},
|
||||||
deactivateRouteFeatures: function() {
|
deactivateRouteFeatures: function() {
|
||||||
OSRM.Printing.deactivate();
|
OSRM.Printing.deactivate();
|
||||||
document.getElementById("gui-zoom").className = "button-inactive";
|
// document.getElementById("gui-zoom").className = "button-inactive";
|
||||||
document.getElementById('leaflet-control-locations-route').className = "leaflet-control-locations-route-inactive";
|
// document.getElementById('leaflet-control-locations-route').className = "leaflet-control-locations-route-inactive";
|
||||||
},
|
},
|
||||||
|
|
||||||
// click: button "reset"
|
// click: button "reset"
|
||||||
|
@ -50,7 +50,7 @@ html, body {
|
|||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
.leaflet-control-zoom {
|
.leaflet-control-zoom {
|
||||||
border-radius:8px;
|
border-radius:8px;
|
||||||
-moz-border-radius:8px;
|
-moz-border-radius:8px;
|
||||||
@ -173,6 +173,7 @@ html, body {
|
|||||||
.leaflet-control-layers a:hover {
|
.leaflet-control-layers a:hover {
|
||||||
background-color: #CCCCCC;
|
background-color: #CCCCCC;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
<!-- scripts -->
|
<!-- scripts -->
|
||||||
<script src="leaflet/leaflet-src.js" type="text/javascript"></script>
|
<script src="leaflet/leaflet-src.js" type="text/javascript"></script>
|
||||||
<script src="base/leaflet/L.Bugfixes.js" type="text/javascript"></script>
|
<script src="base/leaflet/L.Bugfixes.js" type="text/javascript"></script>
|
||||||
<script src="base/leaflet/L.Control.Locations.js" type="text/javascript"></script>
|
<!-- <script src="base/leaflet/L.Control.Locations.js" type="text/javascript"></script> -->
|
||||||
<script src="base/leaflet/L.Control.QueryableLayers.js" type="text/javascript"></script>
|
<script src="base/leaflet/L.Control.QueryableLayers.js" type="text/javascript"></script>
|
||||||
<script src="base/leaflet/L.LabelMarker.js" type="text/javascript"></script>
|
<script src="base/leaflet/L.LabelMarker.js" type="text/javascript"></script>
|
||||||
<script src="base/leaflet/L.LabelMarkerIcon.js" type="text/javascript"></script>
|
<script src="base/leaflet/L.LabelMarkerIcon.js" type="text/javascript"></script>
|
||||||
@ -207,8 +207,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
<div class="full">
|
<div class="full">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="left"><a class="button" id="gui-reset">Reset</a></div>
|
<div class="left"><a class="button" id="gui-reset">Reset</a></div>
|
||||||
<!-- <div class="center"><select id="gui-engine-toggle" class="engine-select"></select></div> -->
|
<div class="center"><select id="gui-engine-toggle" class="engine-select"></select></div>
|
||||||
<div class="center"><a class="button-inactive" id="gui-zoom">Reset</a></div>
|
<!-- <div class="center"><a class="button-inactive" id="gui-zoom">Reset</a></div> -->
|
||||||
<div class="right"><a class="button" id="gui-reverse">Reverse</a></div>
|
<div class="right"><a class="button" id="gui-reverse">Reverse</a></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user