Compare commits
218 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 17bfe95cd3 | |||
| e90fe88cc0 | |||
| eba6330db1 | |||
| a21aaf330e | |||
| 390a14ac77 | |||
| f2d4f31b8f | |||
| ed72366e69 | |||
| 6feccd2507 | |||
| f27e05564d | |||
| d1bc05fcae | |||
| 8323ce78e3 | |||
| 517f321ccc | |||
| 5e24749826 | |||
| 8f6cd99ff6 | |||
| efa959d112 | |||
| f119b79101 | |||
| 8b17e4864e | |||
| 4ebe4848af | |||
| ba46d77d1d | |||
| 0c946f1476 | |||
| 22783a53cd | |||
| 770f3b5979 | |||
| a90b2371c2 | |||
| 052f7060c1 | |||
| 314ff97ca0 | |||
| 35bb9efa51 | |||
| 60436e9928 | |||
| f575ff2ba5 | |||
| 84a960ae1e | |||
| 38ccb9d974 | |||
| 5e3de973d7 | |||
| f385ea4e97 | |||
| c38c0b6f03 | |||
| 74154ab0a6 | |||
| c33dbe67d8 | |||
| 903c4577d1 | |||
| c07f87edca | |||
| 537b9b0623 | |||
| d88baaf1a4 | |||
| 232409d70b | |||
| c549311349 | |||
| 40c6ac0c28 | |||
| 80d2918203 | |||
| 90c48abeaf | |||
| badd48f166 | |||
| caa99038c5 | |||
| ec62156322 | |||
| 1423d80556 | |||
| 59775a9864 | |||
| 7b94a3092f | |||
| 7d82661927 | |||
| eeec69dfab | |||
| a8731d91ab | |||
| 3c5c26a8b5 | |||
| 2e71ad3060 | |||
| 2ad919c970 | |||
| 308b8e5f48 | |||
| 8677f15d47 | |||
| 5923d034c9 | |||
| 05410d5587 | |||
| 1c76c992c1 | |||
| 1973198f3d | |||
| f2ca2ccaed | |||
| 4cdf683447 | |||
| 3bce384f9b | |||
| 03bb7f4f40 | |||
| c900cd0122 | |||
| 2fbfdc93b1 | |||
| cd68e21b95 | |||
| 8677218404 | |||
| f6744f9aa1 | |||
| df623df3e9 | |||
| 6665207066 | |||
| 26262541a4 | |||
| ba0064af99 | |||
| 8d40bc7f4f | |||
| b85849b6bd | |||
| 543b54e2af | |||
| dfd5ee9134 | |||
| 19ae6db308 | |||
| 2a634041a7 | |||
| 34389f9789 | |||
| 2ee7ea87cd | |||
| 6186f3f27e | |||
| a53a34a261 | |||
| e706a9867d | |||
| 9e5689858e | |||
| 40900f6f56 | |||
| f266655b9b | |||
| 8b0ae1bc5f | |||
| 979327ec82 | |||
| 0976358fdf | |||
| 9502689ff8 | |||
| 36f5b36c6b | |||
| 101fc5d02f | |||
| e9736173b0 | |||
| 1ec7c6ab50 | |||
| f90d1db802 | |||
| 14ca66459a | |||
| e7b3590352 | |||
| c0e86c47c2 | |||
| 4a8c2f323c | |||
| d4e6ad8a05 | |||
| f95e515f20 | |||
| 85ea79701c | |||
| 357ec5acfc | |||
| 47b2268504 | |||
| 224c55dec1 | |||
| 1727187b5e | |||
| 4d28f02273 | |||
| a329b1259e | |||
| e39479b908 | |||
| 2b4935c29c | |||
| 3e15c0a164 | |||
| 7830f82b62 | |||
| 84677ddddf | |||
| c8912ad6ee | |||
| 2d956983a5 | |||
| 884f79a620 | |||
| 39f33b670d | |||
| a975dba975 | |||
| 50aea3310a | |||
| 6c1c830c0d | |||
| 772ad0d618 | |||
| 826cbc9a24 | |||
| 7451cc3150 | |||
| 0e9dcc30b7 | |||
| 222e4e8916 | |||
| a3cdba5044 | |||
| 57040e6924 | |||
| b9a817ce26 | |||
| 4130144687 | |||
| ec5934364a | |||
| 23d1ea2a32 | |||
| 28e78e6ea6 | |||
| 90925bd91d | |||
| 42f38a42db | |||
| ab8c700a94 | |||
| 10a96e3aba | |||
| 99f0abef0c | |||
| e7bb320924 | |||
| 96e5c4b518 | |||
| a3cfd49f97 | |||
| fbe722465d | |||
| 448e6cfdc7 | |||
| 8e79b29925 | |||
| bd61494cf4 | |||
| d33a75812d | |||
| 9f5f6019bf | |||
| aef70b832c | |||
| 611d265a27 | |||
| 635b13b61c | |||
| a8a4f56292 | |||
| a0ceee732e | |||
| 560ce74d06 | |||
| d7ffb0d492 | |||
| 369edbe9a7 | |||
| 94ca30c690 | |||
| ab1e5255eb | |||
| 0068d4062d | |||
| 04298b73f3 | |||
| 7657f0de22 | |||
| 7cdeeb0723 | |||
| c0b71cb62a | |||
| 253df58fdb | |||
| cd3005f9fe | |||
| 94cf796ed2 | |||
| 18995379ab | |||
| a5246cc8b8 | |||
| 3a7f527c68 | |||
| f404337383 | |||
| 7421117278 | |||
| f6173b7a48 | |||
| dffd67ef72 | |||
| 3444499cf4 | |||
| 7241438502 | |||
| 44c38146c9 | |||
| 2060088c6b | |||
| 38defe9629 | |||
| 087bb12847 | |||
| c59a6f9444 | |||
| 40c0222ffd | |||
| f763ec2664 | |||
| 186f78f01e | |||
| 1da10942d5 | |||
| 7ad253732a | |||
| 4b1c4068f2 | |||
| 57ec4e5465 | |||
| f3290ab64b | |||
| eb3c2f560e | |||
| 869b13e9db | |||
| 57d9bc5bae | |||
| 917ef160c5 | |||
| ae513dce5c | |||
| 93b5ce2968 | |||
| ba08d0b36c | |||
| 2e60e92b31 | |||
| 5a9a55544b | |||
| ee7c79641a | |||
| 6e57c31ec2 | |||
| 3d9d4f3764 | |||
| 596e7fc60a | |||
| 8845c070a2 | |||
| eaf5dd328f | |||
| 20a0a3b170 | |||
| 8d5d1a9400 | |||
| 572a306d6d | |||
| 63a9e4c6c2 | |||
| c84d4b323e | |||
| 46f717566d | |||
| 0199673d14 | |||
| 607d5408d3 | |||
| f6a3815e91 | |||
| f2efcfc588 | |||
| 2bf573dbe1 | |||
| 9bd4b77278 | |||
| 0ba881c390 | |||
| c7782b2776 |
@@ -0,0 +1,17 @@
|
||||
The following people contributed to the Open Source Routing Machine web frontend:
|
||||
|
||||
Dennis Schieferdecker
|
||||
Dennis Luxen
|
||||
Pascal Neis
|
||||
Teemu Koskinen
|
||||
Nicolas Belett Vigneron
|
||||
Moyg
|
||||
Jean-Frederic
|
||||
Zbigniew Czernik
|
||||
Jonas Häggqvist
|
||||
Sabas
|
||||
Paul Spencer
|
||||
Raphael Pinson
|
||||
Juan Luis Rodriguez Ponce
|
||||
Lauris Bukšis-Haberkorns
|
||||
Barboska
|
||||
@@ -26,6 +26,15 @@ Bugtracking
|
||||
-----------
|
||||
Please use the OSRM-Project bug tracker [(4)] for submitting any bug reports or feature requests.
|
||||
|
||||
|
||||
Contribute
|
||||
----------
|
||||
If you like to contribute, simply fork the project and start coding.
|
||||
It is best practice to create a new branch (from the current master) with a descriptive name for your contributions.
|
||||
When you are done, send a pull request from that branch.
|
||||
With this workflow, each pull request is isolated and can be easily merged.
|
||||
|
||||
|
||||
Integration into Project-OSRM repository
|
||||
----------------------------------------
|
||||
The Project-OSRM repository already contains the frontend repository as a submodule.
|
||||
@@ -41,6 +50,14 @@ To successfully work a repository that contains submodules, use the following gi
|
||||
Note that the frontend can also be checked out independently of the Project-OSRM repository.
|
||||
|
||||
|
||||
Compatibility
|
||||
-------------
|
||||
The frontend has been tested with Firefox 3.0+, Internet Explorer 8+ and Chrome 18+.
|
||||
Certain visuals like rounded corners or moving boxes will only show in newer browser versions.
|
||||
But no actual functionality is affected by this.
|
||||
Note that the frontend will not work with Internet Explorer 6 or 7.
|
||||
|
||||
|
||||
References
|
||||
----------
|
||||
[(1)] Cloudmade Leaflet: http://leaflet.cloudmade.com/
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM old browser support
|
||||
// [simple browser detection and routines to support some old browsers]
|
||||
|
||||
|
||||
// browser detection (runs anonymous function to prevent local variables cluttering global namespace)
|
||||
(function() {
|
||||
var useragent = navigator.userAgent;
|
||||
|
||||
OSRM.Browser = {
|
||||
FF3: useragent.search(/Firefox\/3/),
|
||||
IE6_9: useragent.search(/MSIE (6|7|8|9)/)
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
// compatibility tools for old browsers
|
||||
function getElementsByClassName(node, classname) {
|
||||
var a = [];
|
||||
var re = new RegExp('(^| )'+classname+'( |$)');
|
||||
var els = node.getElementsByTagName("*");
|
||||
for(var i=0,j=els.length; i<j; i++)
|
||||
if(re.test(els[i].className))a.push(els[i]);
|
||||
return a;
|
||||
}
|
||||
document.head = document.head || document.getElementsByTagName('head')[0];
|
||||
@@ -1,140 +0,0 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM GUI functionality
|
||||
// [responsible for all non-routing related GUI behaviour]
|
||||
|
||||
|
||||
OSRM.GUI = {
|
||||
|
||||
// defaults
|
||||
visible: null,
|
||||
width: null,
|
||||
|
||||
// init GUI
|
||||
init: function() {
|
||||
OSRM.GUI.visible = true;
|
||||
OSRM.GUI.width = document.getElementById("main-wrapper").clientWidth;
|
||||
|
||||
// init favicon
|
||||
document.getElementById('favicon').href=OSRM.G.images["favicon"].src;
|
||||
|
||||
// init starting source/target
|
||||
document.getElementById('gui-input-source').value = OSRM.DEFAULTS.ONLOAD_SOURCE;
|
||||
document.getElementById('gui-input-target').value = OSRM.DEFAULTS.ONLOAD_TARGET;
|
||||
|
||||
// init events
|
||||
// [TODO: switch to new event model]
|
||||
document.getElementById("gui-toggle-in").onclick = OSRM.GUI.toggleMain;
|
||||
document.getElementById("gui-toggle-out").onclick = OSRM.GUI.toggleMain;
|
||||
|
||||
document.getElementById("gui-input-source").onchange = function() {OSRM.RoutingGUI.inputChanged(OSRM.C.SOURCE_LABEL);};
|
||||
document.getElementById("gui-delete-source").onclick = function() {OSRM.RoutingGUI.deleteMarker(OSRM.C.SOURCE_LABEL);};
|
||||
document.getElementById("gui-search-source").onclick = function() {OSRM.RoutingGUI.showMarker(OSRM.C.SOURCE_LABEL);};
|
||||
|
||||
document.getElementById("gui-input-target").onchange = function() {OSRM.RoutingGUI.inputChanged(OSRM.C.TARGET_LABEL);};
|
||||
document.getElementById("gui-delete-target").onclick = function() {OSRM.RoutingGUI.deleteMarker(OSRM.C.TARGET_LABEL);};
|
||||
document.getElementById("gui-search-target").onclick = function() {OSRM.RoutingGUI.showMarker(OSRM.C.TARGET_LABEL);};
|
||||
|
||||
document.getElementById("gui-reset").onclick = OSRM.RoutingGUI.resetRouting;
|
||||
document.getElementById("gui-reverse").onclick = OSRM.RoutingGUI.reverseRouting;
|
||||
document.getElementById("gui-options-toggle").onclick = OSRM.GUI.toggleOptions;
|
||||
document.getElementById("open-josm").onclick = OSRM.RoutingGUI.openJOSM;
|
||||
document.getElementById("open-osmbugs").onclick = OSRM.RoutingGUI.openOSMBugs;
|
||||
document.getElementById("option-highlight-nonames").onclick = OSRM.Routing.getRoute;
|
||||
|
||||
// gui after transition events
|
||||
if( OSRM.Browser.FF3==-1 && OSRM.Browser.IE6_9==-1 ) {
|
||||
document.getElementById('main-wrapper').addEventListener("transitionend", OSRM.GUI.onMainTransitionEnd, false);
|
||||
document.getElementById('main-wrapper').addEventListener("webkitTransitionEnd", OSRM.GUI.onMainTransitionEnd, false);
|
||||
document.getElementById('main-wrapper').addEventListener("oTransitionEnd", OSRM.GUI.onMainTransitionEnd, false);
|
||||
document.getElementById('main-wrapper').addEventListener("MSTransitionEnd", OSRM.GUI.onMainTransitionEnd, false);
|
||||
}
|
||||
|
||||
// set default language
|
||||
OSRM.Localization.setLanguage( OSRM.DEFAULTS.LANGUAGE );
|
||||
},
|
||||
|
||||
// set language dependent labels
|
||||
setLabels: function() {
|
||||
document.getElementById("open-josm").innerHTML = OSRM.loc("OPEN_JOSM");
|
||||
document.getElementById("open-osmbugs").innerHTML = OSRM.loc("OPEN_OSMBUGS");
|
||||
document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET");
|
||||
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-options-toggle").innerHTML = OSRM.loc("GUI_OPTIONS");
|
||||
document.getElementById("gui-search-source").innerHTML = OSRM.loc("GUI_SEARCH");
|
||||
document.getElementById("gui-search-target").innerHTML = OSRM.loc("GUI_SEARCH");
|
||||
document.getElementById("gui-search-source-label").innerHTML = OSRM.loc("GUI_START")+":";
|
||||
document.getElementById("gui-search-target-label").innerHTML = OSRM.loc("GUI_END")+":";
|
||||
document.getElementById("gui-input-source").title = OSRM.loc("GUI_START_TOOLTIP");
|
||||
document.getElementById("gui-input-target").title = OSRM.loc("GUI_END_TOOLTIP");
|
||||
document.getElementById("legal-notice").innerHTML = OSRM.loc("GUI_LEGAL_NOTICE");
|
||||
},
|
||||
|
||||
// show/hide main-gui
|
||||
toggleMain: function() {
|
||||
// show main-gui
|
||||
if( OSRM.GUI.visible == false ) {
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="hidden";
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.left=(OSRM.GUI.width+10)+"px";;
|
||||
|
||||
document.getElementById('blob-wrapper').style.visibility="hidden";
|
||||
document.getElementById('main-wrapper').style.left="5px";
|
||||
// hide main-gui
|
||||
} else {
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="hidden";
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.left="30px";
|
||||
|
||||
document.getElementById('main-wrapper').style.left=-OSRM.GUI.width+"px";
|
||||
}
|
||||
|
||||
// execute after animation (old browser support)
|
||||
if( OSRM.Browser.FF3!=-1 || OSRM.Browser.IE6_9!=-1 )
|
||||
OSRM.GUI.onMainTransitionEnd();
|
||||
},
|
||||
|
||||
// do stuff after main-gui animation finished
|
||||
onMainTransitionEnd: function() {
|
||||
// after hiding main-gui
|
||||
if( OSRM.GUI.visible == true ) {
|
||||
document.getElementById('blob-wrapper').style.visibility="visible";
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="visible";
|
||||
OSRM.GUI.visible = false;
|
||||
// after showing main-gui
|
||||
} else {
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="visible";
|
||||
OSRM.GUI.visible = true;
|
||||
}
|
||||
},
|
||||
|
||||
// show/hide small options bubble
|
||||
toggleOptions: function() {
|
||||
if(document.getElementById('options-box').style.visibility=="visible") {
|
||||
document.getElementById('options-box').style.visibility="hidden";
|
||||
} else {
|
||||
document.getElementById('options-box').style.visibility="visible";
|
||||
}
|
||||
},
|
||||
|
||||
// clear output area
|
||||
clearResults: function() {
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM utility functions
|
||||
// [mixed functions]
|
||||
|
||||
|
||||
OSRM.Utils = {
|
||||
|
||||
// [human readabilty functions]
|
||||
|
||||
// human readable time
|
||||
secondsToTime: function(seconds){
|
||||
seconds = parseInt(seconds);
|
||||
minutes = parseInt(seconds/60);
|
||||
seconds = seconds%60;
|
||||
hours = parseInt(minutes/60);
|
||||
minutes = minutes%60;
|
||||
if(hours==0){
|
||||
return minutes + ' ' + 'min';
|
||||
}
|
||||
else{
|
||||
return hours + ' ' + 'h' + ' ' + minutes + ' ' + 'min';
|
||||
}
|
||||
},
|
||||
//human readable distance
|
||||
metersToDistance: function(distance){
|
||||
distance = parseInt(distance);
|
||||
|
||||
if(distance >= 100000){ return (parseInt(distance/1000))+' ' + 'km'; }
|
||||
else if(distance >= 10000){ return (parseInt(distance/1000).toFixed(1))+' ' + 'km'; }
|
||||
else if(distance >= 1000){ return (parseFloat(distance/1000).toFixed(2))+' ' + 'km'; }
|
||||
else{ return distance+' ' + 'm'; }
|
||||
},
|
||||
|
||||
|
||||
// [verification routines]
|
||||
|
||||
// verify angles
|
||||
isLatitude: function(value) {
|
||||
if( value >=-90 && value <=90)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
},
|
||||
isLongitude: function(value) {
|
||||
if( value >=-180 && value <=180)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
@@ -19,39 +19,10 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
// [has to be loaded before all other OSRM classes]
|
||||
|
||||
var OSRM = {};
|
||||
OSRM.VERSION = '0.1.4x';
|
||||
OSRM.DATE = '120416';
|
||||
OSRM.VERSION = '0.1.7';
|
||||
OSRM.DATE = '120705';
|
||||
OSRM.CONSTANTS = {};
|
||||
OSRM.DEFAULTS = {};
|
||||
OSRM.GLOBALS = {};
|
||||
OSRM.G = OSRM.GLOBALS; // abbreviations
|
||||
OSRM.C = OSRM.CONSTANTS;
|
||||
|
||||
|
||||
// declare one class to be a subclass of another class
|
||||
// (runs anonymous function to prevent local functions cluttering global namespace)
|
||||
(function() {
|
||||
var _inheritFromHelper = function() {};
|
||||
OSRM.inheritFrom = function( sub_class, base_class ) {
|
||||
_inheritFromHelper.prototype = base_class.prototype;
|
||||
sub_class.prototype = new _inheritFromHelper();
|
||||
sub_class.prototype.constructor = sub_class;
|
||||
sub_class.prototype.base = base_class.prototype;
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
// extend prototypes of a class -> used to add member values and functions
|
||||
OSRM.extend = function( target_class, properties ) {
|
||||
for( property in properties ) {
|
||||
target_class.prototype[property] = properties[property];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// [usage of convenience functions]
|
||||
// SubClass = function() {
|
||||
// SubClass.prototype.base.constructor.apply(this, arguments);
|
||||
// }
|
||||
// OSRM.inheritFrom( SubClass, BaseClass );
|
||||
// OSRM.extend( SubClass, { property:value } );
|
||||
|
||||
@@ -21,6 +21,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
OSRM.DEFAULTS = {
|
||||
HOST_ROUTING_URL: 'http://router.project-osrm.org/viaroute',
|
||||
HOST_SHORTENER_URL: 'http://map.project-osrm.org/shorten/',
|
||||
HOST_TIMESTAMP_URL: 'http://router.project-osrm.org/timestamp',
|
||||
HOST_GEOCODER_URL: 'http://nominatim.openstreetmap.org/search',
|
||||
HOST_REVERSE_GEOCODER_URL: 'http://nominatim.openstreetmap.org/reverse',
|
||||
WEBSITE_URL: document.URL.replace(/#*(\?.*|$)/i,""), // truncates URL before first ?, and removes tailing #
|
||||
@@ -32,15 +33,26 @@ OSRM.DEFAULTS = {
|
||||
ONLOAD_SOURCE: "",
|
||||
ONLOAD_TARGET: "",
|
||||
HIGHLIGHT_ZOOM_LEVEL: 16,
|
||||
DISTANCE_FORMAT: 0, // 0: km, 1: miles
|
||||
GEOCODER_BOUNDS: '', // the world is not enough!
|
||||
//GEOCODER_BOUNDS: '&bounded=1&viewbox=-27.0,72.0,46.0,36.0', // bounds for Europe
|
||||
|
||||
SHORTENER_PARAMETERS: '%url&jsonp=%jsonp',
|
||||
SHORTENER_REPLY_PARAMETER: 'ShortURL',
|
||||
|
||||
LANGUAGE: "en",
|
||||
LANGUAGE_FILES_DIRECTORY: "localization/",
|
||||
LANUGAGE_ONDEMAND_RELOADING: true,
|
||||
LANGUAGE_SUPPORTED: [
|
||||
{display_name:"en", encoding:"en"},
|
||||
{display_name:"de", encoding:"de"}
|
||||
{encoding:"en", name:"English"},
|
||||
{encoding:"de", name:"Deutsch"},
|
||||
{encoding:"dk", name:"Dansk"},
|
||||
{encoding:"es", name:"Español"},
|
||||
{encoding:"fi", name:"Suomi"},
|
||||
{encoding:"fr", name:"Français"},
|
||||
{encoding:"it", name:"Italiano"},
|
||||
{encoding:"lv", name:"Latviešu"},
|
||||
{encoding:"pl", name:"Polski", culture:"en-US"},
|
||||
{encoding:"ru", name:"Русский"}
|
||||
],
|
||||
|
||||
TILE_SERVERS: [
|
||||
@@ -63,6 +75,24 @@ OSRM.DEFAULTS = {
|
||||
url:'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
|
||||
attribution:'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
|
||||
options:{maxZoom: 18}
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
{
|
||||
display_name: 'Bing Road',
|
||||
apikey:'AjCb2f6Azv_xt9c6pl_xok96bgAYrXQNctnG4o07sTj4iS9N68Za4B3pRJyeCjGr', // please use your own apikey (http://msdn.microsoft.com/en-us/library/ff428642.aspx)
|
||||
type:"Road",
|
||||
options:{minZoom: 1},
|
||||
bing:true,
|
||||
},
|
||||
{
|
||||
display_name: 'Bing Aerial',
|
||||
apikey:'AjCb2f6Azv_xt9c6pl_xok96bgAYrXQNctnG4o07sTj4iS9N68Za4B3pRJyeCjGr', // please use your own apikey (http://msdn.microsoft.com/en-us/library/ff428642.aspx)
|
||||
type:"Aerial",
|
||||
options:{minZoom: 1},
|
||||
bing:true,
|
||||
}
|
||||
],
|
||||
|
||||
MAINTENANCE: false,
|
||||
MAINTENANCE_HEADER: "Scheduled Maintenance",
|
||||
MAINTENANCE_TEXT: "The OSRM Website is down for a scheduled maintenance. Please be patient while required updates are performed. The site will be back online shortly.<br/><br/>In the meantime you may want to go out an map a friendly neighborhood near you...<br/><br/><br/>[OSRM]",
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ call: function(marker_id, query) {
|
||||
if(query=="")
|
||||
return;
|
||||
|
||||
//geo coordinates given -> directly draw results
|
||||
// geo coordinates given -> directly draw results
|
||||
if(query.match(/^\s*[-+]?[0-9]*\.?[0-9]+\s*[,;]\s*[-+]?[0-9]*\.?[0-9]+\s*$/)){
|
||||
var coord = query.split(/[,;]/);
|
||||
OSRM.Geocoder._onclickResult(marker_id, coord[0], coord[1]);
|
||||
@@ -42,8 +42,11 @@ call: function(marker_id, query) {
|
||||
return;
|
||||
}
|
||||
|
||||
//build request for geocoder
|
||||
var call = OSRM.DEFAULTS.HOST_GEOCODER_URL + "?format=json" + OSRM.DEFAULTS.GEOCODER_BOUNDS + "&accept-language="+OSRM.Localization.current_language+"&q=" + query;
|
||||
// build basic request for geocoder
|
||||
var call = OSRM.DEFAULTS.HOST_GEOCODER_URL + "?format=json&json_callback=%jsonp" + OSRM.DEFAULTS.GEOCODER_BOUNDS + "&accept-language="+OSRM.Localization.current_language+"&limit=30&q=" + query;
|
||||
// prioritize results in currently shown mapview
|
||||
var bounds = OSRM.G.map.getBounds();
|
||||
call += "&viewbox=" + bounds._southWest.lat + "," + bounds._northEast.lng + "," + bounds._northEast.lat + "," + bounds._southWest.lng;
|
||||
OSRM.JSONP.call( call, OSRM.Geocoder._showResults, OSRM.Geocoder._showResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "geocoder_"+marker_id, {marker_id:marker_id,query:query} );
|
||||
},
|
||||
|
||||
@@ -77,27 +80,42 @@ _showResults: function(response, parameters) {
|
||||
return;
|
||||
}
|
||||
|
||||
// filter/sort inputs
|
||||
var filtered_response = [];
|
||||
for(var i=0; i < response.length; i++){
|
||||
var result = response[i];
|
||||
if( OSRM.Geocoder._filterResult( result ) )
|
||||
continue;
|
||||
filtered_response.push( result );
|
||||
}
|
||||
filtered_response.sort( OSRM.Geocoder._compareResults );
|
||||
|
||||
// show first result
|
||||
OSRM.Geocoder._onclickResult(parameters.marker_id, response[0].lat, response[0].lon);
|
||||
OSRM.Geocoder._onclickResult(parameters.marker_id, filtered_response[0].lat, filtered_response[0].lon);
|
||||
if( OSRM.G.markers.route.length > 1 ) // if a route is displayed, we don't need to show other possible geocoding results
|
||||
return;
|
||||
return;
|
||||
|
||||
// show possible results for input
|
||||
var html = "";
|
||||
html += '<table class="results-table medium-font">';
|
||||
for(var i=0; i < response.length; i++){
|
||||
var result = response[i];
|
||||
|
||||
html += '<table class="results medium-font">';
|
||||
for(var i=0; i < filtered_response.length; i++){
|
||||
var result = filtered_response[i];
|
||||
|
||||
//odd or even ?
|
||||
var rowstyle='results-odd';
|
||||
if(i%2==0) { rowstyle='results-even'; }
|
||||
var rowstyle='results-body-odd';
|
||||
if(i%2==0) { rowstyle='results-body-even'; }
|
||||
|
||||
html += '<tr class="'+rowstyle+'">';
|
||||
html += '<td class="result-counter"><span">'+(i+1)+'.</span></td>';
|
||||
html += '<td class="result-items">';
|
||||
if(!result.icon)
|
||||
result.icon = "http://nominatim.openstreetmap.org/images/mapicons/poi_point_of_interest.glow.12.png";
|
||||
html += '<td class="results-body-counter"><img src="'+ result.icon + '" alt=""/></td>';
|
||||
html += '<td class="results-body-items">';
|
||||
|
||||
if(result.display_name){
|
||||
html += '<div class="result-item" onclick="OSRM.Geocoder._onclickResult(\''+parameters.marker_id+'\', '+result.lat+', '+result.lon+');">'+result.display_name+'</div>';
|
||||
html += '<div class="results-body-item" onclick="OSRM.Geocoder._onclickResult(\''+parameters.marker_id+'\', '+result.lat+', '+result.lon+');">'+result.display_name;
|
||||
// debug output to show osm_type, class, type
|
||||
// html += '<br/><span class="results-body-item-remark small-font">[osm_type: ' + result.osm_type + ', class: ' + result.class + ', type: ' + result.type + ']</span>';
|
||||
html += '</div>';
|
||||
}
|
||||
html += "</td></tr>";
|
||||
}
|
||||
@@ -105,8 +123,8 @@ _showResults: function(response, parameters) {
|
||||
|
||||
document.getElementById('information-box-header').innerHTML =
|
||||
"<div class='header-title'>"+OSRM.loc("SEARCH_RESULTS")+"</div>" +
|
||||
"<div class='header-content'>("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,response.length)+")</div>";
|
||||
"<div class='header-content'>(found "+response.length+" results)"+"</div>";
|
||||
"<div class='header-content'>("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,filtered_response.length)+")</div>";
|
||||
"<div class='header-content'>(found "+filtered_response.length+" results)"+"</div>";
|
||||
document.getElementById('information-box').innerHTML = html;
|
||||
},
|
||||
_showResults_Empty: function(parameters) {
|
||||
@@ -125,6 +143,45 @@ _showResults_Timeout: function() {
|
||||
"<div class='header-title'>"+OSRM.loc("SEARCH_RESULTS")+"</div>" +
|
||||
"<div class='header-content'>("+OSRM.loc("FOUND_X_RESULTS").replace(/%i/,0)+")</div>";
|
||||
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+OSRM.loc("TIMED_OUT")+"</div>";
|
||||
},
|
||||
|
||||
|
||||
// filter search results [true: result will not be displayed]
|
||||
_filterResult: function(result) {
|
||||
if( result.osm_type == "relation")
|
||||
return true;
|
||||
if( result.type == "aerial_views")
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
// comparator for sorting results [higher weight: result will appear first]
|
||||
_compare_class_weights: {
|
||||
place: 9000,
|
||||
highway: 8000,
|
||||
boundary: 7000
|
||||
},
|
||||
_compare_type_weights: {
|
||||
country: 13,
|
||||
state: 12,
|
||||
county: 11,
|
||||
city: 10,
|
||||
town: 9,
|
||||
village: 8,
|
||||
hamlet: 7,
|
||||
suburb: 6,
|
||||
locality: 5,
|
||||
farm: 4
|
||||
},
|
||||
_compareResults: function(lhs, rhs) {
|
||||
var class_values = OSRM.Geocoder._compare_class_weights;
|
||||
var type_values = OSRM.Geocoder._compare_type_weights;
|
||||
|
||||
var lhs_value = (-class_values[ lhs.class ] || 0) + (-type_values[ lhs.type ] || 0);
|
||||
var rhs_value = (-class_values[ rhs.class ] || 0) + (-type_values[ rhs.type ] || 0);
|
||||
|
||||
return (lhs_value - rhs_value);
|
||||
},
|
||||
|
||||
|
||||
@@ -148,14 +205,14 @@ updateAddress: function(marker_id, do_fallback_to_lat_lng) {
|
||||
|
||||
if(marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource()) {
|
||||
lat = OSRM.G.markers.route[0].getLat();
|
||||
lng = OSRM.G.markers.route[0].getLng();
|
||||
lng = OSRM.G.markers.route[0].getLng();
|
||||
} else if(marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() ) {
|
||||
lat = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLat();
|
||||
lng = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLng();
|
||||
lng = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLng();
|
||||
} else
|
||||
return;
|
||||
|
||||
var call = OSRM.DEFAULTS.HOST_REVERSE_GEOCODER_URL + "?format=json" + "&accept-language="+OSRM.Localization.current_language + "&lat=" + lat + "&lon=" + lng;
|
||||
var call = OSRM.DEFAULTS.HOST_REVERSE_GEOCODER_URL + "?format=json&json_callback=%jsonp" + "&accept-language="+OSRM.Localization.current_language + "&lat=" + lat.toFixed(6) + "&lon=" + lng.toFixed(6);
|
||||
OSRM.JSONP.call( call, OSRM.Geocoder._showReverseResults, OSRM.Geocoder._showReverseResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "reverse_geocoder_"+marker_id, {marker_id:marker_id, do_fallback: do_fallback_to_lat_lng} );
|
||||
},
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
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.HistoryRoute = function() {
|
||||
// style and count of history routes
|
||||
this._history_styles = [{dashed:false, color:'#FFFFFF', opacity:0.5, weight:5},
|
||||
{dashed:false, color:'#0000DD', opacity:0.45, weight:5},
|
||||
{dashed:false, color:'#0000BB', opacity:0.40, weight:5},
|
||||
{dashed:false, color:'#000099', opacity:0.35, weight:5},
|
||||
{dashed:false, color:'#000077', opacity:0.30, weight:5},
|
||||
{dashed:false, color:'#000055', opacity:0.25, weight:5},
|
||||
{dashed:false, color:'#000033', opacity:0.20, weight:5},
|
||||
{dashed:false, color:'#000011', opacity:0.15, weight:5},
|
||||
{dashed:false, color:'#000000', opacity:0.10, weight:5}
|
||||
];
|
||||
this._history_length = this._history_styles.length;
|
||||
|
||||
// actual history data
|
||||
this._history = [];
|
||||
for(var i=0, size=this._history_length; i<size; i++) {
|
||||
var history = {};
|
||||
history.route = new OSRM.SimpleRoute("current" , {dashed:false} );
|
||||
history.markers = [];
|
||||
history.checksum = null;
|
||||
this._history.push(history);
|
||||
}
|
||||
|
||||
// helper functions bound to this
|
||||
this._initiate_redrawHistory = OSRM.bind(this, this._getRoute_RedrawHistory);
|
||||
this._callback_redrawHistory = OSRM.bind(this, this._showRoute_RedrawHistory);
|
||||
};
|
||||
OSRM.extend( OSRM.HistoryRoute,{
|
||||
// switch history routes on/off
|
||||
activate: function() {
|
||||
this.storeHistoryRoute = this._storeHistoryRoute;
|
||||
this.fetchHistoryRoute = this._fetchHistoryRoute;
|
||||
this.showHistoryRoutes = this._showHistoryRoutes;
|
||||
this.clearHistoryRoutes = this._clearHistoryRoutes;
|
||||
OSRM.G.map.on('zoomend', this._initiate_redrawHistory );
|
||||
|
||||
this.storeHistoryRoute();
|
||||
},
|
||||
deactivate: function() {
|
||||
this.clearHistoryRoutes();
|
||||
|
||||
this.storeHistoryRoute = this.empty;
|
||||
this.fetchHistoryRoute = this.empty;
|
||||
this.showHistoryRoutes = this.empty;
|
||||
this.clearHistoryRoutes = this.empty;
|
||||
OSRM.G.map.off('zoomend', this._initiate_redrawHistory );
|
||||
},
|
||||
|
||||
// empty function
|
||||
empty: function() {},
|
||||
storeHistoryRoute: function() {},
|
||||
fetchHistoryRoute: function() {},
|
||||
showHistoryRoutes: function() {},
|
||||
clearHistoryRoutes: function() {},
|
||||
|
||||
// actual functions
|
||||
_storeHistoryRoute: function() {
|
||||
var route = OSRM.G.route;
|
||||
if( !route.isShown() || !route.isRoute() )
|
||||
return;
|
||||
|
||||
// store current route in staging spot
|
||||
var hint_data = OSRM.G.response.hint_data;
|
||||
this._history[0].route.setPositions( route.getPositions() );
|
||||
this._history[0].checksum = hint_data.checksum;
|
||||
this._history[0].markers = [];
|
||||
|
||||
var markers = this._getCurrentMarkers();
|
||||
for(var i=0,size=markers.length; i<size; i++) {
|
||||
var position = { lat:markers[i].lat, lng:markers[i].lng, hint:hint_data.locations[i] };
|
||||
this._history[0].markers.push(position);
|
||||
}
|
||||
},
|
||||
_fetchHistoryRoute: function() {
|
||||
if( this._history[0].markers.length == 0 )
|
||||
return;
|
||||
if( OSRM.G.route.isShown() && this._equalMarkers(this._history[0].markers, this._getCurrentMarkers()) )
|
||||
return;
|
||||
if( this._equalMarkers(this._history[0].markers, this._history[1].markers) )
|
||||
return;
|
||||
|
||||
// move all routes down one position
|
||||
for(var i=this._history_length-1; i>0; i--) {
|
||||
this._history[i].route.setPositions( this._history[i-1].route.getPositions() ); // copying positions quicker than creating new route!
|
||||
this._history[i].markers = this._history[i-1].markers;
|
||||
this._history[i].checksum = this._history[i-1].checksum;
|
||||
}
|
||||
// reset staging spot
|
||||
this._history[0].route.setPositions( [] );
|
||||
this._history[0].markers = [];
|
||||
this._history[0].checksum = null;
|
||||
},
|
||||
_showHistoryRoutes: function() {
|
||||
for(var i=1,size=this._history_length; i<size; i++) {
|
||||
this._history[i].route.setStyle( this._history_styles[i] );
|
||||
this._history[i].route.show();
|
||||
OSRM.G.route.hideOldRoute();
|
||||
}
|
||||
},
|
||||
_clearHistoryRoutes: function() {
|
||||
for(var i=0,size=this._history_length; i<size; i++) {
|
||||
this._history[i].route.hide();
|
||||
this._history[i].route.setPositions( [] );
|
||||
this._history[i].markers = [];
|
||||
this._history[i].checksum = null;
|
||||
}
|
||||
},
|
||||
|
||||
// get positions of current markers (data of jsonp response used, as not all data structures up-to-date!)
|
||||
_getCurrentMarkers: function() {
|
||||
var route = [];
|
||||
|
||||
var positions = OSRM.G.route.getPositions();
|
||||
if(positions.length == 0)
|
||||
return route;
|
||||
|
||||
for(var i=0; i<OSRM.G.response.via_points.length; i++)
|
||||
route.push( {lat:OSRM.G.response.via_points[i][0], lng:OSRM.G.response.via_points[i][1]} );
|
||||
return route;
|
||||
},
|
||||
|
||||
// check if two routes are equivalent by checking their markers
|
||||
_equalMarkers: function(lhs, rhs) {
|
||||
if(lhs.length != rhs.length)
|
||||
return false;
|
||||
for(var i=0,size=lhs.length; i<size; i++) {
|
||||
if( lhs[i].lat.toFixed(5) != rhs[i].lat.toFixed(5) || lhs[i].lng.toFixed(5) != rhs[i].lng.toFixed(5) )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
// requery history routes
|
||||
_showRoute_RedrawHistory: function(response, history_id) {
|
||||
if(!response)
|
||||
return;
|
||||
|
||||
var positions = OSRM.RoutingGeometry._decode(response.route_geometry, 5);
|
||||
this._history[history_id].route.setPositions(positions);
|
||||
this._updateHints(response, history_id);
|
||||
},
|
||||
_getRoute_RedrawHistory: function() {
|
||||
for(var i=0,size=this._history_length; i<size; i++)
|
||||
if( this._history[i].markers.length > 0 ) {
|
||||
OSRM.JSONP.clear('history'+i);
|
||||
OSRM.JSONP.call(this._buildCall(i)+'&instructions=false', this._callback_redrawHistory, OSRM.JSONP.empty, OSRM.DEFAULTS.JSONP_TIMEOUT, 'history'+i, i);
|
||||
}
|
||||
},
|
||||
_buildCall: function(history_id) {
|
||||
var source = OSRM.DEFAULTS.HOST_ROUTING_URL;
|
||||
source += '?z=' + OSRM.G.map.getZoom() + '&output=json&jsonp=%jsonp';
|
||||
|
||||
if(this._history[history_id].checksum)
|
||||
source += '&checksum=' + this._history[history_id].checksum;
|
||||
|
||||
var history_markers = this._history[history_id].markers;
|
||||
for(var i=0,size=history_markers.length; i<size; i++) {
|
||||
source += '&loc=' + history_markers[i].lat.toFixed(6) + ',' + history_markers[i].lng.toFixed(6);
|
||||
if( history_markers[i].hint )
|
||||
source += '&hint=' + history_markers[i].hint;
|
||||
}
|
||||
return source;
|
||||
},
|
||||
_updateHints: function(response, history_id) {
|
||||
this._history[history_id].checksum = response.hint_data.checksum;
|
||||
|
||||
var hints = response.hint_data.locations;
|
||||
for(var i=0; i<hints.length; i++)
|
||||
this._history[history_id].markers[i].hint = hints[i];
|
||||
}
|
||||
});
|
||||
@@ -22,45 +22,6 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
OSRM.GLOBALS.map = null;
|
||||
|
||||
|
||||
// map view/model
|
||||
// [extending Leaflet L.Map with setView/fitBounds methods that respect UI visibility]
|
||||
OSRM.MapView = L.Map.extend({
|
||||
setViewUI: function(position, zoom) {
|
||||
if( OSRM.GUI.visible == true ) {
|
||||
var point = OSRM.G.map.project( position, zoom);
|
||||
point.x-=OSRM.GUI.width/2;
|
||||
position = OSRM.G.map.unproject(point,zoom);
|
||||
}
|
||||
this.setView( position, zoom);
|
||||
},
|
||||
fitBoundsUI: function(bounds) {
|
||||
var southwest = bounds.getSouthWest();
|
||||
var northeast = bounds.getNorthEast();
|
||||
var zoom = OSRM.G.map.getBoundsZoom(bounds);
|
||||
var sw_point = OSRM.G.map.project( southwest, zoom);
|
||||
if( OSRM.GUI.visible == true )
|
||||
sw_point.x-=OSRM.GUI.width/2;
|
||||
else
|
||||
sw_point.x-=10;
|
||||
sw_point.y+=10;
|
||||
var ne_point = OSRM.G.map.project( northeast, zoom);
|
||||
ne_point.y-=10;
|
||||
sw_point.x+=10;
|
||||
bounds.extend( OSRM.G.map.unproject(sw_point,zoom) );
|
||||
bounds.extend( OSRM.G.map.unproject(ne_point,zoom) );
|
||||
this.fitBounds( bounds );
|
||||
},
|
||||
getCenterUI: function(unbounded) {
|
||||
var viewHalf = this.getSize();
|
||||
if( OSRM.GUI.visible == true )
|
||||
viewHalf.x += OSRM.GUI.width;
|
||||
var centerPoint = this._getTopLeftPoint().add(viewHalf.divideBy(2));
|
||||
|
||||
return this.unproject(centerPoint, this._zoom, unbounded);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// map controller
|
||||
// [map initialization, event handling]
|
||||
OSRM.Map = {
|
||||
@@ -68,15 +29,19 @@ OSRM.Map = {
|
||||
// map initialization
|
||||
init: function() {
|
||||
// check if GUI is initialized!
|
||||
if(OSRM.GUI.visible == null)
|
||||
if(OSRM.G.main_handle == null)
|
||||
OSRM.GUI.init();
|
||||
|
||||
// setup tile servers
|
||||
var tile_servers = OSRM.DEFAULTS.TILE_SERVERS;
|
||||
var base_maps = {};
|
||||
for(var i=0, size=tile_servers.length; i<size; i++) {
|
||||
tile_servers[i].options.attribution = tile_servers[i].attribution;
|
||||
base_maps[ tile_servers[i].display_name ] = new L.TileLayer( tile_servers[i].url, tile_servers[i].options );
|
||||
if( tile_servers[i].bing == true ) {
|
||||
base_maps[ tile_servers[i].display_name ] = new L.TileLayer.Bing( tile_servers[i].apikey, tile_servers[i].type, tile_servers[i].options );
|
||||
} else {
|
||||
tile_servers[i].options.attribution = tile_servers[i].attribution;
|
||||
base_maps[ tile_servers[i].display_name ] = new L.TileLayer( tile_servers[i].url, tile_servers[i].options );
|
||||
}
|
||||
}
|
||||
|
||||
// setup map
|
||||
@@ -89,18 +54,12 @@ init: function() {
|
||||
});
|
||||
|
||||
// add layer control
|
||||
var layersControl = new L.Control.Layers(base_maps, {});
|
||||
OSRM.G.map.addControl(layersControl);
|
||||
var layerControl = new L.Control.QueryableLayers(base_maps, {});
|
||||
OSRM.G.map.addLayerControl(layerControl);
|
||||
|
||||
// move zoom markers
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.left=(OSRM.GUI.width+10)+"px";
|
||||
getElementsByClassName(document,'leaflet-control-zoom')[0].style.top="5px";
|
||||
|
||||
// initial correct map position and zoom (respect UI visibility, use browser position)
|
||||
var position = new L.LatLng( OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE);
|
||||
OSRM.G.map.setViewUI( position, OSRM.DEFAULTS.ONLOAD_ZOOM_LEVEL);
|
||||
if (navigator.geolocation && document.URL.indexOf("file://") == -1) // convenience during development, as FF doesn't save rights for local files
|
||||
navigator.geolocation.getCurrentPosition(OSRM.Map.geolocationResponse);
|
||||
OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.left=(OSRM.G.main_handle.boxWidth()+10)+"px";
|
||||
OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.top="5px";
|
||||
|
||||
// map events
|
||||
OSRM.G.map.on('zoomend', OSRM.Map.zoomed );
|
||||
@@ -109,27 +68,39 @@ init: function() {
|
||||
OSRM.G.map.on('mousemove', OSRM.Map.mousemove );
|
||||
},
|
||||
|
||||
// init map position and zoom (respect UI visibility / use browser geolocation)
|
||||
initPosition: function() {
|
||||
var position = new L.LatLng( OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE);
|
||||
OSRM.G.map.setViewUI( position, OSRM.DEFAULTS.ONLOAD_ZOOM_LEVEL, true);
|
||||
if (navigator.geolocation && document.URL.indexOf("file://") == -1) // convenience: FF does not save access rights for local files
|
||||
navigator.geolocation.getCurrentPosition(OSRM.Map.geolocationResponse);
|
||||
},
|
||||
|
||||
// map event handlers
|
||||
zoomed: function(e) { OSRM.Routing.getRoute(); },
|
||||
zoomed: function(e) {
|
||||
if(OSRM.G.dragging)
|
||||
OSRM.Routing.getRoute_Dragging();
|
||||
else
|
||||
OSRM.Routing.getRoute_Redraw({keepAlternative:true});
|
||||
},
|
||||
contextmenu: function(e) {;},
|
||||
mousemove: function(e) { OSRM.Via.drawDragMarker(e); },
|
||||
click: function(e) {
|
||||
OSRM.GUI.deactivateTooltip( "clicking" );
|
||||
if( !OSRM.G.markers.hasSource() ) {
|
||||
var index = OSRM.G.markers.setSource( e.latlng );
|
||||
OSRM.Geocoder.updateAddress( OSRM.C.SOURCE_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG );
|
||||
OSRM.G.markers.route[index].show();
|
||||
OSRM.G.markers.route[index].centerView( OSRM.G.map.getZoom() );
|
||||
OSRM.Routing.getRoute();
|
||||
OSRM.G.markers.route[index].show();
|
||||
OSRM.Routing.getRoute( {recenter:OSRM.G.markers.route.length == 2} ); // allow recentering when the route is first shown
|
||||
} else if( !OSRM.G.markers.hasTarget() ) {
|
||||
var index = OSRM.G.markers.setTarget( e.latlng );
|
||||
OSRM.Geocoder.updateAddress( OSRM.C.TARGET_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG );
|
||||
OSRM.G.markers.route[index].show();
|
||||
OSRM.G.markers.route[index].centerView( OSRM.G.map.getZoom() );
|
||||
OSRM.Routing.getRoute();
|
||||
OSRM.Routing.getRoute( {recenter:OSRM.G.markers.route.length == 2} ); // allow recentering when the route is first shown
|
||||
}
|
||||
},
|
||||
geolocationResponse: function(response) {
|
||||
var latlng = new L.LatLng(response.coords.latitude, response.coords.longitude);
|
||||
OSRM.G.map.setViewUI(latlng, OSRM.DEFAULTS.ZOOM_LEVEL );
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM marker management (all route markers should only be set and deleted with these routines!)
|
||||
// [this holds the vital information of the route]
|
||||
|
||||
OSRM.Markers = function() {
|
||||
this.route = new Array();
|
||||
this.highlight = new OSRM.DragMarker("highlight", {zIndexOffset:-1,draggable:true,icon:OSRM.G.icons['marker-highlight'],dragicon:OSRM.G.icons['marker-highlight-drag']});;
|
||||
this.dragger = new OSRM.DragMarker("drag", {draggable:true,icon:OSRM.G.icons['marker-drag'],dragicon:OSRM.G.icons['marker-drag']});;
|
||||
};
|
||||
OSRM.extend( OSRM.Markers,{
|
||||
reset: function() {
|
||||
// remove route markers
|
||||
for(var i=0; i<this.route.length;i++)
|
||||
this.route[i].hide();
|
||||
this.route.splice(0, this.route.length);
|
||||
document.getElementById('gui-delete-source').style.visibility = "hidden";
|
||||
document.getElementById('gui-delete-target').style.visibility = "hidden";
|
||||
// remove special markers
|
||||
this.highlight.hide();
|
||||
this.dragger.hide();
|
||||
},
|
||||
removeVias: function() {
|
||||
// assert correct route array s - v - t
|
||||
for(var i=1; i<this.route.length-1;i++)
|
||||
this.route[i].hide();
|
||||
this.route.splice(1, this.route.length-2);
|
||||
},
|
||||
setSource: function(position) {
|
||||
// source node is always first node
|
||||
if( this.route[0] && this.route[0].label == OSRM.C.SOURCE_LABEL )
|
||||
this.route[0].setPosition(position);
|
||||
else
|
||||
this.route.splice(0,0, new OSRM.RouteMarker(OSRM.C.SOURCE_LABEL, {draggable:true,icon:OSRM.G.icons['marker-source'],dragicon:OSRM.G.icons['marker-source-drag']}, position));
|
||||
document.getElementById('gui-delete-source').style.visibility = "visible";
|
||||
return 0;
|
||||
},
|
||||
setTarget: function(position) {
|
||||
// target node is always last node
|
||||
if( this.route[this.route.length-1] && this.route[ this.route.length-1 ].label == OSRM.C.TARGET_LABEL )
|
||||
this.route[this.route.length-1].setPosition(position);
|
||||
else
|
||||
this.route.splice( this.route.length,0, new OSRM.RouteMarker(OSRM.C.TARGET_LABEL, {draggable:true,icon:OSRM.G.icons['marker-target'],dragicon:OSRM.G.icons['marker-target-drag']}, position));
|
||||
document.getElementById('gui-delete-target').style.visibility = "visible";
|
||||
return this.route.length-1;
|
||||
},
|
||||
setVia: function(id, position) {
|
||||
// via nodes only between source and target nodes
|
||||
if( this.route.length<2 || id > this.route.length-2 )
|
||||
return -1;
|
||||
|
||||
this.route.splice(id+1,0, new OSRM.RouteMarker(OSRM.C.VIA_LABEL, {draggable:true,icon:OSRM.G.icons['marker-via'],dragicon:OSRM.G.icons['marker-via-drag']}, position));
|
||||
return id+1;
|
||||
},
|
||||
removeMarker: function(id) {
|
||||
if( id >= this.route.length )
|
||||
return;
|
||||
|
||||
// also remove vias if source or target are removed
|
||||
if( id==0 && this.route[0].label == OSRM.C.SOURCE_LABEL ) {
|
||||
this.removeVias();
|
||||
document.getElementById('gui-input-source').value = "";
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
document.getElementById('gui-delete-source').style.visibility = "hidden";
|
||||
} else if( id == this.route.length-1 && this.route[ this.route.length-1 ].label == OSRM.C.TARGET_LABEL ) {
|
||||
this.removeVias();
|
||||
id = this.route.length-1;
|
||||
document.getElementById('gui-input-target').value = "";
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
document.getElementById('gui-delete-target').style.visibility = "hidden";
|
||||
}
|
||||
|
||||
this.route[id].hide();
|
||||
this.route.splice(id, 1);
|
||||
},
|
||||
reverseMarkers: function() {
|
||||
var size = this.route.length;
|
||||
|
||||
// invert route, if a route is shown
|
||||
if( size > 1 ) {
|
||||
// switch positions in nodes
|
||||
var temp_position = this.route[0].getPosition();
|
||||
this.route[0].setPosition( this.route[size-1].getPosition() );
|
||||
this.route[size-1].setPosition( temp_position );
|
||||
// switch nodes in array
|
||||
var temp_node = this.route[0];
|
||||
this.route[0] = this.route[size-1];
|
||||
this.route[size-1] = temp_node;
|
||||
// reverse route
|
||||
this.route.reverse();
|
||||
// clear information (both delete markers stay visible)
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
|
||||
// invert marker, if only one marker is shown (implicit clear of information / delete markers)
|
||||
} else if( size > 0 ) {
|
||||
var position = this.route[0].getPosition();
|
||||
var label = this.route[0].label;
|
||||
this.removeMarker(0);
|
||||
if( label == OSRM.C.TARGET_LABEL )
|
||||
this.setSource( position );
|
||||
else if( label == OSRM.C.SOURCE_LABEL )
|
||||
this.setTarget( position );
|
||||
this.route[0].show();
|
||||
}
|
||||
|
||||
},
|
||||
hasSource: function() {
|
||||
if( this.route[0] && this.route[0].label == OSRM.C.SOURCE_LABEL )
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
hasTarget: function() {
|
||||
if( this.route[this.route.length-1] && this.route[this.route.length-1].label == OSRM.C.TARGET_LABEL )
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
|
||||
//relabel all via markers
|
||||
relabelViaMarkers: function() {
|
||||
for(var i=1, size=this.route.length-1; i<size; i++)
|
||||
this.route[i].marker.setLabel(i);
|
||||
}
|
||||
});
|
||||
@@ -15,95 +15,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM routes
|
||||
// [drawing of all types of route geometry]
|
||||
|
||||
|
||||
// simple route class (wraps Leaflet Polyline)
|
||||
OSRM.SimpleRoute = function (label, style) {
|
||||
this.label = (label ? label : "route");
|
||||
this.route = new L.DashedPolyline();
|
||||
this.route.setLatLngs( [] );
|
||||
if(style) this.route.setStyle( style );
|
||||
|
||||
this.shown = false;
|
||||
};
|
||||
OSRM.extend( OSRM.SimpleRoute,{
|
||||
show: function() {
|
||||
OSRM.G.map.addLayer(this.route);
|
||||
this.shown = true;
|
||||
},
|
||||
hide: function() {
|
||||
OSRM.G.map.removeLayer(this.route);
|
||||
this.shown = false;
|
||||
},
|
||||
isShown: function() {
|
||||
return this.shown;
|
||||
},
|
||||
getPoints: function() {
|
||||
return this.route._originalPoints;
|
||||
},
|
||||
getPositions: function() {
|
||||
return this.route.getLatLngs();
|
||||
},
|
||||
setPositions: function(positions) {
|
||||
this.route.setLatLngs( positions );
|
||||
},
|
||||
setStyle: function(style) {
|
||||
this.route.setStyle(style);
|
||||
},
|
||||
centerView: function() {
|
||||
var bounds = new L.LatLngBounds( this.getPositions() );
|
||||
OSRM.g.map.fitBoundsUI( bounds );
|
||||
},
|
||||
toString: function() {
|
||||
return "OSRM.Route("+ this.label + ", " + this.route.getLatLngs().length + " points)";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// multiroute class (wraps Leaflet LayerGroup to hold several disjoint routes)
|
||||
OSRM.MultiRoute = function (label) {
|
||||
this.label = (label ? label : "multiroute");
|
||||
this.route = new L.LayerGroup();
|
||||
|
||||
this.shown = false;
|
||||
};
|
||||
OSRM.extend( OSRM.MultiRoute,{
|
||||
show: function() {
|
||||
OSRM.G.map.addLayer(this.route);
|
||||
this.shown = true;
|
||||
},
|
||||
hide: function() {
|
||||
OSRM.G.map.removeLayer(this.route);
|
||||
this.shown = false;
|
||||
},
|
||||
isShown: function() {
|
||||
return this.shown;
|
||||
},
|
||||
addRoute: function(positions) {
|
||||
var line = new L.DashedPolyline( positions );
|
||||
line.on('click', function(e) { OSRM.G.route.fire('click',e); });
|
||||
this.route.addLayer( line );
|
||||
},
|
||||
clearRoutes: function() {
|
||||
this.route.clearLayers();
|
||||
},
|
||||
setStyle: function(style) {
|
||||
this.route.invoke('setStyle', style);
|
||||
},
|
||||
toString: function() {
|
||||
return "OSRM.MultiRoute("+ this.label + ")";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// route management (handles drawing of route geometry - current route, old route, unnamed route, highlight unnamed streets)
|
||||
// OSRM route management (handles drawing of route geometry - current route, old route, unnamed route, highlight unnamed streets)
|
||||
// [this holds the route geometry]
|
||||
|
||||
|
||||
OSRM.Route = function() {
|
||||
this._current_route = new OSRM.SimpleRoute("current" , {dashed:false} );
|
||||
this._old_route = new OSRM.SimpleRoute("old", {dashed:false,color:"#123"} );
|
||||
this._unnamed_route = new OSRM.MultiRoute("unnamed");
|
||||
this._current_route = new OSRM.SimpleRoute("current" , {dashed:false} );
|
||||
this._alternative_route = new OSRM.SimpleRoute("alternative" , {dashed:false} );
|
||||
this._old_route = new OSRM.SimpleRoute("old", {dashed:false,color:"#123"} );
|
||||
this._unnamed_route = new OSRM.MultiRoute("unnamed");
|
||||
|
||||
this._current_route_style = {dashed:false,color:'#0033FF', weight:5};
|
||||
this._current_noroute_style = {dashed:true, color:'#222222', weight:2};
|
||||
@@ -111,13 +31,16 @@ OSRM.Route = function() {
|
||||
this._old_noroute_style = {dashed:true, color:'#000000', weight:2};
|
||||
this._unnamed_route_style = {dashed:false, color:'#FF00FF', weight:10};
|
||||
this._old_unnamed_route_style = {dashed:false, color:'#990099', weight:10};
|
||||
this._alternative_route_style = {dashed:false,color:'#770033', weight:5, opacity:0.6};
|
||||
|
||||
this._noroute = OSRM.Route.ROUTE;
|
||||
this._history = new OSRM.HistoryRoute();
|
||||
};
|
||||
OSRM.Route.NOROUTE = true;
|
||||
OSRM.Route.ROUTE = false;
|
||||
OSRM.extend( OSRM.Route,{
|
||||
|
||||
|
||||
// show/hide route
|
||||
showRoute: function(positions, noroute) {
|
||||
this._noroute = noroute;
|
||||
this._current_route.setPositions( positions );
|
||||
@@ -127,18 +50,22 @@ OSRM.extend( OSRM.Route,{
|
||||
this._current_route.setStyle( this._current_route_style );
|
||||
this._current_route.show();
|
||||
//this._raiseUnnamedRoute();
|
||||
|
||||
this._history.fetchHistoryRoute();
|
||||
this._history.showHistoryRoutes();
|
||||
this._history.storeHistoryRoute();
|
||||
},
|
||||
hideRoute: function() {
|
||||
this._current_route.hide();
|
||||
this._unnamed_route.hide();
|
||||
|
||||
this._history.fetchHistoryRoute();
|
||||
this._history.showHistoryRoutes();
|
||||
// deactivate GUI features that need a route
|
||||
OSRM.GUI.deactivateRouteFeatures();
|
||||
},
|
||||
hideAll: function() {
|
||||
this._current_route.hide();
|
||||
this._unnamed_route.hide();
|
||||
this._old_route.hide();
|
||||
this._noroute = OSRM.Route.ROUTE;
|
||||
},
|
||||
|
||||
// show/hide highlighting for unnamed routes
|
||||
showUnnamedRoute: function(positions) {
|
||||
this._unnamed_route.clearRoutes();
|
||||
for(var i=0; i<positions.length; i++) {
|
||||
@@ -156,7 +83,9 @@ OSRM.extend( OSRM.Route,{
|
||||
this._unnamed_route.hide();
|
||||
this._unnamed_route.show();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// show/hide previous route as shadow
|
||||
showOldRoute: function() {
|
||||
this._old_route.setPositions( this._current_route.getPositions() );
|
||||
if ( this._noroute == OSRM.Route.NOROUTE)
|
||||
@@ -172,6 +101,17 @@ OSRM.extend( OSRM.Route,{
|
||||
this._old_route.hide();
|
||||
},
|
||||
|
||||
// show/hide alternative route
|
||||
showAlternativeRoute: function(positions) {
|
||||
this._alternative_route.setPositions( positions );
|
||||
this._alternative_route.setStyle( this._alternative_route_style );
|
||||
this._alternative_route.show();
|
||||
},
|
||||
hideAlternativeRoute: function() {
|
||||
this._alternative_route.hide();
|
||||
},
|
||||
|
||||
// query routines
|
||||
isShown: function() {
|
||||
return this._current_route.isShown();
|
||||
},
|
||||
@@ -183,11 +123,27 @@ OSRM.extend( OSRM.Route,{
|
||||
},
|
||||
getPoints: function() {
|
||||
return this._current_route.getPoints();
|
||||
},
|
||||
},
|
||||
|
||||
// helper routines
|
||||
reset: function() {
|
||||
this.hideRoute();
|
||||
this._old_route.hide();
|
||||
this._noroute = OSRM.Route.ROUTE;
|
||||
this._history.clearHistoryRoutes();
|
||||
},
|
||||
fire: function(type,event) {
|
||||
this._current_route.route.fire(type,event);
|
||||
},
|
||||
centerView: function() {
|
||||
this._current_route.centerView();
|
||||
}
|
||||
},
|
||||
|
||||
// handle history routes
|
||||
activateHistoryRoutes: function() {
|
||||
this._history.activate();
|
||||
},
|
||||
deactivateHistoryRoutes: function() {
|
||||
this._history.deactivate();
|
||||
}
|
||||
});
|
||||
@@ -18,9 +18,6 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
// OSRM via marker routines
|
||||
// [find correct position for a via marker]
|
||||
|
||||
// store location of via points returned by server
|
||||
OSRM.GLOBALS.via_points = null;
|
||||
|
||||
|
||||
OSRM.Via = {
|
||||
|
||||
@@ -49,12 +46,13 @@ findViaIndex: function( new_via_position ) {
|
||||
var nearest_index = OSRM.Via._findNearestRouteSegment( new_via_position );
|
||||
|
||||
// find correct index to insert new via node
|
||||
var new_via_index = OSRM.G.via_points.length;
|
||||
var via_points = OSRM.G.response.via_points;
|
||||
var new_via_index = via_points.length-2;
|
||||
var via_index = Array();
|
||||
for(var i=0; i<OSRM.G.via_points.length; i++) {
|
||||
via_index[i] = OSRM.Via._findNearestRouteSegment( new L.LatLng(OSRM.G.via_points[i][0], OSRM.G.via_points[i][1]) );
|
||||
if(via_index[i] > nearest_index) {
|
||||
new_via_index = i;
|
||||
for(var i=1; i<via_points.length-1; i++) {
|
||||
via_index[i-1] = OSRM.Via._findNearestRouteSegment( new L.LatLng(via_points[i][0], via_points[i][1]) );
|
||||
if(via_index[i-1] > nearest_index) {
|
||||
new_via_index = i-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// queryable Layers control
|
||||
// [simply Control.Layers extended by query functions and some fixes for touch screens]
|
||||
L.Control.QueryableLayers = L.Control.Layers.extend({
|
||||
|
||||
// changes to leaflet behaviour
|
||||
_initLayout: function () {
|
||||
this._container = L.DomUtil.create('div', 'leaflet-control-layers');
|
||||
L.DomEvent.disableClickPropagation(this._container); // change to Leaflet: always disable click propagation
|
||||
|
||||
this._form = L.DomUtil.create('form', 'leaflet-control-layers-list');
|
||||
|
||||
if (this.options.collapsed) {
|
||||
L.DomEvent.addListener(this._container, 'mouseover', this._expand, this);
|
||||
L.DomEvent.addListener(this._container, 'mouseout', this._collapse, this);
|
||||
|
||||
var link = this._layersLink = L.DomUtil.create('a', 'leaflet-control-layers-toggle');
|
||||
link.href = '#';
|
||||
link.title = 'Layers';
|
||||
|
||||
if (L.Browser.touch) {
|
||||
L.DomEvent.addListener(link, 'click', this._expand, this);
|
||||
L.DomEvent.disableClickPropagation(link); // change to Leaflet: disable click propagation
|
||||
} else {
|
||||
L.DomEvent.addListener(link, 'focus', this._expand, this);
|
||||
}
|
||||
this._map.on('movestart', this._collapse, this);
|
||||
// TODO keyboard accessibility
|
||||
|
||||
this._container.appendChild(link);
|
||||
} else {
|
||||
this._expand();
|
||||
}
|
||||
|
||||
this._baseLayersList = L.DomUtil.create('div', 'leaflet-control-layers-base', this._form);
|
||||
this._separator = L.DomUtil.create('div', 'leaflet-control-layers-separator', this._form);
|
||||
this._overlaysList = L.DomUtil.create('div', 'leaflet-control-layers-overlays', this._form);
|
||||
|
||||
this._container.appendChild(this._form);
|
||||
},
|
||||
|
||||
// new query functionality
|
||||
getActiveLayerName: function () {
|
||||
var i, input, obj,
|
||||
inputs = this._form.getElementsByTagName('input'),
|
||||
inputsLen = inputs.length;
|
||||
|
||||
for (i = 0; i < inputsLen; i++) {
|
||||
input = inputs[i];
|
||||
obj = this._layers[input.layerId];
|
||||
if (input.checked && !obj.overlay) {
|
||||
return obj.name;
|
||||
}
|
||||
}
|
||||
},
|
||||
getActiveLayer: function () {
|
||||
var i, input, obj,
|
||||
inputs = this._form.getElementsByTagName('input'),
|
||||
inputsLen = inputs.length;
|
||||
|
||||
for (i = 0; i < inputsLen; i++) {
|
||||
input = inputs[i];
|
||||
obj = this._layers[input.layerId];
|
||||
if (input.checked && !obj.overlay) {
|
||||
return obj.layer;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -34,6 +34,13 @@ L.MouseMarker = L.Marker.extend({
|
||||
}
|
||||
},
|
||||
|
||||
setLabel: function( label ) {
|
||||
if(this._icon) {
|
||||
this._icon.lastChild.innerHTML=label;
|
||||
this._icon.lastChild.style.display = "block";
|
||||
}
|
||||
},
|
||||
|
||||
_changeIcon: function () {
|
||||
var options = this.options;
|
||||
|
||||
@@ -80,8 +80,16 @@ L.SwitchableIcon = L.Class.extend({
|
||||
_createImg: function (src) {
|
||||
var el;
|
||||
if (!L.Browser.ie6) {
|
||||
el = document.createElement('img');
|
||||
el.src = src;
|
||||
el = document.createElement('div');
|
||||
|
||||
var img = document.createElement('img');
|
||||
var num = document.createElement('div');
|
||||
img.src = src;
|
||||
num.className = 'via-counter';
|
||||
num.innerHTML = "";
|
||||
|
||||
el.appendChild(img);
|
||||
el.appendChild(num);
|
||||
} else {
|
||||
el = document.createElement('div');
|
||||
el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")';
|
||||
@@ -106,7 +114,7 @@ L.SwitchableIcon = L.Class.extend({
|
||||
|
||||
_switchImg: function (src, el) {
|
||||
if (!L.Browser.ie6) {
|
||||
el.src = src;
|
||||
el.firstChild.src = src;
|
||||
} else {
|
||||
el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")';
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* Portions of this code and logic copied from OpenLayers and
|
||||
* redistributed under the original Clear BSD license terms:
|
||||
*
|
||||
* http://trac.osgeo.org/openlayers/browser/license.txt
|
||||
*
|
||||
* Copyright 2005-2010 OpenLayers Contributors, released under
|
||||
* the Clear BSD license. See authors.txt for a list of contributors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* --
|
||||
*
|
||||
* Leaflet-specific modifications are released under the following
|
||||
* terms:
|
||||
*
|
||||
* This program is free software. It comes without any warranty, to
|
||||
* the extent permitted by applicable law. You can redistribute it
|
||||
* and/or modify it under the terms of the Do What The Fuck You Want
|
||||
* To Public License, Version 2, as published by Sam Hocevar. See
|
||||
* http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
*/
|
||||
|
||||
L.TileLayer.Bing = L.TileLayer.extend({
|
||||
|
||||
supportedTypes: ['Road', 'Aerial', 'AerialWithLabels'],
|
||||
|
||||
attributionTemplate: '<span style="display:inline-block">' +
|
||||
'<a target="_blank" href="http://www.bing.com/maps/">' +
|
||||
//'<img src="{logo}" /></a><br><span>{copyrights}' +
|
||||
'</a><span>{copyrights}' +
|
||||
'<a style="white-space: nowrap" target="_blank" '+
|
||||
'href="http://www.microsoft.com/maps/product/terms.html">' +
|
||||
'Terms of Use</a></span></span>',
|
||||
|
||||
supportedCultures: {"en":"en-US", "de":"de-DE", "fr":"fr-FR", "it":"it-IT", "es":"es-ES", "nl":"nl-BE"},
|
||||
|
||||
initialize: function(/*String*/ apiKey, /*String*/ mapType, /*Object*/ options) {
|
||||
|
||||
this._apiKey = apiKey;
|
||||
this._mapType = mapType;
|
||||
|
||||
this._loadMetadata();
|
||||
|
||||
L.Util.setOptions(this, options);
|
||||
},
|
||||
|
||||
redraw: function() {
|
||||
this._reset();
|
||||
this._update();
|
||||
},
|
||||
|
||||
_loadMetadata: function() {
|
||||
this._callbackId = "_l_tilelayer_bing_" + (L.TileLayer.Bing._callbackId++);
|
||||
var that = this;
|
||||
window[this._callbackId] = function() {
|
||||
L.TileLayer.Bing.processMetadata.apply(that, arguments);
|
||||
};
|
||||
|
||||
var params = {
|
||||
key: this._apiKey,
|
||||
jsonp: this._callbackId,
|
||||
include: 'ImageryProviders'
|
||||
},
|
||||
url = "http://dev.virtualearth.net/REST/v1/Imagery/Metadata/" +
|
||||
this._mapType + L.Util.getParamString(params),
|
||||
script = document.createElement("script");
|
||||
|
||||
script.type = "text/javascript";
|
||||
script.src = url;
|
||||
script.id = this._callbackId;
|
||||
document.getElementsByTagName("head")[0].appendChild(script);
|
||||
},
|
||||
|
||||
_onMetadataLoaded: function() {},
|
||||
|
||||
onAdd: function(map, insertAtTheBottom) {
|
||||
if (!this.metadata) {
|
||||
this._onMetadataLoaded = L.Util.bind(function() {
|
||||
L.TileLayer.prototype.onAdd.call(this, map, insertAtTheBottom);
|
||||
map.on('moveend', this._updateAttribution, this);
|
||||
this._updateAttribution();
|
||||
}, this);
|
||||
} else {
|
||||
L.TileLayer.prototype.onAdd.call(this, map, insertAtTheBottom);
|
||||
map.on('moveend', this._updateAttribution, this);
|
||||
this._updateAttribution();
|
||||
}
|
||||
},
|
||||
|
||||
onRemove: function(map) {
|
||||
if (this._map.attributionControl) {
|
||||
this._map.attributionControl.removeAttribution(this.attribution);
|
||||
}
|
||||
this._map.off('moveend', this._updateAttribution, this);
|
||||
L.TileLayer.prototype.onRemove.call(this, map);
|
||||
},
|
||||
|
||||
getTileUrl: function(xy, z) {
|
||||
var subdomains = this.options.subdomains,
|
||||
quadDigits = [],
|
||||
i = z,
|
||||
digit,
|
||||
mask,
|
||||
quadKey;
|
||||
// borrowed directly from OpenLayers
|
||||
for (; i > 0; --i) {
|
||||
digit = '0';
|
||||
mask = 1 << (i - 1);
|
||||
if ((xy.x & mask) != 0) {
|
||||
digit++;
|
||||
}
|
||||
if ((xy.y & mask) != 0) {
|
||||
digit++;
|
||||
digit++;
|
||||
}
|
||||
quadDigits.push(digit);
|
||||
}
|
||||
|
||||
return this._url
|
||||
.replace('{culture}', this.supportedCultures[OSRM.Localization.current_language] || "en-US" )
|
||||
.replace('{subdomain}', subdomains[(xy.x + xy.y) % subdomains.length])
|
||||
.replace('{quadkey}', quadDigits.join(""));
|
||||
},
|
||||
|
||||
_updateAttribution: function() {
|
||||
if (this._map.attributionControl) {
|
||||
var metadata = this.metadata;
|
||||
var res = metadata.resourceSets[0].resources[0];
|
||||
var bounds = this._map.getBounds();
|
||||
var providers = res.imageryProviders, zoom = this._map.getZoom() + 1,
|
||||
copyrights = "", provider, i, ii, j, jj, bbox, coverage;
|
||||
for (i=0,ii=providers.length; i<ii; ++i) {
|
||||
provider = providers[i];
|
||||
for (j=0,jj=provider.coverageAreas.length; j<jj; ++j) {
|
||||
coverage = provider.coverageAreas[j];
|
||||
if (zoom <= coverage.zoomMax && zoom >= coverage.zoomMin && coverage.bbox.intersects(bounds)) {
|
||||
copyrights += provider.attribution + " ";
|
||||
j = jj;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._map.attributionControl.removeAttribution(this.attribution);
|
||||
this._map.attributionControl._attributions = {};
|
||||
this._map.attributionControl._update();
|
||||
this.attribution = this.attributionTemplate
|
||||
.replace('{logo}', metadata.brandLogoUri)
|
||||
.replace('{copyrights}', copyrights);
|
||||
this._map.attributionControl.addAttribution(this.attribution);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
L.TileLayer.Bing._callbackId = 0;
|
||||
|
||||
L.TileLayer.Bing.processMetadata = function(metadata) {
|
||||
if (metadata.authenticationResultCode != 'ValidCredentials') {
|
||||
throw "Invalid Bing Maps API Key"
|
||||
}
|
||||
|
||||
if (!metadata.resourceSets.length || !metadata.resourceSets[0].resources.length) {
|
||||
throw "No resources returned, perhaps " + this._mapType + " is an invalid map type?";
|
||||
}
|
||||
|
||||
if (metadata.statusCode != 200) {
|
||||
throw "Bing Maps API request failed with status code " + metadata.statusCode;
|
||||
}
|
||||
|
||||
this.metadata = metadata;
|
||||
var res = metadata.resourceSets[0].resources[0],
|
||||
providers = res.imageryProviders,
|
||||
i = 0,
|
||||
j,
|
||||
provider,
|
||||
bbox,
|
||||
script = document.getElementById(this._callbackId);
|
||||
|
||||
for (; i<providers.length; i++) {
|
||||
provider = providers[i];
|
||||
for (j=0; j<provider.coverageAreas.length; j++) {
|
||||
bbox = provider.coverageAreas[j].bbox;
|
||||
provider.coverageAreas[j].bbox = new L.LatLngBounds(new L.LatLng(bbox[0],bbox[1],true),new L.LatLng(bbox[2],bbox[3], true));
|
||||
}
|
||||
}
|
||||
|
||||
this._url = res.imageUrl;
|
||||
this.options.subdomains = [].concat(res.imageUrlSubdomains);
|
||||
script.parentNode.removeChild(script);
|
||||
window[this._callbackId] = undefined; // cannot delete from window in IE
|
||||
delete this._callbackId;
|
||||
this._onMetadataLoaded();
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// map view/model
|
||||
// [extending Leaflet L.Map with setView/fitBounds methods that respect UI visibility, better layerControl]
|
||||
OSRM.MapView = L.Map.extend({
|
||||
_boundsInsideView: function(bounds) {
|
||||
var viewBounds = this.getBounds(),
|
||||
viewSw = this.project(viewBounds.getSouthWest()),
|
||||
viewNe = this.project(viewBounds.getNorthEast()),
|
||||
sw = this.project(bounds.getSouthWest()),
|
||||
ne = this.project(bounds.getNorthEast());
|
||||
|
||||
if (viewNe.y > ne.y) { // north
|
||||
return false;
|
||||
}
|
||||
if (viewNe.x < ne.x) { // east
|
||||
return false;
|
||||
}
|
||||
if (viewSw.y < sw.y) { // south
|
||||
return false;
|
||||
}
|
||||
if (viewSw.x > sw.x) { // west
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
setViewBounds: function(bounds) {
|
||||
var zoom = this.getBoundsZoom(bounds); // maximum zoom level at which the bounds fit onto the map
|
||||
|
||||
if( this._zoom > zoom ) { // if current zoom level is too close change zoom level and recenter
|
||||
this.setView(bounds.getCenter(), zoom);
|
||||
} else if(!this._boundsInsideView(bounds)){ // if current zoom level is okay, but bounds are outside the viewport, pan
|
||||
this.setView(bounds.getCenter(), this._zoom);
|
||||
}
|
||||
},
|
||||
setViewUI: function(position, zoom, no_animation) {
|
||||
if( OSRM.G.main_handle.boxVisible() ) {
|
||||
var point = this.project( position, zoom);
|
||||
point.x-=OSRM.G.main_handle.boxWidth()/2;
|
||||
position = this.unproject(point,zoom);
|
||||
}
|
||||
this.setView( position, zoom, no_animation);
|
||||
},
|
||||
setViewBoundsUI: function(bounds) {
|
||||
var southwest = bounds.getSouthWest();
|
||||
var northeast = bounds.getNorthEast();
|
||||
var zoom = this.getBoundsZoom(bounds);
|
||||
var sw_point = this.project( southwest, zoom);
|
||||
if( OSRM.G.main_handle.boxVisible() )
|
||||
sw_point.x-=OSRM.G.main_handle.boxWidth()+20;
|
||||
else
|
||||
sw_point.x-=20;
|
||||
sw_point.y+=20;
|
||||
var ne_point = this.project( northeast, zoom);
|
||||
ne_point.y-=20;
|
||||
ne_point.x+=20;
|
||||
bounds.extend( this.unproject(sw_point,zoom) );
|
||||
bounds.extend( this.unproject(ne_point,zoom) );
|
||||
this.setViewBounds( bounds );
|
||||
},
|
||||
fitBoundsUI: function(bounds) {
|
||||
var southwest = bounds.getSouthWest();
|
||||
var northeast = bounds.getNorthEast();
|
||||
var zoom = this.getBoundsZoom(bounds);
|
||||
var sw_point = this.project( southwest, zoom);
|
||||
if( OSRM.G.main_handle.boxVisible() )
|
||||
sw_point.x-=OSRM.G.main_handle.boxWidth()+20;
|
||||
else
|
||||
sw_point.x-=20;
|
||||
sw_point.y+=20;
|
||||
var ne_point = this.project( northeast, zoom);
|
||||
ne_point.y-=20;
|
||||
ne_point.x+=20;
|
||||
bounds.extend( this.unproject(sw_point,zoom) );
|
||||
bounds.extend( this.unproject(ne_point,zoom) );
|
||||
this.fitBounds( bounds );
|
||||
},
|
||||
getBoundsUI: function(unbounded) {
|
||||
var bounds = this.getPixelBounds();
|
||||
if( OSRM.G.main_handle.boxVisible() )
|
||||
bounds.min.x+=OSRM.G.main_handle.boxWidth();
|
||||
var sw = this.unproject(new L.Point(bounds.min.x, bounds.max.y), this._zoom, true),
|
||||
ne = this.unproject(new L.Point(bounds.max.x, bounds.min.y), this._zoom, true);
|
||||
return new L.LatLngBounds(sw, ne);
|
||||
},
|
||||
getCenterUI: function(unbounded) {
|
||||
var viewHalf = this.getSize();
|
||||
if( OSRM.G.main_handle.boxVisible() )
|
||||
viewHalf.x += OSRM.G.main_handle.boxWidth();
|
||||
var centerPoint = this._getTopLeftPoint().add(viewHalf.divideBy(2));
|
||||
|
||||
return this.unproject(centerPoint, this._zoom, unbounded);
|
||||
},
|
||||
addLayerControl: function( layerControl ) {
|
||||
if( this.layerControl )
|
||||
return;
|
||||
|
||||
this.layerControl = layerControl;
|
||||
this.addControl(this.layerControl);
|
||||
},
|
||||
getActiveLayerId: function() {
|
||||
var tile_server_id = 0;
|
||||
|
||||
var tile_servers = OSRM.DEFAULTS.TILE_SERVERS;
|
||||
var tile_server_name = this.layerControl.getActiveLayerName();
|
||||
for(var i=0, size=tile_servers.length; i<size; i++) {
|
||||
if( tile_servers[i].display_name == tile_server_name ) {
|
||||
tile_server_id = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return tile_server_id;
|
||||
}
|
||||
});
|
||||
@@ -16,7 +16,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM markers
|
||||
// [base marker class, derived highlight marker and route marker classes, marker management]
|
||||
// [base marker class, derived highlight marker and route marker classes]
|
||||
|
||||
|
||||
// base marker class (wraps Leaflet markers)
|
||||
@@ -95,10 +95,11 @@ onClick: function(e) {
|
||||
onDrag: function(e) {
|
||||
this.parent.setPosition( e.target.getLatLng() );
|
||||
if(OSRM.G.markers.route.length>1)
|
||||
OSRM.Routing.getDragRoute();
|
||||
OSRM.Routing.getRoute_Dragging();
|
||||
OSRM.Geocoder.updateLocation( this.parent.label );
|
||||
},
|
||||
onDragStart: function(e) {
|
||||
OSRM.GUI.deactivateTooltip( "dragging" );
|
||||
OSRM.G.dragging = true;
|
||||
this.switchIcon(this.options.dragicon);
|
||||
|
||||
@@ -164,86 +165,3 @@ toString: function() {
|
||||
return "OSRM.DragMarker: \""+this.label+"\", "+this.position+")";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// marker management class (all route markers should only be set and deleted with these routines!)
|
||||
// [this holds the vital information of the route]
|
||||
OSRM.Markers = function() {
|
||||
this.route = new Array();
|
||||
this.highlight = new OSRM.DragMarker("highlight", {draggable:true,icon:OSRM.G.icons['marker-highlight'],dragicon:OSRM.G.icons['marker-highlight-drag']});;
|
||||
this.dragger = new OSRM.DragMarker("drag", {draggable:true,icon:OSRM.G.icons['marker-drag'],dragicon:OSRM.G.icons['marker-drag']});;
|
||||
};
|
||||
OSRM.extend( OSRM.Markers,{
|
||||
removeAll: function() {
|
||||
for(var i=0; i<this.route.length;i++)
|
||||
this.route[i].hide();
|
||||
this.route.splice(0, this.route.length);
|
||||
document.getElementById('gui-delete-source').style.visibility = "hidden";
|
||||
document.getElementById('gui-delete-target').style.visibility = "hidden";
|
||||
},
|
||||
removeVias: function() {
|
||||
// assert correct route array s - v - t
|
||||
for(var i=1; i<this.route.length-1;i++)
|
||||
this.route[i].hide();
|
||||
this.route.splice(1, this.route.length-2);
|
||||
},
|
||||
setSource: function(position) {
|
||||
// source node is always first node
|
||||
if( this.route[0] && this.route[0].label == OSRM.C.SOURCE_LABEL )
|
||||
this.route[0].setPosition(position);
|
||||
else
|
||||
this.route.splice(0,0, new OSRM.RouteMarker(OSRM.C.SOURCE_LABEL, {draggable:true,icon:OSRM.G.icons['marker-source'],dragicon:OSRM.G.icons['marker-source-drag']}, position));
|
||||
document.getElementById('gui-delete-source').style.visibility = "visible";
|
||||
return 0;
|
||||
},
|
||||
setTarget: function(position) {
|
||||
// target node is always last node
|
||||
if( this.route[this.route.length-1] && this.route[ this.route.length-1 ].label == OSRM.C.TARGET_LABEL )
|
||||
this.route[this.route.length-1].setPosition(position);
|
||||
else
|
||||
this.route.splice( this.route.length,0, new OSRM.RouteMarker(OSRM.C.TARGET_LABEL, {draggable:true,icon:OSRM.G.icons['marker-target'],dragicon:OSRM.G.icons['marker-target-drag']}, position));
|
||||
document.getElementById('gui-delete-target').style.visibility = "visible";
|
||||
return this.route.length-1;
|
||||
},
|
||||
setVia: function(id, position) {
|
||||
// via nodes only between source and target nodes
|
||||
if( this.route.length<2 || id > this.route.length-2 )
|
||||
return -1;
|
||||
|
||||
this.route.splice(id+1,0, new OSRM.RouteMarker(OSRM.C.VIA_LABEL, {draggable:true,icon:OSRM.G.icons['marker-via'],dragicon:OSRM.G.icons['marker-via-drag']}, position));
|
||||
return id+1;
|
||||
},
|
||||
removeMarker: function(id) {
|
||||
if( id >= this.route.length )
|
||||
return;
|
||||
|
||||
// also remove vias if source or target are removed
|
||||
if( id==0 && this.route[0].label == OSRM.C.SOURCE_LABEL ) {
|
||||
this.removeVias();
|
||||
document.getElementById('gui-input-source').value = "";
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
document.getElementById('gui-delete-source').style.visibility = "hidden";
|
||||
} else if( id == this.route.length-1 && this.route[ this.route.length-1 ].label == OSRM.C.TARGET_LABEL ) {
|
||||
this.removeVias();
|
||||
id = this.route.length-1;
|
||||
document.getElementById('gui-input-target').value = "";
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
document.getElementById('gui-delete-target').style.visibility = "hidden";
|
||||
}
|
||||
|
||||
this.route[id].hide();
|
||||
this.route.splice(id, 1);
|
||||
},
|
||||
hasSource: function() {
|
||||
if( OSRM.G.markers.route[0] && OSRM.G.markers.route[0].label == OSRM.C.SOURCE_LABEL )
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
hasTarget: function() {
|
||||
if( OSRM.G.markers.route[OSRM.G.markers.route.length-1] && OSRM.G.markers.route[OSRM.G.markers.route.length-1].label == OSRM.C.TARGET_LABEL )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM routes
|
||||
// [drawing of all types of route geometry]
|
||||
|
||||
|
||||
// simple route class (wraps Leaflet Polyline)
|
||||
OSRM.SimpleRoute = function (label, style) {
|
||||
this.label = (label ? label : "route");
|
||||
this.route = new L.DashedPolyline();
|
||||
this.route.setLatLngs( [] );
|
||||
if(style) this.route.setStyle( style );
|
||||
|
||||
this.shown = false;
|
||||
};
|
||||
OSRM.extend( OSRM.SimpleRoute,{
|
||||
show: function() {
|
||||
OSRM.G.map.addLayer(this.route);
|
||||
this.shown = true;
|
||||
},
|
||||
hide: function() {
|
||||
OSRM.G.map.removeLayer(this.route);
|
||||
this.shown = false;
|
||||
},
|
||||
isShown: function() {
|
||||
return this.shown;
|
||||
},
|
||||
getPoints: function() {
|
||||
return this.route._originalPoints;
|
||||
},
|
||||
getPositions: function() {
|
||||
return this.route.getLatLngs();
|
||||
},
|
||||
setPositions: function(positions) {
|
||||
this.route.setLatLngs( positions );
|
||||
},
|
||||
setStyle: function(style) {
|
||||
this.route.setStyle(style);
|
||||
},
|
||||
centerView: function() {
|
||||
var bounds = new L.LatLngBounds( this.getPositions() );
|
||||
OSRM.g.map.fitBoundsUI( bounds );
|
||||
},
|
||||
toString: function() {
|
||||
return "OSRM.Route("+ this.label + ", " + this.route.getLatLngs().length + " points)";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// multiroute class (wraps Leaflet LayerGroup to hold several disjoint routes)
|
||||
OSRM.MultiRoute = function (label) {
|
||||
this.label = (label ? label : "multiroute");
|
||||
this.route = new L.LayerGroup();
|
||||
|
||||
this.shown = false;
|
||||
};
|
||||
OSRM.extend( OSRM.MultiRoute,{
|
||||
show: function() {
|
||||
OSRM.G.map.addLayer(this.route);
|
||||
this.shown = true;
|
||||
},
|
||||
hide: function() {
|
||||
OSRM.G.map.removeLayer(this.route);
|
||||
this.shown = false;
|
||||
},
|
||||
isShown: function() {
|
||||
return this.shown;
|
||||
},
|
||||
addRoute: function(positions) {
|
||||
var line = new L.DashedPolyline( positions );
|
||||
line.on('click', function(e) { OSRM.G.route.fire('click',e); });
|
||||
this.route.addLayer( line );
|
||||
},
|
||||
clearRoutes: function() {
|
||||
this.route.clearLayers();
|
||||
},
|
||||
setStyle: function(style) {
|
||||
this.route.invoke('setStyle', style);
|
||||
},
|
||||
toString: function() {
|
||||
return "OSRM.MultiRoute("+ this.label + ")";
|
||||
}
|
||||
});
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM GUI
|
||||
// [base GUI class, all other GUI modules extend this class]
|
||||
|
||||
|
||||
OSRM.GUI = {
|
||||
|
||||
// initialization functions of all GUI parts
|
||||
init_functions: [],
|
||||
|
||||
// init GUI
|
||||
init: function() {
|
||||
for(var i=0, size=OSRM.GUI.init_functions.length; i<size; i++) {
|
||||
OSRM.GUI.init_functions[i]();
|
||||
}
|
||||
},
|
||||
|
||||
//extend GUI class and add init functions to the array
|
||||
extend: function( properties ) {
|
||||
for( property in properties ) {
|
||||
if( property == 'init' )
|
||||
OSRM.GUI.init_functions.push( properties[property] );
|
||||
else
|
||||
OSRM.GUI[property] = properties[property];
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM MainGUI
|
||||
// [handles all GUI events that interact with appearance of main window]
|
||||
|
||||
|
||||
// OSRM GUIBoxGroup
|
||||
// [group UI boxes so that handles can be shown/hidden together]
|
||||
|
||||
OSRM.GUIBoxGroup = function() {
|
||||
this._handles = [];
|
||||
};
|
||||
|
||||
OSRM.extend( OSRM.GUIBoxGroup, {
|
||||
add: function( handle ) {
|
||||
this._handles.push( handle );
|
||||
handle.$addToGroup(this);
|
||||
},
|
||||
select: function( handle ) {
|
||||
for(var i=0; i< this._handles.length; i++) {
|
||||
if( this._handles[i] != handle )
|
||||
this._handles[i].$hideBox();
|
||||
else
|
||||
this._handles[i].$showBox();
|
||||
}
|
||||
},
|
||||
|
||||
$hide: function() {
|
||||
for(var i=0; i< this._handles.length; i++) {
|
||||
this._handles[i].$hide();
|
||||
}
|
||||
},
|
||||
$show: function() {
|
||||
for(var i=0; i< this._handles.length; i++) {
|
||||
this._handles[i].$show();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM GUIBoxHandle
|
||||
// [performs showing and hiding of UI boxes]
|
||||
|
||||
OSRM.GUIBoxHandle = function( box_name, side, css, transitionStartFct, transitionEndFct ) {
|
||||
// do not create handle if box does not contain a toggle button
|
||||
var toggle = document.getElementById( box_name + '-toggle');
|
||||
if( toggle == null ) {
|
||||
console.log("[error] No toggle button for " + box_name);
|
||||
return;
|
||||
}
|
||||
|
||||
// create handle DOM elements
|
||||
var wrapper = document.createElement('div');
|
||||
wrapper.id = box_name + '-handle-wrapper';
|
||||
wrapper.className = 'box-wrapper box-handle-wrapper-'+side;
|
||||
wrapper.style.cssText += css;
|
||||
var content = document.createElement('div');
|
||||
content.id = box_name + '-handle-content';
|
||||
content.className = 'box-content box-handle-content-'+side;
|
||||
var icon = document.createElement('div');
|
||||
icon.id = box_name + '-handle-icon';
|
||||
icon.className = 'iconic-button';
|
||||
|
||||
content.appendChild(icon);
|
||||
wrapper.appendChild(content);
|
||||
document.body.appendChild(wrapper);
|
||||
|
||||
// create attributes
|
||||
this._box = document.getElementById( box_name + '-wrapper' );
|
||||
this._class = this._box.className;
|
||||
this._width = this._box.clientWidth;
|
||||
this._side = side;
|
||||
this._handle = wrapper;
|
||||
this._box_group = null;
|
||||
this._transitionEndFct = transitionEndFct;
|
||||
|
||||
// hide box and show handle by default
|
||||
this._box.style[this._side]=-this._width+"px";
|
||||
this._box_visible = false;
|
||||
this._box.style.visibility="hidden";
|
||||
this._handle.style.visibility="visible";
|
||||
|
||||
// add functionality
|
||||
var full_fct = transitionStartFct ? OSRM.concat(this._toggle, transitionStartFct) : this._toggle;
|
||||
var fct = OSRM.bind( this, full_fct );
|
||||
toggle.onclick = fct;
|
||||
icon.onclick = fct;
|
||||
|
||||
var full_fct = transitionEndFct ? OSRM.concat(this._onTransitionEnd, transitionEndFct) : this._onTransitionEnd;
|
||||
var fct = OSRM.bind( this, full_fct );
|
||||
if( OSRM.Browser.FF3==-1 && OSRM.Browser.IE6_9==-1 ) {
|
||||
var box_wrapper = document.getElementById(box_name + '-wrapper');
|
||||
box_wrapper.addEventListener("transitionend", fct, false);
|
||||
box_wrapper.addEventListener("webkitTransitionEnd", fct, false);
|
||||
box_wrapper.addEventListener("oTransitionEnd", fct, false);
|
||||
box_wrapper.addEventListener("MSTransitionEnd", fct, false);
|
||||
} else {
|
||||
this._legacyTransitionEndFct = fct; // legacy browser support
|
||||
}
|
||||
};
|
||||
|
||||
OSRM.extend( OSRM.GUIBoxHandle, {
|
||||
boxVisible: function() {
|
||||
return this._box_visible;
|
||||
},
|
||||
boxWidth: function() {
|
||||
return this._width;
|
||||
},
|
||||
|
||||
$addToGroup: function(group) {
|
||||
this._box_group = group;
|
||||
},
|
||||
$show: function() {
|
||||
this._handle.style.visibility="visible";
|
||||
},
|
||||
$hide: function() {
|
||||
this._handle.style.visibility="hidden";
|
||||
},
|
||||
$showBox: function() {
|
||||
this._box_visible = true;
|
||||
this._box.style.visibility="visible";
|
||||
this._handle.style.visibility="hidden";
|
||||
this._box.style[this._side]="5px";
|
||||
this._transitionEndFct();
|
||||
},
|
||||
$hideBox: function() {
|
||||
this._box_visible = false;
|
||||
this._box.style.visibility="hidden";
|
||||
this._handle.style.visibility="visible";
|
||||
this._box.style[this._side]=-this._width+"px";
|
||||
},
|
||||
|
||||
_toggle: function() {
|
||||
this._box.className += " box-animated";
|
||||
if( this._box_visible == false ) {
|
||||
this._box_group.$hide();
|
||||
this._box.style[this._side]="5px";
|
||||
this._box.style.visibility="visible"; // already show box, so that animation is seen
|
||||
} else {
|
||||
this._box.style[this._side]=-this._width+"px";
|
||||
}
|
||||
// legacy browser support
|
||||
if( OSRM.Browser.FF3!=-1 || OSRM.Browser.IE6_9!=-1 )
|
||||
setTimeout(this._legacyTransitionEndFct, 0);
|
||||
},
|
||||
_onTransitionEnd: function() {
|
||||
this._box.className = this._class;
|
||||
if( this._box_visible == true ) {
|
||||
this._box_group.$show();
|
||||
this._box_visible = false;
|
||||
this._box.style.visibility="hidden";
|
||||
} else {
|
||||
this._box_visible = true;
|
||||
this._box.style.visibility="visible";
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM MainGUI
|
||||
// [handles all GUI events that interact with appearance of main window]
|
||||
|
||||
|
||||
OSRM.GUI.extend( {
|
||||
|
||||
// init GUI
|
||||
init: function() {
|
||||
// init main box
|
||||
var main_group = new OSRM.GUIBoxGroup();
|
||||
OSRM.G.main_handle = new OSRM.GUIBoxHandle("main", "left", "left:-5px;top:5px;", OSRM.GUI.beforeMainTransition, OSRM.GUI.afterMainTransition);
|
||||
main_group.add( OSRM.G.main_handle );
|
||||
main_group.select( OSRM.G.main_handle );
|
||||
|
||||
// init additional boxes
|
||||
var option_group = new OSRM.GUIBoxGroup();
|
||||
var config_handle = new OSRM.GUIBoxHandle("config", "right", "right:-5px;bottom:70px;");
|
||||
var mapping_handle = new OSRM.GUIBoxHandle("mapping", "right", "right:-5px;bottom:25px;");
|
||||
option_group.add( config_handle );
|
||||
option_group.add( mapping_handle );
|
||||
option_group.select( null );
|
||||
|
||||
// init starting source/target
|
||||
document.getElementById('gui-input-source').value = OSRM.DEFAULTS.ONLOAD_SOURCE;
|
||||
document.getElementById('gui-input-target').value = OSRM.DEFAULTS.ONLOAD_TARGET;
|
||||
|
||||
// init units selector
|
||||
OSRM.GUI.selectorInit( "gui-units-toggle", [{display:"Kilometers",value:0},{display:"Miles",value:1}], 0, OSRM.GUI.onUnitsChanged );
|
||||
|
||||
// query last update of data
|
||||
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');
|
||||
},
|
||||
|
||||
// set language dependent labels
|
||||
setLabels: function() {
|
||||
document.getElementById("open-josm").innerHTML = OSRM.loc("OPEN_JOSM");
|
||||
document.getElementById("open-osmbugs").innerHTML = OSRM.loc("OPEN_OSMBUGS");
|
||||
document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET");
|
||||
document.getElementById("gui-zoom").innerHTML = OSRM.loc("GUI_ZOOM");
|
||||
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-show-previous-routes-label").innerHTML = OSRM.loc("GUI_SHOW_PREVIOUS_ROUTES");
|
||||
document.getElementById("gui-search-source").innerHTML = OSRM.loc("GUI_SEARCH");
|
||||
document.getElementById("gui-search-target").innerHTML = OSRM.loc("GUI_SEARCH");
|
||||
document.getElementById("gui-search-source-label").innerHTML = OSRM.loc("GUI_START")+":";
|
||||
document.getElementById("gui-search-target-label").innerHTML = OSRM.loc("GUI_END")+":";
|
||||
document.getElementById("gui-input-source").title = OSRM.loc("GUI_START_TOOLTIP");
|
||||
document.getElementById("gui-input-target").title = OSRM.loc("GUI_END_TOOLTIP");
|
||||
document.getElementById("legal-notice").innerHTML = OSRM.loc("GUI_LEGAL_NOTICE");
|
||||
document.getElementById("gui-mapping-label").innerHTML = OSRM.loc("GUI_MAPPING_TOOLS");
|
||||
document.getElementById("gui-config-label").innerHTML = OSRM.loc("GUI_CONFIGURATION");
|
||||
document.getElementById("gui-language-2-label").innerHTML = OSRM.loc("GUI_LANGUAGE")+":";
|
||||
document.getElementById("gui-units-label").innerHTML = OSRM.loc("GUI_UNITS")+":";
|
||||
document.getElementById('gui-data-timestamp').innerHTML = OSRM.loc("GUI_DATA_TIMESTAMP")+": " + OSRM.G.data_timestamp;
|
||||
|
||||
document.getElementById("gui-units-toggle").getElementsByTagName("option")[0].innerHTML = OSRM.loc("GUI_KILOMETERS");
|
||||
document.getElementById("gui-units-toggle").getElementsByTagName("option")[1].innerHTML = OSRM.loc("GUI_MILES");
|
||||
OSRM.GUI.selectorOnChange( document.getElementById("gui-units-toggle") );
|
||||
},
|
||||
|
||||
// clear output area
|
||||
clearResults: function() {
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
},
|
||||
|
||||
// reposition and hide zoom controls before main box animation
|
||||
beforeMainTransition: function() {
|
||||
var zoom_controls = OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom');
|
||||
if( zoom_controls.length > 0)
|
||||
zoom_controls[0].style.visibility="hidden";
|
||||
},
|
||||
|
||||
// show zoom controls after main box animation
|
||||
afterMainTransition: function() {
|
||||
var zoom_controls = OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom');
|
||||
if( zoom_controls.length > 0) {
|
||||
zoom_controls[0].style.left = ( OSRM.G.main_handle.boxVisible() == true ? (OSRM.G.main_handle.boxWidth()+10) : "30") + "px";
|
||||
zoom_controls[0].style.visibility="visible";
|
||||
}
|
||||
},
|
||||
|
||||
// toggle distance units
|
||||
onUnitsChanged: function(value) {
|
||||
OSRM.Utils.setToHumanDistanceFunction(value);
|
||||
OSRM.Routing.getRoute({keepAlternative:true});
|
||||
},
|
||||
|
||||
// set timestamp of data
|
||||
setDataTimestamp: function(response) {
|
||||
if(!response)
|
||||
return;
|
||||
|
||||
OSRM.G.data_timestamp = response.timestamp.slice(0,25).replace(/<\/?[^>]+(>|$)/g ,""); // discard tags
|
||||
document.getElementById('gui-data-timestamp').innerHTML = OSRM.loc("GUI_DATA_TIMESTAMP")+": " + OSRM.G.data_timestamp;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM Notifications
|
||||
// [handles notifications: timed tooltips and exclusive notifications]
|
||||
|
||||
|
||||
OSRM.GUI.extend( {
|
||||
|
||||
// tooltips
|
||||
tooltips: {
|
||||
// triggered in OSRM.Localization.setLanguageWrapper
|
||||
localization:
|
||||
{ timeout: 180000, // 30min
|
||||
header: "Did you know? You can change the display language.",
|
||||
body: "You can use the pulldown menu in the upper left corner to select your favorite language. " +
|
||||
"<br/><br/>" +
|
||||
"Don't despair if you cannot find your language of choice. " +
|
||||
"If you want, you can help to provide additional translations! " +
|
||||
"Visit <a href='https://github.com/DennisSchiefer/Project-OSRM-Web'>here</a> for more information."
|
||||
},
|
||||
// triggered in OSRM.Map.click
|
||||
clicking:
|
||||
{ timeout: 60000, // 1min
|
||||
header: "Did you know? You can click on the map to set route markers.",
|
||||
body: "You can click on the map with the left mouse button to set a source marker (green) or a target marker (red), " +
|
||||
"if the source marker already exists. " +
|
||||
"The address of the selected location will be displayed in the boxes to the left. " +
|
||||
"<br/><br/>" +
|
||||
"You can delete a marker by clicking on it again with the left mouse button."
|
||||
},
|
||||
// triggered in OSRM.Routing.getRoute_Dragging
|
||||
dragging:
|
||||
{ timeout: 120000, // 2min
|
||||
header: "Did you know? You can drag each route marker on the map.",
|
||||
body: "You can drag a marker by clicking on it with the left mouse button and holding the button pressed. " +
|
||||
"Then you can move the marker around the map and the route will be updated instantaneously. " +
|
||||
"<br/><br/>" +
|
||||
"You can even create intermediate markers by dragging them off of the main route! "
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// initialize notifications and tooltip timers
|
||||
init: function() {
|
||||
// notifications
|
||||
// [nothing to be done at the moment]
|
||||
|
||||
// tooltip timers
|
||||
var tooltips = OSRM.GUI.tooltips;
|
||||
for( id in tooltips ) {
|
||||
// start timer
|
||||
tooltips[id]._timer = setTimeout(
|
||||
function(_id){ return function(){OSRM.GUI._showTooltip(_id);}; }(id),
|
||||
tooltips[id].timeout
|
||||
);
|
||||
|
||||
// mark tooltip as pending
|
||||
tooltips[id]._pending = true;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// deactivate pending tooltip
|
||||
deactivateTooltip: function(id) {
|
||||
var tooltips = OSRM.GUI.tooltips;
|
||||
if(tooltips[id] == undefined)
|
||||
return;
|
||||
|
||||
// mark tooltip as no longer pending
|
||||
tooltips[id]._pending = false;
|
||||
},
|
||||
// show tooltip after timer expired
|
||||
_showTooltip: function(id) {
|
||||
var tooltips = OSRM.GUI.tooltips;
|
||||
if(tooltips[id] == undefined)
|
||||
return;
|
||||
|
||||
// only show tooltip if it is still pending
|
||||
if( tooltips[id]._pending == false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if a notification is currently shown, restart timer
|
||||
if( OSRM.GUI.isTooltipVisible() ) {
|
||||
tooltips[id]._timer = setTimeout(
|
||||
function(_id){ return function(){OSRM.GUI._showTooltip(_id);}; }(id),
|
||||
tooltips[id].timeout
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// show notification
|
||||
OSRM.GUI.tooltipNotify( tooltips[id].header, tooltips[id].body );
|
||||
|
||||
// mark tooltip as no longer pending
|
||||
tooltips[id]._pending = false;
|
||||
},
|
||||
|
||||
|
||||
// exclusive notification
|
||||
exclusiveNotify: function( header, text, closable ){
|
||||
document.getElementById('exclusive-notification-blanket').style.display = "block";
|
||||
document.getElementById('exclusive-notification-label').innerHTML = header;
|
||||
document.getElementById('exclusive-notification-box').innerHTML = text;
|
||||
if( closable )
|
||||
document.getElementById('exclusive-notification-toggle').onclick = OSRM.GUI.exclusiveDenotify;
|
||||
else
|
||||
document.getElementById('exclusive-notification-toggle').style.display = "none";
|
||||
},
|
||||
exclusiveDenotify: function() {
|
||||
document.getElementById('exclusive-notification-blanket').style.display = "none";
|
||||
},
|
||||
|
||||
|
||||
// tooltip notification
|
||||
tooltipNotify: function( header, text ){
|
||||
document.getElementById('tooltip-notification-wrapper').style.display = "block";
|
||||
document.getElementById('tooltip-notification-label').innerHTML = header;
|
||||
document.getElementById('tooltip-notification-box').innerHTML = text;
|
||||
document.getElementById('tooltip-notification-box').style.display = "block"; // simple trick to always start with a minimized tooltip
|
||||
OSRM.GUI.tooltipResize();
|
||||
|
||||
document.getElementById('tooltip-notification-toggle').onclick = OSRM.GUI.tooltipDenotify;
|
||||
document.getElementById('tooltip-notification-resize').onclick = OSRM.GUI.tooltipResize;
|
||||
},
|
||||
tooltipResize: function() {
|
||||
if( document.getElementById('tooltip-notification-box').style.display == "none" ) {
|
||||
document.getElementById('tooltip-notification-box').style.display = "block";
|
||||
var height = document.getElementById('tooltip-notification-box').clientHeight;
|
||||
document.getElementById('tooltip-notification-content').style.height = (height + 28) + "px";
|
||||
document.getElementById('tooltip-notification-wrapper').style.height = (height + 48) + "px";
|
||||
document.getElementById('tooltip-notification-resize').className = "iconic-button up-marker top-right-button";
|
||||
} else {
|
||||
document.getElementById('tooltip-notification-box').style.display = "none";
|
||||
document.getElementById('tooltip-notification-content').style.height = "18px";
|
||||
document.getElementById('tooltip-notification-wrapper').style.height = "38px";
|
||||
document.getElementById('tooltip-notification-resize').className = "iconic-button down-marker top-right-button";
|
||||
}
|
||||
},
|
||||
tooltipDenotify: function() {
|
||||
document.getElementById('tooltip-notification-wrapper').style.display = "none";
|
||||
},
|
||||
isTooltipVisible: function() {
|
||||
return document.getElementById('tooltip-notification-wrapper').style.display == "block";
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM RoutingGUI
|
||||
// [handles all GUI events that interact with routing in main window]
|
||||
|
||||
|
||||
OSRM.GUI.extend( {
|
||||
|
||||
// init
|
||||
init: function() {
|
||||
// init variables
|
||||
OSRM.Utils.setToHumanDistanceFunction(OSRM.DEFAULTS.DISTANCE_FORMAT);
|
||||
|
||||
// init events
|
||||
document.getElementById("gui-input-source").onchange = function() {OSRM.GUI.inputChanged(OSRM.C.SOURCE_LABEL);};
|
||||
document.getElementById("gui-delete-source").onclick = function() {OSRM.GUI.deleteMarker(OSRM.C.SOURCE_LABEL);};
|
||||
document.getElementById("gui-search-source").onclick = function() {OSRM.GUI.showMarker(OSRM.C.SOURCE_LABEL);};
|
||||
|
||||
document.getElementById("gui-input-target").onchange = function() {OSRM.GUI.inputChanged(OSRM.C.TARGET_LABEL);};
|
||||
document.getElementById("gui-delete-target").onclick = function() {OSRM.GUI.deleteMarker(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-zoom").onclick = OSRM.GUI.zoomOnRoute;
|
||||
document.getElementById("gui-reverse").onclick = OSRM.GUI.reverseRouting;
|
||||
document.getElementById("open-josm").onclick = OSRM.GUI.openJOSM;
|
||||
document.getElementById("open-osmbugs").onclick = OSRM.GUI.openOSMBugs;
|
||||
document.getElementById("option-highlight-nonames").onclick = OSRM.GUI.hightlightNonames;
|
||||
document.getElementById("option-show-previous-routes").onclick = OSRM.GUI.showPreviousRoutes;
|
||||
},
|
||||
|
||||
// toggle GUI features that need a route to work
|
||||
activateRouteFeatures: function() {
|
||||
OSRM.Printing.activate();
|
||||
document.getElementById("gui-zoom").className = "button";
|
||||
},
|
||||
deactivateRouteFeatures: function() {
|
||||
OSRM.Printing.deactivate();
|
||||
document.getElementById("gui-zoom").className = "button-inactive";
|
||||
},
|
||||
|
||||
// click: button "reset"
|
||||
resetRouting: function() {
|
||||
document.getElementById('gui-input-source').value = "";
|
||||
document.getElementById('gui-input-target').value = "";
|
||||
|
||||
OSRM.G.route.reset();
|
||||
OSRM.G.markers.reset();
|
||||
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
|
||||
OSRM.JSONP.reset();
|
||||
},
|
||||
|
||||
// click: button "reverse"
|
||||
reverseRouting: function() {
|
||||
// invert input boxes
|
||||
var tmp = document.getElementById("gui-input-source").value;
|
||||
document.getElementById("gui-input-source").value = document.getElementById("gui-input-target").value;
|
||||
document.getElementById("gui-input-target").value = tmp;
|
||||
|
||||
// recompute route if needed
|
||||
if( OSRM.G.route.isShown() ) {
|
||||
OSRM.G.markers.route.reverse();
|
||||
OSRM.Routing.getRoute_Reversed(); // temporary route reversal for query, actual reversal done after receiving response
|
||||
OSRM.G.markers.route.reverse();
|
||||
OSRM.G.markers.highlight.hide();
|
||||
OSRM.RoutingDescription.showSimple( OSRM.G.response );
|
||||
|
||||
// simply reverse markers
|
||||
} else {
|
||||
OSRM.G.markers.reverseMarkers();
|
||||
}
|
||||
},
|
||||
|
||||
// click: button "show"
|
||||
showMarker: function(marker_id) {
|
||||
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() )
|
||||
OSRM.G.markers.route[0].centerView();
|
||||
else if( marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() )
|
||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].centerView();
|
||||
},
|
||||
|
||||
// changed: any inputbox (is called when enter is pressed [after] or focus is lost [before])
|
||||
inputChanged: function(marker_id) {
|
||||
if( marker_id == OSRM.C.SOURCE_LABEL)
|
||||
OSRM.Geocoder.call(OSRM.C.SOURCE_LABEL, document.getElementById('gui-input-source').value);
|
||||
else if( marker_id == OSRM.C.TARGET_LABEL)
|
||||
OSRM.Geocoder.call(OSRM.C.TARGET_LABEL, document.getElementById('gui-input-target').value);
|
||||
},
|
||||
|
||||
// click: button "open JOSM"
|
||||
openJOSM: function() {
|
||||
var center = OSRM.G.map.getCenterUI();
|
||||
var bounds = OSRM.G.map.getBoundsUI();
|
||||
|
||||
var xdelta = Math.min(0.02, Math.abs(bounds.getSouthWest().lng - center.lng) );
|
||||
var ydelta = Math.min(0.01, Math.abs(bounds.getSouthWest().lat - center.lat) );
|
||||
|
||||
var p = [ 'left=' + (center.lng - xdelta).toFixed(6), 'bottom=' + (center.lat - ydelta).toFixed(6), 'right=' + (center.lng + xdelta).toFixed(6), 'top=' + (center.lat + ydelta).toFixed(6)];
|
||||
var url = 'http://127.0.0.1:8111/load_and_zoom?' + p.join('&');
|
||||
|
||||
var frame = document.getElementById('josm-frame');
|
||||
if(!frame) {
|
||||
frame = L.DomUtil.create('iframe', null, document.body);
|
||||
frame.style.display = "none";
|
||||
frame.id = 'josm-frame';
|
||||
}
|
||||
frame.src = url;
|
||||
},
|
||||
|
||||
//click: button "open OSM Bugs"
|
||||
openOSMBugs: function() {
|
||||
var position = OSRM.G.map.getCenterUI();
|
||||
window.open( "http://osmbugs.org/?lat="+position.lat.toFixed(6)+"&lon="+position.lng.toFixed(6)+"&zoom="+OSRM.G.map.getZoom() );
|
||||
},
|
||||
|
||||
//click: button "delete marker"
|
||||
deleteMarker: function(marker_id) {
|
||||
var id = null;
|
||||
if(marker_id == 'source' && OSRM.G.markers.hasSource() )
|
||||
id = 0;
|
||||
else if(marker_id == 'target' && OSRM.G.markers.hasTarget() )
|
||||
id = OSRM.G.markers.route.length-1;
|
||||
if( id == null)
|
||||
return;
|
||||
|
||||
OSRM.G.markers.removeMarker( id );
|
||||
OSRM.Routing.getRoute();
|
||||
OSRM.G.markers.highlight.hide();
|
||||
},
|
||||
|
||||
//click: checkbox "show previous routes"
|
||||
showPreviousRoutes: function(value) {
|
||||
if( document.getElementById('option-show-previous-routes').checked == false)
|
||||
OSRM.G.route.deactivateHistoryRoutes();
|
||||
else
|
||||
OSRM.G.route.activateHistoryRoutes();
|
||||
},
|
||||
|
||||
//click: button "zoom on route"
|
||||
zoomOnRoute: function() {
|
||||
if( OSRM.G.route.isShown() == false )
|
||||
return;
|
||||
|
||||
var bounds = new L.LatLngBounds( OSRM.G.route._current_route.getPositions() );
|
||||
OSRM.G.map.fitBoundsUI(bounds);
|
||||
},
|
||||
|
||||
//click: toggle highlighting unnamed streets
|
||||
hightlightNonames: function() {
|
||||
OSRM.Routing.getRoute_Redraw({keepAlternative:true});
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM selector
|
||||
// [create special selector elements]
|
||||
|
||||
|
||||
OSRM.GUI.extend( {
|
||||
|
||||
// initialize selector with all options and our look&feel
|
||||
selectorInit: function(id, options, selected, onchange_fct) {
|
||||
// create dropdown menu
|
||||
var select = document.getElementById(id);
|
||||
select.className += " styled-select-helper base-font";
|
||||
select.onchange = function() { OSRM.GUI.selectorOnChange(this); onchange_fct(this.value); };
|
||||
|
||||
// fill dropdown menu
|
||||
for(var i=0, size=options.length; i<size; i++) {
|
||||
var option=document.createElement("option");
|
||||
option.innerHTML = options[i].display;
|
||||
option.value = options[i].value;
|
||||
select.appendChild(option);
|
||||
}
|
||||
select.value = options[selected].value;
|
||||
|
||||
// create visible dropdown menu
|
||||
var textnode = document.createTextNode( options[selected].display );
|
||||
var myspan = document.createElement("span");
|
||||
myspan.className = "styled-select base-font";
|
||||
myspan.id = "styled-select-" + select.id;
|
||||
myspan.appendChild(textnode);
|
||||
select.parentNode.insertBefore(myspan, select);
|
||||
myspan.style.width = (select.offsetWidth-2)+"px";
|
||||
myspan.style.height = (select.offsetHeight)+"px"; // clientHeight gives the height of the opened dropbox!
|
||||
},
|
||||
|
||||
// required behaviour of selector on change to switch shown name
|
||||
selectorOnChange: function(select) {
|
||||
var option = select.getElementsByTagName("option");
|
||||
for(var i = 0; i < option.length; i++)
|
||||
if(option[i].selected == true) {
|
||||
document.getElementById("styled-select-" + select.id).childNodes[0].nodeValue = option[i].childNodes[0].nodeValue;
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
// change selector value
|
||||
selectorChange: function(select, value) {
|
||||
select.value = value;
|
||||
OSRM.GUI.selectorOnChange(select);
|
||||
}
|
||||
|
||||
});
|
||||
|
After Width: | Height: | Size: 397 B |
|
After Width: | Height: | Size: 493 B |
|
After Width: | Height: | Size: 482 B |
|
Before Width: | Height: | Size: 414 B After Width: | Height: | Size: 707 B |
|
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 221 B |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 329 B |
|
After Width: | Height: | Size: 378 B |
|
After Width: | Height: | Size: 347 B |
|
Before Width: | Height: | Size: 716 B |
|
Before Width: | Height: | Size: 617 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 530 B After Width: | Height: | Size: 955 B |
|
Before Width: | Height: | Size: 746 B After Width: | Height: | Size: 973 B |
|
Before Width: | Height: | Size: 635 B After Width: | Height: | Size: 823 B |
|
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 834 B |
|
Before Width: | Height: | Size: 489 B After Width: | Height: | Size: 861 B |
|
Before Width: | Height: | Size: 676 B After Width: | Height: | Size: 897 B |
|
Before Width: | Height: | Size: 656 B After Width: | Height: | Size: 937 B |
|
Before Width: | Height: | Size: 778 B After Width: | Height: | Size: 1018 B |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
@@ -4912,7 +4912,7 @@ L.Control.Attribution = L.Class.extend({
|
||||
var attribs = [];
|
||||
|
||||
for (var i in this._attributions) {
|
||||
if (this._attributions.hasOwnProperty(i)) {
|
||||
if (this._attributions.hasOwnProperty(i) && this._attributions[i]) { // DS_CHANGE: fix for attribution bug (also changed in leaflet.js!)
|
||||
attribs.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,19 +20,31 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
|
||||
|
||||
OSRM.Localization["de"] = {
|
||||
// own language
|
||||
"LANGUAGE": "Deutsch",
|
||||
//gui
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
"GUI_START": "Start",
|
||||
"GUI_END": "Ziel",
|
||||
"GUI_RESET": "Reset",
|
||||
"GUI_ZOOM": "Zoom auf Route",
|
||||
"GUI_SEARCH": "Zeigen",
|
||||
"GUI_REVERSE": "Umdrehen",
|
||||
"GUI_OPTIONS": "Kartenwerkzeuge",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Unbenannte Straßen hervorheben",
|
||||
"GUI_START_TOOLTIP": "Startposition eingeben",
|
||||
"GUI_END_TOOLTIP": "Zielposition eingeben",
|
||||
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting by <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder by <a href='http://www.osm.org/'>OSM</a>",
|
||||
//config
|
||||
"GUI_CONFIGURATION": "Einstellungen",
|
||||
"GUI_LANGUAGE": "Sprache",
|
||||
"GUI_UNITS": "Einheiten",
|
||||
"GUI_KILOMETERS": "Kilometer",
|
||||
"GUI_MILES": "Meilen",
|
||||
"GUI_DATA_TIMESTAMP": "data",
|
||||
// mapping
|
||||
"GUI_MAPPING_TOOLS": "Kartenwerkzeuge",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Unbenannte Straßen hervorheben",
|
||||
"GUI_SHOW_PREVIOUS_ROUTES": "Frühere Routen zeigen",
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Suchergebnisse",
|
||||
"FOUND_X_RESULTS": "%i Ergebnisse gefunden",
|
||||
@@ -50,6 +62,9 @@ OSRM.Localization["de"] = {
|
||||
"DURATION": "Dauer",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Ihre Route wird berechnet",
|
||||
"NO_ROUTE_FOUND": "Keine Route hierher möglich",
|
||||
// printing
|
||||
"OVERVIEW_MAP": "Übersichtskarte",
|
||||
"NO_ROUTE_SELECTED": "Keine Route ausgewählt",
|
||||
// directions
|
||||
"N": "Norden",
|
||||
"E": "Ost",
|
||||
@@ -61,6 +76,7 @@ OSRM.Localization["de"] = {
|
||||
"NW": "Nordwest",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// %d: direction
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Unbekannte Anweisung[ auf <b>%s</b>]",
|
||||
"DIRECTION_1":"Geradeaus weiterfahren[ auf <b>%s</b>]",
|
||||
@@ -68,10 +84,10 @@ OSRM.Localization["de"] = {
|
||||
"DIRECTION_3":"Rechts abbiegen[ auf <b>%s</b>]",
|
||||
"DIRECTION_4":"Scharf rechts abbiegen[ auf <b>%s</b>]",
|
||||
"DIRECTION_5":"Wenden[ auf <b>%s</b>]",
|
||||
"DIRECTION_6":"Leicht links abbiegen[ auf <b>%s</b>]",
|
||||
"DIRECTION_6":"Scharf links abbiegen[ auf <b>%s</b>]",
|
||||
"DIRECTION_7":"Links abbiegen[ auf <b>%s</b>]",
|
||||
"DIRECTION_8":"Scharf links abbiegen[ auf <b>%s</b>]",
|
||||
"DIRECTION_10":"Fahren Sie Richtung <b>%s</b>",
|
||||
"DIRECTION_8":"Leicht links abbiegen[ auf <b>%s</b>]",
|
||||
"DIRECTION_10":"Fahren Sie Richtung <b>%d</b>[ auf <b>%s</b>]",
|
||||
"DIRECTION_11-1":"In den Kreisverkehr einfahren und bei erster Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-2":"In den Kreisverkehr einfahren und bei zweiter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-3":"In den Kreisverkehr einfahren und bei dritter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
@@ -87,4 +103,4 @@ OSRM.Localization["de"] = {
|
||||
|
||||
// set GUI language on load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING==true )
|
||||
OSRM.Localization.setLanguage("de");
|
||||
OSRM.Localization.setLanguage("de");
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM localization
|
||||
// [Danish language support]
|
||||
|
||||
|
||||
OSRM.Localization["dk"] = {
|
||||
// own language
|
||||
"LANGUAGE": "Dansk",
|
||||
//gui
|
||||
"GUI_START": "Start",
|
||||
"GUI_END": "Destination",
|
||||
"GUI_RESET": "Nulstil",
|
||||
"GUI_ZOOM": "Zoom på Rute",
|
||||
"GUI_SEARCH": "Vis",
|
||||
"GUI_REVERSE": "Omvendt",
|
||||
"GUI_START_TOOLTIP": "Indtast start",
|
||||
"GUI_END_TOOLTIP": "Indtast destination",
|
||||
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting af <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder af <a href='http://www.osm.org/'>OSM</a>",
|
||||
//config
|
||||
"GUI_CONFIGURATION": "Konfiguration",
|
||||
"GUI_LANGUAGE": "Sprog",
|
||||
"GUI_UNITS": "Enheder",
|
||||
"GUI_KILOMETERS": "Kilometer",
|
||||
"GUI_MILES": "Miles",
|
||||
"GUI_DATA_TIMESTAMP": "data",
|
||||
// mapping
|
||||
"GUI_MAPPING_TOOLS": "Kortlægnings værktøjer",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Fremhæv unavngivne veje",
|
||||
"GUI_SHOW_PREVIOUS_ROUTES": "Vis tidligere ruter",
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Søgeresultater",
|
||||
"FOUND_X_RESULTS": "fandt %i resultater",
|
||||
"TIMED_OUT": "Indtet svar",
|
||||
"NO_RESULTS_FOUND": "Ingen resultater",
|
||||
"NO_RESULTS_FOUND_SOURCE": "Ingen resultater for start",
|
||||
"NO_RESULTS_FOUND_TARGET": "Ingen resultater for destination",
|
||||
//routing
|
||||
"ROUTE_DESCRIPTION": "Rutebeskrivelse",
|
||||
"GET_LINK_TO_ROUTE": "Lav link",
|
||||
"GENERATE_LINK_TO_ROUTE": "venter på link",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "ikke tilgængelig",
|
||||
"GPX_FILE": "GPX Fil",
|
||||
"DISTANCE": "Distance",
|
||||
"DURATION": "Varighed",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Din rute bliver beregnet",
|
||||
"NO_ROUTE_FOUND": "Ingen mulig rute fundet",
|
||||
//printing
|
||||
"OVERVIEW_MAP": "Oversigtskort",
|
||||
"NO_ROUTE_SELECTED": "Ikke valgte rute",
|
||||
// directions
|
||||
"N": "nord",
|
||||
"E": "øst",
|
||||
"S": "syd",
|
||||
"W": "vest",
|
||||
"NE": "nordøst",
|
||||
"SE": "sydøst",
|
||||
"SW": "sydvest",
|
||||
"NW": "nordvest",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// %d: direction
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Unknown instruction[ on <b>%s</b>]",
|
||||
"DIRECTION_1":"Fortsæt [ ad <b>%s</b>]",
|
||||
"DIRECTION_2":"Drej svagt til højre [ ad <b>%s</b>]",
|
||||
"DIRECTION_3":"Drej til højre[ ad <b>%s</b>]",
|
||||
"DIRECTION_4":"Drej skarpt til højre[ ad <b>%s</b>]",
|
||||
"DIRECTION_5":"U-vending[ ad <b>%s</b>]",
|
||||
"DIRECTION_6":"Drej skarpt til venstre[ ad <b>%s</b>]",
|
||||
"DIRECTION_7":"Drej til venstre[ ad <b>%s</b>]",
|
||||
"DIRECTION_8":"Drej svagt til venstre[ ad <b>%s</b>]",
|
||||
"DIRECTION_10":"Kør mod <b>%d</b>[ ad <b>%s</b>]",
|
||||
"DIRECTION_11-1":"Kør ind i rundkørslen og tag første udkørsel[ ad <b>%s</b>]",
|
||||
"DIRECTION_11-2":"Kør ind i rundkørslen og tag anden udkørsel[ ad <b>%s</b>]",
|
||||
"DIRECTION_11-3":"Kør ind i rundkørslen og tag tredje udkørsel[ ad <b>%s</b>]",
|
||||
"DIRECTION_11-4":"Kør ind i rundkørslen og tag fjerde udkørsel[ ad <b>%s</b>]",
|
||||
"DIRECTION_11-5":"Kør ind i rundkørslen og tag femte udkørsel[ ad <b>%s</b>]",
|
||||
"DIRECTION_11-6":"Kør ind i rundkørslen og tag sjette udkørsel[ ad <b>%s</b>]",
|
||||
"DIRECTION_11-7":"Kør ind i rundkørslen og tag syvende udkørsel[ ad <b>%s</b>]",
|
||||
"DIRECTION_11-8":"Kør ind i rundkørslen og tag ottende udkørsel[ ad <b>%s</b>]",
|
||||
"DIRECTION_11-9":"Kør ind i rundkørslen og tag niende udkørsel[ ad <b>%s</b>]",
|
||||
"DIRECTION_11-x":"Kør ind i rundkørslen og tag en af de alt for mange udkørsler[ ad <b>%s</b>]",
|
||||
"DIRECTION_15":"Du er ankommet til din destination"
|
||||
};
|
||||
|
||||
//set GUI language on load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true )
|
||||
OSRM.Localization.setLanguage("dk");
|
||||
@@ -20,19 +20,31 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
|
||||
|
||||
OSRM.Localization["en"] = {
|
||||
//gui
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
// own language
|
||||
"LANGUAGE": "English",
|
||||
// gui
|
||||
"GUI_START": "Start",
|
||||
"GUI_END": "End",
|
||||
"GUI_RESET": " Reset ",
|
||||
"GUI_ZOOM": "Zoom onto Route",
|
||||
"GUI_SEARCH": " Show ",
|
||||
"GUI_REVERSE": "Reverse",
|
||||
"GUI_OPTIONS": "Mapping Tools",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Highlight unnamed streets",
|
||||
"GUI_START_TOOLTIP": "Enter start",
|
||||
"GUI_END_TOOLTIP": "Enter destination",
|
||||
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting by <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder by <a href='http://www.osm.org/'>OSM</a>",
|
||||
// config
|
||||
"GUI_CONFIGURATION": "Configuration",
|
||||
"GUI_LANGUAGE": "Language",
|
||||
"GUI_UNITS": "Units",
|
||||
"GUI_KILOMETERS": "Kilometers",
|
||||
"GUI_MILES": "Miles",
|
||||
"GUI_DATA_TIMESTAMP": "data",
|
||||
// mapping
|
||||
"GUI_MAPPING_TOOLS": "Mapping Tools",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Highlight unnamed streets",
|
||||
"GUI_SHOW_PREVIOUS_ROUTES": "Show previous routes",
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Search Results",
|
||||
"FOUND_X_RESULTS": "found %i results",
|
||||
@@ -40,7 +52,7 @@ OSRM.Localization["en"] = {
|
||||
"NO_RESULTS_FOUND": "No results found",
|
||||
"NO_RESULTS_FOUND_SOURCE": "No results found for start",
|
||||
"NO_RESULTS_FOUND_TARGET": "No results found for end",
|
||||
//routing
|
||||
// routing
|
||||
"ROUTE_DESCRIPTION": "Route Description",
|
||||
"GET_LINK_TO_ROUTE": "Generate Link",
|
||||
"GENERATE_LINK_TO_ROUTE": "waiting for link",
|
||||
@@ -50,6 +62,9 @@ OSRM.Localization["en"] = {
|
||||
"DURATION": "Duration",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Your route is being computed",
|
||||
"NO_ROUTE_FOUND": "No route possible",
|
||||
// printing
|
||||
"OVERVIEW_MAP": "Overview Map",
|
||||
"NO_ROUTE_SELECTED": "No route selected",
|
||||
// directions
|
||||
"N": "north",
|
||||
"E": "east",
|
||||
@@ -61,30 +76,31 @@ OSRM.Localization["en"] = {
|
||||
"NW": "northwest",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// %d: direction
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Unknown instruction[ on <b>%s</b>]",
|
||||
"DIRECTION_1":"Continue[ on <b>%s</b>]",
|
||||
"DIRECTION_2":"Turn slight right[ on <b>%s</b>]",
|
||||
"DIRECTION_3":"Turn right[ on <b>%s</b>]",
|
||||
"DIRECTION_4":"Turn sharp right[ on <b>%s</b>]",
|
||||
"DIRECTION_5":"U-Turn[ on <b>%s</b>]",
|
||||
"DIRECTION_6":"Turn slight left[ on <b>%s</b>]",
|
||||
"DIRECTION_7":"Turn left[ on <b>%s</b>]",
|
||||
"DIRECTION_8":"Turn sharp left[ on <b>%s</b>]",
|
||||
"DIRECTION_10":"Head <b>%s</b>",
|
||||
"DIRECTION_11-1":"Enter roundabout and leave at first exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-2":"Enter roundabout and leave at second exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-3":"Enter roundabout and leave at third exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-4":"Enter roundabout and leave at fourth exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-5":"Enter roundabout and leave at fifth exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-6":"Enter roundabout and leave at sixth exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-7":"Enter roundabout and leave at seventh exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-8":"Enter roundabout and leave at eighth exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-9":"Enter roundabout and leave at nineth exit[ on <b>%s</b>]",
|
||||
"DIRECTION_11-x":"Enter roundabout and leave at one of the too many exits[ on <b>%s</b>]",
|
||||
"DIRECTION_0":"Unknown instruction[ onto <b>%s</b>]",
|
||||
"DIRECTION_1":"Continue[ onto <b>%s</b>]",
|
||||
"DIRECTION_2":"Turn slight right[ onto <b>%s</b>]",
|
||||
"DIRECTION_3":"Turn right[ onto <b>%s</b>]",
|
||||
"DIRECTION_4":"Turn sharp right[ onto <b>%s</b>]",
|
||||
"DIRECTION_5":"U-Turn[ onto <b>%s</b>]",
|
||||
"DIRECTION_6":"Turn sharp left[ onto <b>%s</b>]",
|
||||
"DIRECTION_7":"Turn left[ onto <b>%s</b>]",
|
||||
"DIRECTION_8":"Turn slight left[ onto <b>%s</b>]",
|
||||
"DIRECTION_10":"Head <b>%d</b>[ onto <b>%s</b>]",
|
||||
"DIRECTION_11-1":"Enter roundabout and leave at first exit[ onto <b>%s</b>]",
|
||||
"DIRECTION_11-2":"Enter roundabout and leave at second exit[ onto <b>%s</b>]",
|
||||
"DIRECTION_11-3":"Enter roundabout and leave at third exit[ onto <b>%s</b>]",
|
||||
"DIRECTION_11-4":"Enter roundabout and leave at fourth exit[ onto <b>%s</b>]",
|
||||
"DIRECTION_11-5":"Enter roundabout and leave at fifth exit[ onto <b>%s</b>]",
|
||||
"DIRECTION_11-6":"Enter roundabout and leave at sixth exit[ onto <b>%s</b>]",
|
||||
"DIRECTION_11-7":"Enter roundabout and leave at seventh exit[ onto <b>%s</b>]",
|
||||
"DIRECTION_11-8":"Enter roundabout and leave at eighth exit[ onto <b>%s</b>]",
|
||||
"DIRECTION_11-9":"Enter roundabout and leave at nineth exit[ onto <b>%s</b>]",
|
||||
"DIRECTION_11-x":"Enter roundabout and leave at one of the too many exits[ onto <b>%s</b>]",
|
||||
"DIRECTION_15":"You have reached your destination"
|
||||
};
|
||||
|
||||
//set GUI language on load
|
||||
// set GUI language on load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true )
|
||||
OSRM.Localization.setLanguage("en");
|
||||
OSRM.Localization.setLanguage("en");
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM localization
|
||||
// [Spanish language support]
|
||||
|
||||
|
||||
OSRM.Localization["es"] = {
|
||||
// own language
|
||||
"LANGUAGE": "Español",
|
||||
// gui
|
||||
"GUI_START": "Inicio",
|
||||
"GUI_END": "Destino",
|
||||
"GUI_RESET": "Borrar",
|
||||
"GUI_ZOOM": "Zoom en la Ruta",
|
||||
"GUI_SEARCH": "Mostrar",
|
||||
"GUI_REVERSE": "Invertir",
|
||||
"GUI_START_TOOLTIP": "Escriba la dirección de origen",
|
||||
"GUI_END_TOOLTIP": "Escriba la dirección de destino",
|
||||
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM alojado en <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder gracias a <a href='http://www.osm.org/'>OSM</a>",
|
||||
// config
|
||||
"GUI_CONFIGURATION": "Configuración",
|
||||
"GUI_LANGUAGE": "Idioma",
|
||||
"GUI_UNITS": "Unidades",
|
||||
"GUI_KILOMETERS": "Kilometros",
|
||||
"GUI_MILES": "Millas",
|
||||
"GUI_DATA_TIMESTAMP": "datos",
|
||||
// mapping
|
||||
"GUI_MAPPING_TOOLS": "Herramientas del mapa",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Resaltar calles sin nombre",
|
||||
"GUI_SHOW_PREVIOUS_ROUTES": "Mostrar rutas anteriores",
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Resultados de la búsqueda",
|
||||
"FOUND_X_RESULTS": "%i resultado(s)",
|
||||
"TIMED_OUT": "Se superó el tiempo máximo de espera",
|
||||
"NO_RESULTS_FOUND": "No se han encontrado resultados",
|
||||
"NO_RESULTS_FOUND_SOURCE": "Ningún resultado para el inicio",
|
||||
"NO_RESULTS_FOUND_TARGET": "Ningún resultado para el destino",
|
||||
// routing
|
||||
"ROUTE_DESCRIPTION": "Descripción de la ruta",
|
||||
"GET_LINK_TO_ROUTE": "Generar enlace",
|
||||
"GENERATE_LINK_TO_ROUTE": "esperando el enlace",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "no disponible",
|
||||
"GPX_FILE": "Archivo GPX",
|
||||
"DISTANCE": "Distancia",
|
||||
"DURATION": "Duración",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Estamos calculando su ruta",
|
||||
"NO_ROUTE_FOUND": "No hay ninguna ruta posible",
|
||||
// printing
|
||||
"OVERVIEW_MAP": "Mapa de referencia",
|
||||
"NO_ROUTE_SELECTED": "Ninguna ruta seleccionada",
|
||||
// directions
|
||||
"N": "norte",
|
||||
"E": "este",
|
||||
"S": "sur",
|
||||
"W": "oeste",
|
||||
"NE": "noreste",
|
||||
"SE": "sureste",
|
||||
"SW": "suroeste",
|
||||
"NW": "noroeste",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// %d: direction
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Instrucción desconocida[ en <b>%s</b>]",
|
||||
"DIRECTION_1":"Continúe[ por <b>%s</b>]",
|
||||
"DIRECTION_2":"Gire ligeramente a la derecha[ hacia <b>%s</b>]",
|
||||
"DIRECTION_3":"Gire a la derecha [ hacia <b>%s</b>]",
|
||||
"DIRECTION_4":"Gire pronunciadamente a la derecha[ hacia <b>%s</b>]",
|
||||
"DIRECTION_5":"Realice un cambio de sentido[ en <b>%s</b>]",
|
||||
"DIRECTION_6":"Gire pronunciadamente a la izquierda[ hacia <b>%s</b>]",
|
||||
"DIRECTION_7":"Gire a la izquierda [ hacia <b>%s</b>]",
|
||||
"DIRECTION_8":"Gire ligeramente a la izquierda[ hacia <b>%s</b>]",
|
||||
"DIRECTION_10":"Diríjase hacia el <b>%d</b>[ por <b>%s</b>]",
|
||||
"DIRECTION_11-1":"En la rotonda, tome la primera salida[ en dirección <b>%s</b>]",
|
||||
"DIRECTION_11-2":"En la rotonda, tome la segunda salida[ en dirección <b>%s</b>]",
|
||||
"DIRECTION_11-3":"En la rotonda, tome la tercera salida[ en dirección <b>%s</b>]",
|
||||
"DIRECTION_11-4":"En la rotonda, tome la cuarta salida[ en dirección <b>%s</b>]",
|
||||
"DIRECTION_11-5":"En la rotonda, tome la quinta salida[ en dirección <b>%s</b>]",
|
||||
"DIRECTION_11-6":"En la rotonda, tome la sexta salida[ en dirección <b>%s</b>]",
|
||||
"DIRECTION_11-7":"En la rotonda, tome la séptima salida[ en dirección <b>%s</b>]",
|
||||
"DIRECTION_11-8":"En la rotonda, tome la octava salida[ en dirección <b>%s</b>]",
|
||||
"DIRECTION_11-9":"En la rotonda, tome la novena salida[ en dirección <b>%s</b>]",
|
||||
"DIRECTION_11-x":"En la rotonda, tome una de sus muchas salidas [ en dirección <b>%s</b>]",
|
||||
"DIRECTION_15":"Ha llegado a su destino"
|
||||
};
|
||||
|
||||
// set GUI language on load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true )
|
||||
OSRM.Localization.setLanguage("es");
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM localization
|
||||
// [Finnish language support]
|
||||
|
||||
|
||||
OSRM.Localization["fi"] = {
|
||||
// own language
|
||||
"LANGUAGE": "Suomi",
|
||||
//gui
|
||||
"GUI_START": "Lähtöpaikka",
|
||||
"GUI_END": "Määränpää",
|
||||
"GUI_RESET": "Tyhjennä",
|
||||
"GUI_ZOOM": "Zoom reitillä",
|
||||
"GUI_SEARCH": "Etsi",
|
||||
"GUI_REVERSE": "Käänteinen reitti",
|
||||
"GUI_START_TOOLTIP": "Syötä lähtöpaikka",
|
||||
"GUI_END_TOOLTIP": "Syötä määränpää",
|
||||
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting by <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder by <a href='http://www.osm.org/'>OSM</a>",
|
||||
//config
|
||||
"GUI_CONFIGURATION": "Kokoonpano",
|
||||
"GUI_LANGUAGE": "Kieli",
|
||||
"GUI_UNITS": "Yksiköt",
|
||||
"GUI_KILOMETERS": "Kilometri",
|
||||
"GUI_MILES": "Miles",
|
||||
"GUI_DATA_TIMESTAMP": "data",
|
||||
// mapping
|
||||
"GUI_MAPPING_TOOLS": "Kartoitustyökalut",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Korosta nimettömät tiet",
|
||||
"GUI_SHOW_PREVIOUS_ROUTES": "Näytä edelliset reitit",
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Haun tulokset",
|
||||
"FOUND_X_RESULTS": "Löytyi %i vaihtoehtoa",
|
||||
"TIMED_OUT": "Aikakatkaisu",
|
||||
"NO_RESULTS_FOUND": "Ei hakutuloksia",
|
||||
"NO_RESULTS_FOUND_SOURCE": "Ei hakutuloksia lähtöpaikka",
|
||||
"NO_RESULTS_FOUND_TARGET": "Ei hakutuloksia määränpäälle",
|
||||
//routing
|
||||
"ROUTE_DESCRIPTION": "Reittiohjeet",
|
||||
"GET_LINK_TO_ROUTE": "Luo linkki",
|
||||
"GENERATE_LINK_TO_ROUTE": "odotetaan linkkiä",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "ei saatavilla",
|
||||
"GPX_FILE": "GPX-tiedosto",
|
||||
"DISTANCE": "Etäisyys",
|
||||
"DURATION": "Aika",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Reittiä lasketaan",
|
||||
"NO_ROUTE_FOUND": "Reittiä ei löytynyt",
|
||||
//printing
|
||||
"OVERVIEW_MAP": "Yleiskuvakartta",
|
||||
"NO_ROUTE_SELECTED": "Ei reitti valittu",
|
||||
// directions
|
||||
"N": "pohjoiseen",
|
||||
"E": "itään",
|
||||
"S": "etelään",
|
||||
"W": "länteen",
|
||||
"NE": "koilliseen",
|
||||
"SE": "kaakkoon",
|
||||
"SW": "lounaaseen",
|
||||
"NW": "luoteeseen",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// %d: direction
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Tuntematon ohje[ tielle <b>%s</b>]",
|
||||
"DIRECTION_1":"Jatka[ tielle <b>%s</b>]",
|
||||
"DIRECTION_2":"Käänny loivasti oikealle[ tielle <b>%s</b>]",
|
||||
"DIRECTION_3":"Käänny oikealle[ tielle <b>%s</b>]",
|
||||
"DIRECTION_4":"Käänny jyrkästi oikealle[ tielle <b>%s</b>]",
|
||||
"DIRECTION_5":"Tee U-käännös[ tiellä <b>%s</b>]",
|
||||
"DIRECTION_6":"Käänny jyrkästi vasemmalle [ tielle <b>%s</b>]",
|
||||
"DIRECTION_7":"Käänny vasemmalle[ tielle <b>%s</b>]",
|
||||
"DIRECTION_8":"Käänny loivasti vasemmalle[ tielle <b>%s</b>]",
|
||||
"DIRECTION_10":"Aja <b>%d</b> [ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-1":"Aja liikenneympyrään ja poistu ensimmäisestä haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-2":"Aja liikenneympyrään ja poistu toisesta haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-3":"Aja liikenneympyrään ja poistu kolmannesta haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-4":"Aja liikenneympyrään ja poistu neljännestä haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-5":"Aja liikenneympyrään ja poistu viidennestä haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-6":"Aja liikenneympyrään ja poistu kuudennesta haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-7":"Aja liikenneympyrään ja poistu seitsemännestä haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-8":"Aja liikenneympyrään ja poistu kahdeksannesta haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-9":"Aja liikenneympyrään ja poistu yhdeksännestä haarasta[ tielle <b>%s</b>]",
|
||||
"DIRECTION_11-x":"Aja liikenneympyrään ja poistu monen haaran jälkeen[ tielle <b>%s</b>]",
|
||||
"DIRECTION_15":"Saavuit määränpäähän"
|
||||
};
|
||||
|
||||
//set GUI language tielle load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true )
|
||||
OSRM.Localization.setLanguage("fi");
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM localization
|
||||
// [French language support]
|
||||
|
||||
|
||||
OSRM.Localization["fr"] = {
|
||||
// own language
|
||||
"LANGUAGE": "Français",
|
||||
//gui
|
||||
"GUI_START": "Départ",
|
||||
"GUI_END": "Arrivée",
|
||||
"GUI_RESET": "Réinitialiser",
|
||||
"GUI_ZOOM": "Zoom sur la Route",
|
||||
"GUI_SEARCH": "Montrer",
|
||||
"GUI_REVERSE": "Inverser",
|
||||
"GUI_START_TOOLTIP": "Entrez le lieu de départ",
|
||||
"GUI_END_TOOLTIP": "Entrez le lieu d’arrivée",
|
||||
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - hébergement par <a href='http://algo2.iti.kit.edu/'>KIT</a> - géocodage par <a href='http://www.osm.org/'>OSM</a>",
|
||||
//config
|
||||
"GUI_CONFIGURATION": "Configuration",
|
||||
"GUI_LANGUAGE": "Langue",
|
||||
"GUI_UNITS": "Unités",
|
||||
"GUI_KILOMETERS": "Kilomètres",
|
||||
"GUI_MILES": "Miles",
|
||||
"GUI_DATA_TIMESTAMP": "data",
|
||||
// mapping
|
||||
"GUI_MAPPING_TOOLS": "Outils de cartographie",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Surligner les rues sans nom",
|
||||
"GUI_SHOW_PREVIOUS_ROUTES": "Afficher itinéraires précédents",
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Résultats de recherche",
|
||||
"FOUND_X_RESULTS": "%i résultat(s)",
|
||||
"TIMED_OUT": "La recherche n’a pas abouti",
|
||||
"NO_RESULTS_FOUND": "Aucun résultat trouvé",
|
||||
"NO_RESULTS_FOUND_SOURCE": "Aucun résultat pour le départ",
|
||||
"NO_RESULTS_FOUND_TARGET": "Aucun résultat pour l'arrivée",
|
||||
//routing
|
||||
"ROUTE_DESCRIPTION": "Description de l’itinéraire",
|
||||
"GET_LINK_TO_ROUTE": "Générer un lien",
|
||||
"GENERATE_LINK_TO_ROUTE": "en attente du lien",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "indisponible",
|
||||
"GPX_FILE": "Fichier GPX",
|
||||
"DISTANCE": "Distance",
|
||||
"DURATION": "Durée",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Votre itinéraire est en cours de calcul",
|
||||
"NO_ROUTE_FOUND": "Pas d’itinéraire possible",
|
||||
//printing
|
||||
"OVERVIEW_MAP": "Carte",
|
||||
"NO_ROUTE_SELECTED": "Pas d’itinéraire choisi",
|
||||
// directions
|
||||
"N": "nord",
|
||||
"E": "est",
|
||||
"S": "sud",
|
||||
"W": "ouest",
|
||||
"NE": "nord-est",
|
||||
"SE": "sud-est",
|
||||
"SW": "sud-ouest",
|
||||
"NW": "nord-ouest",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Instruction inconnue[ sur <b>%s</b>]",
|
||||
"DIRECTION_1":"Continuez[ sur <b>%s</b>]",
|
||||
"DIRECTION_2":"Tournez légèrement à droite[ sur <b>%s</b>]",
|
||||
"DIRECTION_3":"Tournez à droite[ sur <b>%s</b>]",
|
||||
"DIRECTION_4":"Tournez fortement à droite[ sur <b>%s</b>]",
|
||||
"DIRECTION_5":"Faites demi-tour[ sur <b>%s</b>]",
|
||||
"DIRECTION_6":"Tournez fortement à gauche[ sur <b>%s</b>]",
|
||||
"DIRECTION_7":"Tournez à gauche[ sur <b>%s</b>]",
|
||||
"DIRECTION_8":"Tournez légèrement à gauche[ sur <b>%s</b>]",
|
||||
"DIRECTION_10":"Direction <b>%d</b>[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-1":"Au rond-point, prenez la première sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-2":"Au rond-point, prenez la deuxième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-3":"Au rond-point, prenez la troisième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-4":"Au rond-point, prenez la quatrième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-5":"Au rond-point, prenez la cinquième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-6":"Au rond-point, prenez la sixième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-7":"Au rond-point, prenez la septième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-8":"Au rond-point, prenez la huitième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-9":"Au rond-point, prenez la neuvième sortie[ sur <b>%s</b>]",
|
||||
"DIRECTION_11-x":"Au rond-point, prenez l’une des trop nombreuses sorties[ sur <b>%s</b>]",
|
||||
"DIRECTION_15":"Vous êtes arrivé"
|
||||
};
|
||||
|
||||
//set GUI language on load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true )
|
||||
OSRM.Localization.setLanguage("fr");
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM localization
|
||||
// [Italian language support]
|
||||
|
||||
|
||||
OSRM.Localization["it"] = {
|
||||
// own language
|
||||
"LANGUAGE": "Italiano",
|
||||
//gui
|
||||
"GUI_START": "Partenza",
|
||||
"GUI_END": "Destinazione",
|
||||
"GUI_RESET": "Reset",
|
||||
"GUI_ZOOM": "Zoom su Percorso",
|
||||
"GUI_SEARCH": "Mostra",
|
||||
"GUI_REVERSE": "Inverti",
|
||||
"GUI_START_TOOLTIP": "Inserire la Partenza",
|
||||
"GUI_END_TOOLTIP": "Inserire la destinazione",
|
||||
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting by <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder by <a href='http://www.osm.org/'>OSM</a>",
|
||||
//config
|
||||
"GUI_CONFIGURATION": "Configurazione",
|
||||
"GUI_LANGUAGE": "Lingua",
|
||||
"GUI_UNITS": "Unità",
|
||||
"GUI_KILOMETERS": "Chilometri",
|
||||
"GUI_MILES": "Miles",
|
||||
"GUI_DATA_TIMESTAMP": "data",
|
||||
// mapping
|
||||
"GUI_MAPPING_TOOLS": "Strumenti per la Mappatura",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Evidenzia strade senza nome",
|
||||
"GUI_SHOW_PREVIOUS_ROUTES": "Mostra le percorsi precedenti",
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Risultati della ricerca",
|
||||
"FOUND_X_RESULTS": "trovati %i risultati",
|
||||
"TIMED_OUT": "Timeout",
|
||||
"NO_RESULTS_FOUND": "Nessun risultato trovato",
|
||||
"NO_RESULTS_FOUND_SOURCE": "Nessun risultato trovato per la partenza",
|
||||
"NO_RESULTS_FOUND_TARGET": "Nessun risultato trovato per la destinazione",
|
||||
//routing
|
||||
"ROUTE_DESCRIPTION": "Descrizione del percorso",
|
||||
"GET_LINK_TO_ROUTE": "Genera un Link",
|
||||
"GENERATE_LINK_TO_ROUTE": "in attesa del link",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "non disponibile",
|
||||
"GPX_FILE": "File GPX",
|
||||
"DISTANCE": "Distanza",
|
||||
"DURATION": "Durata",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Sto calcolando il tuo percorso",
|
||||
"NO_ROUTE_FOUND": "Nessun percorso possibile",
|
||||
//printing
|
||||
"OVERVIEW_MAP": "Mappa d'insieme",
|
||||
// directions
|
||||
"N": "nord",
|
||||
"E": "est",
|
||||
"S": "sud",
|
||||
"W": "ovest",
|
||||
"NE": "nordest",
|
||||
"SE": "sudest",
|
||||
"SW": "sudovest",
|
||||
"NW": "nordovest",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// %d: direction
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Istruzione sconosciuta[ su <b>%s</b>]",
|
||||
"DIRECTION_1":"Continuare[ su <b>%s</b>]",
|
||||
"DIRECTION_2":"Girare leggermente a destra[ su <b>%s</b>]",
|
||||
"DIRECTION_3":"Girare a destra[ su <b>%s</b>]",
|
||||
"DIRECTION_4":"Girare decisamente a destra[ su <b>%s</b>]",
|
||||
"DIRECTION_5":"Compire una inversione ad U[ su <b>%s</b>]",
|
||||
"DIRECTION_6":"Girare decisamente a sinistra[ su <b>%s</b>]",
|
||||
"DIRECTION_7":"Girare a sinistra[ su <b>%s</b>]",
|
||||
"DIRECTION_8":"Girare leggermente a sinistra[ su <b>%s</b>]",
|
||||
"DIRECTION_10":"Dirigersi a <b>%d</b>[ su <b>%s</b>]",
|
||||
"DIRECTION_11-1":"Immettersi nella rotonda ed abbandonarla alla prima uscita[ su <b>%s</b>]",
|
||||
"DIRECTION_11-2":"Immettersi nella rotonda ed abbandonarla alla seconda uscita[ su <b>%s</b>]",
|
||||
"DIRECTION_11-3":"Immettersi nella rotonda ed abbandonarla alla terza uscita[ su <b>%s</b>]",
|
||||
"DIRECTION_11-4":"Immettersi nella rotonda ed abbandonarla alla quarta uscita[ su <b>%s</b>]",
|
||||
"DIRECTION_11-5":"Immettersi nella rotonda ed abbandonarla alla quinta uscita[ su <b>%s</b>]",
|
||||
"DIRECTION_11-6":"Immettersi nella rotonda ed abbandonarla alla sesta uscita[ su <b>%s</b>]",
|
||||
"DIRECTION_11-7":"Immettersi nella rotonda ed abbandonarla alla settima uscita[ su <b>%s</b>]",
|
||||
"DIRECTION_11-8":"Immettersi nella rotonda ed abbandonarla alla ottava uscita[ su <b>%s</b>]",
|
||||
"DIRECTION_11-9":"Immettersi nella rotonda ed abbandonarla alla nona uscita[ su <b>%s</b>]",
|
||||
"DIRECTION_11-x":"Immettersi nella rotonda ed abbandonarla ad una delle tante uscite[ su <b>%s</b>]",
|
||||
"DIRECTION_15":"Hai raggiunto la tua destinazione"
|
||||
};
|
||||
|
||||
//set GUI language on load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true )
|
||||
OSRM.Localization.setLanguage("it");
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM localization
|
||||
// [Latvian language support]
|
||||
|
||||
|
||||
OSRM.Localization["lv"] = {
|
||||
// own language
|
||||
"LANGUAGE": "Latviešu",
|
||||
// gui
|
||||
"GUI_START": "Sākums",
|
||||
"GUI_END": "Galamērķis",
|
||||
"GUI_RESET": " Reset ",
|
||||
"GUI_ZOOM": "Padidinti ant Route",
|
||||
"GUI_SEARCH": " Rādīt ",
|
||||
"GUI_REVERSE": "Pretējā virzienā",
|
||||
"GUI_START_TOOLTIP": "Izvēlieties sākumu",
|
||||
"GUI_END_TOOLTIP": "Izvēlieties galamērķi",
|
||||
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting by <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder by <a href='http://www.osm.org/'>OSM</a>",
|
||||
// config
|
||||
"GUI_CONFIGURATION": "Konfigurācija",
|
||||
"GUI_LANGUAGE": "Valoda",
|
||||
"GUI_UNITS": "Mērvienība",
|
||||
"GUI_KILOMETERS": "Kilometri",
|
||||
"GUI_MILES": "Jūdzes",
|
||||
"GUI_DATA_TIMESTAMP": "data",
|
||||
// mapping
|
||||
"GUI_MAPPING_TOOLS": "Kartēšanas rīki",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Izcelt ielas bez nosaukumiem",
|
||||
"GUI_SHOW_PREVIOUS_ROUTES": "Rādīt vēsturiskos maršrutus",
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Meklēšanas rezultāti",
|
||||
"FOUND_X_RESULTS": "atrasti %i ieraksti",
|
||||
"TIMED_OUT": "Iestājās noildze",
|
||||
"NO_RESULTS_FOUND": "Neizdevās atrast šādu maršrutu",
|
||||
"NO_RESULTS_FOUND_SOURCE": "Šāds sākuma punkts netika atrasts",
|
||||
"NO_RESULTS_FOUND_TARGET": "Šāds galamērķis netika atrasts",
|
||||
// routing
|
||||
"ROUTE_DESCRIPTION": "Maršruta apraksts",
|
||||
"GET_LINK_TO_ROUTE": "Izveidot saiti",
|
||||
"GENERATE_LINK_TO_ROUTE": "notiek saites veidošana",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "saite nav pieejama",
|
||||
"GPX_FILE": "GPX fails",
|
||||
"DISTANCE": "Attālums",
|
||||
"DURATION": "Ilgums",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Tiek veikta maršruta aprēķināšana",
|
||||
"NO_ROUTE_FOUND": "Maršrutu nav iespējams aprēķināt",
|
||||
// printing
|
||||
"OVERVIEW_MAP": "Kartes pārskats",
|
||||
"NO_ROUTE_SELECTED": "Nav norādīts maršruts",
|
||||
// directions
|
||||
"N": "ziemeļu",
|
||||
"E": "austrumu",
|
||||
"S": "dienvidu",
|
||||
"W": "rietumu",
|
||||
"NE": "ziemeļaustrumu",
|
||||
"SE": "dienvidaustrumu",
|
||||
"SW": "dienvidrietumu",
|
||||
"NW": "ziemeļrietumu",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// %d: direction
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Nezinama instrukcija[ uz <b>%s</b>]",
|
||||
"DIRECTION_1":"Turpiniet ceļu[ pa <b>%s</b>]",
|
||||
"DIRECTION_2":"Pagriezieties nedaudz pa labi [ uz <b>%s</b>]",
|
||||
"DIRECTION_3":"Pagriezieties pa labi[ uz <b>%s</b>]",
|
||||
"DIRECTION_4":"Pagriezieties strauji pa labi[ uz <b>%s</b>]",
|
||||
"DIRECTION_5":"U-veida pagrieziens[ uz <b>%s</b>]",
|
||||
"DIRECTION_6":"Pagriezieties strauji pa kreisi[ uz <b>%s</b>]",
|
||||
"DIRECTION_7":"Pagriezieties pa kreisi[ uz <b>%s</b>]",
|
||||
"DIRECTION_8":"Pagriezieties nedaudz pa kreisi[ uz <b>%s</b>]",
|
||||
"DIRECTION_10":"Dotieties <b>%d</b> virzienā[ uz <b>%s</b>]",
|
||||
"DIRECTION_11-1":"Iebrauciet aplī, brauciet pa pirmo izeju[ uz <b>%s</b>]",
|
||||
"DIRECTION_11-2":"Iebrauciet aplī, brauciet pa otro izeju[ uz <b>%s</b>]",
|
||||
"DIRECTION_11-3":"Iebrauciet aplī, brauciet pa trešo izeju[ uz <b>%s</b>]",
|
||||
"DIRECTION_11-4":"Iebrauciet aplī, brauciet pa ceturto izeju[ uz <b>%s</b>]",
|
||||
"DIRECTION_11-5":"Iebrauciet aplī, brauciet pa piekto izeju[ uz <b>%s</b>]",
|
||||
"DIRECTION_11-6":"Iebrauciet aplī, brauciet pa sesto izeju[ uz <b>%s</b>]",
|
||||
"DIRECTION_11-7":"Iebrauciet aplī, brauciet pa septīto izeju[ uz <b>%s</b>]",
|
||||
"DIRECTION_11-8":"Iebrauciet aplī, brauciet pa astoto izeju[ uz <b>%s</b>]",
|
||||
"DIRECTION_11-9":"Iebrauciet aplī, brauciet pa devīto izeju[ uz <b>%s</b>]",
|
||||
"DIRECTION_11-x":"Ieprauciet aplī, brauciet pa vienu no pārāk daudzajām izejām[ uz <b>%s</b>]",
|
||||
"DIRECTION_15":"Sasniegts galamērķis"
|
||||
};
|
||||
|
||||
// set GUI language on load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true )
|
||||
OSRM.Localization.setLanguage("lv");
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM localization
|
||||
// [Polish language support]
|
||||
|
||||
|
||||
OSRM.Localization["pl"] = {
|
||||
// own language
|
||||
"LANGUAGE": "Polski",
|
||||
//gui
|
||||
"GUI_START": "Początek",
|
||||
"GUI_END": "Koniec",
|
||||
"GUI_RESET": "Reset",
|
||||
"GUI_ZOOM": "Zoom na Trasy",
|
||||
"GUI_SEARCH": "Pokaż",
|
||||
"GUI_REVERSE": "Odwróć",
|
||||
"GUI_START_TOOLTIP": "Wprowadź początek",
|
||||
"GUI_END_TOOLTIP": "Wprowadź koniec",
|
||||
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting: <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder: <a href='http://www.osm.org/'>OSM</a>",
|
||||
//config
|
||||
"GUI_CONFIGURATION": "Konfiguracja",
|
||||
"GUI_LANGUAGE": "Język",
|
||||
"GUI_UNITS": "Jednostki",
|
||||
"GUI_KILOMETERS": "Kilometrów",
|
||||
"GUI_MILES": "Miles",
|
||||
"GUI_DATA_TIMESTAMP": "data",
|
||||
// mapping
|
||||
"GUI_MAPPING_TOOLS": "Narzędzia mapowania",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Zaznacz ulice bez nazwy",
|
||||
"GUI_SHOW_PREVIOUS_ROUTES": "Pokaż poprzednie trasy",
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Wyniki wyszukiwania",
|
||||
"FOUND_X_RESULTS": "znaleziono %i wyników",
|
||||
"TIMED_OUT": "Upłynął czas oczekiwania",
|
||||
"NO_RESULTS_FOUND": "Brak wyników",
|
||||
"NO_RESULTS_FOUND_SOURCE": "Brak wyników dla początku trasy",
|
||||
"NO_RESULTS_FOUND_TARGET": "Brak wyników dla końca trasy",
|
||||
//routing
|
||||
"ROUTE_DESCRIPTION": "Opis trasy",
|
||||
"GET_LINK_TO_ROUTE": "Generuj link",
|
||||
"GENERATE_LINK_TO_ROUTE": "oczekiwanie na link",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "niedostępny",
|
||||
"GPX_FILE": "Plik GPX",
|
||||
"DISTANCE": "Dystans",
|
||||
"DURATION": "Czas",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Twoja trasa została wyznaczona",
|
||||
"NO_ROUTE_FOUND": "Nie można wyznaczyć trasy",
|
||||
//printing
|
||||
"OVERVIEW_MAP": "Mapa poglądowa",
|
||||
// directions
|
||||
"N": "północ",
|
||||
"E": "wschód",
|
||||
"S": "południe",
|
||||
"W": "zachód",
|
||||
"NE": "północny wschód",
|
||||
"SE": "południowy wschód",
|
||||
"SW": "południowy zachód",
|
||||
"NW": "połnocny zachód",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// %d: direction
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Nieznana instrukcja[ na <b>%s</b>]",
|
||||
"DIRECTION_1":"Kontynuuj[ drogą <b>%s</b>]",
|
||||
"DIRECTION_2":"Skręć lekko w prawo[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_3":"Skręć w prawo[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_4":"Skręć ostro w prawo[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_5":"Zawróć[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_6":"Skręć ostro w lewo[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_7":"Skręć w lewo[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_8":"Skręć lekko w lewo[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_10":"Podążaj na <b>%d</b>[ drogą <b>%s</b>]",
|
||||
"DIRECTION_11-1":"Wjedź na rondo, zjedź pierwszym zjazdem[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_11-2":"Wjedź na rondo, zjedź drugim zjazdem[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_11-3":"Wjedź na rondo, zjedź trzecim zjazdem[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_11-4":"Wjedź na rondo, zjedź czwartym zjazdem[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_11-5":"Wjedź na rondo, zjedź piątym zjazdem[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_11-6":"Wjedź na rondo, zjedź szóstym zjazdem[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_11-7":"Wjedź na rondo, zjedź siódmym zjazdem[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_11-8":"Wjedź na rondo, zjedź ósmym zjazdem[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_11-9":"Wjedź na rondo, zjedź dziewiątym zjazdem[ na drogę <b>%s</b>]",
|
||||
"DIRECTION_11-x":"Wjedź na rondo, zjedź wybranym przez siebie zjazdem [ na drogę <b>%s</b>]",
|
||||
"DIRECTION_15":"Cel został osiągnięty"
|
||||
};
|
||||
|
||||
//set GUI language on load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true )
|
||||
OSRM.Localization.setLanguage("pl");
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM localization
|
||||
// [English language support]
|
||||
|
||||
|
||||
OSRM.Localization["ru"] = {
|
||||
// own language
|
||||
"LANGUAGE": "Русский",
|
||||
// gui
|
||||
"GUI_START": "Начало",
|
||||
"GUI_END": "Конец",
|
||||
"GUI_RESET": " Сброс ",
|
||||
"GUI_ZOOM": "зум на маршрут",
|
||||
"GUI_SEARCH": " Показать ",
|
||||
"GUI_REVERSE": "Обратно",
|
||||
"GUI_START_TOOLTIP": "Укажите начальную точку",
|
||||
"GUI_END_TOOLTIP": "Укажите пункт назначения",
|
||||
"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM хостинг от <a href='http://algo2.iti.kit.edu/'>KIT</a> - Геокодинг от <a href='http://www.osm.org/'>OSM</a>",
|
||||
// config
|
||||
"GUI_CONFIGURATION": "Настройки",
|
||||
"GUI_LANGUAGE": "Язык",
|
||||
"GUI_UNITS": "Единицы",
|
||||
"GUI_KILOMETERS": "Километры",
|
||||
"GUI_MILES": "Мили",
|
||||
"GUI_DATA_TIMESTAMP": "версия",
|
||||
// mapping
|
||||
"GUI_MAPPING_TOOLS": "Настройки карты",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Выделить безымянные улицы",
|
||||
"GUI_SHOW_PREVIOUS_ROUTES": "Отображать предыдущий маршрут",
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Результаты поиска",
|
||||
"FOUND_X_RESULTS": "найдено %i результатов",
|
||||
"TIMED_OUT": "Превышен интервал ожидания",
|
||||
"NO_RESULTS_FOUND": "Ничего не найдено",
|
||||
"NO_RESULTS_FOUND_SOURCE": "Начальная точка не найдена",
|
||||
"NO_RESULTS_FOUND_TARGET": "Пункт назначения не найден",
|
||||
// routing
|
||||
"ROUTE_DESCRIPTION": "Описание маршрута",
|
||||
"GET_LINK_TO_ROUTE": "Постоянная ссылка",
|
||||
"GENERATE_LINK_TO_ROUTE": "создание ссылки",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "недоступно",
|
||||
"GPX_FILE": "GPX Файл",
|
||||
"DISTANCE": "Расстояние",
|
||||
"DURATION": "Время",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Вычисление маршрута",
|
||||
"NO_ROUTE_FOUND": "Маршрут не возможен",
|
||||
// printing
|
||||
"OVERVIEW_MAP": "Обзорная карта",
|
||||
"NO_ROUTE_SELECTED": "Маршрут не выбран",
|
||||
// directions
|
||||
"N": "север",
|
||||
"E": "восток",
|
||||
"S": "юг",
|
||||
"W": "запад",
|
||||
"NE": "северо-восток",
|
||||
"SE": "юго-восток",
|
||||
"SW": "юго-запад",
|
||||
"NW": "северо-запад",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// %d: direction
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Неизвестная инструкция[ по <b>%s</b>]",
|
||||
"DIRECTION_1":"Продолжайте движение[ по <b>%s</b>]",
|
||||
"DIRECTION_2":"Примите вправо[ на <b>%s</b>]",
|
||||
"DIRECTION_3":"Поверните направо[ на <b>%s</b>]",
|
||||
"DIRECTION_4":"Поверните резко направо[ на <b>%s</b>]",
|
||||
"DIRECTION_5":"U-образный разворот[ на <b>%s</b>]",
|
||||
"DIRECTION_6":"Примите влево[ на <b>%s</b>]",
|
||||
"DIRECTION_7":"Поверните налево[ на <b>%s</b>]",
|
||||
"DIRECTION_8":"Поверните резко налево[ на <b>%s</b>]",
|
||||
"DIRECTION_10":"Направляйтесь на <b>%d</b>[ по <b>%s</b>]",
|
||||
"DIRECTION_11-1":"На кольцевой дороге выполните 1-ый съезд[ на <b>%s</b>]",
|
||||
"DIRECTION_11-2":"На кольцевой дороге выполните 2-ой съезд[ на <b>%s</b>]",
|
||||
"DIRECTION_11-3":"На кольцевой дороге выполните 3-ий съезд[ на <b>%s</b>]",
|
||||
"DIRECTION_11-4":"На кольцевой дороге выполните 4-ый съезд[ на <b>%s</b>]",
|
||||
"DIRECTION_11-5":"На кольцевой дороге выполните 5-ый съезд[ на <b>%s</b>]",
|
||||
"DIRECTION_11-6":"На кольцевой дороге выполните 6-ой съезд[ на <b>%s</b>]",
|
||||
"DIRECTION_11-7":"На кольцевой дороге выполните 7-ой съезд[ на <b>%s</b>]",
|
||||
"DIRECTION_11-8":"На кольцевой дороге выполните 8-ой съезд[ на <b>%s</b>]",
|
||||
"DIRECTION_11-9":"На кольцевой дороге выполните 9-ый съезд[ на <b>%s</b>]",
|
||||
"DIRECTION_11-x":"На кольцевой дороге выполните съезд[ на <b>%s</b>]",
|
||||
"DIRECTION_15":"Вы прибыли в пункт назначения"
|
||||
};
|
||||
|
||||
// set GUI language on load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true )
|
||||
OSRM.Localization.setLanguage("ru");
|
||||
@@ -21,62 +21,54 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
|
||||
OSRM.Localization = {
|
||||
|
||||
// default directory for localization files
|
||||
DIRECTORY: "localization/",
|
||||
|
||||
// holds currently active language
|
||||
current_language: OSRM.DEFAULTS.LANGUAGE,
|
||||
|
||||
// initialize localization
|
||||
|
||||
//initialize localization
|
||||
init: function() {
|
||||
// create dropdown menu
|
||||
var select = document.createElement('select');
|
||||
select.id = "gui-language-toggle";
|
||||
select.className = "top-left-button";
|
||||
select.onchange = function() { OSRM.Localization.setLanguage(this.value); };
|
||||
|
||||
// fill dropdown menu
|
||||
// fill option list and find default entry
|
||||
var options = [];
|
||||
var options_2 = [];
|
||||
var selected = 0;
|
||||
var supported_languages = OSRM.DEFAULTS.LANGUAGE_SUPPORTED;
|
||||
for(var i=0, size=supported_languages.length; i<size; i++) {
|
||||
var option=document.createElement("option");
|
||||
option.innerHTML = supported_languages[i].display_name;
|
||||
option.value = supported_languages[i].encoding;
|
||||
select.appendChild(option);
|
||||
options.push( {display:supported_languages[i].encoding, value:supported_languages[i].encoding} );
|
||||
options_2.push( {display:supported_languages[i].name, value:supported_languages[i].encoding} );
|
||||
if( supported_languages[i].encoding == OSRM.DEFAULTS.LANGUAGE )
|
||||
selected=i;
|
||||
}
|
||||
select.value = OSRM.DEFAULTS.LANGUAGE;
|
||||
|
||||
// add element to DOM
|
||||
var input_mask_header = document.getElementById('input-mask-header');
|
||||
input_mask_header.insertBefore(select,input_mask_header.firstChild);
|
||||
// generate selectors
|
||||
OSRM.GUI.selectorInit("gui-language-toggle", options, selected, OSRM.Localization.setLanguageWrapper);
|
||||
OSRM.GUI.selectorInit("gui-language-2-toggle", options_2, selected, OSRM.Localization.setLanguageWrapper);
|
||||
|
||||
// create visible dropdown menu
|
||||
var textnode = document.createTextNode(OSRM.DEFAULTS.LANGUAGE);
|
||||
var myspan = document.createElement("span");
|
||||
myspan.className = "styled-select";
|
||||
myspan.id = "styled-select" + select.id;
|
||||
myspan.appendChild(textnode);
|
||||
select.parentNode.insertBefore(myspan, select);
|
||||
myspan.style.width = (select.clientWidth-2)+"px";
|
||||
myspan.style.height = (select.clientHeight)+"px";
|
||||
// set default language
|
||||
OSRM.Localization.setLanguage( OSRM.DEFAULTS.LANGUAGE );
|
||||
},
|
||||
setLanguageWrapper: function(language) { // wrapping required to correctly prevent localization tooltip from showing
|
||||
OSRM.GUI.deactivateTooltip( "localization" );
|
||||
OSRM.Localization.setLanguage(language);
|
||||
},
|
||||
|
||||
// perform language change
|
||||
setLanguage: function(language) {
|
||||
// change value of both language selectors
|
||||
OSRM.GUI.selectorChange( document.getElementById('gui-language-toggle'), language );
|
||||
OSRM.GUI.selectorChange( document.getElementById('gui-language-2-toggle'), language );
|
||||
|
||||
if( OSRM.Localization[language]) {
|
||||
OSRM.Localization.current_language = language;
|
||||
// update selector
|
||||
if( select = document.getElementById('gui-language-toggle') ) { // yes, = not == !
|
||||
var option = select.getElementsByTagName("option");
|
||||
select.value = language;
|
||||
for(var i = 0; i < option.length; i++)
|
||||
if(option[i].selected == true) {
|
||||
document.getElementById("styled-select" + select.id).childNodes[0].nodeValue = option[i].childNodes[0].nodeValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// change gui language
|
||||
OSRM.GUI.setLabels();
|
||||
// change map language
|
||||
if(OSRM.G.map.layerControl.getActiveLayer().redraw)
|
||||
OSRM.G.map.layerControl.getActiveLayer().redraw();
|
||||
// requery data
|
||||
if( OSRM.G.markers == null )
|
||||
return;
|
||||
if( OSRM.G.markers.route.length > 1)
|
||||
OSRM.Routing.getRoute();
|
||||
OSRM.Routing.getRoute({keepAlternative:true});
|
||||
else if(OSRM.G.markers.route.length > 0 && document.getElementById('information-box').innerHTML != "" ) {
|
||||
OSRM.Geocoder.call( OSRM.C.SOURCE_LABEL, document.getElementById("gui-input-source").value );
|
||||
OSRM.Geocoder.call( OSRM.C.TARGET_LABEL, document.getElementById("gui-input-target").value );
|
||||
@@ -92,7 +84,7 @@ setLanguage: function(language) {
|
||||
if( supported_languages[i].encoding == language) {
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = OSRM.DEFAULTS.LANGUAGE_FILES_DIRECTORY + "OSRM.Locale."+language+".js";
|
||||
script.src = OSRM.Localization.DIRECTORY+"OSRM.Locale."+language+".js";
|
||||
document.head.appendChild(script);
|
||||
break;
|
||||
}
|
||||
@@ -112,4 +104,4 @@ translate: function(text) {
|
||||
};
|
||||
|
||||
// shorter call to translate function
|
||||
OSRM.loc = OSRM.Localization.translate;
|
||||
OSRM.loc = OSRM.Localization.translate;
|
||||
|
||||
@@ -17,35 +17,60 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
|
||||
/* OSRM CSS styles */
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* fullscreen map */
|
||||
html, body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
overflow:hidden;
|
||||
}
|
||||
#map {
|
||||
height: 100%;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* changes/additions to leaflet styles */
|
||||
.via-counter
|
||||
{
|
||||
position:absolute;
|
||||
top:-3px;
|
||||
right:-6px;
|
||||
width:16px;
|
||||
border-radius:5px;
|
||||
-moz-border-radius:5px;
|
||||
-webkit-border-radius:5px;
|
||||
background-color:#FFFFFF;
|
||||
text-align:center;
|
||||
vertical-align:middle;
|
||||
font-size:9px;
|
||||
display:none;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* general styles for gui boxes */
|
||||
.gui-wrapper
|
||||
.box-wrapper
|
||||
{
|
||||
position:absolute;
|
||||
border-radius:10px;
|
||||
-moz-border-radius:10px;
|
||||
-webkit-border-radius:10px;
|
||||
background-color:#666666;
|
||||
background-color:rgba(0, 0, 0, 0.25);
|
||||
transition:left 1s;
|
||||
-moz-transition:left 1s;
|
||||
-webkit-transition:left 1s;
|
||||
-o-transition:left 1s;
|
||||
-ms-transition:left 1s;
|
||||
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3f000000, endColorstr=#3f000000);
|
||||
}
|
||||
.gui-box
|
||||
.box-animated
|
||||
{
|
||||
transition:left 1s, right 1s;
|
||||
-moz-transition:left 1s,right 1s;
|
||||
-webkit-transition:left 1s,right 1s;
|
||||
-o-transition:left 1s,right 1s;
|
||||
-ms-transition:left 1s,right 1s;
|
||||
}
|
||||
.box-content
|
||||
{
|
||||
position:absolute;
|
||||
background-color:#ffffff;
|
||||
@@ -56,31 +81,30 @@ html, body {
|
||||
margin:5px;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
|
||||
/* styles for specific gui boxes */
|
||||
#main-wrapper
|
||||
.box-handle-wrapper-right
|
||||
{
|
||||
width:410px;
|
||||
top:5px;
|
||||
bottom:25px;
|
||||
left:5px;
|
||||
width:36px;
|
||||
height:36px;
|
||||
border-top-right-radius:0px;
|
||||
border-bottom-right-radius:0px;
|
||||
-moz-border-radius-topright:0px;
|
||||
-moz-border-radius-bottomright:0px;
|
||||
-webkit-border-top-right-radius:0px;
|
||||
-webkit-border-bottom-right-radius:0px;
|
||||
}
|
||||
#main-input
|
||||
.box-handle-content-right
|
||||
{
|
||||
width:390px;
|
||||
height:200px;
|
||||
width:16px;
|
||||
height:16px;
|
||||
border-top-right-radius:0px;
|
||||
border-bottom-right-radius:0px;
|
||||
-moz-border-radius-topright:0px;
|
||||
-moz-border-radius-bottomright:0px;
|
||||
-webkit-border-top-right-radius:0px;
|
||||
-webkit-border-bottom-right-radius:0px;
|
||||
}
|
||||
#main-output
|
||||
.box-handle-wrapper-left
|
||||
{
|
||||
width:390px;
|
||||
top:220px; /* main-input.height+2*gui-box.margin+2*gui-box.padding */
|
||||
bottom:0px;
|
||||
}
|
||||
#blob-wrapper
|
||||
{
|
||||
left:-5px;
|
||||
top:5px;
|
||||
width:36px;
|
||||
height:36px;
|
||||
border-top-left-radius:0px;
|
||||
@@ -89,9 +113,8 @@ html, body {
|
||||
-moz-border-radius-bottomleft:0px;
|
||||
-webkit-border-top-left-radius:0px;
|
||||
-webkit-border-bottom-left-radius:0px;
|
||||
visibility:hidden;
|
||||
}
|
||||
#blob-content
|
||||
.box-handle-content-left
|
||||
{
|
||||
width:16px;
|
||||
height:16px;
|
||||
@@ -104,6 +127,41 @@ html, body {
|
||||
}
|
||||
|
||||
|
||||
/* general styles for gui box headers */
|
||||
.top-left-button
|
||||
{
|
||||
float:left;
|
||||
vertical-align:top;
|
||||
}
|
||||
.top-right-button
|
||||
{
|
||||
float:right;
|
||||
vertical-align:top;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* styles for main gui boxes */
|
||||
#main-wrapper
|
||||
{
|
||||
width:410px;
|
||||
top:5px;
|
||||
bottom:25px;
|
||||
left:5px;
|
||||
}
|
||||
#main-input
|
||||
{
|
||||
width:390px;
|
||||
height:140px;
|
||||
}
|
||||
#main-output
|
||||
{
|
||||
width:390px;
|
||||
top:160px; /* main-input.height+2*gui-box.margin+2*gui-box.padding */
|
||||
bottom:0px;
|
||||
}
|
||||
|
||||
|
||||
/* styles for main-input areas */
|
||||
#input-mask-header
|
||||
{
|
||||
@@ -113,7 +171,6 @@ html, body {
|
||||
height:50px;
|
||||
background-repeat:no-repeat;
|
||||
background-position:center;
|
||||
background-image:url("images/osrm-logo.png");
|
||||
}
|
||||
#input-mask
|
||||
{
|
||||
@@ -129,30 +186,6 @@ html, body {
|
||||
#gui-language-toggle
|
||||
{
|
||||
position:absolute;
|
||||
border: 0px;
|
||||
text-decoration:none;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.styled-select
|
||||
{
|
||||
position:absolute;
|
||||
background: url("images/selector.png");
|
||||
background-repeat:no-repeat;
|
||||
background-position: top right;
|
||||
padding: 1px 1px 1px 1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.top-left-button
|
||||
{
|
||||
float:left;
|
||||
}
|
||||
.top-right-button
|
||||
{
|
||||
float:right;
|
||||
}
|
||||
|
||||
|
||||
@@ -220,77 +253,56 @@ html, body {
|
||||
}
|
||||
|
||||
|
||||
/* styles for information-box-header */
|
||||
/* styles for main-output information-box-header */
|
||||
.header-title
|
||||
{
|
||||
font-weight:bold;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
.header-label
|
||||
{
|
||||
font-weight:normal;
|
||||
padding:0px 5px 0px 0px;
|
||||
}
|
||||
.header-content
|
||||
{
|
||||
font-weight:normal;
|
||||
}
|
||||
.result-link
|
||||
.route-link
|
||||
{
|
||||
color:#0000ff;
|
||||
text-decoration:none;
|
||||
cursor:pointer;
|
||||
}
|
||||
.result-link:hover
|
||||
.route-link:hover
|
||||
{
|
||||
color:#ff0000;
|
||||
}
|
||||
|
||||
|
||||
/* style for information-box table (search results, driving directions) */
|
||||
.results-table
|
||||
{
|
||||
border-spacing:0px;
|
||||
width:100%;
|
||||
/* styles for main-output information-box -> workaround for invisible scrollbars in Chrome */
|
||||
#information-box::-webkit-scrollbar {
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
}
|
||||
.results-odd
|
||||
{
|
||||
background-color: #FFFDE3;
|
||||
#information-box::-webkit-scrollbar-track {
|
||||
background: #FFFFFF;
|
||||
}
|
||||
.results-even
|
||||
{
|
||||
background-color: #FFF9BB;
|
||||
#information-box::-webkit-scrollbar-thumb {
|
||||
min-height: 30px;
|
||||
background: #EEEEEE;
|
||||
border: 1px solid #999999;
|
||||
-webkit-border-radius: 5ex;
|
||||
}
|
||||
.result-counter
|
||||
{
|
||||
text-align:right;
|
||||
vertical-align:top;
|
||||
font-weight:bold;
|
||||
padding:1px 5px 1px 5px;
|
||||
#information-box::-webkit-scrollbar-thumb:hover {
|
||||
background: #F9F9F9;
|
||||
}
|
||||
.result-items
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
width:100%;
|
||||
padding:1px;
|
||||
}
|
||||
.result-directions
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
padding:1px 5px 1px 5px;
|
||||
}
|
||||
.result-distance
|
||||
{
|
||||
text-align:right;
|
||||
vertical-align: middle;
|
||||
padding:1px 1px 1px 5px;
|
||||
}
|
||||
.result-item
|
||||
{
|
||||
cursor:pointer;
|
||||
color:#000000
|
||||
}
|
||||
.result-item:hover
|
||||
{
|
||||
color:#ff0000
|
||||
#information-box::-webkit-scrollbar-thumb:active {
|
||||
background: #F4F4F4;
|
||||
}
|
||||
|
||||
|
||||
/* style for main-output information-box -> table (general) */
|
||||
.no-results
|
||||
{
|
||||
text-align:center;
|
||||
@@ -298,6 +310,206 @@ html, body {
|
||||
}
|
||||
|
||||
|
||||
/* style for main-output information-box -> table (search results) */
|
||||
.results
|
||||
{
|
||||
border-spacing:0px;
|
||||
width:100%;
|
||||
}
|
||||
.results-body-odd
|
||||
{
|
||||
background-color: #FFFDE3;
|
||||
}
|
||||
.results-body-even
|
||||
{
|
||||
background-color: #FFF9BB;
|
||||
}
|
||||
.results-body-counter
|
||||
{
|
||||
text-align:right;
|
||||
vertical-align:middle;
|
||||
font-weight:bold;
|
||||
padding:1px 5px 1px 5px;
|
||||
}
|
||||
.results-body-items
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align:top;
|
||||
width:100%;
|
||||
padding:1px;
|
||||
}
|
||||
.results-body-item
|
||||
{
|
||||
cursor:pointer;
|
||||
color:#000000
|
||||
}
|
||||
.results-body-item:hover
|
||||
{
|
||||
color:#ff0000
|
||||
}
|
||||
.results-body-item-remark
|
||||
{
|
||||
color:#999999
|
||||
}
|
||||
|
||||
|
||||
/* style for main-output information-box -> table (driving directions) */
|
||||
.description
|
||||
{
|
||||
border-spacing:0px;
|
||||
width:100%;
|
||||
}
|
||||
.description-body-odd
|
||||
{
|
||||
background-color: #FFFDE3;
|
||||
}
|
||||
.description-body-even
|
||||
{
|
||||
background-color: #FFF9BB;
|
||||
}
|
||||
.description-body-items
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
width:100%;
|
||||
padding:1px;
|
||||
}
|
||||
.description-body-directions
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
padding:1px 5px 1px 5px;
|
||||
}
|
||||
.description-body-direction
|
||||
{
|
||||
width:18px;
|
||||
height:18px;
|
||||
}
|
||||
.description-body-distance
|
||||
{
|
||||
text-align:right;
|
||||
vertical-align: middle;
|
||||
padding:1px 1px 1px 5px;
|
||||
|
||||
}
|
||||
.description-body-item
|
||||
{
|
||||
cursor:pointer;
|
||||
color:#000000
|
||||
}
|
||||
.description-body-item:hover
|
||||
{
|
||||
color:#ff0000
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* styles for other gui boxes */
|
||||
#mapping-wrapper
|
||||
{
|
||||
width:410px;
|
||||
height:100px;
|
||||
bottom:25px;
|
||||
right:5px;
|
||||
}
|
||||
#mapping-content
|
||||
{
|
||||
width:390px;
|
||||
height:80px;
|
||||
}
|
||||
#config-wrapper
|
||||
{
|
||||
width:410px;
|
||||
height:100px;
|
||||
bottom:25px;
|
||||
right:5px;
|
||||
}
|
||||
#config-content
|
||||
{
|
||||
width:390px;
|
||||
height:80px;
|
||||
}
|
||||
#exclusive-notification-wrapper
|
||||
{
|
||||
width:600px;
|
||||
height:170px;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-top:-85px;
|
||||
margin-left:-300px;
|
||||
}
|
||||
#exclusive-notification-content
|
||||
{
|
||||
width:580px;
|
||||
height:150px;
|
||||
}
|
||||
#exclusive-notification-blanket
|
||||
{
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
width:100%;
|
||||
height:100%;
|
||||
background-color:rgba(0, 0, 0, 0.25);
|
||||
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3f000000, endColorstr=#3f000000);
|
||||
z-index:100;
|
||||
display:none;
|
||||
}
|
||||
#tooltip-notification-wrapper
|
||||
{
|
||||
width:700px;
|
||||
height:38px;
|
||||
top: 20px;
|
||||
left: 50%;
|
||||
margin-left:-350px;
|
||||
z-index:98;
|
||||
display: none;
|
||||
}
|
||||
#tooltip-notification-content
|
||||
{
|
||||
width:680px;
|
||||
height:18px;
|
||||
}
|
||||
|
||||
|
||||
/* styles for content of other gui boxes */
|
||||
#gui-language-2-toggle
|
||||
{
|
||||
position:relative;
|
||||
}
|
||||
#gui-units-toggle
|
||||
{
|
||||
position:relative;
|
||||
}
|
||||
.box-label
|
||||
{
|
||||
font-weight:bold;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
.config-label
|
||||
{
|
||||
margin: 0px 0px 0px 5px;
|
||||
}
|
||||
.config-select
|
||||
{
|
||||
width:100px;
|
||||
}
|
||||
.mapping-checkbox
|
||||
{
|
||||
margin: 0px 5px 3px 5px;
|
||||
padding: 0px;
|
||||
}
|
||||
.mapping-button
|
||||
{
|
||||
float: right;
|
||||
}
|
||||
#notification-box
|
||||
{
|
||||
margin:5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* buttons */
|
||||
.button
|
||||
{
|
||||
@@ -324,6 +536,36 @@ html, body {
|
||||
background-color:#F4F4F4;
|
||||
color:#FF0000;
|
||||
}
|
||||
.button-inactive
|
||||
{
|
||||
cursor:default;
|
||||
padding:2px 10px 2px 10px;
|
||||
border-radius:5px;
|
||||
-moz-border-radius:5px;
|
||||
-webkit-border-radius:5px;
|
||||
background-color:#F9F9F9;
|
||||
border:1px solid #CCCCCC;
|
||||
color:#999999;
|
||||
text-decoration:none;
|
||||
font-size:9px;
|
||||
outline-style:none;
|
||||
vertical-align:1px;
|
||||
}
|
||||
.button-pressed
|
||||
{
|
||||
cursor:pointer;
|
||||
padding:2px 10px 2px 10px;
|
||||
border-radius:5px;
|
||||
-moz-border-radius:5px;
|
||||
-webkit-border-radius:5px;
|
||||
background-color:#AAAAAA;
|
||||
border:1px solid #999999;
|
||||
color:#000000;
|
||||
text-decoration:none;
|
||||
font-size:9px;
|
||||
outline-style:none;
|
||||
vertical-align:1px;
|
||||
}
|
||||
|
||||
|
||||
/* iconic buttons */
|
||||
@@ -336,58 +578,91 @@ html, body {
|
||||
background-position:center;
|
||||
}
|
||||
|
||||
#gui-toggle-out
|
||||
#gui-printer-inactive
|
||||
{
|
||||
background-image:url("images/cancel.png");
|
||||
}
|
||||
#gui-toggle-out:hover
|
||||
{
|
||||
background-image:url("images/cancel_hover.png");
|
||||
}
|
||||
#gui-toggle-out:active
|
||||
{
|
||||
background-image:url("images/cancel_active.png");
|
||||
cursor:default;
|
||||
}
|
||||
|
||||
#gui-toggle-in
|
||||
|
||||
/* styled select */
|
||||
.styled-select-helper
|
||||
{
|
||||
background-image:url("images/restore.png");
|
||||
border: 0px;
|
||||
text-decoration:none;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
z-index: 5;
|
||||
cursor:pointer;
|
||||
}
|
||||
#gui-toggle-in:hover
|
||||
.styled-select
|
||||
{
|
||||
background-image:url("images/restore_hover.png");
|
||||
}
|
||||
#gui-toggle-in:active
|
||||
{
|
||||
background-image:url("images/restore_active.png");
|
||||
position:absolute;
|
||||
background-repeat:no-repeat;
|
||||
background-position: top right;
|
||||
padding: 1px 1px 1px 1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#gui-printer
|
||||
|
||||
/* checkboxes */
|
||||
input[type=checkbox],
|
||||
{
|
||||
background-image:url("images/printer.png");
|
||||
cursor:pointer;
|
||||
}
|
||||
#gui-printer:hover
|
||||
.checkbox-label
|
||||
{
|
||||
background-image:url("images/printer_hover.png");
|
||||
}
|
||||
#gui-printer:active
|
||||
{
|
||||
background-image:url("images/printer_active.png");
|
||||
vertical-align:2px;
|
||||
}
|
||||
|
||||
.delete-marker
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* utility styles */
|
||||
.quad
|
||||
{
|
||||
background-image:url("images/cancel.png");
|
||||
}
|
||||
.delete-marker:hover
|
||||
{
|
||||
background-image:url("images/cancel_hover.png");
|
||||
}
|
||||
.delete-marker:active
|
||||
{
|
||||
background-image:url("images/cancel_active.png");
|
||||
min-width:10px;
|
||||
min-height:10px;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* table styles */
|
||||
.full
|
||||
{
|
||||
display:table;
|
||||
width:100%;
|
||||
}
|
||||
.row
|
||||
{
|
||||
display:table-row;
|
||||
}
|
||||
.left
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:left;
|
||||
vertical-align:middle;
|
||||
}
|
||||
.right
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:right;
|
||||
vertical-align:middle;
|
||||
}
|
||||
.center
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:center;
|
||||
vertical-align:middle;
|
||||
}
|
||||
.stretch
|
||||
{
|
||||
width:100%;
|
||||
}
|
||||
.fixed
|
||||
{
|
||||
min-width:100px;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* fonts */
|
||||
.base-font {
|
||||
@@ -408,60 +683,5 @@ html, body {
|
||||
.small-font {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 9px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
|
||||
/* utility styles (defined above buttons, so that buttons retain cursor:pointer)*/
|
||||
.quad
|
||||
{
|
||||
min-width:10px;
|
||||
min-height:10px;
|
||||
}
|
||||
|
||||
.not-selectable
|
||||
{
|
||||
cursor:default;
|
||||
-moz-user-select: -moz-none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.text-selectable
|
||||
{
|
||||
cursor:default;
|
||||
-moz-user-select: text;
|
||||
-webkit-user-select: text;
|
||||
-ms-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
.checkbox-label
|
||||
{
|
||||
vertical-align:2px;
|
||||
}
|
||||
|
||||
.full
|
||||
{
|
||||
display:table;
|
||||
width:100%;
|
||||
}
|
||||
.left
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:left;
|
||||
vertical-align:middle;
|
||||
}
|
||||
.right
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:right;
|
||||
vertical-align:middle;
|
||||
}
|
||||
.center
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:center;
|
||||
vertical-align:middle;
|
||||
}
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
@@ -29,9 +29,6 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
<meta name="description" content="OSRM Website"/>
|
||||
<meta name="author" content="Dennis Schieferdecker" />
|
||||
|
||||
<!-- favicon -->
|
||||
<link rel="shortcut icon" href="" type="image/x-icon" id="favicon"/>
|
||||
|
||||
<!-- stylesheets -->
|
||||
<link rel="stylesheet" href="leaflet/leaflet.css" type="text/css"/>
|
||||
<!--[if lte IE 8]><link rel="stylesheet" href="leaflet/leaflet.ie.css" type="text/css"/><![endif]-->
|
||||
@@ -39,58 +36,145 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
|
||||
<!-- scripts -->
|
||||
<script src="leaflet/leaflet-src.js" type="text/javascript"></script>
|
||||
<script src="L.Bugfixes.js" type="text/javascript"></script>
|
||||
<script src="L.DashedPolyline.js" type="text/javascript"></script>
|
||||
<script src="L.MouseMarker.js" type="text/javascript"></script>
|
||||
<script src="L.SwitchableIcon.js" type="text/javascript"></script>
|
||||
<script src="base/leaflet/L.Bugfixes.js" type="text/javascript"></script>
|
||||
<script src="base/leaflet/L.Control.QueryableLayers.js" type="text/javascript"></script>
|
||||
<script src="base/leaflet/L.DashedPolyline.js" type="text/javascript"></script>
|
||||
<script src="base/leaflet/L.MouseMarker.js" type="text/javascript"></script>
|
||||
<script src="base/leaflet/L.SwitchableIcon.js" type="text/javascript"></script>
|
||||
<script src="base/leaflet/L.TileLayer.Bing.js" type="text/javascript"></script>
|
||||
|
||||
<script src="OSRM.base.js" type="text/javascript"></script>
|
||||
<script src="OSRM.config.js" type="text/javascript"></script>
|
||||
<!-- <script defer="defer" src="OSRM.debug.js" type="text/javascript"></script> -->
|
||||
<script src="utils/OSRM.browsers.js" type="text/javascript"></script>
|
||||
<script src="utils/OSRM.classes.js" type="text/javascript"></script>
|
||||
|
||||
<script src="main.js" type="text/javascript"></script>
|
||||
<!-- <script defer="defer" src="OSRM.debug.js" type="text/javascript"></script> -->
|
||||
|
||||
<script src="OSRM.Markers.js" type="text/javascript"></script>
|
||||
<script src="OSRM.Route.js" type="text/javascript"></script>
|
||||
<script src="base/osrm/OSRM.MapView.js" type="text/javascript"></script>
|
||||
<script src="base/osrm/OSRM.Marker.js" type="text/javascript"></script>
|
||||
<script src="base/osrm/OSRM.Route.js" type="text/javascript"></script>
|
||||
|
||||
<script src="OSRM.Map.js" type="text/javascript"></script>
|
||||
<script src="OSRM.GUI.js" type="text/javascript"></script>
|
||||
<script src="base/OSRM.Map.js" type="text/javascript"></script>
|
||||
<script src="base/OSRM.Markers.js" type="text/javascript"></script>
|
||||
<script src="base/OSRM.Routes.js" type="text/javascript"></script>
|
||||
<script src="base/OSRM.HistoryRoutes.js" type="text/javascript"></script>
|
||||
<script src="gui/OSRM.GUI.js" type="text/javascript"></script>
|
||||
<script src="gui/OSRM.GUIBoxGroup.js" type="text/javascript"></script>
|
||||
<script src="gui/OSRM.GUIBoxHandle.js" type="text/javascript"></script>
|
||||
<script src="gui/OSRM.Selector.js" type="text/javascript"></script>
|
||||
<script src="gui/OSRM.MainGUI.js" type="text/javascript"></script>
|
||||
<script src="gui/OSRM.Notifications.js" type="text/javascript"></script>
|
||||
<script src="routing/OSRM.Routing.js" type="text/javascript"></script>
|
||||
<script src="routing/OSRM.RoutingAlternatives.js" type="text/javascript"></script>
|
||||
<script src="routing/OSRM.RoutingDescription.js" type="text/javascript"></script>
|
||||
<script src="routing/OSRM.RoutingGeometry.js" type="text/javascript"></script>
|
||||
<script src="routing/OSRM.RoutingGUI.js" type="text/javascript"></script>
|
||||
<script src="gui/OSRM.RoutingGUI.js" type="text/javascript"></script>
|
||||
<script src="routing/OSRM.RoutingNoNames.js" type="text/javascript"></script>
|
||||
<script src="OSRM.Via.js" type="text/javascript"></script>
|
||||
<script src="OSRM.Geocoder.js" type="text/javascript"></script>
|
||||
<script src="base/OSRM.Via.js" type="text/javascript"></script>
|
||||
<script src="base/OSRM.Geocoder.js" type="text/javascript"></script>
|
||||
|
||||
<script src="OSRM.Browser.js" type="text/javascript"></script>
|
||||
<script src="OSRM.JSONP.js" type="text/javascript"></script>
|
||||
<script src="utils/OSRM.CSS.js" type="text/javascript"></script>
|
||||
<script src="utils/OSRM.JSONP.js" type="text/javascript"></script>
|
||||
<script src="localization/OSRM.Localization.js" type="text/javascript"></script>
|
||||
<script src="printing/OSRM.Printing.js" type="text/javascript"></script>
|
||||
<script src="OSRM.Utils.js" type="text/javascript"></script>
|
||||
<script src="utils/OSRM.Utils.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
||||
|
||||
<!-- body -->
|
||||
<body class="base-font not-selectable">
|
||||
<body class="base-font">
|
||||
|
||||
<!--map-->
|
||||
<!-- map -->
|
||||
<div id="map"></div>
|
||||
|
||||
<!-- show ui blob -->
|
||||
<div id="blob-wrapper" class="gui-wrapper">
|
||||
<div id="blob-content" class="gui-box">
|
||||
<div id="gui-toggle-in" class="iconic-button"></div>
|
||||
<!-- exclusive notification -->
|
||||
<div id="exclusive-notification-blanket">
|
||||
<div id="exclusive-notification-wrapper" class="box-wrapper not-selectable">
|
||||
<div id="exclusive-notification-content" class="box-content">
|
||||
<!-- header -->
|
||||
<div id="exclusive-notification-toggle" class="iconic-button cancel-marker top-right-button"></div>
|
||||
<div id="exclusive-notification-label" class="box-label">Notification</div>
|
||||
|
||||
<!-- notification text -->
|
||||
<div id="exclusive-notification-box"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- show main gui -->
|
||||
<div id="main-wrapper" class="gui-wrapper not-selectable">
|
||||
<!-- tooltip notification -->
|
||||
<div id="tooltip-notification-wrapper" class="box-wrapper not-selectable">
|
||||
<div id="tooltip-notification-content" class="box-content">
|
||||
<!-- header -->
|
||||
<div id="tooltip-notification-toggle" class="iconic-button cancel-marker top-right-button"></div>
|
||||
<div class="quad top-right-button"></div>
|
||||
<div id="tooltip-notification-resize" class="iconic-button cancel-marker top-right-button"></div>
|
||||
<div id="tooltip-notification-label" class="box-label">Notification</div>
|
||||
|
||||
<!-- notification text -->
|
||||
<div id="tooltip-notification-box"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- config gui -->
|
||||
<div id="config-wrapper" class="box-wrapper">
|
||||
<div id="config-content" class="box-content">
|
||||
<!-- header -->
|
||||
<div id="config-toggle" class="iconic-button cancel-marker top-right-button"></div>
|
||||
<div id="gui-config-label" class="box-label">Configuraion</div>
|
||||
|
||||
<!-- config options -->
|
||||
<div class="full">
|
||||
<div class="row">
|
||||
<div class="left fixed"><span id="gui-language-2-label" class="config-label">Language:</span></div>
|
||||
<div class="left stretch"><select id="gui-language-2-toggle" class="config-select"></select></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="left fixed"><span id="gui-units-label" class="config-label">Units:</span></div>
|
||||
<div class="left stretch"><select id="gui-units-toggle" class="config-select"></select></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- data timestamp -->
|
||||
<div class="full">
|
||||
<div class="row">
|
||||
<div class="right small-font"><span id="gui-data-timestamp">data: n/a</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- mapping gui -->
|
||||
<div id="mapping-wrapper" class="box-wrapper">
|
||||
<div id="mapping-content" class="box-content">
|
||||
<!-- header -->
|
||||
<div id="mapping-toggle" class="iconic-button cancel-marker top-right-button"></div>
|
||||
<div id="gui-mapping-label" class="box-label">Mapping Tools</div>
|
||||
|
||||
<!-- header -->
|
||||
<div class="full">
|
||||
<div class="row">
|
||||
<div class="left"><input type="checkbox" id="option-highlight-nonames" value="highlight-nonames" class="mapping-checkbox"/></div>
|
||||
<div class="left stretch"><span id="gui-option-highlight-nonames-label" class="checkbox-label small-font">Highlight unnamed streets</span></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="left"><input type="checkbox" id="option-show-previous-routes" value="show-previous-routes" class="mapping-checkbox"/></div>
|
||||
<div class="left stretch"><span id="gui-option-show-previous-routes-label" class="checkbox-label small-font">Show previous routes</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<a class="button mapping-button" id="open-osmbugs">OSM Bugs</a><span class="quad mapping-button"></span><a class="button mapping-button" id="open-josm">JOSM</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- main gui -->
|
||||
<div id="main-wrapper" class="box-wrapper">
|
||||
|
||||
<!-- input box -->
|
||||
<div id="main-input" class="gui-box">
|
||||
<div id="main-input" class="box-content">
|
||||
<!-- header -->
|
||||
<div id="input-mask-header">
|
||||
<div id="gui-toggle-out" class="iconic-button top-right-button"></div>
|
||||
<select id="gui-language-toggle" class="top-left-button"></select>
|
||||
<div id="main-toggle" class="iconic-button cancel-marker top-right-button"></div>
|
||||
</div>
|
||||
|
||||
<!-- input mask -->
|
||||
@@ -100,15 +184,15 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
<div class="full">
|
||||
<div id="input-source" class="input-marker">
|
||||
<div class="left"><span id="gui-search-source-label" class="input-label">Start:</span></div>
|
||||
<div class="center input-box"><input id="gui-input-source" class="input-box" type="text" maxlength="200" value="" title="Startposition eingeben" /></div>
|
||||
<div class="left"><div id="gui-delete-source" class="iconic-button delete-marker input-delete"></div></div>
|
||||
<div class="right"><a class="button" id="gui-search-source">Zeigen</a></div>
|
||||
<div class="center input-box"><input id="gui-input-source" class="input-box" type="text" maxlength="200" value="" title="Enter start" /></div>
|
||||
<div class="left"><div id="gui-delete-source" class="iconic-button cancel-marker input-delete"></div></div>
|
||||
<div class="right"><a class="button" id="gui-search-source">Show</a></div>
|
||||
</div>
|
||||
<div id="input-target" class="input-marker">
|
||||
<div class="left"><span id="gui-search-target-label" class="input-label">Ende:</span></div>
|
||||
<div class="center input-box"><input id="gui-input-target" class="input-box" type="text" maxlength="200" value="" title="Zielposition eingeben" /></div>
|
||||
<div class="left"><div id="gui-delete-target" class="iconic-button delete-marker input-delete"></div></div>
|
||||
<div class="right"><a class="button" id="gui-search-target">Zeigen</a></div>
|
||||
<div class="left"><span id="gui-search-target-label" class="input-label">End:</span></div>
|
||||
<div class="center input-box"><input id="gui-input-target" class="input-box" type="text" maxlength="200" value="" title="Enter destination" /></div>
|
||||
<div class="left"><div id="gui-delete-target" class="iconic-button cancel-marker input-delete"></div></div>
|
||||
<div class="right"><a class="button" id="gui-search-target">Show</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -117,34 +201,14 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
<!-- action buttons -->
|
||||
<div class="full">
|
||||
<div class="left"><a class="button" id="gui-reset">Reset</a></div>
|
||||
<div class="right"><a class="button" id="gui-reverse">Umdrehen</a></div>
|
||||
<div class="center full"><a class="button-inactive" id="gui-zoom">Reset</a></div>
|
||||
<div class="right"><a class="button" id="gui-reverse">Reverse</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="quad"></div>
|
||||
|
||||
<!-- options -->
|
||||
<div id="input-mask-options">
|
||||
|
||||
<!-- option toggle -->
|
||||
<span id="gui-options-toggle" class="small-font">Kartenwerkzeuge</span>
|
||||
|
||||
<!-- actual options -->
|
||||
<div id="options-box" class="full">
|
||||
<div class="left">
|
||||
<input type="checkbox" id="option-highlight-nonames" value="highlight-nonames" />
|
||||
<span id="gui-option-highlight-nonames-label" class="checkbox-label small-font">Unbenannte Straßen hervorheben</span>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="button" id="open-josm">JOSM</a>
|
||||
<a class="button" id="open-osmbugs">OSM Bugs</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- output box -->
|
||||
<div id="main-output" class="gui-box">
|
||||
<div id="main-output" class="box-content">
|
||||
<div id="information-box-header"></div>
|
||||
<div id="information-box"></div>
|
||||
<div id="legal-notice" class="small-font">GUI2 - OSRM hosting by <a href='http://algo2.iti.kit.edu/'>KIT</a> - Geocoder by <a href='http://www.osm.org/'>OSM</a></div>
|
||||
|
||||
@@ -23,22 +23,32 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
OSRM.init = function() {
|
||||
OSRM.prefetchImages();
|
||||
OSRM.prefetchIcons();
|
||||
OSRM.prefetchCSSIcons();
|
||||
|
||||
OSRM.Localization.init();
|
||||
OSRM.GUI.init();
|
||||
OSRM.Map.init();
|
||||
//OSRM.Printing.init();
|
||||
OSRM.Printing.init();
|
||||
OSRM.Routing.init();
|
||||
OSRM.RoutingAlternatives.init();
|
||||
OSRM.Localization.init();
|
||||
|
||||
// stop if in maintenance mode
|
||||
if( OSRM.inMaintenance() == true )
|
||||
return;
|
||||
|
||||
// check if the URL contains some GET parameter, e.g. for showing a route
|
||||
OSRM.parseParameters();
|
||||
|
||||
// only init default position / geolocation position if GET parameters do not specify a different one
|
||||
if( OSRM.G.initial_position_override == false )
|
||||
OSRM.Map.initPosition();
|
||||
};
|
||||
|
||||
|
||||
// prefetch images
|
||||
OSRM.GLOBALS.images = {};
|
||||
OSRM.prefetchImages = function() {
|
||||
var image_list = [ {id:'marker-shadow', url:L.ROOT_URL + 'images/marker-shadow.png'},
|
||||
var image_list = [ {id:'marker-shadow', url:'leaflet/images/marker-shadow.png'},
|
||||
{id:'marker-source', url:'images/marker-source.png'},
|
||||
{id:'marker-target', url:'images/marker-target.png'},
|
||||
{id:'marker-via', url:'images/marker-via.png'},
|
||||
@@ -54,6 +64,18 @@ OSRM.prefetchImages = function() {
|
||||
{id:'restore', url:'images/restore.png'},
|
||||
{id:'restore_active', url:'images/restore_active.png'},
|
||||
{id:'restore_hover', url:'images/restore_hover.png'},
|
||||
{id:'up', url:'images/up.png'},
|
||||
{id:'up_active', url:'images/up_active.png'},
|
||||
{id:'up_hover', url:'images/up_hover.png'},
|
||||
{id:'down', url:'images/down.png'},
|
||||
{id:'down_active', url:'images/down_active.png'},
|
||||
{id:'down_hover', url:'images/down_hover.png'},
|
||||
{id:'config', url:'images/config.png'},
|
||||
{id:'config_active', url:'images/config_active.png'},
|
||||
{id:'config_hover', url:'images/config_hover.png'},
|
||||
{id:'mapping', url:'images/mapping.png'},
|
||||
{id:'mapping_active', url:'images/mapping_active.png'},
|
||||
{id:'mapping_hover', url:'images/mapping_hover.png'},
|
||||
{id:'printer', url:'images/printer.png'},
|
||||
{id:'printer_active', url:'images/printer_active.png'},
|
||||
{id:'printer_hover', url:'images/printer_hover.png'},
|
||||
@@ -64,12 +86,14 @@ OSRM.prefetchImages = function() {
|
||||
{id:'direction_3', url:'images/turn-right.png'},
|
||||
{id:'direction_4', url:'images/sharp-right.png'},
|
||||
{id:'direction_5', url:'images/u-turn.png'},
|
||||
{id:'direction_6', url:'images/slight-left.png'},
|
||||
{id:'direction_6', url:'images/sharp-left.png'},
|
||||
{id:'direction_7', url:'images/turn-left.png'},
|
||||
{id:'direction_8', url:'images/sharp-left.png'},
|
||||
{id:'direction_8', url:'images/slight-left.png'},
|
||||
{id:'direction_10', url:'images/head.png'},
|
||||
{id:'direction_11', url:'images/round-about.png'},
|
||||
{id:'direction_15', url:'images/target.png'},
|
||||
{id:'favicon', url:'images/osrm-favicon.ico'}
|
||||
{id:'osrm-logo', url:'images/osrm-logo.png'},
|
||||
{id:'selector', url:'images/selector.png'}
|
||||
];
|
||||
|
||||
for(var i=0; i<image_list.length; i++) {
|
||||
@@ -95,15 +119,58 @@ OSRM.prefetchIcons = function() {
|
||||
|
||||
for(var i=0; i<icon_list.length; i++) {
|
||||
var icon = {
|
||||
iconUrl: OSRM.G.images[icon_list[i].image_id].src, iconSize: new L.Point(25, 41), iconAnchor: new L.Point(13, 41),
|
||||
shadowUrl: OSRM.G.images["marker-shadow"].src, shadowSize: new L.Point(41, 41),
|
||||
iconUrl: OSRM.G.images[icon_list[i].image_id].getAttribute("src"), iconSize: new L.Point(25, 41), iconAnchor: new L.Point(13, 41),
|
||||
shadowUrl: OSRM.G.images["marker-shadow"].getAttribute("src"), shadowSize: new L.Point(41, 41),
|
||||
popupAnchor: new L.Point(0, -33)
|
||||
};
|
||||
OSRM.G.icons[icon_list[i].id] = new L.SwitchableIcon(icon);
|
||||
}
|
||||
|
||||
// special values for drag marker
|
||||
OSRM.G.icons['marker-drag'] = new L.SwitchableIcon( {iconUrl: OSRM.G.images["marker-drag"].src, iconSize: new L.Point(18, 18) } );
|
||||
OSRM.G.icons['marker-drag'] = new L.SwitchableIcon( {iconUrl: OSRM.G.images["marker-drag"].getAttribute("src"), iconSize: new L.Point(18, 18) } );
|
||||
};
|
||||
|
||||
|
||||
// set css styles for images
|
||||
OSRM.prefetchCSSIcons = function() {
|
||||
var css_list = [
|
||||
{ id:'#gui-printer-inactive', image_id:'printer_inactive'},
|
||||
{ id:'#gui-printer', image_id:'printer'},
|
||||
{ id:'#gui-printer:hover', image_id:'printer_hover'},
|
||||
{ id:'#gui-printer:active', image_id:'printer_active'},
|
||||
|
||||
{ id:'.cancel-marker', image_id:'cancel'},
|
||||
{ id:'.cancel-marker:hover', image_id:'cancel_hover'},
|
||||
{ id:'.cancel-marker:active', image_id:'cancel_active'},
|
||||
|
||||
{ id:'.up-marker', image_id:'up'},
|
||||
{ id:'.up-marker:hover', image_id:'up_hover'},
|
||||
{ id:'.up-marker:active', image_id:'up_active'},
|
||||
|
||||
{ id:'.down-marker', image_id:'down'},
|
||||
{ id:'.down-marker:hover', image_id:'down_hover'},
|
||||
{ id:'.down-marker:active', image_id:'down_active'},
|
||||
|
||||
{ id:'#input-mask-header', image_id:'osrm-logo'},
|
||||
{ id:'.styled-select', image_id:'selector'},
|
||||
|
||||
{ id:'#config-handle-icon', image_id:'config'},
|
||||
{ id:'#config-handle-icon:hover', image_id:'config_hover'},
|
||||
{ id:'#config-handle-icon:active', image_id:'config_active'},
|
||||
|
||||
{ id:'#mapping-handle-icon', image_id:'mapping'},
|
||||
{ id:'#mapping-handle-icon:hover', image_id:'mapping_hover'},
|
||||
{ id:'#mapping-handle-icon:active', image_id:'mapping_active'},
|
||||
|
||||
{ id:'#main-handle-icon', image_id:'restore'},
|
||||
{ id:'#main-handle-icon:hover', image_id:'restore_hover'},
|
||||
{ id:'#main-handle-icon:active', image_id:'restore_active'}
|
||||
];
|
||||
|
||||
var stylesheet = OSRM.CSS.getStylesheet("main.css");
|
||||
for(var i=0; i<css_list.length; i++) {
|
||||
OSRM.CSS.insert( stylesheet, css_list[i].id, "background-image:url("+ OSRM.G.images[css_list[i].image_id].getAttribute("src") + ");" );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -111,7 +178,10 @@ OSRM.prefetchIcons = function() {
|
||||
OSRM.parseParameters = function(){
|
||||
var called_url = document.location.search.substr(1,document.location.search.length);
|
||||
|
||||
// reject messages that are clearly too long or too small
|
||||
// state, if GET parameters specify a different initial position
|
||||
OSRM.G.initial_position_override = false;
|
||||
|
||||
// reject messages that are clearly too long or too small
|
||||
if( called_url.length > 1000 || called_url.length == 0)
|
||||
return;
|
||||
|
||||
@@ -128,6 +198,12 @@ OSRM.parseParameters = function(){
|
||||
if(name_val[0] == 'hl') {
|
||||
OSRM.Localization.setLanguage(name_val[1]);
|
||||
}
|
||||
else if(name_val[0] == 'df') {
|
||||
var type = parseInt(name_val[1]);
|
||||
if(type != 0 && type != 1)
|
||||
return;
|
||||
OSRM.Utils.setToHumanDistanceFunction(type);
|
||||
}
|
||||
else if(name_val[0] == 'loc') {
|
||||
var coordinates = unescape(name_val[1]).split(',');
|
||||
if(coordinates.length!=2 || !OSRM.Utils.isLatitude(coordinates[0]) || !OSRM.Utils.isLongitude(coordinates[1]) )
|
||||
@@ -155,7 +231,13 @@ OSRM.parseParameters = function(){
|
||||
if(coordinates.length!=2 || !OSRM.Utils.isLatitude(coordinates[0]) || !OSRM.Utils.isLongitude(coordinates[1]) )
|
||||
return;
|
||||
params.center = new L.LatLng( coordinates[0], coordinates[1]);
|
||||
}
|
||||
}
|
||||
else if(name_val[0] == 'alt') {
|
||||
var active_alternative = Number(name_val[1]);
|
||||
if( active_alternative<0 || active_alternative>OSRM.RoutingAlternatives>10) // using 10 as arbitrary upper limit
|
||||
return;
|
||||
params.active_alternative = active_alternative;
|
||||
}
|
||||
}
|
||||
|
||||
// case 1: destination given
|
||||
@@ -167,6 +249,7 @@ OSRM.parseParameters = function(){
|
||||
OSRM.Geocoder.updateAddress( OSRM.C.TARGET_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG );
|
||||
OSRM.G.markers.route[index].show();
|
||||
OSRM.G.markers.route[index].centerView();
|
||||
OSRM.G.initial_position_override = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -193,18 +276,30 @@ OSRM.parseParameters = function(){
|
||||
} else {
|
||||
OSRM.G.map.setView(params.center, params.zoom);
|
||||
}
|
||||
|
||||
// set active alternative (if via points are set or alternative does not exists: automatic fallback to shortest route)
|
||||
OSRM.G.active_alternative = params.active_alternative;
|
||||
|
||||
// compute route
|
||||
OSRM.Routing.getRoute();
|
||||
OSRM.Routing.getRoute({keepAlternative:true});
|
||||
OSRM.G.initial_position_override = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// default case: do nothing
|
||||
// default case: do nothing
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
// check whether to activate maintenance mode
|
||||
OSRM.inMaintenance = function(){
|
||||
if( OSRM.DEFAULTS.MAINTENANCE == true ) {
|
||||
OSRM.GUI.exclusiveNotify( OSRM.DEFAULTS.MAINTENANCE_HEADER, OSRM.DEFAULTS.MAINTENANCE_TEXT, false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
// onload event
|
||||
if(document.addEventListener) // FF, CH
|
||||
document.addEventListener("DOMContentLoaded", OSRM.init, false);
|
||||
else if(document.attachEvent)
|
||||
document.attachEvent("onreadystatechange", function() { if ( document.readyState === "interactive" ) OSRM.init(); });
|
||||
OSRM.Browser.onLoadHandler( OSRM.init );
|
||||
|
||||
@@ -15,14 +15,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM printer
|
||||
// OSRM printing
|
||||
// [printing support]
|
||||
|
||||
|
||||
OSRM.Printing = {
|
||||
|
||||
// directory with printing code, and base OSRM directory relative to this directory
|
||||
DIRECTORY: 'printing/',
|
||||
BASE_DIRECTORY: '../',
|
||||
|
||||
// create UI for printing in mainwindow
|
||||
init: function() {
|
||||
var icon = document.createElement('div');
|
||||
icon.id = "gui-printer";
|
||||
icon.id = "gui-printer-inactive";
|
||||
icon.className = "iconic-button top-right-button";
|
||||
|
||||
var spacer = document.createElement('div');
|
||||
@@ -32,91 +38,220 @@ init: function() {
|
||||
input_mask_header.appendChild(spacer,input_mask_header.lastChild);
|
||||
input_mask_header.appendChild(icon,input_mask_header.lastChild);
|
||||
|
||||
document.getElementById("gui-printer").onclick = OSRM.Printing.print;
|
||||
document.getElementById("gui-printer-inactive").onclick = OSRM.Printing.openPrintWindow;
|
||||
|
||||
OSRM.Browser.onUnloadHandler( OSRM.Printing.uninit );
|
||||
},
|
||||
uninit: function() {
|
||||
if(OSRM.G.printwindow)
|
||||
OSRM.G.printwindow.close();
|
||||
},
|
||||
|
||||
windowLoaded: function(){
|
||||
OSRM.Printing.show( OSRM.G.response );
|
||||
OSRM.printwindow.focus();
|
||||
},
|
||||
|
||||
// switch printer button on/off
|
||||
activate: function() { // use showing route description as trigger
|
||||
if( document.getElementById("gui-printer-inactive") )
|
||||
document.getElementById("gui-printer-inactive").id = "gui-printer";
|
||||
},
|
||||
deactivate: function() { // use hide route as trigger
|
||||
if( document.getElementById("gui-printer") )
|
||||
document.getElementById("gui-printer").id = "gui-printer-inactive";
|
||||
},
|
||||
|
||||
|
||||
// create UI in printwindow
|
||||
show: function(response) {
|
||||
// create header
|
||||
header =
|
||||
var header;
|
||||
if( OSRM.Browser.IE6_8 ) { // tables used for compatibility with legacy IE (quirks mode)
|
||||
header =
|
||||
'<thead class="description-header"><tr><td colspan="3">' +
|
||||
|
||||
'<table class="full">' +
|
||||
'<tr class="row">' +
|
||||
|
||||
'<td class="left stretch">' +
|
||||
'<table class="full">' +
|
||||
'<tr class="row">' +
|
||||
'<td class="left description-header-label">' + OSRM.loc("GUI_START")+ ': </td>' +
|
||||
'<td class="left description-header-content stretch">' + document.getElementById("gui-input-source").value + '</td>' +
|
||||
'</tr>' +
|
||||
'<tr class="row">' +
|
||||
'<td class="left description-header-label">' + OSRM.loc("GUI_END")+ ': </td>' +
|
||||
'<td class="left description-header-content stretch">' + document.getElementById("gui-input-target").value + '</td>' +
|
||||
'</tr>' +
|
||||
'</table>' +
|
||||
'</td>' +
|
||||
|
||||
'<td class="left">' +
|
||||
'<table class="full">' +
|
||||
'<tr class="row">' +
|
||||
'<td class="left description-header-label">' + OSRM.loc("DISTANCE")+': </td>' +
|
||||
'<td class="left description-header-content">' + OSRM.Utils.toHumanDistance(response.route_summary.total_distance) + '</td>' +
|
||||
'</tr>' +
|
||||
'<tr class="row">' +
|
||||
'<td class="left description-header-label">' + OSRM.loc("DURATION")+': </td>' +
|
||||
'<td class="left description-header-content">' + OSRM.Utils.toHumanTime(response.route_summary.total_time) + '</td>' +
|
||||
'</tr>' +
|
||||
'</table>' +
|
||||
'</td>' +
|
||||
|
||||
'</tr>' +
|
||||
'</table>' +
|
||||
|
||||
'<div class="quad"></div>' +
|
||||
'</td></tr></thead>';
|
||||
} else {
|
||||
header =
|
||||
'<thead class="description-header"><tr><td colspan="3">' +
|
||||
|
||||
'<div class="full">' +
|
||||
'<div class="left">' +
|
||||
'<div class="header-title base-font">' + OSRM.loc("ROUTE_DESCRIPTION") + '</div>' +
|
||||
'<div class="header-content">' + OSRM.loc("DISTANCE")+": " + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '</div>' +
|
||||
'<div class="header-content">' + OSRM.loc("DURATION")+": " + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '</div>' +
|
||||
'<div class="row">' +
|
||||
|
||||
'<div class="left stretch">' +
|
||||
'<div class="full">' +
|
||||
'<div class="row">' +
|
||||
'<div class="left description-header-label">' + OSRM.loc("GUI_START")+ ': </div>' +
|
||||
'<div class="left description-header-content stretch">' + document.getElementById("gui-input-source").value + '</div>' +
|
||||
'</div>' +
|
||||
'<div class="right">' +
|
||||
'<div class="row">' +
|
||||
'<div class="left description-header-label">' + OSRM.loc("GUI_END")+ ': </div>' +
|
||||
'<div class="left description-header-content stretch">' + document.getElementById("gui-input-target").value + '</div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
|
||||
// create route description
|
||||
var route_desc = '';
|
||||
route_desc += '<table id="thetable" class="results-table medium-font">';
|
||||
route_desc += '<thead style="display:table-header-group;"><tr><td colspan="3">'+header+'</td></tr></thead>';
|
||||
route_desc += '</thead>';
|
||||
route_desc += '<tbody stlye="display:table-row-group">';
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
|
||||
'<div class="left">' +
|
||||
'<div class="full">' +
|
||||
'<div class="row">' +
|
||||
'<div class="left description-header-label">' + OSRM.loc("DISTANCE")+': </div>' +
|
||||
'<div class="left description-header-content">' + OSRM.Utils.toHumanDistance(response.route_summary.total_distance) + '</div>' +
|
||||
'</div>' +
|
||||
'<div class="row">' +
|
||||
'<div class="left description-header-label">' + OSRM.loc("DURATION")+': </div>' +
|
||||
'<div class="left description-header-content">' + OSRM.Utils.toHumanTime(response.route_summary.total_time) + '</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
|
||||
'<div class="quad"></div>' +
|
||||
'</td></tr></thead>';
|
||||
}
|
||||
|
||||
// create route description
|
||||
var body = '<tbody class="description-body">';
|
||||
for(var i=0; i < response.route_instructions.length; i++){
|
||||
//odd or even ?
|
||||
var rowstyle='results-odd';
|
||||
if(i%2==0) { rowstyle='results-even'; }
|
||||
var rowstyle='description-body-odd';
|
||||
if(i%2==0) { rowstyle='description-body-even'; }
|
||||
|
||||
route_desc += '<tr class="'+rowstyle+'">';
|
||||
body += '<tr class="'+rowstyle+'">';
|
||||
|
||||
route_desc += '<td class="result-directions">';
|
||||
route_desc += '<img width="18px" src="'+OSRM.RoutingDescription.getDrivingInstructionIcon(response.route_instructions[i][0])+'" alt="" />';
|
||||
route_desc += "</td>";
|
||||
|
||||
route_desc += '<td class="result-items">';
|
||||
route_desc += '<div class="result-item">';
|
||||
body += '<td class="description-body-directions">';
|
||||
body += '<img class="description-body-direction" src="'+OSRM.Printing.BASE_DIRECTORY+OSRM.RoutingDescription._getDrivingInstructionIcon(response.route_instructions[i][0])+'" alt="" />';
|
||||
body += "</td>";
|
||||
|
||||
// build route description
|
||||
if( i == 0 )
|
||||
route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, OSRM.loc(response.route_instructions[i][6]) );
|
||||
else if( response.route_instructions[i][1] != "" )
|
||||
route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]);
|
||||
body += '<td class="description-body-items">';
|
||||
if( response.route_instructions[i][1] != "" )
|
||||
body += OSRM.loc(OSRM.RoutingDescription._getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]).replace(/%d/, OSRM.loc(response.route_instructions[i][6]));
|
||||
else
|
||||
route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"");
|
||||
|
||||
route_desc += '</div>';
|
||||
route_desc += "</td>";
|
||||
body += OSRM.loc(OSRM.RoutingDescription._getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"").replace(/%d/, OSRM.loc(response.route_instructions[i][6]));
|
||||
body += "</td>";
|
||||
|
||||
route_desc += '<td class="result-distance">';
|
||||
if( i != response.route_instructions.length-1 )
|
||||
route_desc += '<b>'+OSRM.Utils.metersToDistance(response.route_instructions[i][2])+'</b>';
|
||||
route_desc += "</td>";
|
||||
body += '<td class="description-body-distance">';
|
||||
body += (i == response.route_instructions.length-1) ? ' ' : '<b>'+OSRM.Utils.toHumanDistance(response.route_instructions[i][2])+'</b>'; // fill last entry with a space
|
||||
body += "</td>";
|
||||
|
||||
route_desc += "</tr>";
|
||||
body += "</tr>";
|
||||
}
|
||||
route_desc += '</tbody>';
|
||||
route_desc += '</table>';
|
||||
body += '</tbody>';
|
||||
|
||||
// put everything in DOM
|
||||
OSRM.printwindow.document.getElementById('description').innerHTML = route_desc;
|
||||
var print_window = OSRM.G.printwindow;
|
||||
print_window.document.getElementById('description').innerHTML = '<table class="description medium-font">' + header + body + '</table>';
|
||||
print_window.document.getElementById('overview-map-description').innerHTML = '<table class="description medium-font">' + header + '</table>';
|
||||
|
||||
// init map
|
||||
var map = OSRM.printwindow.initialize();
|
||||
var markers = OSRM.G.markers.route;
|
||||
map.addLayer( new L.MouseMarker( markers[0].getPosition(), {draggable:false,clickable:false,icon:OSRM.G.icons['marker-source']} ) );
|
||||
for(var i=1, size=markers.length-1; i<size; i++)
|
||||
map.addLayer( new L.MouseMarker( markers[i].getPosition(), {draggable:false,clickable:false,icon:OSRM.G.icons['marker-via']} ) );
|
||||
map.addLayer( new L.MouseMarker( markers[markers.length-1].getPosition(), {draggable:false,clickable:false,icon:OSRM.G.icons['marker-target']} ));
|
||||
var route = new L.DashedPolyline();
|
||||
route.setLatLngs( OSRM.G.route.getPositions() );
|
||||
route.setStyle( {dashed:false,clickable:false,color:'#0033FF', weight:5} );
|
||||
map.addLayer( route );
|
||||
var bounds = new L.LatLngBounds( OSRM.G.route.getPositions() );
|
||||
map.fitBounds( bounds );
|
||||
// draw map
|
||||
var positions = OSRM.G.route.getPositions();
|
||||
var tile_server_id = OSRM.G.map.getActiveLayerId();
|
||||
var zoom = print_window.OSRM.drawMap( OSRM.DEFAULTS.TILE_SERVERS[tile_server_id], new L.LatLngBounds( positions ) );
|
||||
|
||||
// draw markers
|
||||
print_window.OSRM.prefetchIcons( OSRM.G.images );
|
||||
print_window.OSRM.drawMarkers( OSRM.G.markers.route );
|
||||
|
||||
// draw route & query for better geometry
|
||||
print_window.OSRM.drawRoute( positions );
|
||||
OSRM.JSONP.call(OSRM.Routing._buildCall()+'&z='+zoom+'&instructions=false', OSRM.Printing.drawRoute, OSRM.Printing.timeoutRoute, OSRM.DEFAULTS.JSONP_TIMEOUT, 'print');
|
||||
// NOTE: correct zoom level was appended as second zoom parameter to JSONP call -> OSRM API only considers the last one!
|
||||
},
|
||||
timeoutRoute: function() {},
|
||||
drawRoute: function(response) {
|
||||
if(!response)
|
||||
return;
|
||||
|
||||
response.alternative_geometries.unshift( response.route_geometry );
|
||||
if( OSRM.G.active_alternative >= response.alternative_geometries.length ) // no redraw if the selected alternative cannot be found
|
||||
return;
|
||||
positions = OSRM.RoutingGeometry._decode( response.alternative_geometries[ OSRM.G.active_alternative ], 5 );
|
||||
OSRM.G.printwindow.OSRM.drawRoute( positions );
|
||||
},
|
||||
|
||||
// react to click
|
||||
print: function() {
|
||||
OSRM.printwindow = window.open("printing/printing.html","","width=540,height=500,left=100,top=100,dependent=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes");
|
||||
OSRM.printwindow.addEventListener("DOMContentLoaded", OSRM.Printing.windowLoaded, false);
|
||||
|
||||
// opens the print window and closes old instances
|
||||
openPrintWindow: function() {
|
||||
// do not open window if there is no route to draw (should never trigger!)
|
||||
if( !OSRM.G.route.isRoute() || !OSRM.G.route.isShown() )
|
||||
return;
|
||||
|
||||
// close old window (should we really do this?)
|
||||
if( OSRM.G.printwindow )
|
||||
OSRM.G.printwindow.close();
|
||||
|
||||
// generate a new window and wait till it has finished loading
|
||||
OSRM.G.printwindow = window.open( OSRM.Printing.DIRECTORY + "printing.html","","width=540,height=500,left=100,top=100,dependent=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes");
|
||||
},
|
||||
|
||||
|
||||
// add content to printwindow after it has finished loading
|
||||
printWindowLoaded: function(){
|
||||
var print_window = OSRM.G.printwindow;
|
||||
var print_document = print_window.document;
|
||||
|
||||
// add css images
|
||||
var css_list = [
|
||||
{ id:'#gui-printer-inactive', image_id:'printer_inactive'},
|
||||
{ id:'#gui-printer', image_id:'printer'},
|
||||
{ id:'#gui-printer:hover', image_id:'printer_hover'},
|
||||
{ id:'#gui-printer:active', image_id:'printer_active'}
|
||||
];
|
||||
var stylesheet = OSRM.CSS.getStylesheet("printing.css", print_document);
|
||||
for(var i=0; i<css_list.length; i++) {
|
||||
OSRM.CSS.insert( stylesheet, css_list[i].id, "background-image:url("+ OSRM.Printing.BASE_DIRECTORY + OSRM.G.images[css_list[i].image_id].getAttribute("src") + ");" );
|
||||
}
|
||||
|
||||
// localization
|
||||
print_window.OSRM.Localization.current_language = OSRM.Localization.current_language;
|
||||
print_document.getElementById('description-label').innerHTML = OSRM.loc( "ROUTE_DESCRIPTION" );
|
||||
print_document.getElementById('overview-map-label').innerHTML = OSRM.loc( "OVERVIEW_MAP" );
|
||||
if( !OSRM.G.route.isRoute() || !OSRM.G.route.isShown() ) { // error message if no route available (can trigger if user refreshes print-window)
|
||||
print_document.getElementById("description").innerHTML = OSRM.loc("NO_ROUTE_SELECTED");
|
||||
return;
|
||||
}
|
||||
|
||||
// add routing content
|
||||
OSRM.Printing.show( OSRM.G.response );
|
||||
|
||||
// add events
|
||||
print_document.getElementById("gui-printer-inactive").id = "gui-printer";
|
||||
print_document.getElementById('gui-printer').onclick = print_window.printWindow;
|
||||
|
||||
// finally, focus on printwindow
|
||||
print_window.focus();
|
||||
}
|
||||
|
||||
};
|
||||
@@ -17,103 +17,34 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
|
||||
/* OSRM CSS styles for printing*/
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* page setup */
|
||||
body
|
||||
{
|
||||
margin: 8px;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* route description box */
|
||||
#description
|
||||
{
|
||||
width:500px;
|
||||
margin:5px;
|
||||
}
|
||||
|
||||
|
||||
/* route map box */
|
||||
#map
|
||||
{
|
||||
width:500px;
|
||||
height:500px;
|
||||
margin:5px;
|
||||
}
|
||||
|
||||
|
||||
/* styles for information-box-header */
|
||||
div.header-title
|
||||
{
|
||||
font-weight:bold;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
.header-content
|
||||
{
|
||||
font-weight:normal;
|
||||
}
|
||||
.result-link
|
||||
{
|
||||
color:#0000ff;
|
||||
text-decoration:none;
|
||||
cursor:pointer;
|
||||
}
|
||||
.result-link:hover
|
||||
{
|
||||
color:#ff0000;
|
||||
}
|
||||
|
||||
|
||||
/* style for information-box table (search results, driving directions) */
|
||||
.results-table
|
||||
{
|
||||
border-spacing:0px;
|
||||
width:100%;
|
||||
}
|
||||
.results-odd
|
||||
{
|
||||
background-color: #FFFDE3;
|
||||
}
|
||||
.results-even
|
||||
{
|
||||
background-color: #FFF9BB;
|
||||
}
|
||||
.result-counter
|
||||
{
|
||||
text-align:right;
|
||||
vertical-align:top;
|
||||
font-weight:bold;
|
||||
padding:1px 5px 1px 5px;
|
||||
}
|
||||
.result-items
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
width:100%;
|
||||
padding:1px;
|
||||
}
|
||||
.result-directions
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
padding:1px 5px 1px 5px;
|
||||
}
|
||||
.result-distance
|
||||
{
|
||||
text-align:right;
|
||||
vertical-align: middle;
|
||||
padding:1px 1px 1px 5px;
|
||||
}
|
||||
.result-item
|
||||
{
|
||||
cursor:pointer;
|
||||
color:#000000
|
||||
}
|
||||
.no-results
|
||||
/* changes/additions to leaflet styles */
|
||||
.via-counter
|
||||
{
|
||||
position:absolute;
|
||||
top:-3px;
|
||||
right:-6px;
|
||||
width:16px;
|
||||
border-radius:5px;
|
||||
-moz-border-radius:5px;
|
||||
-webkit-border-radius:5px;
|
||||
background-color:#FFFFFF;
|
||||
text-align:center;
|
||||
margin:28px;
|
||||
vertical-align:middle;
|
||||
font-size:9px;
|
||||
display:none;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* header area */
|
||||
#printing-header
|
||||
@@ -123,31 +54,101 @@ div.header-title
|
||||
top:0px;
|
||||
height:20px;
|
||||
}
|
||||
.top-left-button
|
||||
{
|
||||
float:left;
|
||||
}
|
||||
.top-right-button
|
||||
{
|
||||
float:right;
|
||||
vertical-align:top;
|
||||
}
|
||||
|
||||
|
||||
/* utility styles */
|
||||
/* content area */
|
||||
div.label
|
||||
{
|
||||
font-weight:bold;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
.box
|
||||
{
|
||||
width:500px;
|
||||
margin:5px;
|
||||
}
|
||||
#overview-map
|
||||
{
|
||||
width:500px;
|
||||
height:500px;
|
||||
margin:5px;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* description content */
|
||||
.description
|
||||
{
|
||||
border-spacing:0px;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
/* styles for description header */
|
||||
.description-header
|
||||
{
|
||||
display:table-header-group;
|
||||
}
|
||||
.description-header-label
|
||||
{
|
||||
padding:0px 5px 0px 0px;
|
||||
}
|
||||
.description-header-content
|
||||
{
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
|
||||
/* styles for description body */
|
||||
.description-body
|
||||
{
|
||||
display:table-row-group;
|
||||
}
|
||||
.description-body-odd
|
||||
{
|
||||
background-color: #FFFDE3;
|
||||
}
|
||||
.description-body-even
|
||||
{
|
||||
background-color: #FFF9BB;
|
||||
}
|
||||
.description-body-items
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
width:100%;
|
||||
padding:1px;
|
||||
}
|
||||
.description-body-directions
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
padding:1px 5px 1px 5px;
|
||||
}
|
||||
.description-body-direction
|
||||
{
|
||||
height:36px;
|
||||
width:36px;
|
||||
}
|
||||
.description-body-distance
|
||||
{
|
||||
text-align:right;
|
||||
vertical-align: middle;
|
||||
padding:1px 1px 1px 5px;
|
||||
}
|
||||
@media print {
|
||||
.quad
|
||||
.description-body-even > td,
|
||||
.description-body-odd > td
|
||||
{
|
||||
page-break-before:always;
|
||||
}
|
||||
}
|
||||
@media screen {
|
||||
.quad
|
||||
{
|
||||
min-width:10px;
|
||||
min-height:10px;
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* iconic buttons */
|
||||
.iconic-button
|
||||
@@ -159,23 +160,69 @@ div.header-title
|
||||
background-position:center;
|
||||
}
|
||||
|
||||
#gui-printer
|
||||
#gui-printer-inactive
|
||||
{
|
||||
background-image:url("../images/printer.png");
|
||||
}
|
||||
#gui-printer:hover
|
||||
{
|
||||
background-image:url("../images/printer_hover.png");
|
||||
}
|
||||
#gui-printer:active
|
||||
{
|
||||
background-image:url("../images/printer_active.png");
|
||||
cursor:default;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* utility styles */
|
||||
.quad
|
||||
{
|
||||
min-width:10px;
|
||||
min-height:10px;
|
||||
}
|
||||
@media print {
|
||||
.pagebreak
|
||||
{
|
||||
page-break-after:always;
|
||||
}
|
||||
.noprint
|
||||
{
|
||||
display:none;
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* table */
|
||||
.full
|
||||
{
|
||||
display:table;
|
||||
width:100%;
|
||||
}
|
||||
.row
|
||||
{
|
||||
display:table-row;
|
||||
}
|
||||
.left
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:left;
|
||||
vertical-align:top;
|
||||
}
|
||||
.right
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:right;
|
||||
vertical-align:top;
|
||||
}
|
||||
.center
|
||||
{
|
||||
display:table-cell;
|
||||
text-align:center;
|
||||
vertical-align:top;
|
||||
}
|
||||
.stretch
|
||||
{
|
||||
width:100%;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* fonts */
|
||||
@media print {
|
||||
|
||||
@media print {
|
||||
.base-font {
|
||||
font-family: Times New Roman, Times, serif;
|
||||
font-size: 16px;
|
||||
@@ -196,23 +243,22 @@ div.header-title
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media screen {
|
||||
.base-font {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
font-size: 13px;
|
||||
font-weight: normal;
|
||||
}
|
||||
.big-font {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 14px;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.medium-font {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 10.5px;
|
||||
font-size: 11px;
|
||||
font-weight: normal;
|
||||
}
|
||||
.small-font {
|
||||
|
||||
@@ -28,9 +28,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
<title>OSRM Website</title>
|
||||
<meta name="description" content="OSRM Website"/>
|
||||
<meta name="author" content="Dennis Schieferdecker" />
|
||||
|
||||
<!-- favicon -->
|
||||
<link rel="shortcut icon" href="../images/osrm-favicon.ico" type="image/x-icon" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=7,9" /> <!-- use quirks mode to correctly print the map in IE8 -->
|
||||
|
||||
<!-- stylesheets -->
|
||||
<link rel="stylesheet" href="../leaflet/leaflet.css" type="text/css"/>
|
||||
@@ -39,37 +37,12 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
|
||||
<!-- scripts -->
|
||||
<script src="../leaflet/leaflet-src.js" type="text/javascript"></script>
|
||||
|
||||
<script>
|
||||
function initialize() {
|
||||
// setup events
|
||||
document.getElementById('gui-printer').onclick= printsite;
|
||||
|
||||
// setup map
|
||||
var osmorgURL = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
osmorgOptions = {maxZoom: 18};
|
||||
var osmorg = new L.TileLayer(osmorgURL, osmorgOptions);
|
||||
var temp1 = new L.Map("map", {
|
||||
center: new L.LatLng(51.505, -0.09),
|
||||
zoom: 13,
|
||||
zoomAnimation: false,
|
||||
fadeAnimation: false,
|
||||
layers: [osmorg],
|
||||
attributionControl: false,
|
||||
zoomControl: false,
|
||||
dragging:false,
|
||||
scrollWheelZoom:false,
|
||||
touchZoom:false,
|
||||
doubleClickZoom:false
|
||||
});
|
||||
return temp1;
|
||||
}
|
||||
|
||||
function printsite() {
|
||||
window.print();
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="printing.js" type="text/javascript"></script>
|
||||
<script src="../base/leaflet/L.DashedPolyline.js" type="text/javascript"></script>
|
||||
<script src="../base/leaflet/L.MouseMarker.js" type="text/javascript"></script>
|
||||
<script src="../base/leaflet/L.SwitchableIcon.js" type="text/javascript"></script>
|
||||
<script src="../base/leaflet/L.TileLayer.Bing.js" type="text/javascript"></script>
|
||||
<script src="../base/osrm/OSRM.MapView.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
||||
|
||||
@@ -77,17 +50,21 @@ function printsite() {
|
||||
<body class="base-font">
|
||||
|
||||
<!-- header -->
|
||||
<div id="printing-header">
|
||||
<div id="gui-printer" class="iconic-button top-right-button"></div>
|
||||
<div id="printing-header" class="noprint">
|
||||
<div id="gui-printer-inactive" class="iconic-button top-right-button"></div>
|
||||
</div>
|
||||
|
||||
<!--description-->
|
||||
<div id="description"></div>
|
||||
<div id="description-label" class="label"></div>
|
||||
<div id="description" class="box"></div>
|
||||
|
||||
<!--map-->
|
||||
<div class="quad"></div>
|
||||
<div class="header-title">Übersichtskarte</div>
|
||||
<div id="map"></div>
|
||||
<div class="pagebreak"> </div>
|
||||
<div class="quad noprint"></div>
|
||||
<div class="quad noprint"></div>
|
||||
<div id="overview-map-label" class="label"></div>
|
||||
<div id="overview-map-description" class="box"></div>
|
||||
<div id="overview-map"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM initialization
|
||||
// [for printing window]
|
||||
|
||||
OSRM = {};
|
||||
OSRM.GLOBALS = { main_handle:{boxVisible:function(){return false;}} }; // needed for fitBoundsUI to work
|
||||
OSRM.Localization = { current_language:"en"}; // needed for localized map tiles
|
||||
OSRM.G = OSRM.GLOBALS;
|
||||
|
||||
|
||||
//print the window
|
||||
function printWindow() {
|
||||
window.print();
|
||||
}
|
||||
|
||||
|
||||
//prefetch icons
|
||||
OSRM.GLOBALS.icons = {};
|
||||
OSRM.prefetchIcons = function(images_list) {
|
||||
var icon_list = [ {id:'marker-source', image_id:'marker-source'},
|
||||
{id:'marker-target', image_id:'marker-target'},
|
||||
{id:'marker-via', image_id:'marker-via'},
|
||||
{id:'marker-highlight', image_id:'marker-highlight'}
|
||||
];
|
||||
|
||||
for(var i=0; i<icon_list.length; i++) {
|
||||
var icon = {
|
||||
// absolute directories used for compatibility with legacy IE (quirks mode)
|
||||
iconUrl: images_list[icon_list[i].image_id].src, iconSize: new L.Point(25, 41), iconAnchor: new L.Point(13, 41),
|
||||
shadowUrl: images_list["marker-shadow"].src, shadowSize: new L.Point(41, 41),
|
||||
popupAnchor: new L.Point(0, -33)
|
||||
};
|
||||
OSRM.G.icons[icon_list[i].id] = new L.SwitchableIcon(icon);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// function to initialize a map in the new window
|
||||
OSRM.drawMap = function(tile_server, bounds) {
|
||||
// setup map
|
||||
var tile_layer;
|
||||
if( tile_server.bing ) tile_layer = new L.TileLayer.Bing(tile_server.apikey, tile_server.type, tile_server.options);
|
||||
else tile_layer = new L.TileLayer(tile_server.url, tile_server.options);
|
||||
OSRM.G.map = new OSRM.MapView("overview-map", {
|
||||
center: new L.LatLng(48.84, 10.10),
|
||||
zoom: 13,
|
||||
zoomAnimation: false,
|
||||
fadeAnimation: false,
|
||||
layers: [tile_layer],
|
||||
attributionControl: false,
|
||||
zoomControl: false,
|
||||
dragging:false,
|
||||
scrollWheelZoom:false,
|
||||
touchZoom:false,
|
||||
doubleClickZoom:false
|
||||
});
|
||||
|
||||
OSRM.G.map.fitBoundsUI(bounds);
|
||||
return OSRM.G.map.getBoundsZoom(bounds);
|
||||
};
|
||||
|
||||
|
||||
// manage makers
|
||||
OSRM.drawMarkers = function( markers ) {
|
||||
OSRM.G.map.addLayer( new L.MouseMarker( markers[0].getPosition(), {draggable:false,clickable:false,icon:OSRM.G.icons['marker-source']} ) );
|
||||
for(var i=1, size=markers.length-1; i<size; i++) {
|
||||
var via_marker = new L.MouseMarker( markers[i].getPosition(), {draggable:false,clickable:false,icon:OSRM.G.icons['marker-via']} );
|
||||
OSRM.G.map.addLayer( via_marker );
|
||||
via_marker.setLabel(i);
|
||||
}
|
||||
OSRM.G.map.addLayer( new L.MouseMarker( markers[markers.length-1].getPosition(), {draggable:false,clickable:false,icon:OSRM.G.icons['marker-target']} ) );
|
||||
};
|
||||
|
||||
|
||||
// manage route
|
||||
OSRM.drawRoute = function( positions ) {
|
||||
if( OSRM.G.route == undefined )
|
||||
OSRM.G.route = new L.DashedPolyline();
|
||||
OSRM.G.route.setLatLngs( positions );
|
||||
OSRM.G.route.setStyle( {dashed:false,clickable:false,color:'#0033FF', weight:5} );
|
||||
OSRM.G.map.addLayer( OSRM.G.route );
|
||||
};
|
||||
OSRM.updateRoute = function( positions ) {
|
||||
OSRM.G.route.setLatLngs( positions );
|
||||
};
|
||||
|
||||
|
||||
// start populating the window when it is fully loaded - and only if it was loaded from OSRM
|
||||
if(window.opener && window.opener.OSRM)
|
||||
window.opener.OSRM.Browser.onLoadHandler( window.opener.OSRM.Printing.printWindowLoaded, window );
|
||||
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
/* OSRM CSS styles for printing*/
|
||||
|
||||
|
||||
/* printer button */
|
||||
.printer-inactive
|
||||
{
|
||||
cursor:pointer;
|
||||
width:16px;
|
||||
height:16px;
|
||||
background-image:url("../images/printer_inactive.png");
|
||||
}
|
||||
.printer
|
||||
{
|
||||
cursor:pointer;
|
||||
width:16px;
|
||||
height:16px;
|
||||
background-image:url("../images/printer.png");
|
||||
}
|
||||
.printer:hover
|
||||
{
|
||||
background-image:url("../images/printer_hover.png");
|
||||
}
|
||||
.printer:active
|
||||
{
|
||||
background-image:url("../images/printer_active.png");
|
||||
}
|
||||
|
||||
/* route summary */
|
||||
.route-summary
|
||||
{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* route description box */
|
||||
#description
|
||||
{
|
||||
position:absolute;
|
||||
bottom:15px;
|
||||
top:60px;
|
||||
width:380px;
|
||||
font-size:12px;
|
||||
margin:5px;
|
||||
}
|
||||
.results-table
|
||||
{
|
||||
border-spacing:0px;
|
||||
}
|
||||
.results-odd
|
||||
{
|
||||
background-color: #FAF3E9; //#ffffff;
|
||||
}
|
||||
.results-even
|
||||
{
|
||||
background-color: #F2DE9C; //#ffffe0;
|
||||
}
|
||||
.result-items
|
||||
{
|
||||
text-align:left;
|
||||
vertical-align: middle;
|
||||
width:100%;
|
||||
padding-left:1px;
|
||||
padding-right:1px;
|
||||
padding-top:1px;
|
||||
padding-bottom:1px;
|
||||
}
|
||||
.result-direction
|
||||
{
|
||||
width:30px;
|
||||
padding-left:1px;
|
||||
padding-right:1px;
|
||||
padding-top:1px;
|
||||
padding-bottom:1px;
|
||||
}
|
||||
.result-distance
|
||||
{
|
||||
text-align:right;
|
||||
vertical-align: middle;
|
||||
width:30px;
|
||||
padding-left:1px;
|
||||
padding-right:1px;
|
||||
padding-top:1px;
|
||||
padding-bottom:1px;
|
||||
}
|
||||
.result-item
|
||||
{
|
||||
cursor:pointer;
|
||||
color:#000000
|
||||
}
|
||||
@@ -25,37 +25,67 @@ OSRM.GLOBALS.markers = null;
|
||||
OSRM.GLOBALS.dragging = null;
|
||||
OSRM.GLOBALS.dragid = null;
|
||||
OSRM.GLOBALS.pending = false;
|
||||
OSRM.GLOBALS.pendingTimer = null;
|
||||
|
||||
|
||||
OSRM.Routing = {
|
||||
|
||||
// init routing data structures
|
||||
init: function() {
|
||||
OSRM.G.markers = new OSRM.Markers();
|
||||
OSRM.G.route = new OSRM.Route();
|
||||
OSRM.G.markers = new OSRM.Markers();
|
||||
OSRM.G.response = { via_points:[] };
|
||||
},
|
||||
|
||||
|
||||
// -- JSONP processing --
|
||||
|
||||
// process JSONP response of routing server
|
||||
timeoutRouteSimple: function() {
|
||||
OSRM.RoutingGeometry.showNA();
|
||||
OSRM.RoutingDescription.showNA( OSRM.loc("TIMED_OUT") );
|
||||
},
|
||||
timeoutRoute: function() {
|
||||
OSRM.RoutingGeometry.showNA();
|
||||
OSRM.RoutingNoNames.showNA();
|
||||
OSRM.RoutingDescription.showNA( OSRM.loc("TIMED_OUT") );
|
||||
OSRM.Routing._snapRoute();
|
||||
},
|
||||
showRouteSimple: function(response) {
|
||||
timeoutRoute_Dragging: function() {
|
||||
OSRM.RoutingGeometry.showNA();
|
||||
OSRM.RoutingDescription.showNA( OSRM.loc("TIMED_OUT") );
|
||||
},
|
||||
timeoutRoute_Reversed: function() {
|
||||
OSRM.G.markers.reverseMarkers();
|
||||
OSRM.Routing.timeoutRoute();
|
||||
},
|
||||
showRoute: function(response, parameters) {
|
||||
if(!response)
|
||||
return;
|
||||
if( parameters.keepAlternative != true )
|
||||
OSRM.G.active_alternative = 0;
|
||||
|
||||
OSRM.G.response = response; // needed for printing & history routes!
|
||||
if(response.status == 207) {
|
||||
OSRM.RoutingGeometry.showNA();
|
||||
OSRM.RoutingNoNames.showNA();
|
||||
OSRM.RoutingDescription.showNA( OSRM.loc("NO_ROUTE_FOUND") );
|
||||
OSRM.Routing._snapRoute();
|
||||
} else {
|
||||
OSRM.RoutingAlternatives.prepare(OSRM.G.response);
|
||||
OSRM.RoutingGeometry.show(OSRM.G.response);
|
||||
OSRM.RoutingNoNames.show(OSRM.G.response);
|
||||
OSRM.RoutingDescription.show(OSRM.G.response);
|
||||
OSRM.Routing._snapRoute();
|
||||
}
|
||||
OSRM.Routing._updateHints(response);
|
||||
if( parameters.recenter == true ) { // allow recentering when the route is first shown
|
||||
var bounds = new L.LatLngBounds( OSRM.G.route._current_route.getPositions() );
|
||||
OSRM.G.map.setViewBoundsUI(bounds);
|
||||
}
|
||||
},
|
||||
showRoute_Dragging: function(response) {
|
||||
if(!response)
|
||||
return;
|
||||
if( !OSRM.G.dragging ) // prevent simple routing when no longer dragging
|
||||
if( !OSRM.G.dragging ) // prevent simple routing when not dragging (required as there can be drag events after a dragstop event!)
|
||||
return;
|
||||
|
||||
|
||||
OSRM.G.response = response; // needed for history routes!
|
||||
if( response.status == 207) {
|
||||
OSRM.RoutingGeometry.showNA();
|
||||
OSRM.RoutingDescription.showNA( OSRM.loc("YOUR_ROUTE_IS_BEING_COMPUTED") );
|
||||
@@ -66,60 +96,78 @@ showRouteSimple: function(response) {
|
||||
OSRM.Routing._updateHints(response);
|
||||
|
||||
if(OSRM.G.pending)
|
||||
OSRM.G.pendingTimer = setTimeout(OSRM.Routing.draggingTimeout,1);
|
||||
setTimeout(OSRM.Routing.draggingTimeout,1);
|
||||
},
|
||||
showRoute: function(response) {
|
||||
showRoute_Redraw: function(response, parameters) {
|
||||
if(!response)
|
||||
return;
|
||||
if( parameters.keepAlternative == false )
|
||||
OSRM.G.active_alternative = 0;
|
||||
|
||||
OSRM.G.response = response;
|
||||
OSRM.G.via_points = response.via_points.slice(0);
|
||||
if(response.status == 207) {
|
||||
OSRM.RoutingGeometry.showNA();
|
||||
OSRM.RoutingNoNames.showNA();
|
||||
OSRM.RoutingDescription.showNA( OSRM.loc("NO_ROUTE_FOUND") );
|
||||
OSRM.Routing._snapRoute();
|
||||
} else {
|
||||
OSRM.RoutingGeometry.show(response);
|
||||
OSRM.RoutingNoNames.show(response);
|
||||
OSRM.RoutingDescription.show(response);
|
||||
OSRM.Routing._snapRoute();
|
||||
OSRM.G.response = response; // not needed, even harmful as important information is not stored! ==> really ????
|
||||
if(response.status != 207) {
|
||||
OSRM.RoutingAlternatives.prepare(OSRM.G.response);
|
||||
OSRM.RoutingGeometry.show(OSRM.G.response);
|
||||
OSRM.RoutingNoNames.show(OSRM.G.response);
|
||||
}
|
||||
OSRM.Routing._updateHints(response);
|
||||
},
|
||||
|
||||
|
||||
|
||||
//-- main function --
|
||||
|
||||
//generate server calls to query routes
|
||||
getRoute: function() {
|
||||
|
||||
getRoute: function(parameters) {
|
||||
// if source or target are not set -> hide route
|
||||
if( OSRM.G.markers.route.length < 2 ) {
|
||||
OSRM.G.route.hideRoute();
|
||||
return;
|
||||
}
|
||||
|
||||
OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=true', OSRM.Routing.showRoute, OSRM.Routing.timeoutRoute, OSRM.DEFAULTS.JSONP_TIMEOUT, 'route');
|
||||
parameters = parameters || {};
|
||||
|
||||
OSRM.JSONP.clear('dragging');
|
||||
OSRM.JSONP.clear('redraw');
|
||||
OSRM.JSONP.clear('route');
|
||||
OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=true', OSRM.Routing.showRoute, OSRM.Routing.timeoutRoute, OSRM.DEFAULTS.JSONP_TIMEOUT, 'route', parameters);
|
||||
},
|
||||
getDragRoute: function() {
|
||||
OSRM.G.pending = !OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=false', OSRM.Routing.showRouteSimple, OSRM.Routing.timeoutRouteSimple, OSRM.DEFAULTS.JSONP_TIMEOUT, 'dragging');;
|
||||
getRoute_Reversed: function() {
|
||||
if( OSRM.G.markers.route.length < 2 )
|
||||
return;
|
||||
|
||||
OSRM.JSONP.clear('dragging');
|
||||
OSRM.JSONP.clear('redraw');
|
||||
OSRM.JSONP.clear('route');
|
||||
OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=true', OSRM.Routing.showRoute, OSRM.Routing.timeoutRoute_Reversed, OSRM.DEFAULTS.JSONP_TIMEOUT, 'route', {});
|
||||
},
|
||||
getRoute_Redraw: function(parameters) {
|
||||
if( OSRM.G.markers.route.length < 2 )
|
||||
return;
|
||||
|
||||
parameters = parameters || {};
|
||||
|
||||
OSRM.JSONP.clear('dragging');
|
||||
OSRM.JSONP.clear('redraw');
|
||||
OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=true', OSRM.Routing.showRoute_Redraw, OSRM.Routing.timeoutRoute, OSRM.DEFAULTS.JSONP_TIMEOUT, 'redraw',parameters);
|
||||
},
|
||||
getRoute_Dragging: function() {
|
||||
OSRM.G.pending = !OSRM.JSONP.call(OSRM.Routing._buildCall()+'&instructions=false', OSRM.Routing.showRoute_Dragging, OSRM.Routing.timeoutRoute_Dragging, OSRM.DEFAULTS.JSONP_TIMEOUT, 'dragging');;
|
||||
},
|
||||
draggingTimeout: function() {
|
||||
OSRM.G.markers.route[OSRM.G.dragid].hint = null;
|
||||
OSRM.Routing.getDragRoute();
|
||||
OSRM.Routing.getRoute_Dragging();
|
||||
},
|
||||
|
||||
_buildCall: function() {
|
||||
var source = OSRM.DEFAULTS.HOST_ROUTING_URL;
|
||||
source += '?z=' + OSRM.G.map.getZoom() + '&output=json&geomformat=cmp';
|
||||
source += '?z=' + OSRM.G.map.getZoom() + '&output=json&jsonp=%jsonp';
|
||||
if(OSRM.G.markers.checksum)
|
||||
source += '&checksum=' + OSRM.G.markers.checksum;
|
||||
for(var i=0,size=OSRM.G.markers.route.length; i<size; i++) {
|
||||
source += '&loc=' + OSRM.G.markers.route[i].getLat() + ',' + OSRM.G.markers.route[i].getLng();
|
||||
if( OSRM.G.markers.route[i].hint)
|
||||
source += '&hint=' + OSRM.G.markers.route[i].hint;
|
||||
var markers = OSRM.G.markers.route;
|
||||
for(var i=0,size=markers.length; i<size; i++) {
|
||||
source += '&loc=' + markers[i].getLat().toFixed(6) + ',' + markers[i].getLng().toFixed(6);
|
||||
if( markers[i].hint)
|
||||
source += '&hint=' + markers[i].hint;
|
||||
}
|
||||
return source;
|
||||
},
|
||||
@@ -137,15 +185,16 @@ _updateHints: function(response) {
|
||||
|
||||
// snap all markers to the received route
|
||||
_snapRoute: function() {
|
||||
var positions = OSRM.G.route.getPositions();
|
||||
|
||||
OSRM.G.markers.route[0].setPosition( positions[0] );
|
||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].setPosition( positions[positions.length-1] );
|
||||
for(var i=0; i<OSRM.G.via_points.length; i++)
|
||||
OSRM.G.markers.route[i+1].setPosition( new L.LatLng(OSRM.G.via_points[i][0], OSRM.G.via_points[i][1]) );
|
||||
var markers = OSRM.G.markers.route;
|
||||
var via_points = OSRM.G.response.via_points;
|
||||
|
||||
for(var i=0; i<via_points.length; i++)
|
||||
markers[i].setPosition( new L.LatLng(via_points[i][0], via_points[i][1]) );
|
||||
|
||||
OSRM.Geocoder.updateAddress(OSRM.C.SOURCE_LABEL);
|
||||
OSRM.Geocoder.updateAddress(OSRM.C.TARGET_LABEL);
|
||||
|
||||
OSRM.G.markers.relabelViaMarkers();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM routing alternatives
|
||||
// [everything about handling alternatives]
|
||||
|
||||
|
||||
OSRM.RoutingAlternatives = {
|
||||
|
||||
// data of gui buttons for alternativess
|
||||
_buttons: [
|
||||
{id:"gui-a", label:"A"},
|
||||
{id:"gui-b", label:"B"}
|
||||
],
|
||||
|
||||
// initialize required values
|
||||
init: function() {
|
||||
OSRM.G.active_alternative = 0;
|
||||
OSRM.G.alternative_count = 0;
|
||||
},
|
||||
|
||||
// restructure response data
|
||||
prepare: function(response) {
|
||||
// move best route to alternative array
|
||||
var the_response = OSRM.G.response;
|
||||
the_response.alternative_geometries.unshift( response.route_geometry );
|
||||
the_response.alternative_instructions.unshift( response.route_instructions );
|
||||
the_response.alternative_summaries.unshift( response.route_summary );
|
||||
|
||||
// update basic information
|
||||
OSRM.G.alternative_count = response.alternative_geometries.length;
|
||||
if( OSRM.G.active_alternative >= OSRM.G.alternative_count ) // reset if the selected alternative cannot be found
|
||||
OSRM.G.active_alternative = 0;
|
||||
|
||||
// switch data
|
||||
the_response.route_geometry = the_response.alternative_geometries[OSRM.G.active_alternative];
|
||||
the_response.route_instructions = the_response.alternative_instructions[OSRM.G.active_alternative];
|
||||
the_response.route_summary = the_response.alternative_summaries[OSRM.G.active_alternative];
|
||||
},
|
||||
|
||||
// switch active alternative and redraw buttons accordingly
|
||||
setActive: function(button_id) {
|
||||
// switch active alternative
|
||||
OSRM.G.active_alternative = button_id;
|
||||
|
||||
// redraw clickable buttons
|
||||
var buttons = OSRM.RoutingAlternatives._buttons;
|
||||
for(var i=0, size=OSRM.G.alternative_count; i<size; i++) {
|
||||
document.getElementById( buttons[i].id ).className = (button_id == i) ? "button-pressed top-right-button" : "button top-right-button";
|
||||
}
|
||||
// do nothing for non-clickable buttons
|
||||
},
|
||||
|
||||
//draw GUI and register click events
|
||||
show: function() {
|
||||
var buttons = OSRM.RoutingAlternatives._buttons;
|
||||
var data = "";
|
||||
// draw clickable buttons
|
||||
for(var i=0, size=OSRM.G.alternative_count; i<size; i++) {
|
||||
var distance = OSRM.Utils.toHumanDistance(OSRM.G.response.alternative_summaries[i].total_distance);
|
||||
var time = OSRM.Utils.toHumanTime(OSRM.G.response.alternative_summaries[i].total_time);
|
||||
var tooltip = OSRM.loc("DISTANCE")+": "+distance+" "+OSRM.loc("DURATION")+": "+time;
|
||||
var buttonClass = (i == OSRM.G.active_alternative) ? "button-pressed" : "button";
|
||||
data = '<a class="'+buttonClass+' top-right-button" id="'+buttons[i].id+'" title="'+tooltip+'">'+buttons[i].label+'</a>' + data;
|
||||
}
|
||||
// draw non-clickable buttons
|
||||
for(var i=OSRM.G.alternative_count, size=buttons.length; i<size; ++i) {
|
||||
data = '<a class="button-inactive top-right-button" id="'+buttons[i].id+'">'+buttons[i].label+'</a>' + data;
|
||||
}
|
||||
// add buttons to DOM
|
||||
document.getElementById('information-box-header').innerHTML = data + document.getElementById('information-box-header').innerHTML;
|
||||
|
||||
// add events
|
||||
for(var i=0, size=OSRM.G.alternative_count; i<size; i++) {
|
||||
document.getElementById(buttons[i].id).onclick = function (button_id) { return function() {OSRM.RoutingAlternatives._click(button_id); }; }(i) ;
|
||||
document.getElementById(buttons[i].id).onmouseover = function (button_id) { return function() {OSRM.RoutingAlternatives._mouseover(button_id); }; } (i);
|
||||
document.getElementById(buttons[i].id).onmouseout = function (button_id) { return function() {OSRM.RoutingAlternatives._mouseout(button_id); }; } (i);
|
||||
}
|
||||
},
|
||||
|
||||
// mouse events on buttons
|
||||
_click: function(button_id) {
|
||||
if( OSRM.G.active_alternative == button_id )
|
||||
return;
|
||||
OSRM.RoutingAlternatives.setActive(button_id);
|
||||
OSRM.G.route.hideAlternativeRoute();
|
||||
|
||||
// switch data
|
||||
var the_response = OSRM.G.response;
|
||||
the_response.route_geometry = the_response.alternative_geometries[button_id];
|
||||
the_response.route_instructions = the_response.alternative_instructions[button_id];
|
||||
the_response.route_summary = the_response.alternative_summaries[button_id];
|
||||
|
||||
// redraw route & data
|
||||
OSRM.RoutingGeometry.show(the_response);
|
||||
OSRM.RoutingNoNames.show(the_response);
|
||||
OSRM.RoutingDescription.show(the_response);
|
||||
},
|
||||
_mouseover: function(button_id) {
|
||||
if( OSRM.G.active_alternative == button_id )
|
||||
return;
|
||||
|
||||
var geometry = OSRM.RoutingGeometry._decode( OSRM.G.response.alternative_geometries[button_id], 5);
|
||||
OSRM.G.route.showAlternativeRoute(geometry);
|
||||
},
|
||||
_mouseout: function(button_id) {
|
||||
if( OSRM.G.active_alternative == button_id )
|
||||
return;
|
||||
|
||||
OSRM.G.route.hideAlternativeRoute();
|
||||
}
|
||||
|
||||
};
|
||||
@@ -22,20 +22,26 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
OSRM.RoutingDescription = {
|
||||
|
||||
// route description events
|
||||
onClickRouteDescription: function(geometry_index) {
|
||||
var positions = OSRM.G.route.getPositions();
|
||||
|
||||
OSRM.G.markers.highlight.setPosition( positions[geometry_index] );
|
||||
onClickRouteDescription: function(lat, lng) {
|
||||
OSRM.G.markers.highlight.setPosition( new L.LatLng(lat, lng) );
|
||||
OSRM.G.markers.highlight.show();
|
||||
OSRM.G.markers.highlight.centerView(OSRM.DEFAULTS.HIGHLIGHT_ZOOM_LEVEL);
|
||||
},
|
||||
onClickCreateShortcut: function(src){
|
||||
src += '&z='+ OSRM.G.map.getZoom() + '¢er=' + OSRM.G.map.getCenter().lat.toFixed(6) + ',' + OSRM.G.map.getCenter().lng.toFixed(6);
|
||||
OSRM.JSONP.call(OSRM.DEFAULTS.HOST_SHORTENER_URL+src, OSRM.RoutingDescription.showRouteLink, OSRM.RoutingDescription.showRouteLink_TimeOut, OSRM.DEFAULTS.JSONP_TIMEOUT, 'shortener');
|
||||
src += '&alt='+OSRM.G.active_alternative;
|
||||
src += '&df=' + OSRM.G.DISTANCE_FORMAT;
|
||||
|
||||
var source = OSRM.DEFAULTS.SHORTENER_PARAMETERS.replace(/%url/, OSRM.DEFAULTS.HOST_SHORTENER_URL+src);
|
||||
|
||||
OSRM.JSONP.call(source, OSRM.RoutingDescription.showRouteLink, OSRM.RoutingDescription.showRouteLink_TimeOut, OSRM.DEFAULTS.JSONP_TIMEOUT, 'shortener');
|
||||
document.getElementById('route-link').innerHTML = '['+OSRM.loc("GENERATE_LINK_TO_ROUTE")+']';
|
||||
},
|
||||
showRouteLink: function(response){
|
||||
document.getElementById('route-link').innerHTML = '[<a class="result-link text-selectable" href="' +response.ShortURL+ '">'+response.ShortURL+'</a>]';
|
||||
if(!response[OSRM.DEFAULTS.SHORTENER_REPLY_PARAMETER])
|
||||
OSRM.RoutingDescription.showRouteLink_TimeOut();
|
||||
else
|
||||
document.getElementById('route-link').innerHTML = '[<a class="route-link" href="' +response[OSRM.DEFAULTS.SHORTENER_REPLY_PARAMETER]+ '">'+response[OSRM.DEFAULTS.SHORTENER_REPLY_PARAMETER]+'</a>]';
|
||||
},
|
||||
showRouteLink_TimeOut: function(){
|
||||
document.getElementById('route-link').innerHTML = '['+OSRM.loc("LINK_TO_ROUTE_TIMEOUT")+']';
|
||||
@@ -43,86 +49,72 @@ showRouteLink_TimeOut: function(){
|
||||
|
||||
// handling of routing description
|
||||
show: function(response) {
|
||||
// activate GUI features that need a route
|
||||
OSRM.GUI.activateRouteFeatures();
|
||||
|
||||
// compute query string
|
||||
var query_string = '?rebuild=1';
|
||||
var query_string = '?hl=' + OSRM.Localization.current_language;
|
||||
for(var i=0; i<OSRM.G.markers.route.length; i++)
|
||||
query_string += '&loc=' + OSRM.G.markers.route[i].getLat().toFixed(6) + ',' + OSRM.G.markers.route[i].getLng().toFixed(6);
|
||||
|
||||
// create link to the route
|
||||
var route_link ='[<a class="result-link" onclick="OSRM.RoutingDescription.onClickCreateShortcut(\'' + OSRM.DEFAULTS.WEBSITE_URL + query_string + '\')">'+OSRM.loc("GET_LINK_TO_ROUTE")+'</a>]';
|
||||
var route_link ='[<a class="route-link" onclick="OSRM.RoutingDescription.onClickCreateShortcut(\'' + OSRM.DEFAULTS.WEBSITE_URL + query_string + '\')">'+OSRM.loc("GET_LINK_TO_ROUTE")+'</a>]';
|
||||
|
||||
// create GPX link
|
||||
var gpx_link = '[<a class="result-link" onClick="document.location.href=\'' + OSRM.DEFAULTS.HOST_ROUTING_URL + query_string + '&output=gpx\';">'+OSRM.loc("GPX_FILE")+'</a>]';
|
||||
var gpx_link = '[<a class="route-link" onClick="document.location.href=\'' + OSRM.DEFAULTS.HOST_ROUTING_URL + query_string + '&output=gpx\';">'+OSRM.loc("GPX_FILE")+'</a>]';
|
||||
|
||||
// create route description
|
||||
var route_desc = "";
|
||||
route_desc += '<table class="results-table medium-font">';
|
||||
|
||||
var positions = OSRM.G.route.getPositions();
|
||||
var body = "";
|
||||
body += '<table class="description medium-font">';
|
||||
for(var i=0; i < response.route_instructions.length; i++){
|
||||
//odd or even ?
|
||||
var rowstyle='results-odd';
|
||||
if(i%2==0) { rowstyle='results-even'; }
|
||||
var rowstyle='description-body-odd';
|
||||
if(i%2==0) { rowstyle='description-body-even'; }
|
||||
|
||||
route_desc += '<tr class="'+rowstyle+'">';
|
||||
body += '<tr class="'+rowstyle+'">';
|
||||
|
||||
route_desc += '<td class="result-directions">';
|
||||
route_desc += '<img width="18px" src="'+OSRM.RoutingDescription.getDrivingInstructionIcon(response.route_instructions[i][0])+'" alt="" />';
|
||||
route_desc += "</td>";
|
||||
body += '<td class="description-body-directions">';
|
||||
body += '<img class="description-body-direction" src="'+ OSRM.RoutingDescription._getDrivingInstructionIcon(response.route_instructions[i][0]) + '" alt=""/>';
|
||||
body += '</td>';
|
||||
|
||||
route_desc += '<td class="result-items">';
|
||||
route_desc += '<div class="result-item" onclick="OSRM.RoutingDescription.onClickRouteDescription('+response.route_instructions[i][3]+')">';
|
||||
body += '<td class="description-body-items">';
|
||||
var pos = positions[response.route_instructions[i][3]];
|
||||
body += '<div class="description-body-item" onclick="OSRM.RoutingDescription.onClickRouteDescription('+pos.lat.toFixed(6)+","+pos.lng.toFixed(6)+')">';
|
||||
|
||||
// build route description
|
||||
if( i == 0 )
|
||||
route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, OSRM.loc(response.route_instructions[i][6]) );
|
||||
else if( response.route_instructions[i][1] != "" )
|
||||
route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]);
|
||||
if( response.route_instructions[i][1] != "" )
|
||||
body += OSRM.loc(OSRM.RoutingDescription._getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]).replace(/%d/, OSRM.loc(response.route_instructions[i][6]));
|
||||
else
|
||||
route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"");
|
||||
body += OSRM.loc(OSRM.RoutingDescription._getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"").replace(/%d/, OSRM.loc(response.route_instructions[i][6]));
|
||||
|
||||
route_desc += '</div>';
|
||||
route_desc += "</td>";
|
||||
body += '</div>';
|
||||
body += "</td>";
|
||||
|
||||
route_desc += '<td class="result-distance">';
|
||||
body += '<td class="description-body-distance">';
|
||||
if( i != response.route_instructions.length-1 )
|
||||
route_desc += '<b>'+OSRM.Utils.metersToDistance(response.route_instructions[i][2])+'</b>';
|
||||
route_desc += "</td>";
|
||||
body += '<b>'+OSRM.Utils.toHumanDistance(response.route_instructions[i][2])+'</b>';
|
||||
body += "</td>";
|
||||
|
||||
route_desc += "</tr>";
|
||||
body += "</tr>";
|
||||
}
|
||||
route_desc += '</table>';
|
||||
body += '</table>';
|
||||
|
||||
// create header
|
||||
header =
|
||||
'<div class="header-title">' + OSRM.loc("ROUTE_DESCRIPTION") + '</div>' +
|
||||
'<div class="full">' +
|
||||
'<div class="left">' +
|
||||
'<div class="header-content">' + OSRM.loc("DISTANCE")+": " + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '</div>' +
|
||||
'<div class="header-content">' + OSRM.loc("DURATION")+": " + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '</div>' +
|
||||
'</div>' +
|
||||
'<div class="right">' +
|
||||
'<div id="route-link" class="header-content">' + route_link + '</div>' +
|
||||
'<div class="header-content">' + gpx_link + '</div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
// build header
|
||||
header = OSRM.RoutingDescription._buildHeader(OSRM.Utils.toHumanDistance(response.route_summary.total_distance), OSRM.Utils.toHumanTime(response.route_summary.total_time), route_link, gpx_link);
|
||||
|
||||
// update DOM
|
||||
document.getElementById('information-box-header').innerHTML = header;
|
||||
document.getElementById('information-box').innerHTML = route_desc;
|
||||
document.getElementById('information-box').innerHTML = body;
|
||||
|
||||
// add alternative GUI (has to be done last since DOM has to be updated before events are registered)
|
||||
OSRM.RoutingAlternatives.show();
|
||||
},
|
||||
|
||||
// simple description
|
||||
showSimple: function(response) {
|
||||
header =
|
||||
'<div class="header-title">' + OSRM.loc("ROUTE_DESCRIPTION") + '</div>' +
|
||||
'<div class="full">' +
|
||||
'<div class="left">' +
|
||||
'<div class="header-content">' + OSRM.loc("DISTANCE")+": " + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '</div>' +
|
||||
'<div class="header-content">' + OSRM.loc("DURATION")+": " + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '</div>' +
|
||||
'</div>' +
|
||||
'<div class="right">' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
// build header
|
||||
header = OSRM.RoutingDescription._buildHeader(OSRM.Utils.toHumanDistance(response.route_summary.total_distance), OSRM.Utils.toHumanTime(response.route_summary.total_time), "", "");
|
||||
|
||||
// update DOM
|
||||
document.getElementById('information-box-header').innerHTML = header;
|
||||
@@ -131,36 +123,80 @@ showSimple: function(response) {
|
||||
|
||||
// no description
|
||||
showNA: function( display_text ) {
|
||||
header =
|
||||
'<div class="header-title">' + OSRM.loc("ROUTE_DESCRIPTION") + '</div>' +
|
||||
'<div class="full">' +
|
||||
'<div class="left">' +
|
||||
'<div class="header-content">' + OSRM.loc("DISTANCE")+": N/A" + '</div>' +
|
||||
'<div class="header-content">' + OSRM.loc("DURATION")+": N/A" + '</div>' +
|
||||
'</div>' +
|
||||
'<div class="right">' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
// build header
|
||||
header = OSRM.RoutingDescription._buildHeader("N/A", "N/A", "", "");
|
||||
|
||||
// update DOM
|
||||
document.getElementById('information-box-header').innerHTML = header;
|
||||
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+display_text+"</div>";
|
||||
},
|
||||
|
||||
// build header
|
||||
_buildHeader: function(distance, duration, route_link, gpx_link) {
|
||||
var temp =
|
||||
'<div class="header-title">' + OSRM.loc("ROUTE_DESCRIPTION") + '</div>' +
|
||||
|
||||
'<div class="full">' +
|
||||
'<div class="row">' +
|
||||
|
||||
'<div class="left">' +
|
||||
'<div class="full">' +
|
||||
'<div class="row">' +
|
||||
'<div class="left header-label">' + OSRM.loc("DISTANCE")+":" + '</div>' +
|
||||
'<div class="left header-content stretch">' + distance + '</div>' +
|
||||
'</div>' +
|
||||
'<div class="row">' +
|
||||
'<div class="left header-label">' + OSRM.loc("DURATION")+":" + '</div>' +
|
||||
'<div class="left header-content stretch">' + duration + '</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
|
||||
'<div class="left">' +
|
||||
'<div class="full">' +
|
||||
'<div class="row">' +
|
||||
'<div class="right header-content" id="route-link">' + route_link + '</div>' +
|
||||
'</div>' +
|
||||
'<div class="row">' +
|
||||
'<div class="right header-content">' + gpx_link + '</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
|
||||
'</div>';
|
||||
// '<div class="header-title">' + OSRM.loc("ROUTE_DESCRIPTION") + '</div>' +
|
||||
// '<div class="full">' +
|
||||
// '<div class="row">' +
|
||||
// '<div class="left header-label">' + OSRM.loc("DISTANCE")+":" + '</div>' +
|
||||
// '<div class="left header-content">' + distance + '</div>' +
|
||||
// '<div class="right header-content" id="route-link">' + route_link + '</div>' +
|
||||
// '</div>' +
|
||||
// '<div class="row">' +
|
||||
// '<div class="left header-label">' + OSRM.loc("DURATION")+":" + '</div>' +
|
||||
// '<div class="left header-content">' + duration + '</div>' +
|
||||
// '<div class="right header-content">' + gpx_link + '</div>' +
|
||||
// '</div>' +
|
||||
// '</div>';
|
||||
return temp;
|
||||
},
|
||||
|
||||
// retrieve driving instruction icon from instruction id
|
||||
getDrivingInstructionIcon: function(server_instruction_id) {
|
||||
_getDrivingInstructionIcon: function(server_instruction_id) {
|
||||
var local_icon_id = "direction_";
|
||||
server_instruction_id = server_instruction_id.replace(/^11-\d{1,}$/,"11"); // dumb check, if there is a roundabout (all have the same icon)
|
||||
local_icon_id += server_instruction_id;
|
||||
|
||||
if( OSRM.G.images[local_icon_id] )
|
||||
return OSRM.G.images[local_icon_id].src;
|
||||
return OSRM.G.images[local_icon_id].getAttribute("src");
|
||||
else
|
||||
return OSRM.G.images["direction_0"].src;
|
||||
return OSRM.G.images["direction_0"].getAttribute("src");
|
||||
},
|
||||
|
||||
// retrieve driving instructions from instruction ids
|
||||
getDrivingInstruction: function(server_instruction_id) {
|
||||
_getDrivingInstruction: function(server_instruction_id) {
|
||||
var local_instruction_id = "DIRECTION_";
|
||||
server_instruction_id = server_instruction_id.replace(/^11-\d{2,}$/,"11-x"); // dumb check, if there are 10+ exits on a roundabout (say the same for exit 10+)
|
||||
local_instruction_id += server_instruction_id;
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM routing
|
||||
// [handles GUI events]
|
||||
|
||||
|
||||
OSRM.RoutingGUI = {
|
||||
|
||||
// click: button "reset"
|
||||
resetRouting: function() {
|
||||
document.getElementById('gui-input-source').value = "";
|
||||
document.getElementById('gui-input-target').value = "";
|
||||
|
||||
OSRM.G.route.hideAll();
|
||||
OSRM.G.markers.removeAll();
|
||||
OSRM.G.markers.highlight.hide();
|
||||
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
|
||||
OSRM.JSONP.reset();
|
||||
},
|
||||
|
||||
// click: button "reverse"
|
||||
reverseRouting: function() {
|
||||
// invert input boxes
|
||||
var tmp = document.getElementById("gui-input-source").value;
|
||||
document.getElementById("gui-input-source").value = document.getElementById("gui-input-target").value;
|
||||
document.getElementById("gui-input-target").value = tmp;
|
||||
|
||||
// invert route
|
||||
OSRM.G.markers.route.reverse();
|
||||
if(OSRM.G.markers.route.length == 1) {
|
||||
if(OSRM.G.markers.route[0].label == OSRM.C.TARGET_LABEL) {
|
||||
OSRM.G.markers.route[0].label = OSRM.C.SOURCE_LABEL;
|
||||
OSRM.G.markers.route[0].marker.setIcon( OSRM.G.icons['marker-source'] );
|
||||
} else if(OSRM.G.markers.route[0].label == OSRM.C.SOURCE_LABEL) {
|
||||
OSRM.G.markers.route[0].label = OSRM.C.TARGET_LABEL;
|
||||
OSRM.G.markers.route[0].marker.setIcon( OSRM.G.icons['marker-target'] );
|
||||
}
|
||||
} else if(OSRM.G.markers.route.length > 1){
|
||||
OSRM.G.markers.route[0].label = OSRM.C.SOURCE_LABEL;
|
||||
OSRM.G.markers.route[0].marker.setIcon( OSRM.G.icons['marker-source'] );
|
||||
|
||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].label = OSRM.C.TARGET_LABEL;
|
||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].marker.setIcon( OSRM.G.icons['marker-target'] );
|
||||
}
|
||||
|
||||
// recompute route
|
||||
if( OSRM.G.route.isShown() ) {
|
||||
OSRM.Routing.getRoute();
|
||||
OSRM.G.markers.highlight.hide();
|
||||
} else {
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
}
|
||||
},
|
||||
|
||||
// click: button "show"
|
||||
showMarker: function(marker_id) {
|
||||
if( OSRM.JSONP.fences["geocoder_source"] || OSRM.JSONP.fences["geocoder_target"] )
|
||||
return;
|
||||
|
||||
if( marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() )
|
||||
OSRM.G.markers.route[0].centerView();
|
||||
else if( marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() )
|
||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].centerView();
|
||||
},
|
||||
|
||||
// changed: any inputbox (is called when enter is pressed [after] or focus is lost [before])
|
||||
inputChanged: function(marker_id) {
|
||||
if( marker_id == OSRM.C.SOURCE_LABEL)
|
||||
OSRM.Geocoder.call(OSRM.C.SOURCE_LABEL, document.getElementById('gui-input-source').value);
|
||||
else if( marker_id == OSRM.C.TARGET_LABEL)
|
||||
OSRM.Geocoder.call(OSRM.C.TARGET_LABEL, document.getElementById('gui-input-target').value);
|
||||
},
|
||||
|
||||
// click: button "open JOSM"
|
||||
openJOSM: function() {
|
||||
var x = OSRM.G.map.getCenterUI();
|
||||
var ydelta = 0.01;
|
||||
var xdelta = ydelta * 2;
|
||||
var p = [ 'left=' + (x.lng - xdelta), 'bottom=' + (x.lat - ydelta), 'right=' + (x.lng + xdelta), 'top=' + (x.lat + ydelta)];
|
||||
var url = 'http://localhost:8111/load_and_zoom?' + p.join('&');
|
||||
|
||||
var frame = L.DomUtil.create('iframe', null, document.body);
|
||||
frame.style.width = frame.style.height = "0px";
|
||||
frame.src = url;
|
||||
frame.onload = function(e) { document.body.removeChild(frame); };
|
||||
},
|
||||
|
||||
//click: button "open OSM Bugs"
|
||||
openOSMBugs: function() {
|
||||
var position = OSRM.G.map.getCenterUI();
|
||||
window.open( "http://osmbugs.org/?lat="+position.lat.toFixed(6)+"&lon="+position.lng.toFixed(6)+"&zoom="+OSRM.G.map.getZoom() );
|
||||
},
|
||||
|
||||
//click: button "delete marker"
|
||||
deleteMarker: function(marker_id) {
|
||||
var id = null;
|
||||
if(marker_id == 'source' && OSRM.G.markers.hasSource() )
|
||||
id = 0;
|
||||
else if(marker_id == 'target' && OSRM.G.markers.hasTarget() )
|
||||
id = OSRM.G.markers.route.length-1;
|
||||
if( id == null)
|
||||
return;
|
||||
|
||||
OSRM.G.markers.removeMarker( id );
|
||||
OSRM.Routing.getRoute();
|
||||
OSRM.G.markers.highlight.hide();
|
||||
}
|
||||
|
||||
};
|
||||
@@ -25,11 +25,7 @@ OSRM.RoutingGeometry = {
|
||||
show: function(response) {
|
||||
var geometry = OSRM.RoutingGeometry._decode(response.route_geometry, 5);
|
||||
|
||||
var positions = [];
|
||||
for( var i=0, size=geometry.length; i < size; i++)
|
||||
positions.push( new L.LatLng(geometry[i][0], geometry[i][1]) );
|
||||
|
||||
OSRM.G.route.showRoute(positions, OSRM.Route.ROUTE);
|
||||
OSRM.G.route.showRoute(geometry, OSRM.Route.ROUTE);
|
||||
},
|
||||
|
||||
//show route geometry - if there is no route
|
||||
@@ -63,7 +59,7 @@ _decode: function(encoded, precision) {
|
||||
} while (b >= 0x20);
|
||||
var dlng = ((result & 1) ? ~(result >> 1) : (result >> 1));
|
||||
lng += dlng;
|
||||
array.push([lat * precision, lng * precision]);
|
||||
array.push( {lat: lat * precision, lng: lng * precision} );
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ show: function(response) {
|
||||
var current_positions = [];
|
||||
var all_positions = [];
|
||||
for( var i=0; i < geometry.length; i++) {
|
||||
current_positions.push( new L.LatLng(geometry[i][0], geometry[i][1]) );
|
||||
current_positions.push( geometry[i] );
|
||||
|
||||
// still named/unnamed?
|
||||
if( (named[i] == is_named || named[i] == undefined) && i != geometry.length-1 )
|
||||
@@ -54,7 +54,7 @@ show: function(response) {
|
||||
if(is_named == false)
|
||||
all_positions.push( current_positions );
|
||||
current_positions = [];
|
||||
current_positions.push( new L.LatLng(geometry[i][0], geometry[i][1]) );
|
||||
current_positions.push( geometry[i] );
|
||||
is_named = named[i];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM CSS manipulator
|
||||
// [edit css styles]
|
||||
|
||||
OSRM.CSS = {
|
||||
getStylesheet: function(filename, the_document) {
|
||||
the_document = the_document || document;
|
||||
var stylesheets = the_document.styleSheets;
|
||||
for(var i=0, size=stylesheets.length; i<size; i++) {
|
||||
if( stylesheets[i].href.indexOf(filename) >= 0)
|
||||
return stylesheets[i];
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
insert: function(stylesheet, selector, rule) {
|
||||
if( stylesheet.addRule ){
|
||||
stylesheet.addRule(selector, rule);
|
||||
} else if( stylesheet.insertRule ){
|
||||
stylesheet.insertRule(selector + ' { ' + rule + ' }', stylesheet.cssRules.length);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -18,7 +18,6 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
// OSRM JSONP call wrapper
|
||||
// [wrapper for JSONP calls with DOM cleaning, fencing, timout handling]
|
||||
|
||||
|
||||
OSRM.JSONP = {
|
||||
|
||||
// storage to keep track of unfinished JSONP calls
|
||||
@@ -29,8 +28,8 @@ OSRM.JSONP = {
|
||||
|
||||
|
||||
// default callback routines
|
||||
late: function() { /*OSRM.debug.log("[jsonp] reply too late");*/ },
|
||||
empty: function() { /*OSRM.debug.log("[jsonp] empty callback");*/ },
|
||||
late: function() {},
|
||||
empty: function() {},
|
||||
|
||||
|
||||
// init JSONP call
|
||||
@@ -49,8 +48,6 @@ OSRM.JSONP = {
|
||||
OSRM.JSONP.timeouts[id] = OSRM.JSONP.empty;
|
||||
OSRM.JSONP.fences[id] = undefined; // clean fence
|
||||
}
|
||||
|
||||
// OSRM.debug.log("[jsonp] timout handling: "+id);
|
||||
};
|
||||
|
||||
// wrap callback function
|
||||
@@ -65,12 +62,9 @@ OSRM.JSONP = {
|
||||
OSRM.JSONP.timeouts[id] = OSRM.JSONP.late;
|
||||
OSRM.JSONP.fences[id] = undefined; // clean fence
|
||||
}
|
||||
|
||||
// OSRM.JSONP.sum[id] += new Number( new Date() - OSRM.JSONP.durations[id] );
|
||||
// OSRM.debug.log("[jsonp] response handling: "+id+" "+ (OSRM.JSONP.sum[id]/OSRM.JSONP.counter[id]).toFixed(2) );
|
||||
};
|
||||
|
||||
// clean DOM (unfortunately, script elements cannot be reused by all browsers)
|
||||
// clean DOM
|
||||
var jsonp = document.getElementById('jsonp_'+id);
|
||||
if(jsonp)
|
||||
jsonp.parentNode.removeChild(jsonp);
|
||||
@@ -79,20 +73,26 @@ OSRM.JSONP = {
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.id = 'jsonp_'+id;
|
||||
script.src = source + "&json_callback=OSRM.JSONP.callbacks."+id + "&jsonp=OSRM.JSONP.callbacks."+id;
|
||||
script.src = source.replace(/%jsonp/,"OSRM.JSONP.callbacks."+id);
|
||||
document.head.appendChild(script);
|
||||
|
||||
// start timeout timer
|
||||
OSRM.JSONP.timers[id] = setTimeout(OSRM.JSONP.timeouts[id], timeout);
|
||||
|
||||
// if(!OSRM.JSONP.durations) { OSRM.JSONP.durations = {}; OSRM.JSONP.counter = {}; OSRM.JSONP.sum = {}; }
|
||||
// if(OSRM.JSONP.counter[id]) OSRM.JSONP.counter[id]++; else {OSRM.JSONP.counter[id] = 1;OSRM.JSONP.sum[id] = 0;}
|
||||
// OSRM.JSONP.durations[id] = new Date();
|
||||
// OSRM.debug.log("[jsonp] init: "+id);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
clear: function(id) {
|
||||
clearTimeout(OSRM.JSONP.timers[id]); // clear timeout timer
|
||||
OSRM.JSONP.callbacks[id] = OSRM.JSONP.empty; // clean functions
|
||||
OSRM.JSONP.timeouts[id] = OSRM.JSONP.empty;
|
||||
OSRM.JSONP.fences[id] = undefined; // clean fence
|
||||
|
||||
// clean DOM
|
||||
var jsonp = document.getElementById('jsonp_'+id);
|
||||
if(jsonp)
|
||||
jsonp.parentNode.removeChild(jsonp);
|
||||
},
|
||||
|
||||
// reset all data
|
||||
reset: function() {
|
||||
OSRM.JSONP.fences = {};
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM utility functions
|
||||
// [mixed functions]
|
||||
|
||||
|
||||
OSRM.Utils = {
|
||||
|
||||
// [human readabilty functions]
|
||||
|
||||
// human readable time
|
||||
toHumanTime: function(seconds){
|
||||
seconds = parseInt(seconds);
|
||||
minutes = parseInt(seconds/60);
|
||||
seconds = seconds%60;
|
||||
hours = parseInt(minutes/60);
|
||||
minutes = minutes%60;
|
||||
if(hours==0 && minutes==0){ return seconds + ' ' + 's'; }
|
||||
else if(hours==0){ return minutes + ' ' + 'min'; }
|
||||
else{ return hours + ' ' + 'h' + ' ' + minutes + ' ' + 'min';}
|
||||
},
|
||||
//human readable distance
|
||||
setToHumanDistanceFunction: function(type) {
|
||||
OSRM.G.DISTANCE_FORMAT = type;
|
||||
if( type == 1 )
|
||||
OSRM.Utils.toHumanDistance = OSRM.Utils.toHumanDistanceMiles;
|
||||
else
|
||||
OSRM.Utils.toHumanDistance = OSRM.Utils.toHumanDistanceMeters;
|
||||
},
|
||||
toHumanDistanceMeters: function(meters){
|
||||
var distance = parseInt(meters);
|
||||
|
||||
distance = distance / 1000;
|
||||
if(distance >= 100){ return (distance).toFixed(0)+' ' + 'km'; }
|
||||
else if(distance >= 10){ return (distance).toFixed(1)+' ' + 'km'; }
|
||||
else if(distance >= 0.1){ return (distance).toFixed(2)+' ' + 'km'; }
|
||||
else{ return (distance*1000).toFixed(0)+' ' + 'm'; }
|
||||
},
|
||||
toHumanDistanceMiles: function(meters){
|
||||
var distance = parseInt(meters);
|
||||
|
||||
distance = distance / 1609.344;
|
||||
if(distance >= 100){ return (distance).toFixed(0)+' ' + 'mi'; }
|
||||
else if(distance >= 10){ return (distance).toFixed(1)+' ' + 'mi'; }
|
||||
else if(distance >= 0.1){ return (distance).toFixed(2)+' ' + 'mi'; }
|
||||
else{ return (distance*5280).toFixed(0)+' ' + 'ft'; }
|
||||
},
|
||||
toHumanDistance: null,
|
||||
|
||||
|
||||
// [verification routines]
|
||||
|
||||
// verify angles
|
||||
isLatitude: function(value) {
|
||||
if( value >=-90 && value <=90)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
},
|
||||
isLongitude: function(value) {
|
||||
if( value >=-180 && value <=180)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM old/cross browser support
|
||||
// [browser detection and routines for old/cross browser support]
|
||||
|
||||
|
||||
// browser detection (runs anonymous function to prevent local variables cluttering global namespace)
|
||||
(function() {
|
||||
var useragent = navigator.userAgent;
|
||||
|
||||
OSRM.Browser = {
|
||||
FF3: useragent.search(/Firefox\/3/),
|
||||
IE6_8: useragent.search(/MSIE (6|7|8)/),
|
||||
IE6_9: useragent.search(/MSIE (6|7|8|9)/)
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
// compatibility tools
|
||||
|
||||
//add document.head reference for older browsers
|
||||
document.head = document.head || document.getElementsByTagName('head')[0];
|
||||
|
||||
// supply getElementsByClassName method for older browser
|
||||
OSRM.Browser.getElementsByClassName = function( node, classname ) {
|
||||
var a = [];
|
||||
var re = new RegExp('(^| )'+classname+'( |$)');
|
||||
var els = node.getElementsByTagName("*");
|
||||
for(var i=0,j=els.length; i<j; i++)
|
||||
if(re.test(els[i].className))a.push(els[i]);
|
||||
return a;
|
||||
};
|
||||
|
||||
// call a function when DOM has finished loading and remove event handler (optionally pass a different window object)
|
||||
OSRM.Browser.onLoadHandler = function( function_pointer, the_window ) {
|
||||
the_window = the_window || window; // default document
|
||||
var the_document = the_window.document;
|
||||
|
||||
if(the_window.addEventListener) { // FF, CH, IE9+
|
||||
var temp_function = function() {
|
||||
the_window.removeEventListener("DOMContentLoaded", arguments.callee, false);
|
||||
function_pointer.call();
|
||||
};
|
||||
the_window.addEventListener("DOMContentLoaded", temp_function, false);
|
||||
}
|
||||
|
||||
else if(the_document.attachEvent) { // IE8-
|
||||
var temp_function = function() {
|
||||
if ( the_document.readyState === "interactive" || the_document.readyState === "complete" ) {
|
||||
the_document.detachEvent("onreadystatechange", arguments.callee);
|
||||
function_pointer.call();
|
||||
}
|
||||
};
|
||||
the_document.attachEvent("onreadystatechange", temp_function);
|
||||
}
|
||||
};
|
||||
OSRM.Browser.onUnloadHandler = function( function_pointer, the_window ) {
|
||||
the_window = the_window || window; // default document
|
||||
var the_document = the_window.document;
|
||||
|
||||
if(the_window.addEventListener) { // FF, CH, IE9+
|
||||
the_window.addEventListener("unload", function_pointer, false);
|
||||
}
|
||||
else if(the_document.attachEvent) { // IE8-
|
||||
the_document.attachEvent("onunload", function_pointer);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// OSRM classes
|
||||
// [support for inheritance and other function related functionality]
|
||||
|
||||
// declare one class to be a subclass of another class
|
||||
// (runs anonymous function to prevent local functions cluttering global namespace)
|
||||
(function() {
|
||||
var _inheritFromHelper = function() {};
|
||||
OSRM.inheritFrom = function( sub_class, base_class ) {
|
||||
_inheritFromHelper.prototype = base_class.prototype;
|
||||
sub_class.prototype = new _inheritFromHelper();
|
||||
sub_class.prototype.constructor = sub_class;
|
||||
sub_class.prototype.base = base_class.prototype;
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
// extend prototypes of a class -> used to add member values and functions
|
||||
OSRM.extend = function( target_class, properties ) {
|
||||
for( property in properties ) {
|
||||
target_class.prototype[property] = properties[property];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// bind a function to an execution context, i.e. an object (needed for correcting this pointers)
|
||||
OSRM.bind = function( context, fct1 ) {
|
||||
return function() {
|
||||
fct1.apply(context, arguments);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// concatenate the execution of two functions with the same set of parameters
|
||||
OSRM.concat = function( fct1, fct2 ) {
|
||||
return function() {
|
||||
fct1.apply(this,arguments);
|
||||
fct2.apply(this,arguments);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// [usage of convenience functions]
|
||||
// SubClass = function() {
|
||||
// SubClass.prototype.base.constructor.apply(this, arguments);
|
||||
// }
|
||||
// OSRM.inheritFrom( SubClass, BaseClass );
|
||||
// OSRM.extend( SubClass, { property:value } );
|
||||
@@ -46,7 +46,7 @@ OSRM.debug.init = function() {
|
||||
|
||||
var clear = document.createElement('a');
|
||||
clear.id = "OSRM.debug-clear";
|
||||
clear.className = "button not-selectable";
|
||||
clear.className = "button";
|
||||
clear.innerHTML = "clear";
|
||||
clear.onclick = OSRM.debug.clear;
|
||||
|
||||
@@ -63,7 +63,4 @@ OSRM.debug.init = function() {
|
||||
|
||||
|
||||
// onload event
|
||||
if(document.addEventListener) // FF, CH
|
||||
document.addEventListener("DOMContentLoaded", OSRM.debug.init, false);
|
||||
else if(document.attachEvent) // IE
|
||||
document.attachEvent("onreadystatechange", function() { if ( document.readyState === "interactive" ) OSRM.debug.init(); });
|
||||
OSRM.Browser.onLoadHandler( OSRM.debug.init );
|
||||