mobility-toolbox-js 2.0.0-beta.8 → 2.0.1-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/api/RoutingAPI.js +15 -0
  2. package/api/RoutingAPI.test.js +25 -0
  3. package/api/StopsAPI.js +12 -0
  4. package/api/StopsAPI.test.js +22 -0
  5. package/api/TralisAPI.js +359 -0
  6. package/api/TralisAPI.test.js +67 -0
  7. package/{src/api/tralis → api}/TralisAPIUtils.js +2 -32
  8. package/api/index.js +3 -0
  9. package/{index.html → api/typedefs.js} +0 -0
  10. package/common/Tracker.js +93 -0
  11. package/common/api/HttpAPI.js +30 -0
  12. package/common/api/HttpAPI.test.js +50 -0
  13. package/common/api/WebSocketAPI.js +175 -0
  14. package/{src/api/tralis/WebSocketConnector.test.js → common/api/WebSocketAPI.test.js} +100 -145
  15. package/common/controls/Control.js +81 -0
  16. package/{src/common → common}/controls/Control.test.js +32 -43
  17. package/common/index.js +4 -0
  18. package/common/layers/Layer.js +213 -0
  19. package/{src/common → common}/layers/Layer.test.js +185 -244
  20. package/common/mixins/CopyrightMixin.js +24 -0
  21. package/common/mixins/SearchMixin.js +110 -0
  22. package/common/mixins/TralisLayerMixin.js +479 -0
  23. package/common/styles/index.js +4 -0
  24. package/{src/common → common}/styles/trackerDefaultStyle.js +39 -175
  25. package/common/styles/trackerDelayStyle.js +8 -0
  26. package/{src/common → common}/styles/trackerSimpleStyle.js +4 -8
  27. package/{src/common → common}/trackerConfig.js +61 -99
  28. package/common/trackerConfig.test.js +23 -0
  29. package/{src/doc/examples/ol-mapbox-layer.md → common/typedefs.js} +0 -0
  30. package/common/utils/createTrackerFilters.js +56 -0
  31. package/common/utils/createTrackerFilters.test.js +79 -0
  32. package/{src/common → common}/utils/getMapboxMapCopyrights.js +3 -16
  33. package/common/utils/getMapboxMapCopyrights.test.js +40 -0
  34. package/{src/common → common}/utils/getMapboxStyleUrl.js +3 -13
  35. package/{src/common → common}/utils/getVehiclePosition.js +3 -33
  36. package/common/utils/index.js +5 -0
  37. package/common/utils/removeDuplicate.js +8 -0
  38. package/common/utils/removeDuplicate.test.js +19 -0
  39. package/{src/common → common}/utils/sortByDelay.js +2 -7
  40. package/common/utils/timeUtils.js +20 -0
  41. package/common/utils/timeUtils.test.js +10 -0
  42. package/index.js +8 -0
  43. package/mapbox/controls/CopyrightControl.js +29 -0
  44. package/mapbox/controls/index.js +1 -0
  45. package/mapbox/index.js +4 -0
  46. package/mapbox/layers/Layer.js +57 -0
  47. package/mapbox/layers/Layer.test.js +182 -0
  48. package/mapbox/layers/TralisLayer.js +182 -0
  49. package/{src/mapbox → mapbox}/layers/TralisLayer.test.js +12 -14
  50. package/mapbox/layers/index.js +2 -0
  51. package/{src/mapbox → mapbox}/utils.js +7 -21
  52. package/mbt.js +50444 -0
  53. package/mbt.js.map +7 -0
  54. package/mbt.min.js +1005 -0
  55. package/mbt.min.js.map +7 -0
  56. package/ol/controls/CopyrightControl.js +42 -0
  57. package/ol/controls/CopyrightControl.test.js +165 -0
  58. package/ol/controls/RoutingControl.js +387 -0
  59. package/ol/controls/RoutingControl.test.js +151 -0
  60. package/ol/controls/StopFinderControl.js +10 -0
  61. package/ol/controls/StopFinderControl.test.js +48 -0
  62. package/ol/controls/index.js +3 -0
  63. package/ol/index.js +5 -0
  64. package/ol/layers/Layer.js +88 -0
  65. package/ol/layers/Layer.test.js +174 -0
  66. package/ol/layers/MapboxLayer.js +203 -0
  67. package/{src/ol → ol}/layers/MapboxLayer.test.js +58 -84
  68. package/ol/layers/MapboxStyleLayer.js +187 -0
  69. package/{src/ol → ol}/layers/MapboxStyleLayer.test.js +97 -128
  70. package/ol/layers/MaplibreLayer.js +139 -0
  71. package/ol/layers/RoutingLayer.js +61 -0
  72. package/{src/ol → ol}/layers/RoutingLayer.test.js +15 -24
  73. package/ol/layers/TralisLayer.js +185 -0
  74. package/ol/layers/TralisLayer.test.js +79 -0
  75. package/ol/layers/VectorLayer.js +22 -0
  76. package/{src/ol → ol}/layers/VectorLayer.test.js +34 -45
  77. package/ol/layers/WMSLayer.js +38 -0
  78. package/ol/layers/WMSLayer.test.js +76 -0
  79. package/ol/layers/index.js +8 -0
  80. package/{src/ol → ol}/styles/fullTrajectoryDelayStyle.js +11 -15
  81. package/ol/styles/fullTrajectoryStyle.js +43 -0
  82. package/ol/styles/index.js +2 -0
  83. package/package.json +34 -74
  84. package/.babelrc +0 -6
  85. package/.esdoc.json +0 -17
  86. package/.eslintignore +0 -1
  87. package/.github/workflows/conventional-pr-title.yml +0 -21
  88. package/.github/workflows/cypress.yml +0 -29
  89. package/.github/workflows/nodejs.yml +0 -28
  90. package/.husky/commit-msg +0 -4
  91. package/.husky/post-checkout +0 -4
  92. package/.husky/post-merge +0 -4
  93. package/.husky/post-rebase +0 -4
  94. package/.husky/pre-commit +0 -4
  95. package/.neutrinorc.js +0 -176
  96. package/.nvmrc +0 -1
  97. package/CHANGELOG.md +0 -10
  98. package/LICENSE +0 -21
  99. package/__mocks__/mapbox-gl.js +0 -81
  100. package/__mocks__/maplibre-gl.js +0 -81
  101. package/commitlint.config.js +0 -1
  102. package/cypress/fixtures/example.json +0 -5
  103. package/cypress/integration/examples/api.spec.js +0 -7
  104. package/cypress/integration/examples/examples.spec.js +0 -7
  105. package/cypress/integration/examples/navigation.spec.js +0 -29
  106. package/cypress/plugins/index.js +0 -21
  107. package/cypress/support/commands.js +0 -25
  108. package/cypress/support/index.js +0 -20
  109. package/cypress.json +0 -4
  110. package/data/fetchRoute.json +0 -292
  111. package/data/fetchTrajectories.json +0 -18
  112. package/data/fetchTrajectoryById.json +0 -3
  113. package/data/fetchTrajectoryStations.json +0 -18
  114. package/data/stopsSearch.json +0 -15
  115. package/documentation.yml +0 -4
  116. package/esdoc/README.md +0 -27
  117. package/esdoc/plugins/MyPlugin.js +0 -69
  118. package/esdoc/plugins/dynamic-property-plugin/Plugin.js +0 -50
  119. package/esdoc/plugins/externals-plugin/Plugin.js +0 -45
  120. package/esdoc/plugins/externals-plugin/externals.js +0 -96
  121. package/global-setup.js +0 -3
  122. package/indexweb.html +0 -49
  123. package/jest.config.js +0 -5
  124. package/pull_request_template.md +0 -17
  125. package/renovate.json +0 -4
  126. package/scripts/read-pkg-json.js +0 -22
  127. package/src/api/index.js +0 -3
  128. package/src/api/routing/RoutingAPI.js +0 -44
  129. package/src/api/routing/RoutingAPI.test.js +0 -41
  130. package/src/api/stops/StopsAPI.js +0 -41
  131. package/src/api/stops/StopsAPI.test.js +0 -34
  132. package/src/api/tralis/TralisAPI.js +0 -731
  133. package/src/api/tralis/TralisAPI.test.js +0 -75
  134. package/src/api/tralis/WebSocketConnector.js +0 -338
  135. package/src/api/tralis/typedefs.js +0 -81
  136. package/src/assets/Lato-Black.ttf +0 -0
  137. package/src/assets/Lato-BlackItalic.ttf +0 -0
  138. package/src/assets/Lato-Bold.ttf +0 -0
  139. package/src/assets/Lato-BoldItalic.ttf +0 -0
  140. package/src/assets/Lato-Italic.ttf +0 -0
  141. package/src/assets/Lato-Light.ttf +0 -0
  142. package/src/assets/Lato-LightItalic.ttf +0 -0
  143. package/src/assets/Lato-Regular.ttf +0 -0
  144. package/src/assets/Lato-Thin.ttf +0 -0
  145. package/src/assets/Lato-ThinItalic.ttf +0 -0
  146. package/src/assets/OFL.txt +0 -93
  147. package/src/common/Tracker.js +0 -197
  148. package/src/common/api/api.js +0 -64
  149. package/src/common/api/api.test.js +0 -68
  150. package/src/common/controls/Control.js +0 -146
  151. package/src/common/index.js +0 -5
  152. package/src/common/layers/Layer.js +0 -404
  153. package/src/common/mixins/CopyrightMixin.js +0 -48
  154. package/src/common/mixins/SearchMixin.js +0 -176
  155. package/src/common/mixins/TralisLayerMixin.js +0 -930
  156. package/src/common/styles/index.js +0 -4
  157. package/src/common/styles/trackerDelayStyle.js +0 -17
  158. package/src/common/trackerConfig.test.js +0 -25
  159. package/src/common/typedefs.js +0 -23
  160. package/src/common/utils/createTrackerFilters.js +0 -87
  161. package/src/common/utils/createTrackerFilters.test.js +0 -95
  162. package/src/common/utils/getMapboxMapCopyrights.test.js +0 -47
  163. package/src/common/utils/index.js +0 -5
  164. package/src/common/utils/removeDuplicate.js +0 -22
  165. package/src/common/utils/removeDuplicate.test.js +0 -22
  166. package/src/common/utils/timeUtils.js +0 -44
  167. package/src/common/utils/timeUtils.test.js +0 -16
  168. package/src/doc/App.js +0 -116
  169. package/src/doc/App.scss +0 -51
  170. package/src/doc/_redirects +0 -2
  171. package/src/doc/components/CodeSandboxButton.js +0 -103
  172. package/src/doc/components/Documentation.js +0 -40
  173. package/src/doc/components/Esdoc/Anchor.js +0 -57
  174. package/src/doc/components/Esdoc/ClassDoc.js +0 -272
  175. package/src/doc/components/Esdoc/DeprecatedHTML.js +0 -16
  176. package/src/doc/components/Esdoc/DetailDocs.js +0 -281
  177. package/src/doc/components/Esdoc/DetailHTML.js +0 -33
  178. package/src/doc/components/Esdoc/DirectSubclassHTML.js +0 -30
  179. package/src/doc/components/Esdoc/DocBuilderUtils.js +0 -694
  180. package/src/doc/components/Esdoc/DocLinkHTML.js +0 -62
  181. package/src/doc/components/Esdoc/DocsLinkHTML.js +0 -38
  182. package/src/doc/components/Esdoc/Esdoc.js +0 -63
  183. package/src/doc/components/Esdoc/EsdocContent.js +0 -51
  184. package/src/doc/components/Esdoc/EsdocNavigation.js +0 -13
  185. package/src/doc/components/Esdoc/EsdocSearch.js +0 -81
  186. package/src/doc/components/Esdoc/ExperimentalHTML.js +0 -17
  187. package/src/doc/components/Esdoc/ExtendsChainHTML.js +0 -32
  188. package/src/doc/components/Esdoc/FileDocLinkHTML.js +0 -60
  189. package/src/doc/components/Esdoc/IdentifiersDoc.js +0 -113
  190. package/src/doc/components/Esdoc/IndirectSubclassHTML.js +0 -30
  191. package/src/doc/components/Esdoc/InheritedSummaryDoc.js +0 -70
  192. package/src/doc/components/Esdoc/InheritedSummaryHTML.js +0 -38
  193. package/src/doc/components/Esdoc/MixinClassesHTML.js +0 -29
  194. package/src/doc/components/Esdoc/NavDoc.js +0 -112
  195. package/src/doc/components/Esdoc/OverrideMethod.js +0 -44
  196. package/src/doc/components/Esdoc/OverrideMethodDescription.js +0 -35
  197. package/src/doc/components/Esdoc/Properties.js +0 -89
  198. package/src/doc/components/Esdoc/README.md +0 -45
  199. package/src/doc/components/Esdoc/SignatureHTML.js +0 -123
  200. package/src/doc/components/Esdoc/SingleDoc.js +0 -31
  201. package/src/doc/components/Esdoc/SummaryDoc.js +0 -160
  202. package/src/doc/components/Esdoc/SummaryHTML.js +0 -96
  203. package/src/doc/components/Esdoc/TypeDocLinkHTML.js +0 -249
  204. package/src/doc/components/Esdoc/css/identifiers.css +0 -38
  205. package/src/doc/components/Esdoc/css/search.css +0 -76
  206. package/src/doc/components/Esdoc/css/style.css +0 -603
  207. package/src/doc/components/Esdoc/index.js +0 -7
  208. package/src/doc/components/Example.js +0 -153
  209. package/src/doc/components/Examples.js +0 -183
  210. package/src/doc/components/Home.js +0 -106
  211. package/src/doc/components/TrackerExample.js +0 -38
  212. package/src/doc/examples/assets/tralis-live-map/index.js +0 -11
  213. package/src/doc/examples/assets/tralis-live-map/s1kreis.svg +0 -105
  214. package/src/doc/examples/assets/tralis-live-map/s20kreis.svg +0 -101
  215. package/src/doc/examples/assets/tralis-live-map/s2kreis.svg +0 -95
  216. package/src/doc/examples/assets/tralis-live-map/s3kreis.svg +0 -95
  217. package/src/doc/examples/assets/tralis-live-map/s4kreis.svg +0 -95
  218. package/src/doc/examples/assets/tralis-live-map/s6kreis.svg +0 -95
  219. package/src/doc/examples/assets/tralis-live-map/s7kreis.svg +0 -95
  220. package/src/doc/examples/assets/tralis-live-map/s8kreis.svg +0 -93
  221. package/src/doc/examples/assets/tralis-live-map/unknown.svg +0 -107
  222. package/src/doc/examples/mb-copyright.html +0 -26
  223. package/src/doc/examples/mb-copyright.js +0 -37
  224. package/src/doc/examples/mb-tracker.html +0 -1
  225. package/src/doc/examples/mb-tracker.js +0 -39
  226. package/src/doc/examples/mb-tracker.md +0 -1
  227. package/src/doc/examples/mb-tralis.html +0 -1
  228. package/src/doc/examples/mb-tralis.js +0 -34
  229. package/src/doc/examples/ol-copyright.html +0 -26
  230. package/src/doc/examples/ol-copyright.js +0 -43
  231. package/src/doc/examples/ol-mapbox-layer.html +0 -1
  232. package/src/doc/examples/ol-mapbox-layer.js +0 -28
  233. package/src/doc/examples/ol-mapbox-style-layer.html +0 -12
  234. package/src/doc/examples/ol-mapbox-style-layer.js +0 -44
  235. package/src/doc/examples/ol-query.html +0 -32
  236. package/src/doc/examples/ol-query.js +0 -83
  237. package/src/doc/examples/ol-routing.html +0 -26
  238. package/src/doc/examples/ol-routing.js +0 -59
  239. package/src/doc/examples/ol-routing.md +0 -1
  240. package/src/doc/examples/ol-stop-finder.html +0 -15
  241. package/src/doc/examples/ol-stop-finder.js +0 -31
  242. package/src/doc/examples/ol-stop-finder.md +0 -1
  243. package/src/doc/examples/ol-tracker.html +0 -1
  244. package/src/doc/examples/ol-tracker.js +0 -44
  245. package/src/doc/examples/ol-tracker.md +0 -1
  246. package/src/doc/examples/ol-tralis.html +0 -5
  247. package/src/doc/examples/ol-tralis.js +0 -57
  248. package/src/doc/examples/tralis-live-map.html +0 -1
  249. package/src/doc/examples/tralis-live-map.js +0 -51
  250. package/src/doc/examples/tralis-live-map.md +0 -3
  251. package/src/doc/examples.js +0 -107
  252. package/src/doc/img/examples/live_tracker_mb.jpg +0 -0
  253. package/src/doc/img/examples/live_tracker_munich.jpg +0 -0
  254. package/src/doc/img/examples/live_tracker_ol.jpg +0 -0
  255. package/src/doc/img/examples/mapbox.jpg +0 -0
  256. package/src/doc/img/examples/mapbox_style.jpg +0 -0
  257. package/src/doc/img/examples/ol-copyright.png +0 -0
  258. package/src/doc/img/examples/query_objects.jpg +0 -0
  259. package/src/doc/img/examples/routing.jpg +0 -0
  260. package/src/doc/img/examples/simple_map.jpg +0 -0
  261. package/src/doc/img/examples/stops.jpg +0 -0
  262. package/src/doc/img/favico.ico +0 -0
  263. package/src/doc/index.js +0 -21
  264. package/src/iife.js +0 -7
  265. package/src/index.js +0 -10
  266. package/src/mapbox/controls/CopyrightControl.js +0 -58
  267. package/src/mapbox/controls/index.js +0 -2
  268. package/src/mapbox/index.js +0 -4
  269. package/src/mapbox/layers/Layer.js +0 -118
  270. package/src/mapbox/layers/Layer.test.js +0 -202
  271. package/src/mapbox/layers/TralisLayer.js +0 -329
  272. package/src/mapbox/layers/index.js +0 -2
  273. package/src/ol/README.md +0 -0
  274. package/src/ol/controls/CopyrightControl.js +0 -80
  275. package/src/ol/controls/CopyrightControl.test.js +0 -211
  276. package/src/ol/controls/RoutingControl.js +0 -752
  277. package/src/ol/controls/RoutingControl.test.js +0 -216
  278. package/src/ol/controls/StopFinderControl.js +0 -38
  279. package/src/ol/controls/StopFinderControl.test.js +0 -59
  280. package/src/ol/controls/index.js +0 -3
  281. package/src/ol/controls/snapshots/RoutingControlRouteGen10.json +0 -58
  282. package/src/ol/controls/snapshots/RoutingControlRouteGen100.json +0 -292
  283. package/src/ol/controls/snapshots/RoutingControlRouteGen30.json +0 -69
  284. package/src/ol/controls/snapshots/RoutingControlRouteGen5.json +0 -58
  285. package/src/ol/controls/snapshots/RoutingControlRouteOSM.json +0 -759
  286. package/src/ol/controls/snapshots/RoutingControlStation1.json +0 -60
  287. package/src/ol/controls/snapshots/RoutingControlStation2.json +0 -49
  288. package/src/ol/index.js +0 -5
  289. package/src/ol/layers/Layer.js +0 -193
  290. package/src/ol/layers/Layer.test.js +0 -197
  291. package/src/ol/layers/MapboxLayer.js +0 -378
  292. package/src/ol/layers/MapboxStyleLayer.js +0 -417
  293. package/src/ol/layers/MaplibreLayer.js +0 -280
  294. package/src/ol/layers/RoutingLayer.js +0 -91
  295. package/src/ol/layers/TralisLayer.js +0 -359
  296. package/src/ol/layers/TralisLayer.test.js +0 -97
  297. package/src/ol/layers/VectorLayer.js +0 -43
  298. package/src/ol/layers/WMSLayer.js +0 -80
  299. package/src/ol/layers/WMSLayer.test.js +0 -84
  300. package/src/ol/layers/index.js +0 -8
  301. package/src/ol/styles/fullTrajectoryStyle.js +0 -51
  302. package/src/ol/styles/index.js +0 -2
  303. package/src/setupTests.js +0 -15
  304. package/webpack.config.js +0 -6
@@ -1,930 +0,0 @@
1
- /* eslint-disable no-empty-function */
2
- /* eslint-disable no-useless-constructor */
3
- /* eslint-disable no-unused-vars */
4
- /* eslint-disable class-methods-use-this */
5
- /* eslint-disable max-classes-per-file */
6
- import qs from 'query-string';
7
- import { buffer, containsCoordinate, intersects } from 'ol/extent';
8
- import { unByKey } from 'ol/Observable';
9
- import GeoJSON from 'ol/format/GeoJSON';
10
- import Point from 'ol/geom/Point';
11
- import debounce from 'lodash.debounce';
12
- import throttle from 'lodash.throttle';
13
- import { fromLonLat } from 'ol/proj';
14
- import Tracker from '../Tracker';
15
- import { timeSteps } from '../trackerConfig';
16
- import createFilters from '../utils/createTrackerFilters';
17
- import trackerDefaultStyle from '../styles/trackerDefaultStyle';
18
- import { TralisAPI, TralisModes } from '../../api';
19
-
20
- /* Permalink parameter used to filters vehicles */
21
- const LINE_FILTER = 'publishedlinename';
22
- const ROUTE_FILTER = 'tripnumber';
23
- const OPERATOR_FILTER = 'operator';
24
-
25
- /**
26
- * TralisLayerInterface.
27
- */
28
- export class TralisLayerInterface {
29
- /*
30
- * Constructor
31
-
32
- * @param {Object} options Layer options.
33
- * @param {string} options.url Tralis service url.
34
- * @param {string} options.apiKey Access key for [geOps services](https://developer.geops.io/).
35
- * @param {boolean} [options.debug=false] Display additional debug informations.
36
- * @param {TralisMode} [options.mode=TralisMode.TOPOGRAPHIC] Tralis's Mode.
37
- * @param {number} [options.minZoomInterpolation=8] Minimal zoom when trains positions start to be interpolated.
38
- * @param {number} [options.minZoomNonTrain=9] Minimal zoom when non trains vehicles are allowed to be displayed.
39
- */
40
- constructor(options = {}) {}
41
-
42
- /**
43
- * Initialize the layer subscribing to the Tralis api.
44
- *
45
- * @param {ol/Map~Map} map
46
- */
47
- init(map) {}
48
-
49
- /**
50
- * Terminate the layer unsubscribing to the Tralis api.
51
- */
52
- terminate() {}
53
-
54
- /**
55
- * Start the clock.
56
- */
57
- start() {}
58
-
59
- /**
60
- * Stop the clock.
61
- */
62
- stop() {}
63
-
64
- /**
65
- * Set the Tralis api's bbox.
66
- *
67
- * @param {Array<number>} extent Extent to request, [minX, minY, maxX, maxY, zoom].
68
- * @param {number} zoom Zoom level to request. Must be an integer.
69
- */
70
- setBbox(extent, zoom) {}
71
-
72
- /**
73
- * Set the Tralis api's mode.
74
- *
75
- * @param {TralisMode} mode Tralis mode
76
- */
77
- setMode(mode) {}
78
-
79
- /**
80
- * Request the stopSequence and the fullTrajectory informations for a vehicle.
81
- *
82
- * @param {string} id The vehicle identifier (the train_id property).
83
- * @param {TralisMode} mode The mode to request. If not defined, the layer´s mode propetrty will be used.
84
- * @return {Promise<{stopSequence: StopSequence, fullTrajectory: FullTrajectory>} A promise that will be resolved with the trajectory informations.
85
- */
86
- getTrajectoryInfos(id, mode) {}
87
- }
88
-
89
- /**
90
- * Mixin for TralisLayerInterface.
91
- *
92
- * @param {Class} Base A class to extend with {TralisLayerInterface} functionnalities.
93
- * @return {Class} A class that implements {TralisLayerInterface} class and extends Base;
94
- * @private
95
- */
96
- const TralisLayerMixin = (Base) =>
97
- class extends Base {
98
- constructor(options = {}) {
99
- super({ hitTolerance: 10, ...options });
100
-
101
- this.debug = options.debug;
102
- this.mode = options.mode || TralisModes.TOPOGRAPHIC;
103
- this.api = options.api || new TralisAPI(options);
104
- this.tenant = options.tenant || ''; // sbb,sbh or sbm
105
- this.minZoomNonTrain = options.minZoomNonTrain || 9; // Min zoom level from which non trains are allowed to be displayed. Min value is 9 (as configured by the server
106
- this.minZoomInterpolation = options.minZoomInterpolation || 8; // Min zoom level from which trains positions are not interpolated.
107
- this.format = new GeoJSON();
108
- this.generalizationLevelByZoom = options.generalizationLevelByZoom || {
109
- 0: 5,
110
- 1: 5,
111
- 2: 5,
112
- 3: 5,
113
- 4: 5,
114
- 5: 5,
115
- 6: 5,
116
- 7: 5,
117
- 8: 10,
118
- 9: 30,
119
- 10: 30,
120
- 11: 100,
121
- 12: 100,
122
- 13: 100,
123
- };
124
-
125
- // This property will call api.setBbox on each movend event
126
- this.isUpdateBboxOnMoveEnd = options.isUpdateBboxOnMoveEnd !== false;
127
-
128
- // Define throttling nad debounce render function
129
- this.throttleRenderTrajectories = throttle(
130
- this.renderTrajectoriesInternal,
131
- 50,
132
- { leading: false, trailing: true },
133
- );
134
-
135
- this.debounceRenderTrajectories = debounce(
136
- this.renderTrajectoriesInternal,
137
- 50,
138
- { leading: true, trailing: true, maxWait: 5000 },
139
- );
140
-
141
- // Bind callbacks
142
- this.onFeatureHover = this.onFeatureHover.bind(this);
143
- this.onFeatureClick = this.onFeatureClick.bind(this);
144
- this.renderTrajectoriesInternal =
145
- this.renderTrajectoriesInternal.bind(this);
146
- this.onTrajectoryMessage = this.onTrajectoryMessage.bind(this);
147
- this.onDeleteTrajectoryMessage =
148
- this.onDeleteTrajectoryMessage.bind(this);
149
- this.onDocumentVisibilityChange =
150
- this.onDocumentVisibilityChange.bind(this);
151
- }
152
-
153
- /**
154
- * Define layer's properties.
155
- *
156
- * @ignore
157
- */
158
- defineProperties(options) {
159
- // Tracker options use to build the tracker.
160
- let { regexPublishedLineName, publishedLineName, tripNumber, operator } =
161
- options;
162
- const {
163
- style,
164
- speed,
165
- pixelRatio,
166
- hoverVehicleId,
167
- selectedVehicleId,
168
- filter,
169
- sort,
170
- time,
171
- live,
172
- } = options;
173
-
174
- const initTrackerOptions = {
175
- style,
176
- };
177
-
178
- Object.keys(initTrackerOptions).forEach(
179
- (key) =>
180
- initTrackerOptions[key] === undefined &&
181
- delete initTrackerOptions[key],
182
- );
183
-
184
- let currSpeed = speed || 1;
185
- let currTime = time || new Date();
186
-
187
- super.defineProperties(options);
188
-
189
- Object.defineProperties(this, {
190
- isTrackerLayer: { value: true },
191
-
192
- /**
193
- * Style function used to render a vehicle.
194
- */
195
- style: {
196
- value: (trajectory, viewState) =>
197
- (style || trackerDefaultStyle)(trajectory, viewState, this),
198
- },
199
-
200
- /**
201
- * Speed of the wheel of time.
202
- * If live property is true. The speed is ignored.
203
- */
204
- speed: {
205
- get: () => currSpeed,
206
- set: (newSpeed) => {
207
- currSpeed = newSpeed;
208
- this.start();
209
- },
210
- },
211
-
212
- /**
213
- * Function to filter which vehicles to display.
214
- */
215
- filter: {
216
- value: filter,
217
- writable: true,
218
- },
219
-
220
- /**
221
- * Function to sort the vehicles to display.
222
- */
223
- sort: {
224
- value: sort,
225
- writable: true,
226
- },
227
-
228
- /**
229
- * The tracker that renders the trajectories.
230
- */
231
- tracker: { value: null, writable: true },
232
-
233
- /**
234
- * Canvas cache object for trajectories drawn.
235
- */
236
- styleCache: { value: {} },
237
-
238
- /**
239
- * If true. The layer will always use Date.now() on the next tick to render the trajectories.
240
- * When true, setting the time property has no effect.
241
- */
242
- live: {
243
- value: live === false ? live : true,
244
- writable: true,
245
- },
246
-
247
- /**
248
- * Time used to display the trajectories. Can be a Date or a number in ms representing a Date.
249
- * If live property is true. The setter does nothing.
250
- */
251
- time: {
252
- get: () => currTime,
253
- set: (newTime) => {
254
- currTime = newTime && newTime.getTime ? newTime : new Date(newTime);
255
- this.renderTrajectories();
256
- },
257
- },
258
-
259
- /**
260
- * Keep track of which trajectories are stored.
261
- */
262
- trajectories: {
263
- value: {},
264
- writable: true,
265
- },
266
-
267
- /**
268
- * Keep track of which trajectories are currently drawn.
269
- */
270
- renderedTrajectories: {
271
- get: () => (this.tracker && this.tracker.renderedTrajectories) || [],
272
- },
273
-
274
- /**
275
- * Id of the hovered vehicle.
276
- */
277
- hoverVehicleId: {
278
- value: hoverVehicleId,
279
- writable: true,
280
- },
281
-
282
- /**
283
- * Id of the selected vehicle.
284
- */
285
- selectedVehicleId: {
286
- value: selectedVehicleId,
287
- writable: true,
288
- },
289
-
290
- /**
291
- * Id of the selected vehicle.
292
- */
293
- pixelRatio: {
294
- value:
295
- pixelRatio ||
296
- (typeof window !== 'undefined' ? window.devicePixelRatio : 1),
297
- writable: true,
298
- },
299
-
300
- /**
301
- * Options used by the constructor of the Tracker class.
302
- */
303
- initTrackerOptions: {
304
- value: initTrackerOptions,
305
- writable: false,
306
- },
307
-
308
- /**
309
- * If true, encapsulates the renderTrajectories calls in a requestAnimationFrame.
310
- */
311
- useRequestAnimationFrame: {
312
- value: options.useRequestAnimationFrame || false,
313
- writable: true,
314
- },
315
-
316
- /**
317
- * If true, encapsulates the renderTrajectories calls in a throttle function. Default to true.
318
- */
319
- useThrottle: {
320
- value: options.useThrottle || true,
321
- writable: true,
322
- },
323
-
324
- /**
325
- * If true, encapsulates the renderTrajectories calls in a debounce function.
326
- */
327
- useDebounce: {
328
- value: options.useDebounce || false,
329
- writable: true,
330
- },
331
-
332
- /**
333
- * Filter properties used in combination with permalink parameters.
334
- */
335
- publishedLineName: {
336
- get: () => publishedLineName,
337
- set: (newPublishedLineName) => {
338
- publishedLineName = newPublishedLineName;
339
- this.updateFilters();
340
- },
341
- },
342
- tripNumber: {
343
- get: () => tripNumber,
344
- set: (newTripNumber) => {
345
- tripNumber = newTripNumber;
346
- this.updateFilters();
347
- },
348
- },
349
- operator: {
350
- get: () => operator,
351
- set: (newOperator) => {
352
- operator = newOperator;
353
- this.updateFilters();
354
- },
355
- },
356
- regexPublishedLineName: {
357
- get: () => regexPublishedLineName,
358
- set: (newRegex) => {
359
- regexPublishedLineName = newRegex;
360
- this.updateFilters();
361
- },
362
- },
363
-
364
- /**
365
- * Style properties.
366
- */
367
- delayDisplay: {
368
- value: options.delayDisplay || 300000,
369
- writable: true,
370
- },
371
- delayOutlineColor: {
372
- value: options.delayOutlineColor || '#000000',
373
- writable: true,
374
- },
375
-
376
- /**
377
- * Debug properties.
378
- */
379
- // Not used anymore, but could be useful for debugging.
380
- // showVehicleTraj: {
381
- // value:
382
- // options.showVehicleTraj !== undefined
383
- // ? options.showVehicleTraj
384
- // : true,
385
- // writable: true,
386
- // },
387
- });
388
-
389
- // Update filter function based on convenient properties
390
- this.updateFilters();
391
- }
392
-
393
- init(map) {
394
- super.init(map);
395
-
396
- this.tracker = new Tracker({
397
- style: (...args) => this.style(...args),
398
- ...this.initTrackerOptions,
399
- });
400
-
401
- // If the layer is visible we start the rendering clock
402
- if (this.visible) {
403
- this.start();
404
- }
405
-
406
- // On change of visibility we start/stop the rendering clock
407
- this.visibilityRef = this.on('change:visible', (evt) => {
408
- if (evt.target.visible) {
409
- this.start();
410
- } else {
411
- this.stop();
412
- }
413
- });
414
-
415
- // To avoid browser hanging when the tab is not visible for a certain amount of time,
416
- // We stop the rendering and the websocket when hide and start again when show.
417
- document.addEventListener(
418
- 'visibilitychange',
419
- this.onDocumentVisibilityChange,
420
- );
421
- }
422
-
423
- terminate() {
424
- document.removeEventListener(
425
- 'visibilitychange',
426
- this.onDocumentVisibilityChange,
427
- );
428
-
429
- this.stop();
430
- unByKey(this.visibilityRef);
431
- if (this.tracker) {
432
- const { canvas } = this.tracker;
433
- const context = canvas.getContext('2d');
434
- context.clearRect(0, 0, canvas.width, canvas.height);
435
- this.tracker = null;
436
- }
437
- super.terminate();
438
- }
439
-
440
- start() {
441
- this.stop();
442
- this.renderTrajectories();
443
- this.startUpdateTime();
444
-
445
- if (this.isClickActive) {
446
- this.onClick(this.onFeatureClick);
447
- }
448
-
449
- if (this.isHoverActive) {
450
- this.onHover(this.onFeatureHover);
451
- }
452
-
453
- this.api.open();
454
- this.api.subscribeTrajectory(
455
- this.mode,
456
- this.onTrajectoryMessage,
457
- this.isUpdateBboxOnMoveEnd,
458
- );
459
- this.api.subscribeDeletedVehicles(
460
- this.mode,
461
- this.onDeleteTrajectoryMessage,
462
- this.isUpdateBboxOnMoveEnd,
463
- );
464
-
465
- if (this.isUpdateBboxOnMoveEnd) {
466
- // Update the bbox on each move end
467
- this.setBbox();
468
- }
469
- }
470
-
471
- /**
472
- * Start the clock.
473
- * @private
474
- */
475
- startUpdateTime() {
476
- this.stopUpdateTime();
477
- this.updateTimeDelay = this.getRefreshTimeInMs();
478
- this.updateTimeInterval = setInterval(() => {
479
- // When live=true, we update the time with new Date();
480
- this.time = this.live
481
- ? new Date()
482
- : this.time.getTime() + this.updateTimeDelay * this.speed;
483
- }, this.updateTimeDelay);
484
- }
485
-
486
- stop() {
487
- this.api.unsubscribeTrajectory(this.onTrajectoryMessage);
488
- this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage);
489
- this.api.close();
490
- }
491
-
492
- /**
493
- * Stop the clock.
494
- * @private
495
- */
496
- stopUpdateTime() {
497
- if (this.updateTimeInterval) {
498
- clearInterval(this.updateTimeInterval);
499
- }
500
- }
501
-
502
- /**
503
- * Launch renderTrajectories. it avoids duplicating code in renderTrajectories method.
504
- *
505
- * @param {object} viewState The view state of the map.
506
- * @param {number[2]} viewState.center Center coordinate of the map in mercator coordinate.
507
- * @param {number[4]} viewState.extent Extent of the map in mercator coordinates.
508
- * @param {number[2]} viewState.size Size ([width, height]) of the canvas to render.
509
- * @param {number} [viewState.rotation = 0] Rotation of the map to render.
510
- * @param {number} viewState.resolution Resolution of the map to render.
511
- * @param {boolean} noInterpolate If true trajectories are not interpolated but
512
- * drawn at the last known coordinate. Use this for performance optimization
513
- * during map navigation.
514
- * @private
515
- */
516
- renderTrajectoriesInternal(viewState, noInterpolate) {
517
- if (!this.tracker) {
518
- return false;
519
- }
520
-
521
- const time = this.live ? Date.now() : this.time;
522
-
523
- const trajectories = Object.values(this.trajectories);
524
-
525
- // console.time('sort');
526
- if (this.sort) {
527
- trajectories.sort(this.sort);
528
- }
529
- // console.timeEnd('sort');
530
-
531
- // console.time('render');
532
- this.renderState = this.tracker.renderTrajectories(
533
- trajectories,
534
- { ...viewState, pixelRatio: this.pixelRatio, time },
535
- {
536
- noInterpolate:
537
- viewState.zoom < this.minZoomInterpolation ? true : noInterpolate,
538
- hoverVehicleId: this.hoverVehicleId,
539
- selectedVehicleId: this.selectedVehicleId,
540
- iconScale: this.iconScale,
541
- delayDisplay: this.delayDisplay,
542
- delayOutlineColor: this.delayOutlineColor,
543
- },
544
- );
545
-
546
- // console.timeEnd('render');
547
- return true;
548
- }
549
-
550
- /**
551
- * Render the trajectories requesting an animation frame and cancelling the previous one.
552
- * This function must be overrided by children to provide the correct parameters.
553
- *
554
- * @param {object} viewState The view state of the map.
555
- * @param {number[2]} viewState.center Center coordinate of the map in mercator coordinate.
556
- * @param {number[4]} viewState.extent Extent of the map in mercator coordinates.
557
- * @param {number[2]} viewState.size Size ([width, height]) of the canvas to render.
558
- * @param {number} [viewState.rotation = 0] Rotation of the map to render.
559
- * @param {number} viewState.resolution Resolution of the map to render.
560
- * @param {boolean} noInterpolate If true trajectories are not interpolated but
561
- * drawn at the last known coordinate. Use this for performance optimization
562
- * during map navigation.
563
- * @private
564
- */
565
- renderTrajectories(viewState, noInterpolate) {
566
- if (this.requestId) {
567
- cancelAnimationFrame(this.requestId);
568
- this.requestId = null;
569
- }
570
-
571
- if (!noInterpolate && this.useRequestAnimationFrame) {
572
- this.requestId = requestAnimationFrame(() => {
573
- this.renderTrajectoriesInternal(viewState, noInterpolate);
574
- });
575
- } else if (!noInterpolate && this.useDebounce) {
576
- this.debounceRenderTrajectories(viewState, noInterpolate);
577
- } else if (!noInterpolate && this.useThrottle) {
578
- this.throttleRenderTrajectories(viewState, noInterpolate);
579
- } else {
580
- this.renderTrajectoriesInternal(viewState, noInterpolate);
581
- }
582
- }
583
-
584
- setBbox(extent, zoom) {
585
- // Clean trajectories before sending the new bbox
586
- // Purge trajectories:
587
- // - which are outside the extent
588
- // - when it's bus and zoom level is too low for them
589
- const keys = Object.keys(this.trajectories);
590
- for (let i = keys.length - 1; i >= 0; i -= 1) {
591
- this.purgeTrajectory(this.trajectories[keys[i]], extent, zoom);
592
- }
593
-
594
- const bbox = [...extent];
595
-
596
- if (this.isUpdateBboxOnMoveEnd) {
597
- bbox.push(zoom);
598
-
599
- if (this.tenant) {
600
- bbox.push(`tenant=${this.tenant}`);
601
- }
602
-
603
- /* @ignore */
604
- this.generalizationLevel = this.generalizationLevelByZoom[zoom];
605
- if (this.generalizationLevel) {
606
- bbox.push(`gen=${this.generalizationLevel}`);
607
- }
608
- }
609
-
610
- this.api.bbox = bbox;
611
- }
612
-
613
- setMode(mode) {
614
- if (this.mode === mode) {
615
- return;
616
- }
617
- this.mode = mode;
618
- this.api.subscribeTrajectory(
619
- this.mode,
620
- this.onTrajectoryMessage,
621
- this.isUpdateBboxOnMoveEnd,
622
- );
623
- this.api.subscribeDeletedVehicles(
624
- this.mode,
625
- this.onDeleteTrajectoryMessage,
626
- this.isUpdateBboxOnMoveEnd,
627
- );
628
- }
629
-
630
- /**
631
- * Get the duration before the next update depending on zoom level.
632
- *
633
- * @private
634
- * @param {number} zoom
635
- */
636
- getRefreshTimeInMs(zoom) {
637
- const roundedZoom = Math.round(zoom);
638
- const timeStep = timeSteps[roundedZoom] || 25;
639
- const nextTick = Math.max(25, timeStep / this.speed);
640
- const nextThrottleTick = Math.min(nextTick, 500);
641
- // TODO: see if this should go elsewhere.
642
- if (this.useThrottle) {
643
- this.throttleRenderTrajectories = throttle(
644
- this.renderTrajectoriesInternal,
645
- nextThrottleTick,
646
- { leading: true, trailing: true },
647
- );
648
- } else if (this.useDebounce) {
649
- this.debounceRenderTrajectories = debounce(
650
- this.renderTrajectoriesInternal,
651
- nextThrottleTick,
652
- { leading: true, trailing: true, maxWait: 5000 },
653
- );
654
- }
655
- if (this.api?.buffer) {
656
- const [, size] = this.api.buffer;
657
- this.api.buffer = [nextThrottleTick, size];
658
- }
659
- return nextTick;
660
- }
661
-
662
- /**
663
- * Get vehicle.
664
- * @param {function} filterFc A function use to filter results.
665
- * @return {Array<Object>} Array of vehicle.
666
- */
667
- getVehicle(filterFc) {
668
- return Object.values(this.trajectories).filter(filterFc);
669
- }
670
-
671
- /**
672
- * Request feature information for a given coordinate.
673
- *
674
- * @param {ol/coordinate~Coordinate} coordinate Coordinate.
675
- * @param {Object} options Options See child classes to see which options are supported.
676
- * @param {number} [options.resolution=1] The resolution of the map.
677
- * @param {number} [options.nb=Infinity] The max number of vehicles to return.
678
- * @return {Promise<FeatureInfo>} Promise with features, layer and coordinate.
679
- */
680
- getFeatureInfoAtCoordinate(coordinate, options = {}) {
681
- const { resolution, nb } = options;
682
- const ext = buffer(
683
- [...coordinate, ...coordinate],
684
- this.hitTolerance * resolution,
685
- );
686
- let trajectories = Object.values(this.trajectories);
687
-
688
- if (this.sort) {
689
- trajectories = trajectories.sort(this.sort);
690
- }
691
-
692
- const vehicles = [];
693
- for (let i = 0; i < trajectories.length; i += 1) {
694
- if (
695
- trajectories[i].properties.coordinate &&
696
- containsCoordinate(ext, trajectories[i].properties.coordinate)
697
- ) {
698
- vehicles.push(trajectories[i]);
699
- }
700
- if (vehicles.length === nb) {
701
- break;
702
- }
703
- }
704
-
705
- return Promise.resolve({
706
- layer: this,
707
- features: vehicles.map((vehicle) => this.format.readFeature(vehicle)),
708
- coordinate,
709
- });
710
- }
711
-
712
- /**
713
- * Request the stopSequence and the fullTrajectory informations for a vehicle.
714
- *
715
- * @param {string} id The vehicle identifier (the train_id property).
716
- * @return {Promise<{stopSequence: StopSequence, fullTrajectory: FullTrajectory>} A promise that will be resolved with the trajectory informations.
717
- */
718
- getTrajectoryInfos(id) {
719
- // When a vehicle is selected, we request the complete stop sequence and the complete full trajectory.
720
- // Then we combine them in one response and send them to inherited layers.
721
- const promises = [
722
- this.api.getStopSequence(id, this.mode),
723
- this.api.getFullTrajectory(id, this.mode, this.generalizationLevel),
724
- ];
725
-
726
- return Promise.all(promises).then(([stopSequence, fullTrajectory]) => {
727
- const response = {
728
- stopSequence,
729
- fullTrajectory,
730
- };
731
- return response;
732
- });
733
- }
734
-
735
- /**
736
- * Determine if the trajectory is useless and should be removed from the list or not.
737
- * By default, this function exclude vehicles:
738
- * - that have their trajectory outside the current extent and
739
- * - that are not a train and zoom level is lower than layer's minZoomNonTrain property.
740
- *
741
- * @param {TralisTrajectory} trajectory
742
- * @param {Array<number>} extent
743
- * @param {number} zoom
744
- * @return {boolean} if the trajectory must be displayed or not.
745
- * @ignore
746
- */
747
- purgeTrajectory(trajectory, extent, zoom) {
748
- const { type, bounds, train_id: id } = trajectory.properties;
749
- if (
750
- !intersects(extent, bounds) ||
751
- (type !== 'rail' && zoom < (this.minZoomNonTrain || 9))
752
- ) {
753
- this.removeTrajectory(id);
754
- return true;
755
- }
756
- return false;
757
- }
758
-
759
- /**
760
- * Add a trajectory to the tracker.
761
- * @param {TralisTrajectory} trajectory The trajectory to add.
762
- * @private
763
- */
764
- addTrajectory(trajectory) {
765
- if (this.filter && !this.filter(trajectory)) {
766
- return;
767
- }
768
- this.trajectories[trajectory.properties.train_id] = trajectory;
769
- this.renderTrajectories();
770
- }
771
-
772
- removeTrajectory(id) {
773
- delete this.trajectories[id];
774
- }
775
-
776
- /**
777
- * On zoomend we adjust the time interval of the update of vehicles positions.
778
- *
779
- * @param evt Event that triggered the function.
780
- * @private
781
- */
782
- // eslint-disable-next-line no-unused-vars
783
- onZoomEnd(evt) {
784
- this.startUpdateTime();
785
- }
786
-
787
- onDocumentVisibilityChange() {
788
- if (!this.visible) {
789
- return;
790
- }
791
- if (document.hidden) {
792
- this.stop();
793
- } else {
794
- this.start();
795
- }
796
- }
797
-
798
- /**
799
- * Callback on websocket's trajectory channel events.
800
- * It adds a trajectory to the list.
801
- *
802
- * @private
803
- */
804
- onTrajectoryMessage(data) {
805
- if (!data.content) {
806
- return;
807
- }
808
- const trajectory = data.content;
809
-
810
- const {
811
- geometry,
812
- properties: {
813
- train_id: id,
814
- time_since_update: timeSinceUpdate,
815
- raw_coordinates: rawCoordinates,
816
- },
817
- } = trajectory;
818
-
819
- // ignore old events [SBAHNM-97]
820
- if (timeSinceUpdate < 0) {
821
- return;
822
- }
823
-
824
- // console.time(`onTrajectoryMessage${data.content.properties.train_id}`);
825
- if (this.purgeTrajectory(trajectory)) {
826
- return;
827
- }
828
-
829
- if (
830
- this.debug &&
831
- this.mode === TralisModes.TOPOGRAPHIC &&
832
- rawCoordinates
833
- ) {
834
- trajectory.properties.olGeometry = {
835
- type: 'Point',
836
- coordinates: fromLonLat(
837
- rawCoordinates,
838
- this.map.getView().getProjection(),
839
- ),
840
- };
841
- } else {
842
- trajectory.properties.olGeometry = this.format.readGeometry(geometry);
843
- }
844
-
845
- // TODO Make sure the timeOffset is useful. May be we can remove it.
846
- trajectory.properties.timeOffset = Date.now() - data.timestamp;
847
- this.addTrajectory(trajectory);
848
- }
849
-
850
- /**
851
- * Callback on websocket's deleted_vehicles channel events.
852
- * It removes the trajectory from the list.
853
- *
854
- * @private
855
- * @override
856
- */
857
- onDeleteTrajectoryMessage(data) {
858
- if (!data.content) {
859
- return;
860
- }
861
-
862
- this.removeTrajectory(data.content);
863
- }
864
-
865
- /**
866
- * Callback when user moves the mouse/pointer over the map.
867
- * It sets the layer's hoverVehicleId property with the current hovered vehicle's id.
868
- *
869
- * @private
870
- * @override
871
- */
872
- onFeatureHover(features, layer, coordinate) {
873
- const [feature] = features;
874
- let id = null;
875
- if (feature) {
876
- id = feature.get('train_id');
877
- }
878
- if (this.hoverVehicleId !== id) {
879
- /** @ignore */
880
- this.hoverVehicleId = id;
881
- this.renderTrajectories(true);
882
- }
883
- }
884
-
885
- /**
886
- * Callback when user clicks on the map.
887
- * It sets the layer's selectedVehicleId property with the current selected vehicle's id.
888
- *
889
- * @private
890
- * @override
891
- */
892
- onFeatureClick(features, layer, coordinate) {
893
- const [feature] = features;
894
- let id = null;
895
- if (feature) {
896
- id = feature.get('train_id');
897
- }
898
- if (this.selectedVehicleId !== id) {
899
- /** @ignore */
900
- this.selectedVehicleId = id;
901
- this.selectedVehicle = feature;
902
- this.renderTrajectories(true);
903
- }
904
- }
905
-
906
- /**
907
- * Update filter provided by properties or permalink.
908
- */
909
- updateFilters() {
910
- // Setting filters from the permalink if no values defined by the layer.
911
- const parameters = qs.parse(window.location.search.toLowerCase());
912
- const publishedName = this.publishedLineName || parameters[LINE_FILTER];
913
- const tripNumber = this.tripNumber || parameters[ROUTE_FILTER];
914
- const operator = this.operator || parameters[OPERATOR_FILTER];
915
- const { regexPublishedLineName } = this;
916
-
917
- // Only overrides filter function if one of this property exists.
918
- if (publishedName || tripNumber || operator || regexPublishedLineName) {
919
- // filter is the property in TrackerLayerMixin.
920
- this.filter = createFilters(
921
- publishedName,
922
- tripNumber,
923
- operator,
924
- regexPublishedLineName,
925
- );
926
- }
927
- }
928
- };
929
-
930
- export default TralisLayerMixin;