diff --git a/AUTHORS.md b/AUTHORS.md index 5ee70cc13..8d6ac377e 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -8,4 +8,6 @@ Nicolas Belett Vigneron Moyg Jean-Frederic Zbigniew Czernik -Jonas Häggqvist \ No newline at end of file +Jonas Häggqvist +Sabas +Paul Spencer \ No newline at end of file diff --git a/README.md b/README.md index dd77af2c8..fa92f94b8 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,10 @@ Please use the OSRM-Project bug tracker [(4)] for submitting any bug reports or Contribute ---------- -If you like to contribute, you can simply fork the project and start coding. -When you are going to provide a more substantial addition, please create a new branch first. -For pull requests use the develop branch as target, never the master branch. +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 @@ -49,6 +50,14 @@ To successfully work a repository that contains submodules, use the following gi Note that the frontend can also be checked out independently of the Project-OSRM repository. +Compatibility +------------- +The frontend has been tested with Firefox 3.0+, Internet Explorer 8+ and Chrome 18+. +Certain visuals like rounded corners or moving boxes will only show in newer browser versions. +But no actual functionality is affected by this. +Note that the frontend will not work with Internet Explorer 6 or 7. + + References ---------- [(1)] Cloudmade Leaflet: http://leaflet.cloudmade.com/ diff --git a/WebContent/OSRM.config.js b/WebContent/OSRM.config.js index ba78c25e5..7c817671b 100644 --- a/WebContent/OSRM.config.js +++ b/WebContent/OSRM.config.js @@ -21,6 +21,7 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.DEFAULTS = { HOST_ROUTING_URL: 'http://router.project-osrm.org/viaroute', HOST_SHORTENER_URL: 'http://map.project-osrm.org/shorten/', + HOST_TIMESTAMP_URL: 'http://router.project-osrm.org/timestamp', HOST_GEOCODER_URL: 'http://nominatim.openstreetmap.org/search', HOST_REVERSE_GEOCODER_URL: 'http://nominatim.openstreetmap.org/reverse', WEBSITE_URL: document.URL.replace(/#*(\?.*|$)/i,""), // truncates URL before first ?, and removes tailing # @@ -32,6 +33,7 @@ OSRM.DEFAULTS = { ONLOAD_SOURCE: "", ONLOAD_TARGET: "", HIGHLIGHT_ZOOM_LEVEL: 16, + DISTANCE_FORMAT: 0, // 0: km, 1: miles GEOCODER_BOUNDS: '', // the world is not enough! //GEOCODER_BOUNDS: '&bounded=1&viewbox=-27.0,72.0,46.0,36.0', // bounds for Europe @@ -39,15 +41,15 @@ OSRM.DEFAULTS = { SHORTENER_REPLY_PARAMETER: 'ShortURL', LANGUAGE: "en", - LANGUAGE_FILES_DIRECTORY: "localization/", LANUGAGE_ONDEMAND_RELOADING: true, LANGUAGE_SUPPORTED: [ - {display_name:"en", encoding:"en"}, - {display_name:"dk", encoding:"dk"}, - {display_name:"de", encoding:"de"}, - {display_name:"fi", encoding:"fi"}, - {display_name:"fr", encoding:"fr"}, - {display_name:"pl", encoding:"pl"} + {encoding:"en", name:"English"}, + {encoding:"de", name:"Deutsch"}, + {encoding:"dk", name:"Dansk"}, + {encoding:"fi", name:"Suomi"}, + {encoding:"fr", name:"Français"}, + {encoding:"it", name:"Italiano"}, + {encoding:"pl", name:"Polski", culture:"en-US"} ], TILE_SERVERS: [ @@ -70,6 +72,24 @@ OSRM.DEFAULTS = { url:'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png', attribution:'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade', options:{maxZoom: 18} - } - ] -}; + }, + { + display_name: 'Bing Road', + apikey:'AjCb2f6Azv_xt9c6pl_xok96bgAYrXQNctnG4o07sTj4iS9N68Za4B3pRJyeCjGr', // please use your own apikey (http://msdn.microsoft.com/en-us/library/ff428642.aspx) + type:"Road", + options:{minZoom: 1}, + bing:true, + }, + { + display_name: 'Bing Aerial', + apikey:'AjCb2f6Azv_xt9c6pl_xok96bgAYrXQNctnG4o07sTj4iS9N68Za4B3pRJyeCjGr', // please use your own apikey (http://msdn.microsoft.com/en-us/library/ff428642.aspx) + type:"Aerial", + options:{minZoom: 1}, + bing:true, + } + ], + + MAINTENANCE: false, + MAINTENANCE_HEADER: "Scheduled Maintenance", + MAINTENANCE_TEXT: "The OSRM Website is down for a scheduled maintenance. Please be patient while required updates are performed. The site will be back online shortly.

In the meantime you may want to go out an map a friendly neighborhood near you...


[OSRM]", +}; diff --git a/WebContent/base/OSRM.HistoryRoutes.js b/WebContent/base/OSRM.HistoryRoutes.js new file mode 100644 index 000000000..7a0a65a77 --- /dev/null +++ b/WebContent/base/OSRM.HistoryRoutes.js @@ -0,0 +1,193 @@ +/* +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU AFFERO General Public License as published by +the Free Software Foundation; either version 3 of the License, or +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +or see http://www.gnu.org/licenses/agpl.txt. +*/ + +// OSRM route management (handles drawing of route geometry - current route, old route, unnamed route, highlight unnamed streets) +// [this holds the route geometry] + + +OSRM.HistoryRoute = function() { + // style and count of history routes + this._history_styles = [{dashed:false, color:'#FFFFFF', opacity:0.5, weight:5}, + {dashed:false, color:'#0000DD', opacity:0.45, weight:5}, + {dashed:false, color:'#0000BB', opacity:0.40, weight:5}, + {dashed:false, color:'#000099', opacity:0.35, weight:5}, + {dashed:false, color:'#000077', opacity:0.30, weight:5}, + {dashed:false, color:'#000055', opacity:0.25, weight:5}, + {dashed:false, color:'#000033', opacity:0.20, weight:5}, + {dashed:false, color:'#000011', opacity:0.15, weight:5}, + {dashed:false, color:'#000000', opacity:0.10, weight:5} + ]; + this._history_length = this._history_styles.length; + + // actual history data + this._history = []; + for(var i=0, size=this._history_length; i0; 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 0 ) { + OSRM.JSONP.clear('history'+i); + OSRM.JSONP.call(this._buildCall(i)+'&instructions=false', this._callback_redrawHistory, OSRM.JSONP.empty, OSRM.DEFAULTS.JSONP_TIMEOUT, 'history'+i, i); + } + }, + _buildCall: function(history_id) { + var source = OSRM.DEFAULTS.HOST_ROUTING_URL; + source += '?z=' + OSRM.G.map.getZoom() + '&output=json&jsonp=%jsonp&geomformat=cmp'; + + 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 nearest_index) { - new_via_index = i; + for(var i=1; i nearest_index) { + new_via_index = i-1; break; } } diff --git a/WebContent/base/leaflet/L.Bugfixes.js b/WebContent/base/leaflet/L.Bugfixes.js index 6d0b0a67b..e1979df15 100644 --- a/WebContent/base/leaflet/L.Bugfixes.js +++ b/WebContent/base/leaflet/L.Bugfixes.js @@ -19,12 +19,6 @@ or see http://www.gnu.org/licenses/agpl.txt. // [assorted bugfixes to Leaflet functions we use] -// find relative leaflet URL -var i = 0; -while( L.ROOT_URL[i] == document.URL[i] ) { i++; } -L.RELATIVE_ROOT_URL = L.ROOT_URL.slice(i); - - // return closest point on segment or distance to that point L.LineUtil._sqClosestPointOnSegment = function (p, p1, p2, sqDist) { var x = p1.x, diff --git a/WebContent/base/leaflet/L.Control.QueryableLayers.js b/WebContent/base/leaflet/L.Control.QueryableLayers.js index 973884591..47c1423ae 100644 --- a/WebContent/base/leaflet/L.Control.QueryableLayers.js +++ b/WebContent/base/leaflet/L.Control.QueryableLayers.js @@ -30,5 +30,18 @@ getActiveLayerName: function () { 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; + } + } } }); diff --git a/WebContent/base/leaflet/L.MouseMarker.js b/WebContent/base/leaflet/L.MouseMarker.js index f15c79b19..a3eaeb5b6 100644 --- a/WebContent/base/leaflet/L.MouseMarker.js +++ b/WebContent/base/leaflet/L.MouseMarker.js @@ -34,6 +34,13 @@ L.MouseMarker = L.Marker.extend({ } }, + setLabel: function( label ) { + if(this._icon) { + this._icon.lastChild.innerHTML=label; + this._icon.lastChild.style.display = "block"; + } + }, + _changeIcon: function () { var options = this.options; diff --git a/WebContent/base/leaflet/L.SwitchableIcon.js b/WebContent/base/leaflet/L.SwitchableIcon.js index 8a93d863e..faff9b42b 100644 --- a/WebContent/base/leaflet/L.SwitchableIcon.js +++ b/WebContent/base/leaflet/L.SwitchableIcon.js @@ -80,8 +80,16 @@ L.SwitchableIcon = L.Class.extend({ _createImg: function (src) { var el; if (!L.Browser.ie6) { - el = document.createElement('img'); - el.src = src; + el = document.createElement('div'); + + var img = document.createElement('img'); + var num = document.createElement('div'); + img.src = src; + num.className = 'via-counter'; + num.innerHTML = ""; + + el.appendChild(img); + el.appendChild(num); } else { el = document.createElement('div'); el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")'; @@ -106,7 +114,7 @@ L.SwitchableIcon = L.Class.extend({ _switchImg: function (src, el) { if (!L.Browser.ie6) { - el.src = src; + el.firstChild.src = src; } else { el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")'; } diff --git a/WebContent/base/leaflet/L.TileLayer.Bing.js b/WebContent/base/leaflet/L.TileLayer.Bing.js new file mode 100644 index 000000000..acfc0438a --- /dev/null +++ b/WebContent/base/leaflet/L.TileLayer.Bing.js @@ -0,0 +1,191 @@ +/* + * Portions of this code and logic copied from OpenLayers and + * redistributed under the original Clear BSD license terms: + * + * http://trac.osgeo.org/openlayers/browser/license.txt + * + * Copyright 2005-2010 OpenLayers Contributors, released under + * the Clear BSD license. See authors.txt for a list of contributors. + * All rights reserved. + * + * -- + * + * Leaflet-specific modifications are released under the following + * terms: + * + * This program is free software. It comes without any warranty, to + * the extent permitted by applicable law. You can redistribute it + * and/or modify it under the terms of the Do What The Fuck You Want + * To Public License, Version 2, as published by Sam Hocevar. See + * http://sam.zoy.org/wtfpl/COPYING for more details. + */ + +L.TileLayer.Bing = L.TileLayer.extend({ + + supportedTypes: ['Road', 'Aerial', 'AerialWithLabels'], + + attributionTemplate: '' + + '' + + //'
{copyrights}' + + '{copyrights}' + + '' + + 'Terms of Use', + + supportedCultures: {"en":"en-US", "de":"de-DE", "fr":"fr-FR", "it":"it-IT", "es":"es-ES", "nl":"nl-BE"}, + + initialize: function(/*String*/ apiKey, /*String*/ mapType, /*Object*/ options) { + + this._apiKey = apiKey; + this._mapType = mapType; + + this._loadMetadata(); + + L.Util.setOptions(this, options); + }, + + redraw: function() { + this._reset(); + this._update(); + }, + + _loadMetadata: function() { + this._callbackId = "_l_tilelayer_bing_" + (L.TileLayer.Bing._callbackId++); + var that = this; + window[this._callbackId] = function() { + L.TileLayer.Bing.processMetadata.apply(that, arguments); + }; + + var params = { + key: this._apiKey, + jsonp: this._callbackId, + include: 'ImageryProviders' + }, + url = "http://dev.virtualearth.net/REST/v1/Imagery/Metadata/" + + this._mapType + L.Util.getParamString(params), + script = document.createElement("script"); + + script.type = "text/javascript"; + script.src = url; + script.id = this._callbackId; + document.getElementsByTagName("head")[0].appendChild(script); + }, + + _onMetadataLoaded: function() {}, + + onAdd: function(map, insertAtTheBottom) { + if (!this.metadata) { + this._onMetadataLoaded = L.Util.bind(function() { + L.TileLayer.prototype.onAdd.call(this, map, insertAtTheBottom); + map.on('moveend', this._updateAttribution, this); + this._updateAttribution(); + }, this); + } else { + L.TileLayer.prototype.onAdd.call(this, map, insertAtTheBottom); + map.on('moveend', this._updateAttribution, this); + this._updateAttribution(); + } + }, + + onRemove: function(map) { + if (this._map.attributionControl) { + this._map.attributionControl.removeAttribution(this.attribution); + } + this._map.off('moveend', this._updateAttribution, this); + L.TileLayer.prototype.onRemove.call(this, map); + }, + + getTileUrl: function(xy, z) { + var subdomains = this.options.subdomains, + quadDigits = [], + i = z, + digit, + mask, + quadKey; + // borrowed directly from OpenLayers + for (; i > 0; --i) { + digit = '0'; + mask = 1 << (i - 1); + if ((xy.x & mask) != 0) { + digit++; + } + if ((xy.y & mask) != 0) { + digit++; + digit++; + } + quadDigits.push(digit); + } + + return this._url + .replace('{culture}', this.supportedCultures[OSRM.Localization.current_language] || "en-US" ) + .replace('{subdomain}', subdomains[(xy.x + xy.y) % subdomains.length]) + .replace('{quadkey}', quadDigits.join("")); + }, + + _updateAttribution: function() { + if (this._map.attributionControl) { + var metadata = this.metadata; + var res = metadata.resourceSets[0].resources[0]; + var bounds = this._map.getBounds(); + var providers = res.imageryProviders, zoom = this._map.getZoom() + 1, + copyrights = "", provider, i, ii, j, jj, bbox, coverage; + for (i=0,ii=providers.length; i= coverage.zoomMin && coverage.bbox.intersects(bounds)) { + copyrights += provider.attribution + " "; + j = jj; + } + } + } + this._map.attributionControl.removeAttribution(this.attribution); + this._map.attributionControl._attributions = {}; + this._map.attributionControl._update(); + this.attribution = this.attributionTemplate + .replace('{logo}', metadata.brandLogoUri) + .replace('{copyrights}', copyrights); + this._map.attributionControl.addAttribution(this.attribution); + } + } +}); + +L.TileLayer.Bing._callbackId = 0; + +L.TileLayer.Bing.processMetadata = function(metadata) { + if (metadata.authenticationResultCode != 'ValidCredentials') { + throw "Invalid Bing Maps API Key" + } + + if (!metadata.resourceSets.length || !metadata.resourceSets[0].resources.length) { + throw "No resources returned, perhaps " + this._mapType + " is an invalid map type?"; + } + + if (metadata.statusCode != 200) { + throw "Bing Maps API request failed with status code " + metadata.statusCode; + } + + this.metadata = metadata; + var res = metadata.resourceSets[0].resources[0], + providers = res.imageryProviders, + i = 0, + j, + provider, + bbox, + script = document.getElementById(this._callbackId); + + for (; i1) - OSRM.Routing.getDragRoute(); + OSRM.Routing.getRoute_Dragging(); OSRM.Geocoder.updateLocation( this.parent.label ); }, onDragStart: function(e) { diff --git a/WebContent/gui/OSRM.GUIBoxGroup.js b/WebContent/gui/OSRM.GUIBoxGroup.js new file mode 100644 index 000000000..e1987529e --- /dev/null +++ b/WebContent/gui/OSRM.GUIBoxGroup.js @@ -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(); + } +} +}); \ No newline at end of file diff --git a/WebContent/gui/OSRM.GUIBoxHandle.js b/WebContent/gui/OSRM.GUIBoxHandle.js new file mode 100644 index 000000000..682f8b1e1 --- /dev/null +++ b/WebContent/gui/OSRM.GUIBoxHandle.js @@ -0,0 +1,128 @@ +/* +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 = 'not-selectable box-wrapper box-handle-wrapper-'+side; + wrapper.style.cssText += css; + var content = document.createElement('div'); + content.id = box_name + '-handle-content'; + content.className = 'box-content box-handle-content-'+side; + var icon = document.createElement('div'); + icon.id = box_name + '-handle-icon'; + icon.className = 'iconic-button'; + + content.appendChild(icon); + wrapper.appendChild(content); + document.body.appendChild(wrapper); + + // create attributes + this._box = document.getElementById( box_name + '-wrapper' ); + this._class = this._box.className; + this._width = this._box.clientWidth; + this._side = side; + this._handle = wrapper; + this._box_group = null; + this._transitionEndFct = transitionEndFct; + + // hide box and show handle by default + this._box.style[this._side]=-this._width+"px"; + this._box_visible = false; + this._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._handle.style.visibility="hidden"; + this._box.style[this._side]="5px"; + this._transitionEndFct(); +}, +$hideBox: function() { + this._box_visible = false; + 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"; + } 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; + } else { + this._box_visible = true; + } +} +}); \ No newline at end of file diff --git a/WebContent/gui/OSRM.MainGUI.js b/WebContent/gui/OSRM.MainGUI.js index bd3875c54..b77e6e838 100644 --- a/WebContent/gui/OSRM.MainGUI.js +++ b/WebContent/gui/OSRM.MainGUI.js @@ -21,33 +21,32 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.GUI.extend( { -// defaults -visible: null, -width: null, - // init GUI init: function() { - OSRM.GUI.visible = true; - OSRM.GUI.width = document.getElementById("main-wrapper").clientWidth; + // 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 events - document.getElementById("gui-toggle-in").onclick = OSRM.GUI.toggleMain; - document.getElementById("gui-toggle-out").onclick = OSRM.GUI.toggleMain; - - // gui after transition events - if( OSRM.Browser.FF3==-1 && OSRM.Browser.IE6_9==-1 ) { - document.getElementById('main-wrapper').addEventListener("transitionend", OSRM.GUI._onMainTransitionEnd, false); - document.getElementById('main-wrapper').addEventListener("webkitTransitionEnd", OSRM.GUI._onMainTransitionEnd, false); - document.getElementById('main-wrapper').addEventListener("oTransitionEnd", OSRM.GUI._onMainTransitionEnd, false); - document.getElementById('main-wrapper').addEventListener("MSTransitionEnd", OSRM.GUI._onMainTransitionEnd, false); - } + // init units selector + OSRM.GUI.selectorInit( "gui-units-toggle", [{display:"Kilometers",value:0},{display:"Miles",value:1}], 0, OSRM.GUI.onUnitsChanged ); - // set default language - OSRM.Localization.setLanguage( OSRM.DEFAULTS.LANGUAGE ); + // query last update of data + OSRM.G.data_timestamp = "n/a"; + OSRM.JSONP.call(OSRM.DEFAULTS.HOST_TIMESTAMP_URL+"?jsonp=%jsonp", OSRM.GUI.setDataTimestamp, OSRM.JSONP.empty, OSRM.DEFAULTS.JSONP_TIMEOUT, 'data_timestamp'); }, // set language dependent labels @@ -57,7 +56,7 @@ setLabels: function() { document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET"); document.getElementById("gui-reverse").innerHTML = OSRM.loc("GUI_REVERSE"); document.getElementById("gui-option-highlight-nonames-label").innerHTML = OSRM.loc("GUI_HIGHLIGHT_UNNAMED_ROADS"); - document.getElementById("gui-options-toggle").innerHTML = OSRM.loc("GUI_OPTIONS"); + document.getElementById("gui-option-show-previous-routes-label").innerHTML = OSRM.loc("GUI_SHOW_PREVIOUS_ROUTES"); document.getElementById("gui-search-source").innerHTML = OSRM.loc("GUI_SEARCH"); document.getElementById("gui-search-target").innerHTML = OSRM.loc("GUI_SEARCH"); document.getElementById("gui-search-source-label").innerHTML = OSRM.loc("GUI_START")+":"; @@ -65,57 +64,52 @@ setLabels: function() { document.getElementById("gui-input-source").title = OSRM.loc("GUI_START_TOOLTIP"); document.getElementById("gui-input-target").title = OSRM.loc("GUI_END_TOOLTIP"); document.getElementById("legal-notice").innerHTML = OSRM.loc("GUI_LEGAL_NOTICE"); + document.getElementById("gui-mapping-label").innerHTML = OSRM.loc("GUI_MAPPING_TOOLS"); + document.getElementById("gui-config-label").innerHTML = OSRM.loc("GUI_CONFIGURATION"); + document.getElementById("gui-language-2-label").innerHTML = OSRM.loc("GUI_LANGUAGE")+":"; + document.getElementById("gui-units-label").innerHTML = OSRM.loc("GUI_UNITS")+":"; + document.getElementById('gui-data-timestamp').innerHTML = OSRM.loc("GUI_DATA_TIMESTAMP")+": " + OSRM.G.data_timestamp; + + document.getElementById("gui-units-toggle").getElementsByTagName("option")[0].innerHTML = OSRM.loc("GUI_KILOMETERS"); + document.getElementById("gui-units-toggle").getElementsByTagName("option")[1].innerHTML = OSRM.loc("GUI_MILES"); + OSRM.GUI.selectorOnChange( document.getElementById("gui-units-toggle") ); }, -//clear output area +// clear output area clearResults: function() { document.getElementById('information-box').innerHTML = ""; document.getElementById('information-box-header').innerHTML = ""; }, -//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"; +// reposition and hide zoom controls before main box animation +beforeMainTransition: function() { + var zoom_controls = OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom'); + if( zoom_controls.length > 0) + zoom_controls[0].style.visibility="hidden"; +}, + +// show zoom controls after main box animation +afterMainTransition: function() { + var zoom_controls = OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom'); + if( zoom_controls.length > 0) { + zoom_controls[0].style.left = ( OSRM.G.main_handle.boxVisible() == true ? (OSRM.G.main_handle.boxWidth()+10) : "30") + "px"; + zoom_controls[0].style.visibility="visible"; } }, + +// toggle distance units +onUnitsChanged: function(value) { + OSRM.Utils.setToHumanDistanceFunction(value); + OSRM.Routing.getRoute(); +}, + +// set timestamp of data +setDataTimestamp: function(response) { + if(!response) + return; -// show/hide main-gui -toggleMain: function() { - // show main-gui - if( OSRM.GUI.visible == false ) { - OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="hidden"; - OSRM.Browser.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 { - OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="hidden"; - OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.left="30px"; - - document.getElementById('main-wrapper').style.left=-OSRM.GUI.width+"px"; - } - - // execute after animation (old browser support) - if( OSRM.Browser.FF3!=-1 || OSRM.Browser.IE6_9!=-1 ) - OSRM.GUI._onMainTransitionEnd(); -}, - -// do stuff after main-gui animation finished -_onMainTransitionEnd: function() { - // after hiding main-gui - if( OSRM.GUI.visible == true ) { - document.getElementById('blob-wrapper').style.visibility="visible"; - OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="visible"; - OSRM.GUI.visible = false; - // after showing main-gui - } else { - OSRM.Browser.getElementsByClassName(document,'leaflet-control-zoom')[0].style.visibility="visible"; - OSRM.GUI.visible = true; - } + OSRM.G.data_timestamp = response.timestamp.slice(0,25).replace(/<\/?[^>]+(>|$)/g ,""); // discard tags + document.getElementById('gui-data-timestamp').innerHTML = OSRM.loc("GUI_DATA_TIMESTAMP")+": " + OSRM.G.data_timestamp; } -}); +}); \ No newline at end of file diff --git a/WebContent/gui/OSRM.RoutingGUI.js b/WebContent/gui/OSRM.RoutingGUI.js index 808081692..c2c4fb60d 100644 --- a/WebContent/gui/OSRM.RoutingGUI.js +++ b/WebContent/gui/OSRM.RoutingGUI.js @@ -23,6 +23,9 @@ OSRM.GUI.extend( { // init init: function() { + // init variables + OSRM.Utils.setToHumanDistanceFunction(OSRM.DEFAULTS.DISTANCE_FORMAT); + // init events document.getElementById("gui-input-source").onchange = function() {OSRM.GUI.inputChanged(OSRM.C.SOURCE_LABEL);}; document.getElementById("gui-delete-source").onclick = function() {OSRM.GUI.deleteMarker(OSRM.C.SOURCE_LABEL);}; @@ -34,10 +37,10 @@ init: function() { document.getElementById("gui-reset").onclick = OSRM.GUI.resetRouting; document.getElementById("gui-reverse").onclick = OSRM.GUI.reverseRouting; - document.getElementById("gui-options-toggle").onclick = OSRM.GUI.toggleOptions; document.getElementById("open-josm").onclick = OSRM.GUI.openJOSM; document.getElementById("open-osmbugs").onclick = OSRM.GUI.openOSMBugs; - document.getElementById("option-highlight-nonames").onclick = OSRM.Routing.getZoomRoute; + document.getElementById("option-highlight-nonames").onclick = OSRM.Routing.getRoute_Redraw; + document.getElementById("option-show-previous-routes").onclick = OSRM.GUI.showPreviousRoutes; }, // click: button "reset" @@ -45,9 +48,8 @@ resetRouting: function() { document.getElementById('gui-input-source').value = ""; document.getElementById('gui-input-target').value = ""; - OSRM.G.route.hideAll(); - OSRM.G.markers.removeAll(); - OSRM.G.markers.highlight.hide(); + OSRM.G.route.reset(); + OSRM.G.markers.reset(); document.getElementById('information-box').innerHTML = ""; document.getElementById('information-box-header').innerHTML = ""; @@ -65,7 +67,7 @@ reverseRouting: function() { // recompute route if needed if( OSRM.G.route.isShown() ) { OSRM.G.markers.route.reverse(); - OSRM.Routing.getRoute(); // temporary route reversal for query, actual reversal done after receiving response + 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 ); @@ -78,7 +80,7 @@ reverseRouting: function() { // click: button "show" showMarker: function(marker_id) { - if( OSRM.JSONP.fences["geocoder_source"] || OSRM.JSONP.fences["geocoder_target"] ) + if( OSRM.JSONP.fences["geocoder_source"] || OSRM.JSONP.fences["geocoder_target"] ) // needed when focus was on input box and user clicked on button return; if( marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() ) @@ -134,6 +136,14 @@ deleteMarker: function(marker_id) { 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(); } }); diff --git a/WebContent/gui/OSRM.Selector.js b/WebContent/gui/OSRM.Selector.js new file mode 100644 index 000000000..a9700f50a --- /dev/null +++ b/WebContent/gui/OSRM.Selector.js @@ -0,0 +1,67 @@ +/* +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU AFFERO General Public License as published by +the Free Software Foundation; either version 3 of the License, or +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +or see http://www.gnu.org/licenses/agpl.txt. +*/ + +// OSRM selector +// [create special selector elements] + + +OSRM.GUI.extend( { + +// initialize selector with all options and our look&feel +selectorInit: function(id, options, selected, onchange_fct) { + // create dropdown menu + var select = document.getElementById(id); + select.className += " styled-select-helper base-font"; + select.onchange = function() { OSRM.GUI.selectorOnChange(this); onchange_fct(this.value); }; + + // fill dropdown menu + for(var i=0, size=options.length; i0},removeEventListener:function(a,b,c){if(!this.hasEventListeners(a))return this;for(var d=0,e=this._leaflet_events,f=e[a].length;d=this.min.x&&c.x<=this.max.x&&b.y>=this.min.y&&c.y<=this.max.y},intersects:function(a){var b=this.min,c=this.max,d=a.min,e=a.max,f=e.x>=b.x&&d.x<=c.x,g=e.y>=b.y&&d.y<=c.y;return f&&g}}),L.Transformation=L.Class.extend({initialize:function(a,b,c,d){this._a=a,this._b=b,this._c=c,this._d=d},transform:function(a,b){return this._transform(a.clone(),b)},_transform:function(a,b){return b=b||1,a.x=b*(this._a*a.x+this._b),a.y=b*(this._c*a.y+this._d),a},untransform:function(a,b){return b=b||1,new L.Point((a.x/b-this._b)/this._a,(a.y/b-this._d)/this._c)}}),L.DomUtil={get:function(a){return typeof a=="string"?document.getElementById(a):a},getStyle:function(a,b){var c=a.style[b];!c&&a.currentStyle&&(c=a.currentStyle[b]);if(!c||c==="auto"){var d=document.defaultView.getComputedStyle(a,null);c=d?d[b]:null}return c==="auto"?null:c},getViewportOffset:function(a){var b=0,c=0,d=a,e=document.body;do{b+=d.offsetTop||0,c+=d.offsetLeft||0;if(d.offsetParent===e&&L.DomUtil.getStyle(d,"position")==="absolute")break;d=d.offsetParent}while(d);d=a;do{if(d===e)break;b-=d.scrollTop||0,c-=d.scrollLeft||0,d=d.parentNode}while(d);return new L.Point(c,b)},create:function(a,b,c){var d=document.createElement(a);return d.className=b,c&&c.appendChild(d),d},disableTextSelection:function(){document.selection&&document.selection.empty&&document.selection.empty(),this._onselectstart||(this._onselectstart=document.onselectstart,document.onselectstart=L.Util.falseFn)},enableTextSelection:function(){document.onselectstart=this._onselectstart,this._onselectstart=null},hasClass:function(a,b){return a.className.length>0&&RegExp("(^|\\s)"+b+"(\\s|$)").test(a.className)},addClass:function(a,b){L.DomUtil.hasClass(a,b)||(a.className+=(a.className?" ":"")+b)},removeClass:function(a,b){a.className=a.className.replace(/(\S+)\s*/g,function(a,c){return c===b?"":a}).replace(/^\s+/,"")},setOpacity:function(a,b){L.Browser.ie?a.style.filter="alpha(opacity="+Math.round(b*100)+")":a.style.opacity=b},testProp:function(a){var b=document.documentElement.style;for(var c=0;c=b.lat&&e.lat<=c.lat&&d.lng>=b.lng&&e.lng<=c.lng},intersects:function(a){var b=this._southWest,c=this._northEast,d=a.getSouthWest(),e=a.getNorthEast(),f=e.lat>=b.lat&&d.lat<=c.lat,g=e.lng>=b.lng&&d.lng<=c.lng;return f&&g},toBBoxString:function(){var a=this._southWest,b=this._northEast;return[a.lng,a.lat,b.lng,b.lat].join(",")}}),L.Projection={},L.Projection.SphericalMercator={MAX_LATITUDE:85.0511287798,project:function(a){var b=L.LatLng.DEG_TO_RAD,c=this.MAX_LATITUDE,d=Math.max(Math.min(c,a.lat),-c),e=a.lng*b,f=d*b;return f=Math.log(Math.tan(Math.PI/4+f/2)),new L.Point(e,f)},unproject:function(a,b){var c=L.LatLng.RAD_TO_DEG,d=a.x*c,e=(2*Math.atan(Math.exp(a.y))-Math.PI/2)*c;return new L.LatLng(e,d,b)}},L.Projection.LonLat={project:function(a){return new L.Point(a.lng,a.lat)},unproject:function(a,b){return new L.LatLng(a.y,a.x,b)}},L.CRS={latLngToPoint:function(a,b){var c=this.projection.project(a);return this.transformation._transform(c,b)},pointToLatLng:function(a,b,c){var d=this.transformation.untransform(a,b);return this.projection.unproject(d,c)},project:function(a){return this.projection.project(a)}},L.CRS.EPSG3857=L.Util.extend({},L.CRS,{code:"EPSG:3857",projection:L.Projection.SphericalMercator,transformation:new L.Transformation(.5/Math.PI,.5,-0.5/Math.PI,.5),project:function(a){var b=this.projection.project(a),c=6378137;return b.multiplyBy(c)}}),L.CRS.EPSG900913=L.Util.extend({},L.CRS.EPSG3857,{code:"EPSG:900913"}),L.CRS.EPSG4326=L.Util.extend({},L.CRS,{code:"EPSG:4326",projection:L.Projection.LonLat,transformation:new L.Transformation(1/360,.5,-1/360,.5)}),L.Map=L.Class.extend({includes:L.Mixin.Events,options:{crs:L.CRS.EPSG3857||L.CRS.EPSG4326,scale:function(a){return 256*Math.pow(2,a)},center:null,zoom:null,layers:[],dragging:!0,touchZoom:L.Browser.touch&&!L.Browser.android,scrollWheelZoom:!L.Browser.touch,doubleClickZoom:!0,boxZoom:!0,zoomControl:!0,attributionControl:!0,fadeAnimation:L.DomUtil.TRANSITION&&!L.Browser.android,zoomAnimation:L.DomUtil.TRANSITION&&!L.Browser.android&&!L.Browser.mobileOpera,trackResize:!0,closePopupOnClick:!0,worldCopyJump:!0},initialize:function(a,b){L.Util.setOptions(this,b),this._container=L.DomUtil.get(a);if(this._container._leaflet)throw Error("Map container is already initialized.");this._container._leaflet=!0,this._initLayout(),L.DomEvent&&(this._initEvents(),L.Handler&&this._initInteraction(),L.Control&&this._initControls()),this.options.maxBounds&&this.setMaxBounds(this.options.maxBounds);var c=this.options.center,d=this.options.zoom;c!==null&&d!==null&&this.setView(c,d,!0);var e=this.options.layers;e=e instanceof Array?e:[e],this._tileLayersNum=0,this._initLayers(e)},setView:function(a,b){return this._resetView(a,this._limitZoom(b)),this},setZoom:function(a){return this.setView(this.getCenter(),a)},zoomIn:function(){return this.setZoom(this._zoom+1)},zoomOut:function(){return this.setZoom(this._zoom-1)},fitBounds:function(a){var b=this.getBoundsZoom(a);return this.setView(a.getCenter(),b)},fitWorld:function(){var a=new L.LatLng(-60,-170),b=new L.LatLng(85,179);return this.fitBounds(new L.LatLngBounds(a,b))},panTo:function(a){return this.setView(a,this._zoom)},panBy:function(a){return this.fire("movestart"),this._rawPanBy(a),this.fire("move"),this.fire("moveend"),this},setMaxBounds:function(a){this.options.maxBounds=a;if(!a)return this._boundsMinZoom=null,this;var b=this.getBoundsZoom(a,!0);return this._boundsMinZoom=b,this._loaded&&(this._zoomf.x&&(g=f.x-d.x),c.y>e.y&&(h=e.y-c.y),c.xl&&--m>0)o=h*Math.sin(j),n=Math.PI/2-2*Math.atan(i*Math.pow((1-o)/(1+o),.5*h))-j,j+=n;return new L.LatLng(j*c,f,b)}},L.CRS.EPSG3395=L.Util.extend({},L.CRS,{code:"EPSG:3395",projection:L.Projection.Mercator,transformation:function(){var a=L.Projection.Mercator,b=a.R_MAJOR,c=a.R_MINOR;return new L.Transformation(.5/(Math.PI*b),.5,-0.5/(Math.PI*c),.5)}()}),L.TileLayer=L.Class.extend({includes:L.Mixin.Events,options:{minZoom:0,maxZoom:18,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",opacity:1,scheme:"xyz",continuousWorld:!1,noWrap:!1,zoomOffset:0,zoomReverse:!1,unloadInvisibleTiles:L.Browser.mobile,updateWhenIdle:L.Browser.mobile,reuseTiles:!1},initialize:function(a,b,c){L.Util.setOptions(this,b),this._url=a,this._urlParams=c,typeof this.options.subdomains=="string"&&(this.options.subdomains=this.options.subdomains.split(""))},onAdd:function(a,b){this._map=a,this._insertAtTheBottom=b,this._initContainer(),this._createTileProto(),a.on("viewreset",this._resetCallback,this),this.options.updateWhenIdle?a.on("moveend",this._update,this):(this._limitedUpdate=L.Util.limitExecByInterval(this._update,150,this),a.on("move",this._limitedUpdate,this)),this._reset(),this._update()},onRemove:function(a){this._map.getPanes().tilePane.removeChild(this._container),this._container=null,this._map.off("viewreset",this._resetCallback,this),this.options.updateWhenIdle?this._map.off("moveend",this._update,this):this._map.off("move",this._limitedUpdate,this)},getAttribution:function(){return this.options.attribution},setOpacity:function(a){this.options.opacity=a,this._setOpacity(a);if(L.Browser.webkit)for(var b in this._tiles)this._tiles.hasOwnProperty(b)&&(this._tiles[b].style.webkitTransform+=" translate(0,0)")},_setOpacity:function(a){a<1&&L.DomUtil.setOpacity(this._container,a)},_initContainer:function(){var a=this._map.getPanes().tilePane,b=a.firstChild;if(!this._container||a.empty)this._container=L.DomUtil.create("div","leaflet-layer"),this._insertAtTheBottom&&b?a.insertBefore(this._container,b):a.appendChild(this._container),this._setOpacity(this.options.opacity)},_resetCallback:function(a){this._reset(a.hard)},_reset:function(a){var b;for(b in this._tiles)this._tiles.hasOwnProperty(b)&&this.fire("tileunload",{tile:this._tiles[b]});this._tiles={},this.options.reuseTiles&&(this._unusedTiles=[]),a&&this._container&&(this._container.innerHTML=""),this._initContainer()},_update:function(){var a=this._map.getPixelBounds(),b=this._map.getZoom(),c=this.options.tileSize;if(b>this.options.maxZoom||ba.max.x||da.max.y)f=this._tiles[e],this.fire("tileunload",{tile:f,url:f.src}),f.parentNode===this._container&&this._container.removeChild(f),this.options.reuseTiles&&this._unusedTiles.push(this._tiles[e]),f.src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=",delete this._tiles[e]}},_addTile:function(a,b){var c=this._getTilePos(a),d=this._map.getZoom(),e=a.x+":"+a.y,f=Math.pow(2,this._getOffsetZoom(d));if(!this.options.continuousWorld){if(!this.options.noWrap)a.x=(a.x%f+f)%f;else if(a.x<0||a.x>=f){this._tilesToLoad--;return}if(a.y<0||a.y>=f){this._tilesToLoad--;return}}var g=this._getTile();L.DomUtil.setPosition(g,c),this._tiles[e]=g,this.options.scheme==="tms"&&(a.y=f-a.y-1),this._loadTile(g,a,d),b.appendChild(g)},_getOffsetZoom:function(a){return a=this.options.zoomReverse?this.options.maxZoom-a:a,a+this.options.zoomOffset},_getTilePos:function(a){var b=this._map.getPixelOrigin(),c=this.options.tileSize;return a.multiplyBy(c).subtract(b)},getTileUrl:function(a,b){var c=this.options.subdomains,d=this.options.subdomains[(a.x+a.y)%c.length];return L.Util.template(this._url,L.Util.extend({s:d,z:this._getOffsetZoom(b),x:a.x,y:a.y},this._urlParams))},_createTileProto:function(){this._tileImg=L.DomUtil.create("img","leaflet-tile"),this._tileImg.galleryimg="no";var a=this.options.tileSize;this._tileImg.style.width=a+"px",this._tileImg.style.height=a+"px"},_getTile:function(){if(this.options.reuseTiles&&this._unusedTiles.length>0){var a=this._unusedTiles.pop();return this._resetTile(a),a}return this._createTile()},_resetTile:function(a){},_createTile:function(){var a=this._tileImg.cloneNode(!1);return a.onselectstart=a.onmousemove=L.Util.falseFn,a},_loadTile:function(a,b,c){a._layer=this,a.onload=this._tileOnLoad,a.onerror=this._tileOnError,a.src=this.getTileUrl(b,c)},_tileOnLoad:function(a){var b=this._layer;this.className+=" leaflet-tile-loaded",b.fire("tileload",{tile:this,url:this.src}),b._tilesToLoad--,b._tilesToLoad||b.fire("load")},_tileOnError:function(a){var b=this._layer;b.fire("tileerror",{tile:this,url:this.src});var c=b.options.errorTileUrl;c&&(this.src=c)}}),L.TileLayer.WMS=L.TileLayer.extend({defaultWmsParams:{service:"WMS",request:"GetMap",version:"1.1.1",layers:"",styles:"",format:"image/jpeg",transparent:!1},initialize:function(a,b){this._url=a,this.wmsParams=L.Util.extend({},this.defaultWmsParams),this.wmsParams.width=this.wmsParams.height=this.options.tileSize;for(var c in b)this.options.hasOwnProperty(c)||(this.wmsParams[c]=b[c]);L.Util.setOptions(this,b)},onAdd:function(a){var b=parseFloat(this.wmsParams.version)<1.3?"srs":"crs";this.wmsParams[b]=a.options.crs.code,L.TileLayer.prototype.onAdd.call(this,a)},getTileUrl:function(a,b){var c=this.options.tileSize,d=a.multiplyBy(c),e=d.add(new L.Point(c,c)),f=this._map.unproject(d,this._zoom,!0),g=this._map.unproject(e,this._zoom,!0),h=this._map.options.crs.project(f),i=this._map.options.crs.project(g),j=[h.x,i.y,i.x,h.y].join(",");return this._url+L.Util.getParamString(this.wmsParams)+"&bbox="+j}}),L.TileLayer.Canvas=L.TileLayer.extend({options:{async:!1},initialize:function(a){L.Util.setOptions(this,a)},redraw:function(){for(var a in this._tiles){var b=this._tiles[a];this._redrawTile(b)}},_redrawTile:function(a){this.drawTile(a,a._tilePoint,a._zoom)},_createTileProto:function(){this._canvasProto=L.DomUtil.create("canvas","leaflet-tile");var a=this.options.tileSize;this._canvasProto.width=a,this._canvasProto.height=a},_createTile:function(){var a=this._canvasProto.cloneNode(!1);return a.onselectstart=a.onmousemove=L.Util.falseFn,a},_loadTile:function(a,b,c){a._layer=this,a._tilePoint=b,a._zoom=c,this.drawTile(a,b,c),this.options.async||this.tileDrawn(a)},drawTile:function(a,b,c){},tileDrawn:function(a){this._tileOnLoad.call(a)}}),L.ImageOverlay=L.Class.extend({includes:L.Mixin.Events,initialize:function(a,b){this._url=a,this._bounds=b},onAdd:function(a){this._map=a,this._image||this._initImage(),a.getPanes().overlayPane.appendChild(this._image),a.on("viewreset",this._reset,this),this._reset()},onRemove:function(a){a.getPanes().overlayPane.removeChild(this._image),a.off("viewreset",this._reset,this)},_initImage:function(){this._image=L.DomUtil.create("img","leaflet-image-layer"),this._image.style.visibility="hidden",L.Util.extend(this._image,{galleryimg:"no",onselectstart:L.Util.falseFn,onmousemove:L.Util.falseFn,onload:L.Util.bind(this._onImageLoad,this),src:this._url})},_reset:function(){var a=this._map.latLngToLayerPoint(this._bounds.getNorthWest()),b=this._map.latLngToLayerPoint(this._bounds.getSouthEast()),c=b.subtract(a);L.DomUtil.setPosition(this._image,a),this._image.style.width=c.x+"px",this._image.style.height=c.y+"px"},_onImageLoad:function(){this._image.style.visibility="",this.fire("load")}}),L.Icon=L.Class.extend({iconUrl:L.ROOT_URL+"images/marker.png",shadowUrl:L.ROOT_URL+"images/marker-shadow.png",iconSize:new L.Point(25,41),shadowSize:new L.Point(41,41),iconAnchor:new L.Point(13,41),popupAnchor:new L.Point(0,-33),initialize:function(a){a&&(this.iconUrl=a)},createIcon:function(){return this._createIcon("icon")},createShadow:function(){return this._createIcon("shadow")},_createIcon:function(a){var b=this[a+"Size"],c=this[a+"Url"];if(!c&&a==="shadow")return null;var d;return c?d=this._createImg(c):d=this._createDiv(),d.className="leaflet-marker-"+a,d.style.marginLeft=-this.iconAnchor.x+"px",d.style.marginTop=-this.iconAnchor.y+"px",b&&(d.style.width=b.x+"px",d.style.height=b.y+"px"),d},_createImg:function(a){var b;return L.Browser.ie6?(b=document.createElement("div"),b.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+a+'")'):(b=document.createElement("img"),b.src=a),b},_createDiv:function(){return document.createElement("div")}}),L.Marker=L.Class.extend({includes:L.Mixin.Events,options:{icon:new L.Icon,title:"",clickable:!0,draggable:!1,zIndexOffset:0},initialize:function(a,b){L.Util.setOptions(this,b),this._latlng=a},onAdd:function(a){this._map=a,this._initIcon(),a.on("viewreset",this._reset,this),this._reset()},onRemove:function(a){this._removeIcon(),this.closePopup&&this.closePopup(),this._map=null,a.off("viewreset",this._reset,this)},getLatLng:function(){return this._latlng},setLatLng:function(a){this._latlng=a,this._icon&&(this._reset(),this._popup&&this._popup.setLatLng(this._latlng))},setZIndexOffset:function(a){this.options.zIndexOffset=a,this._icon&&this._reset()},setIcon:function(a){this._map&&this._removeIcon(),this.options.icon=a,this._map&&(this._initIcon(),this._reset())},_initIcon:function(){this._icon||(this._icon=this.options.icon.createIcon(),this.options.title&&(this._icon.title=this.options.title),this._initInteraction()),this._shadow||(this._shadow=this.options.icon.createShadow()),this._map._panes.markerPane.appendChild(this._icon),this._shadow&&this._map._panes.shadowPane.appendChild(this._shadow)},_removeIcon:function(){this._map._panes.markerPane.removeChild(this._icon),this._shadow&&this._map._panes.shadowPane.removeChild(this._shadow),this._icon=this._shadow=null},_reset:function(){var a=this._map.latLngToLayerPoint(this._latlng).round();L.DomUtil.setPosition(this._icon,a),this._shadow&&L.DomUtil.setPosition(this._shadow,a),this._icon.style.zIndex=a.y+this.options.zIndexOffset},_initInteraction:function(){if(this.options.clickable){this._icon.className+=" leaflet-clickable",L.DomEvent.addListener(this._icon,"click",this._onMouseClick,this);var a=["dblclick","mousedown","mouseover","mouseout"];for(var b=0;bthis.options.maxWidth?this.options.maxWidth:af.x&&(d.x=c.x+this._containerWidth-f.x+e.x),c.y<0&&(d.y=c.y-e.y),c.y+a>f.y&&(d.y=c.y+a-f.y+e.y),(d.x||d.y)&&this._map.panBy(d)},_onCloseButtonClick:function(a){this._close(),L.DomEvent.stop(a)}}),L.Marker.include({openPopup:function(){return this._popup.setLatLng(this._latlng),this._map&&this._map.openPopup(this._popup),this},closePopup:function(){return this._popup&&this._popup._close(),this},bindPopup:function(a,b){return b=L.Util.extend({offset:this.options.icon.popupAnchor},b),this._popup||this.on("click",this.openPopup,this),this._popup=new L.Popup(b,this),this._popup.setContent(a),this},unbindPopup:function(){return this._popup&&(this._popup=null,this.off("click",this.openPopup)),this}}),L.Map.include({openPopup:function(a){return this.closePopup(),this._popup=a,this.addLayer(a),this.fire("popupopen",{popup:this._popup}),this},closePopup:function(){return this._popup&&(this.removeLayer(this._popup),this.fire("popupclose",{popup:this._popup}),this._popup=null),this}}),L.LayerGroup=L.Class.extend({initialize:function(a){this._layers={};if(a)for(var b=0,c=a.length;b')}}catch(a){return function(a){return document.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}()},_initPath:function(){this._container=L.Path._createElement("shape"),this._container.className+=" leaflet-vml-shape"+(this.options.clickable?" leaflet-clickable":""),this._container.coordsize="1 1",this._path=L.Path._createElement("path"),this._container.appendChild(this._path),this._map._pathRoot.appendChild(this._container)},_initStyle:function(){this.options.stroke?(this._stroke=L.Path._createElement("stroke"),this._stroke.endcap="round",this._container.appendChild(this._stroke)):this._container.stroked=!1,this.options.fill?(this._container.filled=!0,this._fill=L.Path._createElement("fill"),this._container.appendChild(this._fill)):this._container.filled=!1,this._updateStyle()},_updateStyle:function(){this.options.stroke&&(this._stroke.weight=this.options.weight+"px",this._stroke.color=this.options.color,this._stroke.opacity=this.options.opacity),this.options.fill&&(this._fill.color=this.options.fillColor||this.options.color,this._fill.opacity=this.options.fillOpacity)},_updatePath:function(){this._container.style.display="none",this._path.v=this.getPathString()+" ",this._container.style.display=""}}),L.Map.include(L.Browser.svg||!L.Browser.vml?{}:{_initPathRoot:function(){this._pathRoot||(this._pathRoot=document.createElement("div"),this._pathRoot.className="leaflet-vml-container",this._panes.overlayPane.appendChild(this._pathRoot),this.on("moveend",this._updatePathViewport),this._updatePathViewport())}}),L.Browser.canvas=function(){return!!document.createElement("canvas").getContext}(),L.Path=L.Path.SVG&&!window.L_PREFER_CANVAS||!L.Browser.canvas?L.Path:L.Path.extend({statics:{CANVAS:!0,SVG:!1},options:{updateOnMoveEnd:!0},_initElements:function(){this._map._initPathRoot(),this._ctx=this._map._canvasCtx},_updateStyle:function(){this.options.stroke&&(this._ctx.lineWidth=this.options.weight,this._ctx.strokeStyle=this.options.color),this.options.fill&&(this._ctx.fillStyle=this.options.fillColor||this.options.color)},_drawPath:function(){var a,b,c,d,e,f;this._ctx.beginPath();for(a=0,c=this._parts.length;af&&(g=h,f=i);f>c&&(b[g]=1,this._simplifyDPStep(a,b,c,d,g),this._simplifyDPStep(a,b,c,g,e))},_reducePoints:function(a,b){var c=[a[0]];for(var d=1,e=0,f=a.length;db&&(c.push(a[d]),e=d);return eb.max.x&&(c|=2),a.yb.max.y&&(c|=8),c},_sqDist:function(a,b){var c=b.x-a.x,d=b.y-a.y;return c*c+d*d},_sqClosestPointOnSegment:function(a,b,c,d){var e=b.x,f=b.y,g=c.x-e,h=c.y-f,i=g*g+h*h,j;return i>0&&(j=((a.x-e)*g+(a.y-f)*h)/i,j>1?(e=c.x,f=c.y):j>0&&(e+=g*j,f+=h*j)),g=a.x-e,h=a.y-f,d?g*g+h*h:new L.Point(e,f)}},L.Polyline=L.Path.extend({initialize:function(a,b){L.Path.prototype.initialize.call(this,b),this._latlngs=a},options:{smoothFactor:1,noClip:!1,updateOnMoveEnd:!0},projectLatlngs:function(){this._originalPoints=[];for(var a=0,b=this._latlngs.length;aa.max.x||c.y-b>a.max.y||c.x+ba.y!=e.y>a.y&&a.x<(e.x-d.x)*(a.y-d.y)/(e.y-d.y)+d.x&&(b=!b)}return b}}:{}),L.Circle.include(L.Path.CANVAS?{_drawPath:function(){var a=this._point;this._ctx.beginPath(),this._ctx.arc(a.x,a.y,this._radius,0,Math.PI*2)},_containsPoint:function(a){var b=this._point,c=this.options.stroke?this.options.weight/2:0;return a.distanceTo(b)<=this._radius+c}}:{}),L.GeoJSON=L.FeatureGroup.extend({initialize:function(a,b){L.Util.setOptions(this,b),this._geojson=a,this._layers={},a&&this.addGeoJSON(a)},addGeoJSON:function(a){if(a.features){for(var b=0,c=a.features.length;b1)return;var b=a.touches&&a.touches.length===1?a.touches[0]:a,c=b.target;L.DomEvent.preventDefault(a),L.Browser.touch&&c.tagName.toLowerCase()==="a"&&(c.className+=" leaflet-active"),this._moved=!1;if(this._moving)return;L.Browser.touch||(L.DomUtil.disableTextSelection(),this._setMovingCursor()),this._startPos=this._newPos=L.DomUtil.getPosition(this._element),this._startPoint=new L.Point(b.clientX,b.clientY),L.DomEvent.addListener(document,L.Draggable.MOVE,this._onMove,this),L.DomEvent.addListener(document,L.Draggable.END,this._onUp,this)},_onMove:function(a){if(a.touches&&a.touches.length>1)return;L.DomEvent.preventDefault(a);var b=a.touches&&a.touches.length===1?a.touches[0]:a;this._moved||(this.fire("dragstart"),this._moved=!0),this._moving=!0;var c=new L.Point(b.clientX,b.clientY);this._newPos=this._startPos.add(c).subtract(this._startPoint),L.Util.requestAnimFrame(this._updatePosition,this,!0,this._dragStartTarget)},_updatePosition:function(){this.fire("predrag"),L.DomUtil.setPosition(this._element,this._newPos),this.fire("drag")},_onUp:function(a){if(a.changedTouches){var b=a.changedTouches[0],c=b.target,d=this._newPos&&this._newPos.distanceTo(this._startPos)||0;c.tagName.toLowerCase()==="a"&&(c.className=c.className.replace(" leaflet-active","")),d0&&c<=f,d=b}function l(a){e&&(g.type="dblclick",b(g),d=null)}var d,e=!1,f=250,g,h="_leaflet_",i="touchstart",j="touchend";a[h+i+c]=k,a[h+j+c]=l,a.addEventListener(i,k,!1),a.addEventListener(j,l,!1)},removeDoubleTapListener:function(a,b){var c="_leaflet_";a.removeEventListener(a,a[c+"touchstart"+b],!1),a.removeEventListener(a,a[c+"touchend"+b],!1)}}),L.Map.TouchZoom=L.Handler.extend({addHooks:function(){L.DomEvent.addListener(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){L.DomEvent.removeListener(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(a){if(!a.touches||a.touches.length!==2||this._map._animatingZoom)return;var b=this._map.mouseEventToLayerPoint(a.touches[0]),c=this._map.mouseEventToLayerPoint(a.touches[1]),d=this._map.containerPointToLayerPoint(this._map.getSize().divideBy(2));this._startCenter=b.add(c).divideBy(2,!0),this._startDist=b.distanceTo(c),this._moved=!1,this._zooming=!0,this._centerOffset=d.subtract(this._startCenter),L.DomEvent.addListener(document,"touchmove",this._onTouchMove,this),L.DomEvent.addListener(document,"touchend",this._onTouchEnd,this),L.DomEvent.preventDefault(a)},_onTouchMove:function(a){if(!a.touches||a.touches.length!==2)return;this._moved||(this._map._mapPane.className+=" leaflet-zoom-anim",this._map.fire("zoomstart").fire("movestart")._prepareTileBg(),this._moved=!0);var b=this._map.mouseEventToLayerPoint(a.touches[0]),c=this._map.mouseEventToLayerPoint(a.touches[1]);this._scale=b.distanceTo(c)/this._startDist,this._delta=b.add(c).divideBy(2,!0).subtract(this._startCenter),this._map._tileBg.style.webkitTransform=[L.DomUtil.getTranslateString(this._delta),L.DomUtil.getScaleString(this._scale,this._startCenter)].join(" "),L.DomEvent.preventDefault(a)},_onTouchEnd:function(a){if(!this._moved||!this._zooming)return;this._zooming=!1;var b=this._map.getZoom(),c=Math.log(this._scale)/Math.LN2,d=c>0?Math.ceil(c):Math.floor(c),e=this._map._limitZoom(b+d),f=e-b,g=this._centerOffset.subtract(this._delta).divideBy(this._scale),h=this._map.getPixelOrigin().add(this._startCenter).add(g),i=this._map.unproject(h);L.DomEvent.removeListener(document,"touchmove",this._onTouchMove),L.DomEvent.removeListener(document,"touchend",this._onTouchEnd);var j=Math.pow(2,f);this._map._runAnimation(i,e,j/this._scale,this._startCenter.add(g))}}),L.Map.BoxZoom=L.Handler.extend({initialize:function(a){this._map=a,this._container=a._container,this._pane=a._panes.overlayPane},addHooks:function(){L.DomEvent.addListener(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){L.DomEvent.removeListener(this._container,"mousedown",this._onMouseDown)},_onMouseDown:function(a){if(!a.shiftKey||a.which!==1&&a.button!==1)return!1;L.DomUtil.disableTextSelection(),this._startLayerPoint=this._map.mouseEventToLayerPoint(a),this._box=L.DomUtil.create("div","leaflet-zoom-box",this._pane),L.DomUtil.setPosition(this._box,this._startLayerPoint),this._container.style.cursor="crosshair",L.DomEvent.addListener(document,"mousemove",this._onMouseMove,this),L.DomEvent.addListener(document,"mouseup",this._onMouseUp,this),L.DomEvent.preventDefault(a)},_onMouseMove:function(a){var b=this._map.mouseEventToLayerPoint(a),c=b.x-this._startLayerPoint.x,d=b.y-this._startLayerPoint.y,e=Math.min(b.x,this._startLayerPoint.x),f=Math.min(b.y,this._startLayerPoint.y),g=new L.Point(e,f);L.DomUtil.setPosition(this._box,g),this._box.style.width=Math.abs(c)-4+"px",this._box.style.height=Math.abs(d)-4+"px"},_onMouseUp:function(a){this._pane.removeChild(this._box),this._container.style.cursor="",L.DomUtil.enableTextSelection(),L.DomEvent.removeListener(document,"mousemove",this._onMouseMove),L.DomEvent.removeListener(document,"mouseup",this._onMouseUp);var b=this._map.mouseEventToLayerPoint(a),c=new L.LatLngBounds(this._map.layerPointToLatLng(this._startLayerPoint),this._map.layerPointToLatLng(b));this._map.fitBounds(c)}}),L.Handler.MarkerDrag=L.Handler.extend({initialize:function(a){this._marker=a},addHooks:function(){var a=this._marker._icon;this._draggable||(this._draggable=new L.Draggable(a,a),this._draggable.on("dragstart",this._onDragStart,this).on("drag",this._onDrag,this).on("dragend",this._onDragEnd,this)),this._draggable.enable()},removeHooks:function(){this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},_onDragStart:function(a){this._marker.closePopup().fire("movestart").fire("dragstart")},_onDrag:function(a){var b=L.DomUtil.getPosition(this._marker._icon);this._marker._shadow&&L.DomUtil.setPosition(this._marker._shadow,b),this._marker._latlng=this._marker._map.layerPointToLatLng(b),this._marker.fire("move").fire("drag")},_onDragEnd:function(){this._marker.fire("moveend").fire("dragend")}}),L.Control={},L.Control.Position={TOP_LEFT:"topLeft",TOP_RIGHT:"topRight",BOTTOM_LEFT:"bottomLeft",BOTTOM_RIGHT:"bottomRight"},L.Map.include({addControl:function(a){a.onAdd(this);var b=a.getPosition(),c=this._controlCorners[b],d=a.getContainer();return L.DomUtil.addClass(d,"leaflet-control"),b.indexOf("bottom")!==-1?c.insertBefore(d,c.firstChild):c.appendChild(d),this},removeControl:function(a){var b=a.getPosition(),c=this._controlCorners[b],d=a.getContainer();return c.removeChild(d),a.onRemove&&a.onRemove(this),this},_initControlPos:function(){var a=this._controlCorners={},b="leaflet-",c=b+"top",d=b+"bottom",e=b+"left",f=b+"right",g=L.DomUtil.create("div",b+"control-container",this._container);L.Browser.touch&&(g.className+=" "+b+"big-buttons"),a.topLeft=L.DomUtil.create("div",c+" "+e,g),a.topRight=L.DomUtil.create("div",c+" "+f,g),a.bottomLeft=L.DomUtil.create("div",d+" "+e,g),a.bottomRight=L.DomUtil.create("div",d+" "+f,g)}}),L.Control.Zoom=L.Class.extend({onAdd:function(a){this._map=a,this._container=L.DomUtil.create("div","leaflet-control-zoom"),this._zoomInButton=this._createButton("Zoom in","leaflet-control-zoom-in",this._map.zoomIn,this._map),this._zoomOutButton=this._createButton("Zoom out","leaflet-control-zoom-out",this._map.zoomOut,this._map),this._container.appendChild(this._zoomInButton),this._container.appendChild(this._zoomOutButton)},getContainer:function(){return this._container},getPosition:function(){return L.Control.Position.TOP_LEFT},_createButton:function(a,b,c,d){var e=document.createElement("a");return e.href="#",e.title=a,e.className=b,L.Browser.touch||L.DomEvent.disableClickPropagation(e),L.DomEvent.addListener(e,"click",L.DomEvent.preventDefault),L.DomEvent.addListener(e,"click",c,d),e}}),L.Control.Attribution=L.Class.extend({initialize:function(a){this._prefix=a||'Powered by Leaflet',this._attributions={}},onAdd:function(a){this._container=L.DomUtil.create("div","leaflet-control-attribution"),L.DomEvent.disableClickPropagation(this._container),this._map=a,this._update()},getPosition:function(){return L.Control.Position.BOTTOM_RIGHT},getContainer:function(){return this._container},setPrefix:function(a){this._prefix=a,this._update()},addAttribution:function(a){if(!a)return;this._attributions[a]||(this._attributions[a]=0),this._attributions[a]++,this._update()},removeAttribution:function(a){if(!a)return;this._attributions[a]--,this._update()},_update:function(){if(!this._map)return;var a=[];for(var b in this._attributions)this._attributions.hasOwnProperty(b)&&a.push(b);var c=[];this._prefix&&c.push(this._prefix),a.length&&c.push(a.join(", ")),this._container.innerHTML=c.join(" — ")}}),L.Control.Layers=L.Class.extend({options:{collapsed:!0},initialize:function(a,b,c){L.Util.setOptions(this,c),this._layers={};for(var d in a)a.hasOwnProperty(d)&&this._addLayer(a[d],d);for(d in b)b.hasOwnProperty(d)&&this._addLayer(b[d],d,!0)},onAdd:function(a){this._map=a,this._initLayout(),this._update()},getContainer:function(){return this._container},getPosition:function(){return L.Control.Position.TOP_RIGHT},addBaseLayer:function(a,b){return this._addLayer(a,b),this._update(),this},addOverlay:function(a,b){return this._addLayer(a,b,!0),this._update(),this},removeLayer:function(a){var b=L.Util.stamp(a);return delete this._layers[b],this._update(),this},_initLayout:function(){this._container=L.DomUtil.create("div","leaflet-control-layers"),L.Browser.touch||L.DomEvent.disableClickPropagation(this._container),this._form=L.DomUtil.create("form","leaflet-control-layers-list");if(this.options.collapsed){L.DomEvent.addListener(this._container,"mouseover",this._expand,this),L.DomEvent.addListener(this._container,"mouseout",this._collapse,this);var a=this._layersLink=L.DomUtil.create("a","leaflet-control-layers-toggle");a.href="#",a.title="Layers",L.Browser.touch?L.DomEvent.addListener(a,"click",this._expand,this):L.DomEvent.addListener(a,"focus",this._expand,this),this._map.on("movestart",this._collapse,this),this._container.appendChild(a)}else this._expand();this._baseLayersList=L.DomUtil.create("div","leaflet-control-layers-base",this._form),this._separator=L.DomUtil.create("div","leaflet-control-layers-separator",this._form),this._overlaysList=L.DomUtil.create("div","leaflet-control-layers-overlays",this._form),this._container.appendChild(this._form)},_addLayer:function(a,b,c){var d=L.Util.stamp(a);this._layers[d]={layer:a,name:b,overlay:c}},_update:function(){if(!this._container)return;this._baseLayersList.innerHTML="",this._overlaysList.innerHTML="";var a=!1,b=!1;for(var c in this._layers)if(this._layers.hasOwnProperty(c)){var d=this._layers[c];this._addItem(d),b=b||d.overlay,a=a||!d.overlay}this._separator.style.display=b&&a?"":"none"},_addItem:function(a,b){var c=document.createElement("label"),d=document.createElement("input");a.overlay||(d.name="leaflet-base-layers"),d.type=a.overlay?"checkbox":"radio",d.checked=this._map.hasLayer(a.layer),d.layerId=L.Util.stamp(a.layer),L.DomEvent.addListener(d,"click",this._onInputClick,this);var e=document.createTextNode(" "+a.name);c.appendChild(d),c.appendChild(e);var f=a.overlay?this._overlaysList:this._baseLayersList;f.appendChild(c)},_onInputClick:function(){var a,b,c,d=this._form.getElementsByTagName("input"),e=d.length;for(a=0;a0},removeEventListener:function(a,b,c){if(!this.hasEventListeners(a))return this;for(var d=0,e=this._leaflet_events,f=e[a].length;d=this.min.x&&c.x<=this.max.x&&b.y>=this.min.y&&c.y<=this.max.y},intersects:function(a){var b=this.min,c=this.max,d=a.min,e=a.max,f=e.x>=b.x&&d.x<=c.x,g=e.y>=b.y&&d.y<=c.y;return f&&g}}),L.Transformation=L.Class.extend({initialize:function(a,b,c,d){this._a=a,this._b=b,this._c=c,this._d=d},transform:function(a,b){return this._transform(a.clone(),b)},_transform:function(a,b){return b=b||1,a.x=b*(this._a*a.x+this._b),a.y=b*(this._c*a.y+this._d),a},untransform:function(a,b){return b=b||1,new L.Point((a.x/b-this._b)/this._a,(a.y/b-this._d)/this._c)}}),L.DomUtil={get:function(a){return typeof a=="string"?document.getElementById(a):a},getStyle:function(a,b){var c=a.style[b];!c&&a.currentStyle&&(c=a.currentStyle[b]);if(!c||c==="auto"){var d=document.defaultView.getComputedStyle(a,null);c=d?d[b]:null}return c==="auto"?null:c},getViewportOffset:function(a){var b=0,c=0,d=a,e=document.body;do{b+=d.offsetTop||0,c+=d.offsetLeft||0;if(d.offsetParent===e&&L.DomUtil.getStyle(d,"position")==="absolute")break;d=d.offsetParent}while(d);d=a;do{if(d===e)break;b-=d.scrollTop||0,c-=d.scrollLeft||0,d=d.parentNode}while(d);return new L.Point(c,b)},create:function(a,b,c){var d=document.createElement(a);return d.className=b,c&&c.appendChild(d),d},disableTextSelection:function(){document.selection&&document.selection.empty&&document.selection.empty(),this._onselectstart||(this._onselectstart=document.onselectstart,document.onselectstart=L.Util.falseFn)},enableTextSelection:function(){document.onselectstart=this._onselectstart,this._onselectstart=null},hasClass:function(a,b){return a.className.length>0&&RegExp("(^|\\s)"+b+"(\\s|$)").test(a.className)},addClass:function(a,b){L.DomUtil.hasClass(a,b)||(a.className+=(a.className?" ":"")+b)},removeClass:function(a,b){a.className=a.className.replace(/(\S+)\s*/g,function(a,c){return c===b?"":a}).replace(/^\s+/,"")},setOpacity:function(a,b){L.Browser.ie?a.style.filter="alpha(opacity="+Math.round(b*100)+")":a.style.opacity=b},testProp:function(a){var b=document.documentElement.style;for(var c=0;c=b.lat&&e.lat<=c.lat&&d.lng>=b.lng&&e.lng<=c.lng},intersects:function(a){var b=this._southWest,c=this._northEast,d=a.getSouthWest(),e=a.getNorthEast(),f=e.lat>=b.lat&&d.lat<=c.lat,g=e.lng>=b.lng&&d.lng<=c.lng;return f&&g},toBBoxString:function(){var a=this._southWest,b=this._northEast;return[a.lng,a.lat,b.lng,b.lat].join(",")}}),L.Projection={},L.Projection.SphericalMercator={MAX_LATITUDE:85.0511287798,project:function(a){var b=L.LatLng.DEG_TO_RAD,c=this.MAX_LATITUDE,d=Math.max(Math.min(c,a.lat),-c),e=a.lng*b,f=d*b;return f=Math.log(Math.tan(Math.PI/4+f/2)),new L.Point(e,f)},unproject:function(a,b){var c=L.LatLng.RAD_TO_DEG,d=a.x*c,e=(2*Math.atan(Math.exp(a.y))-Math.PI/2)*c;return new L.LatLng(e,d,b)}},L.Projection.LonLat={project:function(a){return new L.Point(a.lng,a.lat)},unproject:function(a,b){return new L.LatLng(a.y,a.x,b)}},L.CRS={latLngToPoint:function(a,b){var c=this.projection.project(a);return this.transformation._transform(c,b)},pointToLatLng:function(a,b,c){var d=this.transformation.untransform(a,b);return this.projection.unproject(d,c)},project:function(a){return this.projection.project(a)}},L.CRS.EPSG3857=L.Util.extend({},L.CRS,{code:"EPSG:3857",projection:L.Projection.SphericalMercator,transformation:new L.Transformation(.5/Math.PI,.5,-0.5/Math.PI,.5),project:function(a){var b=this.projection.project(a),c=6378137;return b.multiplyBy(c)}}),L.CRS.EPSG900913=L.Util.extend({},L.CRS.EPSG3857,{code:"EPSG:900913"}),L.CRS.EPSG4326=L.Util.extend({},L.CRS,{code:"EPSG:4326",projection:L.Projection.LonLat,transformation:new L.Transformation(1/360,.5,-1/360,.5)}),L.Map=L.Class.extend({includes:L.Mixin.Events,options:{crs:L.CRS.EPSG3857||L.CRS.EPSG4326,scale:function(a){return 256*Math.pow(2,a)},center:null,zoom:null,layers:[],dragging:!0,touchZoom:L.Browser.touch&&!L.Browser.android,scrollWheelZoom:!L.Browser.touch,doubleClickZoom:!0,boxZoom:!0,zoomControl:!0,attributionControl:!0,fadeAnimation:L.DomUtil.TRANSITION&&!L.Browser.android,zoomAnimation:L.DomUtil.TRANSITION&&!L.Browser.android&&!L.Browser.mobileOpera,trackResize:!0,closePopupOnClick:!0,worldCopyJump:!0},initialize:function(a,b){L.Util.setOptions(this,b),this._container=L.DomUtil.get(a);if(this._container._leaflet)throw Error("Map container is already initialized.");this._container._leaflet=!0,this._initLayout(),L.DomEvent&&(this._initEvents(),L.Handler&&this._initInteraction(),L.Control&&this._initControls()),this.options.maxBounds&&this.setMaxBounds(this.options.maxBounds);var c=this.options.center,d=this.options.zoom;c!==null&&d!==null&&this.setView(c,d,!0);var e=this.options.layers;e=e instanceof Array?e:[e],this._tileLayersNum=0,this._initLayers(e)},setView:function(a,b){return this._resetView(a,this._limitZoom(b)),this},setZoom:function(a){return this.setView(this.getCenter(),a)},zoomIn:function(){return this.setZoom(this._zoom+1)},zoomOut:function(){return this.setZoom(this._zoom-1)},fitBounds:function(a){var b=this.getBoundsZoom(a);return this.setView(a.getCenter(),b)},fitWorld:function(){var a=new L.LatLng(-60,-170),b=new L.LatLng(85,179);return this.fitBounds(new L.LatLngBounds(a,b))},panTo:function(a){return this.setView(a,this._zoom)},panBy:function(a){return this.fire("movestart"),this._rawPanBy(a),this.fire("move"),this.fire("moveend"),this},setMaxBounds:function(a){this.options.maxBounds=a;if(!a)return this._boundsMinZoom=null,this;var b=this.getBoundsZoom(a,!0);return this._boundsMinZoom=b,this._loaded&&(this._zoomf.x&&(g=f.x-d.x),c.y>e.y&&(h=e.y-c.y),c.xl&&--m>0)o=h*Math.sin(j),n=Math.PI/2-2*Math.atan(i*Math.pow((1-o)/(1+o),.5*h))-j,j+=n;return new L.LatLng(j*c,f,b)}},L.CRS.EPSG3395=L.Util.extend({},L.CRS,{code:"EPSG:3395",projection:L.Projection.Mercator,transformation:function(){var a=L.Projection.Mercator,b=a.R_MAJOR,c=a.R_MINOR;return new L.Transformation(.5/(Math.PI*b),.5,-0.5/(Math.PI*c),.5)}()}),L.TileLayer=L.Class.extend({includes:L.Mixin.Events,options:{minZoom:0,maxZoom:18,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",opacity:1,scheme:"xyz",continuousWorld:!1,noWrap:!1,zoomOffset:0,zoomReverse:!1,unloadInvisibleTiles:L.Browser.mobile,updateWhenIdle:L.Browser.mobile,reuseTiles:!1},initialize:function(a,b,c){L.Util.setOptions(this,b),this._url=a,this._urlParams=c,typeof this.options.subdomains=="string"&&(this.options.subdomains=this.options.subdomains.split(""))},onAdd:function(a,b){this._map=a,this._insertAtTheBottom=b,this._initContainer(),this._createTileProto(),a.on("viewreset",this._resetCallback,this),this.options.updateWhenIdle?a.on("moveend",this._update,this):(this._limitedUpdate=L.Util.limitExecByInterval(this._update,150,this),a.on("move",this._limitedUpdate,this)),this._reset(),this._update()},onRemove:function(a){this._map.getPanes().tilePane.removeChild(this._container),this._container=null,this._map.off("viewreset",this._resetCallback,this),this.options.updateWhenIdle?this._map.off("moveend",this._update,this):this._map.off("move",this._limitedUpdate,this)},getAttribution:function(){return this.options.attribution},setOpacity:function(a){this.options.opacity=a,this._setOpacity(a);if(L.Browser.webkit)for(var b in this._tiles)this._tiles.hasOwnProperty(b)&&(this._tiles[b].style.webkitTransform+=" translate(0,0)")},_setOpacity:function(a){a<1&&L.DomUtil.setOpacity(this._container,a)},_initContainer:function(){var a=this._map.getPanes().tilePane,b=a.firstChild;if(!this._container||a.empty)this._container=L.DomUtil.create("div","leaflet-layer"),this._insertAtTheBottom&&b?a.insertBefore(this._container,b):a.appendChild(this._container),this._setOpacity(this.options.opacity)},_resetCallback:function(a){this._reset(a.hard)},_reset:function(a){var b;for(b in this._tiles)this._tiles.hasOwnProperty(b)&&this.fire("tileunload",{tile:this._tiles[b]});this._tiles={},this.options.reuseTiles&&(this._unusedTiles=[]),a&&this._container&&(this._container.innerHTML=""),this._initContainer()},_update:function(){var a=this._map.getPixelBounds(),b=this._map.getZoom(),c=this.options.tileSize;if(b>this.options.maxZoom||ba.max.x||da.max.y)f=this._tiles[e],this.fire("tileunload",{tile:f,url:f.src}),f.parentNode===this._container&&this._container.removeChild(f),this.options.reuseTiles&&this._unusedTiles.push(this._tiles[e]),f.src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=",delete this._tiles[e]}},_addTile:function(a,b){var c=this._getTilePos(a),d=this._map.getZoom(),e=a.x+":"+a.y,f=Math.pow(2,this._getOffsetZoom(d));if(!this.options.continuousWorld){if(!this.options.noWrap)a.x=(a.x%f+f)%f;else if(a.x<0||a.x>=f){this._tilesToLoad--;return}if(a.y<0||a.y>=f){this._tilesToLoad--;return}}var g=this._getTile();L.DomUtil.setPosition(g,c),this._tiles[e]=g,this.options.scheme==="tms"&&(a.y=f-a.y-1),this._loadTile(g,a,d),b.appendChild(g)},_getOffsetZoom:function(a){return a=this.options.zoomReverse?this.options.maxZoom-a:a,a+this.options.zoomOffset},_getTilePos:function(a){var b=this._map.getPixelOrigin(),c=this.options.tileSize;return a.multiplyBy(c).subtract(b)},getTileUrl:function(a,b){var c=this.options.subdomains,d=this.options.subdomains[(a.x+a.y)%c.length];return L.Util.template(this._url,L.Util.extend({s:d,z:this._getOffsetZoom(b),x:a.x,y:a.y},this._urlParams))},_createTileProto:function(){this._tileImg=L.DomUtil.create("img","leaflet-tile"),this._tileImg.galleryimg="no";var a=this.options.tileSize;this._tileImg.style.width=a+"px",this._tileImg.style.height=a+"px"},_getTile:function(){if(this.options.reuseTiles&&this._unusedTiles.length>0){var a=this._unusedTiles.pop();return this._resetTile(a),a}return this._createTile()},_resetTile:function(a){},_createTile:function(){var a=this._tileImg.cloneNode(!1);return a.onselectstart=a.onmousemove=L.Util.falseFn,a},_loadTile:function(a,b,c){a._layer=this,a.onload=this._tileOnLoad,a.onerror=this._tileOnError,a.src=this.getTileUrl(b,c)},_tileOnLoad:function(a){var b=this._layer;this.className+=" leaflet-tile-loaded",b.fire("tileload",{tile:this,url:this.src}),b._tilesToLoad--,b._tilesToLoad||b.fire("load")},_tileOnError:function(a){var b=this._layer;b.fire("tileerror",{tile:this,url:this.src});var c=b.options.errorTileUrl;c&&(this.src=c)}}),L.TileLayer.WMS=L.TileLayer.extend({defaultWmsParams:{service:"WMS",request:"GetMap",version:"1.1.1",layers:"",styles:"",format:"image/jpeg",transparent:!1},initialize:function(a,b){this._url=a,this.wmsParams=L.Util.extend({},this.defaultWmsParams),this.wmsParams.width=this.wmsParams.height=this.options.tileSize;for(var c in b)this.options.hasOwnProperty(c)||(this.wmsParams[c]=b[c]);L.Util.setOptions(this,b)},onAdd:function(a){var b=parseFloat(this.wmsParams.version)<1.3?"srs":"crs";this.wmsParams[b]=a.options.crs.code,L.TileLayer.prototype.onAdd.call(this,a)},getTileUrl:function(a,b){var c=this.options.tileSize,d=a.multiplyBy(c),e=d.add(new L.Point(c,c)),f=this._map.unproject(d,this._zoom,!0),g=this._map.unproject(e,this._zoom,!0),h=this._map.options.crs.project(f),i=this._map.options.crs.project(g),j=[h.x,i.y,i.x,h.y].join(",");return this._url+L.Util.getParamString(this.wmsParams)+"&bbox="+j}}),L.TileLayer.Canvas=L.TileLayer.extend({options:{async:!1},initialize:function(a){L.Util.setOptions(this,a)},redraw:function(){for(var a in this._tiles){var b=this._tiles[a];this._redrawTile(b)}},_redrawTile:function(a){this.drawTile(a,a._tilePoint,a._zoom)},_createTileProto:function(){this._canvasProto=L.DomUtil.create("canvas","leaflet-tile");var a=this.options.tileSize;this._canvasProto.width=a,this._canvasProto.height=a},_createTile:function(){var a=this._canvasProto.cloneNode(!1);return a.onselectstart=a.onmousemove=L.Util.falseFn,a},_loadTile:function(a,b,c){a._layer=this,a._tilePoint=b,a._zoom=c,this.drawTile(a,b,c),this.options.async||this.tileDrawn(a)},drawTile:function(a,b,c){},tileDrawn:function(a){this._tileOnLoad.call(a)}}),L.ImageOverlay=L.Class.extend({includes:L.Mixin.Events,initialize:function(a,b){this._url=a,this._bounds=b},onAdd:function(a){this._map=a,this._image||this._initImage(),a.getPanes().overlayPane.appendChild(this._image),a.on("viewreset",this._reset,this),this._reset()},onRemove:function(a){a.getPanes().overlayPane.removeChild(this._image),a.off("viewreset",this._reset,this)},_initImage:function(){this._image=L.DomUtil.create("img","leaflet-image-layer"),this._image.style.visibility="hidden",L.Util.extend(this._image,{galleryimg:"no",onselectstart:L.Util.falseFn,onmousemove:L.Util.falseFn,onload:L.Util.bind(this._onImageLoad,this),src:this._url})},_reset:function(){var a=this._map.latLngToLayerPoint(this._bounds.getNorthWest()),b=this._map.latLngToLayerPoint(this._bounds.getSouthEast()),c=b.subtract(a);L.DomUtil.setPosition(this._image,a),this._image.style.width=c.x+"px",this._image.style.height=c.y+"px"},_onImageLoad:function(){this._image.style.visibility="",this.fire("load")}}),L.Icon=L.Class.extend({iconUrl:L.ROOT_URL+"images/marker.png",shadowUrl:L.ROOT_URL+"images/marker-shadow.png",iconSize:new L.Point(25,41),shadowSize:new L.Point(41,41),iconAnchor:new L.Point(13,41),popupAnchor:new L.Point(0,-33),initialize:function(a){a&&(this.iconUrl=a)},createIcon:function(){return this._createIcon("icon")},createShadow:function(){return this._createIcon("shadow")},_createIcon:function(a){var b=this[a+"Size"],c=this[a+"Url"];if(!c&&a==="shadow")return null;var d;return c?d=this._createImg(c):d=this._createDiv(),d.className="leaflet-marker-"+a,d.style.marginLeft=-this.iconAnchor.x+"px",d.style.marginTop=-this.iconAnchor.y+"px",b&&(d.style.width=b.x+"px",d.style.height=b.y+"px"),d},_createImg:function(a){var b;return L.Browser.ie6?(b=document.createElement("div"),b.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+a+'")'):(b=document.createElement("img"),b.src=a),b},_createDiv:function(){return document.createElement("div")}}),L.Marker=L.Class.extend({includes:L.Mixin.Events,options:{icon:new L.Icon,title:"",clickable:!0,draggable:!1,zIndexOffset:0},initialize:function(a,b){L.Util.setOptions(this,b),this._latlng=a},onAdd:function(a){this._map=a,this._initIcon(),a.on("viewreset",this._reset,this),this._reset()},onRemove:function(a){this._removeIcon(),this.closePopup&&this.closePopup(),this._map=null,a.off("viewreset",this._reset,this)},getLatLng:function(){return this._latlng},setLatLng:function(a){this._latlng=a,this._icon&&(this._reset(),this._popup&&this._popup.setLatLng(this._latlng))},setZIndexOffset:function(a){this.options.zIndexOffset=a,this._icon&&this._reset()},setIcon:function(a){this._map&&this._removeIcon(),this.options.icon=a,this._map&&(this._initIcon(),this._reset())},_initIcon:function(){this._icon||(this._icon=this.options.icon.createIcon(),this.options.title&&(this._icon.title=this.options.title),this._initInteraction()),this._shadow||(this._shadow=this.options.icon.createShadow()),this._map._panes.markerPane.appendChild(this._icon),this._shadow&&this._map._panes.shadowPane.appendChild(this._shadow)},_removeIcon:function(){this._map._panes.markerPane.removeChild(this._icon),this._shadow&&this._map._panes.shadowPane.removeChild(this._shadow),this._icon=this._shadow=null},_reset:function(){var a=this._map.latLngToLayerPoint(this._latlng).round();L.DomUtil.setPosition(this._icon,a),this._shadow&&L.DomUtil.setPosition(this._shadow,a),this._icon.style.zIndex=a.y+this.options.zIndexOffset},_initInteraction:function(){if(this.options.clickable){this._icon.className+=" leaflet-clickable",L.DomEvent.addListener(this._icon,"click",this._onMouseClick,this);var a=["dblclick","mousedown","mouseover","mouseout"];for(var b=0;bthis.options.maxWidth?this.options.maxWidth:af.x&&(d.x=c.x+this._containerWidth-f.x+e.x),c.y<0&&(d.y=c.y-e.y),c.y+a>f.y&&(d.y=c.y+a-f.y+e.y),(d.x||d.y)&&this._map.panBy(d)},_onCloseButtonClick:function(a){this._close(),L.DomEvent.stop(a)}}),L.Marker.include({openPopup:function(){return this._popup.setLatLng(this._latlng),this._map&&this._map.openPopup(this._popup),this},closePopup:function(){return this._popup&&this._popup._close(),this},bindPopup:function(a,b){return b=L.Util.extend({offset:this.options.icon.popupAnchor},b),this._popup||this.on("click",this.openPopup,this),this._popup=new L.Popup(b,this),this._popup.setContent(a),this},unbindPopup:function(){return this._popup&&(this._popup=null,this.off("click",this.openPopup)),this}}),L.Map.include({openPopup:function(a){return this.closePopup(),this._popup=a,this.addLayer(a),this.fire("popupopen",{popup:this._popup}),this},closePopup:function(){return this._popup&&(this.removeLayer(this._popup),this.fire("popupclose",{popup:this._popup}),this._popup=null),this}}),L.LayerGroup=L.Class.extend({initialize:function(a){this._layers={};if(a)for(var b=0,c=a.length;b')}}catch(a){return function(a){return document.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}()},_initPath:function(){this._container=L.Path._createElement("shape"),this._container.className+=" leaflet-vml-shape"+(this.options.clickable?" leaflet-clickable":""),this._container.coordsize="1 1",this._path=L.Path._createElement("path"),this._container.appendChild(this._path),this._map._pathRoot.appendChild(this._container)},_initStyle:function(){this.options.stroke?(this._stroke=L.Path._createElement("stroke"),this._stroke.endcap="round",this._container.appendChild(this._stroke)):this._container.stroked=!1,this.options.fill?(this._container.filled=!0,this._fill=L.Path._createElement("fill"),this._container.appendChild(this._fill)):this._container.filled=!1,this._updateStyle()},_updateStyle:function(){this.options.stroke&&(this._stroke.weight=this.options.weight+"px",this._stroke.color=this.options.color,this._stroke.opacity=this.options.opacity),this.options.fill&&(this._fill.color=this.options.fillColor||this.options.color,this._fill.opacity=this.options.fillOpacity)},_updatePath:function(){this._container.style.display="none",this._path.v=this.getPathString()+" ",this._container.style.display=""}}),L.Map.include(L.Browser.svg||!L.Browser.vml?{}:{_initPathRoot:function(){this._pathRoot||(this._pathRoot=document.createElement("div"),this._pathRoot.className="leaflet-vml-container",this._panes.overlayPane.appendChild(this._pathRoot),this.on("moveend",this._updatePathViewport),this._updatePathViewport())}}),L.Browser.canvas=function(){return!!document.createElement("canvas").getContext}(),L.Path=L.Path.SVG&&!window.L_PREFER_CANVAS||!L.Browser.canvas?L.Path:L.Path.extend({statics:{CANVAS:!0,SVG:!1},options:{updateOnMoveEnd:!0},_initElements:function(){this._map._initPathRoot(),this._ctx=this._map._canvasCtx},_updateStyle:function(){this.options.stroke&&(this._ctx.lineWidth=this.options.weight,this._ctx.strokeStyle=this.options.color),this.options.fill&&(this._ctx.fillStyle=this.options.fillColor||this.options.color)},_drawPath:function(){var a,b,c,d,e,f;this._ctx.beginPath();for(a=0,c=this._parts.length;af&&(g=h,f=i);f>c&&(b[g]=1,this._simplifyDPStep(a,b,c,d,g),this._simplifyDPStep(a,b,c,g,e))},_reducePoints:function(a,b){var c=[a[0]];for(var d=1,e=0,f=a.length;db&&(c.push(a[d]),e=d);return eb.max.x&&(c|=2),a.yb.max.y&&(c|=8),c},_sqDist:function(a,b){var c=b.x-a.x,d=b.y-a.y;return c*c+d*d},_sqClosestPointOnSegment:function(a,b,c,d){var e=b.x,f=b.y,g=c.x-e,h=c.y-f,i=g*g+h*h,j;return i>0&&(j=((a.x-e)*g+(a.y-f)*h)/i,j>1?(e=c.x,f=c.y):j>0&&(e+=g*j,f+=h*j)),g=a.x-e,h=a.y-f,d?g*g+h*h:new L.Point(e,f)}},L.Polyline=L.Path.extend({initialize:function(a,b){L.Path.prototype.initialize.call(this,b),this._latlngs=a},options:{smoothFactor:1,noClip:!1,updateOnMoveEnd:!0},projectLatlngs:function(){this._originalPoints=[];for(var a=0,b=this._latlngs.length;aa.max.x||c.y-b>a.max.y||c.x+ba.y!=e.y>a.y&&a.x<(e.x-d.x)*(a.y-d.y)/(e.y-d.y)+d.x&&(b=!b)}return b}}:{}),L.Circle.include(L.Path.CANVAS?{_drawPath:function(){var a=this._point;this._ctx.beginPath(),this._ctx.arc(a.x,a.y,this._radius,0,Math.PI*2)},_containsPoint:function(a){var b=this._point,c=this.options.stroke?this.options.weight/2:0;return a.distanceTo(b)<=this._radius+c}}:{}),L.GeoJSON=L.FeatureGroup.extend({initialize:function(a,b){L.Util.setOptions(this,b),this._geojson=a,this._layers={},a&&this.addGeoJSON(a)},addGeoJSON:function(a){if(a.features){for(var b=0,c=a.features.length;b1)return;var b=a.touches&&a.touches.length===1?a.touches[0]:a,c=b.target;L.DomEvent.preventDefault(a),L.Browser.touch&&c.tagName.toLowerCase()==="a"&&(c.className+=" leaflet-active"),this._moved=!1;if(this._moving)return;L.Browser.touch||(L.DomUtil.disableTextSelection(),this._setMovingCursor()),this._startPos=this._newPos=L.DomUtil.getPosition(this._element),this._startPoint=new L.Point(b.clientX,b.clientY),L.DomEvent.addListener(document,L.Draggable.MOVE,this._onMove,this),L.DomEvent.addListener(document,L.Draggable.END,this._onUp,this)},_onMove:function(a){if(a.touches&&a.touches.length>1)return;L.DomEvent.preventDefault(a);var b=a.touches&&a.touches.length===1?a.touches[0]:a;this._moved||(this.fire("dragstart"),this._moved=!0),this._moving=!0;var c=new L.Point(b.clientX,b.clientY);this._newPos=this._startPos.add(c).subtract(this._startPoint),L.Util.requestAnimFrame(this._updatePosition,this,!0,this._dragStartTarget)},_updatePosition:function(){this.fire("predrag"),L.DomUtil.setPosition(this._element,this._newPos),this.fire("drag")},_onUp:function(a){if(a.changedTouches){var b=a.changedTouches[0],c=b.target,d=this._newPos&&this._newPos.distanceTo(this._startPos)||0;c.tagName.toLowerCase()==="a"&&(c.className=c.className.replace(" leaflet-active","")),d0&&c<=f,d=b}function l(a){e&&(g.type="dblclick",b(g),d=null)}var d,e=!1,f=250,g,h="_leaflet_",i="touchstart",j="touchend";a[h+i+c]=k,a[h+j+c]=l,a.addEventListener(i,k,!1),a.addEventListener(j,l,!1)},removeDoubleTapListener:function(a,b){var c="_leaflet_";a.removeEventListener(a,a[c+"touchstart"+b],!1),a.removeEventListener(a,a[c+"touchend"+b],!1)}}),L.Map.TouchZoom=L.Handler.extend({addHooks:function(){L.DomEvent.addListener(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){L.DomEvent.removeListener(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(a){if(!a.touches||a.touches.length!==2||this._map._animatingZoom)return;var b=this._map.mouseEventToLayerPoint(a.touches[0]),c=this._map.mouseEventToLayerPoint(a.touches[1]),d=this._map.containerPointToLayerPoint(this._map.getSize().divideBy(2));this._startCenter=b.add(c).divideBy(2,!0),this._startDist=b.distanceTo(c),this._moved=!1,this._zooming=!0,this._centerOffset=d.subtract(this._startCenter),L.DomEvent.addListener(document,"touchmove",this._onTouchMove,this),L.DomEvent.addListener(document,"touchend",this._onTouchEnd,this),L.DomEvent.preventDefault(a)},_onTouchMove:function(a){if(!a.touches||a.touches.length!==2)return;this._moved||(this._map._mapPane.className+=" leaflet-zoom-anim",this._map.fire("zoomstart").fire("movestart")._prepareTileBg(),this._moved=!0);var b=this._map.mouseEventToLayerPoint(a.touches[0]),c=this._map.mouseEventToLayerPoint(a.touches[1]);this._scale=b.distanceTo(c)/this._startDist,this._delta=b.add(c).divideBy(2,!0).subtract(this._startCenter),this._map._tileBg.style.webkitTransform=[L.DomUtil.getTranslateString(this._delta),L.DomUtil.getScaleString(this._scale,this._startCenter)].join(" "),L.DomEvent.preventDefault(a)},_onTouchEnd:function(a){if(!this._moved||!this._zooming)return;this._zooming=!1;var b=this._map.getZoom(),c=Math.log(this._scale)/Math.LN2,d=c>0?Math.ceil(c):Math.floor(c),e=this._map._limitZoom(b+d),f=e-b,g=this._centerOffset.subtract(this._delta).divideBy(this._scale),h=this._map.getPixelOrigin().add(this._startCenter).add(g),i=this._map.unproject(h);L.DomEvent.removeListener(document,"touchmove",this._onTouchMove),L.DomEvent.removeListener(document,"touchend",this._onTouchEnd);var j=Math.pow(2,f);this._map._runAnimation(i,e,j/this._scale,this._startCenter.add(g))}}),L.Map.BoxZoom=L.Handler.extend({initialize:function(a){this._map=a,this._container=a._container,this._pane=a._panes.overlayPane},addHooks:function(){L.DomEvent.addListener(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){L.DomEvent.removeListener(this._container,"mousedown",this._onMouseDown)},_onMouseDown:function(a){if(!a.shiftKey||a.which!==1&&a.button!==1)return!1;L.DomUtil.disableTextSelection(),this._startLayerPoint=this._map.mouseEventToLayerPoint(a),this._box=L.DomUtil.create("div","leaflet-zoom-box",this._pane),L.DomUtil.setPosition(this._box,this._startLayerPoint),this._container.style.cursor="crosshair",L.DomEvent.addListener(document,"mousemove",this._onMouseMove,this),L.DomEvent.addListener(document,"mouseup",this._onMouseUp,this),L.DomEvent.preventDefault(a)},_onMouseMove:function(a){var b=this._map.mouseEventToLayerPoint(a),c=b.x-this._startLayerPoint.x,d=b.y-this._startLayerPoint.y,e=Math.min(b.x,this._startLayerPoint.x),f=Math.min(b.y,this._startLayerPoint.y),g=new L.Point(e,f);L.DomUtil.setPosition(this._box,g),this._box.style.width=Math.abs(c)-4+"px",this._box.style.height=Math.abs(d)-4+"px"},_onMouseUp:function(a){this._pane.removeChild(this._box),this._container.style.cursor="",L.DomUtil.enableTextSelection(),L.DomEvent.removeListener(document,"mousemove",this._onMouseMove),L.DomEvent.removeListener(document,"mouseup",this._onMouseUp);var b=this._map.mouseEventToLayerPoint(a),c=new L.LatLngBounds(this._map.layerPointToLatLng(this._startLayerPoint),this._map.layerPointToLatLng(b));this._map.fitBounds(c)}}),L.Handler.MarkerDrag=L.Handler.extend({initialize:function(a){this._marker=a},addHooks:function(){var a=this._marker._icon;this._draggable||(this._draggable=new L.Draggable(a,a),this._draggable.on("dragstart",this._onDragStart,this).on("drag",this._onDrag,this).on("dragend",this._onDragEnd,this)),this._draggable.enable()},removeHooks:function(){this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},_onDragStart:function(a){this._marker.closePopup().fire("movestart").fire("dragstart")},_onDrag:function(a){var b=L.DomUtil.getPosition(this._marker._icon);this._marker._shadow&&L.DomUtil.setPosition(this._marker._shadow,b),this._marker._latlng=this._marker._map.layerPointToLatLng(b),this._marker.fire("move").fire("drag")},_onDragEnd:function(){this._marker.fire("moveend").fire("dragend")}}),L.Control={},L.Control.Position={TOP_LEFT:"topLeft",TOP_RIGHT:"topRight",BOTTOM_LEFT:"bottomLeft",BOTTOM_RIGHT:"bottomRight"},L.Map.include({addControl:function(a){a.onAdd(this);var b=a.getPosition(),c=this._controlCorners[b],d=a.getContainer();return L.DomUtil.addClass(d,"leaflet-control"),b.indexOf("bottom")!==-1?c.insertBefore(d,c.firstChild):c.appendChild(d),this},removeControl:function(a){var b=a.getPosition(),c=this._controlCorners[b],d=a.getContainer();return c.removeChild(d),a.onRemove&&a.onRemove(this),this},_initControlPos:function(){var a=this._controlCorners={},b="leaflet-",c=b+"top",d=b+"bottom",e=b+"left",f=b+"right",g=L.DomUtil.create("div",b+"control-container",this._container);L.Browser.touch&&(g.className+=" "+b+"big-buttons"),a.topLeft=L.DomUtil.create("div",c+" "+e,g),a.topRight=L.DomUtil.create("div",c+" "+f,g),a.bottomLeft=L.DomUtil.create("div",d+" "+e,g),a.bottomRight=L.DomUtil.create("div",d+" "+f,g)}}),L.Control.Zoom=L.Class.extend({onAdd:function(a){this._map=a,this._container=L.DomUtil.create("div","leaflet-control-zoom"),this._zoomInButton=this._createButton("Zoom in","leaflet-control-zoom-in",this._map.zoomIn,this._map),this._zoomOutButton=this._createButton("Zoom out","leaflet-control-zoom-out",this._map.zoomOut,this._map),this._container.appendChild(this._zoomInButton),this._container.appendChild(this._zoomOutButton)},getContainer:function(){return this._container},getPosition:function(){return L.Control.Position.TOP_LEFT},_createButton:function(a,b,c,d){var e=document.createElement("a");return e.href="#",e.title=a,e.className=b,L.Browser.touch||L.DomEvent.disableClickPropagation(e),L.DomEvent.addListener(e,"click",L.DomEvent.preventDefault),L.DomEvent.addListener(e,"click",c,d),e}}),L.Control.Attribution=L.Class.extend({initialize:function(a){this._prefix=a||'Powered by Leaflet',this._attributions={}},onAdd:function(a){this._container=L.DomUtil.create("div","leaflet-control-attribution"),L.DomEvent.disableClickPropagation(this._container),this._map=a,this._update()},getPosition:function(){return L.Control.Position.BOTTOM_RIGHT},getContainer:function(){return this._container},setPrefix:function(a){this._prefix=a,this._update()},addAttribution:function(a){if(!a)return;this._attributions[a]||(this._attributions[a]=0),this._attributions[a]++,this._update()},removeAttribution:function(a){if(!a)return;this._attributions[a]--,this._update()},_update:function(){if(!this._map)return;var a=[];for(var b in this._attributions)if(this._attributions.hasOwnProperty(b)&&this._attributions[b])a.push(b);var c=[];this._prefix&&c.push(this._prefix),a.length&&c.push(a.join(", ")),this._container.innerHTML=c.join(" — ")}}),L.Control.Layers=L.Class.extend({options:{collapsed:!0},initialize:function(a,b,c){L.Util.setOptions(this,c),this._layers={};for(var d in a)a.hasOwnProperty(d)&&this._addLayer(a[d],d);for(d in b)b.hasOwnProperty(d)&&this._addLayer(b[d],d,!0)},onAdd:function(a){this._map=a,this._initLayout(),this._update()},getContainer:function(){return this._container},getPosition:function(){return L.Control.Position.TOP_RIGHT},addBaseLayer:function(a,b){return this._addLayer(a,b),this._update(),this},addOverlay:function(a,b){return this._addLayer(a,b,!0),this._update(),this},removeLayer:function(a){var b=L.Util.stamp(a);return delete this._layers[b],this._update(),this},_initLayout:function(){this._container=L.DomUtil.create("div","leaflet-control-layers"),L.Browser.touch||L.DomEvent.disableClickPropagation(this._container),this._form=L.DomUtil.create("form","leaflet-control-layers-list");if(this.options.collapsed){L.DomEvent.addListener(this._container,"mouseover",this._expand,this),L.DomEvent.addListener(this._container,"mouseout",this._collapse,this);var a=this._layersLink=L.DomUtil.create("a","leaflet-control-layers-toggle");a.href="#",a.title="Layers",L.Browser.touch?L.DomEvent.addListener(a,"click",this._expand,this):L.DomEvent.addListener(a,"focus",this._expand,this),this._map.on("movestart",this._collapse,this),this._container.appendChild(a)}else this._expand();this._baseLayersList=L.DomUtil.create("div","leaflet-control-layers-base",this._form),this._separator=L.DomUtil.create("div","leaflet-control-layers-separator",this._form),this._overlaysList=L.DomUtil.create("div","leaflet-control-layers-overlays",this._form),this._container.appendChild(this._form)},_addLayer:function(a,b,c){var d=L.Util.stamp(a);this._layers[d]={layer:a,name:b,overlay:c}},_update:function(){if(!this._container)return;this._baseLayersList.innerHTML="",this._overlaysList.innerHTML="";var a=!1,b=!1;for(var c in this._layers)if(this._layers.hasOwnProperty(c)){var d=this._layers[c];this._addItem(d),b=b||d.overlay,a=a||!d.overlay}this._separator.style.display=b&&a?"":"none"},_addItem:function(a,b){var c=document.createElement("label"),d=document.createElement("input");a.overlay||(d.name="leaflet-base-layers"),d.type=a.overlay?"checkbox":"radio",d.checked=this._map.hasLayer(a.layer),d.layerId=L.Util.stamp(a.layer),L.DomEvent.addListener(d,"click",this._onInputClick,this);var e=document.createTextNode(" "+a.name);c.appendChild(d),c.appendChild(e);var f=a.overlay?this._overlaysList:this._baseLayersList;f.appendChild(c)},_onInputClick:function(){var a,b,c,d=this._form.getElementsByTagName("input"),e=d.length;for(a=0;aKIT - Geocoder by OSM", +//config +"GUI_CONFIGURATION": "Einstellungen", +"GUI_LANGUAGE": "Sprache", +"GUI_UNITS": "Einheiten", +"GUI_KILOMETERS": "Kilometer", +"GUI_MILES": "Meilen", +"GUI_DATA_TIMESTAMP": "data", +// mapping +"GUI_MAPPING_TOOLS": "Kartenwerkzeuge", +"GUI_HIGHLIGHT_UNNAMED_ROADS": "Unbenannte Straßen hervorheben", +"GUI_SHOW_PREVIOUS_ROUTES": "Frühere Routen zeigen", +"OPEN_JOSM": "JOSM", +"OPEN_OSMBUGS": "OSM Bugs", // geocoder "SEARCH_RESULTS": "Suchergebnisse", "FOUND_X_RESULTS": "%i Ergebnisse gefunden", @@ -52,6 +63,7 @@ OSRM.Localization["de"] = { "NO_ROUTE_FOUND": "Keine Route hierher möglich", // printing "OVERVIEW_MAP": "Übersichtskarte", +"NO_ROUTE_SELECTED": "Keine Route ausgewählt", // directions "N": "Norden", "E": "Ost", diff --git a/WebContent/localization/OSRM.Locale.dk.js b/WebContent/localization/OSRM.Locale.dk.js index a1326bd27..91850e5b0 100644 --- a/WebContent/localization/OSRM.Locale.dk.js +++ b/WebContent/localization/OSRM.Locale.dk.js @@ -20,19 +20,30 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.Localization["dk"] = { +// own language +"LANGUAGE": "Dansk", //gui -"OPEN_JOSM": "JOSM", -"OPEN_OSMBUGS": "OSM Fejl", "GUI_START": "Start", "GUI_END": "Destination", -"GUI_RESET": "  Nulstil  ", -"GUI_SEARCH": "  Vis  ", +"GUI_RESET": "Nulstil", +"GUI_SEARCH": "Vis", "GUI_REVERSE": "Omvendt", -"GUI_OPTIONS": "Kortlægnings værktøjer", -"GUI_HIGHLIGHT_UNNAMED_ROADS": "Fremhæv unavngivne veje", "GUI_START_TOOLTIP": "Indtast start", "GUI_END_TOOLTIP": "Indtast destination", "GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting af KIT - Geocoder af OSM", +//config +"GUI_CONFIGURATION": "Konfiguration", +"GUI_LANGUAGE": "Sprog", +"GUI_UNITS": "Enheder", +"GUI_KILOMETERS": "Kilometer", +"GUI_MILES": "Miles", +"GUI_DATA_TIMESTAMP": "data", +// mapping +"GUI_MAPPING_TOOLS": "Kortlægnings værktøjer", +"GUI_HIGHLIGHT_UNNAMED_ROADS": "Fremhæv unavngivne veje", +"GUI_SHOW_PREVIOUS_ROUTES": "Vis tidligere ruter", +"OPEN_JOSM": "JOSM", +"OPEN_OSMBUGS": "OSM Bugs", // geocoder "SEARCH_RESULTS": "Søgeresultater", "FOUND_X_RESULTS": "fandt %i resultater", diff --git a/WebContent/localization/OSRM.Locale.en.js b/WebContent/localization/OSRM.Locale.en.js index 1210ce2e7..f4ab40d28 100644 --- a/WebContent/localization/OSRM.Locale.en.js +++ b/WebContent/localization/OSRM.Locale.en.js @@ -20,19 +20,30 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.Localization["en"] = { -//gui -"OPEN_JOSM": "JOSM", -"OPEN_OSMBUGS": "OSM Bugs", +// own language +"LANGUAGE": "English", +// gui "GUI_START": "Start", "GUI_END": "End", "GUI_RESET": "  Reset  ", "GUI_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 KIT - Geocoder by OSM", +// config +"GUI_CONFIGURATION": "Configuration", +"GUI_LANGUAGE": "Language", +"GUI_UNITS": "Units", +"GUI_KILOMETERS": "Kilometers", +"GUI_MILES": "Miles", +"GUI_DATA_TIMESTAMP": "data", +// mapping +"GUI_MAPPING_TOOLS": "Mapping Tools", +"GUI_HIGHLIGHT_UNNAMED_ROADS": "Highlight unnamed streets", +"GUI_SHOW_PREVIOUS_ROUTES": "Show previous routes", +"OPEN_JOSM": "JOSM", +"OPEN_OSMBUGS": "OSM Bugs", // geocoder "SEARCH_RESULTS": "Search Results", "FOUND_X_RESULTS": "found %i results", @@ -40,7 +51,7 @@ OSRM.Localization["en"] = { "NO_RESULTS_FOUND": "No results found", "NO_RESULTS_FOUND_SOURCE": "No results found for start", "NO_RESULTS_FOUND_TARGET": "No results found for end", -//routing +// routing "ROUTE_DESCRIPTION": "Route Description", "GET_LINK_TO_ROUTE": "Generate Link", "GENERATE_LINK_TO_ROUTE": "waiting for link", @@ -50,8 +61,9 @@ OSRM.Localization["en"] = { "DURATION": "Duration", "YOUR_ROUTE_IS_BEING_COMPUTED": "Your route is being computed", "NO_ROUTE_FOUND": "No route possible", -//printing +// printing "OVERVIEW_MAP": "Overview Map", +"NO_ROUTE_SELECTED": "No route selected", // directions "N": "north", "E": "east", @@ -88,6 +100,6 @@ OSRM.Localization["en"] = { "DIRECTION_15":"You have reached your destination" }; -//set GUI language on load +// set GUI language on load if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true ) OSRM.Localization.setLanguage("en"); diff --git a/WebContent/localization/OSRM.Locale.fi.js b/WebContent/localization/OSRM.Locale.fi.js index a650fadab..bebfe5325 100644 --- a/WebContent/localization/OSRM.Locale.fi.js +++ b/WebContent/localization/OSRM.Locale.fi.js @@ -20,19 +20,30 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.Localization["fi"] = { +// own language +"LANGUAGE": "Suomi", //gui -"OPEN_JOSM": "JOSM", -"OPEN_OSMBUGS": "OSM Bugs", "GUI_START": "Lähtöpaikka", "GUI_END": "Määränpää", -"GUI_RESET": "  Tyhjennä  ", -"GUI_SEARCH": "  Etsi  ", +"GUI_RESET": "Tyhjennä", +"GUI_SEARCH": "Etsi", "GUI_REVERSE": "Käänteinen reitti", -"GUI_OPTIONS": "Kartoitustyökalut", -"GUI_HIGHLIGHT_UNNAMED_ROADS": "Korosta nimettömät tiet", "GUI_START_TOOLTIP": "Syötä lähtöpaikka", "GUI_END_TOOLTIP": "Syötä määränpää", "GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting by KIT - Geocoder by OSM", +//config +"GUI_CONFIGURATION": "Kokoonpano", +"GUI_LANGUAGE": "Kieli", +"GUI_UNITS": "Yksiköt", +"GUI_KILOMETERS": "Kilometri", +"GUI_MILES": "Miles", +"GUI_DATA_TIMESTAMP": "data", +// mapping +"GUI_MAPPING_TOOLS": "Kartoitustyökalut", +"GUI_HIGHLIGHT_UNNAMED_ROADS": "Korosta nimettömät tiet", +"GUI_SHOW_PREVIOUS_ROUTES": "Näytä edelliset reitit", +"OPEN_JOSM": "JOSM", +"OPEN_OSMBUGS": "OSM Bugs", // geocoder "SEARCH_RESULTS": "Haun tulokset", "FOUND_X_RESULTS": "Löytyi %i vaihtoehtoa", @@ -52,6 +63,7 @@ OSRM.Localization["fi"] = { "NO_ROUTE_FOUND": "Reittiä ei löytynyt", //printing "OVERVIEW_MAP": "Yleiskuvakartta", +"NO_ROUTE_SELECTED": "Ei reitti valittu", // directions "N": "pohjoiseen", "E": "itään", diff --git a/WebContent/localization/OSRM.Locale.fr.js b/WebContent/localization/OSRM.Locale.fr.js index 3629455a2..ecc256f88 100644 --- a/WebContent/localization/OSRM.Locale.fr.js +++ b/WebContent/localization/OSRM.Locale.fr.js @@ -20,19 +20,30 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.Localization["fr"] = { +// own language +"LANGUAGE": "Français", //gui -"OPEN_JOSM": "JOSM", -"OPEN_OSMBUGS": "Bugs OSM", "GUI_START": "Départ", "GUI_END": "Arrivée", "GUI_RESET": "Réinitialiser", "GUI_SEARCH": "Montrer", "GUI_REVERSE": "Inverser", -"GUI_OPTIONS": "Outils de cartographie", -"GUI_HIGHLIGHT_UNNAMED_ROADS": "Surligner les rues sans nom", "GUI_START_TOOLTIP": "Entrez le lieu de départ", "GUI_END_TOOLTIP": "Entrez le lieu d’arrivée", "GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - hébergement par KIT - géocodage par OSM", +//config +"GUI_CONFIGURATION": "Configuration", +"GUI_LANGUAGE": "Langue", +"GUI_UNITS": "Unités", +"GUI_KILOMETERS": "Kilomètres", +"GUI_MILES": "Miles", +"GUI_DATA_TIMESTAMP": "data", +// mapping +"GUI_MAPPING_TOOLS": "Outils de cartographie", +"GUI_HIGHLIGHT_UNNAMED_ROADS": "Surligner les rues sans nom", +"GUI_SHOW_PREVIOUS_ROUTES": "Afficher itinéraires précédents", +"OPEN_JOSM": "JOSM", +"OPEN_OSMBUGS": "OSM Bugs", // geocoder "SEARCH_RESULTS": "Résultats de recherche", "FOUND_X_RESULTS": "%i résultat(s)", @@ -51,7 +62,8 @@ OSRM.Localization["fr"] = { "YOUR_ROUTE_IS_BEING_COMPUTED": "Votre itinéraire est en cours de calcul", "NO_ROUTE_FOUND": "Pas d’itinéraire possible", //printing -"OVERVIEW_MAP": "Overview Map", +"OVERVIEW_MAP": "Carte", +"NO_ROUTE_SELECTED": "Pas d’itinéraire choisi", // directions "N": "nord", "E": "est", diff --git a/WebContent/localization/OSRM.Locale.it.js b/WebContent/localization/OSRM.Locale.it.js new file mode 100644 index 000000000..c8b6ad717 --- /dev/null +++ b/WebContent/localization/OSRM.Locale.it.js @@ -0,0 +1,104 @@ +/* +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU AFFERO General Public License as published by +the Free Software Foundation; either version 3 of the License, or +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +or see http://www.gnu.org/licenses/agpl.txt. +*/ + +// OSRM localization +// [Italian language support] + + +OSRM.Localization["it"] = { +// own language +"LANGUAGE": "Italiano", +//gui +"GUI_START": "Partenza", +"GUI_END": "Destinazione", +"GUI_RESET": "Reset", +"GUI_SEARCH": "Mostra", +"GUI_REVERSE": "Inverti", +"GUI_START_TOOLTIP": "Inserire la Partenza", +"GUI_END_TOOLTIP": "Inserire la destinazione", +"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting by KIT - Geocoder by OSM", +//config +"GUI_CONFIGURATION": "Configurazione", +"GUI_LANGUAGE": "Lingua", +"GUI_UNITS": "Unità", +"GUI_KILOMETERS": "Chilometri", +"GUI_MILES": "Miles", +"GUI_DATA_TIMESTAMP": "data", +// mapping +"GUI_MAPPING_TOOLS": "Strumenti per la Mappatura", +"GUI_HIGHLIGHT_UNNAMED_ROADS": "Evidenzia strade senza nome", +"GUI_SHOW_PREVIOUS_ROUTES": "Show previous routes", +"OPEN_JOSM": "JOSM", +"OPEN_OSMBUGS": "OSM Bugs", +// geocoder +"SEARCH_RESULTS": "Risultati della ricerca", +"FOUND_X_RESULTS": "trovati %i risultati", +"TIMED_OUT": "Timeout", +"NO_RESULTS_FOUND": "Nessun risultato trovato", +"NO_RESULTS_FOUND_SOURCE": "Nessun risultato trovato per la partenza", +"NO_RESULTS_FOUND_TARGET": "Nessun risultato trovato per la destinazione", +//routing +"ROUTE_DESCRIPTION": "Descrizione del percorso", +"GET_LINK_TO_ROUTE": "Genera un Link", +"GENERATE_LINK_TO_ROUTE": "in attesa del link", +"LINK_TO_ROUTE_TIMEOUT": "non disponibile", +"GPX_FILE": "File GPX", +"DISTANCE": "Distanza", +"DURATION": "Durata", +"YOUR_ROUTE_IS_BEING_COMPUTED": "Sto calcolando il tuo percorso", +"NO_ROUTE_FOUND": "Nessun percorso possibile", +//printing +"OVERVIEW_MAP": "Mappa d'insieme", +// directions +"N": "nord", +"E": "est", +"S": "sud", +"W": "ovest", +"NE": "nordest", +"SE": "sudest", +"SW": "sudovest", +"NW": "nordovest", +// driving directions +// %s: road name +// %d: direction +// [*]: will only be printed when there actually is a road name +"DIRECTION_0":"Istruzione sconosciuta[ su %s]", +"DIRECTION_1":"Continuare[ su %s]", +"DIRECTION_2":"Girare leggermente a destra[ su %s]", +"DIRECTION_3":"Girare a destra[ su %s]", +"DIRECTION_4":"Girare decisamente a destra[ su %s]", +"DIRECTION_5":"Compire una inversione ad U[ su %s]", +"DIRECTION_6":"Girare leggermente a sinistra[ su %s]", +"DIRECTION_7":"Girare a sinistra[ su %s]", +"DIRECTION_8":"Girare decisamente a sinistra[ su %s]", +"DIRECTION_10":"Dirigersi a %d[ su %s]", +"DIRECTION_11-1":"Immettersi nella rotonda ed abbandonarla alla prima uscita[ su %s]", +"DIRECTION_11-2":"Immettersi nella rotonda ed abbandonarla alla seconda uscita[ su %s]", +"DIRECTION_11-3":"Immettersi nella rotonda ed abbandonarla alla terza uscita[ su %s]", +"DIRECTION_11-4":"Immettersi nella rotonda ed abbandonarla alla quarta uscita[ su %s]", +"DIRECTION_11-5":"Immettersi nella rotonda ed abbandonarla alla quinta uscita[ su %s]", +"DIRECTION_11-6":"Immettersi nella rotonda ed abbandonarla alla sesta uscita[ su %s]", +"DIRECTION_11-7":"Immettersi nella rotonda ed abbandonarla alla settima uscita[ su %s]", +"DIRECTION_11-8":"Immettersi nella rotonda ed abbandonarla alla ottava uscita[ su %s]", +"DIRECTION_11-9":"Immettersi nella rotonda ed abbandonarla alla nona uscita[ su %s]", +"DIRECTION_11-x":"Immettersi nella rotonda ed abbandonarla ad una delle tante uscite[ su %s]", +"DIRECTION_15":"Hai raggiunto la tua destinazione" +}; + +//set GUI language on load +if( OSRM.DEFAULTS.LANUGAGE_ONDEMAND_RELOADING == true ) + OSRM.Localization.setLanguage("it"); diff --git a/WebContent/localization/OSRM.Locale.pl.js b/WebContent/localization/OSRM.Locale.pl.js index 0cb435122..3e6463778 100644 --- a/WebContent/localization/OSRM.Locale.pl.js +++ b/WebContent/localization/OSRM.Locale.pl.js @@ -20,19 +20,30 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.Localization["pl"] = { +// own language +"LANGUAGE": "Polski", //gui -"OPEN_JOSM": "JOSM", -"OPEN_OSMBUGS": "OSM Bugs", "GUI_START": "PoczÄ…tek", "GUI_END": "Koniec", -"GUI_RESET": "  Reset  ", -"GUI_SEARCH": "  Pokaż  ", +"GUI_RESET": "Reset", +"GUI_SEARCH": "Pokaż", "GUI_REVERSE": "Odwróć", -"GUI_OPTIONS": "NarzÄ™dzia", -"GUI_HIGHLIGHT_UNNAMED_ROADS": "Zaznacz ulice bez nazwy", "GUI_START_TOOLTIP": "Wprowadź poczÄ…tek", "GUI_END_TOOLTIP": "Wprowadź koniec", "GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting: KIT - Geocoder: OSM", +//config +"GUI_CONFIGURATION": "Konfiguracja", +"GUI_LANGUAGE": "JÄ™zyk", +"GUI_UNITS": "Jednostki", +"GUI_KILOMETERS": "Kilometrów", +"GUI_MILES": "Miles", +"GUI_DATA_TIMESTAMP": "data", +// mapping +"GUI_MAPPING_TOOLS": "NarzÄ™dzia mapowania", +"GUI_HIGHLIGHT_UNNAMED_ROADS": "Zaznacz ulice bez nazwy", +"GUI_SHOW_PREVIOUS_ROUTES": "Pokaż poprzednie trasy", +"OPEN_JOSM": "JOSM", +"OPEN_OSMBUGS": "OSM Bugs", // geocoder "SEARCH_RESULTS": "Wyniki wyszukiwania", "FOUND_X_RESULTS": "znaleziono %i wyników", @@ -66,7 +77,7 @@ OSRM.Localization["pl"] = { // %d: direction // [*]: will only be printed when there actually is a road name "DIRECTION_0":"Nieznana instrukcja[ na %s]", -"DIRECTION_1":"Podążaj[ drogÄ… %s]", +"DIRECTION_1":"Kontynuuj[ drogÄ… %s]", "DIRECTION_2":"Skręć lekko w prawo[ na drogÄ™ %s]", "DIRECTION_3":"Skręć w prawo[ na drogÄ™ %s]", "DIRECTION_4":"Skręć ostro w prawo[ na drogÄ™ %s]", @@ -74,7 +85,7 @@ OSRM.Localization["pl"] = { "DIRECTION_6":"Skręć lekko w lewo[ na drogÄ™ %s]", "DIRECTION_7":"Skręć w lewo[ na drogÄ™ %s]", "DIRECTION_8":"Skręć ostro w lewo[ na drogÄ™ %s]", -"DIRECTION_10":"Podążaj %d[ drogÄ… %s]", +"DIRECTION_10":"Podążaj na %d[ drogÄ… %s]", "DIRECTION_11-1":"Wjedź na rondo, zjedź pierwszym zjazdem[ na drogÄ™ %s]", "DIRECTION_11-2":"Wjedź na rondo, zjedź drugim zjazdem[ na drogÄ™ %s]", "DIRECTION_11-3":"Wjedź na rondo, zjedź trzecim zjazdem[ na drogÄ™ %s]", diff --git a/WebContent/localization/OSRM.Localization.js b/WebContent/localization/OSRM.Localization.js index dad3ec19e..25bc56901 100644 --- a/WebContent/localization/OSRM.Localization.js +++ b/WebContent/localization/OSRM.Localization.js @@ -21,57 +21,45 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.Localization = { +// default directory for localization files +DIRECTORY: "localization/", + +// holds currently active language current_language: OSRM.DEFAULTS.LANGUAGE, - -// initialize localization + +//initialize localization init: function() { - // create dropdown menu - var select = document.createElement('select'); - select.id = "gui-language-toggle"; - select.className = "top-left-button"; - select.onchange = function() { OSRM.Localization.setLanguage(this.value); }; - - // fill dropdown menu + // fill option list and find default entry + var options = []; + var options_2 = []; + var selected = 0; var supported_languages = OSRM.DEFAULTS.LANGUAGE_SUPPORTED; for(var i=0, size=supported_languages.length; i workaround for invisible scrollbars in Chrome */ +#information-box::-webkit-scrollbar { + height: 10px; + width: 10px; +} +#information-box::-webkit-scrollbar-track { + background: #FFFFFF; +} +#information-box::-webkit-scrollbar-thumb { + min-height: 30px; + background: #EEEEEE; + border: 1px solid #999999; + -webkit-border-radius: 5ex; +} +#information-box::-webkit-scrollbar-thumb:hover { + background: #F9F9F9; +} +#information-box::-webkit-scrollbar-thumb:active { + background: #F4F4F4; +} + + +/* style for main-output information-box -> table (general) */ .no-results { text-align:center; @@ -277,7 +310,7 @@ html, body { } -/* style for information-box table (search results) */ +/* style for main-output information-box -> table (search results) */ .results { border-spacing:0px; @@ -316,7 +349,7 @@ html, body { } -/* style for information-box table (driving directions) */ +/* style for main-output information-box -> table (driving directions) */ .description { border-spacing:0px; @@ -365,6 +398,98 @@ html, body { color:#ff0000 } +/* ------------------------------------------------------------------------ */ + +/* styles for other gui boxes */ +#mapping-wrapper +{ + width:410px; + height:100px; + bottom:25px; + right:5px; +} +#mapping-content +{ + width:390px; + height:80px; +} +#config-wrapper +{ + width:410px; + height:100px; + bottom:25px; + right:5px; +} +#config-content +{ + width:390px; + height:80px; +} +#notification-wrapper +{ + width:600px; + height:170px; + top: 50%; + left: 50%; + margin-top:-85px; + margin-left:-300px; +} +#notification-content +{ + width:580px; + height:150px; +} +#notification-blanket +{ + position:absolute; + top:0px; + left:0px; + width:100%; + height:100%; + background-color:rgba(0, 0, 0, 0.25); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3f000000, endColorstr=#3f000000); + z-index:100; + display:none; +} + + +/* styles for content of other gui boxes */ +#gui-language-2-toggle +{ + position:relative; +} +#gui-units-toggle +{ + position:relative; +} +.box-label +{ + font-weight:bold; + margin-bottom:10px; +} +.config-label +{ + margin: 0px 0px 0px 5px; +} +.config-select +{ + width:100px; +} +.mapping-checkbox +{ + margin: 0px 5px 3px 5px; + padding: 0px; +} +.mapping-button +{ + float: right; +} +#notification-box +{ + margin:5px 5px 5px 5px; +} + +/* ------------------------------------------------------------------------ */ /* buttons */ .button @@ -404,88 +529,45 @@ html, body { background-position:center; } -#gui-toggle-out -{ - background-image:url("images/cancel.png"); -} -#gui-toggle-out:hover -{ - background-image:url("images/cancel_hover.png"); -} -#gui-toggle-out:active -{ - background-image:url("images/cancel_active.png"); -} - -#gui-toggle-in -{ - background-image:url("images/restore.png"); -} -#gui-toggle-in:hover -{ - background-image:url("images/restore_hover.png"); -} -#gui-toggle-in:active -{ - background-image:url("images/restore_active.png"); -} - -#gui-printer -{ - background-image:url("images/printer.png"); -} #gui-printer-inactive { cursor:default; - background-image:url("images/printer_inactive.png"); -} -#gui-printer:hover -{ - background-image:url("images/printer_hover.png"); -} -#gui-printer:active -{ - background-image:url("images/printer_active.png"); -} - -.delete-marker -{ - background-image:url("images/cancel.png"); -} -.delete-marker:hover -{ - background-image:url("images/cancel_hover.png"); -} -.delete-marker:active -{ - background-image:url("images/cancel_active.png"); } -/* fonts */ -.base-font { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 12px; - font-weight: normal; +/* styled select */ +.styled-select-helper +{ + border: 0px; + text-decoration:none; + opacity: 0; + filter: alpha(opacity=0); + z-index: 5; + cursor:pointer; } -.big-font { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 14px; - font-weight: bold; -} -.medium-font { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 10.5px; - font-weight: normal; -} -.small-font { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 9px; - font-weight: normal; +.styled-select +{ + position:absolute; + background-repeat:no-repeat; + background-position: top right; + padding: 1px 1px 1px 1px; + overflow: hidden; } -/* utility styles (defined above buttons, so that buttons retain cursor:pointer)*/ +/* checkboxes */ +input[type=checkbox], +{ + cursor:pointer; +} +.checkbox-label +{ + vertical-align:2px; +} + +/* ------------------------------------------------------------------------ */ + +/* utility styles */ .quad { min-width:10px; @@ -500,7 +582,6 @@ html, body { -ms-user-select: none; user-select: none; } - .text-selectable { cursor:default; @@ -510,11 +591,9 @@ html, body { user-select: text; } -.checkbox-label -{ - vertical-align:2px; -} +/* ------------------------------------------------------------------------ */ +/* table styles */ .full { display:table; @@ -545,4 +624,32 @@ html, body { .stretch { width:100%; +} +.fixed +{ + min-width:100px; +} + +/* ------------------------------------------------------------------------ */ + +/* fonts */ +.base-font { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 12px; + font-weight: normal; +} +.big-font { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 14px; + font-weight: bold; +} +.medium-font { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 10.5px; + font-weight: normal; +} +.small-font { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 9px; + font-weight: normal; } \ No newline at end of file diff --git a/WebContent/main.html b/WebContent/main.html index 8d6c75edc..e913562f7 100644 --- a/WebContent/main.html +++ b/WebContent/main.html @@ -41,6 +41,7 @@ or see http://www.gnu.org/licenses/agpl.txt. + @@ -57,7 +58,11 @@ or see http://www.gnu.org/licenses/agpl.txt. + + + + @@ -67,6 +72,7 @@ or see http://www.gnu.org/licenses/agpl.txt. + @@ -77,24 +83,82 @@ or see http://www.gnu.org/licenses/agpl.txt. - +
- -
-
-
+ +
+
+
+ +
+
Notification
+ + +
+
- -
+ +
+
+ +
+
Configuraion
+ + +
+
+
Language:
+
+
+
+
Units:
+
+
+
+ + +
+
+
data: n/a
+
+
+
+
+ + +
+
+ +
+
Mapping Tools
+ + +
+
+
+
Highlight unnamed streets
+
+
+
+
Show previous routes
+
+
+ OSM BugsJOSM +
+
+ + +
-
+
-
+ +
@@ -105,13 +169,13 @@ or see http://www.gnu.org/licenses/agpl.txt.
Start:
-
+
End:
-
+
@@ -124,31 +188,10 @@ or see http://www.gnu.org/licenses/agpl.txt.
- -
- - -
- - - Mapping Tools - - -
-
- - Highlight unnamed streets -
-
- JOSM - OSM Bugs -
-
-
-
+
diff --git a/WebContent/main.js b/WebContent/main.js index 313c5a39e..94f69826d 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -23,12 +23,17 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.init = function() { OSRM.prefetchImages(); OSRM.prefetchIcons(); + OSRM.prefetchCSSIcons(); - OSRM.Localization.init(); OSRM.GUI.init(); OSRM.Map.init(); OSRM.Printing.init(); OSRM.Routing.init(); + OSRM.Localization.init(); + + // stop if in maintenance mode + if( OSRM.inMaintenance() == true ) + return; // check if the URL contains some GET parameter, e.g. for showing a route OSRM.parseParameters(); @@ -42,7 +47,7 @@ OSRM.init = function() { // prefetch images OSRM.GLOBALS.images = {}; OSRM.prefetchImages = function() { - var image_list = [ {id:'marker-shadow', url:L.RELATIVE_ROOT_URL + 'images/marker-shadow.png'}, + var image_list = [ {id:'marker-shadow', url:'leaflet/images/marker-shadow.png'}, {id:'marker-source', url:'images/marker-source.png'}, {id:'marker-target', url:'images/marker-target.png'}, {id:'marker-via', url:'images/marker-via.png'}, @@ -58,6 +63,12 @@ OSRM.prefetchImages = function() { {id:'restore', url:'images/restore.png'}, {id:'restore_active', url:'images/restore_active.png'}, {id:'restore_hover', url:'images/restore_hover.png'}, + {id:'config', url:'images/config.png'}, + {id:'config_active', url:'images/config_active.png'}, + {id:'config_hover', url:'images/config_hover.png'}, + {id:'mapping', url:'images/mapping.png'}, + {id:'mapping_active', url:'images/mapping_active.png'}, + {id:'mapping_hover', url:'images/mapping_hover.png'}, {id:'printer', url:'images/printer.png'}, {id:'printer_active', url:'images/printer_active.png'}, {id:'printer_hover', url:'images/printer_hover.png'}, @@ -73,7 +84,9 @@ OSRM.prefetchImages = function() { {id:'direction_8', url:'images/sharp-left.png'}, {id:'direction_10', url:'images/head.png'}, {id:'direction_11', url:'images/round-about.png'}, - {id:'direction_15', url:'images/target.png'} + {id:'direction_15', url:'images/target.png'}, + {id:'osrm-logo', url:'images/osrm-logo.png'}, + {id:'selector', url:'images/selector.png'} ]; for(var i=0; i' + + + '' + + '' + + + '' + + + '' + + + '' + + '
' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
' + OSRM.loc("GUI_START")+ ': ' + document.getElementById("gui-input-source").value + '
' + OSRM.loc("GUI_END")+ ': ' + document.getElementById("gui-input-target").value + '
' + + '
' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
' + OSRM.loc("DISTANCE")+': ' + OSRM.Utils.toHumanDistance(response.route_summary.total_distance) + '
' + OSRM.loc("DURATION")+': ' + OSRM.Utils.toHumanTime(response.route_summary.total_time) + '
' + + '
' + + + '
' + + ''; + } else { + header = '' + '
' + @@ -75,11 +125,11 @@ show: function(response) { '
' + '
' + '
' + OSRM.loc("DISTANCE")+':
' + - '
' + OSRM.Utils.metersToDistance(response.route_summary.total_distance) + '
' + + '
' + OSRM.Utils.toHumanDistance(response.route_summary.total_distance) + '
' + '
' + '
' + '
' + OSRM.loc("DURATION")+':
' + - '
' + OSRM.Utils.secondsToTime(response.route_summary.total_time) + '
' + + '
' + OSRM.Utils.toHumanTime(response.route_summary.total_time) + '
' + '
' + '
' + '
' + @@ -88,7 +138,8 @@ show: function(response) { '
' + '
' + - ''; + ''; + } // create route description var body = ''; @@ -100,7 +151,7 @@ show: function(response) { body += ''; body += ''; - body += ''; + body += ''; body += ""; // build route description @@ -112,8 +163,7 @@ show: function(response) { body += ""; body += ''; - if( i != response.route_instructions.length-1 ) - body += ''+OSRM.Utils.metersToDistance(response.route_instructions[i][2])+''; + body += (i == response.route_instructions.length-1) ? ' ' : ''+OSRM.Utils.toHumanDistance(response.route_instructions[i][2])+''; // fill last entry with a space body += ""; body += ""; @@ -128,28 +178,29 @@ show: function(response) { // draw map var positions = OSRM.G.route.getPositions(); var tile_server_id = OSRM.G.map.getActiveLayerId(); - var zoom = print_window.drawMap( OSRM.DEFAULTS.TILE_SERVERS[tile_server_id], new L.LatLngBounds( positions ) ); + var zoom = print_window.OSRM.drawMap( OSRM.DEFAULTS.TILE_SERVERS[tile_server_id], new L.LatLngBounds( positions ) ); // draw markers - print_window.prefetchIcons( OSRM.G.images ); - print_window.drawMarkers( OSRM.G.markers.route ); + print_window.OSRM.prefetchIcons( OSRM.G.images ); + print_window.OSRM.drawMarkers( OSRM.G.markers.route ); - // draw route & query for better geometry - print_window.drawRoute( positions ); + // draw route & query for better geometry + print_window.OSRM.drawRoute( positions ); OSRM.JSONP.call(OSRM.Routing._buildCall()+'&z='+zoom+'&instructions=false', OSRM.Printing.drawRoute, OSRM.Printing.timeoutRoute, OSRM.DEFAULTS.JSONP_TIMEOUT, 'print'); + // NOTE: simply appended correct zoom level as second zoom parameter to JSONP call -> OSRM API only considers the last one! }, timeoutRoute: function() {}, drawRoute: function(response) { if(!response) return; var positions = OSRM.RoutingGeometry._decode(response.route_geometry, 5); - OSRM.G.printwindow.drawRoute( positions ); + OSRM.G.printwindow.OSRM.drawRoute( positions ); }, // opens the print window and closes old instances openPrintWindow: function() { - // do not open window if there is no route to draw + // do not open window if there is no route to draw (should never trigger!) if( !OSRM.G.route.isRoute() || !OSRM.G.route.isShown() ) return; @@ -158,7 +209,7 @@ openPrintWindow: function() { OSRM.G.printwindow.close(); // generate a new window and wait till it has finished loading - OSRM.G.printwindow = window.open("printing/printing.html","","width=540,height=500,left=100,top=100,dependent=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes"); + OSRM.G.printwindow = window.open( OSRM.Printing.DIRECTORY + "printing.html","","width=540,height=500,left=100,top=100,dependent=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes"); }, @@ -167,16 +218,34 @@ printWindowLoaded: function(){ var print_window = OSRM.G.printwindow; var print_document = print_window.document; - // add events - print_document.getElementById('gui-printer').onclick = print_window.printWindow; + // add css images + var css_list = [ + { id:'#gui-printer-inactive', image_id:'printer_inactive'}, + { id:'#gui-printer', image_id:'printer'}, + { id:'#gui-printer:hover', image_id:'printer_hover'}, + { id:'#gui-printer:active', image_id:'printer_active'} + ]; + var stylesheet = OSRM.CSS.getStylesheet("printing.css", print_document); + for(var i=0; iOSRM Website + @@ -40,27 +41,28 @@ or see http://www.gnu.org/licenses/agpl.txt. + - +
-
+
-
Route Description
+
-
+
 
-
Overview Map
+
diff --git a/WebContent/printing/printing.js b/WebContent/printing/printing.js index 2cd947367..93d549a30 100644 --- a/WebContent/printing/printing.js +++ b/WebContent/printing/printing.js @@ -19,8 +19,8 @@ or see http://www.gnu.org/licenses/agpl.txt. // [for printing window] OSRM = {}; -OSRM.GLOBALS = {}; -OSRM.GUI = { visible:false }; +OSRM.GLOBALS = { main_handle:{boxVisible:function(){return false;}} }; // needed for fitBoundsUI to work +OSRM.Localization = { current_language:"en"}; // needed for localized map tiles OSRM.G = OSRM.GLOBALS; @@ -32,7 +32,7 @@ function printWindow() { //prefetch icons OSRM.GLOBALS.icons = {}; -prefetchIcons = function(images_list) { +OSRM.prefetchIcons = function(images_list) { var icon_list = [ {id:'marker-source', image_id:'marker-source'}, {id:'marker-target', image_id:'marker-target'}, {id:'marker-via', image_id:'marker-via'}, @@ -41,8 +41,9 @@ prefetchIcons = function(images_list) { for(var i=0; i'+response[OSRM.DEFAULTS.SHORTENER_REPLY_PARAMETER]+']'; + document.getElementById('route-link').innerHTML = '['+response[OSRM.DEFAULTS.SHORTENER_REPLY_PARAMETER]+']'; }, showRouteLink_TimeOut: function(){ document.getElementById('route-link').innerHTML = '['+OSRM.loc("LINK_TO_ROUTE_TIMEOUT")+']'; @@ -64,8 +63,8 @@ show: function(response) { var gpx_link = '['+OSRM.loc("GPX_FILE")+']'; // create route description + var positions = OSRM.G.route.getPositions(); var body = ""; - body += ''; for(var i=0; i < response.route_instructions.length; i++){ //odd or even ? @@ -79,7 +78,8 @@ show: function(response) { body += ''; body += '"; body += ""; @@ -100,7 +100,7 @@ show: function(response) { body += '
'; - body += '
'; + var pos = positions[response.route_instructions[i][3]]; + body += '
'; // build route description if( response.route_instructions[i][1] != "" ) @@ -92,7 +92,7 @@ show: function(response) { body += '
'; if( i != response.route_instructions.length-1 ) - body += ''+OSRM.Utils.metersToDistance(response.route_instructions[i][2])+''; + body += ''+OSRM.Utils.toHumanDistance(response.route_instructions[i][2])+''; body += "
'; // build header - header = OSRM.RoutingDescription._buildHeader(OSRM.Utils.metersToDistance(response.route_summary.total_distance), OSRM.Utils.secondsToTime(response.route_summary.total_time), route_link, gpx_link); + header = OSRM.RoutingDescription._buildHeader(OSRM.Utils.toHumanDistance(response.route_summary.total_distance), OSRM.Utils.toHumanTime(response.route_summary.total_time), route_link, gpx_link); // update DOM document.getElementById('information-box-header').innerHTML = header; @@ -110,7 +110,7 @@ show: function(response) { // simple description showSimple: function(response) { // build header - header = OSRM.RoutingDescription._buildHeader(OSRM.Utils.metersToDistance(response.route_summary.total_distance), OSRM.Utils.secondsToTime(response.route_summary.total_time), "", ""); + header = OSRM.RoutingDescription._buildHeader(OSRM.Utils.toHumanDistance(response.route_summary.total_distance), OSRM.Utils.toHumanTime(response.route_summary.total_time), "", ""); // update DOM document.getElementById('information-box-header').innerHTML = header; diff --git a/WebContent/utils/OSRM.CSS.js b/WebContent/utils/OSRM.CSS.js new file mode 100644 index 000000000..03aa1d2f6 --- /dev/null +++ b/WebContent/utils/OSRM.CSS.js @@ -0,0 +1,39 @@ +/* +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU AFFERO General Public License as published by +the Free Software Foundation; either version 3 of the License, or +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +or see http://www.gnu.org/licenses/agpl.txt. +*/ + +// OSRM CSS manipulator +// [edit css styles] + +OSRM.CSS = { + getStylesheet: function(filename, the_document) { + the_document = the_document || document; + var stylesheets = the_document.styleSheets; + for(var i=0, size=stylesheets.length; i= 0) + return stylesheets[i]; + } + return null; + }, + + insert: function(stylesheet, selector, rule) { + if( stylesheet.addRule ){ + stylesheet.addRule(selector, rule); + } else if( stylesheet.insertRule ){ + stylesheet.insertRule(selector + ' { ' + rule + ' }', stylesheet.cssRules.length); + } + } +}; \ No newline at end of file diff --git a/WebContent/utils/OSRM.Utils.js b/WebContent/utils/OSRM.Utils.js index 9c4decdc7..ea544ed8e 100644 --- a/WebContent/utils/OSRM.Utils.js +++ b/WebContent/utils/OSRM.Utils.js @@ -24,28 +24,46 @@ OSRM.Utils = { // [human readabilty functions] // human readable time -secondsToTime: function(seconds){ +toHumanTime: function(seconds){ seconds = parseInt(seconds); minutes = parseInt(seconds/60); seconds = seconds%60; hours = parseInt(minutes/60); minutes = minutes%60; if(hours==0){ - return minutes + ' ' + 'min'; + return minutes + ' ' + 'min'; } else{ - return hours + ' ' + 'h' + ' ' + minutes + ' ' + 'min'; + return hours + ' ' + 'h' + ' ' + minutes + ' ' + 'min'; } }, //human readable distance -metersToDistance: function(distance){ - distance = parseInt(distance); - - if(distance >= 100000){ return (parseInt(distance/1000))+' ' + 'km'; } - else if(distance >= 10000){ return (parseInt(distance/1000).toFixed(1))+' ' + 'km'; } - else if(distance >= 1000){ return (parseFloat(distance/1000).toFixed(2))+' ' + 'km'; } - else{ return distance+' ' + 'm'; } +setToHumanDistanceFunction: function(type) { + OSRM.G.DISTANCE_FORMAT = type; + if( type == 1 ) + OSRM.Utils.toHumanDistance = OSRM.Utils.toHumanDistanceMiles; + else + OSRM.Utils.toHumanDistance = OSRM.Utils.toHumanDistanceMeters; }, +toHumanDistanceMeters: function(meters){ + var distance = parseInt(meters); + + distance = distance / 1000; + if(distance >= 100){ return (distance).toFixed(0)+' ' + 'km'; } + else if(distance >= 10){ return (distance).toFixed(1)+' ' + 'km'; } + else if(distance >= 0.1){ return (distance).toFixed(2)+' ' + 'km'; } + else{ return (distance*1000).toFixed(0)+' ' + 'm'; } +}, +toHumanDistanceMiles: function(meters){ + var distance = parseInt(meters); + + distance = distance / 1609.344; + if(distance >= 100){ return (distance).toFixed(0)+' ' + 'mi'; } + else if(distance >= 10){ return (distance).toFixed(1)+' ' + 'mi'; } + else if(distance >= 0.1){ return (distance).toFixed(2)+' ' + 'mi'; } + else{ return (distance*5280).toFixed(0)+' ' + 'ft'; } +}, +toHumanDistance: null, // [verification routines] diff --git a/WebContent/utils/OSRM.browsers.js b/WebContent/utils/OSRM.browsers.js index 9d4d7ec8f..ffb9dbfee 100644 --- a/WebContent/utils/OSRM.browsers.js +++ b/WebContent/utils/OSRM.browsers.js @@ -25,6 +25,7 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.Browser = { FF3: useragent.search(/Firefox\/3/), + IE6_8: useragent.search(/MSIE (6|7|8)/), IE6_9: useragent.search(/MSIE (6|7|8|9)/) }; }()); @@ -67,4 +68,15 @@ OSRM.Browser.onLoadHandler = function( function_pointer, the_window ) { }; the_document.attachEvent("onreadystatechange", temp_function); } +}; +OSRM.Browser.onUnloadHandler = function( function_pointer, the_window ) { + the_window = the_window || window; // default document + var the_document = the_window.document; + + if(the_window.addEventListener) { // FF, CH, IE9+ + the_window.addEventListener("unload", function_pointer, false); + } + else if(the_document.attachEvent) { // IE8- + the_document.attachEvent("onunload", function_pointer); + } }; \ No newline at end of file diff --git a/WebContent/utils/OSRM.classes.js b/WebContent/utils/OSRM.classes.js index 4b21d653c..14c8e292a 100644 --- a/WebContent/utils/OSRM.classes.js +++ b/WebContent/utils/OSRM.classes.js @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or see http://www.gnu.org/licenses/agpl.txt. */ -// OSRM base class -// [support for inheritance] +// OSRM classes +// [support for inheritance and other function related functionality] // declare one class to be a subclass of another class // (runs anonymous function to prevent local functions cluttering global namespace) @@ -39,6 +39,23 @@ OSRM.extend = function( target_class, properties ) { }; +// bind a function to an execution context, i.e. an object (needed for correcting this pointers) +OSRM.bind = function( context, fct1 ) { + return function() { + fct1.apply(context, arguments); + }; +}; + + +// concatenate the execution of two functions with the same set of parameters +OSRM.concat = function( fct1, fct2 ) { + return function() { + fct1.apply(this,arguments); + fct2.apply(this,arguments); + }; +}; + + // [usage of convenience functions] // SubClass = function() { // SubClass.prototype.base.constructor.apply(this, arguments);