From 28ebc35fcb6e796a0ef2cbaf00a6bdf6176e6176 Mon Sep 17 00:00:00 2001 From: strukturart Date: Sun, 7 Jan 2024 22:56:18 +0100 Subject: [PATCH] select polyline --- application/assets/css/main.css | 46 ++++++ application/assets/js/maps.js | 2 +- application/assets/js/module.js | 47 +++++- application/assets/js/overpass.js | 249 ++++++++++++++++++++---------- application/index.html | 23 ++- application/index.js | 14 +- application/manifest.webapp | 2 +- application/manifest.webmanifest | 2 +- docs/assets/css/main.css | 46 ++++++ docs/assets/js/maps.js | 2 +- docs/assets/js/module.js | 37 ++++- docs/assets/js/overpass.js | 201 ++++++++++++++++-------- docs/index.html | 23 ++- docs/index.js | 14 +- docs/manifest.webapp | 2 +- docs/manifest.webmanifest | 2 +- 16 files changed, 540 insertions(+), 172 deletions(-) diff --git a/application/assets/css/main.css b/application/assets/css/main.css index 96c3bd06..4fa88b94 100644 --- a/application/assets/css/main.css +++ b/application/assets/css/main.css @@ -682,6 +682,52 @@ div#intro div#intro-footer { left: 0px; } +/*/////////////////////////// +///LOADING////////////////*/ + +.loading-spinner { + display: none; + position: fixed; + width: 80px; + height: 80px; + top: 50%; + left: 50%; + margin-left: -40px; + margin-top: -40px; + + z-index: 5000000; +} +.loading-spinner div { + box-sizing: border-box; + display: block; + position: absolute; + width: 64px; + height: 64px; + margin: 8px; + border: 8px solid rgb(126, 11, 11); + border-radius: 50%; + animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; + border-color: rgb(238, 27, 27) transparent transparent transparent; +} +.loading-spinner div:nth-child(1) { + animation-delay: -0.45s; +} +.loading-spinner div:nth-child(2) { + animation-delay: -0.3s; +} +.loading-spinner div:nth-child(3) { + animation-delay: -0.15s; +} + +@keyframes lds-ring { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} + /*/ ////////////////////////// ///FINDER////////////////*/ diff --git a/application/assets/js/maps.js b/application/assets/js/maps.js index 5b5cc235..0acd65ad 100644 --- a/application/assets/js/maps.js +++ b/application/assets/js/maps.js @@ -221,7 +221,7 @@ const maps = (() => { let addMap = function (url, attribution, max_zoom, type, marker) { console.log(general.active_layer); if (attribution == null) attribution = ""; - if (max_zoom == null) max_zoom = 12; + if (max_zoom == null) max_zoom = 17; //remove layer if (url == "") { if (map.hasLayer(tilesLayer)) { diff --git a/application/assets/js/module.js b/application/assets/js/module.js index cf6b94a7..cfa75a44 100644 --- a/application/assets/js/module.js +++ b/application/assets/js/module.js @@ -386,7 +386,6 @@ const module = (() => { let select_marker = function () { index++; let markers_collection = []; //makers in map boundingbox - let polyline_collection = []; // Reset contained list overpass_group.eachLayer(function (l) { @@ -403,6 +402,13 @@ const module = (() => { } }); + selected_polyline_markers_group.eachLayer(function (l) { + // Check if the layer is a marker and not already in markers_collection + if (l instanceof L.Marker && markers_collection.indexOf(l) === -1) { + markers_collection.push(l); + } + }); + status.marker_selection = true; status.windowOpen = "marker"; @@ -413,6 +419,7 @@ const module = (() => { //show selected marker map.setView(markers_collection[index].getLatLng()); + console.log(markers_collection[index]); //popup document.querySelector("input#popup").value = ""; @@ -463,16 +470,42 @@ const module = (() => { } }); - if (index_polyline >= polyline_collection.length) index = 0; + if (index_polyline >= polyline_collection.length) index_polyline = 0; + let hh = polyline_collection[index_polyline]; + selected_polyline_markers_group.clearLayers(); //show selected marker - let i = polyline_collection[index_polyline].getLatLngs(); - console.log(polyline_collection[index_polyline]); + try { + let pu = polyline_collection[index_polyline].getPopup(); + + if (pu != undefined && pu._content != undefined) { + //get popup content + document.querySelector("input#popup").value = pu._content; + //show popup + + polyline_collection[index_polyline].openPopup(); + //close popup + setTimeout(function () { + polyline_collection[index_polyline].closePopup(); + }, 5000); + } - // Check if the polyline has a popup - var popup = polyline_collection[index_polyline]; + map.setView(polyline_collection[index_polyline].getCenter()); - map.setView(i[0]); + // console.log(polyline_collection[index_polyline].markers); + /* + hh.getLatLngs().forEach((e) => { + L.marker(e) + .addTo(selected_polyline_markers_group) + .setIcon(maps.public_transport); + });*/ + + polyline_collection[index_polyline].markers.forEach((e) => { + L.marker(e.latlng) + .addTo(selected_polyline_markers_group) + .setIcon(maps.public_transport); + }); + } catch (e) {} return polyline_collection[index]; }; diff --git a/application/assets/js/overpass.js b/application/assets/js/overpass.js index d2622a52..d18dbc12 100644 --- a/application/assets/js/overpass.js +++ b/application/assets/js/overpass.js @@ -21,19 +21,15 @@ const overpass = (() => { function call(map, overpassQuery, icon) { //clear group before ad new items - if (general.zoomlevel > 13) { - helper.side_toaster( - "Please zoom, otherwise too much data will be loaded", - 2000 - ); - return false; - } + let public_transport = false; let relation_query = "[" + overpassQuery + "]"; - let way_query = overpassQuery; + let way_query = "[" + overpassQuery + "]"; + let node_query = "[" + overpassQuery + "]"; if (overpassQuery.indexOf("public_transport") > -1) { + node_query = "['public_transport'='stop_position']['bus'='yes']"; relation_query = "['type'='route']['route'='bus']"; - way_query = "public_transport=platform"; + way_query = "['public_transport'='stop_platform']['bus'='yes']"; public_transport = true; } @@ -43,7 +39,6 @@ const overpass = (() => { overpass_group.eachLayer(function (layer) { if (layer.tag === overpassQuery) { - console.log("try"); overpass_group.removeLayer(layer._leaflet_id); } }); @@ -63,94 +58,190 @@ const overpass = (() => { let s = map.getBounds().getSouth(); var bounds = s + "," + w + "," + n + "," + e; - var nodeQuery = "(node[" + overpassQuery + "](" + bounds + ");"; - var wayQuery = "way[" + way_query + "](" + bounds + ");"; + var nodeQuery = "(node" + node_query + "(" + bounds + ");"; + var wayQuery = "way" + way_query + "(" + bounds + ");"; var relationQuery = "relation" + relation_query + "(" + bounds + ");)"; var query = "?data=[out:json][timeout:25];" + nodeQuery + wayQuery + relationQuery + - ";out;>;out skel%3b"; + ";out body;>;out skel%3b"; var baseUrl = "https://overpass-api.de/api/interpreter"; var resultUrl = baseUrl + query; let segmentCoords = []; - let history = ""; - fetch(resultUrl) - .then((response) => response.json()) - .then(function (data) { - let no_data = false; - data.elements.forEach((element) => { - // console.log(element); - if (element.type == "node" && !public_transport) { - no_data = true; - let k = L.marker([element.lat, element.lon]) - .addTo(overpass_group) - .setIcon(maps[icon]); - - k.tag = overpassQuery; - try { - k.bindPopup(element.tags.name); - } catch (e) {} - } + let segmentCoordsMarker = []; + function fetchDataWithXHR(resultUrl, callback, errorCallback) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", resultUrl, true); + xhr.responseType = "json"; + + var timeoutId; // Variable to store the timeout ID + + // Set up a function to handle the timeout event + // Set up a one-time timeout using setTimeout + timeoutId = setTimeout(function () { + xhr.abort(); + document.querySelector(".loading-spinner").style.display = "none"; + helper.side_toaster("Too much data, loading was aborted", 6000); + }, 20000); // Set the timeout duration in milliseconds + + xhr.onload = function () { + if (xhr.status === 200) { + callback(xhr.response); + clearInterval(timeoutId); // Clear the interval if the request is successful + } else { + errorCallback( + new Error(`Failed to fetch: ${xhr.status} ${xhr.statusText}`) + ); + } + }; - if (element.type == "way" && !public_transport) { - no_data = true; - } + xhr.onprogress = function (event) { + document.querySelector(".loading-spinner").style.display = "block"; + + if (event.lengthComputable) { + // If total size is known, you can calculate the progress percentage + var progress = (event.loaded / event.total) * 100; + console.log(`Download Progress: ${progress}% (${event.loaded})`); + } else { + // If total size is not known, just track the downloaded size + downloadedSize = event.loaded / (1024 * 1024); // Convert bytes to megabytes + console.log(`Downloaded Size: ${downloadedSize} megabytes`); + } + }; + + xhr.onerror = function () { + errorCallback(new Error("Network error occurred")); + document.querySelector(".loading-spinner").style.display = "none"; + clearTimeout(timeoutId); // Clear the timeout if there is an error + }; + + xhr.send(); + } + + fetchDataWithXHR( + resultUrl, + function (data) { + if (data.elements.length === 0) { + helper.side_toaster("no data", 4000); + document.querySelector(".loading-spinner").style.display = "none"; + document.activeElement.classList.remove(""); + return false; + } + + if (data.elements.length > 80000) { + helper.side_toaster( + "There is too much data to process, please use a different zoom level", + 6000 + ); + document.querySelector(".loading-spinner").style.display = "none"; + } else { + // console.log(data); + + for (let i = 0; i < data.elements.length; i++) { + const element = data.elements[i]; + + if (element.type === "node" && !public_transport) { + let k = L.marker([element.lat, element.lon]) + .addTo(overpass_group) + .setIcon(maps[icon]); + + k.tag = overpassQuery; + try { + k.bindPopup(element.tags.name); + } catch (e) {} + } + + if (element.type === "way" && !public_transport) { + // Your logic for ways + } + + if (element.type === "way" && public_transport) { + // if (element.tags.name) console.log(element); + } + + //public transport + if (element.type === "relation" && public_transport) { + let f = element; + + // + element.members.forEach((e, index) => { + //get nodes of memebers + //get name of stops + + let relation_name = + f.tags.name !== undefined && f.tags.name !== null + ? f.tags.name + : ""; + + let color = + f.tags.colour !== undefined && f.tags.colour !== null + ? f.tags.colour + : generateRandomColor(); + + let m = data.elements.find((m) => m.id === e.ref); + + if (m && m.type === "node") { + segmentCoordsMarker.push({ + id: m.id, + latlng: [m.lat, m.lon], + }); + } + + if (m && m.type === "way") { + m.nodes.forEach((e) => { + let m = data.elements.find((m) => m.id === e); + + segmentCoords.push({ + id: m.id, + latlng: [m.lat, m.lon], + color: color, + name: relation_name, + }); + }); + } - if (element.type == "relation" && public_transport) { - no_data = true; - let f = element; - element.members.forEach((e) => { - //console.log(e.ref); - data.elements.forEach((m) => { - if (m.id == e.ref) { - if (m.type == "node") { - // console.log(f.tags.name); - let k = L.marker([m.lat, m.lon]) - .addTo(overpass_group) - .setIcon(maps[icon]); - - k.tag = overpassQuery; - - try { - k.bindPopup(f.tags.name); - } catch (e) {} - - segmentCoords.push([m.lat, m.lon]); - - //draw line and reset - if (f.id != history) { - segmentCoords.pop(); - let h = L.polyline(segmentCoords, { - color: generateRandomColor(), - }); - - h.tag = overpassQuery; - h.name = "test"; - - h.addTo(overpass_group); - segmentCoords = []; + if (index === element.members.length - 1) { + let h = L.polyline( + segmentCoords.map((coord) => coord.latlng), + { + color: color, + weight: 4, } + ); + + var popup = L.popup({ + maxWidth: "80%", + }); - history = f.id; - } + popup.setContent(relation_name); + + h.bindPopup(popup); + h.tag = overpassQuery; + h.markers = segmentCoordsMarker; + + h.addTo(overpass_group); + segmentCoords = []; + segmentCoordsMarker = []; } }); - }); + } } - }); - - if (!no_data) { - helper.side_toaster("no data", 4000); - } else { - helper.side_toaster("layer loaded", 2000); + helper.side_toaster( + "You can select the line with key 0 and the stops with key 3", + 6000 + ); + document.querySelector(".loading-spinner").style.display = "none"; } - }) - .catch(function (err) { + }, + function (err) { + document.querySelector(".loading-spinner").style.display = "none"; + helper.side_toaster("something went wrong, try again" + err, 6000); - }); + } + ); } return { diff --git a/application/index.html b/application/index.html index 8e98cabc..62be4f94 100644 --- a/application/index.html +++ b/application/index.html @@ -49,6 +49,13 @@
+
+
+
+
+
+
+ +
+
+
during tracking,
upload /5 min to osm aacount
+
longpress 1
+
+
+
during tracking,
larger view of the parameters
@@ -727,6 +741,13 @@

Instructions

+
+
+
jump between linies
+
0
+
+
+
keylock
@@ -751,7 +772,7 @@

Instructions

share your position
-
0
+
3
diff --git a/application/index.js b/application/index.js index a828da8e..d7a2591e 100644 --- a/application/index.js +++ b/application/index.js @@ -6,6 +6,7 @@ const debug = false; //groups let markers_group = new L.FeatureGroup(); +let selected_polyline_markers_group = new L.FeatureGroup(); let overpass_group = new L.FeatureGroup(); let measure_group_path = new L.FeatureGroup(); let measure_group = new L.FeatureGroup(); @@ -76,7 +77,7 @@ let general = { ? localStorage.getItem("openstreetmap_token") : "", step: 0.001, - zoomlevel: 12, + zoomlevel: 18, measurement_unit: "km", active_item: "", active_layer: [], @@ -414,6 +415,7 @@ document.addEventListener("DOMContentLoaded", function () { map.addLayer(gpx_group); map.addLayer(geoJSON_group); map.addLayer(hotline_group); + map.addLayer(selected_polyline_markers_group); jsonLayer.addTo(map); @@ -424,6 +426,8 @@ document.addEventListener("DOMContentLoaded", function () { general.last_map_type ); + console.log(general); + //get files and store // Function to remove duplicates based on the 'name' property @@ -881,7 +885,6 @@ document.addEventListener("DOMContentLoaded", function () { }; let open_finder = function () { - console.log(overpass_group); settings.load_settings(); finder_tabindex(); document.querySelector("div#finder").style.display = "block"; @@ -2683,6 +2686,12 @@ document.addEventListener("DOMContentLoaded", function () { break; + case "3": + if (status.windowOpen == "map") { + mozactivity.share_position(); + } + break; + case "4": if (status.windowOpen == "map") { auto_update_view(); @@ -2732,7 +2741,6 @@ document.addEventListener("DOMContentLoaded", function () { case "0": if (status.windowOpen == "map") { - //mozactivity.share_position(); module.select_polyline(); } break; diff --git a/application/manifest.webapp b/application/manifest.webapp index fd0c2163..b4c46c19 100644 --- a/application/manifest.webapp +++ b/application/manifest.webapp @@ -1,5 +1,5 @@ { - "version": "1.9.777", + "version": "1.9.782", "version_name": "hotline", "name": "o.map", "description": "O.map, your ultimate navigation companion for KaiOS-powered devices. O.map is a lightweight and feature-rich map application designed specifically for KaiOS, enabling you to explore and navigate the world with ease. Whether you're a local resident, a tourist, or an adventurer, O.map is here to enhance your journey and keep you on the right track.", diff --git a/application/manifest.webmanifest b/application/manifest.webmanifest index 3e228f75..b2ffc351 100644 --- a/application/manifest.webmanifest +++ b/application/manifest.webmanifest @@ -21,7 +21,7 @@ ], "b2g_features": { - "version": "2.0.86", + "version": "2.0.87", "id": "o.map", "core": true, "categories": ["utilities"], diff --git a/docs/assets/css/main.css b/docs/assets/css/main.css index 96c3bd06..4fa88b94 100644 --- a/docs/assets/css/main.css +++ b/docs/assets/css/main.css @@ -682,6 +682,52 @@ div#intro div#intro-footer { left: 0px; } +/*/////////////////////////// +///LOADING////////////////*/ + +.loading-spinner { + display: none; + position: fixed; + width: 80px; + height: 80px; + top: 50%; + left: 50%; + margin-left: -40px; + margin-top: -40px; + + z-index: 5000000; +} +.loading-spinner div { + box-sizing: border-box; + display: block; + position: absolute; + width: 64px; + height: 64px; + margin: 8px; + border: 8px solid rgb(126, 11, 11); + border-radius: 50%; + animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; + border-color: rgb(238, 27, 27) transparent transparent transparent; +} +.loading-spinner div:nth-child(1) { + animation-delay: -0.45s; +} +.loading-spinner div:nth-child(2) { + animation-delay: -0.3s; +} +.loading-spinner div:nth-child(3) { + animation-delay: -0.15s; +} + +@keyframes lds-ring { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} + /*/ ////////////////////////// ///FINDER////////////////*/ diff --git a/docs/assets/js/maps.js b/docs/assets/js/maps.js index 5b5cc235..0acd65ad 100644 --- a/docs/assets/js/maps.js +++ b/docs/assets/js/maps.js @@ -221,7 +221,7 @@ const maps = (() => { let addMap = function (url, attribution, max_zoom, type, marker) { console.log(general.active_layer); if (attribution == null) attribution = ""; - if (max_zoom == null) max_zoom = 12; + if (max_zoom == null) max_zoom = 17; //remove layer if (url == "") { if (map.hasLayer(tilesLayer)) { diff --git a/docs/assets/js/module.js b/docs/assets/js/module.js index 95917828..70c6d501 100644 --- a/docs/assets/js/module.js +++ b/docs/assets/js/module.js @@ -403,6 +403,13 @@ const module = (() => { } }); + selected_polyline_markers_group.eachLayer(function (l) { + // Check if the layer is a marker and not already in markers_collection + if (l instanceof L.Marker && markers_collection.indexOf(l) === -1) { + markers_collection.push(l); + } + }); + status.marker_selection = true; status.windowOpen = "marker"; @@ -463,12 +470,34 @@ const module = (() => { } }); - if (index_polyline >= polyline_collection.length) index = 0; + if (index_polyline >= polyline_collection.length) index_polyline = 0; + let hh = polyline_collection[index_polyline]; + selected_polyline_markers_group.clearLayers(); //show selected marker - let i = polyline_collection[index]; - console.log(polyline_collection); - // map.setView(i[0]); + try { + let pu = polyline_collection[index_polyline].getPopup(); + + if (pu != undefined && pu._content != undefined) { + //get popup content + document.querySelector("input#popup").value = pu._content; + //show popup + + polyline_collection[index_polyline].openPopup(); + //close popup + setTimeout(function () { + polyline_collection[index_polyline].closePopup(); + }, 5000); + } + + map.setView(polyline_collection[index_polyline].getCenter()); + + hh.getLatLngs().forEach((e) => { + L.marker(e) + .addTo(selected_polyline_markers_group) + .setIcon(maps.public_transport); + }); + } catch (e) {} return polyline_collection[index]; }; diff --git a/docs/assets/js/overpass.js b/docs/assets/js/overpass.js index 38935539..6d005abd 100644 --- a/docs/assets/js/overpass.js +++ b/docs/assets/js/overpass.js @@ -21,13 +21,7 @@ const overpass = (() => { function call(map, overpassQuery, icon) { //clear group before ad new items - if (general.zoomlevel > 13) { - helper.side_toaster( - "Please zoom, otherwise too much data will be loaded", - 2000 - ); - return false; - } + let public_transport = false; let relation_query = "[" + overpassQuery + "]"; let way_query = overpassQuery; @@ -77,79 +71,150 @@ const overpass = (() => { let segmentCoords = []; let history = ""; - fetch(resultUrl) - .then((response) => response.json()) - .then(function (data) { - let no_data = false; - data.elements.forEach((element) => { - // console.log(element); - if (element.type == "node" && !public_transport) { - no_data = true; - let k = L.marker([element.lat, element.lon]) - .addTo(overpass_group) - .setIcon(maps[icon]); - - k.tag = overpassQuery; - try { - k.bindPopup(element.tags.name); - } catch (e) {} - } + function fetchDataWithXHR(resultUrl, callback, errorCallback) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", resultUrl, true); + xhr.responseType = "json"; + + var timeoutId; // Variable to store the timeout ID + + // Set up a function to handle the timeout event + // Set up a one-time timeout using setTimeout + timeoutId = setTimeout(function () { + xhr.abort(); + document.querySelector(".loading-spinner").style.display = "none"; + helper.side_toaster("Too much data, loading was aborted", 6000); + }, 20000); // Set the timeout duration in milliseconds + + xhr.onload = function () { + if (xhr.status === 200) { + callback(xhr.response); + clearInterval(timeoutId); // Clear the interval if the request is successful + } else { + errorCallback( + new Error(`Failed to fetch: ${xhr.status} ${xhr.statusText}`) + ); + } + }; - if (element.type == "way" && !public_transport) { - no_data = true; - } + xhr.onprogress = function (event) { + document.querySelector(".loading-spinner").style.display = "block"; + + if (event.lengthComputable) { + // If total size is known, you can calculate the progress percentage + var progress = (event.loaded / event.total) * 100; + console.log(`Download Progress: ${progress}% (${event.loaded})`); + } else { + // If total size is not known, just track the downloaded size + downloadedSize = event.loaded / (1024 * 1024); // Convert bytes to megabytes + console.log(`Downloaded Size: ${downloadedSize} megabytes`); + } + }; + + xhr.onerror = function () { + errorCallback(new Error("Network error occurred")); + document.querySelector(".loading-spinner").style.display = "none"; + clearTimeout(timeoutId); // Clear the timeout if there is an error + }; + + xhr.send(); + } + + fetchDataWithXHR( + resultUrl, + function (data) { + if (data.elements.length === 0) { + helper.side_toaster("no data", 4000); + document.querySelector(".loading-spinner").style.display = "none"; + document.activeElement.classList.remove(""); + return false; + } - if (element.type == "relation" && public_transport) { - no_data = true; - let f = element; - element.members.forEach((e) => { - //console.log(e.ref); - data.elements.forEach((m) => { - if (m.id == e.ref) { - if (m.type == "node") { - // console.log(f.tags.name); - let k = L.marker([m.lat, m.lon]) - .addTo(overpass_group) - .setIcon(maps[icon]); - - k.tag = overpassQuery; - - try { - k.bindPopup(f.tags.name); - } catch (e) {} - - segmentCoords.push([m.lat, m.lon]); - - //draw line and reset - if (f.id != history) { - segmentCoords.pop(); - let h = L.polyline(segmentCoords, { + if (data.elements.length > 80000) { + helper.side_toaster( + "There is too much data to process, please use a different zoom level", + 6000 + ); + document.querySelector(".loading-spinner").style.display = "none"; + } else { + for (let i = 0; i < data.elements.length; i++) { + const element = data.elements[i]; + + // Your existing logic here + if (element.type === "node" && !public_transport) { + let k = L.marker([element.lat, element.lon]) + .addTo(overpass_group) + .setIcon(maps[icon]); + + k.tag = overpassQuery; + try { + k.bindPopup(element.tags.name); + } catch (e) {} + } + + if (element.type === "way" && !public_transport) { + // Your logic for ways + } + + if (element.type === "relation" && public_transport) { + let f = element; + + element.members.forEach((e) => { + let m = data.elements.find((m) => m.id === e.ref); + + let hh = ""; + try { + hh = m.tags.name; + } catch (e) {} + + if (m && m.type === "way") { + } + + if (m && m.type === "node") { + //todo add tags.name as popoup + segmentCoords.push({ + latlng: [m.lat, m.lon], + popup: hh, + }); + + if (f.id !== history) { + segmentCoords.pop(); + let h = L.polyline( + segmentCoords.map((coord) => coord.latlng), + { color: generateRandomColor(), - }); + } + ); - h.tag = overpassQuery; + var popup = L.popup({ + maxWidth: "80%", + }); - h.addTo(overpass_group); - segmentCoords = []; - } + popup.setContent(f.tags.name); - history = f.id; + h.bindPopup(popup); + h.tag = overpassQuery; + + h.addTo(overpass_group); + segmentCoords = []; } + + history = f.id; } }); - }); + } } - }); - - if (!no_data) { - helper.side_toaster("no data", 4000); - } else { - helper.side_toaster("layer loaded", 2000); + helper.side_toaster( + "You can select the line with key 0 and the stops with key 3", + 6000 + ); + document.querySelector(".loading-spinner").style.display = "none"; } - }) - .catch(function (err) { + }, + function (err) { helper.side_toaster("something went wrong, try again" + err, 6000); - }); + } + ); } return { diff --git a/docs/index.html b/docs/index.html index 8e98cabc..62be4f94 100644 --- a/docs/index.html +++ b/docs/index.html @@ -49,6 +49,13 @@
+
+
+
+
+
+
+
+
+
+
during tracking,
upload /5 min to osm aacount
+
longpress 1
+
+
+
during tracking,
larger view of the parameters
@@ -727,6 +741,13 @@

Instructions

+
+
+
jump between linies
+
0
+
+
+
keylock
@@ -751,7 +772,7 @@

Instructions

share your position
-
0
+
3
diff --git a/docs/index.js b/docs/index.js index a828da8e..d7a2591e 100644 --- a/docs/index.js +++ b/docs/index.js @@ -6,6 +6,7 @@ const debug = false; //groups let markers_group = new L.FeatureGroup(); +let selected_polyline_markers_group = new L.FeatureGroup(); let overpass_group = new L.FeatureGroup(); let measure_group_path = new L.FeatureGroup(); let measure_group = new L.FeatureGroup(); @@ -76,7 +77,7 @@ let general = { ? localStorage.getItem("openstreetmap_token") : "", step: 0.001, - zoomlevel: 12, + zoomlevel: 18, measurement_unit: "km", active_item: "", active_layer: [], @@ -414,6 +415,7 @@ document.addEventListener("DOMContentLoaded", function () { map.addLayer(gpx_group); map.addLayer(geoJSON_group); map.addLayer(hotline_group); + map.addLayer(selected_polyline_markers_group); jsonLayer.addTo(map); @@ -424,6 +426,8 @@ document.addEventListener("DOMContentLoaded", function () { general.last_map_type ); + console.log(general); + //get files and store // Function to remove duplicates based on the 'name' property @@ -881,7 +885,6 @@ document.addEventListener("DOMContentLoaded", function () { }; let open_finder = function () { - console.log(overpass_group); settings.load_settings(); finder_tabindex(); document.querySelector("div#finder").style.display = "block"; @@ -2683,6 +2686,12 @@ document.addEventListener("DOMContentLoaded", function () { break; + case "3": + if (status.windowOpen == "map") { + mozactivity.share_position(); + } + break; + case "4": if (status.windowOpen == "map") { auto_update_view(); @@ -2732,7 +2741,6 @@ document.addEventListener("DOMContentLoaded", function () { case "0": if (status.windowOpen == "map") { - //mozactivity.share_position(); module.select_polyline(); } break; diff --git a/docs/manifest.webapp b/docs/manifest.webapp index fd0c2163..b4c46c19 100644 --- a/docs/manifest.webapp +++ b/docs/manifest.webapp @@ -1,5 +1,5 @@ { - "version": "1.9.777", + "version": "1.9.782", "version_name": "hotline", "name": "o.map", "description": "O.map, your ultimate navigation companion for KaiOS-powered devices. O.map is a lightweight and feature-rich map application designed specifically for KaiOS, enabling you to explore and navigate the world with ease. Whether you're a local resident, a tourist, or an adventurer, O.map is here to enhance your journey and keep you on the right track.", diff --git a/docs/manifest.webmanifest b/docs/manifest.webmanifest index 3e228f75..b2ffc351 100644 --- a/docs/manifest.webmanifest +++ b/docs/manifest.webmanifest @@ -21,7 +21,7 @@ ], "b2g_features": { - "version": "2.0.86", + "version": "2.0.87", "id": "o.map", "core": true, "categories": ["utilities"],