Compare commits

..

No commits in common. "92ab599d7516a13075d546171756cf9aae3124a9" and "3610b8b610dee65ac318c2a71b18a03f6cd573e5" have entirely different histories.

4 changed files with 18 additions and 133 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "lifo-dijkstraserv"]
path = lifo-dijkstraserv
url = https://notsyncing.net:8080/markus/lifo-dijkstraserv.git

View File

@ -42,7 +42,8 @@ L.StreetLabels = L.LabelTextCollision
_text: function (ctx, layer) {
if (layer && layer.feature && layer.feature.properties && layer.feature.properties[this.options.propertyName] !== undefined) {
if (layer && layer.feature && layer.feature.properties && layer.feature.properties[this.options.propertyName] !== 'undefined') {
if (this.options.showLabelIf) {
if (this.options.showLabelIf.call(this, layer.feature) === false) {
return;
@ -94,7 +95,7 @@ L.StreetLabels = L.LabelTextCollision
L.point(p.x + offsetX, p.y + offsetY), L.point(
textWidth, textHeight));
if (this._getCollisionFlag(layer)) {
if (this.options.collisionFlg) {
for (var index in this._textList) {
var pointBounds = this._textList[index];
if (pointBounds.intersects(bounds)) {
@ -105,6 +106,7 @@ L.StreetLabels = L.LabelTextCollision
this._textList.push(bounds);
ctx.fillStyle = this.options.fontStyle.fillStyle;
ctx.strokeStyle = this.options.fontStyle.strokeStyle;
@ -142,10 +144,6 @@ L.StreetLabels = L.LabelTextCollision
}
},
_getCollisionFlag: function (layer) {
return this.options.collisionFlg;
},
/***
* Returns the bearing in degrees clockwise from north (0 degrees)
from the first L.LatLng to the second, at the first LatLng

View File

@ -5,7 +5,6 @@ var polyconf_show_street_names = 5; // Zoom level for when to start showing stre
var polyconf_show_cities = 5; /* City outlines will be filled on this level and further away */
var polyconf_show_districts = 4; /* Shown from polyconf_show_cities until this*/
var dijkstraserv_base = "https://notsyncing.net/dijkstra/";
var wikiurl_base = "https://wiki.linux-forks.de/mediawiki/index.php/"
var streetLabelsRenderer = new L.StreetLabels({
@ -37,13 +36,6 @@ var streetLabelsRenderer = new L.StreetLabels({
},
});
streetLabelsRenderer._getCollisionFlag = function (layer) {
if (!(layer instanceof L.Polygon)) // Always check collision for streets
return true;
zoom = mymap.getZoom();
return (zoom < 5);
}
streetLabelsRenderer._getDynamicFontSize = function (layer) {
zoom = mymap.getZoom();
@ -94,13 +86,6 @@ var style_outlines = {
var style_streets = {
};
var style_route = {
radius: 8,
fillColor: "#00ff00",
color: "red",
opacity: 1.0,
fillOpacity: 0.5
};
// Projection fix from: https://gis.stackexchange.com/questions/200865/leaflet-crs-simple-custom-scale
var factorx = 1 / 256 * 4;
@ -271,10 +256,6 @@ function load_geojson(name, url, geotype, iconcolor, active=1, style={}) {
iconname = "umbrella-beach";
iconcolor = "orange";
break;
case "waterway":
iconname = "water";
iconcolor = "blue";
break;
}
if (iconname != "star")
break;
@ -366,8 +347,12 @@ function prompt_location() {
}
var search_element;
var route_element;
function build_sidebar() {
function toggle_search() {
if (el = document.getElementById('searchbar')) {
el.parentNode.removeChild(el);
return;
}
if (!search_element) {
search_element = document.createElement("div");
search_element.style.overflow = "scroll";
@ -376,43 +361,14 @@ function build_sidebar() {
search_element.innerHTML = '<input style="width:100%;" id="search_query" name="lifo_map_search" type="search" placeholder="Start typing to search..." oninput="search(event)"><div id="search_results"></div>' ;
}
if (!route_element) {
route_element = document.createElement("div");
route_element.style.overflow = "scroll";
route_element.style.padding = "6px";
route_element.style.height = "100%";
route_element.innerHTML = '<a href="#" onclick="toggle_search(\'search\',1);return false;">&lt;-- Return to search<br></a><input style="width:100%;" id="route_start" name="lifo_route_loc" type="search" placeholder="Start at x,y"><br><input style="width:100%;" id="route_destination" name="lifo_route_loc" type="search" placeholder="Go to x,y"><br><input id="route_submit" type="button" style="width:100%;" value="Go!" onclick="route(event)"><div id="route_results"></div>';
}
}
var current_sidebar = "search";
function toggle_search(type = current_sidebar, force_act = 0) {
if (el = document.getElementById('sidebar')) {
el.parentNode.removeChild(el);
if (force_act == 0 && type == current_sidebar)
return;
}
td = document.getElementById('windowtr').insertCell(0);
td.style.width = "400px";
td.style.borderRight = "1px solid black";
td.style.verticalAlign = "top";
td.id = "sidebar";
switch (type) {
case "search":
td.id = "searchbar";
td.appendChild(search_element);
document.getElementById('search_query').select();
break;
case "route":
td.appendChild(route_element);
break;
default:
alert("JS error: sidebar");
break;
}
current_sidebar = type;
document.getElementById('search_query').select();
}
function htmlEntities(str) {
@ -496,67 +452,6 @@ function search(e) {
return false;
}
var route_layer;
function route(e) // BOOKMARK
{
if (route_layer) {
mymap.removeLayer(route_layer);
}
start = document.getElementById('route_start').value;
destination = document.getElementById('route_destination').value;
if ((start == "") || (destination == "")) {
document.getElementById('route_results').innerHTML = "";
return;
}
document.getElementById('route_submit').disabled = true;
document.getElementById('route_results').innerHTML = "Loading...";
var xhttp_ps = new XMLHttpRequest();
xhttp_ps.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) {
var json = JSON.parse(xhttp_ps.responseText);
geojson = L.geoJSON(json, {
style: style_route
});
route_layer = geojson.addTo(mymap);
str = "<ol>";
last_through = "";
geojson.eachLayer( function(layer) {
if (last_through != layer.feature.properties.through) {
str += '<li><a href="#" onclick="latLng2 = L.latLng(' + layer.feature.geometry.coordinates[0][1] + ',' + layer.feature.geometry.coordinates[0][0] + '); jump_to(latLng2); return false;">' + htmlEntities(layer.feature.properties.description) + "</a></li>";
last_through = layer.feature.properties.through;
}
});
str += "</ol>";
document.getElementById('route_results').innerHTML = str;
} else {
document.getElementById('route_results').innerHTML = "No results.";
}
document.getElementById('route_submit').disabled = false;
}
};
coordstr = start + ';' + destination;
xhttp_ps.open("GET", dijkstraserv_base + coordstr, true);
xhttp_ps.send();
}
function set_route_start(latlng) {
toggle_search("route", 1);
document.getElementById('route_start').value = latlng.lat + ',' + latlng.lng;
route();
}
function set_route_destination(latlng) {
toggle_search("route", 1);
document.getElementById('route_destination').value = latlng.lat + ',' + latlng.lng;
route();
}
L.MyControl = L.Control.extend({
options: {
position: 'topleft',
@ -608,15 +503,13 @@ var baseballIcon = L.AwesomeMarkers.icon({
function onMapClick(e) {
var addinfo = "";
pos = resolve_latlng(e.latlng);
route_links = '<br><a href="#" onclick="latLng2 = L.latLng(' + pos.lng + ',' + pos.lat + '); set_route_start(latLng2); return false;">[route from here]</a>';
route_links += ' <a href="#" onclick="latLng2 = L.latLng(' + pos.lng + ',' + pos.lat + '); set_route_destination(latLng2); return false;">[route to here]</a>';
if (current_location != "")
addinfo = " (part of <a target=\"_blank\" href='" + wikiurl_base + current_location + "'>" + current_location + "</a>)";
if (current_feature) {
popup.setLatLng(e.latlng).setContent("This is " + current_feature.properties.name + addinfo + route_links).openOn(mymap);
popup.setLatLng(e.latlng).setContent("This is " + current_feature.properties.name + addinfo).openOn(mymap);
} else {
popup.setLatLng(e.latlng).setContent("You clicked the map at " + pos.lng + "," + pos.lat + addinfo + route_links).openOn(mymap);
pos = resolve_latlng(e.latlng);
popup.setLatLng(e.latlng).setContent("You clicked the map at " + pos.lng + "," + pos.lat + addinfo).openOn(mymap);
}
current_feature = null;
current_location = "";
@ -707,7 +600,5 @@ function onHashChange(e, hash=null) {
}
}
build_sidebar();
window.addEventListener("hashchange", onHashChange, false);
onHashChange(null);

@ -1 +0,0 @@
Subproject commit d7d59322c57c9154faa537d8d00e4ec2071f09fa