mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Draw transit vehicles as trolleybuses, cable cars, funiculars, gondolas and monorails
The transit layer knew five modes, so a trolleybus drew as a bus, a funicular as a train and a coach as a city bus. The GTFS basic route types are now modes of their own (trolleybus, cable_tram, monorail, funicular, aerial_lift), each with an icon, colour, detection tier, card word, voice name, speed ceiling and fleet model. A vehicle record may carry its route's GTFS route_type as routeType. It settles the mode after the feed's fleet hint and before its route hint, and picks the finer model (a coach for 200, a high-speed set for 101) when the type is a kind of the vehicle's mode. Retained history classifies epochs through transitModeFor too, so trails join the live vehicle. Route hints from each operator's routes.txt: Prague's trolleybus lines (51-59, 232, 275) and Petrin funicular, and the trams, trolleybuses and metro lines of Bucharest, Cluj-Napoca and Turin. A feed may also name route corrections that outrank the route type: Le Havre's routes.txt types its funicular (8-FUNI) as a bus, so it is corrected to a funicular.
This commit is contained in:
1 parent
250f0e20c3
commit
39c89d563b
32 files changed
+708
-61
No files matched your search
@@ -16,6 +16,7 @@ import {
|
||||
import {
|
||||
transitModeFor,
|
||||
transitModeResolved,
|
||||
transitModelRouteType,
|
||||
} from '../../data/transitFeeds.js';
|
||||
import {
|
||||
attachFloorToPlace,
|
||||
@@ -222,12 +223,19 @@ export function createIngestion({ state, services, parts, source }) {
|
||||
for (const record of records) {
|
||||
if (isStaleVehicleFix(record, now, fetchedAt)) continue;
|
||||
const key = transitVehicleKey(feed.id, record.id);
|
||||
const mode = transitModeFor(feed, record.routeId, record.id);
|
||||
const mode = transitModeFor(
|
||||
feed,
|
||||
record.routeId,
|
||||
record.id,
|
||||
record.routeType,
|
||||
);
|
||||
const modeInferred = !transitModeResolved(
|
||||
feed,
|
||||
record.routeId,
|
||||
record.id,
|
||||
record.routeType,
|
||||
);
|
||||
const routeType = transitModelRouteType(mode, record.routeType);
|
||||
// A stamp ahead of the fetch is a clock fault; the fetch time bounds it.
|
||||
const stamped = vehicleReportTimeMs(record, fetchedAt);
|
||||
const reportAt =
|
||||
@@ -267,6 +275,7 @@ export function createIngestion({ state, services, parts, source }) {
|
||||
continue;
|
||||
}
|
||||
if (entry.mode !== mode) parts.rendering.paintMode(entry, mode);
|
||||
entry.routeType = routeType;
|
||||
entry.modeInferred = modeInferred;
|
||||
updatePlayback(entry, now, monoNow);
|
||||
parts.rendering.schedulePlayback(entry);
|
||||
@@ -320,6 +329,8 @@ export function createIngestion({ state, services, parts, source }) {
|
||||
feedId: feed.id,
|
||||
marker: null,
|
||||
mode,
|
||||
// The GTFS route type its model is chosen by, when it has one.
|
||||
routeType,
|
||||
modeInferred,
|
||||
heightM: prior === null ? 0 : prior,
|
||||
heightCell: height.cell,
|
||||
|
||||
@@ -11,9 +11,14 @@ import {
|
||||
} from '../../data/contactPlayback.js';
|
||||
const MODE_MAX_SPEED_MPS = Object.freeze({
|
||||
bus: 36, // ~130 km/h — a coach on a motorway
|
||||
trolleybus: 28, // ~100 km/h — wired to the street
|
||||
tram: 28, // ~100 km/h — interurban light rail
|
||||
cable_tram: 12, // ~43 km/h — the cable runs at a walking-pace multiple
|
||||
subway: 42, // ~150 km/h
|
||||
monorail: 42, // ~150 km/h
|
||||
rail: 111, // ~400 km/h — high-speed services exist on some feeds
|
||||
funicular: 16, // ~58 km/h — the fastest lines
|
||||
aerial_lift: 15, // ~54 km/h — the fastest gondolas and trams
|
||||
ferry: 25, // ~90 km/h — fast catamarans
|
||||
unknown: 56, // ~200 km/h
|
||||
});
|
||||
|
||||
@@ -189,9 +189,14 @@ export const SELECTED_CARD_REFRESH_MS = 250;
|
||||
/** Mode palette: distinct at a glance, none reused by flights (white/cyan), military (amber), or vessels. */
|
||||
export const TRANSIT_MODE_COLORS = Object.freeze({
|
||||
bus: '#5EF08A',
|
||||
trolleybus: '#B6F04A',
|
||||
tram: '#FFC24A',
|
||||
cable_tram: '#FF8F4A',
|
||||
subway: '#FF4538',
|
||||
monorail: '#FF6FB8',
|
||||
rail: '#D9A6FF',
|
||||
funicular: '#E8C98A',
|
||||
aerial_lift: '#7FA8FF',
|
||||
ferry: '#5FD6FF',
|
||||
unknown: '#D8DDE5',
|
||||
});
|
||||
@@ -526,9 +531,14 @@ const UNDERGROUND_MODES = new Set(['subway']);
|
||||
/** The mode in plain words, for a card a person reads rather than scans. */
|
||||
const TRANSIT_MODE_WORD = Object.freeze({
|
||||
bus: msg('Bus'),
|
||||
trolleybus: msg('Trolleybus'),
|
||||
tram: msg('Tram'),
|
||||
cable_tram: msg('Cable car'),
|
||||
subway: msg('Subway'),
|
||||
monorail: msg('Monorail'),
|
||||
rail: msg('Train'),
|
||||
funicular: msg('Funicular'),
|
||||
aerial_lift: msg('Gondola'),
|
||||
ferry: msg('Ferry'),
|
||||
unknown: msg('Transit vehicle'),
|
||||
});
|
||||
@@ -536,9 +546,14 @@ const TRANSIT_MODE_WORD = Object.freeze({
|
||||
/** Short, fixed-width mode word for the detection card's class field. */
|
||||
const TRANSIT_MODE_ABBR = Object.freeze({
|
||||
bus: 'BUS',
|
||||
trolleybus: 'TROLLEY',
|
||||
tram: 'TRAM',
|
||||
cable_tram: 'CABLE',
|
||||
subway: 'METRO',
|
||||
monorail: 'MONO',
|
||||
rail: 'RAIL',
|
||||
funicular: 'FUNI',
|
||||
aerial_lift: 'GONDOLA',
|
||||
ferry: 'FERRY',
|
||||
unknown: 'TRANSIT',
|
||||
});
|
||||
|
||||
@@ -531,9 +531,15 @@ export function createRendering({ state, services, parts }) {
|
||||
groundLiftM,
|
||||
};
|
||||
}
|
||||
if (item.mode !== entry.mode) {
|
||||
if (item.mode !== entry.mode || item.routeType !== entry.routeType) {
|
||||
item.mode = entry.mode;
|
||||
item.spec = transitModelSpec(set, { mode: entry.mode });
|
||||
item.routeType = entry.routeType;
|
||||
// The route type picks the finer model (a coach, a high-speed set);
|
||||
// the mode is the fallback for a type the model table lacks.
|
||||
item.spec = transitModelSpec(set, {
|
||||
routeType: entry.routeType,
|
||||
mode: entry.mode,
|
||||
});
|
||||
item.tint =
|
||||
MODE_CESIUM_COLORS[entry.mode] || MODE_CESIUM_COLORS.unknown;
|
||||
}
|
||||
|
||||
@@ -8,16 +8,9 @@ import {
|
||||
} from '../../data/contactPlayback.js';
|
||||
import { createContactTrailRenderer } from '../../data/contactTrailRenderer.js';
|
||||
import { fixDistanceM } from './movement.js';
|
||||
import { TRANSIT_MODE_COLORS } from './policy.js';
|
||||
import { transitStyleProfile } from '../../data/transitPresetStyle.js';
|
||||
|
||||
const MODE_COLOR = {
|
||||
bus: '#5EF08A',
|
||||
tram: '#FFC24A',
|
||||
subway: '#FF4538',
|
||||
rail: '#D9A6FF',
|
||||
ferry: '#5FD6FF',
|
||||
unknown: '#D8DDE5',
|
||||
};
|
||||
// Final Cesium batching uses 3,152 bytes per two-lane edge.
|
||||
// The 1,278-instance body plus 64 bytes/instance reserve stays below 2 MiB.
|
||||
export const TRAIL_VERTEX_LIMIT = 640;
|
||||
@@ -41,7 +34,7 @@ export function createTrails({ state, services, parts, source }) {
|
||||
renderer?.setStyle(
|
||||
transitStyleProfile(state._stylePreset) === 'mono'
|
||||
? '#FFFFFF'
|
||||
: MODE_COLOR[selected?.mode] || MODE_COLOR.unknown,
|
||||
: TRANSIT_MODE_COLORS[selected?.mode] || TRANSIT_MODE_COLORS.unknown,
|
||||
);
|
||||
}
|
||||
function releaseSelectionGeometry(entry) {
|
||||
|
||||
Reference in new issue
Block a user