mobility-toolbox-js 2.3.10 → 2.4.0
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 +290 -0
- package/api/RealtimeAPI.d.ts.map +1 -0
- package/api/RealtimeAPI.js +483 -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/typedefs.d.ts +179 -0
- package/api/typedefs.d.ts.map +1 -0
- package/{src/api → api}/typedefs.js +1 -11
- 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/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 +288 -0
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -0
- package/common/mixins/RealtimeLayerMixin.js +779 -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/realtimeDefaultStyle.d.ts +36 -0
- package/common/styles/realtimeDefaultStyle.d.ts.map +1 -0
- package/common/styles/realtimeDefaultStyle.js +276 -0
- package/common/styles/realtimeDelayStyle.d.ts +12 -0
- 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 +87 -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 +183 -0
- package/common/typedefs.d.ts.map +1 -0
- package/{src/common → common}/typedefs.js +1 -1
- 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 +11 -0
- package/common/utils/createCanvas.d.ts.map +1 -0
- package/common/utils/createCanvas.js +28 -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 +13 -0
- package/common/utils/debounceDeparturesMessages.d.ts.map +1 -0
- package/common/utils/debounceDeparturesMessages.js +28 -0
- package/common/utils/debounceWebsocketMessages.d.ts +12 -0
- package/common/utils/debounceWebsocketMessages.d.ts.map +1 -0
- package/common/utils/debounceWebsocketMessages.js +30 -0
- package/common/utils/getLayersAsFlatArray.d.ts +4 -0
- package/common/utils/getLayersAsFlatArray.d.ts.map +1 -0
- package/common/utils/getLayersAsFlatArray.js +16 -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 +8 -0
- package/common/utils/getMapboxRender.d.ts.map +1 -0
- package/common/utils/getMapboxRender.js +88 -0
- package/common/utils/getMaplibreRender.d.ts +9 -0
- package/common/utils/getMaplibreRender.d.ts.map +1 -0
- package/common/utils/getMaplibreRender.js +40 -0
- package/{src/common/utils/getRealtimeModeSuffix.ts → common/utils/getRealtimeModeSuffix.d.ts} +2 -4
- 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 +18 -0
- package/common/utils/index.d.ts.map +1 -0
- package/{src/common → common}/utils/index.js +2 -1
- package/common/utils/realtimeConfig.d.ts +53 -0
- package/common/utils/realtimeConfig.d.ts.map +1 -0
- package/common/utils/realtimeConfig.js +202 -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 +4 -0
- package/common/utils/sortByDelay.d.ts.map +1 -0
- package/common/utils/sortByDelay.js +21 -0
- package/common/utils/timeUtils.d.ts +24 -0
- package/common/utils/timeUtils.d.ts.map +1 -0
- package/common/utils/timeUtils.js +39 -0
- 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/{src/mapbox/controls/CopyrightControl.ts → mapbox/controls/CopyrightControl.js} +21 -26
- 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/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 +180 -0
- package/mapbox/layers/RealtimeLayer.d.ts.map +1 -0
- package/mapbox/layers/RealtimeLayer.js +270 -0
- package/mapbox/layers/index.d.ts +3 -0
- package/mapbox/layers/index.d.ts.map +1 -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/mbt.js +64822 -0
- package/mbt.js.map +7 -0
- package/mbt.min.js +1090 -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/controls/StopFinderControl.ts → ol/controls/StopFinderControl.js} +7 -10
- 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 +174 -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 +131 -0
- package/ol/layers/MapboxStyleLayer.d.ts.map +1 -0
- package/ol/layers/MapboxStyleLayer.js +369 -0
- package/{src/ol/layers/MaplibreLayer.ts → ol/layers/MaplibreLayer.d.ts} +10 -21
- 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 +332 -0
- package/ol/layers/RoutingLayer.d.ts +35 -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/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 +1 -1
- package/setupTests.d.ts +2 -0
- package/setupTests.d.ts.map +1 -0
- package/{src/setupTests.js → setupTests.js} +7 -12
- package/.esdoc.js +0 -18
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -25
- package/.fixpackrc +0 -20
- package/.github/workflows/build.yml +0 -16
- package/.github/workflows/conventional-pr-title.yml +0 -16
- package/.github/workflows/cypress.yml +0 -101
- package/.github/workflows/test.yml +0 -17
- 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/.lintstagedrc.js +0 -10
- package/.nvmrc +0 -1
- package/.prettierrc.js +0 -5
- package/.stylelintrc.js +0 -4
- package/CHANGELOG.md +0 -132
- package/LICENSE +0 -21
- package/MIGRATION-V2.md +0 -248
- package/README.md +0 -42
- package/__mocks__/mapbox-gl.js +0 -81
- package/__mocks__/maplibre-gl.js +0 -81
- package/babel.config.js +0 -9
- package/commitlint.config.js +0 -1
- package/cypress/e2e/examples/api.cy.js +0 -7
- package/cypress/e2e/examples/examples.cy.js +0 -7
- package/cypress/e2e/examples/navigation.cy.js +0 -29
- package/cypress/fixtures/example.json +0 -5
- package/cypress/plugins/index.js +0 -21
- package/cypress/support/commands.js +0 -25
- package/cypress/support/e2e.js +0 -20
- package/cypress.config.ts +0 -15
- 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/dependabot.yml +0 -15
- package/doc/.eslintrc.json +0 -1
- package/doc/README.md +0 -34
- package/doc/next.config.js +0 -16
- package/doc/package.json +0 -41
- package/doc/pages/404.js +0 -5
- package/doc/pages/_app.js +0 -61
- package/doc/pages/_document.js +0 -64
- package/doc/pages/doc/[...slug].js +0 -23
- package/doc/pages/doc.js +0 -23
- package/doc/pages/example/[example].js +0 -52
- package/doc/pages/examples.js +0 -34
- package/doc/pages/index.js +0 -25
- package/doc/public/README.md +0 -15
- package/doc/public/favicon.ico +0 -0
- package/doc/public/static/assets/Lato-Black.ttf +0 -0
- package/doc/public/static/assets/Lato-BlackItalic.ttf +0 -0
- package/doc/public/static/assets/Lato-Bold.ttf +0 -0
- package/doc/public/static/assets/Lato-BoldItalic.ttf +0 -0
- package/doc/public/static/assets/Lato-Italic.ttf +0 -0
- package/doc/public/static/assets/Lato-Light.ttf +0 -0
- package/doc/public/static/assets/Lato-LightItalic.ttf +0 -0
- package/doc/public/static/assets/Lato-Regular.ttf +0 -0
- package/doc/public/static/assets/Lato-Thin.ttf +0 -0
- package/doc/public/static/assets/Lato-ThinItalic.ttf +0 -0
- package/doc/public/static/assets/OFL.txt +0 -93
- package/doc/public/static/examples/assets/tralis-live-map/index.js +0 -11
- package/doc/public/static/examples/assets/tralis-live-map/s1kreis.svg +0 -105
- package/doc/public/static/examples/assets/tralis-live-map/s20kreis.svg +0 -101
- package/doc/public/static/examples/assets/tralis-live-map/s2kreis.svg +0 -95
- package/doc/public/static/examples/assets/tralis-live-map/s3kreis.svg +0 -95
- package/doc/public/static/examples/assets/tralis-live-map/s4kreis.svg +0 -95
- package/doc/public/static/examples/assets/tralis-live-map/s6kreis.svg +0 -95
- package/doc/public/static/examples/assets/tralis-live-map/s7kreis.svg +0 -95
- package/doc/public/static/examples/assets/tralis-live-map/s8kreis.svg +0 -93
- package/doc/public/static/examples/assets/tralis-live-map/unknown.svg +0 -107
- package/doc/public/static/examples/layers.html +0 -11
- package/doc/public/static/examples/layers.js +0 -97
- package/doc/public/static/examples/mb-copyright.html +0 -26
- package/doc/public/static/examples/mb-copyright.js +0 -37
- package/doc/public/static/examples/mb-tracker.html +0 -1
- package/doc/public/static/examples/mb-tracker.js +0 -40
- package/doc/public/static/examples/mb-tracker.md +0 -1
- package/doc/public/static/examples/mb-tralis.html +0 -1
- package/doc/public/static/examples/mb-tralis.js +0 -34
- package/doc/public/static/examples/ol-copyright.html +0 -26
- package/doc/public/static/examples/ol-copyright.js +0 -43
- package/doc/public/static/examples/ol-mapbox-layer.html +0 -1
- package/doc/public/static/examples/ol-mapbox-layer.js +0 -28
- package/doc/public/static/examples/ol-mapbox-style-layer.html +0 -12
- package/doc/public/static/examples/ol-mapbox-style-layer.js +0 -48
- package/doc/public/static/examples/ol-query.html +0 -32
- package/doc/public/static/examples/ol-query.js +0 -83
- package/doc/public/static/examples/ol-routing.html +0 -26
- package/doc/public/static/examples/ol-routing.js +0 -65
- package/doc/public/static/examples/ol-routing.md +0 -1
- package/doc/public/static/examples/ol-stop-finder.html +0 -15
- package/doc/public/static/examples/ol-stop-finder.js +0 -35
- package/doc/public/static/examples/ol-stop-finder.md +0 -1
- package/doc/public/static/examples/ol-tracker.html +0 -1
- package/doc/public/static/examples/ol-tracker.js +0 -41
- package/doc/public/static/examples/ol-tracker.md +0 -1
- package/doc/public/static/examples/ol-tralis.html +0 -5
- package/doc/public/static/examples/ol-tralis.js +0 -62
- package/doc/public/static/examples/tralis-live-map.html +0 -1
- package/doc/public/static/examples/tralis-live-map.js +0 -67
- package/doc/public/static/examples/tralis-live-map.md +0 -3
- package/doc/public/static/img/live_tracker_mb.jpg +0 -0
- package/doc/public/static/img/live_tracker_munich.jpg +0 -0
- package/doc/public/static/img/live_tracker_ol.jpg +0 -0
- package/doc/public/static/img/mapbox.jpg +0 -0
- package/doc/public/static/img/mapbox_style.jpg +0 -0
- package/doc/public/static/img/ol-copyright.png +0 -0
- package/doc/public/static/img/query_objects.jpg +0 -0
- package/doc/public/static/img/routing.jpg +0 -0
- package/doc/public/static/img/simple_map.jpg +0 -0
- package/doc/public/static/img/stops.jpg +0 -0
- package/doc/public/vercel.svg +0 -4
- package/doc/src/components/CodeSandboxButton.js +0 -102
- package/doc/src/components/Documentation.js +0 -42
- package/doc/src/components/Esdoc/Anchor.js +0 -57
- package/doc/src/components/Esdoc/ClassDoc.js +0 -272
- package/doc/src/components/Esdoc/DeprecatedHTML.js +0 -16
- package/doc/src/components/Esdoc/DetailDocs.js +0 -279
- package/doc/src/components/Esdoc/DetailHTML.js +0 -33
- package/doc/src/components/Esdoc/DirectSubclassHTML.js +0 -30
- package/doc/src/components/Esdoc/DocBuilderUtils.js +0 -697
- package/doc/src/components/Esdoc/DocLinkHTML.js +0 -63
- package/doc/src/components/Esdoc/DocsLinkHTML.js +0 -38
- package/doc/src/components/Esdoc/Esdoc.js +0 -63
- package/doc/src/components/Esdoc/EsdocContent.js +0 -56
- package/doc/src/components/Esdoc/EsdocNavigation.js +0 -13
- package/doc/src/components/Esdoc/EsdocSearch.js +0 -78
- package/doc/src/components/Esdoc/ExperimentalHTML.js +0 -17
- package/doc/src/components/Esdoc/ExtendsChainHTML.js +0 -32
- package/doc/src/components/Esdoc/FileDocLinkHTML.js +0 -62
- package/doc/src/components/Esdoc/IdentifiersDoc.js +0 -113
- package/doc/src/components/Esdoc/IndirectSubclassHTML.js +0 -30
- package/doc/src/components/Esdoc/InheritedSummaryDoc.js +0 -70
- package/doc/src/components/Esdoc/InheritedSummaryHTML.js +0 -38
- package/doc/src/components/Esdoc/MixinClassesHTML.js +0 -29
- package/doc/src/components/Esdoc/NavDoc.js +0 -112
- package/doc/src/components/Esdoc/OverrideMethod.js +0 -44
- package/doc/src/components/Esdoc/OverrideMethodDescription.js +0 -35
- package/doc/src/components/Esdoc/Properties.js +0 -89
- package/doc/src/components/Esdoc/README.md +0 -45
- package/doc/src/components/Esdoc/SignatureHTML.js +0 -123
- package/doc/src/components/Esdoc/SingleDoc.js +0 -31
- package/doc/src/components/Esdoc/SummaryDoc.js +0 -160
- package/doc/src/components/Esdoc/SummaryHTML.js +0 -96
- package/doc/src/components/Esdoc/TypeDocLinkHTML.js +0 -251
- package/doc/src/components/Esdoc/index.js +0 -7
- package/doc/src/components/Esdoc/taffydb.js +0 -2070
- package/doc/src/components/Example.js +0 -200
- package/doc/src/components/ExampleCard.js +0 -126
- package/doc/src/components/Examples.js +0 -78
- package/doc/src/components/Home.js +0 -121
- package/doc/src/components/TrackerExample.js +0 -39
- package/doc/src/examples.js +0 -117
- package/doc/styles/App.scss +0 -53
- package/doc/styles/identifiers.css +0 -38
- package/doc/styles/search.css +0 -76
- package/doc/styles/style.css +0 -603
- 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 -93
- package/esdoc/plugins/optional-chaining-plugin/Plugin.js +0 -8
- package/global-setup.js +0 -3
- package/jest.config.js +0 -24
- package/pull_request_template.md +0 -17
- package/scripts/read-pkg-json.js +0 -22
- package/src/api/RealtimeAPI.test.js +0 -144
- package/src/api/RealtimeAPI.ts +0 -712
- package/src/api/RoutingAPI.test.js +0 -41
- package/src/api/RoutingAPI.ts +0 -47
- package/src/api/StopsAPI.test.js +0 -34
- package/src/api/StopsAPI.ts +0 -45
- package/src/common/api/HttpAPI.test.js +0 -68
- package/src/common/api/HttpAPI.ts +0 -77
- package/src/common/api/WebSocketAPI.test.js +0 -421
- package/src/common/api/WebSocketAPI.ts +0 -515
- package/src/common/controls/ControlCommon.test.js +0 -106
- package/src/common/controls/ControlCommon.ts +0 -194
- package/src/common/controls/CopyrightControlCommon.ts +0 -41
- package/src/common/controls/StopFinderControlCommon.ts +0 -192
- package/src/common/layers/LayerCommon.test.js +0 -158
- package/src/common/layers/LayerCommon.ts +0 -321
- package/src/common/mixins/RealtimeLayerMixin.ts +0 -1168
- package/src/common/mixins/UserInteractionsLayerMixin.test.js +0 -227
- package/src/common/mixins/UserInteractionsLayerMixin.ts +0 -352
- package/src/common/styles/realtimeDefaultStyle.ts +0 -436
- package/src/common/styles/realtimeDelayStyle.ts +0 -27
- package/src/common/styles/realtimeHeadingStyle.ts +0 -138
- package/src/common/styles/realtimeSimpleStyle.ts +0 -25
- package/src/common/utils/compareDepartures.ts +0 -46
- package/src/common/utils/createCanvas.ts +0 -33
- package/src/common/utils/createRealtimeFilters.test.js +0 -100
- package/src/common/utils/createRealtimeFilters.ts +0 -96
- package/src/common/utils/debounceDeparturesMessages.ts +0 -52
- package/src/common/utils/debounceWebsocketMessages.ts +0 -47
- package/src/common/utils/getLayersAsFlatArray.ts +0 -17
- package/src/common/utils/getMapboxMapCopyrights.test.js +0 -47
- package/src/common/utils/getMapboxMapCopyrights.ts +0 -52
- package/src/common/utils/getMapboxRender.ts +0 -104
- package/src/common/utils/getMaplibreRender.ts +0 -54
- package/src/common/utils/getUrlWithParams.ts +0 -21
- package/src/common/utils/getVehiclePosition.ts +0 -92
- package/src/common/utils/realtimeConfig.test.js +0 -57
- package/src/common/utils/realtimeConfig.ts +0 -228
- package/src/common/utils/removeDuplicate.test.js +0 -22
- package/src/common/utils/removeDuplicate.ts +0 -22
- package/src/common/utils/renderTrajectories.ts +0 -194
- package/src/common/utils/sortAndFilterDepartures.ts +0 -78
- package/src/common/utils/sortByDelay.ts +0 -29
- package/src/common/utils/timeUtils.test.js +0 -16
- package/src/common/utils/timeUtils.ts +0 -45
- package/src/index.js +0 -10
- package/src/mapbox/layers/Layer.test.js +0 -217
- package/src/mapbox/layers/Layer.ts +0 -144
- package/src/mapbox/layers/RealtimeLayer.test.js +0 -13
- package/src/mapbox/layers/RealtimeLayer.ts +0 -350
- package/src/mapbox/utils/getMercatorResolution.ts +0 -21
- package/src/mapbox/utils/getSourceCoordinates.ts +0 -34
- package/src/ol/README.md +0 -0
- package/src/ol/controls/CopyrightControl.test.js +0 -211
- package/src/ol/controls/CopyrightControl.ts +0 -82
- package/src/ol/controls/RoutingControl.test.js +0 -205
- package/src/ol/controls/RoutingControl.ts +0 -869
- 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.test.js +0 -212
- package/src/ol/layers/Layer.ts +0 -252
- package/src/ol/layers/MapGlLayer.ts +0 -294
- package/src/ol/layers/MapboxLayer.test.js +0 -190
- package/src/ol/layers/MapboxLayer.ts +0 -136
- package/src/ol/layers/MapboxStyleLayer.test.js +0 -258
- package/src/ol/layers/MapboxStyleLayer.ts +0 -466
- package/src/ol/layers/RealtimeLayer.test.js +0 -84
- package/src/ol/layers/RealtimeLayer.ts +0 -465
- package/src/ol/layers/RoutingLayer.test.js +0 -48
- package/src/ol/layers/RoutingLayer.ts +0 -113
- package/src/ol/layers/VectorLayer.test.js +0 -87
- package/src/ol/layers/VectorLayer.ts +0 -48
- package/src/ol/layers/WMSLayer.test.js +0 -65
- package/src/ol/layers/WMSLayer.ts +0 -114
- package/src/ol/styles/fullTrajectoryDelayStyle.ts +0 -37
- package/src/ol/styles/fullTrajectoryStyle.ts +0 -56
- package/tsconfig.json +0 -23
- /package/{src/api → api}/index.js +0 -0
- /package/{src/common → common}/index.js +0 -0
- /package/{src/common → common}/styles/index.js +0 -0
- /package/{src/mapbox → mapbox}/controls/index.js +0 -0
- /package/{src/mapbox → mapbox}/index.js +0 -0
- /package/{src/mapbox → mapbox}/layers/index.js +0 -0
- /package/{src/mapbox → mapbox}/utils/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}/layers/index.js +0 -0
- /package/{src/ol → ol}/styles/index.js +0 -0
- /package/{src/types → types}/common.d.ts +0 -0
- /package/{src/types → types}/index.d.ts +0 -0
- /package/{src/types → types}/realtime.d.ts +0 -0
- /package/{src/types → types}/routing.d.ts +0 -0
- /package/{src/types → types}/stops.d.ts +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { AnyMap, CommonLayerClass, UserInteractionCallback } from '../../types';
|
|
2
|
+
import LayerCommon from '../layers/LayerCommon';
|
|
3
|
+
export type UserInteractionsLayerMixinOptions = {
|
|
4
|
+
userInteractions?: boolean;
|
|
5
|
+
userClickInteractions?: boolean;
|
|
6
|
+
userHoverInteractions?: boolean;
|
|
7
|
+
defaultUserInteractions?: boolean;
|
|
8
|
+
onClick?: UserInteractionCallback;
|
|
9
|
+
onHover?: UserInteractionCallback;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* UserInteractionsLayerInterface.
|
|
13
|
+
*/
|
|
14
|
+
export declare class UserInteractionsLayerInterface {
|
|
15
|
+
constructor(options?: {});
|
|
16
|
+
/**
|
|
17
|
+
* Initialize the layer adding user interactions.
|
|
18
|
+
*
|
|
19
|
+
* @param {ol/Map~Map} map
|
|
20
|
+
*/
|
|
21
|
+
attachToMap(map: AnyMap): void;
|
|
22
|
+
/**
|
|
23
|
+
* Terminate the layer unsubscribing user interactions.
|
|
24
|
+
*/
|
|
25
|
+
detachFromMap(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Activate map listeners events.
|
|
28
|
+
*/
|
|
29
|
+
activateUserInteractions(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Deactivate map listeners events.
|
|
32
|
+
*/
|
|
33
|
+
deactivateUserInteractions(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Subscribe on user:click event.
|
|
36
|
+
*/
|
|
37
|
+
onClick(callback: UserInteractionCallback): void;
|
|
38
|
+
/**
|
|
39
|
+
* Subscribe on user:hover event.
|
|
40
|
+
*/
|
|
41
|
+
onHover(callback: UserInteractionCallback): void;
|
|
42
|
+
/**
|
|
43
|
+
* Unsubscribe on user:click event.
|
|
44
|
+
*/
|
|
45
|
+
unClick(callback: UserInteractionCallback): void;
|
|
46
|
+
/**
|
|
47
|
+
* Unsubscribe on user:hover event.
|
|
48
|
+
*/
|
|
49
|
+
unHover(callback: UserInteractionCallback): void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Mixin for UserInteractionsLayerInterface. It provide onClick and onHover functions.
|
|
53
|
+
*
|
|
54
|
+
* @param {Class} Base A class to extend with {UserInteractionsLayerInterface} functionnalities.
|
|
55
|
+
* @return {Class} A class that implements {UserInteractionsLayerInterface} class and extends Base;
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
declare function UserInteractionsLayerMixin<T extends CommonLayerClass>(Base: T): T & typeof LayerCommon;
|
|
59
|
+
export default UserInteractionsLayerMixin;
|
|
60
|
+
//# sourceMappingURL=UserInteractionsLayerMixin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserInteractionsLayerMixin.d.ts","sourceRoot":"","sources":["../../../src/common/mixins/UserInteractionsLayerMixin.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAEhD,MAAM,MAAM,iCAAiC,GAAG;IAC9C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAClC,OAAO,CAAC,EAAE,uBAAuB,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,qBAAa,8BAA8B;gBAU7B,OAAO,KAAK;IAExB;;;;OAIG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM;IAEvB;;OAEG;IACH,aAAa;IAEb;;OAEG;IACH,wBAAwB;IAExB;;OAEG;IACH,0BAA0B;IAE1B;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,uBAAuB;IAEzC;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,uBAAuB;IAEzC;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,uBAAuB;IAEzC;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,uBAAuB;CAC1C;AAED;;;;;;GAMG;AACH,iBAAS,0BAA0B,CAAC,CAAC,SAAS,gBAAgB,EAC5D,IAAI,EAAE,CAAC,GACN,CAAC,GAAG,OAAO,WAAW,CAkQxB;AAED,eAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/* eslint-disable no-empty-function,@typescript-eslint/no-empty-function */
|
|
2
|
+
/* eslint-disable no-useless-constructor,@typescript-eslint/no-useless-constructor */
|
|
3
|
+
/* eslint-disable no-unused-vars,@typescript-eslint/no-unused-vars */
|
|
4
|
+
/* eslint-disable class-methods-use-this */
|
|
5
|
+
/* eslint-disable max-classes-per-file */
|
|
6
|
+
import { fromLonLat } from 'ol/proj';
|
|
7
|
+
import { unByKey } from 'ol/Observable';
|
|
8
|
+
import BaseEvent from 'ol/events/Event';
|
|
9
|
+
/**
|
|
10
|
+
* UserInteractionsLayerInterface.
|
|
11
|
+
*/
|
|
12
|
+
export class UserInteractionsLayerInterface {
|
|
13
|
+
/*
|
|
14
|
+
* Constructor
|
|
15
|
+
|
|
16
|
+
* @param {Object} options Layer options.
|
|
17
|
+
* @param {string} options.userInteractions If true, it listens for user mouse hover and click event.
|
|
18
|
+
* @param {string} options.userClickInteractions If true, it listens for user click event.
|
|
19
|
+
* @param {string} options.userHoverInteractions If true, it listens for user mouse over event.
|
|
20
|
+
* @param {string} options.defaultUserInteractions If true, it adds default listeners for user mouse hover and click event.
|
|
21
|
+
*/
|
|
22
|
+
constructor(options = {}) { }
|
|
23
|
+
/**
|
|
24
|
+
* Initialize the layer adding user interactions.
|
|
25
|
+
*
|
|
26
|
+
* @param {ol/Map~Map} map
|
|
27
|
+
*/
|
|
28
|
+
attachToMap(map) { }
|
|
29
|
+
/**
|
|
30
|
+
* Terminate the layer unsubscribing user interactions.
|
|
31
|
+
*/
|
|
32
|
+
detachFromMap() { }
|
|
33
|
+
/**
|
|
34
|
+
* Activate map listeners events.
|
|
35
|
+
*/
|
|
36
|
+
activateUserInteractions() { }
|
|
37
|
+
/**
|
|
38
|
+
* Deactivate map listeners events.
|
|
39
|
+
*/
|
|
40
|
+
deactivateUserInteractions() { }
|
|
41
|
+
/**
|
|
42
|
+
* Subscribe on user:click event.
|
|
43
|
+
*/
|
|
44
|
+
onClick(callback) { }
|
|
45
|
+
/**
|
|
46
|
+
* Subscribe on user:hover event.
|
|
47
|
+
*/
|
|
48
|
+
onHover(callback) { }
|
|
49
|
+
/**
|
|
50
|
+
* Unsubscribe on user:click event.
|
|
51
|
+
*/
|
|
52
|
+
unClick(callback) { }
|
|
53
|
+
/**
|
|
54
|
+
* Unsubscribe on user:hover event.
|
|
55
|
+
*/
|
|
56
|
+
unHover(callback) { }
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Mixin for UserInteractionsLayerInterface. It provide onClick and onHover functions.
|
|
60
|
+
*
|
|
61
|
+
* @param {Class} Base A class to extend with {UserInteractionsLayerInterface} functionnalities.
|
|
62
|
+
* @return {Class} A class that implements {UserInteractionsLayerInterface} class and extends Base;
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
function UserInteractionsLayerMixin(Base) {
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
return class extends Base {
|
|
68
|
+
constructor(options = {}) {
|
|
69
|
+
super(options);
|
|
70
|
+
const { userInteractions = true, userClickInteractions = true, userHoverInteractions = true, defaultUserInteractions = true, } = options;
|
|
71
|
+
this.userInteractions = userInteractions;
|
|
72
|
+
this.userClickInteractions = userClickInteractions;
|
|
73
|
+
this.userHoverInteractions = userHoverInteractions;
|
|
74
|
+
this.defaultUserInteractions = defaultUserInteractions;
|
|
75
|
+
this.userClickCallbacks = [];
|
|
76
|
+
this.userHoverCallbacks = [];
|
|
77
|
+
this.userClickEventsKeys = [];
|
|
78
|
+
this.userHoverEventsKeys = [];
|
|
79
|
+
this.onUserClickCallback = this.onUserClickCallback.bind(this);
|
|
80
|
+
this.onUserMoveCallback = this.onUserMoveCallback.bind(this);
|
|
81
|
+
// Add mouse event callbacks
|
|
82
|
+
const { onClick, onHover } = options;
|
|
83
|
+
if (this.userInteractions && this.userClickInteractions && onClick) {
|
|
84
|
+
this.onClick(onClick);
|
|
85
|
+
}
|
|
86
|
+
if (this.userInteractions && this.userHoverInteractions && onHover) {
|
|
87
|
+
this.onHover(onHover);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
attachToMap(map) {
|
|
91
|
+
super.attachToMap(map);
|
|
92
|
+
if (this.userInteractions &&
|
|
93
|
+
this.defaultUserInteractions &&
|
|
94
|
+
this.userClickInteractions &&
|
|
95
|
+
this.onFeatureClick) {
|
|
96
|
+
this.onClick(this.onFeatureClick);
|
|
97
|
+
}
|
|
98
|
+
if (this.userInteractions &&
|
|
99
|
+
this.defaultUserInteractions &&
|
|
100
|
+
this.userHoverInteractions &&
|
|
101
|
+
this.onFeatureHover) {
|
|
102
|
+
this.onHover(this.onFeatureHover);
|
|
103
|
+
}
|
|
104
|
+
this.listenEvents();
|
|
105
|
+
}
|
|
106
|
+
detachFromMap() {
|
|
107
|
+
this.unlistenEvents();
|
|
108
|
+
super.detachFromMap();
|
|
109
|
+
}
|
|
110
|
+
listenEvents() {
|
|
111
|
+
this.unlistenEvents();
|
|
112
|
+
this.userClickCallbacks.forEach((callback) => {
|
|
113
|
+
this.userClickEventsKeys.push(this.on(
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
'user:click', ({ target: { features, layer, coordinate, event }, }) => {
|
|
116
|
+
callback(features, layer, coordinate, event);
|
|
117
|
+
}));
|
|
118
|
+
});
|
|
119
|
+
this.userHoverCallbacks.forEach((callback) => {
|
|
120
|
+
this.userHoverEventsKeys.push(this.on(
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
'user:hover', ({ target: { features, layer, coordinate, event }, }) => {
|
|
123
|
+
callback(features, layer, coordinate, event);
|
|
124
|
+
}));
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
unlistenEvents() {
|
|
128
|
+
unByKey(this.userClickEventsKeys);
|
|
129
|
+
unByKey(this.userHoverEventsKeys);
|
|
130
|
+
this.userClickEventsKeys = [];
|
|
131
|
+
this.userHoverEventsKeys = [];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Listens to click events on the layer.
|
|
135
|
+
* @param {function} callback Callback function, called with the clicked
|
|
136
|
+
* features,
|
|
137
|
+
* the layer instance and the click event.
|
|
138
|
+
*/
|
|
139
|
+
onClick(callback) {
|
|
140
|
+
this.userClickCallbacks.push(callback);
|
|
141
|
+
this.activateUserInteractions();
|
|
142
|
+
if (this.map) {
|
|
143
|
+
// If the layer is already attached to the map we reload the events
|
|
144
|
+
this.listenEvents();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Listens to hover events on the layer.
|
|
149
|
+
* @param {function} callback Callback function, called with the clicked
|
|
150
|
+
* features, the layer instance and the click event.
|
|
151
|
+
*/
|
|
152
|
+
onHover(callback) {
|
|
153
|
+
this.userHoverCallbacks.push(callback);
|
|
154
|
+
this.activateUserInteractions();
|
|
155
|
+
if (this.map) {
|
|
156
|
+
// If the layer is already attached to the map we reload the events
|
|
157
|
+
this.listenEvents();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Unlistens to click events on the layer.
|
|
162
|
+
* @param {function} callback Callback function, called with the clicked
|
|
163
|
+
* features,
|
|
164
|
+
* the layer instance and the click event.
|
|
165
|
+
*/
|
|
166
|
+
unClick(callback) {
|
|
167
|
+
const index = this.userClickCallbacks.indexOf(callback);
|
|
168
|
+
if (index !== -1) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
this.userClickCallbacks = this.userClickCallbacks.slice(index, 1);
|
|
172
|
+
if (this.map) {
|
|
173
|
+
// If the layer is already attached to the map we reload the events
|
|
174
|
+
this.listenEvents();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Unlistens to hover events on the layer.
|
|
179
|
+
* @param {function} callback Callback function, called with the clicked
|
|
180
|
+
* features, the layer instance and the click event.
|
|
181
|
+
*/
|
|
182
|
+
unHover(callback) {
|
|
183
|
+
const index = this.userHoverCallbacks.indexOf(callback);
|
|
184
|
+
if (index !== -1) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
this.userHoverCallbacks = this.userHoverCallbacks.slice(index, 1);
|
|
188
|
+
if (this.map) {
|
|
189
|
+
// If the layer is already attached to the map we reload the events
|
|
190
|
+
this.listenEvents();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Function triggered when the user click the map.
|
|
195
|
+
* @private
|
|
196
|
+
*/
|
|
197
|
+
onUserClickCallback(evt) {
|
|
198
|
+
const coordinate = evt.coordinate ||
|
|
199
|
+
fromLonLat(evt.lngLat.toArray());
|
|
200
|
+
const emptyFeatureInfo = {
|
|
201
|
+
features: [],
|
|
202
|
+
layer: this,
|
|
203
|
+
coordinate,
|
|
204
|
+
event: evt,
|
|
205
|
+
};
|
|
206
|
+
return this.getFeatureInfoAtCoordinate(coordinate)
|
|
207
|
+
.then((featureInfo) => {
|
|
208
|
+
const event = new BaseEvent('user:click');
|
|
209
|
+
event.target = featureInfo;
|
|
210
|
+
this.dispatchEvent(event);
|
|
211
|
+
return featureInfo;
|
|
212
|
+
})
|
|
213
|
+
.catch(() => emptyFeatureInfo);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Function triggered when the user move the cursor.
|
|
217
|
+
* @private
|
|
218
|
+
*/
|
|
219
|
+
onUserMoveCallback(evt) {
|
|
220
|
+
const coordinate = evt.coordinate ||
|
|
221
|
+
fromLonLat(evt.lngLat.toArray());
|
|
222
|
+
const emptyFeatureInfo = {
|
|
223
|
+
features: [],
|
|
224
|
+
layer: this,
|
|
225
|
+
coordinate,
|
|
226
|
+
event: evt,
|
|
227
|
+
};
|
|
228
|
+
return this.getFeatureInfoAtCoordinate(coordinate)
|
|
229
|
+
.then((featureInfo) => {
|
|
230
|
+
const event = new BaseEvent('user:hover');
|
|
231
|
+
event.target = featureInfo;
|
|
232
|
+
this.dispatchEvent(event);
|
|
233
|
+
return featureInfo;
|
|
234
|
+
})
|
|
235
|
+
.catch(() => emptyFeatureInfo);
|
|
236
|
+
}
|
|
237
|
+
activateUserInteractions() { }
|
|
238
|
+
deactivateUserInteractions() { }
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
export default UserInteractionsLayerMixin;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as realtimeDefaultStyle } from "./realtimeDefaultStyle";
|
|
2
|
+
export { default as realtimeDelayStyle } from "./realtimeDelayStyle";
|
|
3
|
+
export { default as realtimeSimpleStyle } from "./realtimeSimpleStyle";
|
|
4
|
+
export * from "./realtimeDefaultStyle";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/styles/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { RealtimeStyleFunction } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Draw circle delay background
|
|
4
|
+
*
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
export declare const getDelayBgCanvas: (origin: number, radius: number, color: string) => import("../../types").AnyCanvas | null;
|
|
8
|
+
/**
|
|
9
|
+
* Draw delay text
|
|
10
|
+
*
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
export declare const getDelayTextCanvas: (text: string, fontSize: number, font: string, delayColor: string, delayOutlineColor?: string, pixelRatio?: number) => import("../../types").AnyCanvas | null;
|
|
14
|
+
/**
|
|
15
|
+
* Draw colored circle with black border
|
|
16
|
+
*
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
export declare const getCircleCanvas: (origin: number, radius: number, color: string, hasStroke: boolean, hasDash: boolean, pixelRatio: number) => import("../../types").AnyCanvas | null;
|
|
20
|
+
/**
|
|
21
|
+
* Draw text in the circle
|
|
22
|
+
*
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
export declare const getTextCanvas: (text: string, origin: number, textSize: number, fillColor: string, strokeColor: string, hasStroke: boolean, pixelRatio: number, getTextFont: (fontSize: number, text?: string) => string) => import("../../types").AnyCanvas | null;
|
|
26
|
+
/**
|
|
27
|
+
* A tracker style that take in account the delay.
|
|
28
|
+
*
|
|
29
|
+
* @param {RealtimeTrajectory} trajectory The trajectory to render.
|
|
30
|
+
* @param {ViewState} viewState The view state of the map.
|
|
31
|
+
* @param {RealtimeStyleOptions} options Some options to change the rendering
|
|
32
|
+
* @return a canvas
|
|
33
|
+
*/
|
|
34
|
+
declare const realtimeDefaultStyle: RealtimeStyleFunction;
|
|
35
|
+
export default realtimeDefaultStyle;
|
|
36
|
+
//# sourceMappingURL=realtimeDefaultStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtimeDefaultStyle.d.ts","sourceRoot":"","sources":["../../../src/common/styles/realtimeDefaultStyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAMrB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,WACnB,MAAM,UACN,MAAM,SACP,MAAM,2CAmBd,CAAC;AAKF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,SACvB,MAAM,YACF,MAAM,QACV,MAAM,cACA,MAAM,sBACC,MAAM,eACb,MAAM,2CA0BnB,CAAC;AAKF;;;;GAIG;AACH,eAAO,MAAM,eAAe,WAClB,MAAM,UACN,MAAM,SACP,MAAM,aACF,OAAO,WACT,OAAO,cACJ,MAAM,2CAiCnB,CAAC;AAKF;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAClB,MAAM,UACJ,MAAM,YACJ,MAAM,aACL,MAAM,eACJ,MAAM,aACR,OAAO,cACN,MAAM,0BACM,MAAM,SAAS,MAAM,KAAK,MAAM,2CAmCzD,CAAC;AAKF;;;;;;;GAOG;AACH,QAAA,MAAM,oBAAoB,EAAE,qBA8O3B,CAAC;AACF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import createCanvas from '../utils/createCanvas';
|
|
2
|
+
/** @private */
|
|
3
|
+
const cacheDelayBg = {};
|
|
4
|
+
/**
|
|
5
|
+
* Draw circle delay background
|
|
6
|
+
*
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export const getDelayBgCanvas = (origin, radius, color) => {
|
|
10
|
+
const key = `${origin}, ${radius}, ${color}`;
|
|
11
|
+
if (!cacheDelayBg[key]) {
|
|
12
|
+
const canvas = createCanvas(origin * 2, origin * 2);
|
|
13
|
+
if (canvas) {
|
|
14
|
+
const ctx = canvas.getContext('2d');
|
|
15
|
+
if (!ctx) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
ctx.beginPath();
|
|
19
|
+
ctx.arc(origin, origin, radius, 0, 2 * Math.PI, false);
|
|
20
|
+
ctx.fillStyle = color;
|
|
21
|
+
ctx.filter = 'blur(1px)';
|
|
22
|
+
ctx.fill();
|
|
23
|
+
cacheDelayBg[key] = canvas;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return cacheDelayBg[key];
|
|
27
|
+
};
|
|
28
|
+
/** @private */
|
|
29
|
+
const cacheDelayText = {};
|
|
30
|
+
/**
|
|
31
|
+
* Draw delay text
|
|
32
|
+
*
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
export const getDelayTextCanvas = (text, fontSize, font, delayColor, delayOutlineColor = '#000', pixelRatio = 1) => {
|
|
36
|
+
const key = `${text}, ${font}, ${delayColor}, ${delayOutlineColor}, ${pixelRatio}`;
|
|
37
|
+
if (!cacheDelayText[key]) {
|
|
38
|
+
const canvas = createCanvas(Math.ceil(text.length * fontSize), Math.ceil(fontSize + 8 * pixelRatio));
|
|
39
|
+
if (canvas) {
|
|
40
|
+
const ctx = canvas.getContext('2d');
|
|
41
|
+
if (!ctx) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
ctx.font = font;
|
|
45
|
+
ctx.textAlign = 'left';
|
|
46
|
+
ctx.textBaseline = 'middle';
|
|
47
|
+
ctx.font = font;
|
|
48
|
+
ctx.fillStyle = delayColor;
|
|
49
|
+
ctx.strokeStyle = delayOutlineColor;
|
|
50
|
+
ctx.lineWidth = 1.5 * pixelRatio;
|
|
51
|
+
ctx.strokeText(text, 0, fontSize);
|
|
52
|
+
ctx.fillText(text, 0, fontSize);
|
|
53
|
+
cacheDelayText[key] = canvas;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return cacheDelayText[key];
|
|
57
|
+
};
|
|
58
|
+
/** @private */
|
|
59
|
+
const cacheCircle = {};
|
|
60
|
+
/**
|
|
61
|
+
* Draw colored circle with black border
|
|
62
|
+
*
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
export const getCircleCanvas = (origin, radius, color, hasStroke, hasDash, pixelRatio) => {
|
|
66
|
+
const key = `${origin}, ${radius}, ${color}, ${hasStroke}, ${hasDash}, ${pixelRatio}`;
|
|
67
|
+
if (!cacheCircle[key]) {
|
|
68
|
+
const canvas = createCanvas(origin * 2, origin * 2);
|
|
69
|
+
if (canvas) {
|
|
70
|
+
const ctx = canvas.getContext('2d');
|
|
71
|
+
if (!ctx) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
ctx.fillStyle = color;
|
|
75
|
+
if (hasStroke) {
|
|
76
|
+
ctx.lineWidth = 1 * pixelRatio;
|
|
77
|
+
ctx.strokeStyle = '#000000';
|
|
78
|
+
}
|
|
79
|
+
ctx.beginPath();
|
|
80
|
+
ctx.arc(origin, origin, radius, 0, 2 * Math.PI, false);
|
|
81
|
+
ctx.fill();
|
|
82
|
+
if (hasDash) {
|
|
83
|
+
ctx.setLineDash([5, 3]);
|
|
84
|
+
}
|
|
85
|
+
if (hasStroke) {
|
|
86
|
+
ctx.stroke();
|
|
87
|
+
}
|
|
88
|
+
cacheCircle[key] = canvas;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return cacheCircle[key];
|
|
92
|
+
};
|
|
93
|
+
/** @private */
|
|
94
|
+
const cacheText = {};
|
|
95
|
+
/**
|
|
96
|
+
* Draw text in the circle
|
|
97
|
+
*
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
export const getTextCanvas = (text, origin, textSize, fillColor, strokeColor, hasStroke, pixelRatio, getTextFont) => {
|
|
101
|
+
const key = `${text}, ${origin}, ${textSize}, ${fillColor},${strokeColor}, ${hasStroke}, ${pixelRatio}`;
|
|
102
|
+
if (!cacheText[key]) {
|
|
103
|
+
const canvas = createCanvas(origin * 2, origin * 2);
|
|
104
|
+
if (canvas) {
|
|
105
|
+
const ctx = canvas.getContext('2d');
|
|
106
|
+
if (!ctx) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
// Draw a stroke to the text only if a provider provides realtime but we don't use it.
|
|
110
|
+
if (hasStroke) {
|
|
111
|
+
ctx.save();
|
|
112
|
+
ctx.textBaseline = 'middle';
|
|
113
|
+
ctx.textAlign = 'center';
|
|
114
|
+
ctx.font = getTextFont(textSize + 2, text);
|
|
115
|
+
ctx.strokeStyle = strokeColor;
|
|
116
|
+
ctx.strokeText(text, origin, origin);
|
|
117
|
+
ctx.restore();
|
|
118
|
+
}
|
|
119
|
+
// Draw a text
|
|
120
|
+
ctx.textBaseline = 'middle';
|
|
121
|
+
ctx.textAlign = 'center';
|
|
122
|
+
ctx.fillStyle = fillColor;
|
|
123
|
+
ctx.font = getTextFont(textSize, text);
|
|
124
|
+
ctx.strokeStyle = strokeColor;
|
|
125
|
+
ctx.strokeText(text, origin, origin);
|
|
126
|
+
ctx.fillText(text, origin, origin);
|
|
127
|
+
cacheText[key] = canvas;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return cacheText[key];
|
|
131
|
+
};
|
|
132
|
+
/** @private */
|
|
133
|
+
const cache = {};
|
|
134
|
+
/**
|
|
135
|
+
* A tracker style that take in account the delay.
|
|
136
|
+
*
|
|
137
|
+
* @param {RealtimeTrajectory} trajectory The trajectory to render.
|
|
138
|
+
* @param {ViewState} viewState The view state of the map.
|
|
139
|
+
* @param {RealtimeStyleOptions} options Some options to change the rendering
|
|
140
|
+
* @return a canvas
|
|
141
|
+
*/
|
|
142
|
+
const realtimeDefaultStyle = (trajectory, viewState, options) => {
|
|
143
|
+
const { hoverVehicleId, selectedVehicleId, useDelayStyle, delayOutlineColor = '#000', delayDisplay = 300000, getRadius = () => 0, getBgColor = () => '#000', getDelayColor = () => '#000', getDelayText = () => null, getDelayFont = (fontSize) => `bold ${fontSize}px arial, sans-serif`, getText = (text) => text, getTextFont = (fontSize) => `bold ${fontSize}px arial, sans-serif`, getTextColor = () => '#000', getTextSize = () => 14, getMaxRadiusForText = () => 10, getMaxRadiusForStrokeAndDelay = () => 7, } = options;
|
|
144
|
+
const { zoom, pixelRatio = 1 } = viewState;
|
|
145
|
+
let { type } = trajectory.properties;
|
|
146
|
+
const { train_id: id, line, delay, state, operator_provides_realtime_journey: operatorProvidesRealtime, } = trajectory.properties;
|
|
147
|
+
let { name, text_color: textColor, color } = line || {};
|
|
148
|
+
name = getText(name);
|
|
149
|
+
const cancelled = state === 'JOURNEY_CANCELLED';
|
|
150
|
+
if (!type) {
|
|
151
|
+
type = 'Rail';
|
|
152
|
+
}
|
|
153
|
+
if (!name) {
|
|
154
|
+
name = 'I';
|
|
155
|
+
}
|
|
156
|
+
if (!textColor) {
|
|
157
|
+
textColor = '#000000';
|
|
158
|
+
}
|
|
159
|
+
if (color && color[0] !== '#') {
|
|
160
|
+
color = `#${color}`;
|
|
161
|
+
}
|
|
162
|
+
if (textColor[0] !== '#') {
|
|
163
|
+
textColor = `#${textColor}`;
|
|
164
|
+
}
|
|
165
|
+
const z = Math.min(Math.floor(zoom || 1), 16);
|
|
166
|
+
const hover = !!(hoverVehicleId && hoverVehicleId === id);
|
|
167
|
+
const selected = !!(selectedVehicleId && selectedVehicleId === id);
|
|
168
|
+
// Calcul the radius of the circle
|
|
169
|
+
let radius = getRadius(type, z) * pixelRatio;
|
|
170
|
+
const isDisplayStrokeAndDelay = radius >= getMaxRadiusForStrokeAndDelay() * pixelRatio;
|
|
171
|
+
if (hover || selected) {
|
|
172
|
+
radius = isDisplayStrokeAndDelay
|
|
173
|
+
? radius + 5 * pixelRatio
|
|
174
|
+
: 14 * pixelRatio;
|
|
175
|
+
}
|
|
176
|
+
const isDisplayText = radius > getMaxRadiusForText() * pixelRatio;
|
|
177
|
+
// Optimize the cache key, very important in high zoom level
|
|
178
|
+
let key = `${radius}${hover || selected}`;
|
|
179
|
+
if (useDelayStyle) {
|
|
180
|
+
key += `${operatorProvidesRealtime}${delay}`;
|
|
181
|
+
if (isDisplayStrokeAndDelay) {
|
|
182
|
+
key += `${cancelled}`;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
key += `${color || type}`;
|
|
187
|
+
if (isDisplayStrokeAndDelay) {
|
|
188
|
+
key += `${cancelled}${delay}`;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (isDisplayText) {
|
|
192
|
+
key += `${name}${textColor}`;
|
|
193
|
+
}
|
|
194
|
+
if (!cache[key]) {
|
|
195
|
+
if (radius === 0) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
const margin = 1 * pixelRatio;
|
|
199
|
+
const radiusDelay = radius + 2 * pixelRatio;
|
|
200
|
+
const markerSize = radius * 2;
|
|
201
|
+
const size = radiusDelay * 2 + margin * 2;
|
|
202
|
+
const origin = size / 2;
|
|
203
|
+
// Draw circle delay background
|
|
204
|
+
let delayBg = null;
|
|
205
|
+
if (isDisplayStrokeAndDelay && delay !== null) {
|
|
206
|
+
delayBg = getDelayBgCanvas(origin, radiusDelay, getDelayColor(delay, cancelled));
|
|
207
|
+
}
|
|
208
|
+
// Show delay if feature is hovered or if delay is above 5mins.
|
|
209
|
+
let delayText = null;
|
|
210
|
+
let fontSize = 0;
|
|
211
|
+
if (isDisplayStrokeAndDelay &&
|
|
212
|
+
(hover || (delay || 0) >= delayDisplay || cancelled)) {
|
|
213
|
+
// Draw delay text
|
|
214
|
+
fontSize =
|
|
215
|
+
Math.max(cancelled ? 19 : 14, Math.min(cancelled ? 19 : 17, radius * 1.2)) * pixelRatio;
|
|
216
|
+
const text = getDelayText(delay, cancelled);
|
|
217
|
+
if (text) {
|
|
218
|
+
delayText = getDelayTextCanvas(text, fontSize, getDelayFont(fontSize, text), getDelayColor(delay, cancelled, true), delayOutlineColor, pixelRatio);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
// Draw colored circle with black border
|
|
222
|
+
let circleFillColor;
|
|
223
|
+
if (useDelayStyle) {
|
|
224
|
+
circleFillColor = getDelayColor(delay, cancelled);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
circleFillColor = color || getBgColor(type);
|
|
228
|
+
}
|
|
229
|
+
const hasStroke = isDisplayStrokeAndDelay || hover || selected;
|
|
230
|
+
const hasDash = !!isDisplayStrokeAndDelay &&
|
|
231
|
+
!!useDelayStyle &&
|
|
232
|
+
delay === null &&
|
|
233
|
+
operatorProvidesRealtime === 'yes';
|
|
234
|
+
const circle = getCircleCanvas(origin, radius, circleFillColor, hasStroke, hasDash, pixelRatio);
|
|
235
|
+
// Create the canvas
|
|
236
|
+
const width = size + ((delayText === null || delayText === void 0 ? void 0 : delayText.width) || 0) * 2;
|
|
237
|
+
const height = size;
|
|
238
|
+
const canvas = createCanvas(width, height);
|
|
239
|
+
if (canvas) {
|
|
240
|
+
const ctx = canvas.getContext('2d');
|
|
241
|
+
if (!ctx) {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
// The renderTrajectories will center the image on the vehicle positions.
|
|
245
|
+
const originX = (delayText === null || delayText === void 0 ? void 0 : delayText.width) || 0;
|
|
246
|
+
if (delayBg) {
|
|
247
|
+
ctx.drawImage(delayBg, originX, 0);
|
|
248
|
+
}
|
|
249
|
+
if (circle) {
|
|
250
|
+
ctx.drawImage(circle, originX, 0);
|
|
251
|
+
}
|
|
252
|
+
// Draw text in the circle
|
|
253
|
+
let circleText = null;
|
|
254
|
+
if (isDisplayText) {
|
|
255
|
+
const fontSize2 = Math.max(radius, 10);
|
|
256
|
+
const textSize = getTextSize(ctx, markerSize, name, fontSize2, getTextFont);
|
|
257
|
+
const textColor2 = !useDelayStyle
|
|
258
|
+
? textColor || getTextColor(type)
|
|
259
|
+
: '#000000';
|
|
260
|
+
const hasStroke2 = !!useDelayStyle &&
|
|
261
|
+
delay === null &&
|
|
262
|
+
operatorProvidesRealtime === 'yes';
|
|
263
|
+
circleText = getTextCanvas(name, origin, textSize, textColor2, circleFillColor, hasStroke2, pixelRatio, getTextFont);
|
|
264
|
+
}
|
|
265
|
+
if (circleText) {
|
|
266
|
+
ctx.drawImage(circleText, originX, 0);
|
|
267
|
+
}
|
|
268
|
+
if (delayText) {
|
|
269
|
+
ctx.drawImage(delayText, originX + Math.ceil(origin + radiusDelay) + margin, Math.ceil(origin - fontSize));
|
|
270
|
+
}
|
|
271
|
+
cache[key] = canvas;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return cache[key];
|
|
275
|
+
};
|
|
276
|
+
export default realtimeDefaultStyle;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RealtimeStyleFunction } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* A tracker style that display the delay as backgroundColor.
|
|
4
|
+
*
|
|
5
|
+
* @param {*} trajectory The trajectory to render.
|
|
6
|
+
* @param {*} viewState The view state of the map.
|
|
7
|
+
* @param {*} options Some options to change the rendering
|
|
8
|
+
* @return a canvas
|
|
9
|
+
*/
|
|
10
|
+
declare const realtimeDelayStyle: RealtimeStyleFunction;
|
|
11
|
+
export default realtimeDelayStyle;
|
|
12
|
+
//# sourceMappingURL=realtimeDelayStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtimeDelayStyle.d.ts","sourceRoot":"","sources":["../../../src/common/styles/realtimeDelayStyle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIV,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB;;;;;;;GAOG;AACH,QAAA,MAAM,kBAAkB,EAAE,qBASzB,CAAC;AACF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import realtimeDefaultStyle from './realtimeDefaultStyle';
|
|
2
|
+
/**
|
|
3
|
+
* A tracker style that display the delay as backgroundColor.
|
|
4
|
+
*
|
|
5
|
+
* @param {*} trajectory The trajectory to render.
|
|
6
|
+
* @param {*} viewState The view state of the map.
|
|
7
|
+
* @param {*} options Some options to change the rendering
|
|
8
|
+
* @return a canvas
|
|
9
|
+
*/
|
|
10
|
+
const realtimeDelayStyle = (trajectory, viewState, options) => {
|
|
11
|
+
return realtimeDefaultStyle(trajectory, viewState, Object.assign(Object.assign({}, options), { useDelayStyle: true }));
|
|
12
|
+
};
|
|
13
|
+
export default realtimeDelayStyle;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RealtimeStyleFunction } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* A tracker style that take in account the delay.
|
|
4
|
+
*
|
|
5
|
+
* @param {RealtimeTrajectory} trajectory The trajectory to render.
|
|
6
|
+
* @param {ViewState} viewState The view state of the map.
|
|
7
|
+
* @param {RealtimeStyleOptions} options Some options to change the rendering
|
|
8
|
+
* @return a canvas
|
|
9
|
+
*/
|
|
10
|
+
declare const realtimeHeadingStyle: RealtimeStyleFunction;
|
|
11
|
+
export default realtimeHeadingStyle;
|
|
12
|
+
//# sourceMappingURL=realtimeHeadingStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtimeHeadingStyle.d.ts","sourceRoot":"","sources":["../../../src/common/styles/realtimeHeadingStyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,qBAAqB,EAEtB,MAAM,aAAa,CAAC;AAsFrB;;;;;;;GAOG;AACH,QAAA,MAAM,oBAAoB,EAAE,qBAoC3B,CAAC;AACF,eAAe,oBAAoB,CAAC"}
|