Files
osmWorkflow/.trellis/tasks/archive/2026-08/08-12-vehicle-incident-info/design.md

49 lines
2.0 KiB
Markdown

# Design: Vehicle Incident And Information Preview
## Boundary
This is browser-only Cesium preview state. It changes neither generated OSM data nor `package/` assets.
Vehicle routes and models remain `_preview/` resources; refresh resets all vehicle event state.
## Data Model
Each object returned by `addCruiseVehicle()` gains:
```js
{
id: "vehicle-1",
modelName: "car_a01_002",
status: "normal" | "breakdown" | "accident",
incidentNote: "",
motion: { state },
markerEntity
}
```
The current route distance remains the single motion source. The clock tick leaves it unchanged while
status is not `normal`; returning to normal resumes from that position.
## Interaction Flow
1. Vehicle Cesium Entities carry a `vehicleId` property.
2. A `ScreenSpaceEventHandler` picks a clicked entity, resolves its vehicle, synchronizes the existing
vehicle selector, and opens a positioned information card.
3. The card displays vehicle number, model family, route label/length, configured speed, state, and note.
4. Card controls set normal/breakdown/accident and persist only in the in-memory vehicle object.
5. State changes update marker visibility, the route material, card content, and Cesium render request.
## Visual Contract
- Normal: no marker; original route color; motion active.
- Breakdown: yellow wrench label above the vehicle; route retains its original color; motion frozen.
- Accident: red warning-triangle label above the vehicle; route material becomes red; motion frozen.
- Marker positions use the same vehicle `CallbackProperty`, so they move with the vehicle before an event
and remain at the incident location while stopped.
## Compatibility And Risks
- Picking must ignore routes, static models, and signal entities.
- No route must retain the existing disabled cruise controls and never show a card.
- The card must be HTML/CSS UI, not Cesium InfoBox, because the viewer deliberately disables InfoBox.
- The feature must not alter signal runtime behavior or vehicle asset URLs.