finished dragging of routes,
moved corrected bugs in Leaflet to their own file (drag after dragend, distance to path), open osmbugs in new window
This commit is contained in:
parent
5165e01a5c
commit
3b485f1426
80
WebContent/L.Bugfixes.js
Normal file
80
WebContent/L.Bugfixes.js
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU AFFERO General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
or see http://www.gnu.org/licenses/agpl.txt.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Leaflet bugfixes
|
||||||
|
// [assorted bugfixes to Leaflet functions we use]
|
||||||
|
|
||||||
|
|
||||||
|
// return closest point on segment or distance to that point
|
||||||
|
L.LineUtil._sqClosestPointOnSegment = function (p, p1, p2, sqDist) {
|
||||||
|
var x = p1.x,
|
||||||
|
y = p1.y,
|
||||||
|
dx = p2.x - x,
|
||||||
|
dy = p2.y - y,
|
||||||
|
dot = dx * dx + dy * dy,
|
||||||
|
t;
|
||||||
|
|
||||||
|
if (dot > 0) {
|
||||||
|
t = ((p.x - x) * dx + (p.y - y) * dy) / dot;
|
||||||
|
|
||||||
|
if (t > 1) {
|
||||||
|
x = p2.x;
|
||||||
|
y = p2.y;
|
||||||
|
} else if (t > 0) {
|
||||||
|
x += dx * t;
|
||||||
|
y += dy * t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dx = p.x - x;
|
||||||
|
dy = p.y - y;
|
||||||
|
|
||||||
|
// DS_CHANGE: modified return values
|
||||||
|
if(sqDist)
|
||||||
|
return dx*dx + dy*dy;
|
||||||
|
else {
|
||||||
|
var p = new L.Point(x,y);
|
||||||
|
p._sqDist = dx*dx + dy*dy;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// makes requestAnimFrame respect the immediate paramter -> prevents drag events after dragend events
|
||||||
|
// (alternatively: add if(!this.dragging ) return to L.Draggable._updatePosition, but must be done in leaflet.js!)
|
||||||
|
// [TODO: In Leaflet 0.4 use L.Util.cancelAnimFrame(this._animRequest) in L.Draggable._onUp() instead, also has to be done in leaflet.js!]
|
||||||
|
L.Util.requestAnimFrame = (function () {
|
||||||
|
function timeoutDefer(callback) {
|
||||||
|
window.setTimeout(callback, 1000 / 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
var requestFn = window.requestAnimationFrame ||
|
||||||
|
window.webkitRequestAnimationFrame ||
|
||||||
|
window.mozRequestAnimationFrame ||
|
||||||
|
window.oRequestAnimationFrame ||
|
||||||
|
window.msRequestAnimationFrame ||
|
||||||
|
timeoutDefer;
|
||||||
|
|
||||||
|
return function (callback, context, immediate, contextEl) {
|
||||||
|
callback = context ? L.Util.bind(callback, context) : callback;
|
||||||
|
if (immediate ) { // DS_CHANGE: removed additional condition requestFn === timeoutDefer
|
||||||
|
callback();
|
||||||
|
} else {
|
||||||
|
requestFn(callback, contextEl);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}());
|
@ -39,8 +39,8 @@ OSRM.loc = OSRM.Localization.translate;
|
|||||||
// German language support
|
// German language support
|
||||||
OSRM.Localization["de"] = {
|
OSRM.Localization["de"] = {
|
||||||
//gui
|
//gui
|
||||||
"OPEN_JOSM": "JOSM Öffnen",
|
"OPEN_JOSM": "JOSM",
|
||||||
"OPEN_OSMBUGS": "OSM Bugs Öffnen",
|
"OPEN_OSMBUGS": "OSM Bugs",
|
||||||
"GUI_START": "Start",
|
"GUI_START": "Start",
|
||||||
"GUI_END": "Ziel",
|
"GUI_END": "Ziel",
|
||||||
"GUI_RESET": "Reset",
|
"GUI_RESET": "Reset",
|
||||||
@ -82,8 +82,8 @@ OSRM.Localization["de"] = {
|
|||||||
// English language support
|
// English language support
|
||||||
OSRM.Localization["en"] = {
|
OSRM.Localization["en"] = {
|
||||||
//gui
|
//gui
|
||||||
"OPEN_JOSM": "Open JOSM",
|
"OPEN_JOSM": "JOSM",
|
||||||
"OPEN_OSMBUGS": "Open OSM Bugs",
|
"OPEN_OSMBUGS": "OSM Bugs",
|
||||||
"GUI_START": "Start",
|
"GUI_START": "Start",
|
||||||
"GUI_END": "End",
|
"GUI_END": "End",
|
||||||
"GUI_RESET": " Reset ",
|
"GUI_RESET": " Reset ",
|
||||||
|
@ -67,24 +67,6 @@ toString: function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// highlight marker class (cannot be dragged)
|
|
||||||
OSRM.HighlightMarker = function( label, style, position) {
|
|
||||||
OSRM.HighlightMarker.prototype.base.constructor.apply( this, arguments );
|
|
||||||
this.label = label ? label : "highlight_marker";
|
|
||||||
|
|
||||||
this.marker.on( 'click', this.onClick );
|
|
||||||
};
|
|
||||||
OSRM.inheritFrom( OSRM.HighlightMarker, OSRM.Marker );
|
|
||||||
OSRM.extend( OSRM.HighlightMarker, {
|
|
||||||
toString: function() {
|
|
||||||
return "OSRM.HighlightMarker: \""+this.label+"\", "+this.position+")";
|
|
||||||
},
|
|
||||||
onClick: function(e) {
|
|
||||||
this.parent.hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// route marker class (draggable, invokes route drawing routines)
|
// route marker class (draggable, invokes route drawing routines)
|
||||||
OSRM.RouteMarker = function ( label, style, position ) {
|
OSRM.RouteMarker = function ( label, style, position ) {
|
||||||
OSRM.RouteMarker.prototype.base.constructor.apply( this, arguments );
|
OSRM.RouteMarker.prototype.base.constructor.apply( this, arguments );
|
||||||
@ -94,8 +76,6 @@ OSRM.RouteMarker = function ( label, style, position ) {
|
|||||||
this.marker.on( 'drag', this.onDrag );
|
this.marker.on( 'drag', this.onDrag );
|
||||||
this.marker.on( 'dragstart', this.onDragStart );
|
this.marker.on( 'dragstart', this.onDragStart );
|
||||||
this.marker.on( 'dragend', this.onDragEnd );
|
this.marker.on( 'dragend', this.onDragEnd );
|
||||||
// this.marker.on( 'mouseover', this.onMouseOver );
|
|
||||||
// this.marker.on( 'mouseout', this.onMouseOut );
|
|
||||||
};
|
};
|
||||||
OSRM.inheritFrom( OSRM.RouteMarker, OSRM.Marker );
|
OSRM.inheritFrom( OSRM.RouteMarker, OSRM.Marker );
|
||||||
OSRM.extend( OSRM.RouteMarker, {
|
OSRM.extend( OSRM.RouteMarker, {
|
||||||
@ -126,7 +106,8 @@ onDragStart: function(e) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//OSRM.G.markers.highlight.hide();
|
if( this.parent != OSRM.G.markers.highlight)
|
||||||
|
OSRM.G.markers.highlight.hide();
|
||||||
if (OSRM.G.route.isShown())
|
if (OSRM.G.route.isShown())
|
||||||
OSRM.G.route.showOldRoute();
|
OSRM.G.route.showOldRoute();
|
||||||
},
|
},
|
||||||
@ -142,12 +123,6 @@ onDragEnd: function(e) {
|
|||||||
if(OSRM.G.route.isShown()==false)
|
if(OSRM.G.route.isShown()==false)
|
||||||
OSRM.Geocoder.updateAddress(this.parent.label);
|
OSRM.Geocoder.updateAddress(this.parent.label);
|
||||||
},
|
},
|
||||||
onMouseOver: function(e) {
|
|
||||||
OSRM.G.onmouse = true;
|
|
||||||
},
|
|
||||||
onMouseOut: function(e) {
|
|
||||||
OSRM.G.onmouse = false;
|
|
||||||
},
|
|
||||||
toString: function() {
|
toString: function() {
|
||||||
return "OSRM.RouteMarker: \""+this.label+"\", "+this.position+")";
|
return "OSRM.RouteMarker: \""+this.label+"\", "+this.position+")";
|
||||||
}
|
}
|
||||||
@ -171,11 +146,11 @@ onDragStart: function(e) {
|
|||||||
OSRM.RouteMarker.prototype.onDragStart.call(this,e);
|
OSRM.RouteMarker.prototype.onDragStart.call(this,e);
|
||||||
},
|
},
|
||||||
onDragEnd: function(e) {
|
onDragEnd: function(e) {
|
||||||
OSRM.G.markers.route[OSRM.G.dragid].hide();
|
|
||||||
OSRM.G.markers.route[OSRM.G.dragid] = new OSRM.RouteMarker(OSRM.C.VIA_LABEL, {draggable:true,icon:OSRM.G.icons['marker-via']}, e.target.getLatLng() );
|
OSRM.G.markers.route[OSRM.G.dragid] = new OSRM.RouteMarker(OSRM.C.VIA_LABEL, {draggable:true,icon:OSRM.G.icons['marker-via']}, e.target.getLatLng() );
|
||||||
OSRM.G.markers.route[OSRM.G.dragid].show();
|
OSRM.G.markers.route[OSRM.G.dragid].show();
|
||||||
|
|
||||||
OSRM.RouteMarker.prototype.onDragEnd.call(this,e);
|
OSRM.RouteMarker.prototype.onDragEnd.call(this,e);
|
||||||
|
this.parent.hide();
|
||||||
},
|
},
|
||||||
toString: function() {
|
toString: function() {
|
||||||
return "OSRM.DragMarker: \""+this.label+"\", "+this.position+")";
|
return "OSRM.DragMarker: \""+this.label+"\", "+this.position+")";
|
||||||
|
@ -27,8 +27,6 @@ OSRM.SimpleRoute = function (label, style) {
|
|||||||
if(style) this.route.setStyle( style );
|
if(style) this.route.setStyle( style );
|
||||||
|
|
||||||
this.shown = false;
|
this.shown = false;
|
||||||
|
|
||||||
this.route.on('click', this.onClick);
|
|
||||||
};
|
};
|
||||||
OSRM.extend( OSRM.SimpleRoute,{
|
OSRM.extend( OSRM.SimpleRoute,{
|
||||||
show: function() {
|
show: function() {
|
||||||
@ -58,14 +56,6 @@ centerView: function() {
|
|||||||
var bounds = new L.LatLngBounds( this.getPositions() );
|
var bounds = new L.LatLngBounds( this.getPositions() );
|
||||||
OSRM.g.map.fitBoundsUI( bounds );
|
OSRM.g.map.fitBoundsUI( bounds );
|
||||||
},
|
},
|
||||||
onClick: function(e) {
|
|
||||||
if(OSRM.G.route.isRoute()) {
|
|
||||||
var via_index = OSRM.Via.findViaIndex( e.latlng );
|
|
||||||
var marker_index = OSRM.G.markers.setVia(via_index, e.latlng);
|
|
||||||
OSRM.G.markers.route[marker_index].show();
|
|
||||||
OSRM.Routing.getRoute();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
toString: function() {
|
toString: function() {
|
||||||
return "OSRM.Route("+ this.label + ", " + this.route.getLatLngs().length + " points)";
|
return "OSRM.Route("+ this.label + ", " + this.route.getLatLngs().length + " points)";
|
||||||
}
|
}
|
||||||
|
@ -1,513 +0,0 @@
|
|||||||
/*
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU AFFERO General Public License as published by
|
|
||||||
the Free Software Foundation; either version 3 of the License, or
|
|
||||||
any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
or see http://www.gnu.org/licenses/agpl.txt.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// OSRM routing routines
|
|
||||||
// [management of routing/direction requests and processing of responses]
|
|
||||||
// [TODO: major refactoring scheduled]
|
|
||||||
|
|
||||||
// some variables
|
|
||||||
OSRM.GLOBALS.route = null;
|
|
||||||
OSRM.GLOBALS.markers = null;
|
|
||||||
|
|
||||||
OSRM.CONSTANTS.NO_DESCRIPTION = 0;
|
|
||||||
OSRM.CONSTANTS.FULL_DESCRIPTION = 1;
|
|
||||||
|
|
||||||
OSRM.G.dragging = null;
|
|
||||||
OSRM.GLOBALS.dragid = null;
|
|
||||||
OSRM.GLOBALS.pending = false;
|
|
||||||
OSRM.GLOBALS.pendingTimer = null;
|
|
||||||
|
|
||||||
|
|
||||||
OSRM.Routing = {
|
|
||||||
|
|
||||||
// init routing data structures
|
|
||||||
init: function() {
|
|
||||||
OSRM.G.route = new OSRM.Route();
|
|
||||||
OSRM.G.markers = new OSRM.Markers();
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// -- JSONP processing --
|
|
||||||
|
|
||||||
// process JSONP response of routing server
|
|
||||||
timeoutRouteSimple: function() {
|
|
||||||
OSRM.Routing.showNoRouteGeometry();
|
|
||||||
OSRM.Routing.showNoRouteDescription();
|
|
||||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("TIMED_OUT")+".<p>";
|
|
||||||
},
|
|
||||||
timeoutRoute: function() {
|
|
||||||
OSRM.Routing.showNoRouteGeometry();
|
|
||||||
OSRM.G.route.hideUnnamedRoute();
|
|
||||||
OSRM.Routing.showNoRouteDescription();
|
|
||||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("TIMED_OUT")+".<p>";
|
|
||||||
},
|
|
||||||
showRouteSimple: function(response) {
|
|
||||||
if(!response)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( !OSRM.G.dragging ) // prevent simple routing when no longer dragging
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( response.status == 207) {
|
|
||||||
OSRM.Routing.showNoRouteGeometry();
|
|
||||||
OSRM.Routing.showNoRouteDescription();
|
|
||||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("YOUR_ROUTE_IS_BEING_COMPUTED")+".<p>";
|
|
||||||
} else {
|
|
||||||
OSRM.Routing.showRouteGeometry(response);
|
|
||||||
OSRM.Routing.showRouteDescriptionSimple(response);
|
|
||||||
}
|
|
||||||
OSRM.Routing._updateHints(response);
|
|
||||||
|
|
||||||
// TODO: hack to process final drag event, if it was fenced, but we are still dragging (alternative approach)
|
|
||||||
if(OSRM.G.pending) {
|
|
||||||
//clearTimeout(OSRM.G.pendingTimer);
|
|
||||||
OSRM.G.pendingTimer = setTimeout(OSRM.Routing.draggingTimeout,1);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
showRoute: function(response) {
|
|
||||||
if(!response)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(response.status == 207) {
|
|
||||||
OSRM.Routing.showNoRouteGeometry();
|
|
||||||
OSRM.G.route.hideUnnamedRoute();
|
|
||||||
OSRM.Routing.showNoRouteDescription();
|
|
||||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("NO_ROUTE_FOUND")+".<p>";
|
|
||||||
} else {
|
|
||||||
OSRM.Routing.showRouteGeometry(response);
|
|
||||||
OSRM.Routing.showRouteNonames(response);
|
|
||||||
OSRM.Routing.showRouteDescription(response);
|
|
||||||
OSRM.Routing._snapRoute();
|
|
||||||
}
|
|
||||||
OSRM.Routing._updateHints(response);
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// show route geometry
|
|
||||||
showNoRouteGeometry: function() {
|
|
||||||
var positions = [];
|
|
||||||
for(var i=0, size=OSRM.G.markers.route.length; i<size; i++)
|
|
||||||
positions.push( OSRM.G.markers.route[i].getPosition() );
|
|
||||||
|
|
||||||
OSRM.G.route.showRoute(positions, OSRM.Route.NOROUTE);
|
|
||||||
},
|
|
||||||
showRouteGeometry: function(response) {
|
|
||||||
OSRM.G.via_points = response.via_points.slice(0);
|
|
||||||
|
|
||||||
var geometry = OSRM.Routing.decodeRouteGeometry(response.route_geometry, 5);
|
|
||||||
|
|
||||||
var points = [];
|
|
||||||
for( var i=0, size=geometry.length; i < size; i++)
|
|
||||||
points.push( new L.LatLng(geometry[i][0], geometry[i][1]) );
|
|
||||||
|
|
||||||
OSRM.G.route.showRoute(points, OSRM.Route.ROUTE);
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// route description display (and helper functions)
|
|
||||||
onClickRouteDescription: function(geometry_index) {
|
|
||||||
var positions = OSRM.G.route.getPositions();
|
|
||||||
|
|
||||||
OSRM.G.markers.highlight.setPosition( positions[geometry_index] );
|
|
||||||
OSRM.G.markers.highlight.show();
|
|
||||||
OSRM.G.markers.highlight.centerView(OSRM.DEFAULTS.HIGHLIGHT_ZOOM_LEVEL);
|
|
||||||
},
|
|
||||||
onClickCreateShortcut: function(src){
|
|
||||||
src += '&z='+ OSRM.G.map.getZoom() + '¢er=' + OSRM.G.map.getCenter().lat + ',' + OSRM.G.map.getCenter().lng;
|
|
||||||
OSRM.JSONP.call(OSRM.DEFAULTS.HOST_SHORTENER_URL+src, OSRM.Routing.showRouteLink, OSRM.Routing.showRouteLink_TimeOut, 2000, 'shortener');
|
|
||||||
document.getElementById('route-prelink').innerHTML = '['+OSRM.loc("GENERATE_LINK_TO_ROUTE")+']';
|
|
||||||
},
|
|
||||||
showRouteLink: function(response){
|
|
||||||
document.getElementById('route-prelink').innerHTML = '[<a id="gpx-link" class = "text-selectable" href="' +response.ShortURL+ '">'+response.ShortURL+'</a>]';
|
|
||||||
},
|
|
||||||
showRouteLink_TimeOut: function(){
|
|
||||||
document.getElementById('route-prelink').innerHTML = '['+OSRM.loc("LINK_TO_ROUTE_TIMEOUT")+']';
|
|
||||||
},
|
|
||||||
showRouteDescription: function(response) {
|
|
||||||
// compute query string
|
|
||||||
var query_string = '?rebuild=1';
|
|
||||||
for(var i=0; i<OSRM.G.markers.route.length; i++)
|
|
||||||
query_string += '&loc=' + OSRM.G.markers.route[i].getLat() + ',' + OSRM.G.markers.route[i].getLng();
|
|
||||||
|
|
||||||
// create link to the route
|
|
||||||
var route_link ='<span class="route-summary" id="route-prelink">[<a id="gpx-link" onclick="OSRM.Routing.onClickCreateShortcut(\'' + OSRM.DEFAULTS.WEBSITE_URL + query_string + '\')">'+OSRM.loc("GET_LINK_TO_ROUTE")+'</a>]</span>';
|
|
||||||
|
|
||||||
// create GPX link
|
|
||||||
var gpx_link = '<span class="route-summary">[<a id="gpx-link" onClick="document.location.href=\'' + OSRM.DEFAULTS.HOST_ROUTING_URL + query_string + '&output=gpx\';">'+OSRM.loc("GPX_FILE")+'</a>]</span>';
|
|
||||||
|
|
||||||
// create route description
|
|
||||||
var route_desc = "";
|
|
||||||
route_desc += '<table class="results-table">';
|
|
||||||
|
|
||||||
for(var i=0; i < response.route_instructions.length; i++){
|
|
||||||
//odd or even ?
|
|
||||||
var rowstyle='results-odd';
|
|
||||||
if(i%2==0) { rowstyle='results-even'; }
|
|
||||||
|
|
||||||
route_desc += '<tr class="'+rowstyle+'">';
|
|
||||||
|
|
||||||
route_desc += '<td class="result-directions">';
|
|
||||||
route_desc += '<img width="18px" src="images/'+OSRM.Routing.getDirectionIcon(response.route_instructions[i][0])+'" alt="" />';
|
|
||||||
route_desc += "</td>";
|
|
||||||
|
|
||||||
route_desc += '<td class="result-items">';
|
|
||||||
route_desc += '<span class="result-item" onclick="OSRM.Routing.onClickRouteDescription('+response.route_instructions[i][3]+')">';
|
|
||||||
route_desc += response.route_instructions[i][0];
|
|
||||||
if( i == 0 )
|
|
||||||
route_desc += ' ' + OSRM.loc( response.route_instructions[i][6] );
|
|
||||||
if( response.route_instructions[i][1] != "" ) {
|
|
||||||
route_desc += ' on ';
|
|
||||||
route_desc += '<b>' + response.route_instructions[i][1] + '</b>';
|
|
||||||
}
|
|
||||||
//route_desc += ' for ';
|
|
||||||
route_desc += '</span>';
|
|
||||||
route_desc += "</td>";
|
|
||||||
|
|
||||||
route_desc += '<td class="result-distance">';
|
|
||||||
if( i != response.route_instructions.length-1 )
|
|
||||||
route_desc += '<b>'+OSRM.Utils.metersToDistance(response.route_instructions[i][2])+'</b>';
|
|
||||||
route_desc += "</td>";
|
|
||||||
|
|
||||||
route_desc += "</tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
route_desc += '</table>';
|
|
||||||
headline = "";
|
|
||||||
headline += OSRM.loc("ROUTE_DESCRIPTION")+":<br>";
|
|
||||||
headline += '<div style="float:left;width:40%">';
|
|
||||||
headline += "<span class='route-summary'>"
|
|
||||||
+ OSRM.loc("DISTANCE")+": " + OSRM.Utils.metersToDistance(response.route_summary.total_distance)
|
|
||||||
+ "<br>"
|
|
||||||
+ OSRM.loc("DURATION")+": " + OSRM.Utils.secondsToTime(response.route_summary.total_time)
|
|
||||||
+ "</span>";
|
|
||||||
headline += '</div>';
|
|
||||||
headline += '<div style="float:left;text-align:right;width:60%;">'+route_link+'<br>'+gpx_link+'</div>';
|
|
||||||
|
|
||||||
var output = "";
|
|
||||||
output += route_desc;
|
|
||||||
|
|
||||||
document.getElementById('information-box-headline').innerHTML = headline;
|
|
||||||
document.getElementById('information-box').innerHTML = output;
|
|
||||||
},
|
|
||||||
showRouteDescriptionSimple: function(response) {
|
|
||||||
headline = OSRM.loc("ROUTE_DESCRIPTION")+":<br>";
|
|
||||||
headline += "<span class='route-summary'>"
|
|
||||||
+ OSRM.loc("DISTANCE")+": " + OSRM.Utils.metersToDistance(response.route_summary.total_distance)
|
|
||||||
+ "<br>"
|
|
||||||
+ OSRM.loc("DURATION")+": " + OSRM.Utils.secondsToTime(response.route_summary.total_time)
|
|
||||||
+ "</span>";
|
|
||||||
headline += '<br><br>';
|
|
||||||
|
|
||||||
document.getElementById('information-box-headline').innerHTML = headline;
|
|
||||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("YOUR_ROUTE_IS_BEING_COMPUTED")+".<p>";
|
|
||||||
},
|
|
||||||
showNoRouteDescription: function() {
|
|
||||||
headline = OSRM.loc("ROUTE_DESCRIPTION")+":<br>";
|
|
||||||
headline += "<span class='route-summary'>"
|
|
||||||
+ OSRM.loc("DISTANCE")+": N/A"
|
|
||||||
+ "<br>"
|
|
||||||
+ OSRM.loc("DURATION")+": N/A"
|
|
||||||
+ "</span>";
|
|
||||||
headline += '<br><br>';
|
|
||||||
|
|
||||||
document.getElementById('information-box-headline').innerHTML = headline;
|
|
||||||
document.getElementById('information-box').innerHTML = "<br><p style='font-size:14px;font-weight:bold;text-align:center;'>"+OSRM.loc("YOUR_ROUTE_IS_BEING_COMPUTED")+".<p>";
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// unnamed streets display
|
|
||||||
showRouteNonames: function(response) {
|
|
||||||
// do not display unnamed streets?
|
|
||||||
if( document.getElementById('option-highlight-nonames').checked == false) {
|
|
||||||
OSRM.G.route.hideUnnamedRoute();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// mark geometry positions where unnamed/named streets switch
|
|
||||||
var named = [];
|
|
||||||
for (var i = 0; i < response.route_instructions.length; i++) {
|
|
||||||
if( response.route_instructions[i][1] == '' )
|
|
||||||
named[ response.route_instructions[i][3] ] = false; // no street name
|
|
||||||
else
|
|
||||||
named[ response.route_instructions[i][3] ] = true; // yes street name
|
|
||||||
}
|
|
||||||
|
|
||||||
// aggregate geometry for unnamed streets
|
|
||||||
var geometry = OSRM.Routing.decodeRouteGeometry(response.route_geometry, 5);
|
|
||||||
var is_named = true;
|
|
||||||
var current_positions = [];
|
|
||||||
var all_positions = [];
|
|
||||||
for( var i=0; i < geometry.length; i++) {
|
|
||||||
current_positions.push( new L.LatLng(geometry[i][0], geometry[i][1]) );
|
|
||||||
|
|
||||||
// still named/unnamed?
|
|
||||||
if( (named[i] == is_named || named[i] == undefined) && i != geometry.length-1 )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// switch between named/unnamed!
|
|
||||||
if(is_named == false)
|
|
||||||
all_positions.push( current_positions );
|
|
||||||
current_positions = [];
|
|
||||||
current_positions.push( new L.LatLng(geometry[i][0], geometry[i][1]) );
|
|
||||||
is_named = named[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// display unnamed streets
|
|
||||||
OSRM.G.route.showUnnamedRoute(all_positions);
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
//-- main function --
|
|
||||||
|
|
||||||
//generate server calls to query routes
|
|
||||||
getDragRoute: function() {
|
|
||||||
// prepare JSONP call
|
|
||||||
var source = OSRM.DEFAULTS.HOST_ROUTING_URL;
|
|
||||||
source += '?z=' + OSRM.G.map.getZoom() + '&output=json&geomformat=cmp&instructions=false';
|
|
||||||
if(OSRM.G.markers.checksum)
|
|
||||||
source += '&checksum=' + OSRM.G.markers.checksum;
|
|
||||||
for(var i=0, size=OSRM.G.markers.route.length; i<size; i++) {
|
|
||||||
source += '&loc=' + OSRM.G.markers.route[i].getLat() + ',' + OSRM.G.markers.route[i].getLng();
|
|
||||||
if( OSRM.G.markers.route[i].hint)
|
|
||||||
source += '&hint=' + OSRM.G.markers.route[i].hint;
|
|
||||||
}
|
|
||||||
OSRM.G.pending = !OSRM.JSONP.call(source, OSRM.Routing.showRouteSimple, OSRM.Routing.timeoutRouteSimple, OSRM.DEFAULTS.JSONP_TIMEOUT, 'dragging');;
|
|
||||||
},
|
|
||||||
draggingTimeout: function() {
|
|
||||||
OSRM.G.markers.route[OSRM.G.dragid].hint = null;
|
|
||||||
OSRM.Routing.getDragRoute();
|
|
||||||
},
|
|
||||||
|
|
||||||
// generate server calls to query routes
|
|
||||||
getRoute: function(do_description) {
|
|
||||||
|
|
||||||
// if source or target are not set -> hide route
|
|
||||||
if( OSRM.G.markers.route.length < 2 ) {
|
|
||||||
OSRM.G.route.hideRoute();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// prepare JSONP call
|
|
||||||
var type = null;
|
|
||||||
var callback = null;
|
|
||||||
var timeout = null;
|
|
||||||
|
|
||||||
var source = OSRM.DEFAULTS.HOST_ROUTING_URL;
|
|
||||||
source += '?z=' + OSRM.G.map.getZoom() + '&output=json' + '&geomformat=cmp';
|
|
||||||
if(OSRM.G.markers.checksum)
|
|
||||||
source += '&checksum=' + OSRM.G.markers.checksum;
|
|
||||||
for(var i=0; i<OSRM.G.markers.route.length; i++) {
|
|
||||||
source += '&loc=' + OSRM.G.markers.route[i].getLat() + ',' + OSRM.G.markers.route[i].getLng();
|
|
||||||
if( OSRM.G.markers.route[i].hint)
|
|
||||||
source += '&hint=' + OSRM.G.markers.route[i].hint;
|
|
||||||
}
|
|
||||||
|
|
||||||
// decide whether it is a dragging call or a normal one
|
|
||||||
if (do_description) {
|
|
||||||
callback = OSRM.Routing.showRoute;
|
|
||||||
timeout = OSRM.Routing.timeoutRoute;
|
|
||||||
source +='&instructions=true';
|
|
||||||
type = 'route';
|
|
||||||
} else {
|
|
||||||
callback = OSRM.Routing.showRouteSimple;
|
|
||||||
timeout = OSRM.Routing.timeoutRouteSimple;
|
|
||||||
source +='&instructions=false';
|
|
||||||
type = 'dragging';
|
|
||||||
}
|
|
||||||
|
|
||||||
// do call
|
|
||||||
var called = OSRM.JSONP.call(source, callback, timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, type);
|
|
||||||
|
|
||||||
// TODO: hack to process final drag event, if it was fenced, but we are still dragging
|
|
||||||
if(called == false && !do_description) {
|
|
||||||
clearTimeout(OSRM.G.pendingTimer);
|
|
||||||
OSRM.G.pendingTimer = setTimeout(OSRM.Routing.timeoutDrag,OSRM.DEFAULTS.JSONP_TIMEOUT);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
clearTimeout(OSRM.G.pendingTimer);
|
|
||||||
}
|
|
||||||
// // TODO: hack to process final drag event, if it was fenced, but we are still dragging (alternative approach)
|
|
||||||
// if(called == false && !do_description) {
|
|
||||||
// OSRM.G.pending = true;
|
|
||||||
// } else {
|
|
||||||
// clearTimeout(OSRM.G.pendingTimer);
|
|
||||||
// OSRM.G.pending = false;
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
timeoutDrag: function() {
|
|
||||||
OSRM.G.markers.route[OSRM.G.dragid].hint = null;
|
|
||||||
OSRM.Routing.getRoute(OSRM.C.NO_DESCRIPTION);
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
//-- helper functions --
|
|
||||||
|
|
||||||
//decode compressed route geometry
|
|
||||||
decodeRouteGeometry: function(encoded, precision) {
|
|
||||||
precision = Math.pow(10, -precision);
|
|
||||||
var len = encoded.length, index=0, lat=0, lng = 0, array = [];
|
|
||||||
while (index < len) {
|
|
||||||
var b, shift = 0, result = 0;
|
|
||||||
do {
|
|
||||||
b = encoded.charCodeAt(index++) - 63;
|
|
||||||
result |= (b & 0x1f) << shift;
|
|
||||||
shift += 5;
|
|
||||||
} while (b >= 0x20);
|
|
||||||
var dlat = ((result & 1) ? ~(result >> 1) : (result >> 1));
|
|
||||||
lat += dlat;
|
|
||||||
shift = 0;
|
|
||||||
result = 0;
|
|
||||||
do {
|
|
||||||
b = encoded.charCodeAt(index++) - 63;
|
|
||||||
result |= (b & 0x1f) << shift;
|
|
||||||
shift += 5;
|
|
||||||
} while (b >= 0x20);
|
|
||||||
var dlng = ((result & 1) ? ~(result >> 1) : (result >> 1));
|
|
||||||
lng += dlng;
|
|
||||||
array.push([lat * precision, lng * precision]);
|
|
||||||
}
|
|
||||||
return array;
|
|
||||||
},
|
|
||||||
|
|
||||||
// update hints of all markers
|
|
||||||
_updateHints: function(response) {
|
|
||||||
var hint_locations = response.hint_data.locations;
|
|
||||||
OSRM.G.markers.checksum = response.hint_data.checksum;
|
|
||||||
for(var i=0; i<hint_locations.length; i++)
|
|
||||||
OSRM.G.markers.route[i].hint = hint_locations[i];
|
|
||||||
},
|
|
||||||
|
|
||||||
// snap all markers to the received route
|
|
||||||
_snapRoute: function() {
|
|
||||||
var positions = OSRM.G.route.getPositions();
|
|
||||||
|
|
||||||
OSRM.G.markers.route[0].setPosition( positions[0] );
|
|
||||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].setPosition( positions[positions.length-1] );
|
|
||||||
for(var i=0; i<OSRM.G.via_points.length; i++)
|
|
||||||
OSRM.G.markers.route[i+1].setPosition( new L.LatLng(OSRM.G.via_points[i][0], OSRM.G.via_points[i][1]) );
|
|
||||||
|
|
||||||
OSRM.Geocoder.updateAddress(OSRM.C.SOURCE_LABEL);
|
|
||||||
OSRM.Geocoder.updateAddress(OSRM.C.TARGET_LABEL);
|
|
||||||
},
|
|
||||||
|
|
||||||
// map driving instructions to icons
|
|
||||||
// [TODO: better implementation, language-safe]
|
|
||||||
getDirectionIcon: function(name) {
|
|
||||||
var directions = {
|
|
||||||
"Turn left":"turn-left.png",
|
|
||||||
"Turn right":"turn-right.png",
|
|
||||||
"U-Turn":"u-turn.png",
|
|
||||||
"Head":"continue.png",
|
|
||||||
"Continue":"continue.png",
|
|
||||||
"Turn slight left":"slight-left.png",
|
|
||||||
"Turn slight right":"slight-right.png",
|
|
||||||
"Turn sharp left":"sharp-left.png",
|
|
||||||
"Turn sharp right":"sharp-right.png",
|
|
||||||
"Enter roundabout and leave at first exit":"round-about.png",
|
|
||||||
"Enter roundabout and leave at second exit":"round-about.png",
|
|
||||||
"Enter roundabout and leave at third exit":"round-about.png",
|
|
||||||
"Enter roundabout and leave at fourth exit":"round-about.png",
|
|
||||||
"Enter roundabout and leave at fifth exit":"round-about.png",
|
|
||||||
"Enter roundabout and leave at sixth exit":"round-about.png",
|
|
||||||
"Enter roundabout and leave at seventh exit":"round-about.png",
|
|
||||||
"Enter roundabout and leave at eighth exit":"round-about.png",
|
|
||||||
"Enter roundabout and leave at nineth exit":"round-about.png",
|
|
||||||
"Enter roundabout and leave at tenth exit":"round-about.png",
|
|
||||||
"Enter roundabout and leave at one of the too many exit":"round-about.png",
|
|
||||||
"You have reached your destination":"target.png"
|
|
||||||
};
|
|
||||||
|
|
||||||
if( directions[name] )
|
|
||||||
return directions[name];
|
|
||||||
else
|
|
||||||
return "default.png";
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// -- gui functions --
|
|
||||||
|
|
||||||
// click: button "reset"
|
|
||||||
resetRouting: function() {
|
|
||||||
document.getElementById('input-source-name').value = "";
|
|
||||||
document.getElementById('input-target-name').value = "";
|
|
||||||
|
|
||||||
OSRM.G.route.hideAll();
|
|
||||||
OSRM.G.markers.removeAll();
|
|
||||||
OSRM.G.markers.highlight.hide();
|
|
||||||
|
|
||||||
document.getElementById('information-box').innerHTML = "";
|
|
||||||
document.getElementById('information-box-headline').innerHTML = "";
|
|
||||||
|
|
||||||
OSRM.JSONP.reset();
|
|
||||||
},
|
|
||||||
|
|
||||||
// click: button "reverse"
|
|
||||||
reverseRouting: function() {
|
|
||||||
// invert input boxes
|
|
||||||
var tmp = document.getElementById("input-source-name").value;
|
|
||||||
document.getElementById("input-source-name").value = document.getElementById("input-target-name").value;
|
|
||||||
document.getElementById("input-target-name").value = tmp;
|
|
||||||
|
|
||||||
// invert route
|
|
||||||
OSRM.G.markers.route.reverse();
|
|
||||||
if(OSRM.G.markers.route.length == 1) {
|
|
||||||
if(OSRM.G.markers.route[0].label == OSRM.C.TARGET_LABEL) {
|
|
||||||
OSRM.G.markers.route[0].label = OSRM.C.SOURCE_LABEL;
|
|
||||||
OSRM.G.markers.route[0].marker.setIcon( new L.Icon('images/marker-source.png') );
|
|
||||||
} else if(OSRM.G.markers.route[0].label == OSRM.C.SOURCE_LABEL) {
|
|
||||||
OSRM.G.markers.route[0].label = OSRM.C.TARGET_LABEL;
|
|
||||||
OSRM.G.markers.route[0].marker.setIcon( new L.Icon('images/marker-target.png') );
|
|
||||||
}
|
|
||||||
} else if(OSRM.G.markers.route.length > 1){
|
|
||||||
OSRM.G.markers.route[0].label = OSRM.C.SOURCE_LABEL;
|
|
||||||
OSRM.G.markers.route[0].marker.setIcon( new L.Icon('images/marker-source.png') );
|
|
||||||
|
|
||||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].label = OSRM.C.TARGET_LABEL;
|
|
||||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].marker.setIcon( new L.Icon('images/marker-target.png') );
|
|
||||||
}
|
|
||||||
|
|
||||||
// recompute route
|
|
||||||
if( OSRM.G.route.isShown() ) {
|
|
||||||
OSRM.Routing.getRoute(OSRM.C.FULL_DESCRIPTION);
|
|
||||||
OSRM.G.markers.highlight.hide();
|
|
||||||
} else {
|
|
||||||
document.getElementById('information-box').innerHTML = "";
|
|
||||||
document.getElementById('information-box-headline').innerHTML = "";
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// click: button "show"
|
|
||||||
showMarker: function(marker_id) {
|
|
||||||
if( OSRM.JSONP.fences["geocoder_source"] || OSRM.JSONP.fences["geocoder_target"] )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() )
|
|
||||||
OSRM.G.markers.route[0].centerView();
|
|
||||||
else if( marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() )
|
|
||||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].centerView();
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// changed: any inputbox (is called when return is pressed [after] or focus is lost [before])
|
|
||||||
inputChanged: function(marker_id) {
|
|
||||||
if( marker_id == OSRM.C.SOURCE_LABEL)
|
|
||||||
OSRM.Geocoder.call(OSRM.C.SOURCE_LABEL, document.getElementById('input-source-name').value);
|
|
||||||
else if( marker_id == OSRM.C.TARGET_LABEL)
|
|
||||||
OSRM.Geocoder.call(OSRM.C.TARGET_LABEL, document.getElementById('input-target-name').value);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
@ -68,30 +68,32 @@ findViaIndex: function( new_via_position ) {
|
|||||||
dragTimer: new Date(),
|
dragTimer: new Date(),
|
||||||
|
|
||||||
drawDragMarker: function(event) {
|
drawDragMarker: function(event) {
|
||||||
if( OSRM.G.route.isShown() == false )
|
if( OSRM.G.route.isShown() == false)
|
||||||
return;
|
return;
|
||||||
if( OSRM.G.dragging == true )
|
if( OSRM.G.dragging == true )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// throttle computation
|
||||||
if( (new Date() - OSRM.Via.dragTimer) < 25 )
|
if( (new Date() - OSRM.Via.dragTimer) < 25 )
|
||||||
return;
|
return;
|
||||||
if( OSRM.G.onmouse ) {
|
|
||||||
OSRM.G.markers.dragger.hide();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
OSRM.Via.dragTimer = new Date();
|
OSRM.Via.dragTimer = new Date();
|
||||||
|
|
||||||
// var mouse = event.latlng;
|
// get distance to route
|
||||||
// for(var i=0, size=OSRM.G.markers.route.length; i<size; i++) {
|
|
||||||
// if(OSRM.G.markers.route[i].label=='drag')
|
|
||||||
// continue;
|
|
||||||
// var position = OSRM.G.markers.route[i].getPosition();
|
|
||||||
// var dist = OSRM.G.map.project(mouse).distanceTo(OSRM.G.map.project(position));
|
|
||||||
// if( dist < 10 )
|
|
||||||
// min_dist = 1000;
|
|
||||||
// }
|
|
||||||
var minpoint = OSRM.G.route._current_route.route.closestLayerPoint( event.layerPoint );
|
var minpoint = OSRM.G.route._current_route.route.closestLayerPoint( event.layerPoint );
|
||||||
var min_dist = minpoint._sqDist;
|
var min_dist = minpoint._sqDist;
|
||||||
|
|
||||||
|
// get distance to markers
|
||||||
|
var mouse = event.latlng;
|
||||||
|
for(var i=0, size=OSRM.G.markers.route.length; i<size; i++) {
|
||||||
|
if(OSRM.G.markers.route[i].label=='drag')
|
||||||
|
continue;
|
||||||
|
var position = OSRM.G.markers.route[i].getPosition();
|
||||||
|
var dist = OSRM.G.map.project(mouse).distanceTo(OSRM.G.map.project(position));
|
||||||
|
if( dist < 20 )
|
||||||
|
min_dist = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check whether mouse is over another marker
|
||||||
var pos = OSRM.G.map.layerPointToContainerPoint(event.layerPoint);
|
var pos = OSRM.G.map.layerPointToContainerPoint(event.layerPoint);
|
||||||
var obj = document.elementFromPoint(pos.x,pos.y);
|
var obj = document.elementFromPoint(pos.x,pos.y);
|
||||||
for(var i=0, size=OSRM.G.markers.route.length; i<size; i++) {
|
for(var i=0, size=OSRM.G.markers.route.length; i<size; i++) {
|
||||||
|
@ -3382,14 +3382,7 @@ L.LineUtil = {
|
|||||||
dx = p.x - x;
|
dx = p.x - x;
|
||||||
dy = p.y - y;
|
dy = p.y - y;
|
||||||
|
|
||||||
//return sqDist ? dx * dx + dy * dy : new L.Point(x, y); // DS_CHANGE
|
return sqDist ? dx * dx + dy * dy : new L.Point(x, y);
|
||||||
if(sqDist)
|
|
||||||
return dx*dx + dy*dy;
|
|
||||||
else {
|
|
||||||
var p = new L.Point(x,y);
|
|
||||||
p._sqDist = dx*dx + dy*dy;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
|
|
||||||
<!-- scripts -->
|
<!-- scripts -->
|
||||||
<script src="leaflet/leaflet-src.js" type="text/javascript"></script>
|
<script src="leaflet/leaflet-src.js" type="text/javascript"></script>
|
||||||
|
<script src="L.Bugfixes.js" type="text/javascript"></script>
|
||||||
<script src="L.DashedPolyline.js" type="text/javascript"></script>
|
<script src="L.DashedPolyline.js" type="text/javascript"></script>
|
||||||
<script src="L.MouseMarker.js" type="text/javascript"></script>
|
<script src="L.MouseMarker.js" type="text/javascript"></script>
|
||||||
|
|
||||||
@ -116,11 +117,11 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
<span class="main-options" id="options-toggle" onclick="OSRM.GUI.toggleOptions()">Kartenwerkzeuge</span>
|
<span class="main-options" id="options-toggle" onclick="OSRM.GUI.toggleOptions()">Kartenwerkzeuge</span>
|
||||||
<div class="main-options" id="options-box">
|
<div class="main-options" id="options-box">
|
||||||
<span class="main-options-left-box">
|
<span class="main-options-left-box">
|
||||||
<input type="checkbox" id="option-highlight-nonames" name="main-options" value="highlight-nonames" onclick="OSRM.RoutingGUI.getRoute();" /><span id="gui-option-highlight-nonames-label">Unbenannte Straßen hervorheben</span>
|
<input type="checkbox" id="option-highlight-nonames" name="main-options" value="highlight-nonames" onclick="OSRM.Routing.getRoute();" /><span id="gui-option-highlight-nonames-label">Unbenannte Straßen hervorheben</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="main-options-right-box">
|
<span class="main-options-right-box">
|
||||||
<a class="button not-selectable" id="open-josm" onclick="OSRM.RoutingGUI.openJOSM();">JOSM Öffnen</a>
|
<a class="button not-selectable" id="open-josm" onclick="OSRM.RoutingGUI.openJOSM();">JOSM</a>
|
||||||
<a class="button not-selectable" id="open-osmbugs" onclick="OSRM.RoutingGUI.openOSMBugs();">OSM Bugs Öffnen</a>
|
<a class="button not-selectable" id="open-osmbugs" onclick="OSRM.RoutingGUI.openOSMBugs();">OSM Bugs</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -108,8 +108,7 @@ openJOSM: function() {
|
|||||||
//click: button "open OSM Bugs"
|
//click: button "open OSM Bugs"
|
||||||
openOSMBugs: function() {
|
openOSMBugs: function() {
|
||||||
var position = OSRM.G.map.getCenterUI();
|
var position = OSRM.G.map.getCenterUI();
|
||||||
document.location.href = "http://osmbugs.org/?lat="+position.lat.toFixed(6)+"&lon="+position.lng.toFixed(6)+"&zoom="+OSRM.G.map.getZoom();
|
window.open( "http://osmbugs.org/?lat="+position.lat.toFixed(6)+"&lon="+position.lng.toFixed(6)+"&zoom="+OSRM.G.map.getZoom() );
|
||||||
//window.open( "http://osmbugs.org/?lat="+position.lat.toFixed(6)+"&lon="+position.lng.toFixed(6)+"&zoom="+OSRM.G.map.getZoom() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user