diff --git a/frontend/js/main.js b/frontend/js/main.js index 7243047..7e59ec0 100644 --- a/frontend/js/main.js +++ b/frontend/js/main.js @@ -4897,13 +4897,26 @@ async function shareRideContext() { let segs = buildRoadSegments(await DB.getRoadPoints()); roads = segs.map(s => ({ p: s.pts.map(q => [r5(q.lat), r5(q.lon)]), t: s.atype || "b" })); } catch (e) {} + // POI near the ride only (bbox of route+track + margin) — the full set is too big to send. + let pois = []; + try { + let all = await POI.load(); + let bpts = track.concat(route); + if (all && all.length && bpts.length) { + let minLa = 1e9, maxLa = -1e9, minLo = 1e9, maxLo = -1e9; + for (let p of bpts) { if (p[0] < minLa) minLa = p[0]; if (p[0] > maxLa) maxLa = p[0]; if (p[1] < minLo) minLo = p[1]; if (p[1] > maxLo) maxLo = p[1]; } + minLa -= 0.05; maxLa += 0.05; minLo -= 0.07; maxLo += 0.07; // ~5 km margin + pois = all.filter(p => p.la >= minLa && p.la <= maxLa && p.lo >= minLo && p.lo <= maxLo) + .map(p => ({ la: r5(p.la), lo: r5(p.lo), c: p.c, n: p.n })); + } + } catch (e) {} showToast("Отдаю смотрящему..."); try { let raw = await window.__TAURI__.core.invoke("http_request", { - url: shareUrl, method: "POST", body: JSON.stringify({ token, route, roads, track }) + url: shareUrl, method: "POST", body: JSON.stringify({ token, route, roads, track, pois }) }); let res = JSON.parse(raw || "{}"); - if (res.ok) showToast(`Отдано: маршрут ${route.length}, дороги ${roads.length}, трек ${track.length}`); + if (res.ok) showToast(`Отдано: маршрут ${route.length}, дороги ${roads.length}, трек ${track.length}, POI ${pois.length}`); else appAlert("Не отдалось: " + (res.error || "ошибка")); } catch (e) { appAlert("Не отдалось: " + (e.message || e)); } } diff --git a/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking-adventure.brf b/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking-adventure.brf index 73e06f1..fb3d4ae 100644 --- a/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking-adventure.brf +++ b/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking-adventure.brf @@ -137,6 +137,25 @@ assign adventurepenalty = if allow_adventure then 0 else add ( if ford=yes|stepping_stones then 10000 else 0 ) ( if or tracktype=grade5 trail_visibility=bad|horrible|no then 5000 else 0 ) +# NB: avoidance by estimated_river_class was tried and dropped — it flags riverside ways too, +# not only crossings, so it forced 5x detours. Untagged fords are SHOWN instead (wetcross on +# the preview) and will be handled by manual ground-truth marks. + +# Surface cost (approved ranking, singlespeed): asphalt < compacted < grunтовka(ground/dirt/ +# earth/soil) < cobblestone/sett < gravel(all) < clay < grass/wood < sand/mud(avoid). Added to +# costfactor so a dirt track beats a gravel one of the same tracktype. +# canonical lookup values only (aliases fold into them: paved=bricks/brick/chipseal, +# concrete=cement, ground=soil, cobblestone=unhewn_cobblestone, grass=artificial_turf). +assign surfacepenalty = + if surface=asphalt|concrete|paved|paving_stones then 0.0 + else if surface=compacted then 0.2 + else if surface=ground|dirt|earth then 0.4 + else if surface=cobblestone|sett then 0.6 + else if surface=gravel|fine_gravel|pebblestone|unpaved then 0.9 + else if surface=clay then 1.3 + else if surface=grass|grass_paver|wood then 1.5 + else if surface=sand|mud then 5.0 + else 0.0 assign initialcost = if ( equal initialclassifier classifier_ferry ) then 10000 @@ -308,6 +327,7 @@ assign costfactor add noise_penalty add traffic_penalty add adventurepenalty + add surfacepenalty # # apply oneway-and access-penalties diff --git a/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking.brf b/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking.brf index 45b59f5..1635ad4 100644 --- a/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking.brf +++ b/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking.brf @@ -137,6 +137,25 @@ assign adventurepenalty = if allow_adventure then 0 else add ( if ford=yes|stepping_stones then 10000 else 0 ) ( if or tracktype=grade5 trail_visibility=bad|horrible|no then 5000 else 0 ) +# NB: avoidance by estimated_river_class was tried and dropped — it flags riverside ways too, +# not only crossings, so it forced 5x detours. Untagged fords are SHOWN instead (wetcross on +# the preview) and will be handled by manual ground-truth marks. + +# Surface cost (approved ranking, singlespeed): asphalt < compacted < grunтовka(ground/dirt/ +# earth/soil) < cobblestone/sett < gravel(all) < clay < grass/wood < sand/mud(avoid). Added to +# costfactor so a dirt track beats a gravel one of the same tracktype. +# canonical lookup values only (aliases fold into them: paved=bricks/brick/chipseal, +# concrete=cement, ground=soil, cobblestone=unhewn_cobblestone, grass=artificial_turf). +assign surfacepenalty = + if surface=asphalt|concrete|paved|paving_stones then 0.0 + else if surface=compacted then 0.2 + else if surface=ground|dirt|earth then 0.4 + else if surface=cobblestone|sett then 0.6 + else if surface=gravel|fine_gravel|pebblestone|unpaved then 0.9 + else if surface=clay then 1.3 + else if surface=grass|grass_paver|wood then 1.5 + else if surface=sand|mud then 5.0 + else 0.0 assign initialcost = if ( equal initialclassifier classifier_ferry ) then 10000 @@ -308,6 +327,7 @@ assign costfactor add noise_penalty add traffic_penalty add adventurepenalty + add surfacepenalty # # apply oneway-and access-penalties diff --git a/tools/brouter-web-staging/brouter-web/baldav-custom.js b/tools/brouter-web-staging/brouter-web/baldav-custom.js new file mode 100644 index 0000000..2d2786e --- /dev/null +++ b/tools/brouter-web-staging/brouter-web/baldav-custom.js @@ -0,0 +1,528 @@ +(function () { + var LS_DARK = "baldav_bw_dark"; + function isDark() { try { return localStorage.getItem(LS_DARK) === "1"; } catch (e) { return false; } } + + // Inject the dark rules as a