added buttons to switch to JOSM and OSM Bugs,
added getCenter function that respects UI visibility
This commit is contained in:
parent
fd3cf02af4
commit
007dd19cec
@ -30,6 +30,9 @@ init: function() {
|
|||||||
OSRM.GUI.visible = true;
|
OSRM.GUI.visible = true;
|
||||||
OSRM.GUI.width = document.getElementById("main-wrapper").clientWidth;
|
OSRM.GUI.width = document.getElementById("main-wrapper").clientWidth;
|
||||||
|
|
||||||
|
// translate
|
||||||
|
document.getElementById("open-josm").innerHTML = OSRM.loc("OPEN_JOSM");
|
||||||
|
document.getElementById("open-osmbugs").innerHTML = OSRM.loc("OPEN_OSMBUGS");
|
||||||
document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET");
|
document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET");
|
||||||
document.getElementById("gui-reverse").innerHTML = OSRM.loc("GUI_REVERSE");
|
document.getElementById("gui-reverse").innerHTML = OSRM.loc("GUI_REVERSE");
|
||||||
document.getElementById("gui-option-highlight-nonames-label").innerHTML = OSRM.loc("GUI_HIGHLIGHT_UNNAMED_ROADS");
|
document.getElementById("gui-option-highlight-nonames-label").innerHTML = OSRM.loc("GUI_HIGHLIGHT_UNNAMED_ROADS");
|
||||||
|
@ -39,12 +39,14 @@ OSRM.loc = OSRM.Localization.translate;
|
|||||||
// German language support
|
// German language support
|
||||||
OSRM.Localization["de"] = {
|
OSRM.Localization["de"] = {
|
||||||
//gui
|
//gui
|
||||||
|
"OPEN_JOSM": "JOSM Öffnen",
|
||||||
|
"OPEN_OSMBUGS": "OSM Bugs Öffnen",
|
||||||
"GUI_START": "Start",
|
"GUI_START": "Start",
|
||||||
"GUI_END": "Ziel",
|
"GUI_END": "Ziel",
|
||||||
"GUI_RESET": "Reset",
|
"GUI_RESET": "Reset",
|
||||||
"GUI_SEARCH": "Zeigen",
|
"GUI_SEARCH": "Zeigen",
|
||||||
"GUI_REVERSE": "Umdrehen",
|
"GUI_REVERSE": "Umdrehen",
|
||||||
"GUI_OPTIONS": "Optionen",
|
"GUI_OPTIONS": "Kartenwerkzeuge",
|
||||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Unbenannte Straßen hervorheben",
|
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Unbenannte Straßen hervorheben",
|
||||||
"GUI_START_TOOLTIP": "Startposition eingeben",
|
"GUI_START_TOOLTIP": "Startposition eingeben",
|
||||||
"GUI_END_TOOLTIP": "Zielposition eingeben",
|
"GUI_END_TOOLTIP": "Zielposition eingeben",
|
||||||
@ -80,12 +82,14 @@ OSRM.Localization["de"] = {
|
|||||||
// English language support
|
// English language support
|
||||||
OSRM.Localization["en"] = {
|
OSRM.Localization["en"] = {
|
||||||
//gui
|
//gui
|
||||||
|
"OPEN_JOSM": "Open JOSM",
|
||||||
|
"OPEN_OSMBUGS": "Open OSM Bugs",
|
||||||
"GUI_START": "Start",
|
"GUI_START": "Start",
|
||||||
"GUI_END": "End",
|
"GUI_END": "End",
|
||||||
"GUI_RESET": " Reset ",
|
"GUI_RESET": " Reset ",
|
||||||
"GUI_SEARCH": " Show ",
|
"GUI_SEARCH": " Show ",
|
||||||
"GUI_REVERSE": "Reverse",
|
"GUI_REVERSE": "Reverse",
|
||||||
"GUI_OPTIONS": "Options",
|
"GUI_OPTIONS": "Mapping Tools",
|
||||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Highlight unnamed streets",
|
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Highlight unnamed streets",
|
||||||
"GUI_START_TOOLTIP": "Enter start",
|
"GUI_START_TOOLTIP": "Enter start",
|
||||||
"GUI_END_TOOLTIP": "Enter destination",
|
"GUI_END_TOOLTIP": "Enter destination",
|
||||||
|
@ -49,6 +49,14 @@ OSRM.MapView = L.Map.extend({
|
|||||||
bounds.extend( OSRM.G.map.unproject(sw_point,zoom) );
|
bounds.extend( OSRM.G.map.unproject(sw_point,zoom) );
|
||||||
bounds.extend( OSRM.G.map.unproject(ne_point,zoom) );
|
bounds.extend( OSRM.G.map.unproject(ne_point,zoom) );
|
||||||
this.fitBounds( bounds );
|
this.fitBounds( bounds );
|
||||||
|
},
|
||||||
|
getCenterUI: function(unbounded) {
|
||||||
|
var viewHalf = this.getSize();
|
||||||
|
if( OSRM.GUI.visible == true )
|
||||||
|
viewHalf.x += OSRM.GUI.width;
|
||||||
|
var centerPoint = this._getTopLeftPoint().add(viewHalf.divideBy(2));
|
||||||
|
|
||||||
|
return this.unproject(centerPoint, this._zoom, unbounded);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -148,8 +148,21 @@ html, body, #map {
|
|||||||
|
|
||||||
.main-options
|
.main-options
|
||||||
{
|
{
|
||||||
|
position:relative;
|
||||||
font-size:10px;
|
font-size:10px;
|
||||||
}
|
}
|
||||||
|
.main-options-left-box
|
||||||
|
{
|
||||||
|
position:absolute;
|
||||||
|
left:5px;
|
||||||
|
top:0px;
|
||||||
|
}
|
||||||
|
.main-options-right-box
|
||||||
|
{
|
||||||
|
position:absolute;
|
||||||
|
right:5px;
|
||||||
|
top:5px;
|
||||||
|
}
|
||||||
#options-toggle
|
#options-toggle
|
||||||
{
|
{
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
|
@ -113,11 +113,16 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!-- options -->
|
<!-- options -->
|
||||||
<div class="vquad"></div>
|
<span class="main-options" id="options-toggle" onclick="OSRM.GUI.toggleOptions()">Kartenwerkzeuge</span>
|
||||||
<div class="main-options not-selectable" id="options-toggle" onclick="OSRM.GUI.toggleOptions()">Options</div>
|
<div class="main-options" id="options-box">
|
||||||
<div class="main-options not-selectable" id="options-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.RoutingGUI.getRoute();" /><span id="gui-option-highlight-nonames-label">Unbenannte Straßen hervorheben</span>
|
||||||
</div>
|
</span>
|
||||||
|
<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-osmbugs" onclick="OSRM.RoutingGUI.openOSMBugs();">OSM Bugs Öffnen</a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- output box -->
|
<!-- output box -->
|
||||||
|
@ -143,6 +143,6 @@ _snapRoute: function() {
|
|||||||
|
|
||||||
OSRM.Geocoder.updateAddress(OSRM.C.SOURCE_LABEL);
|
OSRM.Geocoder.updateAddress(OSRM.C.SOURCE_LABEL);
|
||||||
OSRM.Geocoder.updateAddress(OSRM.C.TARGET_LABEL);
|
OSRM.Geocoder.updateAddress(OSRM.C.TARGET_LABEL);
|
||||||
},
|
}
|
||||||
|
|
||||||
};
|
};
|
@ -89,6 +89,27 @@ inputChanged: function(marker_id) {
|
|||||||
OSRM.Geocoder.call(OSRM.C.SOURCE_LABEL, document.getElementById('input-source-name').value);
|
OSRM.Geocoder.call(OSRM.C.SOURCE_LABEL, document.getElementById('input-source-name').value);
|
||||||
else if( marker_id == OSRM.C.TARGET_LABEL)
|
else if( marker_id == OSRM.C.TARGET_LABEL)
|
||||||
OSRM.Geocoder.call(OSRM.C.TARGET_LABEL, document.getElementById('input-target-name').value);
|
OSRM.Geocoder.call(OSRM.C.TARGET_LABEL, document.getElementById('input-target-name').value);
|
||||||
|
},
|
||||||
|
|
||||||
|
// click: button "open JOSM"
|
||||||
|
openJOSM: function() {
|
||||||
|
var x = OSRM.G.map.getCenterUI();
|
||||||
|
var ydelta = 0.01;
|
||||||
|
var xdelta = ydelta * 2;
|
||||||
|
var p = [ 'left=' + (x.lng - xdelta), 'bottom=' + (x.lat - ydelta), 'right=' + (x.lng + xdelta), 'top=' + (x.lat + ydelta)];
|
||||||
|
var url = 'http://localhost:8111/load_and_zoom?' + p.join('&');
|
||||||
|
|
||||||
|
var frame = L.DomUtil.create('iframe', null, document.body);
|
||||||
|
frame.style.width = frame.style.height = "0px";
|
||||||
|
frame.src = url;
|
||||||
|
frame.onload = function(e) { document.body.removeChild(frame); };
|
||||||
|
},
|
||||||
|
|
||||||
|
//click: button "open OSM Bugs"
|
||||||
|
openOSMBugs: function() {
|
||||||
|
var position = OSRM.G.map.getCenterUI();
|
||||||
|
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() );
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user