Dashboard overlay (Overlays → Live → Dashboard): one inclinometer (compass ring, roll and pitch), speed, the speed limit with an over-limit warning and, on the route, the next limit change, traffic signal, maneuver and its lanes; /api/route gains speed_limits, signals and lanes, POST /api/road gives the driven road's limit; GNSS simulation (random trips over Valhalla) for trying it without the car; the HMC5883L heading in can.json
This commit is contained in:
1 parent
5958ffd153
commit
190a8ad334
13 files changed
+713
-27
No files matched your search
+14
-3
@@ -1,6 +1,6 @@
|
||||
import { Marker } from "/vendor/maplibre-gl/maplibre-gl.mjs";
|
||||
import { ROUTE_ICON, POSITION_ICON, SAVED_POINT_ICON, REVERSE_ICON, CLEAR_ICON, SAVE_ICON } from "/js/icons.js";
|
||||
import { notifySidePanelOpen, onlyOneSidePanelOpen, notifyGpxStoreChanged, onRoutePoint, onRouteEdit } from "/js/panels.js";
|
||||
import { notifySidePanelOpen, onlyOneSidePanelOpen, notifyGpxStoreChanged, onRoutePoint, onRouteEdit, notifyRouteChanged } from "/js/panels.js";
|
||||
import { isLoggedIn } from "/js/auth.js";
|
||||
import { wirePreview } from "/js/preview.js";
|
||||
import { elevationAt } from "/js/dem.js";
|
||||
@@ -268,6 +268,7 @@ export class RoutePanelControl {
|
||||
|
||||
_showResult(route, message) {
|
||||
this._draw();
|
||||
notifyRouteChanged(route);
|
||||
this._saveButton.hidden = !route || !isLoggedIn();
|
||||
this._directions.hidden = !route;
|
||||
this._profileButton.hidden = true;
|
||||
@@ -359,7 +360,9 @@ export class RoutePanelControl {
|
||||
});
|
||||
}
|
||||
|
||||
const data = { type: "FeatureCollection", features: this._route ? [this._route] : [] };
|
||||
// the traffic signals on it as points next to the line
|
||||
const signals = (this._route?.properties.signals || []).map(([lon, lat]) => ({ type: "Feature", geometry: { type: "Point", coordinates: [lon, lat] }, properties: {} }));
|
||||
const data = { type: "FeatureCollection", features: this._route ? [this._route, ...signals] : [] };
|
||||
const source = this._map.getSource(SOURCE);
|
||||
if (source) {
|
||||
source.setData(data);
|
||||
@@ -380,6 +383,14 @@ export class RoutePanelControl {
|
||||
layout: { "line-cap": "round", "line-join": "round" },
|
||||
paint: { "line-color": COLOR, "line-width": 5 },
|
||||
});
|
||||
this._map.addLayer({
|
||||
id: `${SOURCE}-signals`,
|
||||
type: "circle",
|
||||
source: SOURCE,
|
||||
minzoom: 14,
|
||||
filter: ["==", ["geometry-type"], "Point"],
|
||||
paint: { "circle-radius": 5, "circle-color": "#222", "circle-stroke-color": "#f9a825", "circle-stroke-width": 2.5 },
|
||||
});
|
||||
}
|
||||
|
||||
// A route item in the library ("Routes" folder), keeping its points and
|
||||
@@ -389,7 +400,7 @@ export class RoutePanelControl {
|
||||
const name = window.prompt("Route name:", this._editing?.name || `Route ${new Date().toLocaleDateString()}`);
|
||||
if (!name || !name.trim()) return;
|
||||
|
||||
const { maneuvers, ...properties } = this._route.properties;
|
||||
const { maneuvers, speed_limits: _limits, signals: _signals, ...properties } = this._route.properties;
|
||||
const feature = {
|
||||
type: "Feature",
|
||||
geometry: this._route.geometry,
|
||||
|
||||
Reference in new issue
Block a user