Compare commits
322 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 35d2c6871f | |||
| 9a7863f8d5 | |||
| 716e5ed6b0 | |||
| 8f4e10de2d | |||
| 99b36e8f46 | |||
| d64fb6781c | |||
| cdaef51b20 | |||
| 40ad5a22ad | |||
| 54232645ae | |||
| 618bb3ef70 | |||
| a83a3d125d | |||
| f2a4a02af8 | |||
| cdc98b2ad8 | |||
| aee90bf530 | |||
| db857166b2 | |||
| 0d13f1f6d7 | |||
| 65f53b6563 | |||
| d4c5725613 | |||
| ab99ffc241 | |||
| 794140711d | |||
| 6dcea6d808 | |||
| c9f229fea8 | |||
| d3d3ebb5de | |||
| 94ad1003e9 | |||
| afb70126ad | |||
| 532d7cb057 | |||
| e98afb46e7 | |||
| f8779e479e | |||
| e1cb34cf38 | |||
| f2cd56b329 | |||
| 80d51683d4 | |||
| ee8d04656d | |||
| 3fc8c4309f | |||
| 3f1c3e0923 | |||
| 695ef4746b | |||
| 995466e89f | |||
| 4f28b2fe69 | |||
| 5498aa03a5 | |||
| 60d236dd3e | |||
| f571b5c7e5 | |||
| 792404b311 | |||
| 862cde1056 | |||
| 71399daf00 | |||
| 320bbcfb20 | |||
| 4bb52cfe8c | |||
| 915baf57c3 | |||
| f31abcea80 | |||
| 3ab5a22890 | |||
| 5a2dd78694 | |||
| 6c2e391622 | |||
| 9a6c6cd485 | |||
| ea84f774a7 | |||
| 5901b25e69 | |||
| d9b0ab3d2e | |||
| f004a65db1 | |||
| b792d44b4e | |||
| e8eb342434 | |||
| 0916e3f2e3 | |||
| 5f089e628b | |||
| de2e070dde | |||
| 8ecae7ef97 | |||
| ecd342224e | |||
| 1f7a724ded | |||
| ecd04188df | |||
| 71f55dc30a | |||
| 1746946b70 | |||
| 3746a25057 | |||
| 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 | |||
| 33035fccc0 | |||
| c14e461370 | |||
| 6f4e9a1d11 | |||
| 3610e21854 | |||
| f6a3815e91 | |||
| f2efcfc588 | |||
| 2bf573dbe1 | |||
| 9bd4b77278 | |||
| fb995ad0b0 | |||
| 3a85661e45 | |||
| 0ba881c390 | |||
| c7782b2776 | |||
| 23ca80030e | |||
| f08c389faa | |||
| 47369a0036 | |||
| 253b591a87 | |||
| 5c4488d350 | |||
| 25310ff1bd | |||
| c2d52080d3 | |||
| bf681855ed | |||
| 899d216b9b | |||
| 73aeab3a57 | |||
| 61073ebc9d | |||
| 393334cabd | |||
| 01e4afe2f0 | |||
| 9b599c90f8 | |||
| 252c234221 | |||
| 888a5d04c8 | |||
| b1631eff77 | |||
| ffd5e2de99 | |||
| ea207cef6e | |||
| 893c09f6fc | |||
| 213bb71b35 | |||
| 0fd8d4d8cf | |||
| 13f0a3fb6b | |||
| 3141d3ba48 | |||
| 4ff4fcf516 | |||
| f273f0cfc5 | |||
| dc192d47a8 | |||
| 0f032f7635 | |||
| 060c7e499a | |||
| 28a241c371 | |||
| abba49a44e |
@@ -0,0 +1,19 @@
|
||||
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
|
||||
miszka999
|
||||
Konstantin Delchev
|
||||
@@ -24,7 +24,16 @@ Branches
|
||||
|
||||
Bugtracking
|
||||
-----------
|
||||
Please use the OSRM-Project bug tracker for submitting any bug reports or feature requests.
|
||||
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
|
||||
----------------------------------------
|
||||
@@ -41,14 +50,23 @@ 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/
|
||||
[(2)] Project OSRM: http://project-osrm.org/
|
||||
[(3)] Project OSRM Frontend: http://map.project-osrm.org/
|
||||
|
||||
[(3)] Project OSRM Frontend: http://map.project-osrm.org/
|
||||
[(4)] Project OSRM Bugtracker: https://github.com/DennisOSRM/Project-OSRM/issues/
|
||||
|
||||
|
||||
[(1)]: http://leaflet.cloudmade.com/ "Cloudmade Leaflet"
|
||||
[(2)]: http://project-osrm.org/ "Project OSRM"
|
||||
[(3)]: http://map.project-osrm.org/ "Project-OSRM Frontend"
|
||||
[(3)]: http://map.project-osrm.org/ "Project-OSRM Frontend"
|
||||
[(4)]: https://github.com/DennisOSRM/Project-OSRM/issues/ "Project-OSRM Bugtracker"
|
||||
@@ -1,80 +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.
|
||||
*/
|
||||
|
||||
// Leaflet bugfixes
|
||||
// [assorted bugfixes to Leaflet functions we use]
|
||||
|
||||
|
||||
// return closest point on segment or distance to that point
|
||||
L.LineUtil._sqClosestPointOnSegment = function (p, p1, p2, sqDist) {
|
||||
var x = p1.x,
|
||||
y = p1.y,
|
||||
dx = p2.x - x,
|
||||
dy = p2.y - y,
|
||||
dot = dx * dx + dy * dy,
|
||||
t;
|
||||
|
||||
if (dot > 0) {
|
||||
t = ((p.x - x) * dx + (p.y - y) * dy) / dot;
|
||||
|
||||
if (t > 1) {
|
||||
x = p2.x;
|
||||
y = p2.y;
|
||||
} else if (t > 0) {
|
||||
x += dx * t;
|
||||
y += dy * t;
|
||||
}
|
||||
}
|
||||
|
||||
dx = p.x - x;
|
||||
dy = p.y - y;
|
||||
|
||||
// DS_CHANGE: modified return values
|
||||
if(sqDist)
|
||||
return dx*dx + dy*dy;
|
||||
else {
|
||||
var p = new L.Point(x,y);
|
||||
p._sqDist = dx*dx + dy*dy;
|
||||
return p;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// makes requestAnimFrame respect the immediate paramter -> prevents drag events after dragend events
|
||||
// (alternatively: add if(!this.dragging ) return to L.Draggable._updatePosition, but must be done in leaflet.js!)
|
||||
// [TODO: In Leaflet 0.4 use L.Util.cancelAnimFrame(this._animRequest) in L.Draggable._onUp() instead, also has to be done in leaflet.js!]
|
||||
L.Util.requestAnimFrame = (function () {
|
||||
function timeoutDefer(callback) {
|
||||
window.setTimeout(callback, 1000 / 60);
|
||||
}
|
||||
|
||||
var requestFn = window.requestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame ||
|
||||
window.oRequestAnimationFrame ||
|
||||
window.msRequestAnimationFrame ||
|
||||
timeoutDefer;
|
||||
|
||||
return function (callback, context, immediate, contextEl) {
|
||||
callback = context ? L.Util.bind(callback, context) : callback;
|
||||
if (immediate ) { // DS_CHANGE: removed additional condition requestFn === timeoutDefer
|
||||
callback();
|
||||
} else {
|
||||
requestFn(callback, contextEl);
|
||||
}
|
||||
};
|
||||
}());
|
||||
@@ -1,60 +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.
|
||||
*/
|
||||
|
||||
// Leaflet extension: Dashed Polyline
|
||||
// [adds dashed optionally dashed lines when using SVG or VML rendering]
|
||||
|
||||
|
||||
// dashed polyline class
|
||||
L.DashedPolyline = L.Polyline.extend({
|
||||
initialize: function(latlngs, options) {
|
||||
L.Polyline.prototype.initialize.call(this, latlngs, options);
|
||||
},
|
||||
|
||||
options: {
|
||||
dashed: true
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// svg rendering
|
||||
L.DashedPolyline = !L.Browser.svg ? L.DashedPolyline : L.DashedPolyline.extend({
|
||||
_updateStyle: function () {
|
||||
L.Polyline.prototype._updateStyle.call(this);
|
||||
if (this.options.stroke) {
|
||||
if (this.options.dashed == true)
|
||||
this._path.setAttribute('stroke-dasharray', '8,6');
|
||||
else
|
||||
this._path.setAttribute('stroke-dasharray', '');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// vml rendering
|
||||
L.DashedPolyline = L.Browser.svg || !L.Browser.vml ? L.DashedPolyline : L.DashedPolyline.extend({
|
||||
_updateStyle: function () {
|
||||
L.Polyline.prototype._updateStyle.call(this);
|
||||
if (this.options.stroke) {
|
||||
if (this.options.dashed == true)
|
||||
this._stroke.dashstyle = "dash";
|
||||
else
|
||||
this._stroke.dashstyle = "solid";
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@@ -1,64 +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.
|
||||
*/
|
||||
|
||||
// Leaflet extension: MouseMarker
|
||||
// [marker class that propagates modifier and button presses in mouse click events and allows for changing icons]
|
||||
|
||||
|
||||
// extended marker class
|
||||
L.MouseMarker = L.Marker.extend({
|
||||
initialize: function (latlng, options) {
|
||||
L.Marker.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
switchIcon: function( icon ) {
|
||||
this.options.icon = icon;
|
||||
|
||||
if (this._map) {
|
||||
this._changeIcon();
|
||||
this._reset();
|
||||
}
|
||||
},
|
||||
|
||||
_changeIcon: function () {
|
||||
var options = this.options;
|
||||
|
||||
if (this._icon) {
|
||||
this._icon = options.icon.switchIcon( this._icon );
|
||||
this._icon.title = options.title;
|
||||
}
|
||||
|
||||
var panes = this._map._panes;
|
||||
|
||||
if (this._shadow)
|
||||
panes.shadowPane.removeChild(this._shadow);
|
||||
this._shadow = options.icon.createShadow();
|
||||
if (this._shadow)
|
||||
panes.shadowPane.appendChild(this._shadow);
|
||||
},
|
||||
|
||||
_onMouseClick: function (e) {
|
||||
L.DomEvent.stopPropagation(e);
|
||||
if (this.dragging && this.dragging.moved()) { return; }
|
||||
this.fire(e.type, {
|
||||
altKey: e.altKey,
|
||||
ctrlKey: e.ctrlKey,
|
||||
shiftKey: e.shiftKey,
|
||||
button: e.button
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1,115 +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.
|
||||
*/
|
||||
|
||||
// Leaflet extension: SwitchableIcon
|
||||
// [will be an extension of L.Icon in Leaflet 0.4, for now it is a copy with added functionality]
|
||||
|
||||
|
||||
// icon class with functions to simply switch the icon images
|
||||
L.SwitchableIcon = L.Class.extend({
|
||||
options: {
|
||||
/*
|
||||
iconUrl: (String) (required)
|
||||
iconSize: (Point) (can be set through CSS)
|
||||
iconAnchor: (Point) (centered by default if size is specified, can be set in CSS with negative margins)
|
||||
popupAnchor: (Point) (if not specified, popup opens in the anchor point)
|
||||
shadowUrl: (Point) (no shadow by default)
|
||||
shadowSize: (Point)
|
||||
*/
|
||||
className: ''
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
L.Util.setOptions(this, options);
|
||||
},
|
||||
|
||||
createIcon: function () {
|
||||
return this._createIcon('icon');
|
||||
},
|
||||
|
||||
createShadow: function () {
|
||||
return this.options.shadowUrl ? this._createIcon('shadow') : null;
|
||||
},
|
||||
|
||||
_createIcon: function (name) {
|
||||
var img = this._createImg(this.options[name + 'Url']);
|
||||
this._setIconStyles(img, name);
|
||||
return img;
|
||||
},
|
||||
|
||||
_setIconStyles: function (img, name) {
|
||||
var options = this.options,
|
||||
size = options[name + 'Size'],
|
||||
anchor = options.iconAnchor;
|
||||
|
||||
if (!anchor && size) {
|
||||
anchor = size.divideBy(2, true);
|
||||
}
|
||||
|
||||
if (name === 'shadow' && anchor && options.shadowOffset) {
|
||||
anchor._add(options.shadowOffset);
|
||||
}
|
||||
|
||||
img.className = 'leaflet-marker-' + name + ' ' + options.className;
|
||||
|
||||
if (anchor) {
|
||||
img.style.marginLeft = (-anchor.x) + 'px';
|
||||
img.style.marginTop = (-anchor.y) + 'px';
|
||||
}
|
||||
|
||||
if (size) {
|
||||
img.style.width = size.x + 'px';
|
||||
img.style.height = size.y + 'px';
|
||||
}
|
||||
},
|
||||
|
||||
_createImg: function (src) {
|
||||
var el;
|
||||
if (!L.Browser.ie6) {
|
||||
el = document.createElement('img');
|
||||
el.src = src;
|
||||
} else {
|
||||
el = document.createElement('div');
|
||||
el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")';
|
||||
}
|
||||
return el;
|
||||
},
|
||||
|
||||
// new functions start here
|
||||
switchIcon: function (el) {
|
||||
return this._switchIcon('icon', el);
|
||||
},
|
||||
|
||||
switchShadow: function (el) {
|
||||
return this.options.shadowUrl ? this._switchIcon('shadow', el) : null;
|
||||
},
|
||||
|
||||
_switchIcon: function (name, el) {
|
||||
var img = this._switchImg(this.options[name + 'Url'], el);
|
||||
this._setIconStyles(img, name);
|
||||
return img;
|
||||
},
|
||||
|
||||
_switchImg: function (src, el) {
|
||||
if (!L.Browser.ie6) {
|
||||
el.src = src;
|
||||
} else {
|
||||
el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")';
|
||||
}
|
||||
return el;
|
||||
}
|
||||
});
|
||||
@@ -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,103 +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;
|
||||
|
||||
// translate
|
||||
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("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("input-source-name").title = OSRM.loc("GUI_START_TOOLTIP");
|
||||
document.getElementById("input-target-name").title = OSRM.loc("GUI_END_TOOLTIP");
|
||||
document.getElementById("legal-notice").innerHTML = OSRM.loc("GUI_LEGAL_NOTICE");
|
||||
|
||||
document.getElementById('input-source-name').value = OSRM.DEFAULTS.ONLOAD_SOURCE;
|
||||
document.getElementById('input-target-name').value = OSRM.DEFAULTS.ONLOAD_TARGET;
|
||||
},
|
||||
|
||||
// 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
|
||||
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);
|
||||
} else {
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,206 +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 geocoding routines
|
||||
// [geocoder query, management and display of geocoder results]
|
||||
|
||||
// some constants
|
||||
OSRM.CONSTANTS.SOURCE_LABEL = "source";
|
||||
OSRM.CONSTANTS.TARGET_LABEL = "target";
|
||||
OSRM.CONSTANTS.VIA_LABEL = "via";
|
||||
OSRM.CONSTANTS.DO_FALLBACK_TO_LAT_LNG = true;
|
||||
|
||||
|
||||
OSRM.Geocoder = {
|
||||
|
||||
//[normal geocoding]
|
||||
|
||||
// process input request and call geocoder if needed
|
||||
call: function(marker_id, query) {
|
||||
if(query=="")
|
||||
return;
|
||||
|
||||
//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]);
|
||||
OSRM.Geocoder.updateAddress( marker_id );
|
||||
return;
|
||||
}
|
||||
|
||||
//build request for geocoder
|
||||
var call = OSRM.DEFAULTS.HOST_GEOCODER_URL + "?format=json" + OSRM.DEFAULTS.GEOCODER_BOUNDS + "&q=" + query;
|
||||
OSRM.JSONP.call( call, OSRM.Geocoder._showResults, OSRM.Geocoder._showResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "geocoder_"+marker_id, {marker_id:marker_id,query:query} );
|
||||
},
|
||||
|
||||
|
||||
// helper function for clicks on geocoder search results
|
||||
_onclickResult: function(marker_id, lat, lon) {
|
||||
var index;
|
||||
if( marker_id == OSRM.C.SOURCE_LABEL )
|
||||
index = OSRM.G.markers.setSource( new L.LatLng(lat, lon) );
|
||||
else if( marker_id == OSRM.C.TARGET_LABEL )
|
||||
index = OSRM.G.markers.setTarget( new L.LatLng(lat, lon) );
|
||||
else
|
||||
return;
|
||||
|
||||
OSRM.G.markers.route[index].show();
|
||||
OSRM.G.markers.route[index].centerView();
|
||||
OSRM.Routing.getRoute();
|
||||
},
|
||||
|
||||
|
||||
// process geocoder response
|
||||
_showResults: function(response, parameters) {
|
||||
if(!response){
|
||||
OSRM.Geocoder._showResults_Empty(parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
if(response.length == 0) {
|
||||
OSRM.Geocoder._showResults_Empty(parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
// show possible results for input
|
||||
var html = "";
|
||||
html += '<table class="results-table">';
|
||||
for(var i=0; i < response.length; i++){
|
||||
var result = response[i];
|
||||
|
||||
//odd or even ?
|
||||
var rowstyle='results-odd';
|
||||
if(i%2==0) { rowstyle='results-even'; }
|
||||
|
||||
html += '<tr class="'+rowstyle+'">';
|
||||
html += '<td class="result-counter"><span">'+(i+1)+'.</span></td>';
|
||||
html += '<td class="result-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 += "</td></tr>";
|
||||
}
|
||||
html += '</table>';
|
||||
|
||||
document.getElementById('information-box-headline').innerHTML = OSRM.loc("SEARCH_RESULTS")+":";
|
||||
document.getElementById('information-box').innerHTML = html;
|
||||
|
||||
OSRM.Geocoder._onclickResult(parameters.marker_id, response[0].lat, response[0].lon);
|
||||
},
|
||||
_showResults_Empty: function(parameters) {
|
||||
document.getElementById('information-box-headline').innerHTML = OSRM.loc("SEARCH_RESULTS")+":";
|
||||
if(parameters.marker_id == OSRM.C.SOURCE_LABEL)
|
||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("NO_RESULTS_FOUND_SOURCE")+": "+parameters.query +".<p>";
|
||||
else if(parameters.marker_id == OSRM.C.TARGET_LABEL)
|
||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("NO_RESULTS_FOUND_TARGET")+": "+parameters.query +".<p>";
|
||||
else
|
||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("NO_RESULTS_FOUND")+": "+parameters.query +".<p>";
|
||||
},
|
||||
_showResults_Timeout: function() {
|
||||
document.getElementById('information-box-headline').innerHTML = OSRM.loc("SEARCH_RESULTS")+":";
|
||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("TIMED_OUT")+".<p>";
|
||||
},
|
||||
|
||||
|
||||
// [reverse geocoding]
|
||||
|
||||
//update geo coordinates in input boxes
|
||||
updateLocation: function(marker_id) {
|
||||
if (marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource()) {
|
||||
document.getElementById("input-source-name").value = OSRM.G.markers.route[0].getLat().toFixed(6) + ", " + OSRM.G.markers.route[0].getLng().toFixed(6);
|
||||
} else if (marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget()) {
|
||||
document.getElementById("input-target-name").value = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLat().toFixed(6) + ", " + OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLng().toFixed(6);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// update address in input boxes
|
||||
updateAddress: function(marker_id, do_fallback_to_lat_lng) {
|
||||
// build request for reverse geocoder
|
||||
var lat = null;
|
||||
var lng = null;
|
||||
|
||||
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();
|
||||
} 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();
|
||||
} else
|
||||
return;
|
||||
|
||||
var call = OSRM.DEFAULTS.HOST_REVERSE_GEOCODER_URL + "?format=json" + "&lat=" + lat + "&lon=" + lng;
|
||||
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} );
|
||||
},
|
||||
|
||||
|
||||
// processing JSONP response of reverse geocoder
|
||||
_showReverseResults: function(response, parameters) {
|
||||
if(!response) {
|
||||
OSRM.Geocoder._showReverseResults_Timeout(response, parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
if(response.address == undefined) {
|
||||
OSRM.Geocoder._showReverseResults_Timeout(response, parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
// build reverse geocoding address
|
||||
var used_address_data = 0;
|
||||
var address = "";
|
||||
if( response.address.road) {
|
||||
address += response.address.road;
|
||||
used_address_data++;
|
||||
}
|
||||
if( response.address.city ) {
|
||||
if( used_address_data > 0 )
|
||||
address += ", ";
|
||||
address += response.address.city;
|
||||
used_address_data++;
|
||||
} else if( response.address.village ) {
|
||||
if( used_address_data > 0 )
|
||||
address += ", ";
|
||||
address += response.address.village;
|
||||
used_address_data++;
|
||||
}
|
||||
if( used_address_data < 2 && response.address.country ) {
|
||||
if( used_address_data > 0 )
|
||||
address += ", ";
|
||||
address += response.address.country;
|
||||
used_address_data++;
|
||||
}
|
||||
if( used_address_data == 0 ) {
|
||||
OSRM.Geocoder._showReverseResults_Timeout(response, parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
// add result to DOM
|
||||
if(parameters.marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() )
|
||||
document.getElementById("input-source-name").value = address;
|
||||
else if(parameters.marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() )
|
||||
document.getElementById("input-target-name").value = address;
|
||||
},
|
||||
_showReverseResults_Timeout: function(response, parameters) {
|
||||
if(!parameters.do_fallback)
|
||||
return;
|
||||
|
||||
updateLocation(parameters.marker_id);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,122 +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 localization
|
||||
// [basic localization options]
|
||||
|
||||
|
||||
OSRM.Localization = {
|
||||
|
||||
// if existing, return localized string -> English string -> input string
|
||||
translate: function(text) {
|
||||
if( OSRM.Localization[OSRM.DEFAULTS.LANGUAGE][text] )
|
||||
return OSRM.Localization[OSRM.DEFAULTS.LANGUAGE][text];
|
||||
else if( OSRM.Localization["en"][text] )
|
||||
return OSRM.Localization["en"][text];
|
||||
else
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
// shorter call to translate function
|
||||
OSRM.loc = OSRM.Localization.translate;
|
||||
|
||||
|
||||
// German language support
|
||||
OSRM.Localization["de"] = {
|
||||
//gui
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
"GUI_START": "Start",
|
||||
"GUI_END": "Ziel",
|
||||
"GUI_RESET": "Reset",
|
||||
"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>",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Suchergebnisse",
|
||||
"TIMED_OUT": "Zeitüberschreitung",
|
||||
"NO_RESULTS_FOUND": "Keine Ergebnisse gefunden",
|
||||
"NO_RESULTS_FOUND_SOURCE": "Keine Ergebnisse gefunden für Start",
|
||||
"NO_RESULTS_FOUND_TARGET": "Keine Ergebnisse gefunden für Ziel",
|
||||
// routing
|
||||
"ROUTE_DESCRIPTION": "Routenbeschreibung",
|
||||
"GET_LINK_TO_ROUTE": "Generiere Link",
|
||||
"GENERATE_LINK_TO_ROUTE": "Warte auf Antwort",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "nicht möglich",
|
||||
"GPX_FILE": "GPX Datei",
|
||||
"DISTANCE": "Distanz",
|
||||
"DURATION": "Dauer",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Ihre Route wird berechnet",
|
||||
"NO_ROUTE_FOUND": "Keine Route hierher möglich",
|
||||
// directions
|
||||
"N": "Norden",
|
||||
"O": "Ost",
|
||||
"S": "Süden",
|
||||
"W": "Westen",
|
||||
"NO": "Nordost",
|
||||
"SO": "Südost",
|
||||
"SW": "Südwest",
|
||||
"NW": "Nordwest"
|
||||
};
|
||||
|
||||
|
||||
// English language support
|
||||
OSRM.Localization["en"] = {
|
||||
//gui
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
"GUI_START": "Start",
|
||||
"GUI_END": "End",
|
||||
"GUI_RESET": " Reset ",
|
||||
"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>",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Search Results",
|
||||
"TIMED_OUT": "Timed Out",
|
||||
"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
|
||||
"ROUTE_DESCRIPTION": "Route Description",
|
||||
"GET_LINK_TO_ROUTE": "Generate Link",
|
||||
"GENERATE_LINK_TO_ROUTE": "waiting for link",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "not available",
|
||||
"GPX_FILE": "GPX File",
|
||||
"DISTANCE": "Distance",
|
||||
"DURATION": "Duration",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Your route is being computed",
|
||||
"NO_ROUTE_FOUND": "No route possible",
|
||||
// directions
|
||||
"N": "north",
|
||||
"E": "east",
|
||||
"S": "south",
|
||||
"W": "west",
|
||||
"NE": "northeast",
|
||||
"SE": "southeast",
|
||||
"SW": "southwest",
|
||||
"NW": "northwest"
|
||||
};
|
||||
@@ -1,151 +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 map handling
|
||||
// [initialization, event handling, centering relative to UI]
|
||||
|
||||
// will hold the map object
|
||||
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 = {
|
||||
|
||||
// map initialization
|
||||
init: function() {
|
||||
// check if GUI is initialized!
|
||||
if(OSRM.GUI.visible == null)
|
||||
OSRM.GUI.init();
|
||||
|
||||
// setup tile servers
|
||||
var osmorgURL = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
osmorgAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 Mapnik',
|
||||
osmorgOptions = {maxZoom: 18, attribution: osmorgAttribution};
|
||||
|
||||
var osmdeURL = 'http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
|
||||
osmdeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 Mapnik',
|
||||
osmdeOptions = {maxZoom: 18, attribution: osmdeAttribution};
|
||||
|
||||
var mapquestURL = 'http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png',
|
||||
mapquestAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 MapQuest',
|
||||
mapquestOptions = {maxZoom: 18, attribution: mapquestAttribution, subdomains: '1234'};
|
||||
|
||||
var cloudmadeURL = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
|
||||
cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
|
||||
cloudmadeOptions = {maxZoom: 18, attribution: cloudmadeAttribution};
|
||||
|
||||
var osmorg = new L.TileLayer(osmorgURL, osmorgOptions),
|
||||
osmde = new L.TileLayer(osmdeURL, osmdeOptions),
|
||||
mapquest = new L.TileLayer(mapquestURL, mapquestOptions),
|
||||
cloudmade = new L.TileLayer(cloudmadeURL, cloudmadeOptions);
|
||||
|
||||
// setup map
|
||||
OSRM.G.map = new OSRM.MapView('map', {
|
||||
center: new L.LatLng(51.505, -0.09),
|
||||
zoom: 13,
|
||||
zoomAnimation: false, // false: removes animations and hiding of routes during zoom
|
||||
fadeAnimation: false,
|
||||
layers: [osmorg]
|
||||
});
|
||||
|
||||
// add tileservers
|
||||
var baseMaps = {
|
||||
"osm.org": osmorg,
|
||||
"osm.de": osmde,
|
||||
"MapQuest": mapquest,
|
||||
"CloudMade": cloudmade
|
||||
};
|
||||
|
||||
var overlayMaps = {};
|
||||
var layersControl = new L.Control.Layers(baseMaps, overlayMaps);
|
||||
OSRM.G.map.addControl(layersControl);
|
||||
|
||||
// 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 map position and zoom
|
||||
var position = new L.LatLng( OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE);
|
||||
OSRM.G.map.setViewUI( position, OSRM.DEFAULTS.ZOOM_LEVEL);
|
||||
|
||||
// map events
|
||||
OSRM.G.map.on('zoomend', OSRM.Map.zoomed );
|
||||
OSRM.G.map.on('click', OSRM.Map.click );
|
||||
OSRM.G.map.on('contextmenu', OSRM.Map.contextmenu );
|
||||
OSRM.G.map.on('mousemove', OSRM.Map.mousemove );
|
||||
},
|
||||
|
||||
// map event handlers
|
||||
zoomed: function(e) { OSRM.Routing.getRoute(); },
|
||||
contextmenu: function(e) {;},
|
||||
mousemove: function(e) { OSRM.Via.drawDragMarker(e); },
|
||||
click: function(e) {
|
||||
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();
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -19,39 +19,11 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
// [has to be loaded before all other OSRM classes]
|
||||
|
||||
var OSRM = {};
|
||||
OSRM.VERSION = '0.1.3';
|
||||
OSRM.DATE = '120402';
|
||||
OSRM.VERSION = '0.1.8';
|
||||
OSRM.DATE = '120831';
|
||||
OSRM.CONSTANTS = {};
|
||||
OSRM.DEFAULTS = {};
|
||||
OSRM.GLOBALS = {};
|
||||
OSRM.Control = {}; // control container
|
||||
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 } );
|
||||
|
||||
@@ -19,18 +19,93 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
// [has to be loaded directly after OSRM.base]
|
||||
|
||||
OSRM.DEFAULTS = {
|
||||
HOST_ROUTING_URL: 'http://router.project-osrm.org/viaroute',
|
||||
HOST_SHORTENER_URL: 'http://map.project-osrm.org/shorten/',
|
||||
ROUTING_ENGINES: [
|
||||
{ url: 'http://router.project-osrm.org/viaroute',
|
||||
timestamp: 'http://router.project-osrm.org/timestamp',
|
||||
metric: 0,
|
||||
label: 'ENGINE_0',
|
||||
}
|
||||
],
|
||||
|
||||
WEBSITE_URL: document.URL.replace(/#*(\?.*|$)/i,""), // truncates URL before first ?, and removes tailing #
|
||||
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 #
|
||||
JSONP_TIMEOUT: 5000,
|
||||
HOST_SHORTENER_URL: 'http://map.project-osrm.org/shorten/',
|
||||
|
||||
SHORTENER_PARAMETERS: '%url&jsonp=%jsonp',
|
||||
SHORTENER_REPLY_PARAMETER: 'ShortURL',
|
||||
|
||||
ROUTING_ENGINE: 0,
|
||||
DISTANCE_FORMAT: 0, // 0: km, 1: miles
|
||||
GEOCODER_BOUNDS: '',
|
||||
ZOOM_LEVEL: 14,
|
||||
HIGHLIGHT_ZOOM_LEVEL: 16,
|
||||
JSONP_TIMEOUT: 10000,
|
||||
|
||||
ONLOAD_ZOOM_LEVEL: 5,
|
||||
ONLOAD_LATITUDE: 48.84,
|
||||
ONLOAD_LONGITUDE: 10.10,
|
||||
ONLOAD_SOURCE: "",
|
||||
ONLOAD_TARGET: "",
|
||||
HIGHLIGHT_ZOOM_LEVEL: 16,
|
||||
|
||||
LANGUAGE: "en",
|
||||
GEOCODER_BOUNDS: '&bounded=1&viewbox=-27.0,72.0,46.0,36.0'
|
||||
};
|
||||
LANUGAGE_ONDEMAND_RELOADING: true,
|
||||
LANGUAGE_SUPPORTED: [
|
||||
{encoding:"en", name:"English"},
|
||||
{encoding:"bg", name:"Български"},
|
||||
{encoding:"cs", name:"Česky"},
|
||||
{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"},
|
||||
{encoding:"ru", name:"Русский"}
|
||||
],
|
||||
|
||||
TILE_SERVERS: [
|
||||
{ display_name: 'osm.org',
|
||||
url:'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
attribution:'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 Mapnik',
|
||||
options:{maxZoom: 18}
|
||||
},
|
||||
{ display_name: 'osm.de',
|
||||
url:'http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
|
||||
attribution:'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 Mapnik',
|
||||
options:{maxZoom: 18}
|
||||
},
|
||||
{ display_name: 'MapQuest',
|
||||
url:'http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png',
|
||||
attribution:'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 MapQuest',
|
||||
options:{maxZoom: 18, subdomains: '1234'}
|
||||
},
|
||||
{ display_name: 'CloudMade',
|
||||
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)
|
||||
options:{type:"Road", 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)
|
||||
options:{type:"Aerial", minZoom: 1},
|
||||
bing:true,
|
||||
}
|
||||
],
|
||||
|
||||
NOTIFICATIONS: {
|
||||
LOCALIZATION: 1800000, // 30min
|
||||
CLICKING: 60000, // 1min
|
||||
DRAGGING: 120000, // 2min
|
||||
MAINTENANCE: false
|
||||
},
|
||||
OVERRIDE_MAINTENANCE_NOTIFICATION_HEADER: undefined,
|
||||
OVERRIDE_MAINTENANCE_NOTIFICATION_BODY: undefined
|
||||
};
|
||||
|
||||
@@ -0,0 +1,297 @@
|
||||
/*
|
||||
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 geocoding routines
|
||||
// [geocoder query, management and display of geocoder results]
|
||||
|
||||
// some constants
|
||||
OSRM.CONSTANTS.SOURCE_LABEL = "source";
|
||||
OSRM.CONSTANTS.TARGET_LABEL = "target";
|
||||
OSRM.CONSTANTS.VIA_LABEL = "via";
|
||||
OSRM.CONSTANTS.DO_FALLBACK_TO_LAT_LNG = true;
|
||||
|
||||
|
||||
OSRM.Geocoder = {
|
||||
|
||||
//[normal geocoding]
|
||||
|
||||
// process input request and call geocoder if needed
|
||||
call: function(marker_id, query) {
|
||||
if(query=="")
|
||||
return;
|
||||
|
||||
// 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]);
|
||||
OSRM.Geocoder.updateAddress( marker_id );
|
||||
return;
|
||||
}
|
||||
|
||||
// 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} );
|
||||
},
|
||||
|
||||
|
||||
// helper function for clicks on geocoder search results
|
||||
_onclickResult: function(marker_id, lat, lon) {
|
||||
var index;
|
||||
if( marker_id == OSRM.C.SOURCE_LABEL )
|
||||
index = OSRM.G.markers.setSource( new L.LatLng(lat, lon) );
|
||||
else if( marker_id == OSRM.C.TARGET_LABEL )
|
||||
index = OSRM.G.markers.setTarget( new L.LatLng(lat, lon) );
|
||||
else
|
||||
return;
|
||||
|
||||
OSRM.G.markers.route[index].show();
|
||||
OSRM.G.markers.route[index].centerView();
|
||||
if( OSRM.G.markers.route.length > 1 )
|
||||
OSRM.Routing.getRoute();
|
||||
},
|
||||
|
||||
|
||||
// process geocoder response
|
||||
_showResults: function(response, parameters) {
|
||||
if(!response){
|
||||
OSRM.Geocoder._showResults_Empty(parameters);
|
||||
return;
|
||||
}
|
||||
if(response.length == 0) {
|
||||
OSRM.Geocoder._showResults_Empty(parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
// filter/sort inputs
|
||||
var filtered_response_temp = []; // filter results
|
||||
for(var i=0, iEnd=response.length; i < iEnd; i++){
|
||||
var result = response[i];
|
||||
if( OSRM.Geocoder._filterResult( result ) )
|
||||
continue;
|
||||
filtered_response_temp.push( result );
|
||||
}
|
||||
if(filtered_response_temp.length == 0) { // stop if no results remain
|
||||
OSRM.Geocoder._showResults_Empty(parameters);
|
||||
return;
|
||||
}
|
||||
filtered_response_temp.sort( OSRM.Geocoder._compareResults ); // rank results
|
||||
filtered_response_temp.sort( OSRM.Geocoder._compareLocations ); // remove duplicate locations (stable sort -> retain highest ranked)
|
||||
var filtered_response = [];
|
||||
filtered_response.push( filtered_response_temp[0] );
|
||||
for(var i=1, iEnd = filtered_response_temp.length; i<iEnd; i++) {
|
||||
var prev_result = filtered_response_temp[i-1];
|
||||
var result = filtered_response_temp[i];
|
||||
if( result.lat != prev_result.lat || result.lon != prev_result.lon ) {
|
||||
filtered_response.push( result );
|
||||
}
|
||||
}
|
||||
filtered_response.sort( OSRM.Geocoder._compareResults ); // rank results again
|
||||
|
||||
// show first result
|
||||
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;
|
||||
|
||||
// show possible results for input
|
||||
var html = "";
|
||||
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-body-odd';
|
||||
if(i%2==0) { rowstyle='results-body-even'; }
|
||||
|
||||
html += '<tr class="'+rowstyle+'">';
|
||||
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="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>";
|
||||
}
|
||||
html += '</table>';
|
||||
|
||||
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/,filtered_response.length)+")</div>";
|
||||
"<div class='header-content'>(found "+filtered_response.length+" results)"+"</div>";
|
||||
document.getElementById('information-box').innerHTML = html;
|
||||
},
|
||||
_showResults_Empty: function(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/,0)+")</div>";
|
||||
if(parameters.marker_id == OSRM.C.SOURCE_LABEL)
|
||||
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+OSRM.loc("NO_RESULTS_FOUND_SOURCE")+": "+parameters.query +"</div>";
|
||||
else if(parameters.marker_id == OSRM.C.TARGET_LABEL)
|
||||
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+OSRM.loc("NO_RESULTS_FOUND_TARGET")+": "+parameters.query +"</div>";
|
||||
else
|
||||
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+OSRM.loc("NO_RESULTS_FOUND")+": "+parameters.query +"</div>";
|
||||
},
|
||||
_showResults_Timeout: function() {
|
||||
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/,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: {
|
||||
boundary: 9000,
|
||||
place: 8000,
|
||||
highway: 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);
|
||||
},
|
||||
|
||||
|
||||
// comparator for sorting objects according to their locations
|
||||
_compareLocations: function(lhs, rhs) {
|
||||
if( lhs.lat != rhs.lat )
|
||||
return lhs.lat < rhs.lat;
|
||||
else
|
||||
return lhs.lon < rhs.lon;
|
||||
},
|
||||
|
||||
|
||||
// [reverse geocoding]
|
||||
|
||||
//update geo coordinates in input boxes
|
||||
updateLocation: function(marker_id) {
|
||||
if (marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource()) {
|
||||
document.getElementById("gui-input-source").value = OSRM.G.markers.route[0].getLat().toFixed(6) + ", " + OSRM.G.markers.route[0].getLng().toFixed(6);
|
||||
} else if (marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget()) {
|
||||
document.getElementById("gui-input-target").value = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLat().toFixed(6) + ", " + OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLng().toFixed(6);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// update address in input boxes
|
||||
updateAddress: function(marker_id, do_fallback_to_lat_lng) {
|
||||
// build request for reverse geocoder
|
||||
var lat = null;
|
||||
var lng = null;
|
||||
|
||||
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();
|
||||
} 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();
|
||||
} else
|
||||
return;
|
||||
|
||||
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} );
|
||||
},
|
||||
|
||||
|
||||
// processing JSONP response of reverse geocoder
|
||||
_showReverseResults: function(response, parameters) {
|
||||
if(!response) {
|
||||
OSRM.Geocoder._showReverseResults_Timeout(response, parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
if(response.address == undefined) {
|
||||
OSRM.Geocoder._showReverseResults_Timeout(response, parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
// build reverse geocoding address
|
||||
var used_address_data = 0;
|
||||
var address = "";
|
||||
if( response.address.road) {
|
||||
address += response.address.road;
|
||||
used_address_data++;
|
||||
}
|
||||
if( response.address.city ) {
|
||||
if( used_address_data > 0 )
|
||||
address += ", ";
|
||||
address += response.address.city;
|
||||
used_address_data++;
|
||||
} else if( response.address.village ) {
|
||||
if( used_address_data > 0 )
|
||||
address += ", ";
|
||||
address += response.address.village;
|
||||
used_address_data++;
|
||||
}
|
||||
if( used_address_data < 2 && response.address.country ) {
|
||||
if( used_address_data > 0 )
|
||||
address += ", ";
|
||||
address += response.address.country;
|
||||
used_address_data++;
|
||||
}
|
||||
if( used_address_data == 0 ) {
|
||||
OSRM.Geocoder._showReverseResults_Timeout(response, parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
// add result to DOM
|
||||
if(parameters.marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() )
|
||||
document.getElementById("gui-input-source").value = address;
|
||||
else if(parameters.marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() )
|
||||
document.getElementById("gui-input-target").value = address;
|
||||
},
|
||||
_showReverseResults_Timeout: function(response, parameters) {
|
||||
if(!parameters.do_fallback)
|
||||
return;
|
||||
|
||||
OSRM.Geocoder.updateLocation(parameters.marker_id);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -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 = [{color:'#FFFFFF', opacity:0.5, weight:5, dashArray:""},
|
||||
{color:'#0000DD', opacity:0.45, weight:5, dashArray:""},
|
||||
{color:'#0000BB', opacity:0.40, weight:5, dashArray:""},
|
||||
{color:'#000099', opacity:0.35, weight:5, dashArray:""},
|
||||
{color:'#000077', opacity:0.30, weight:5, dashArray:""},
|
||||
{color:'#000055', opacity:0.25, weight:5, dashArray:""},
|
||||
{color:'#000033', opacity:0.20, weight:5, dashArray:""},
|
||||
{color:'#000011', opacity:0.15, weight:5, dashArray:""},
|
||||
{color:'#000000', opacity:0.10, weight:5, dashArray:""}
|
||||
];
|
||||
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" , {dashArray:""} );
|
||||
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.G.active_routing_server_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];
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
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 map handling
|
||||
// [initialization, event handling, centering relative to UI]
|
||||
|
||||
// will hold the map object
|
||||
OSRM.GLOBALS.map = null;
|
||||
OSRM.GLOBALS.localizable_maps = [];
|
||||
|
||||
|
||||
// map controller
|
||||
// [map initialization, event handling]
|
||||
OSRM.Map = {
|
||||
|
||||
// map initialization
|
||||
init: function() {
|
||||
// check if GUI is initialized!
|
||||
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++) {
|
||||
if( tile_servers[i].bing == true ) {
|
||||
base_maps[ tile_servers[i].display_name ] = new L.BingLayer( tile_servers[i].apikey, tile_servers[i].options );
|
||||
OSRM.G.localizable_maps.push( base_maps[ tile_servers[i].display_name ] );
|
||||
} 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
|
||||
OSRM.G.map = new OSRM.Control.Map('map', {
|
||||
center: new L.LatLng(OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE),
|
||||
zoom: OSRM.DEFAULTS.ONLOAD_ZOOM_LEVEL,
|
||||
layers: [base_maps[tile_servers[0].display_name]],
|
||||
zoomAnimation: false, // animations have to be inactive during initialization (leaflet issue #918)
|
||||
fadeAnimation: false,
|
||||
zoomControl: false // use OSRM zoom buttons
|
||||
});
|
||||
|
||||
// add locations control
|
||||
OSRM.G.map.locationsControl = new OSRM.Control.Locations();
|
||||
OSRM.G.map.locationsControl.addTo(OSRM.G.map);
|
||||
|
||||
// add layer control
|
||||
OSRM.G.map.layerControl = new OSRM.Control.Layers(base_maps, {});
|
||||
OSRM.G.map.layerControl.addTo(OSRM.G.map);
|
||||
|
||||
// add zoom control
|
||||
OSRM.G.map.zoomControl = new OSRM.Control.Zoom();
|
||||
OSRM.G.map.zoomControl.addTo(OSRM.G.map);
|
||||
OSRM.G.map.zoomControl.show();
|
||||
|
||||
// add scale control
|
||||
OSRM.G.map.scaleControl = new L.Control.Scale();
|
||||
OSRM.G.map.scaleControl.options.metric = (OSRM.G.DISTANCE_FORMAT != 1);
|
||||
OSRM.G.map.scaleControl.options.imperial = (OSRM.G.DISTANCE_FORMAT == 1);
|
||||
OSRM.G.map.scaleControl.addTo(OSRM.G.map);
|
||||
|
||||
// map events
|
||||
OSRM.G.map.on('zoomend', OSRM.Map.zoomed );
|
||||
OSRM.G.map.on('click', OSRM.Map.click );
|
||||
OSRM.G.map.on('contextmenu', OSRM.Map.contextmenu );
|
||||
OSRM.G.map.on('mousemove', OSRM.Map.mousemove );
|
||||
},
|
||||
initFinally: function() {
|
||||
L.Util.setOptions( OSRM.G.map, {
|
||||
zoomAnimation: true,
|
||||
fadeAnimation: true
|
||||
} );
|
||||
},
|
||||
|
||||
// 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) {
|
||||
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.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.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,109 +15,32 @@ 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" , {dashArray:""} );
|
||||
this._alternative_route = new OSRM.SimpleRoute("alternative" , {dashArray:""} );
|
||||
this._old_route = new OSRM.SimpleRoute("old", {color:"#123", dashArray:""} );
|
||||
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};
|
||||
this._old_route_style = {dashed:false,color:'#112233', weight:5};
|
||||
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._current_route_style = {color:'#0033FF', weight:5, dashArray:""};
|
||||
this._current_noroute_style = {color:'#222222', weight:2, dashArray:"8,6"};
|
||||
this._old_route_style = {color:'#112233', weight:5, dashArray:""};
|
||||
this._old_noroute_style = {color:'#000000', weight:2, dashArray:"8,6"};
|
||||
this._unnamed_route_style = {color:'#FF00FF', weight:10, dashArray:""};
|
||||
this._old_unnamed_route_style = {color:'#990099', weight:10, dashArray:""};
|
||||
this._alternative_route_style = {color:'#770033', weight:5, opacity:0.6, dashArray:""};
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +78,7 @@ drawDragMarker: function(event) {
|
||||
|
||||
// get distance to route
|
||||
var minpoint = OSRM.G.route._current_route.route.closestLayerPoint( event.layerPoint );
|
||||
var min_dist = minpoint._sqDist;
|
||||
var min_dist = minpoint ? minpoint.distance : 1000;
|
||||
|
||||
// get distance to markers
|
||||
var mouse = event.latlng;
|
||||
@@ -111,7 +109,7 @@ drawDragMarker: function(event) {
|
||||
min_dist = 1000;
|
||||
}
|
||||
|
||||
if( min_dist < 400) {
|
||||
if( min_dist < 20) {
|
||||
OSRM.G.markers.dragger.setPosition( OSRM.G.map.layerPointToLatLng(minpoint) );
|
||||
OSRM.G.markers.dragger.show();
|
||||
} else
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
Copyright (c) 2011-2012, Pavel Shramov
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
of conditions and the following disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// TileLayer using BingMaps
|
||||
// [modified to support multiple cultures]
|
||||
|
||||
L.BingLayer = L.TileLayer.extend({
|
||||
options: {
|
||||
subdomains: [0, 1, 2, 3],
|
||||
type: 'Aerial', // supported: 'Road', 'Aerial', 'AerialWithLabels'
|
||||
attribution: 'Bing',
|
||||
culture: 'en-US'
|
||||
},
|
||||
|
||||
initialize: function(key, options) {
|
||||
L.Util.setOptions(this, options);
|
||||
|
||||
this._key = key;
|
||||
this._url = null;
|
||||
this.meta = {};
|
||||
this.loadMetadata();
|
||||
},
|
||||
|
||||
tile2quad: function(x, y, z) {
|
||||
var quad = '';
|
||||
for (var i = z; i > 0; i--) {
|
||||
var digit = 0;
|
||||
var mask = 1 << (i - 1);
|
||||
if ((x & mask) != 0) digit += 1;
|
||||
if ((y & mask) != 0) digit += 2;
|
||||
quad = quad + digit;
|
||||
}
|
||||
return quad;
|
||||
},
|
||||
|
||||
getTileUrl: function(p, z) {
|
||||
var z = this._getZoomForUrl();
|
||||
var subdomains = this.options.subdomains,
|
||||
s = this.options.subdomains[(p.x + p.y) % subdomains.length];
|
||||
return this._url.replace('{subdomain}', s)
|
||||
.replace('{quadkey}', this.tile2quad(p.x, p.y, z))
|
||||
.replace('{culture}', this.options.culture);
|
||||
},
|
||||
|
||||
loadMetadata: function() {
|
||||
var _this = this;
|
||||
var cbid = '_bing_metadata_' + L.Util.stamp(this);
|
||||
window[cbid] = function (meta) {
|
||||
_this.meta = meta;
|
||||
window[cbid] = undefined;
|
||||
var e = document.getElementById(cbid);
|
||||
e.parentNode.removeChild(e);
|
||||
if (meta.errorDetails) {
|
||||
alert("Got metadata" + meta.errorDetails);
|
||||
return;
|
||||
}
|
||||
_this.initMetadata();
|
||||
};
|
||||
var url = "http://dev.virtualearth.net/REST/v1/Imagery/Metadata/" + this.options.type + "?include=ImageryProviders&jsonp=" + cbid + "&key=" + this._key;
|
||||
var script = document.createElement("script");
|
||||
script.type = "text/javascript";
|
||||
script.src = url;
|
||||
script.id = cbid;
|
||||
document.getElementsByTagName("head")[0].appendChild(script);
|
||||
},
|
||||
|
||||
initMetadata: function() {
|
||||
var r = this.meta.resourceSets[0].resources[0];
|
||||
this.options.subdomains = r.imageUrlSubdomains;
|
||||
this._url = r.imageUrl;
|
||||
this._providers = [];
|
||||
for (var i = 0; i < r.imageryProviders.length; i++) {
|
||||
var p = r.imageryProviders[i];
|
||||
for (var j = 0; j < p.coverageAreas.length; j++) {
|
||||
var c = p.coverageAreas[j];
|
||||
var coverage = {zoomMin: c.zoomMin, zoomMax: c.zoomMax, active: false};
|
||||
var bounds = new L.LatLngBounds(
|
||||
new L.LatLng(c.bbox[0]+0.01, c.bbox[1]+0.01),
|
||||
new L.LatLng(c.bbox[2]-0.01, c.bbox[3]-0.01)
|
||||
);
|
||||
coverage.bounds = bounds;
|
||||
coverage.attrib = p.attribution;
|
||||
this._providers.push(coverage);
|
||||
}
|
||||
}
|
||||
this._update();
|
||||
},
|
||||
|
||||
_update: function() {
|
||||
if (this._url == null || !this._map) return;
|
||||
this._update_attribution();
|
||||
L.TileLayer.prototype._update.apply(this, []);
|
||||
},
|
||||
|
||||
_update_attribution: function() {
|
||||
var bounds = this._map.getBounds();
|
||||
var zoom = this._map.getZoom();
|
||||
if(this._map.attributionControl) // check if attributionControl is active
|
||||
for (var i = 0; i < this._providers.length; i++) {
|
||||
var p = this._providers[i];
|
||||
if ((zoom <= p.zoomMax && zoom >= p.zoomMin) &&
|
||||
bounds.intersects(p.bounds)) {
|
||||
if (!p.active)
|
||||
this._map.attributionControl.addAttribution(p.attrib);
|
||||
p.active = true;
|
||||
} else {
|
||||
if (p.active)
|
||||
this._map.attributionControl.removeAttribution(p.attrib);
|
||||
p.active = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onRemove: function(map) {
|
||||
if(this._map.attributionControl) // check if attributionControl is activ
|
||||
for (var i = 0; i < this._providers.length; i++) {
|
||||
var p = this._providers[i];
|
||||
if (p.active) {
|
||||
this._map.attributionControl.removeAttribution(p.attrib);
|
||||
p.active = false;
|
||||
}
|
||||
}
|
||||
L.TileLayer.prototype.onRemove.apply(this, [map]);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Leaflet bugfixes
|
||||
// [assorted bugfixes to Leaflet functions we use]
|
||||
|
||||
|
||||
// bugfix for issue #892 of Leaflet
|
||||
L.DomUtil.enableTextSelection = function () {
|
||||
if( !document.onselectstart )
|
||||
return;
|
||||
document.onselectstart = this._onselectstart;
|
||||
this._onselectstart = null;
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Leaflet extension: LabelMarker
|
||||
// [marker class that allows for changing icons while dragging]
|
||||
|
||||
|
||||
// extended marker class
|
||||
L.LabelMarker = L.Marker.extend({
|
||||
// change marker icon
|
||||
changeIcon: function( icon ) {
|
||||
this.options.icon = icon;
|
||||
|
||||
if (this._map) {
|
||||
this._changeIcon();
|
||||
}
|
||||
},
|
||||
|
||||
// add/change marker label
|
||||
setLabel: function( label ) {
|
||||
if(this._icon) {
|
||||
this._icon.lastChild.innerHTML=label;
|
||||
this._icon.lastChild.style.display = "block";
|
||||
}
|
||||
},
|
||||
|
||||
// actual icon changing routine
|
||||
_changeIcon: function () {
|
||||
var options = this.options,
|
||||
map = this._map,
|
||||
animation = (map.options.zoomAnimation && map.options.markerZoomAnimation),
|
||||
classToAdd = animation ? 'leaflet-zoom-animated' : 'leaflet-zoom-hide';
|
||||
|
||||
if (this._icon) {
|
||||
this._icon = options.icon.changeIcon( this._icon );
|
||||
L.DomUtil.addClass(this._icon, classToAdd);
|
||||
L.DomUtil.addClass(this._icon, 'leaflet-clickable');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Leaflet extension: LabelMarkerIcon
|
||||
// [icon class with extra label and simple icon changing]
|
||||
|
||||
|
||||
// extended icon class
|
||||
L.LabelMarkerIcon = L.Icon.extend({
|
||||
// altered icon creation (with label)
|
||||
_createImg: function (src) {
|
||||
var el;
|
||||
if (!L.Browser.ie6) {
|
||||
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 + '")';
|
||||
}
|
||||
return el;
|
||||
},
|
||||
|
||||
// non-destructive icon changing
|
||||
changeIcon: function (el) {
|
||||
return this._changeIcon('icon', el);
|
||||
},
|
||||
|
||||
changeShadow: function (el) {
|
||||
return this.options.shadowUrl ? this._changeIcon('shadow', el) : null;
|
||||
},
|
||||
|
||||
_changeIcon: function (name, el) {
|
||||
var src = this._getIconUrl(name);
|
||||
if (!src) {
|
||||
if (name === 'icon') {
|
||||
throw new Error("iconUrl not set in Icon options (see the docs).");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
var img = this._changeImg(src, el);
|
||||
this._setIconStyles(img, name);
|
||||
|
||||
return img;
|
||||
},
|
||||
|
||||
_changeImg: function (src, el) {
|
||||
if (!L.Browser.ie6) {
|
||||
el.firstChild.src = src;
|
||||
} else {
|
||||
el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")';
|
||||
}
|
||||
return el;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
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 Layers control
|
||||
// [extension of Layers.Control with OSRM styling and additional query methods]
|
||||
OSRM.Control.Layers = L.Control.Layers.extend({
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// overwrite Control.Layers methods to get OSRM styling
|
||||
_initLayout: function () {
|
||||
L.Control.Layers.prototype._initLayout.apply(this);
|
||||
this._container.className = "box-wrapper gui-control-wrapper";
|
||||
this._layersLink.className = "box-content gui-control gui-layers";
|
||||
this._form.className = "box-content gui-control gui-layers-list medium-font";
|
||||
|
||||
this._baseLayersList.className = "gui-layers-base";
|
||||
this._separator.className = "gui-layers-separator";
|
||||
this._overlaysList.className = "gui-layers-overlays";
|
||||
},
|
||||
_expand: function () {
|
||||
L.DomUtil.addClass(this._container, 'gui-layers-expanded');
|
||||
},
|
||||
_collapse: function () {
|
||||
this._container.className = this._container.className.replace(' gui-layers-expanded', '');
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// locations control
|
||||
// [navigation buttons for important locations - zoom on route, zoom on user]
|
||||
OSRM.Control.Locations = L.Control.extend({
|
||||
options: {
|
||||
position: 'topright'
|
||||
},
|
||||
|
||||
onAdd: function (map) {
|
||||
// create wrapper
|
||||
var container = L.DomUtil.create('div', 'box-wrapper gui-control-wrapper');
|
||||
L.DomEvent.disableClickPropagation(container);
|
||||
|
||||
// create buttons
|
||||
this._userButton = this._createButton('gui-locations-user', container, OSRM.GUI.zoomOnUser, map, !!navigator.geolocation );
|
||||
this._routeButton = this._createButton('gui-locations-route', container, OSRM.GUI.zoomOnRoute, map, false);
|
||||
|
||||
this._container = container;
|
||||
return container;
|
||||
},
|
||||
|
||||
_createButton: function (id, container, fn, context, isActive) {
|
||||
var inactive = (isActive == false) ? "-inactive" : "";
|
||||
var classNames = "box-content" + " " + "gui-control"+inactive + " " + id+inactive;
|
||||
var link = L.DomUtil.create('a', classNames, container);
|
||||
link.title = id;
|
||||
|
||||
L.DomEvent
|
||||
.on(link, 'click', L.DomEvent.stopPropagation)
|
||||
.on(link, 'click', L.DomEvent.preventDefault)
|
||||
.on(link, 'click', fn, context)
|
||||
.on(link, 'dblclick', L.DomEvent.stopPropagation);
|
||||
|
||||
return link;
|
||||
},
|
||||
|
||||
activateRoute: function() {
|
||||
this._routeButton.className = "box-content gui-control gui-locations-route";
|
||||
},
|
||||
deactivateRoute: function() {
|
||||
this._routeButton.className = "box-content gui-control-inactive gui-locations-route-inactive";
|
||||
},
|
||||
setTooltips: function( userButton, routeButton) {
|
||||
this._userButton.title = userButton;
|
||||
this._routeButton.title = routeButton;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
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 Map control
|
||||
// [extension of L.Map with additional view & bounds methods that respect OSRM UI visibility; methods for querying active layers]
|
||||
OSRM.Control.Map = 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);
|
||||
},
|
||||
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;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// zoom control
|
||||
// [modified zoom control with ids, prevention of click propagation, show/hide with respect to main OSRM window]
|
||||
OSRM.Control.Zoom = L.Control.extend({
|
||||
options: {
|
||||
position: 'topleft'
|
||||
},
|
||||
|
||||
onAdd: function (map) {
|
||||
// create wrapper
|
||||
var container = L.DomUtil.create('div', 'box-wrapper gui-control-wrapper');
|
||||
L.DomEvent.disableClickPropagation(container);
|
||||
|
||||
// create buttons
|
||||
this._zoomIn = this._createButton('gui-zoom-in', container, map.zoomIn, map, true);
|
||||
this._zoomOut = this._createButton('gui-zoom-out', container, map.zoomOut, map, true);
|
||||
|
||||
this._container = container;
|
||||
return container;
|
||||
},
|
||||
|
||||
_createButton: function (id, container, fn, context, isActive) {
|
||||
var inactive = (isActive == false) ? "-inactive" : "";
|
||||
var classNames = "box-content" + " " + "gui-control"+inactive + " " + id+inactive;
|
||||
var link = L.DomUtil.create('a', classNames, container);
|
||||
link.title = id;
|
||||
|
||||
L.DomEvent
|
||||
.on(link, 'click', L.DomEvent.stopPropagation)
|
||||
.on(link, 'click', L.DomEvent.preventDefault)
|
||||
.on(link, 'click', fn, context)
|
||||
.on(link, 'dblclick', L.DomEvent.stopPropagation);
|
||||
|
||||
return link;
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
if( this._container )
|
||||
this._container.style.visibility="hidden";
|
||||
},
|
||||
|
||||
show: function() {
|
||||
if( this._container ) {
|
||||
this._container.style.top = "5px";
|
||||
this._container.style.left = ( OSRM.G.main_handle.boxVisible() == true ? (OSRM.G.main_handle.boxWidth()+10) : "30") + "px";
|
||||
this._container.style.visibility="visible";
|
||||
}
|
||||
},
|
||||
setTooltips: function( zoomIn, zoomOut) {
|
||||
this._zoomIn.title = zoomIn;
|
||||
this._zoomOut.title = zoomOut;
|
||||
}
|
||||
});
|
||||
@@ -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)
|
||||
@@ -24,7 +24,7 @@ OSRM.Marker = function( label, style, position ) {
|
||||
this.label = label ? label : "marker";
|
||||
this.position = position ? position : new L.LatLng(0,0);
|
||||
|
||||
this.marker = new L.MouseMarker( this.position, style );
|
||||
this.marker = new L.LabelMarker( this.position, style );
|
||||
this.marker.parent = this;
|
||||
|
||||
this.shown = false;
|
||||
@@ -90,16 +90,18 @@ onClick: function(e) {
|
||||
|
||||
OSRM.Routing.getRoute();
|
||||
OSRM.G.markers.highlight.hide();
|
||||
OSRM.G.markers.dragger.hide();
|
||||
},
|
||||
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);
|
||||
this.changeIcon(this.options.dragicon);
|
||||
|
||||
// store id of dragged marker
|
||||
for( var i=0; i<OSRM.G.markers.route.length; i++)
|
||||
@@ -109,23 +111,25 @@ onDragStart: function(e) {
|
||||
}
|
||||
|
||||
if( this.parent != OSRM.G.markers.highlight)
|
||||
OSRM.G.markers.highlight.hide();
|
||||
OSRM.G.markers.highlight.hide();
|
||||
if( this.parent != OSRM.G.markers.dragger)
|
||||
OSRM.G.markers.dragger.hide();
|
||||
if (OSRM.G.route.isShown())
|
||||
OSRM.G.route.showOldRoute();
|
||||
},
|
||||
onDragEnd: function(e) {
|
||||
OSRM.G.dragging = false;
|
||||
this.switchIcon(this.options.baseicon);
|
||||
this.changeIcon(this.options.baseicon);
|
||||
|
||||
this.parent.setPosition( e.target.getLatLng() );
|
||||
OSRM.Routing.getRoute();
|
||||
if (OSRM.G.route.isShown()) {
|
||||
OSRM.Routing.getRoute();
|
||||
OSRM.G.route.hideOldRoute();
|
||||
OSRM.G.route.hideUnnamedRoute();
|
||||
}
|
||||
|
||||
if(OSRM.G.route.isShown()==false)
|
||||
} else {
|
||||
OSRM.Geocoder.updateAddress(this.parent.label);
|
||||
OSRM.GUI.clearResults();
|
||||
}
|
||||
},
|
||||
toString: function() {
|
||||
return "OSRM.RouteMarker: \""+this.label+"\", "+this.position+")";
|
||||
@@ -141,7 +145,8 @@ OSRM.DragMarker = function ( label, style, position ) {
|
||||
OSRM.inheritFrom( OSRM.DragMarker, OSRM.RouteMarker );
|
||||
OSRM.extend( OSRM.DragMarker, {
|
||||
onClick: function(e) {
|
||||
this.parent.hide();
|
||||
if( this.parent != OSRM.G.markers.dragger)
|
||||
this.parent.hide();
|
||||
},
|
||||
onDragStart: function(e) {
|
||||
var new_via_index = OSRM.Via.findViaIndex( e.target.getLatLng() );
|
||||
@@ -160,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('delete-source-marker').style.visibility = "hidden";
|
||||
document.getElementById('delete-target-marker').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('delete-source-marker').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('delete-target-marker').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('input-source-name').value = "";
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-headline').innerHTML = "";
|
||||
document.getElementById('delete-source-marker').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('input-target-name').value = "";
|
||||
document.getElementById('information-box').innerHTML = "";
|
||||
document.getElementById('information-box-headline').innerHTML = "";
|
||||
document.getElementById('delete-target-marker').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,95 @@
|
||||
/*
|
||||
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.Polyline( [], 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.Polyline( 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';
|
||||
icon.title = box_name;
|
||||
|
||||
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";
|
||||
},
|
||||
$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,144 @@
|
||||
/*
|
||||
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.initDistanceFormatsSelector();
|
||||
},
|
||||
|
||||
// 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").lastChild.nodeValue = OSRM.loc("GUI_HIGHLIGHT_UNNAMED_ROADS");
|
||||
document.getElementById("gui-option-show-previous-routes-label").lastChild.nodeValue = 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-label').innerHTML = OSRM.loc("GUI_DATA_TIMESTAMP");
|
||||
document.getElementById('gui-data-timestamp').innerHTML = OSRM.G.data_timestamp;
|
||||
document.getElementById('gui-timestamp-label').innerHTML = OSRM.loc("GUI_VERSION");
|
||||
document.getElementById('gui-timestamp').innerHTML = OSRM.DATE+"; v"+OSRM.VERSION;
|
||||
document.getElementById('config-handle-icon').title = OSRM.loc("GUI_CONFIGURATION");
|
||||
document.getElementById('mapping-handle-icon').title = OSRM.loc("GUI_MAPPING_TOOLS");
|
||||
document.getElementById('main-handle-icon').title = OSRM.loc("GUI_MAIN_WINDOW");
|
||||
OSRM.G.map.zoomControl.setTooltips( OSRM.loc("GUI_ZOOM_IN"), OSRM.loc("GUI_ZOOM_OUT") );
|
||||
OSRM.G.map.locationsControl.setTooltips( OSRM.loc("GUI_ZOOM_ON_USER"), OSRM.loc("GUI_ZOOM_ON_ROUTE") );
|
||||
OSRM.GUI.setDistanceFormatsLanguage();
|
||||
OSRM.GUI.setRoutingEnginesLanguage();
|
||||
},
|
||||
|
||||
// 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() {
|
||||
OSRM.G.map.zoomControl.hide();
|
||||
},
|
||||
// show zoom controls after main box animation
|
||||
afterMainTransition: function() {
|
||||
OSRM.G.map.zoomControl.show();
|
||||
},
|
||||
|
||||
// distance format routines
|
||||
initDistanceFormatsSelector: function() {
|
||||
var options = OSRM.GUI.getDistanceFormats();
|
||||
OSRM.GUI.selectorInit( "gui-units-toggle", options, OSRM.DEFAULTS.DISTANCE_FORMAT, OSRM.GUI._onDistanceFormatChanged );
|
||||
},
|
||||
setDistanceFormat: function(type) {
|
||||
if( OSRM.G.active_distance_format == type )
|
||||
return;
|
||||
OSRM.G.active_distance_format = type;
|
||||
|
||||
// change scale control
|
||||
if(OSRM.G.map) {
|
||||
OSRM.G.map.scaleControl.removeFrom(OSRM.G.map);
|
||||
OSRM.G.map.scaleControl.options.metric = (type != 1);
|
||||
OSRM.G.map.scaleControl.options.imperial = (type == 1);
|
||||
OSRM.G.map.scaleControl.addTo(OSRM.G.map);
|
||||
}
|
||||
|
||||
// change converter
|
||||
if( type == 1 )
|
||||
OSRM.Utils.toHumanDistance = OSRM.Utils.toHumanDistanceMiles;
|
||||
else
|
||||
OSRM.Utils.toHumanDistance = OSRM.Utils.toHumanDistanceMeters;
|
||||
},
|
||||
_onDistanceFormatChanged: function(type) {
|
||||
OSRM.GUI.setDistanceFormat(type);
|
||||
OSRM.Routing.getRoute({keepAlternative:true});
|
||||
},
|
||||
setDistanceFormatsLanguage: function() {
|
||||
var options = OSRM.GUI.getDistanceFormats();
|
||||
OSRM.GUI.selectorRenameOptions("gui-units-toggle", options );
|
||||
},
|
||||
getDistanceFormats: function() {
|
||||
return [{display:OSRM.loc("GUI_KILOMETERS"),value:0},{display:OSRM.loc("GUI_MILES"),value:1}];
|
||||
},
|
||||
|
||||
// data timestamp routines
|
||||
queryDataTimestamp: function() {
|
||||
OSRM.G.data_timestamp = "n/a";
|
||||
OSRM.JSONP.call( OSRM.G.active_routing_timestamp_url+"?jsonp=%jsonp", OSRM.GUI.setDataTimestamp, OSRM.JSONP.empty, OSRM.DEFAULTS.JSONP_TIMEOUT, 'data_timestamp');
|
||||
},
|
||||
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.G.data_timestamp;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
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
|
||||
activeExclusive: undefined,
|
||||
activeTooltip: undefined,
|
||||
tooltips: {},
|
||||
// LOCALIZATION: deactivation triggered in OSRM.Localization.setLanguageWrapper
|
||||
// CLICKING: deactivation triggered in OSRM.Map.click
|
||||
// DRAGGING: deactivation triggered in OSRM.Routing.getRoute_Dragging
|
||||
// MAINTENANCE: deactivation only by config
|
||||
|
||||
|
||||
// initialize notifications and tooltip timers
|
||||
init: function() {
|
||||
// exclusive notifications
|
||||
var config = OSRM.DEFAULTS.NOTIFICATIONS;
|
||||
if( config["MAINTENANCE"] == true ) {
|
||||
var header = OSRM.DEFAULTS.OVERRIDE_MAINTENANCE_NOTIFICATION_HEADER || OSRM.loc("NOTIFICATION_MAINTENANCE_HEADER");
|
||||
var body = OSRM.DEFAULTS.OVERRIDE_MAINTENANCE_NOTIFICATION_BODY || OSRM.loc("NOTIFICATION_MAINTENANCE_BODY");
|
||||
OSRM.GUI.exclusiveNotify( header, body, false);
|
||||
OSRM.GUI.activeExclusive = "MAINTENANCE";
|
||||
return;
|
||||
}
|
||||
|
||||
// tooltip timers
|
||||
var config = OSRM.DEFAULTS.NOTIFICATIONS;
|
||||
var tooltips = OSRM.GUI.tooltips;
|
||||
for( id in config ) {
|
||||
// skip notification?
|
||||
if( !OSRM.Utils.isNumber( config[id] ) )
|
||||
continue;
|
||||
// create structure to hold timer data
|
||||
tooltips[id] = {};
|
||||
// start timer
|
||||
tooltips[id]._timer = setTimeout(
|
||||
function(_id){ return function(){OSRM.GUI._showTooltip(_id);}; }(id),
|
||||
config[id]
|
||||
);
|
||||
|
||||
// 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;
|
||||
// only show tooltip if it exists
|
||||
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
|
||||
var config = OSRM.DEFAULTS.NOTIFICATIONS;
|
||||
if( OSRM.GUI.isTooltipVisible() ) {
|
||||
tooltips[id]._timer = setTimeout(
|
||||
function(_id){ return function(){OSRM.GUI._showTooltip(_id);}; }(id),
|
||||
config[id]
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// show notification
|
||||
OSRM.GUI.tooltipNotify( OSRM.loc("NOTIFICATION_"+id+"_HEADER"), OSRM.loc("NOTIFICATION_"+id+"_BODY") );
|
||||
OSRM.GUI.activeTooltip = id;
|
||||
|
||||
// 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";
|
||||
OSRM.GUI.exclusiveResize();
|
||||
},
|
||||
exclusiveDenotify: function() {
|
||||
document.getElementById('exclusive-notification-blanket').style.display = "none";
|
||||
OSRM.GUI.activeExclusive = undefined;
|
||||
},
|
||||
exclusiveUpdate: function() {
|
||||
if( OSRM.GUI.activeExclusive == undefined )
|
||||
return;
|
||||
|
||||
// override mainly intended for maintenance mode
|
||||
var header = OSRM.DEFAULTS["OVERRIDE_"+OSRM.GUI.activeExclusive+"_HEADER"] || OSRM.loc("NOTIFICATION_MAINTENANCE_HEADER");
|
||||
var body = OSRM.DEFAULTS["OVERRIDE_"+OSRM.GUI.activeExclusive+"_BODY"] || OSRM.loc("NOTIFICATION_MAINTENANCE_BODY");
|
||||
|
||||
document.getElementById('exclusive-notification-label').innerHTML = header;
|
||||
document.getElementById('exclusive-notification-box').innerHTML = body;
|
||||
OSRM.GUI.exclusiveResize();
|
||||
},
|
||||
exclusiveResize: function() {
|
||||
var height = document.getElementById('exclusive-notification-box').clientHeight;
|
||||
document.getElementById('exclusive-notification-content').style.height = (height + 28) + "px";
|
||||
document.getElementById('exclusive-notification-wrapper').style.height = (height + 48) + "px";
|
||||
},
|
||||
inMaintenance: function() {
|
||||
return OSRM.GUI.activeExclusive == "MAINTENANCE";
|
||||
},
|
||||
|
||||
// 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;
|
||||
},
|
||||
tooltipDenotify: function() {
|
||||
document.getElementById('tooltip-notification-wrapper').style.display = "none";
|
||||
OSRM.GUI.activeTooltip = undefined;
|
||||
},
|
||||
tooltipUpdate: function() {
|
||||
if( OSRM.GUI.activeTooltip == undefined )
|
||||
return;
|
||||
document.getElementById('tooltip-notification-label').innerHTML = OSRM.loc("NOTIFICATION_"+OSRM.GUI.activeTooltip+"_HEADER");
|
||||
document.getElementById('tooltip-notification-box').innerHTML = OSRM.loc("NOTIFICATION_"+OSRM.GUI.activeTooltip+"_BODY");
|
||||
OSRM.GUI.tooltipResize();
|
||||
OSRM.GUI.tooltipResize(); // simple trick to retain opened/closed state of tooltip
|
||||
},
|
||||
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";
|
||||
}
|
||||
},
|
||||
isTooltipVisible: function() {
|
||||
return document.getElementById('tooltip-notification-wrapper').style.display == "block";
|
||||
},
|
||||
|
||||
|
||||
// update language of any notification
|
||||
updateNotifications: function() {
|
||||
OSRM.GUI.exclusiveUpdate();
|
||||
OSRM.GUI.tooltipUpdate();
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
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 RoutingEngineGUI
|
||||
// [handles all GUI aspects that deals with switching the routing engine]
|
||||
|
||||
|
||||
OSRM.GUI.extend( {
|
||||
|
||||
// init
|
||||
init: function() {
|
||||
// gather routing engines
|
||||
var options = OSRM.GUI.getRoutingEngines();
|
||||
|
||||
// generate selectors
|
||||
OSRM.GUI.selectorInit("gui-engine-toggle", options, OSRM.DEFAULTS.ROUTING_ENGINE, OSRM.GUI._onRoutingEngineChanged);
|
||||
},
|
||||
|
||||
// change active routing engine
|
||||
setRoutingEngine: function(engine) {
|
||||
if( engine == OSRM.G.active_routing_engine )
|
||||
return;
|
||||
|
||||
OSRM.GUI.selectorChange( 'gui-engine-toggle', engine );
|
||||
|
||||
OSRM.G.active_routing_engine = engine;
|
||||
OSRM.G.active_routing_metric = OSRM.DEFAULTS.ROUTING_ENGINES[ OSRM.G.active_routing_engine ].metric;;
|
||||
OSRM.G.active_routing_server_url = OSRM.DEFAULTS.ROUTING_ENGINES[ OSRM.G.active_routing_engine ].url;
|
||||
OSRM.G.active_routing_timestamp_url = OSRM.DEFAULTS.ROUTING_ENGINES[ OSRM.G.active_routing_engine ].timestamp;
|
||||
|
||||
// requery data timestamp
|
||||
OSRM.GUI.queryDataTimestamp();
|
||||
OSRM.JSONP.call( OSRM.DEFAULTS.ROUTING_ENGINES[ OSRM.G.active_routing_engine ].timestamp+"?jsonp=%jsonp", OSRM.GUI.setDataTimestamp, OSRM.GUI.setDataTimestampTimeout, OSRM.DEFAULTS.JSONP_TIMEOUT, 'data_timestamp');
|
||||
},
|
||||
_onRoutingEngineChanged: function(engine) {
|
||||
if( engine == OSRM.G.active_routing_engine )
|
||||
return;
|
||||
|
||||
OSRM.GUI.setRoutingEngine( engine );
|
||||
|
||||
// requery route
|
||||
if( OSRM.G.markers.route.length > 1 )
|
||||
OSRM.Routing.getRoute();
|
||||
},
|
||||
|
||||
// change language of routing engine entries
|
||||
setRoutingEnginesLanguage: function() {
|
||||
// gather routing engines
|
||||
var options = OSRM.GUI.getRoutingEngines();
|
||||
|
||||
// change dropdown menu names
|
||||
OSRM.GUI.selectorRenameOptions( "gui-engine-toggle", options );
|
||||
},
|
||||
|
||||
// gather routing engines
|
||||
getRoutingEngines: function() {
|
||||
var engines = OSRM.DEFAULTS.ROUTING_ENGINES;
|
||||
var options = [];
|
||||
for(var i=0, size=engines.length; i<size; i++) {
|
||||
options.push( {display:OSRM.loc(engines[i].label), value:i} );
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
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.GUI.setDistanceFormat(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-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();
|
||||
OSRM.G.map.locationsControl.activateRoute();
|
||||
OSRM.G.active_shortlink = null; // delete shortlink when new route is shown (RoutingDescription calls this method!)
|
||||
},
|
||||
deactivateRouteFeatures: function() {
|
||||
OSRM.Printing.deactivate();
|
||||
OSRM.G.map.locationsControl.deactivateRoute();
|
||||
OSRM.G.active_shortlink = null; // delete shortlink when the route is hidden
|
||||
},
|
||||
|
||||
// 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: button "zoom on user"
|
||||
zoomOnUser: function() {
|
||||
if (navigator.geolocation)
|
||||
navigator.geolocation.getCurrentPosition(OSRM.Map.geolocationResponse);
|
||||
},
|
||||
|
||||
//click: toggle highlighting unnamed streets
|
||||
hightlightNonames: function() {
|
||||
OSRM.Routing.getRoute_Redraw({keepAlternative:true});
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
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(id, value) {
|
||||
var select = document.getElementById(id);
|
||||
select.value = value;
|
||||
OSRM.GUI._selectorOnChange(select);
|
||||
},
|
||||
|
||||
// replace selector options with new names
|
||||
selectorRenameOptions: function(id, options) {
|
||||
var select = document.getElementById(id);
|
||||
var styledSelect = document.getElementById("styled-select-"+id);
|
||||
|
||||
// create new dropdown menu
|
||||
var new_select = document.createElement("select");
|
||||
new_select.id = id;
|
||||
new_select.className = select.className;
|
||||
new_select.onchange = select.onchange;
|
||||
|
||||
// fill new dropdown menu
|
||||
var selected_display = "";
|
||||
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;
|
||||
new_select.appendChild(option);
|
||||
|
||||
if( options[i].value == select.value )
|
||||
selected_display = options[i].display;
|
||||
}
|
||||
new_select.value = select.value;
|
||||
|
||||
// switch old with new dropdown menu
|
||||
select.parentNode.insertBefore(new_select, select);
|
||||
select.parentNode.removeChild(select);
|
||||
|
||||
// change styled dropdown menu size & language
|
||||
styledSelect.childNodes[0].nodeValue = selected_display;
|
||||
styledSelect.style.width = (new_select.offsetWidth-2)+"px";
|
||||
styledSelect.style.height = (new_select.offsetHeight)+"px";
|
||||
|
||||
// // old variant without creating a new dropdown menu (works in current browsers, but not in older FF or IE)
|
||||
// var select = document.getElementById(id);
|
||||
// var select_options = select.getElementsByTagName("option");
|
||||
// var styledSelect = document.getElementById("styled-select-"+id);
|
||||
//
|
||||
// // fill dropdown menu with new option names
|
||||
// for(var i = 0; i < select_options.length; i++) {
|
||||
// select_options[i].childNodes[0].nodeValue = options[i].display;
|
||||
//
|
||||
// if(select_options[i].selected == true)
|
||||
// styledSelect.childNodes[0].nodeValue = options[i].display;
|
||||
// }
|
||||
//
|
||||
// // resize visible dropdown menu as needed
|
||||
// styledSelect.style.width = (select.offsetWidth-2)+"px";
|
||||
// styledSelect.style.height = (select.offsetHeight)+"px"; // clientHeight gives the height of the opened dropbox!
|
||||
}
|
||||
|
||||
});
|
||||
|
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: 534 B |
|
After Width: | Height: | Size: 690 B |
|
After Width: | Height: | Size: 737 B |
|
After Width: | Height: | Size: 713 B |
|
After Width: | Height: | Size: 700 B |
|
After Width: | Height: | Size: 684 B |
|
After Width: | Height: | Size: 824 B |
|
After Width: | Height: | Size: 817 B |
|
After Width: | Height: | Size: 913 B |
|
After Width: | Height: | Size: 329 B |
|
After Width: | Height: | Size: 378 B |
|
After Width: | Height: | Size: 347 B |
|
After Width: | Height: | Size: 347 B |
|
After Width: | Height: | Size: 349 B |
|
After Width: | Height: | Size: 350 B |
|
After Width: | Height: | Size: 322 B |
|
Before Width: | Height: | Size: 716 B |
|
Before Width: | Height: | Size: 617 B After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 446 B |
|
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 |
|
After Width: | Height: | Size: 163 B |
|
After Width: | Height: | Size: 169 B |
|
After Width: | Height: | Size: 165 B |
|
After Width: | Height: | Size: 153 B |
|
After Width: | Height: | Size: 156 B |
|
After Width: | Height: | Size: 155 B |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -11,14 +11,13 @@
|
||||
.leaflet-popup-pane,
|
||||
.leaflet-overlay-pane svg,
|
||||
.leaflet-zoom-box,
|
||||
.leaflet-image-layer { /* TODO optimize classes */
|
||||
.leaflet-image-layer,
|
||||
.leaflet-layer { /* TODO optimize classes */
|
||||
position: absolute;
|
||||
}
|
||||
.leaflet-container {
|
||||
overflow: hidden;
|
||||
}
|
||||
.leaflet-tile-pane, .leaflet-container {
|
||||
-webkit-transform: translate3d(0,0,0);
|
||||
outline: 0;
|
||||
}
|
||||
.leaflet-tile,
|
||||
.leaflet-marker-icon,
|
||||
@@ -34,44 +33,50 @@
|
||||
.leaflet-clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
.leaflet-dragging, .leaflet-dragging .leaflet-clickable {
|
||||
cursor: move;
|
||||
}
|
||||
.leaflet-container img {
|
||||
/* map is broken in FF if you have max-width: 100% on tiles */
|
||||
max-width: none !important;
|
||||
}
|
||||
.leaflet-container img.leaflet-image-layer {
|
||||
/* stupid Android 2 doesn't understand "max-width: none" properly */
|
||||
max-width: 15000px !important;
|
||||
}
|
||||
|
||||
.leaflet-tile-pane { z-index: 2; }
|
||||
|
||||
.leaflet-objects-pane { z-index: 3; }
|
||||
.leaflet-overlay-pane { z-index: 4; }
|
||||
.leaflet-shadow-pane { z-index: 5; }
|
||||
.leaflet-marker-pane { z-index: 6; }
|
||||
.leaflet-popup-pane { z-index: 7; }
|
||||
|
||||
.leaflet-zoom-box {
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.leaflet-tile {
|
||||
visibility: hidden;
|
||||
filter: inherit;
|
||||
visibility: hidden;
|
||||
}
|
||||
.leaflet-tile-loaded {
|
||||
visibility: inherit;
|
||||
}
|
||||
|
||||
a.leaflet-active {
|
||||
outline: 2px solid orange;
|
||||
}
|
||||
|
||||
.leaflet-zoom-box {
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/* Leaflet controls */
|
||||
|
||||
.leaflet-control {
|
||||
position: relative;
|
||||
z-index: 7;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.leaflet-top,
|
||||
.leaflet-bottom {
|
||||
position: absolute;
|
||||
z-index: 1000;
|
||||
pointer-events: none;
|
||||
}
|
||||
.leaflet-top {
|
||||
top: 0;
|
||||
@@ -105,7 +110,7 @@ a.leaflet-active {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.leaflet-control-zoom, .leaflet-control-layers {
|
||||
.leaflet-control-zoom {
|
||||
-moz-border-radius: 7px;
|
||||
-webkit-border-radius: 7px;
|
||||
border-radius: 7px;
|
||||
@@ -132,7 +137,7 @@ a.leaflet-active {
|
||||
.leaflet-control-zoom a:hover {
|
||||
background-color: #fff;
|
||||
}
|
||||
.leaflet-big-buttons .leaflet-control-zoom a {
|
||||
.leaflet-touch .leaflet-control-zoom a {
|
||||
width: 27px;
|
||||
height: 27px;
|
||||
}
|
||||
@@ -145,18 +150,18 @@ a.leaflet-active {
|
||||
}
|
||||
|
||||
.leaflet-control-layers {
|
||||
-moz-box-shadow: 0 0 7px #999;
|
||||
-webkit-box-shadow: 0 0 7px #999;
|
||||
box-shadow: 0 0 7px #999;
|
||||
|
||||
box-shadow: 0 1px 7px #999;
|
||||
background: #f8f8f9;
|
||||
-moz-border-radius: 8px;
|
||||
-webkit-border-radius: 8px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.leaflet-control-layers a {
|
||||
background-image: url(images/layers.png);
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
}
|
||||
.leaflet-big-buttons .leaflet-control-layers a {
|
||||
.leaflet-touch .leaflet-control-layers a {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
}
|
||||
@@ -189,23 +194,60 @@ a.leaflet-active {
|
||||
}
|
||||
|
||||
.leaflet-container .leaflet-control-attribution {
|
||||
margin: 0;
|
||||
padding: 0 5px;
|
||||
|
||||
font: 11px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
color: #333;
|
||||
|
||||
background-color: rgba(255, 255, 255, 0.7);
|
||||
box-shadow: 0 0 5px #bbb;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
-moz-box-shadow: 0 0 7px #ccc;
|
||||
-webkit-box-shadow: 0 0 7px #ccc;
|
||||
box-shadow: 0 0 7px #ccc;
|
||||
.leaflet-control-attribution,
|
||||
.leaflet-control-scale-line {
|
||||
padding: 0 5px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.leaflet-container .leaflet-control-attribution,
|
||||
.leaflet-container .leaflet-control-scale {
|
||||
font: 11px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
.leaflet-left .leaflet-control-scale {
|
||||
margin-left: 5px;
|
||||
}
|
||||
.leaflet-bottom .leaflet-control-scale {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.leaflet-control-scale-line {
|
||||
border: 2px solid #777;
|
||||
border-top: none;
|
||||
color: black;
|
||||
line-height: 1;
|
||||
font-size: 10px;
|
||||
padding-bottom: 2px;
|
||||
text-shadow: 1px 1px 1px #fff;
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
.leaflet-control-scale-line:not(:first-child) {
|
||||
border-top: 2px solid #777;
|
||||
padding-top: 1px;
|
||||
border-bottom: none;
|
||||
margin-top: -2px;
|
||||
}
|
||||
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
|
||||
border-bottom: 2px solid #777;
|
||||
}
|
||||
|
||||
.leaflet-touch .leaflet-control-attribution, .leaflet-touch .leaflet-control-layers {
|
||||
box-shadow: none;
|
||||
}
|
||||
.leaflet-touch .leaflet-control-layers {
|
||||
border: 5px solid #bbb;
|
||||
}
|
||||
|
||||
|
||||
/* Fade animations */
|
||||
/* Zoom and fade animations */
|
||||
|
||||
.leaflet-fade-anim .leaflet-tile {
|
||||
.leaflet-fade-anim .leaflet-tile, .leaflet-fade-anim .leaflet-popup {
|
||||
opacity: 0;
|
||||
|
||||
-webkit-transition: opacity 0.2s linear;
|
||||
@@ -213,30 +255,27 @@ a.leaflet-active {
|
||||
-o-transition: opacity 0.2s linear;
|
||||
transition: opacity 0.2s linear;
|
||||
}
|
||||
.leaflet-fade-anim .leaflet-tile-loaded {
|
||||
.leaflet-fade-anim .leaflet-tile-loaded, .leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.leaflet-fade-anim .leaflet-popup {
|
||||
opacity: 0;
|
||||
|
||||
-webkit-transition: opacity 0.2s linear;
|
||||
-moz-transition: opacity 0.2s linear;
|
||||
-o-transition: opacity 0.2s linear;
|
||||
transition: opacity 0.2s linear;
|
||||
}
|
||||
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
|
||||
opacity: 1;
|
||||
.leaflet-zoom-anim .leaflet-zoom-animated {
|
||||
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0.25,0.1,0.25,0.75);
|
||||
-moz-transition: -moz-transform 0.25s cubic-bezier(0.25,0.1,0.25,0.75);
|
||||
-o-transition: -o-transform 0.25s cubic-bezier(0.25,0.1,0.25,0.75);
|
||||
transition: transform 0.25s cubic-bezier(0.25,0.1,0.25,0.75);
|
||||
}
|
||||
|
||||
.leaflet-zoom-anim .leaflet-tile {
|
||||
-webkit-transition: none;
|
||||
-moz-transition: none;
|
||||
-o-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
.leaflet-zoom-anim .leaflet-tile,
|
||||
.leaflet-pan-anim .leaflet-tile,
|
||||
.leaflet-touching .leaflet-zoom-animated {
|
||||
-webkit-transition: none;
|
||||
-moz-transition: none;
|
||||
-o-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.leaflet-zoom-anim .leaflet-objects-pane {
|
||||
.leaflet-zoom-anim .leaflet-zoom-hide {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
@@ -246,19 +285,18 @@ a.leaflet-active {
|
||||
.leaflet-popup {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
-webkit-transform: translate3d(0,0,0);
|
||||
}
|
||||
.leaflet-popup-content-wrapper {
|
||||
padding: 1px;
|
||||
text-align: left;
|
||||
}
|
||||
.leaflet-popup-content {
|
||||
margin: 19px;
|
||||
margin: 14px 20px;
|
||||
}
|
||||
.leaflet-popup-tip-container {
|
||||
margin: 0 auto;
|
||||
width: 40px;
|
||||
height: 16px;
|
||||
height: 20px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -275,19 +313,30 @@ a.leaflet-active {
|
||||
-o-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.leaflet-popup-close-button {
|
||||
.leaflet-container a.leaflet-popup-close-button {
|
||||
position: absolute;
|
||||
top: 9px;
|
||||
right: 9px;
|
||||
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
|
||||
overflow: hidden;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 4px 5px 0 0;
|
||||
text-align: center;
|
||||
width: 18px;
|
||||
height: 14px;
|
||||
font: 16px/14px Tahoma, Verdana, sans-serif;
|
||||
color: #c3c3c3;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
.leaflet-container a.leaflet-popup-close-button:hover {
|
||||
color: #999;
|
||||
}
|
||||
.leaflet-popup-content p {
|
||||
margin: 18px 0;
|
||||
}
|
||||
.leaflet-popup-scrolled {
|
||||
overflow: auto;
|
||||
border-bottom: 1px solid #ddd;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
|
||||
|
||||
/* Visual appearance */
|
||||
@@ -298,17 +347,27 @@ a.leaflet-active {
|
||||
.leaflet-container a {
|
||||
color: #0078A8;
|
||||
}
|
||||
.leaflet-container a.leaflet-active {
|
||||
outline: 2px solid orange;
|
||||
}
|
||||
.leaflet-zoom-box {
|
||||
border: 2px dotted #05f;
|
||||
background: white;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.leaflet-div-icon {
|
||||
background: #fff;
|
||||
border: 1px solid #666;
|
||||
}
|
||||
.leaflet-editing-icon {
|
||||
border-radius: 2px;
|
||||
}
|
||||
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
|
||||
background: white;
|
||||
|
||||
box-shadow: 0 1px 10px #888;
|
||||
-moz-box-shadow: 0 1px 10px #888;
|
||||
-webkit-box-shadow: 0 1px 14px #999;
|
||||
box-shadow: 0 3px 10px #888;
|
||||
-moz-box-shadow: 0 3px 10px #888;
|
||||
-webkit-box-shadow: 0 3px 14px #999;
|
||||
}
|
||||
.leaflet-popup-content-wrapper {
|
||||
-moz-border-radius: 20px;
|
||||
@@ -318,6 +377,3 @@ a.leaflet-active {
|
||||
.leaflet-popup-content {
|
||||
font: 12px/1.4 "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
}
|
||||
.leaflet-popup-close-button {
|
||||
background: white url(images/popup-close.png);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
.leaflet-tile {
|
||||
filter: inherit;
|
||||
}
|
||||
|
||||
.leaflet-vml-shape {
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
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
|
||||
// [Bulgarian language support]
|
||||
|
||||
|
||||
OSRM.Localization["bg"] = {
|
||||
// own language
|
||||
"CULTURE": "bg-BG",
|
||||
"LANGUAGE": "Български",
|
||||
// gui
|
||||
"GUI_START": "Начало",
|
||||
"GUI_END": "Край",
|
||||
"GUI_RESET": "Изчисти",
|
||||
"GUI_ZOOM_ON_ROUTE": "Приближи на маршрута",
|
||||
"GUI_ZOOM_ON_USER": "Приближи на потребител",
|
||||
"GUI_SEARCH": "Покажи",
|
||||
"GUI_REVERSE": "Размени",
|
||||
"GUI_START_TOOLTIP": "Въведи начало",
|
||||
"GUI_END_TOOLTIP": "Въведи карйна цел",
|
||||
"GUI_MAIN_WINDOW": "главния прозорец",
|
||||
"GUI_ZOOM_IN": "Приближаване",
|
||||
"GUI_ZOOM_OUT": "Oтдалечаване",
|
||||
// config
|
||||
"GUI_CONFIGURATION": "Конфигурация",
|
||||
"GUI_LANGUAGE": "Език",
|
||||
"GUI_UNITS": "единици",
|
||||
"GUI_KILOMETERS": "Километри",
|
||||
"GUI_MILES": "Мили",
|
||||
// mapping
|
||||
"GUI_MAPPING_TOOLS": "Инструменти за карта",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Подчертай неименувани улици",
|
||||
"GUI_SHOW_PREVIOUS_ROUTES": "Покажи преднишни маршрути",
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Грешки",
|
||||
// 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": "Не е изберан маршрут",
|
||||
// routing engines
|
||||
"ENGINE_0": "Kола (най-бързо)",
|
||||
// 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":"Обратен завой[ по <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":"Влез в кръговото и излез на първия изход[ по <b>%s</b>]",
|
||||
"DIRECTION_11-2":"Влез в кръговото и излез на втория изход[ по <b>%s</b>]",
|
||||
"DIRECTION_11-3":"Влез в кръговото и излез на третия изход[ по <b>%s</b>]",
|
||||
"DIRECTION_11-4":"Влез в кръговото и излез на четвъртия изход[ по <b>%s</b>]",
|
||||
"DIRECTION_11-5":"Влез в кръговото и излез на петия изход[ по <b>%s</b>]",
|
||||
"DIRECTION_11-6":"Влез в кръговото и излез на шестия изход[ по <b>%s</b>]",
|
||||
"DIRECTION_11-7":"Влез в кръговото и излез на седмия изход[ по <b>%s</b>]",
|
||||
"DIRECTION_11-8":"Влез в кръговото и излез на осмия изход[ по <b>%s</b>]",
|
||||
"DIRECTION_11-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("bg");
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
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
|
||||
// [Czech language support]
|
||||
|
||||
|
||||
OSRM.Localization["cs"] = {
|
||||
// own language
|
||||
"CULTURE": "cs-CZ",
|
||||
"LANGUAGE": "česky",
|
||||
// gui
|
||||
"GUI_START": "Odkud",
|
||||
"GUI_END": "Kam",
|
||||
"GUI_RESET": "Vyčistit",
|
||||
"GUI_ZOOM": "Zoom na trasu",
|
||||
"GUI_SEARCH": "Ukázat",
|
||||
"GUI_REVERSE": "Prohodit",
|
||||
"GUI_START_TOOLTIP": "Zadejte začátek cesty",
|
||||
"GUI_END_TOOLTIP": "Zadejte cíl cesty",
|
||||
"GUI_ZOOM_IN": "Najíždět",
|
||||
"GUI_ZOOM_OUT": "Oddálit",
|
||||
// config
|
||||
"GUI_CONFIGURATION": "Nastavení",
|
||||
"GUI_LANGUAGE": "Jazyk",
|
||||
"GUI_UNITS": "Jednotky",
|
||||
"GUI_KILOMETERS": "kilometry",
|
||||
"GUI_MILES": "míle",
|
||||
// mapping
|
||||
"GUI_MAPPING_TOOLS": "Mapovací nástroje",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Zvýraznit nepojmenované ulice",
|
||||
"GUI_SHOW_PREVIOUS_ROUTES": "Zobrazit předchozí trasy",
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
// geocoder
|
||||
"SEARCH_RESULTS": "Výsledky hledání",
|
||||
"FOUND_X_RESULTS": "nalezeno %i výsledků",
|
||||
"TIMED_OUT": "Časová lhůta uplynula",
|
||||
"NO_RESULTS_FOUND": "Nejsou žádné výsledky",
|
||||
"NO_RESULTS_FOUND_SOURCE": "Nejsou žádné výsledky pro začátek trasy",
|
||||
"NO_RESULTS_FOUND_TARGET": "Nejsou žádné výsledky pro konec trasy",
|
||||
//routing
|
||||
"ROUTE_DESCRIPTION": "Popis trasy",
|
||||
"GET_LINK_TO_ROUTE": "Generovat odkaz",
|
||||
"GENERATE_LINK_TO_ROUTE": "čekání na odkaz",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "není k dispozici",
|
||||
"GPX_FILE": "GPX soubor",
|
||||
"DISTANCE": "Vzdálenost",
|
||||
"DURATION": "Doba",
|
||||
"YOUR_ROUTE_IS_BEING_COMPUTED": "Vaše trasa byla vyznačena",
|
||||
"NO_ROUTE_FOUND": "Trasu nelze vyznačit",
|
||||
// printing
|
||||
"OVERVIEW_MAP": "Přehledová mapka",
|
||||
"NO_ROUTE_SELECTED": "Ne vybranou trasu",
|
||||
// routing engines
|
||||
"ENGINE_0": "Auto (nejrychlejší)",
|
||||
// directions
|
||||
"N": "sever",
|
||||
"E": "východ",
|
||||
"S": "jih",
|
||||
"W": "západ",
|
||||
"NE": "severovýchod",
|
||||
"SE": "jihovýchod",
|
||||
"SW": "jihozápad",
|
||||
"NW": "severozápad",
|
||||
// driving directions
|
||||
// %s: road name
|
||||
// %d: direction
|
||||
// [*]: will only be printed when there actually is a road name
|
||||
"DIRECTION_0":"Neznámý pokyn[ na <b>%s</b>]",
|
||||
"DIRECTION_1":"Pokračujte[ silnicí <b>%s</b>]",
|
||||
"DIRECTION_2":"Zahněte mírně vpravo[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_3":"Zahněte vpravo[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_4":"Zahněte ostře doprava[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_5":"Otočte se[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_6":"Zahněte ostře doleva[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_7":"Zahněte vlevo[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_8":"Zahněte mírně vlevo[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_10":"Jeďte na <b>%d</b>[ silnicí <b>%s</b>]",
|
||||
"DIRECTION_11-1":"Najeďte na kruhový objezd a opusťte jej prvním výjezdem[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_11-2":"Najeďte na kruhový objezd a opusťte jej druhým výjezdem[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_11-3":"Najeďte na kruhový objezd a opusťte jej třetím výjezdem[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_11-4":"Najeďte na kruhový objezd a opusťte jej čtvrtým výjezdem[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_11-5":"Najeďte na kruhový objezd a opusťte jej pátým výjezdem[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_11-6":"Najeďte na kruhový objezd a opusťte jej šestým výjezdem[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_11-7":"Najeďte na kruhový objezd a opusťte jej sedmým výjezdem[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_11-8":"Najeďte na kruhový objezd a opusťte jej osmým výjezdem[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_11-9":"Najeďte na kruhový objezd a opusťte jej devátým výjezdem[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_11-1":"Najeďte na kruhový objezd a opusťte jej vámi vybraným výjezdem[ na silnici <b>%s</b>]",
|
||||
"DIRECTION_15":"Jste u cíle"
|
||||
};
|
||||
|
||||
// set GUI language on load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true )
|
||||
OSRM.Localization.setLanguage("cs");
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
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
|
||||
// [German language support]
|
||||
|
||||
|
||||
OSRM.Localization["de"] = {
|
||||
// own language
|
||||
"CULTURE": "de-DE",
|
||||
"LANGUAGE": "Deutsch",
|
||||
// gui
|
||||
"GUI_START": "Start",
|
||||
"GUI_END": "Ziel",
|
||||
"GUI_RESET": "Reset",
|
||||
"GUI_ZOOM_ON_ROUTE": "Zoom auf Route",
|
||||
"GUI_ZOOM_ON_USER": "Zoom auf Anwender",
|
||||
"GUI_SEARCH": "Zeigen",
|
||||
"GUI_REVERSE": "Umdrehen",
|
||||
"GUI_START_TOOLTIP": "Startposition eingeben",
|
||||
"GUI_END_TOOLTIP": "Zielposition eingeben",
|
||||
"GUI_MAIN_WINDOW": "Hauptfenster",
|
||||
"GUI_ZOOM_IN": "Vergrößern",
|
||||
"GUI_ZOOM_OUT": "Verkleinern",
|
||||
// config
|
||||
"GUI_CONFIGURATION": "Einstellungen",
|
||||
"GUI_LANGUAGE": "Sprache",
|
||||
"GUI_UNITS": "Einheiten",
|
||||
"GUI_KILOMETERS": "Kilometer",
|
||||
"GUI_MILES": "Meilen",
|
||||
// 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",
|
||||
"TIMED_OUT": "Zeitüberschreitung",
|
||||
"NO_RESULTS_FOUND": "Keine Ergebnisse gefunden",
|
||||
"NO_RESULTS_FOUND_SOURCE": "Keine Ergebnisse gefunden für Start",
|
||||
"NO_RESULTS_FOUND_TARGET": "Keine Ergebnisse gefunden für Ziel",
|
||||
// routing
|
||||
"ROUTE_DESCRIPTION": "Routenbeschreibung",
|
||||
"GET_LINK_TO_ROUTE": "Generiere Link",
|
||||
"GENERATE_LINK_TO_ROUTE": "Warte auf Antwort",
|
||||
"LINK_TO_ROUTE_TIMEOUT": "nicht möglich",
|
||||
"GPX_FILE": "GPX Datei",
|
||||
"DISTANCE": "Distanz",
|
||||
"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",
|
||||
//routing engines
|
||||
"ENGINE_0": "Auto (schnellste)",
|
||||
// directions
|
||||
"N": "Norden",
|
||||
"E": "Ost",
|
||||
"S": "Süden",
|
||||
"W": "Westen",
|
||||
"NE": "Nordost",
|
||||
"SE": "Südost",
|
||||
"SW": "Südwest",
|
||||
"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>]",
|
||||
"DIRECTION_2":"Leicht rechts abbiegen[ auf <b>%s</b>]",
|
||||
"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":"Scharf links abbiegen[ auf <b>%s</b>]",
|
||||
"DIRECTION_7":"Links abbiegen[ auf <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",
|
||||
"DIRECTION_11-4":"In den Kreisverkehr einfahren und bei vierter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-5":"In den Kreisverkehr einfahren und bei fünfter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-6":"In den Kreisverkehr einfahren und bei sechster Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-7":"In den Kreisverkehr einfahren und bei siebter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-8":"In den Kreisverkehr einfahren und bei achter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-9":"In den Kreisverkehr einfahren und bei neunter Möglichkeit[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_11-x":"In den Kreisverkehr einfahren und bei einer der vielen Möglichkeiten[ in Richtung <b>%s</b>] verlassen",
|
||||
"DIRECTION_15":"Sie haben Ihr Ziel erreicht"
|
||||
};
|
||||
|
||||
// set GUI language on load
|
||||
if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING==true )
|
||||
OSRM.Localization.setLanguage("de");
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
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
|
||||
"CULTURE": "da-DK",
|
||||
"LANGUAGE": "Dansk",
|
||||
// gui
|
||||
"GUI_START": "Start",
|
||||
"GUI_END": "Destination",
|
||||
"GUI_RESET": "Nulstil",
|
||||
"GUI_ZOOM_ON_ROUTE": "Zoom på Rute",
|
||||
"GUI_ZOOM_ON_USER": "Zoom på Bruger",
|
||||
"GUI_SEARCH": "Vis",
|
||||
"GUI_REVERSE": "Omvendt",
|
||||
"GUI_START_TOOLTIP": "Indtast start",
|
||||
"GUI_END_TOOLTIP": "Indtast destination",
|
||||
"GUI_MAIN_WINDOW": "Hovedvinduet",
|
||||
"GUI_ZOOM_IN": "Zoome ind",
|
||||
"GUI_ZOOM_OUT": "Zoome ud",
|
||||
// config
|
||||
"GUI_CONFIGURATION": "Konfiguration",
|
||||
"GUI_LANGUAGE": "Sprog",
|
||||
"GUI_UNITS": "Enheder",
|
||||
"GUI_KILOMETERS": "Kilometer",
|
||||
"GUI_MILES": "Miles",
|
||||
// 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",
|
||||
// routing engines
|
||||
"ENGINE_0": "Bil (hurtigste)",
|
||||
// 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");
|
||||