mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42: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
@@ -25,6 +25,7 @@ import {
|
||||
vesselModelSpec,
|
||||
} from './fleetModels.js';
|
||||
import { FLEET_TRAIL_ANCHORS } from './fleetTrailAnchors.js';
|
||||
import { TRANSIT_MODES } from './transitFeeds.js';
|
||||
import {
|
||||
centrelineSegments,
|
||||
distanceToSurface,
|
||||
@@ -444,6 +445,38 @@ test('aids to navigation are the buoy of the mark their type names', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('every transit mode but unknown draws its own model, and a route type a finer one', () => {
|
||||
for (const mode of TRANSIT_MODES.filter((m) => m !== 'unknown')) {
|
||||
assert.ok(types.transit.modes[mode], `${mode} has a model`);
|
||||
assert.equal(
|
||||
resolveTransit(types, { mode }).model,
|
||||
types.transit.modes[mode][0],
|
||||
);
|
||||
}
|
||||
for (const [mode, model] of [
|
||||
['trolleybus', 'trolleybus'],
|
||||
['cable_tram', 'cable_tram'],
|
||||
['aerial_lift', 'gondola'],
|
||||
['funicular', 'funicular'],
|
||||
['monorail', 'monorail'],
|
||||
])
|
||||
assert.equal(resolveTransit(types, { mode }).model, model, mode);
|
||||
// A route type outranks the mode: a coach and a high-speed set are still
|
||||
// the bus and rail modes.
|
||||
for (const [routeType, mode, model] of [
|
||||
[200, 'bus', 'coach'],
|
||||
[101, 'rail', 'high_speed'],
|
||||
[106, 'rail', 'regional_dmu'],
|
||||
[710, 'bus', 'double_decker'],
|
||||
])
|
||||
assert.equal(resolveTransit(types, { routeType, mode }).model, model);
|
||||
// A type the table lacks falls back to the mode.
|
||||
assert.equal(
|
||||
resolveTransit(types, { routeType: 300, mode: 'rail' }).model,
|
||||
'commuter_emu',
|
||||
);
|
||||
});
|
||||
|
||||
test('transit specs: rail category and mode, then route type, then mode, then the default', () => {
|
||||
assert.deepEqual(resolveTransit(types, { railCategory: 'national' }), {
|
||||
model: 'intercity',
|
||||
|
||||
Reference in new issue
Block a user