-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathdefaultPreferences.config.ts
More file actions
453 lines (447 loc) · 17.2 KB
/
Copy pathdefaultPreferences.config.ts
File metadata and controls
453 lines (447 loc) · 17.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
/*
* Copyright 2022, Polytechnique Montreal and contributors
*
* This file is licensed under the MIT License.
* License text available at https://opensource.org/licenses/MIT
*/
import config from './shared/project.config';
import lineModesDefaultValues from './lineModesDefaultValues';
import constants from './constants';
import type { ProjectMapBasemapShortname } from './mapBaseLayersProject.types';
// @deprecated This type has moved to chaire-lib's project configuration
interface SectionDescription {
localizedTitle: string;
icon: string;
showMap?: boolean;
showFullSizePanel?: boolean;
enabled?: boolean;
}
export interface PreferencesModel {
defaultSection: string;
infoPanelPosition: string;
dateTimeFormat: string;
/** When true use dark theme, when false use light theme. When undefined, follow system preference. */
isDarkTheme: boolean | undefined;
// @deprecated This type has moved to chaire-lib's project configuration.
// Use the project configuration's `sections` instead, as it is not a
// preference, but an instance specific configuration.
sections?: {
[key: string]: {
[key: string]: SectionDescription;
};
};
/** Map display preferences */
map: {
/** Initial map center as [longitude, latitude] tuple (GeoJSON order) */
center: [number, number];
/** Initial zoom level (typically 1-20, where higher values are more zoomed in) */
zoom: number;
/** Default base layer shortname (`osm` or a `mapBaseLayers` entry) */
basemapShortname: ProjectMapBasemapShortname;
/** Overlay opacity as a percentage (0–100) */
overlayOpacity: number;
/** Overlay color: 'black' or 'white' */
overlayColor: 'black' | 'white';
/** Min map zoom (1–15) for path waypoint layers / editing; not under transit.paths so Path defaults do not copy it */
pathWaypointMinZoom: number;
};
colorPicker: {
/** Hexadecimal strings of the various colors that should be available */
colors: string[];
};
[key: string]: any;
}
// TODO: Type more fields
const defaultPreferences: PreferencesModel = {
defaultSection: 'agencies',
infoPanelPosition: 'right',
dateTimeFormat: 'YYYY-MM-DD HH:mm',
isDarkTheme: undefined, // Follow system preference
map: {
center: [config.mapDefaultCenter.lon, config.mapDefaultCenter.lat],
zoom: 10,
basemapShortname: 'osm',
overlayOpacity: 50,
overlayColor: 'black',
pathWaypointMinZoom: 10
},
socketUploadChunkSize: 10240000,
defaultWalkingSpeedMetersPerSeconds: 5 / 3.6,
geoNames: {
host: 'http://api.geonames.org/findNearestIntersectionOSMJSON'
},
valhallaRouting: {
host: 'http://localhost',
port: 8002,
autoStart: false,
modes: {
walking: 'pedestrian',
driving: 'auto',
bus: 'bus',
cycling: 'bicycle'
}
},
btm: {
host: 'https://taximtl.ville.montreal.qc.ca'
},
json2Capnp: {
enabled: true, // if not enabled, will use javascript to read/write capnp cache files (slower)
host: 'http://localhost',
port: 2000
},
osrmRouting: {
// directoryPrefix: used as a prefix, can be overridden in .env (OSRM_DIRECTORY_PREFIX).
// Keep empty for none (will only use the mode name):
// If empty, directories will be projects/{PROJECT_SHORTNAME}/osrm/{MODE}
// If not empty, directories will be projects/{PROJECT_SHORTNAME}/osrm/directoryPrefix_{MODE}
// TODO: Move these params to chaire-lib-backend with server.config. See issue #1140
directoryPrefix: '',
maxDistanceFromNearestNetworkNodeMeters: 300,
useContinueStraightForMapMatching: false // use only if using the forked version of osrm-backend with support for continue-straight in match query
},
colorPicker: {
colors: [
// saturated
'#0086FF',
'#00ffdd',
'#00ff55',
'#aaff00',
'#fff600',
'#ff9400',
'#ff3f00',
'#ff0000',
'#ff0061',
'#ff00c3',
'#d000ff',
'#7b00ff',
'#4800ff',
'#1d00ff',
// dark
'#004787',
'#008270',
'#00842c',
'#5a8700',
'#878200',
'#824b00',
'#872100',
'#840000',
'#910037',
'#870067',
'#6e0087',
'#410087',
'#250084',
'#0f0087',
// light
'#7cc2ff',
'#99fff1',
'#8effb4',
'#d3ff7c',
'#fffa7f',
'#ffc677',
'#ff9977',
'#ff89b6',
'#e98cff',
'#aa89ff',
// greys
'#ffffff',
'#c9c9c9',
'#878787' // greys
]
},
simulations: {
defaultColor: '#0086FF',
classes: ['LineAndNumberOfVehiclesGASimulation'],
geneticAlgorithms: {
fitnessSorters: {
maximize: function (fitnessA: number, fitnessB: number) {
return fitnessB - fitnessA; // descendant (more chance to select candidates with high fitness)
},
minimize: function (fitnessA: number, fitnessB: number) {
return fitnessA - fitnessB; // ascendent (more chance to select candidates with low fitness)
}
},
odTripFitnessFunctions: {
travelTimeCost: function (odTrip) {
return (10 * odTrip.travelTimeSeconds) / 3600 + odTrip.initialLostTimeAtDepartureSeconds / 3600;
},
travelTimeWithTransferPenalty: function (odTrip) {
return (
(10 * (odTrip.travelTimeSeconds + odTrip.numberOfTransfers * 300)) / 3600 +
odTrip.initialLostTimeAtDepartureSeconds / 3600
);
}
},
nonRoutableOdTripFitnessFunctions: {
taxi: function (odTrip) {
//return 10;
if (odTrip.onlyDrivingTravelTimeSeconds && odTrip.onlyDrivingTravelTimeSeconds > 0) {
return 3.5 + (87.5 * odTrip.onlyDrivingTravelTimeSeconds) / 3600; // taxi at 50km/h
} else if (odTrip.onlyWalkingTravelTimeSeconds && odTrip.onlyWalkingTravelTimeSeconds > 0) {
// divide walking time by 10 to get an approximation of 50 km/h
return 3.5 + (87.5 * odTrip.onlyWalkingTravelTimeSeconds) / (10 * 3600); // taxi at 50km/h
} else {
return 30;
}
}
},
fitnessFunctions: {
hourlyUserPlusOperatingCosts: function (stats) {
return stats.usersHourlyCost + stats.operatingHourlyCost;
},
hourlyUserCosts: function (stats) {
return stats.usersHourlyCost;
},
hourlyOperatingCosts: function (stats) {
return stats.operatingHourlyCost;
}
}
}
},
transit: {
definitionsAndSymbolsLatexUrl:
'https://github.com/kaligrafy/CIV6708-Definitions-and-symbols/blob/master/main.tex',
showEvolutionaryAlgorithmsFields: false,
periods: {
default: {
name: {
fr: 'Par défaut',
en: 'Default'
},
periods: [
{
shortname: 'morning',
name: {
fr: 'Matinée (4h à 6h)',
en: 'Morning (4-6AM)'
},
startAtHour: 4,
endAtHour: 6
},
{
shortname: 'am_peak',
name: {
fr: 'Pointe du matin (6h à 9h)',
en: 'AM Peak (6-9AM)'
},
startAtHour: 6,
endAtHour: 9
},
{
shortname: 'midday',
name: {
fr: 'Journée (9h à 15h)',
en: 'Midday (9AM-15PM)'
},
startAtHour: 9,
endAtHour: 15
},
{
shortname: 'pm_peak',
name: {
fr: 'Pointe du soir (15h à 18h)',
en: 'PM Peak (3-6PM)'
},
startAtHour: 15,
endAtHour: 18
},
{
shortname: 'evening',
name: {
fr: 'Soirée (18h à 23h)',
en: 'Evening (6-11PM)'
},
startAtHour: 18,
endAtHour: 23
},
{
shortname: 'night',
name: {
fr: 'Nuit (23h à 4h)',
en: 'Night (11PM-4AM)'
},
startAtHour: 23,
endAtHour: 28
}
]
},
extended_morning_peak: {
name: {
fr: 'Pointe du matin étendue',
en: 'Extended morning peak'
},
periods: [
{
shortname: 'extended_morning_peak',
name: {
fr: 'Pointe du matin étendue (5h à 11h)',
en: 'Extended morning peak (5-11AM)'
},
startAtHour: 5,
endAtHour: 11
}
]
},
complete_day: {
name: {
fr: 'Journée complète',
en: 'Complete day'
},
periods: [
{
shortname: 'complete_day',
name: {
fr: 'Journée complète (4h à 24h)',
en: 'Complete day (4AM-midnight)'
},
startAtHour: 4,
endAtHour: 24
}
]
}
},
stations: {
defaultColor: '#0086FF'
},
networks: {
defaultColor: '#0086FF'
},
nodes: {
defaultStopAggregationWalkingRadiusSecondsWhenImportingFromGtfs: 60,
defaultColor: '#0086FF',
defaultDwellTimeSeconds: 20,
useBirdDistanceForTransferableNodes: false,
useBirdDistanceForODNodes: false,
defaultRoutingRadiusMeters: 50,
nameIsRequired: false,
defaultWalkingSpeedMps: 5 / 3.6,
maxTransferWalkingTravelTimeSeconds: 15 * 60, // more than that would be quite unrealistic
maxAccessEgressWalkingTravelTimeSeconds: 20 * 60,
weightCalculation: function (odTripExpansionFactor, walkingTravelTimeSeconds) {
return odTripExpansionFactor / Math.exp(Math.pow(walkingTravelTimeSeconds / 60, 1.6) / 50);
}
},
paths: {
data: {
defaultRoutingEngine: 'engine',
defaultRoutingMode: 'bus_urban',
defaultMinLayoverTimeSeconds: 180,
defaultLayoverRatioOverTotalTravelTime: 0.1
},
generator: {
defaultMinDistanceBetweenTerminalsKm: 3,
defaultAvgInterNodesDistanceMeters: 400,
defaultMedianInterNodesDistanceMeters: 400,
defaultMaxTemporalTortuosity: 1.5
}
},
lines: {
defaultColor: '#0086FF',
defaultLayoverRatioOverTotalTravelTime: 0.1,
defaultIsAutonomous: false,
defaultAllowSameLineTransfers: false,
lineModesDefaultValues // TODO: Move these to transition default prefs
},
services: {
defaultColor: '#0086FF'
},
scenarios: {
defaultColor: '#0086FF'
},
agencies: {
defaultColor: '#0086FF'
},
routing: {
batch: {
withGeometry: false,
projection: String(constants.geographicCoordinateSystem.srid),
allowSavingOdTripsToDb: false
},
transit: {
routingModes: ['transit'],
withAlternatives: false,
departureTimeSecondsSinceMidnight: 28800,
arrivalTimeSecondsSinceMidnight: null,
minWaitingTimeSeconds: 180,
maxTransferTravelTimeSeconds: 600,
maxAccessEgressTravelTimeSeconds: 900,
maxWalkingOnlyTravelTimeSeconds: 1800,
maxTotalTravelTimeSeconds: 10800,
walkingSpeedMps: 1.3888888888,
walkingSpeedFactor: 1.0, // walking travel times are weighted using this factor: Example: > 1.0 means faster walking, < 1.0 means slower walking
originLocationColor: 'rgba(140, 212, 0, 1.0)',
destinationLocationColor: 'rgba(212, 35, 14, 1.0)',
walkingSegmentsColor: 'rgba(160, 160, 160, 1.0)',
walking: {
color: 'rgba(255, 238, 0, 1.0)'
},
cycling: {
color: 'rgba(0, 204, 51, 1.0)'
},
driving: {
color: 'rgba(229, 45, 0, 1.0)'
},
default: {
color: 'rgba(160, 160, 160, 1.0)'
}
},
transitAccessibilityMap: {
departureTimeSecondsSinceMidnight: 28800,
arrivalTimeSecondsSinceMidnight: null,
deltaIntervalSeconds: 300,
deltaSeconds: 900,
numberOfPolygons: 3,
direction: 'to', // to, from
minWaitingTimeSeconds: 180,
maxTransferTravelTimeSeconds: 600,
maxAccessEgressTravelTimeSeconds: 900,
maxWalkingOnlyTravelTimeSeconds: 1800,
walkingSpeedMps: 1.3888888888,
walkingSpeedFactor: 1.0, // walking travel times are weighted using this factor: Example: > 1.0 means faster walking, < 1.0 means slower walking
maxTotalTravelTimeSeconds: 1800,
locationColor: 'rgba(47, 138, 243, 1)',
polygonColor: 'rgba(47, 138, 243, 0.4)',
intersectionLocationColor: 'rgba(47, 138, 243, 1)',
intersectionPolygonColor: 'rgba(47, 138, 243, 0.6)',
comparisonLocation1Color: 'rgba(252, 208, 89, 1)',
comparisonPolygon1Color: 'rgba(252, 208, 89, 0.6)',
comparisonLocation2Color: 'rgba(231, 74, 184, 1)',
comparisonPolygon2Color: 'rgba(231, 74, 184, 0.6)',
calculatePois: false,
calculatePopulation: false
},
transitOdTrips: {
minWaitingTimeSeconds: 180,
maxTransferTravelTimeSeconds: 600,
maxAccessEgressTravelTimeSeconds: 900,
maxWalkingOnlyTravelTimeSeconds: 1800,
maxTotalTravelTimeSeconds: 10800,
walkingSpeedMps: 1.3888888888,
odTripsSampleRatio: 1.0,
walkingSpeedFactor: 1.0 // walking travel times are weighted using this factor: Example: > 1.0 means faster walking, < 1.0 means slower walking
}
}
},
// maxAccessibilityWeightsBirdDistancesMeters should be >= maxAccessibilityWeightsNetworkDistancesMeters
// because it is used as a first step to filter out POIs that are too far away.
maxAccessibilityWeightsBirdDistancesMeters: {
walking: 2500 // ~30 minutes at 5 km/h
// more modes could be added later on.
},
maxAccessibilityWeightsNetworkDistancesMeters: {
walking: 2500 // Maximum network distance in meters for node weight calculations
// more modes could be added later on.
},
maxAccessibilityWeightsTravelTimeSeconds: {
walking: 1800 // ~30 minutes maximum travel time for node weight calculations
// more modes could be added later on.
},
proj4Projections: {
[String(constants.geographicCoordinateSystem.srid)]: constants.geographicCoordinateSystem,
'2950': {
srid: 2950,
label: 'MTM Zone 8 NAD83 EPSG:2950',
value: '+proj=tmerc +lat_0=0 +lon_0=-73.5 +k=0.9999 +x_0=304800 +y_0=0 +ellps=GRS80 +units=m +no_defs'
}
}
};
export default defaultPreferences;