mobility-toolbox-js 2.0.0-beta.8 → 2.0.0-beta.80
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.
- package/api/RealtimeAPI.d.ts +279 -0
- package/api/RealtimeAPI.d.ts.map +1 -0
- package/api/RealtimeAPI.js +466 -0
- package/api/RoutingAPI.d.ts +37 -0
- package/api/RoutingAPI.d.ts.map +1 -0
- package/api/RoutingAPI.js +35 -0
- package/api/StopsAPI.d.ts +38 -0
- package/api/StopsAPI.d.ts.map +1 -0
- package/api/StopsAPI.js +36 -0
- package/api/index.d.ts +4 -0
- package/api/index.d.ts.map +1 -0
- package/api/index.js +3 -0
- package/api/typedefs.d.ts +179 -0
- package/api/typedefs.d.ts.map +1 -0
- package/{src/api/tralis → api}/typedefs.js +4 -10
- package/common/api/HttpAPI.d.ts +31 -0
- package/common/api/HttpAPI.d.ts.map +1 -0
- package/common/api/HttpAPI.js +57 -0
- package/common/api/WebSocketAPI.d.ts +153 -0
- package/common/api/WebSocketAPI.d.ts.map +1 -0
- package/common/api/WebSocketAPI.js +341 -0
- package/common/controls/ControlCommon.d.ts +76 -0
- package/common/controls/ControlCommon.d.ts.map +1 -0
- package/common/controls/ControlCommon.js +150 -0
- package/common/controls/CopyrightControlCommon.d.ts +13 -0
- package/common/controls/CopyrightControlCommon.d.ts.map +1 -0
- package/common/controls/CopyrightControlCommon.js +34 -0
- package/common/controls/StopFinderControlCommon.d.ts +55 -0
- package/common/controls/StopFinderControlCommon.d.ts.map +1 -0
- package/common/controls/StopFinderControlCommon.js +144 -0
- package/common/index.d.ts +3 -0
- package/common/index.d.ts.map +1 -0
- package/common/index.js +2 -0
- package/common/layers/LayerCommon.d.ts +94 -0
- package/common/layers/LayerCommon.d.ts.map +1 -0
- package/common/layers/LayerCommon.js +244 -0
- package/common/mixins/RealtimeLayerMixin.d.ts +286 -0
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -0
- package/common/mixins/RealtimeLayerMixin.js +776 -0
- package/common/mixins/UserInteractionsLayerMixin.d.ts +60 -0
- package/common/mixins/UserInteractionsLayerMixin.d.ts.map +1 -0
- package/common/mixins/UserInteractionsLayerMixin.js +241 -0
- package/common/styles/index.d.ts +5 -0
- package/common/styles/index.d.ts.map +1 -0
- package/common/styles/index.js +4 -0
- package/common/styles/realtimeDefaultStyle.d.ts +36 -0
- package/common/styles/realtimeDefaultStyle.d.ts.map +1 -0
- package/common/styles/realtimeDefaultStyle.js +275 -0
- package/{src/common/styles/trackerDelayStyle.js → common/styles/realtimeDelayStyle.d.ts} +4 -9
- package/common/styles/realtimeDelayStyle.d.ts.map +1 -0
- package/common/styles/realtimeDelayStyle.js +13 -0
- package/common/styles/realtimeHeadingStyle.d.ts +12 -0
- package/common/styles/realtimeHeadingStyle.d.ts.map +1 -0
- package/common/styles/realtimeHeadingStyle.js +85 -0
- package/common/styles/realtimeSimpleStyle.d.ts +4 -0
- package/common/styles/realtimeSimpleStyle.d.ts.map +1 -0
- package/common/styles/realtimeSimpleStyle.js +23 -0
- package/common/typedefs.d.ts +111 -0
- package/common/typedefs.d.ts.map +1 -0
- package/common/typedefs.js +52 -0
- package/common/utils/compareDepartures.d.ts +11 -0
- package/common/utils/compareDepartures.d.ts.map +1 -0
- package/common/utils/compareDepartures.js +35 -0
- package/common/utils/createCanvas.d.ts +10 -0
- package/common/utils/createCanvas.d.ts.map +1 -0
- package/common/utils/createCanvas.js +27 -0
- package/common/utils/createRealtimeFilters.d.ts +13 -0
- package/common/utils/createRealtimeFilters.d.ts.map +1 -0
- package/common/utils/createRealtimeFilters.js +74 -0
- package/common/utils/debounceDeparturesMessages.d.ts +12 -0
- package/common/utils/debounceDeparturesMessages.d.ts.map +1 -0
- package/common/utils/debounceDeparturesMessages.js +24 -0
- package/common/utils/debounceWebsocketMessages.d.ts +11 -0
- package/common/utils/debounceWebsocketMessages.d.ts.map +1 -0
- package/common/utils/debounceWebsocketMessages.js +29 -0
- package/common/utils/getLayersAsFlatArray.d.ts +3 -0
- package/common/utils/getLayersAsFlatArray.d.ts.map +1 -0
- package/common/utils/getLayersAsFlatArray.js +15 -0
- package/common/utils/getMapboxMapCopyrights.d.ts +18 -0
- package/common/utils/getMapboxMapCopyrights.d.ts.map +1 -0
- package/common/utils/getMapboxMapCopyrights.js +30 -0
- package/common/utils/getMapboxRender.d.ts +7 -0
- package/common/utils/getMapboxRender.d.ts.map +1 -0
- package/common/utils/getMapboxRender.js +87 -0
- package/common/utils/getMaplibreRender.d.ts +7 -0
- package/common/utils/getMaplibreRender.d.ts.map +1 -0
- package/common/utils/getMaplibreRender.js +38 -0
- package/common/utils/getRealtimeModeSuffix.d.ts +10 -0
- package/common/utils/getRealtimeModeSuffix.d.ts.map +1 -0
- package/common/utils/getRealtimeModeSuffix.js +7 -0
- package/common/utils/getUrlWithParams.d.ts +9 -0
- package/common/utils/getUrlWithParams.d.ts.map +1 -0
- package/common/utils/getUrlWithParams.js +18 -0
- package/common/utils/getVehiclePosition.d.ts +16 -0
- package/common/utils/getVehiclePosition.d.ts.map +1 -0
- package/common/utils/getVehiclePosition.js +72 -0
- package/common/utils/index.d.ts +17 -0
- package/common/utils/index.d.ts.map +1 -0
- package/common/utils/index.js +17 -0
- package/common/utils/realtimeConfig.d.ts +49 -0
- package/common/utils/realtimeConfig.d.ts.map +1 -0
- package/common/utils/realtimeConfig.js +173 -0
- package/common/utils/removeDuplicate.d.ts +10 -0
- package/common/utils/removeDuplicate.d.ts.map +1 -0
- package/common/utils/removeDuplicate.js +15 -0
- package/common/utils/renderTrajectories.d.ts +17 -0
- package/common/utils/renderTrajectories.d.ts.map +1 -0
- package/common/utils/renderTrajectories.js +110 -0
- package/common/utils/sortAndFilterDepartures.d.ts +16 -0
- package/common/utils/sortAndFilterDepartures.d.ts.map +1 -0
- package/common/utils/sortAndFilterDepartures.js +58 -0
- package/common/utils/sortByDelay.d.ts +3 -0
- package/common/utils/sortByDelay.d.ts.map +1 -0
- package/common/utils/sortByDelay.js +20 -0
- package/common/utils/timeUtils.d.ts +24 -0
- package/common/utils/timeUtils.d.ts.map +1 -0
- package/{src/common → common}/utils/timeUtils.js +13 -18
- package/iife.d.ts +3 -0
- package/iife.d.ts.map +1 -0
- package/{src/iife.js → iife.js} +1 -3
- package/index.d.ts +10 -0
- package/index.d.ts.map +1 -0
- package/index.js +10 -0
- package/mapbox/controls/CopyrightControl.d.ts +29 -0
- package/mapbox/controls/CopyrightControl.d.ts.map +1 -0
- package/mapbox/controls/CopyrightControl.js +48 -0
- package/mapbox/controls/index.d.ts +2 -0
- package/mapbox/controls/index.d.ts.map +1 -0
- package/mapbox/index.d.ts +6 -0
- package/mapbox/index.d.ts.map +1 -0
- package/{src/mapbox → mapbox}/index.js +1 -0
- package/mapbox/layers/Layer.d.ts +59 -0
- package/mapbox/layers/Layer.d.ts.map +1 -0
- package/mapbox/layers/Layer.js +101 -0
- package/mapbox/layers/RealtimeLayer.d.ts +181 -0
- package/mapbox/layers/RealtimeLayer.d.ts.map +1 -0
- package/mapbox/layers/RealtimeLayer.js +276 -0
- package/mapbox/layers/index.d.ts +3 -0
- package/mapbox/layers/index.d.ts.map +1 -0
- package/mapbox/layers/index.js +2 -0
- package/mapbox/utils/getMercatorResolution.d.ts +9 -0
- package/mapbox/utils/getMercatorResolution.d.ts.map +1 -0
- package/mapbox/utils/getMercatorResolution.js +18 -0
- package/mapbox/utils/getSourceCoordinates.d.ts +9 -0
- package/mapbox/utils/getSourceCoordinates.d.ts.map +1 -0
- package/mapbox/utils/getSourceCoordinates.js +27 -0
- package/mapbox/utils/index.d.ts +3 -0
- package/mapbox/utils/index.d.ts.map +1 -0
- package/mapbox/utils/index.js +2 -0
- package/mbt.js +59981 -0
- package/mbt.js.map +7 -0
- package/mbt.min.js +1084 -0
- package/mbt.min.js.map +7 -0
- package/ol/controls/CopyrightControl.d.ts +31 -0
- package/ol/controls/CopyrightControl.d.ts.map +1 -0
- package/ol/controls/CopyrightControl.js +68 -0
- package/ol/controls/RoutingControl.d.ts +193 -0
- package/ol/controls/RoutingControl.d.ts.map +1 -0
- package/ol/controls/RoutingControl.js +631 -0
- package/ol/controls/StopFinderControl.d.ts +30 -0
- package/ol/controls/StopFinderControl.d.ts.map +1 -0
- package/{src/ol → ol}/controls/StopFinderControl.js +10 -16
- package/ol/controls/index.d.ts +4 -0
- package/ol/controls/index.d.ts.map +1 -0
- package/ol/index.d.ts +6 -0
- package/ol/index.d.ts.map +1 -0
- package/ol/layers/Layer.d.ts +86 -0
- package/ol/layers/Layer.d.ts.map +1 -0
- package/ol/layers/Layer.js +160 -0
- package/ol/layers/MapGlLayer.d.ts +67 -0
- package/ol/layers/MapGlLayer.d.ts.map +1 -0
- package/ol/layers/MapGlLayer.js +218 -0
- package/ol/layers/MapboxLayer.d.ts +50 -0
- package/ol/layers/MapboxLayer.d.ts.map +1 -0
- package/ol/layers/MapboxLayer.js +109 -0
- package/ol/layers/MapboxStyleLayer.d.ts +129 -0
- package/ol/layers/MapboxStyleLayer.d.ts.map +1 -0
- package/ol/layers/MapboxStyleLayer.js +374 -0
- package/ol/layers/MaplibreLayer.d.ts +28 -0
- package/ol/layers/MaplibreLayer.d.ts.map +1 -0
- package/ol/layers/MaplibreLayer.js +34 -0
- package/ol/layers/RealtimeLayer.d.ts +202 -0
- package/ol/layers/RealtimeLayer.d.ts.map +1 -0
- package/ol/layers/RealtimeLayer.js +340 -0
- package/ol/layers/RoutingLayer.d.ts +34 -0
- package/ol/layers/RoutingLayer.d.ts.map +1 -0
- package/ol/layers/RoutingLayer.js +85 -0
- package/ol/layers/VectorLayer.d.ts +25 -0
- package/ol/layers/VectorLayer.d.ts.map +1 -0
- package/ol/layers/VectorLayer.js +38 -0
- package/ol/layers/WMSLayer.d.ts +42 -0
- package/ol/layers/WMSLayer.d.ts.map +1 -0
- package/ol/layers/WMSLayer.js +88 -0
- package/ol/layers/index.d.ts +9 -0
- package/ol/layers/index.d.ts.map +1 -0
- package/{src/ol → ol}/layers/index.js +1 -1
- package/ol/styles/fullTrajectoryDelayStyle.d.ts +4 -0
- package/ol/styles/fullTrajectoryDelayStyle.d.ts.map +1 -0
- package/ol/styles/fullTrajectoryDelayStyle.js +33 -0
- package/ol/styles/fullTrajectoryStyle.d.ts +5 -0
- package/ol/styles/fullTrajectoryStyle.d.ts.map +1 -0
- package/ol/styles/fullTrajectoryStyle.js +44 -0
- package/ol/styles/index.d.ts +3 -0
- package/ol/styles/index.d.ts.map +1 -0
- package/package.json +96 -189
- package/setupTests.d.ts +2 -0
- package/setupTests.d.ts.map +1 -0
- package/{src/setupTests.js → setupTests.js} +13 -2
- package/types/common.d.ts +122 -0
- package/types/index.d.ts +11 -0
- package/types/realtime.d.ts +320 -0
- package/types/routing.d.ts +206 -0
- package/types/stops.d.ts +143 -0
- package/.babelrc +0 -6
- package/.esdoc.json +0 -17
- package/.eslintignore +0 -1
- package/.github/workflows/conventional-pr-title.yml +0 -21
- package/.github/workflows/cypress.yml +0 -29
- package/.github/workflows/nodejs.yml +0 -28
- package/.husky/commit-msg +0 -4
- package/.husky/post-checkout +0 -4
- package/.husky/post-merge +0 -4
- package/.husky/post-rebase +0 -4
- package/.husky/pre-commit +0 -4
- package/.neutrinorc.js +0 -176
- package/.nvmrc +0 -1
- package/CHANGELOG.md +0 -10
- package/LICENSE +0 -21
- package/README.md +0 -23
- package/__mocks__/mapbox-gl.js +0 -81
- package/__mocks__/maplibre-gl.js +0 -81
- package/commitlint.config.js +0 -1
- package/cypress/fixtures/example.json +0 -5
- package/cypress/integration/examples/api.spec.js +0 -7
- package/cypress/integration/examples/examples.spec.js +0 -7
- package/cypress/integration/examples/navigation.spec.js +0 -29
- package/cypress/plugins/index.js +0 -21
- package/cypress/support/commands.js +0 -25
- package/cypress/support/index.js +0 -20
- package/cypress.json +0 -4
- package/data/fetchRoute.json +0 -292
- package/data/fetchTrajectories.json +0 -18
- package/data/fetchTrajectoryById.json +0 -3
- package/data/fetchTrajectoryStations.json +0 -18
- package/data/stopsSearch.json +0 -15
- package/documentation.yml +0 -4
- package/esdoc/README.md +0 -27
- package/esdoc/plugins/MyPlugin.js +0 -69
- package/esdoc/plugins/dynamic-property-plugin/Plugin.js +0 -50
- package/esdoc/plugins/externals-plugin/Plugin.js +0 -45
- package/esdoc/plugins/externals-plugin/externals.js +0 -96
- package/global-setup.js +0 -3
- package/index.html +0 -0
- package/indexweb.html +0 -49
- package/jest.config.js +0 -5
- package/pull_request_template.md +0 -17
- package/renovate.json +0 -4
- package/scripts/read-pkg-json.js +0 -22
- package/src/api/index.js +0 -3
- package/src/api/routing/RoutingAPI.js +0 -44
- package/src/api/routing/RoutingAPI.test.js +0 -41
- package/src/api/stops/StopsAPI.js +0 -41
- package/src/api/stops/StopsAPI.test.js +0 -34
- package/src/api/tralis/TralisAPI.js +0 -731
- package/src/api/tralis/TralisAPI.test.js +0 -75
- package/src/api/tralis/TralisAPIUtils.js +0 -73
- package/src/api/tralis/WebSocketConnector.js +0 -338
- package/src/api/tralis/WebSocketConnector.test.js +0 -356
- package/src/assets/Lato-Black.ttf +0 -0
- package/src/assets/Lato-BlackItalic.ttf +0 -0
- package/src/assets/Lato-Bold.ttf +0 -0
- package/src/assets/Lato-BoldItalic.ttf +0 -0
- package/src/assets/Lato-Italic.ttf +0 -0
- package/src/assets/Lato-Light.ttf +0 -0
- package/src/assets/Lato-LightItalic.ttf +0 -0
- package/src/assets/Lato-Regular.ttf +0 -0
- package/src/assets/Lato-Thin.ttf +0 -0
- package/src/assets/Lato-ThinItalic.ttf +0 -0
- package/src/assets/OFL.txt +0 -93
- package/src/common/Tracker.js +0 -197
- package/src/common/api/api.js +0 -64
- package/src/common/api/api.test.js +0 -68
- package/src/common/controls/Control.js +0 -146
- package/src/common/controls/Control.test.js +0 -98
- package/src/common/index.js +0 -5
- package/src/common/layers/Layer.js +0 -404
- package/src/common/layers/Layer.test.js +0 -585
- package/src/common/mixins/CopyrightMixin.js +0 -48
- package/src/common/mixins/SearchMixin.js +0 -176
- package/src/common/mixins/TralisLayerMixin.js +0 -930
- package/src/common/styles/index.js +0 -4
- package/src/common/styles/trackerDefaultStyle.js +0 -333
- package/src/common/styles/trackerSimpleStyle.js +0 -22
- package/src/common/trackerConfig.js +0 -190
- package/src/common/trackerConfig.test.js +0 -25
- package/src/common/typedefs.js +0 -23
- package/src/common/utils/createTrackerFilters.js +0 -87
- package/src/common/utils/createTrackerFilters.test.js +0 -95
- package/src/common/utils/getMapboxMapCopyrights.js +0 -32
- package/src/common/utils/getMapboxMapCopyrights.test.js +0 -47
- package/src/common/utils/getMapboxStyleUrl.js +0 -32
- package/src/common/utils/getVehiclePosition.js +0 -72
- package/src/common/utils/index.js +0 -5
- package/src/common/utils/removeDuplicate.js +0 -22
- package/src/common/utils/removeDuplicate.test.js +0 -22
- package/src/common/utils/sortByDelay.js +0 -23
- package/src/common/utils/timeUtils.test.js +0 -16
- package/src/doc/App.js +0 -116
- package/src/doc/App.scss +0 -51
- package/src/doc/_redirects +0 -2
- package/src/doc/components/CodeSandboxButton.js +0 -103
- package/src/doc/components/Documentation.js +0 -40
- package/src/doc/components/Esdoc/Anchor.js +0 -57
- package/src/doc/components/Esdoc/ClassDoc.js +0 -272
- package/src/doc/components/Esdoc/DeprecatedHTML.js +0 -16
- package/src/doc/components/Esdoc/DetailDocs.js +0 -281
- package/src/doc/components/Esdoc/DetailHTML.js +0 -33
- package/src/doc/components/Esdoc/DirectSubclassHTML.js +0 -30
- package/src/doc/components/Esdoc/DocBuilderUtils.js +0 -694
- package/src/doc/components/Esdoc/DocLinkHTML.js +0 -62
- package/src/doc/components/Esdoc/DocsLinkHTML.js +0 -38
- package/src/doc/components/Esdoc/Esdoc.js +0 -63
- package/src/doc/components/Esdoc/EsdocContent.js +0 -51
- package/src/doc/components/Esdoc/EsdocNavigation.js +0 -13
- package/src/doc/components/Esdoc/EsdocSearch.js +0 -81
- package/src/doc/components/Esdoc/ExperimentalHTML.js +0 -17
- package/src/doc/components/Esdoc/ExtendsChainHTML.js +0 -32
- package/src/doc/components/Esdoc/FileDocLinkHTML.js +0 -60
- package/src/doc/components/Esdoc/IdentifiersDoc.js +0 -113
- package/src/doc/components/Esdoc/IndirectSubclassHTML.js +0 -30
- package/src/doc/components/Esdoc/InheritedSummaryDoc.js +0 -70
- package/src/doc/components/Esdoc/InheritedSummaryHTML.js +0 -38
- package/src/doc/components/Esdoc/MixinClassesHTML.js +0 -29
- package/src/doc/components/Esdoc/NavDoc.js +0 -112
- package/src/doc/components/Esdoc/OverrideMethod.js +0 -44
- package/src/doc/components/Esdoc/OverrideMethodDescription.js +0 -35
- package/src/doc/components/Esdoc/Properties.js +0 -89
- package/src/doc/components/Esdoc/README.md +0 -45
- package/src/doc/components/Esdoc/SignatureHTML.js +0 -123
- package/src/doc/components/Esdoc/SingleDoc.js +0 -31
- package/src/doc/components/Esdoc/SummaryDoc.js +0 -160
- package/src/doc/components/Esdoc/SummaryHTML.js +0 -96
- package/src/doc/components/Esdoc/TypeDocLinkHTML.js +0 -249
- package/src/doc/components/Esdoc/css/identifiers.css +0 -38
- package/src/doc/components/Esdoc/css/search.css +0 -76
- package/src/doc/components/Esdoc/css/style.css +0 -603
- package/src/doc/components/Esdoc/index.js +0 -7
- package/src/doc/components/Example.js +0 -153
- package/src/doc/components/Examples.js +0 -183
- package/src/doc/components/Home.js +0 -106
- package/src/doc/components/TrackerExample.js +0 -38
- package/src/doc/examples/assets/tralis-live-map/index.js +0 -11
- package/src/doc/examples/assets/tralis-live-map/s1kreis.svg +0 -105
- package/src/doc/examples/assets/tralis-live-map/s20kreis.svg +0 -101
- package/src/doc/examples/assets/tralis-live-map/s2kreis.svg +0 -95
- package/src/doc/examples/assets/tralis-live-map/s3kreis.svg +0 -95
- package/src/doc/examples/assets/tralis-live-map/s4kreis.svg +0 -95
- package/src/doc/examples/assets/tralis-live-map/s6kreis.svg +0 -95
- package/src/doc/examples/assets/tralis-live-map/s7kreis.svg +0 -95
- package/src/doc/examples/assets/tralis-live-map/s8kreis.svg +0 -93
- package/src/doc/examples/assets/tralis-live-map/unknown.svg +0 -107
- package/src/doc/examples/mb-copyright.html +0 -26
- package/src/doc/examples/mb-copyright.js +0 -37
- package/src/doc/examples/mb-tracker.html +0 -1
- package/src/doc/examples/mb-tracker.js +0 -39
- package/src/doc/examples/mb-tracker.md +0 -1
- package/src/doc/examples/mb-tralis.html +0 -1
- package/src/doc/examples/mb-tralis.js +0 -34
- package/src/doc/examples/ol-copyright.html +0 -26
- package/src/doc/examples/ol-copyright.js +0 -43
- package/src/doc/examples/ol-mapbox-layer.html +0 -1
- package/src/doc/examples/ol-mapbox-layer.js +0 -28
- package/src/doc/examples/ol-mapbox-layer.md +0 -0
- package/src/doc/examples/ol-mapbox-style-layer.html +0 -12
- package/src/doc/examples/ol-mapbox-style-layer.js +0 -44
- package/src/doc/examples/ol-query.html +0 -32
- package/src/doc/examples/ol-query.js +0 -83
- package/src/doc/examples/ol-routing.html +0 -26
- package/src/doc/examples/ol-routing.js +0 -59
- package/src/doc/examples/ol-routing.md +0 -1
- package/src/doc/examples/ol-stop-finder.html +0 -15
- package/src/doc/examples/ol-stop-finder.js +0 -31
- package/src/doc/examples/ol-stop-finder.md +0 -1
- package/src/doc/examples/ol-tracker.html +0 -1
- package/src/doc/examples/ol-tracker.js +0 -44
- package/src/doc/examples/ol-tracker.md +0 -1
- package/src/doc/examples/ol-tralis.html +0 -5
- package/src/doc/examples/ol-tralis.js +0 -57
- package/src/doc/examples/tralis-live-map.html +0 -1
- package/src/doc/examples/tralis-live-map.js +0 -51
- package/src/doc/examples/tralis-live-map.md +0 -3
- package/src/doc/examples.js +0 -107
- package/src/doc/img/examples/live_tracker_mb.jpg +0 -0
- package/src/doc/img/examples/live_tracker_munich.jpg +0 -0
- package/src/doc/img/examples/live_tracker_ol.jpg +0 -0
- package/src/doc/img/examples/mapbox.jpg +0 -0
- package/src/doc/img/examples/mapbox_style.jpg +0 -0
- package/src/doc/img/examples/ol-copyright.png +0 -0
- package/src/doc/img/examples/query_objects.jpg +0 -0
- package/src/doc/img/examples/routing.jpg +0 -0
- package/src/doc/img/examples/simple_map.jpg +0 -0
- package/src/doc/img/examples/stops.jpg +0 -0
- package/src/doc/img/favico.ico +0 -0
- package/src/doc/index.js +0 -21
- package/src/index.js +0 -10
- package/src/mapbox/controls/CopyrightControl.js +0 -58
- package/src/mapbox/layers/Layer.js +0 -118
- package/src/mapbox/layers/Layer.test.js +0 -202
- package/src/mapbox/layers/TralisLayer.js +0 -329
- package/src/mapbox/layers/TralisLayer.test.js +0 -40
- package/src/mapbox/layers/index.js +0 -2
- package/src/mapbox/utils.js +0 -46
- package/src/ol/README.md +0 -0
- package/src/ol/controls/CopyrightControl.js +0 -80
- package/src/ol/controls/CopyrightControl.test.js +0 -211
- package/src/ol/controls/RoutingControl.js +0 -752
- package/src/ol/controls/RoutingControl.test.js +0 -216
- package/src/ol/controls/StopFinderControl.test.js +0 -59
- package/src/ol/controls/snapshots/RoutingControlRouteGen10.json +0 -58
- package/src/ol/controls/snapshots/RoutingControlRouteGen100.json +0 -292
- package/src/ol/controls/snapshots/RoutingControlRouteGen30.json +0 -69
- package/src/ol/controls/snapshots/RoutingControlRouteGen5.json +0 -58
- package/src/ol/controls/snapshots/RoutingControlRouteOSM.json +0 -759
- package/src/ol/controls/snapshots/RoutingControlStation1.json +0 -60
- package/src/ol/controls/snapshots/RoutingControlStation2.json +0 -49
- package/src/ol/layers/Layer.js +0 -193
- package/src/ol/layers/Layer.test.js +0 -197
- package/src/ol/layers/MapboxLayer.js +0 -378
- package/src/ol/layers/MapboxLayer.test.js +0 -186
- package/src/ol/layers/MapboxStyleLayer.js +0 -417
- package/src/ol/layers/MapboxStyleLayer.test.js +0 -262
- package/src/ol/layers/MaplibreLayer.js +0 -280
- package/src/ol/layers/RoutingLayer.js +0 -91
- package/src/ol/layers/RoutingLayer.test.js +0 -49
- package/src/ol/layers/TralisLayer.js +0 -359
- package/src/ol/layers/TralisLayer.test.js +0 -97
- package/src/ol/layers/VectorLayer.js +0 -43
- package/src/ol/layers/VectorLayer.test.js +0 -98
- package/src/ol/layers/WMSLayer.js +0 -80
- package/src/ol/layers/WMSLayer.test.js +0 -84
- package/src/ol/styles/fullTrajectoryDelayStyle.js +0 -35
- package/src/ol/styles/fullTrajectoryStyle.js +0 -51
- package/webpack.config.js +0 -6
- /package/{src/mapbox → mapbox}/controls/index.js +0 -0
- /package/{src/ol → ol}/controls/index.js +0 -0
- /package/{src/ol → ol}/index.js +0 -0
- /package/{src/ol → ol}/styles/index.js +0 -0
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
import WS from 'jest-websocket-mock';
|
|
2
|
-
import Connector from './WebSocketConnector';
|
|
3
|
-
|
|
4
|
-
describe('WebSocketConnector', () => {
|
|
5
|
-
describe('#constructor', () => {
|
|
6
|
-
let server;
|
|
7
|
-
let server2;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
server = new WS(`ws://foo:1234`);
|
|
11
|
-
server2 = new WS(`ws://foo:12345`);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
afterEach(() => {
|
|
15
|
-
server.close();
|
|
16
|
-
server2.close();
|
|
17
|
-
WS.clean();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe('#constructor', () => {
|
|
21
|
-
test("doesn't connect.", async () => {
|
|
22
|
-
const client = new Connector();
|
|
23
|
-
expect(client.websocket).toBe();
|
|
24
|
-
expect(client.closed).toBe(false);
|
|
25
|
-
expect(client.closing).toBe(false);
|
|
26
|
-
expect(client.connecting).toBe(false);
|
|
27
|
-
expect(client.open).toBe(false);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
describe('#close', () => {
|
|
32
|
-
test('should close the websocket and clear some property', async () => {
|
|
33
|
-
// eslint-disable-next-line no-unused-vars
|
|
34
|
-
const client = new Connector();
|
|
35
|
-
const subsc2 = {
|
|
36
|
-
params: 'foo',
|
|
37
|
-
cb: () => {},
|
|
38
|
-
errorCb: () => {},
|
|
39
|
-
quiet: false,
|
|
40
|
-
};
|
|
41
|
-
client.subscriptions = [subsc2];
|
|
42
|
-
client.messagesOnOpen = ['GET foo'];
|
|
43
|
-
client.connect(`ws://foo:1234`);
|
|
44
|
-
client.websocket.addEventListener = jest.fn();
|
|
45
|
-
client.websocket.removeEventListener = jest.fn();
|
|
46
|
-
client.websocket.close = jest.fn();
|
|
47
|
-
await server.connected;
|
|
48
|
-
expect(client.websocket).toBeDefined();
|
|
49
|
-
expect(client.messagesOnOpen).toEqual(['GET foo']);
|
|
50
|
-
client.close();
|
|
51
|
-
expect(client.messagesOnOpen).toEqual([]);
|
|
52
|
-
expect(client.websocket).toBeNull();
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
describe('#connect', () => {
|
|
57
|
-
test('create a new WebSocket.', async () => {
|
|
58
|
-
const client = new Connector();
|
|
59
|
-
client.connect(`ws://foo:1234`);
|
|
60
|
-
await server.connected;
|
|
61
|
-
client.send('hello');
|
|
62
|
-
await expect(server).toReceiveMessage('hello');
|
|
63
|
-
expect(server).toHaveReceivedMessages(['hello']);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test('close previous connection.', async () => {
|
|
67
|
-
const client = new Connector();
|
|
68
|
-
client.connect(`ws://foo:1234`);
|
|
69
|
-
await server.connected;
|
|
70
|
-
expect(client.websocket).toBeDefined();
|
|
71
|
-
const old = client.websocket;
|
|
72
|
-
expect(old.readyState).toBe(WebSocket.OPEN);
|
|
73
|
-
client.connect(`ws://foo:12345`);
|
|
74
|
-
expect(old.readyState).toBe(WebSocket.CLOSING);
|
|
75
|
-
expect(client.websocket.readyState).toBe(WebSocket.CONNECTING);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test('call onOpen function', async () => {
|
|
79
|
-
const onOpen = jest.fn();
|
|
80
|
-
const client = new Connector();
|
|
81
|
-
client.subscribe = jest.fn();
|
|
82
|
-
client.connect(`ws://foo:1234`, onOpen);
|
|
83
|
-
await server.connected;
|
|
84
|
-
expect(client.websocket.readyState).toBe(WebSocket.OPEN);
|
|
85
|
-
expect(onOpen).toHaveBeenCalledTimes(1);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
test('subscribe previous subscriptions on open (quiet or not)', async () => {
|
|
89
|
-
const client = new Connector();
|
|
90
|
-
client.subscribe = jest.fn();
|
|
91
|
-
client.send = jest.fn();
|
|
92
|
-
const subsc = {
|
|
93
|
-
params: 'foo',
|
|
94
|
-
cb: () => {},
|
|
95
|
-
errorCb: () => {},
|
|
96
|
-
quiet: true,
|
|
97
|
-
};
|
|
98
|
-
const subsc2 = {
|
|
99
|
-
params: 'foo',
|
|
100
|
-
cb: () => {},
|
|
101
|
-
errorCb: () => {},
|
|
102
|
-
quiet: false,
|
|
103
|
-
};
|
|
104
|
-
client.subscriptions = [subsc, subsc2];
|
|
105
|
-
|
|
106
|
-
client.connect(`ws://foo:1234`);
|
|
107
|
-
await server.connected;
|
|
108
|
-
expect(client.websocket.readyState).toBe(WebSocket.OPEN);
|
|
109
|
-
expect(client.subscribe).toHaveBeenCalledTimes(2);
|
|
110
|
-
client.subscribe.mockReset();
|
|
111
|
-
|
|
112
|
-
client.connect(`ws://foo:12345`);
|
|
113
|
-
await server2.connected;
|
|
114
|
-
expect(client.websocket.readyState).toBe(WebSocket.OPEN);
|
|
115
|
-
expect(client.subscribe).toHaveBeenCalledTimes(2);
|
|
116
|
-
expect(client.subscribe).toHaveBeenCalledWith(
|
|
117
|
-
subsc.params,
|
|
118
|
-
subsc.cb,
|
|
119
|
-
subsc.errorCb,
|
|
120
|
-
subsc.quiet,
|
|
121
|
-
);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
test('send GET and SUB for not quiet previous subscriptions', async () => {
|
|
125
|
-
const client = new Connector();
|
|
126
|
-
client.send = jest.fn();
|
|
127
|
-
const subsc = {
|
|
128
|
-
params: { channel: 'foo' },
|
|
129
|
-
cb: () => {},
|
|
130
|
-
errorCb: () => {},
|
|
131
|
-
quiet: false,
|
|
132
|
-
};
|
|
133
|
-
client.subscriptions = [subsc];
|
|
134
|
-
|
|
135
|
-
client.connect(`ws://foo:1234`);
|
|
136
|
-
client.websocket.addEventListener = jest.fn();
|
|
137
|
-
client.websocket.removeEventListener = jest.fn();
|
|
138
|
-
await server.connected;
|
|
139
|
-
expect(client.websocket.readyState).toBe(WebSocket.OPEN);
|
|
140
|
-
expect(client.send).toHaveBeenCalledTimes(2);
|
|
141
|
-
expect(client.send.mock.calls[0]).toEqual(['GET foo']);
|
|
142
|
-
expect(client.send.mock.calls[1]).toEqual(['SUB foo']);
|
|
143
|
-
client.send.mockReset();
|
|
144
|
-
|
|
145
|
-
client.connect(`ws://foo:12345`);
|
|
146
|
-
client.websocket.addEventListener = jest.fn();
|
|
147
|
-
client.websocket.removeEventListener = jest.fn();
|
|
148
|
-
await server2.connected;
|
|
149
|
-
expect(client.websocket.readyState).toBe(WebSocket.OPEN);
|
|
150
|
-
// not quiet subscriptions will send GET and SUB requests.
|
|
151
|
-
expect(client.send).toHaveBeenCalledTimes(2);
|
|
152
|
-
expect(client.send.mock.calls[0]).toEqual(['GET foo']);
|
|
153
|
-
expect(client.send.mock.calls[1]).toEqual(['SUB foo']);
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
test('doesn\t send GET and SUB for quiet previous subscriptions', async () => {
|
|
157
|
-
const client = new Connector();
|
|
158
|
-
client.send = jest.fn();
|
|
159
|
-
const subsc = {
|
|
160
|
-
params: { channel: 'foo' },
|
|
161
|
-
cb: () => {},
|
|
162
|
-
errorCb: () => {},
|
|
163
|
-
quiet: true,
|
|
164
|
-
};
|
|
165
|
-
client.subscriptions = [subsc];
|
|
166
|
-
|
|
167
|
-
client.connect(`ws://foo:1234`);
|
|
168
|
-
client.websocket.addEventListener = jest.fn();
|
|
169
|
-
client.websocket.removeEventListener = jest.fn();
|
|
170
|
-
await server.connected;
|
|
171
|
-
expect(client.websocket.readyState).toBe(WebSocket.OPEN);
|
|
172
|
-
expect(client.send).toHaveBeenCalledTimes(0);
|
|
173
|
-
client.send.mockReset();
|
|
174
|
-
|
|
175
|
-
client.connect(`ws://foo:12345`);
|
|
176
|
-
client.websocket.addEventListener = jest.fn();
|
|
177
|
-
client.websocket.removeEventListener = jest.fn();
|
|
178
|
-
await server2.connected;
|
|
179
|
-
expect(client.websocket.readyState).toBe(WebSocket.OPEN);
|
|
180
|
-
// not quiet subscriptions will send GET and SUB requests.
|
|
181
|
-
expect(client.send).toHaveBeenCalledTimes(0);
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
describe('#subscribe', () => {
|
|
186
|
-
test('adds subscription to subscriptions array', async () => {
|
|
187
|
-
// eslint-disable-next-line no-unused-vars
|
|
188
|
-
const client = new Connector();
|
|
189
|
-
client.connect(`ws://foo:1234`);
|
|
190
|
-
await server.connected;
|
|
191
|
-
const params = { channel: 'bar', args: ['baz'], id: 'id' };
|
|
192
|
-
const cb = jest.fn();
|
|
193
|
-
const errorCb = jest.fn();
|
|
194
|
-
client.subscribe(params, cb, errorCb);
|
|
195
|
-
expect(client.subscriptions.length).toBe(1);
|
|
196
|
-
expect(client.subscriptions[0].params).toBe(params);
|
|
197
|
-
expect(client.subscriptions[0].cb).toBe(cb);
|
|
198
|
-
expect(client.subscriptions[0].errorCb).toBe(errorCb);
|
|
199
|
-
expect(client.subscriptions[0].quiet).toBe(false);
|
|
200
|
-
|
|
201
|
-
const obj = { source: 'bar baz', client_reference: 'id' };
|
|
202
|
-
server.send(JSON.stringify(obj));
|
|
203
|
-
|
|
204
|
-
expect(cb).toHaveBeenCalledTimes(1);
|
|
205
|
-
expect(cb).toHaveBeenCalledWith(obj);
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
test("doesn't duplicate subscriptions", async () => {
|
|
209
|
-
// eslint-disable-next-line no-unused-vars
|
|
210
|
-
const client = new Connector();
|
|
211
|
-
client.connect(`ws://foo:1234`);
|
|
212
|
-
await server.connected;
|
|
213
|
-
const params = { channel: 'bar', args: ['baz'], id: 'id' };
|
|
214
|
-
const cb = jest.fn();
|
|
215
|
-
const errorCb = jest.fn();
|
|
216
|
-
client.subscribe(params, cb, errorCb, true);
|
|
217
|
-
client.subscribe(params, cb, errorCb, true);
|
|
218
|
-
expect(client.subscriptions.length).toBe(1);
|
|
219
|
-
|
|
220
|
-
const obj = { source: 'bar baz', client_reference: 'id' };
|
|
221
|
-
server.send(JSON.stringify(obj));
|
|
222
|
-
|
|
223
|
-
expect(cb).toHaveBeenCalledTimes(1);
|
|
224
|
-
expect(cb).toHaveBeenCalledWith(obj);
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
test('send GET and SUB requests.', async () => {
|
|
228
|
-
// eslint-disable-next-line no-unused-vars
|
|
229
|
-
const client = new Connector();
|
|
230
|
-
client.connect(`ws://foo:1234`);
|
|
231
|
-
client.send = jest.fn();
|
|
232
|
-
const params = { channel: 'bar', args: ['baz'], id: 'id' };
|
|
233
|
-
const cb = jest.fn();
|
|
234
|
-
const errorCb = jest.fn();
|
|
235
|
-
client.subscribe(params, cb, errorCb);
|
|
236
|
-
expect(client.send).toHaveBeenCalledTimes(2);
|
|
237
|
-
expect(client.send).toHaveBeenCalledWith('GET bar baz id');
|
|
238
|
-
expect(client.send).toHaveBeenCalledWith('SUB bar baz id');
|
|
239
|
-
client.send.mockRestore();
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
test('should register callback without sending GET and SUB requests (quiet=true).', async () => {
|
|
243
|
-
// eslint-disable-next-line no-unused-vars
|
|
244
|
-
const client = new Connector();
|
|
245
|
-
client.connect(`ws://foo:1234`);
|
|
246
|
-
await server.connected;
|
|
247
|
-
const params = { channel: 'bar', args: ['baz'], id: 'id' };
|
|
248
|
-
const cb = jest.fn();
|
|
249
|
-
const errorCb = jest.fn();
|
|
250
|
-
client.send = jest.fn();
|
|
251
|
-
client.subscribe(params, cb, errorCb, true);
|
|
252
|
-
expect(client.subscriptions.length).toBe(1);
|
|
253
|
-
expect(client.subscriptions[0].params).toBe(params);
|
|
254
|
-
expect(client.subscriptions[0].cb).toBe(cb);
|
|
255
|
-
expect(client.subscriptions[0].errorCb).toBe(errorCb);
|
|
256
|
-
expect(client.subscriptions[0].quiet).toBe(true);
|
|
257
|
-
expect(client.send).toBeCalledTimes(0);
|
|
258
|
-
client.send.mockRestore();
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
describe('#unsubscribe', () => {
|
|
263
|
-
test('should only unsubscribe the subscription using the good cb', async () => {
|
|
264
|
-
// eslint-disable-next-line no-unused-vars
|
|
265
|
-
const client = new Connector();
|
|
266
|
-
client.connect(`ws://foo:1234`);
|
|
267
|
-
await server.connected;
|
|
268
|
-
const params = { channel: 'foo', id: 'id' };
|
|
269
|
-
const cb = jest.fn();
|
|
270
|
-
const cb2 = jest.fn();
|
|
271
|
-
client.subscribe(params, cb);
|
|
272
|
-
client.subscribe(params, cb2);
|
|
273
|
-
expect(client.subscriptions.length).toBe(2);
|
|
274
|
-
expect(client.subscriptions[0].params).toBe(params);
|
|
275
|
-
expect(client.subscriptions[0].cb).toBe(cb);
|
|
276
|
-
expect(client.subscriptions[1].params).toBe(params);
|
|
277
|
-
expect(client.subscriptions[1].cb).toBe(cb2);
|
|
278
|
-
|
|
279
|
-
client.unsubscribe('foo', cb);
|
|
280
|
-
expect(client.subscriptions.length).toBe(1);
|
|
281
|
-
|
|
282
|
-
expect(cb).toHaveBeenCalledTimes(0);
|
|
283
|
-
expect(cb2).toHaveBeenCalledTimes(0);
|
|
284
|
-
const obj = { source: 'foo', client_reference: 'id' };
|
|
285
|
-
server.send(JSON.stringify(obj));
|
|
286
|
-
|
|
287
|
-
expect(cb2).toHaveBeenCalledTimes(1);
|
|
288
|
-
expect(cb).toHaveBeenCalledTimes(0);
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
test('should unsubscribe all subscriptions related to a channel', () => {
|
|
292
|
-
// eslint-disable-next-line no-unused-vars
|
|
293
|
-
const client = new Connector();
|
|
294
|
-
client.connect(`ws://foo:1234`);
|
|
295
|
-
client.websocket.removeEventListener = jest.fn();
|
|
296
|
-
client.websocket.addEventListener = jest.fn();
|
|
297
|
-
const params = { channel: 'foo' };
|
|
298
|
-
const params2 = { channel: 'bar' };
|
|
299
|
-
const cb = jest.fn();
|
|
300
|
-
const cb2 = jest.fn();
|
|
301
|
-
client.subscribe(params, cb);
|
|
302
|
-
client.subscribe(params, cb);
|
|
303
|
-
client.subscribe(params, cb);
|
|
304
|
-
client.subscribe(params, cb2);
|
|
305
|
-
client.subscribe(params2, cb2);
|
|
306
|
-
expect(client.subscriptions.length).toBe(3);
|
|
307
|
-
expect(client.websocket.removeEventListener).toBeCalledTimes(2);
|
|
308
|
-
expect(
|
|
309
|
-
client.websocket.addEventListener.mock.calls.filter(
|
|
310
|
-
(c) => c[0] === 'message',
|
|
311
|
-
).length,
|
|
312
|
-
).toBe(5);
|
|
313
|
-
|
|
314
|
-
client.unsubscribe('foo');
|
|
315
|
-
expect(client.subscriptions.length).toBe(1);
|
|
316
|
-
expect(client.subscriptions[0].params).toBe(params2);
|
|
317
|
-
expect(client.subscriptions[0].cb).toBe(cb2);
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
test('send DEL when there is no more unquiet subscriptions on the channel', async () => {
|
|
321
|
-
// eslint-disable-next-line no-unused-vars
|
|
322
|
-
const client = new Connector();
|
|
323
|
-
client.connect(`ws://foo:1234`);
|
|
324
|
-
await server.connected;
|
|
325
|
-
client.send = jest.fn();
|
|
326
|
-
client.websocket.removeEventListener = jest.fn();
|
|
327
|
-
client.websocket.addEventListener = jest.fn();
|
|
328
|
-
const params = { channel: 'foo' };
|
|
329
|
-
const cb = jest.fn();
|
|
330
|
-
client.subscribe(params, cb);
|
|
331
|
-
expect(client.send).toHaveBeenCalledWith('GET foo');
|
|
332
|
-
expect(client.send).toHaveBeenCalledWith('SUB foo');
|
|
333
|
-
|
|
334
|
-
client.unsubscribe('foo');
|
|
335
|
-
expect(client.send).toHaveBeenCalledWith('DEL foo');
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
test("doesn't send DEL when we unsubscribe a quiet channel", () => {
|
|
339
|
-
// eslint-disable-next-line no-unused-vars
|
|
340
|
-
const client = new Connector();
|
|
341
|
-
client.connect(`ws://foo:1234`);
|
|
342
|
-
client.send = jest.fn();
|
|
343
|
-
client.websocket.removeEventListener = jest.fn();
|
|
344
|
-
client.websocket.addEventListener = jest.fn();
|
|
345
|
-
const params = { channel: 'foo' };
|
|
346
|
-
const cb = jest.fn();
|
|
347
|
-
client.subscribe(params, cb, null, true);
|
|
348
|
-
expect(cb).toHaveBeenCalledTimes(0);
|
|
349
|
-
|
|
350
|
-
client.unsubscribe('foo');
|
|
351
|
-
expect(cb).toHaveBeenCalledTimes(0);
|
|
352
|
-
client.send.mockRestore();
|
|
353
|
-
});
|
|
354
|
-
});
|
|
355
|
-
});
|
|
356
|
-
});
|
|
Binary file
|
|
Binary file
|
package/src/assets/Lato-Bold.ttf
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/assets/Lato-Thin.ttf
DELETED
|
Binary file
|
|
Binary file
|
package/src/assets/OFL.txt
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2010-2014 by tyPoland Lukasz Dziedzic (team@latofonts.com) with Reserved Font Name "Lato"
|
|
2
|
-
|
|
3
|
-
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
-
This license is copied below, and is also available with a FAQ at:
|
|
5
|
-
http://scripts.sil.org/OFL
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
-----------------------------------------------------------
|
|
9
|
-
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
-
-----------------------------------------------------------
|
|
11
|
-
|
|
12
|
-
PREAMBLE
|
|
13
|
-
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
-
development of collaborative font projects, to support the font creation
|
|
15
|
-
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
-
open framework in which fonts may be shared and improved in partnership
|
|
17
|
-
with others.
|
|
18
|
-
|
|
19
|
-
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
-
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
-
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
-
redistributed and/or sold with any software provided that any reserved
|
|
23
|
-
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
-
however, cannot be released under any other type of license. The
|
|
25
|
-
requirement for fonts to remain under this license does not apply
|
|
26
|
-
to any document created using the fonts or their derivatives.
|
|
27
|
-
|
|
28
|
-
DEFINITIONS
|
|
29
|
-
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
-
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
-
include source files, build scripts and documentation.
|
|
32
|
-
|
|
33
|
-
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
-
copyright statement(s).
|
|
35
|
-
|
|
36
|
-
"Original Version" refers to the collection of Font Software components as
|
|
37
|
-
distributed by the Copyright Holder(s).
|
|
38
|
-
|
|
39
|
-
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
-
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
-
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
-
new environment.
|
|
43
|
-
|
|
44
|
-
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
-
writer or other person who contributed to the Font Software.
|
|
46
|
-
|
|
47
|
-
PERMISSION & CONDITIONS
|
|
48
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
-
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
-
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
-
Software, subject to the following conditions:
|
|
52
|
-
|
|
53
|
-
1) Neither the Font Software nor any of its individual components,
|
|
54
|
-
in Original or Modified Versions, may be sold by itself.
|
|
55
|
-
|
|
56
|
-
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
-
redistributed and/or sold with any software, provided that each copy
|
|
58
|
-
contains the above copyright notice and this license. These can be
|
|
59
|
-
included either as stand-alone text files, human-readable headers or
|
|
60
|
-
in the appropriate machine-readable metadata fields within text or
|
|
61
|
-
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
-
|
|
63
|
-
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
-
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
-
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
-
presented to the users.
|
|
67
|
-
|
|
68
|
-
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
-
Software shall not be used to promote, endorse or advertise any
|
|
70
|
-
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
-
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
-
permission.
|
|
73
|
-
|
|
74
|
-
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
-
must be distributed entirely under this license, and must not be
|
|
76
|
-
distributed under any other license. The requirement for fonts to
|
|
77
|
-
remain under this license does not apply to any document created
|
|
78
|
-
using the Font Software.
|
|
79
|
-
|
|
80
|
-
TERMINATION
|
|
81
|
-
This license becomes null and void if any of the above conditions are
|
|
82
|
-
not met.
|
|
83
|
-
|
|
84
|
-
DISCLAIMER
|
|
85
|
-
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
-
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
-
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
-
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
-
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
-
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
-
OTHER DEALINGS IN THE FONT SOFTWARE.
|
package/src/common/Tracker.js
DELETED
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-param-reassign */
|
|
2
|
-
import { compose, apply, create } from 'ol/transform';
|
|
3
|
-
import getVehiclePosition from './utils/getVehiclePosition';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Tracker. This class stores and allows to draw trajectories on a canvas.
|
|
7
|
-
* @class
|
|
8
|
-
* @param {Object} options
|
|
9
|
-
* @private
|
|
10
|
-
*/
|
|
11
|
-
export default class Tracker {
|
|
12
|
-
/**
|
|
13
|
-
* @private
|
|
14
|
-
*/
|
|
15
|
-
constructor(options) {
|
|
16
|
-
/**
|
|
17
|
-
* Function use to style the features displayed.
|
|
18
|
-
* @type {function}
|
|
19
|
-
*/
|
|
20
|
-
this.style = options.style;
|
|
21
|
-
|
|
22
|
-
// we draw directly on the canvas since openlayers is too slow.
|
|
23
|
-
/**
|
|
24
|
-
* HTML <canvas> element.
|
|
25
|
-
* @type {Canvas}
|
|
26
|
-
*/
|
|
27
|
-
this.canvas = options.canvas || document.createElement('canvas');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Draw all the trajectories available to the canvas.
|
|
32
|
-
* @param {ViewState} trajectories An array of trajectories.
|
|
33
|
-
* @param {ViewState} viewState The view state of the map.
|
|
34
|
-
* @param {boolean} options.hoverVehicleId The id of the vehicle to highlight.
|
|
35
|
-
* @param {boolean} options.selectedVehicleId The id of the vehicle to select.
|
|
36
|
-
* @param {boolean} options.noInterpolate If true trajectories are not interpolated but
|
|
37
|
-
* drawn at the last known coordinate. Use this for performance optimization
|
|
38
|
-
* during map navigation.
|
|
39
|
-
* @private
|
|
40
|
-
*/
|
|
41
|
-
renderTrajectories(trajectories, viewState, options) {
|
|
42
|
-
const {
|
|
43
|
-
time = Date.now(),
|
|
44
|
-
size = [],
|
|
45
|
-
center,
|
|
46
|
-
resolution,
|
|
47
|
-
rotation = 0,
|
|
48
|
-
pixelRatio,
|
|
49
|
-
} = viewState;
|
|
50
|
-
const {
|
|
51
|
-
noInterpolate = false,
|
|
52
|
-
hoverVehicleId,
|
|
53
|
-
selectedVehicleId,
|
|
54
|
-
} = options;
|
|
55
|
-
|
|
56
|
-
const { canvas } = this;
|
|
57
|
-
const context = canvas.getContext('2d');
|
|
58
|
-
context.clearRect(0, 0, canvas.width, canvas.height);
|
|
59
|
-
|
|
60
|
-
const [width, height] = size;
|
|
61
|
-
if (
|
|
62
|
-
width &&
|
|
63
|
-
height &&
|
|
64
|
-
(canvas.width !== width || canvas.height !== height)
|
|
65
|
-
) {
|
|
66
|
-
[canvas.width, canvas.height] = [width * pixelRatio, height * pixelRatio];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const coordinateToPixelTransform = compose(
|
|
70
|
-
create(),
|
|
71
|
-
size[0] / 2,
|
|
72
|
-
size[1] / 2,
|
|
73
|
-
1 / resolution,
|
|
74
|
-
-1 / resolution,
|
|
75
|
-
-rotation,
|
|
76
|
-
-center[0],
|
|
77
|
-
-center[1],
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
// Offscreen canvas has not style attribute
|
|
81
|
-
if (canvas.style) {
|
|
82
|
-
canvas.style.width = `${canvas.width / pixelRatio}px`;
|
|
83
|
-
canvas.style.height = `${canvas.height / pixelRatio}px`;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
let hoverVehicleImg;
|
|
87
|
-
let hoverVehiclePx;
|
|
88
|
-
let hoverVehicleWidth;
|
|
89
|
-
let hoverVehicleHeight;
|
|
90
|
-
let selectedVehicleImg;
|
|
91
|
-
let selectedVehiclePx;
|
|
92
|
-
let selectedVehicleWidth;
|
|
93
|
-
let selectedVehicleHeight;
|
|
94
|
-
let nbRendered = 0;
|
|
95
|
-
|
|
96
|
-
for (let i = trajectories.length - 1; i >= 0; i -= 1) {
|
|
97
|
-
const trajectory = trajectories[i];
|
|
98
|
-
|
|
99
|
-
// We simplify the trajectory object
|
|
100
|
-
const { train_id: id, timeOffset } = trajectory.properties;
|
|
101
|
-
// We set the rotation and the timeFraction of the trajectory (used by tralis).
|
|
102
|
-
// if rotation === null that seems there is no rotation available.
|
|
103
|
-
const { coord, rotation: rotationIcon } = getVehiclePosition(
|
|
104
|
-
time - (timeOffset || 0),
|
|
105
|
-
trajectory,
|
|
106
|
-
noInterpolate,
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
// We store the current vehicle position to the trajectory.
|
|
110
|
-
trajectories[i].properties.coordinate = coord;
|
|
111
|
-
trajectories[i].properties.rotation = rotationIcon;
|
|
112
|
-
|
|
113
|
-
if (!coord) {
|
|
114
|
-
// eslint-disable-next-line no-continue
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
let px = apply(coordinateToPixelTransform, [...coord]);
|
|
119
|
-
if (!px) {
|
|
120
|
-
// eslint-disable-next-line no-continue
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
px = px.map((p) => p * pixelRatio);
|
|
125
|
-
|
|
126
|
-
if (
|
|
127
|
-
px[0] < 0 ||
|
|
128
|
-
px[0] > canvas.width ||
|
|
129
|
-
px[1] < 0 ||
|
|
130
|
-
px[1] > canvas.height
|
|
131
|
-
) {
|
|
132
|
-
// eslint-disable-next-line no-continue
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const vehicleImg = this.style(trajectory, viewState, options);
|
|
137
|
-
if (!vehicleImg) {
|
|
138
|
-
// eslint-disable-next-line no-continue
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
nbRendered += 1;
|
|
143
|
-
|
|
144
|
-
const imgWidth = vehicleImg.width;
|
|
145
|
-
const imgHeight = vehicleImg.height;
|
|
146
|
-
|
|
147
|
-
if (hoverVehicleId !== id && selectedVehicleId !== id) {
|
|
148
|
-
context.drawImage(
|
|
149
|
-
vehicleImg,
|
|
150
|
-
px[0] - imgWidth / 2,
|
|
151
|
-
px[1] - imgHeight / 2,
|
|
152
|
-
imgWidth,
|
|
153
|
-
imgHeight,
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (hoverVehicleId && hoverVehicleId === id) {
|
|
158
|
-
// Store the canvas to draw it at the end
|
|
159
|
-
hoverVehicleImg = vehicleImg;
|
|
160
|
-
hoverVehiclePx = px;
|
|
161
|
-
hoverVehicleWidth = imgWidth;
|
|
162
|
-
hoverVehicleHeight = imgHeight;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (selectedVehicleId && selectedVehicleId === id) {
|
|
166
|
-
// Store the canvas to draw it at the end
|
|
167
|
-
selectedVehicleImg = vehicleImg;
|
|
168
|
-
selectedVehiclePx = px;
|
|
169
|
-
selectedVehicleWidth = imgWidth;
|
|
170
|
-
selectedVehicleHeight = imgHeight;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (selectedVehicleImg) {
|
|
175
|
-
context.drawImage(
|
|
176
|
-
selectedVehicleImg,
|
|
177
|
-
selectedVehiclePx[0] - selectedVehicleWidth / 2,
|
|
178
|
-
selectedVehiclePx[1] - selectedVehicleHeight / 2,
|
|
179
|
-
selectedVehicleWidth,
|
|
180
|
-
selectedVehicleHeight,
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if (hoverVehicleImg) {
|
|
185
|
-
context.drawImage(
|
|
186
|
-
hoverVehicleImg,
|
|
187
|
-
hoverVehiclePx[0] - hoverVehicleWidth / 2,
|
|
188
|
-
hoverVehiclePx[1] - hoverVehicleHeight / 2,
|
|
189
|
-
hoverVehicleWidth,
|
|
190
|
-
hoverVehicleHeight,
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
return {
|
|
194
|
-
nbTrajectoriesRendered: nbRendered,
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
}
|