summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Koch <markus@notsyncing.net>2021-02-26 20:08:42 +0100
committerMarkus Koch <markus@notsyncing.net>2021-02-26 20:08:42 +0100
commit8a4a455e05015c3b1cf007b75798aa1ee5aee6b6 (patch)
tree27f6fb3a7ce6054ed4aed83e784858c2df7f7846
parent1bd7cb11602121dda9a7966ca18755fd9fa2287a (diff)
downloadlifomapserver-8a4a455e05015c3b1cf007b75798aa1ee5aee6b6.tar.gz
lifomapserver-8a4a455e05015c3b1cf007b75798aa1ee5aee6b6.tar.bz2
lifomapserver-8a4a455e05015c3b1cf007b75798aa1ee5aee6b6.zip
htdocs: Add trainline support
-rw-r--r--htdocs/mapscript.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/htdocs/mapscript.js b/htdocs/mapscript.js
index a27ee10..515ac83 100644
--- a/htdocs/mapscript.js
+++ b/htdocs/mapscript.js
@@ -95,6 +95,14 @@ var style_outlines = {
var style_streets = {
};
+var style_trains = {
+ color: "yellow"
+ };
+
+var style_tech = {
+ color: "red"
+ };
+
var style_route = {
radius: 8,
fillColor: "#00ff00",
@@ -206,9 +214,12 @@ function load_geojson(name, url, geotype, iconcolor, active=1, style={}) {
switch (geotype) {
case "street":
+ case "train":
onEachFeature = function(feature, layer) {
layer.myTag = geotype;
layer.myName = name;
+ if (geotype == "train")
+ layer.no_search = true
layer.on("click", function (e) {
current_feature = feature;
});
@@ -387,7 +398,11 @@ function build_sidebar() {
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>';
+ route_element.innerHTML = '<a href="#" onclick="toggle_search(\'search\',1);return false;">&lt;-- Return to search<br><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 type="checkbox" name="use_trains" id="use_trains" value="trains" checked disabled=true><label for="use_trains"> Use trains (only S12)</label><br>\
+ <input id="route_submit" type="button" style="width:100%;" value="Go!" onclick="route(event)"><div id="route_results"></div>';
}
}
@@ -451,6 +466,8 @@ function search(e) {
for (key in layers._layers[i].layer._layers) {
item = layers._layers[i].layer._layers[key];
+ if (item.hasOwnProperty("no_search"))
+ break;
switch (item.feature.geometry.type) {
case "Point":
regex = new RegExp(query, 'i');
@@ -533,7 +550,7 @@ function route(e) // BOOKMARK
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>";
+ 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).replace('[T]', '🚆️') + "</a></li>";
last_through = layer.feature.properties.through;
}
});