mobility-toolbox-js 2.0.1-beta.13 → 2.1.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 +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 +32 -12
- package/api/StopsAPI.d.ts +38 -0
- package/api/StopsAPI.d.ts.map +1 -0
- package/api/StopsAPI.js +33 -9
- package/api/index.d.ts +4 -0
- package/api/index.d.ts.map +1 -0
- package/api/index.js +3 -3
- package/api/typedefs.d.ts +179 -0
- package/api/typedefs.d.ts.map +1 -0
- package/api/typedefs.js +75 -0
- package/common/api/HttpAPI.d.ts +31 -0
- package/common/api/HttpAPI.d.ts.map +1 -0
- package/common/api/HttpAPI.js +54 -27
- package/common/api/WebSocketAPI.d.ts +153 -0
- package/common/api/WebSocketAPI.d.ts.map +1 -0
- package/common/api/WebSocketAPI.js +330 -164
- 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 -4
- 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 -4
- 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/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 +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 +26 -15
- 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 +67 -37
- package/common/utils/index.d.ts +17 -0
- package/common/utils/index.d.ts.map +1 -0
- package/common/utils/index.js +17 -5
- 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 +12 -5
- 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 +17 -15
- package/common/utils/timeUtils.d.ts +24 -0
- package/common/utils/timeUtils.d.ts.map +1 -0
- package/common/utils/timeUtils.js +34 -15
- package/iife.d.ts +3 -0
- package/iife.d.ts.map +1 -0
- package/iife.js +5 -0
- package/index.d.ts +10 -0
- package/index.d.ts.map +1 -0
- package/index.js +8 -6
- package/mapbox/controls/CopyrightControl.d.ts +29 -0
- package/mapbox/controls/CopyrightControl.d.ts.map +1 -0
- package/mapbox/controls/CopyrightControl.js +44 -25
- package/mapbox/controls/index.d.ts +2 -0
- package/mapbox/controls/index.d.ts.map +1 -0
- package/mapbox/controls/index.js +2 -1
- package/mapbox/index.d.ts +6 -0
- package/mapbox/index.d.ts.map +1 -0
- package/mapbox/index.js +5 -4
- package/mapbox/layers/Layer.d.ts +59 -0
- package/mapbox/layers/Layer.d.ts.map +1 -0
- package/mapbox/layers/Layer.js +99 -55
- 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 -2
- 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 +26061 -16500
- package/mbt.js.map +4 -4
- package/mbt.min.js +205 -126
- package/mbt.min.js.map +4 -4
- package/ol/controls/CopyrightControl.d.ts +31 -0
- package/ol/controls/CopyrightControl.d.ts.map +1 -0
- package/ol/controls/CopyrightControl.js +62 -36
- package/ol/controls/RoutingControl.d.ts +193 -0
- package/ol/controls/RoutingControl.d.ts.map +1 -0
- package/ol/controls/RoutingControl.js +601 -357
- package/ol/controls/StopFinderControl.d.ts +30 -0
- package/ol/controls/StopFinderControl.d.ts.map +1 -0
- package/ol/controls/StopFinderControl.js +30 -8
- package/ol/controls/index.d.ts +4 -0
- package/ol/controls/index.d.ts.map +1 -0
- package/ol/controls/index.js +3 -3
- package/ol/index.d.ts +6 -0
- package/ol/index.d.ts.map +1 -0
- package/ol/index.js +5 -5
- package/ol/layers/Layer.d.ts +86 -0
- package/ol/layers/Layer.d.ts.map +1 -0
- package/ol/layers/Layer.js +163 -77
- 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 +99 -193
- package/ol/layers/MapboxStyleLayer.d.ts +129 -0
- package/ol/layers/MapboxStyleLayer.d.ts.map +1 -0
- package/ol/layers/MapboxStyleLayer.js +362 -171
- package/ol/layers/MaplibreLayer.d.ts +28 -0
- package/ol/layers/MaplibreLayer.d.ts.map +1 -0
- package/ol/layers/MaplibreLayer.js +30 -135
- 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 +72 -48
- package/ol/layers/VectorLayer.d.ts +25 -0
- package/ol/layers/VectorLayer.d.ts.map +1 -0
- package/ol/layers/VectorLayer.js +34 -18
- package/ol/layers/WMSLayer.d.ts +42 -0
- package/ol/layers/WMSLayer.d.ts.map +1 -0
- package/ol/layers/WMSLayer.js +84 -34
- package/ol/layers/index.d.ts +9 -0
- package/ol/layers/index.d.ts.map +1 -0
- package/ol/layers/index.js +8 -8
- package/ol/styles/fullTrajectoryDelayStyle.d.ts +4 -0
- package/ol/styles/fullTrajectoryDelayStyle.d.ts.map +1 -0
- package/ol/styles/fullTrajectoryDelayStyle.js +26 -24
- package/ol/styles/fullTrajectoryStyle.d.ts +5 -0
- package/ol/styles/fullTrajectoryStyle.d.ts.map +1 -0
- package/ol/styles/fullTrajectoryStyle.js +40 -39
- package/ol/styles/index.d.ts +3 -0
- package/ol/styles/index.d.ts.map +1 -0
- package/ol/styles/index.js +2 -2
- package/package.json +81 -133
- package/setupTests.d.ts +2 -0
- package/setupTests.d.ts.map +1 -0
- package/setupTests.js +26 -0
- 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/README.md +0 -23
- package/api/RoutingAPI.test.js +0 -25
- package/api/StopsAPI.test.js +0 -22
- package/api/TralisAPI.js +0 -359
- package/api/TralisAPI.test.js +0 -67
- package/api/TralisAPIUtils.js +0 -43
- package/common/Tracker.js +0 -93
- package/common/api/HttpAPI.test.js +0 -50
- package/common/api/WebSocketAPI.test.js +0 -311
- package/common/controls/Control.js +0 -81
- package/common/controls/Control.test.js +0 -87
- package/common/layers/Layer.js +0 -213
- package/common/layers/Layer.test.js +0 -526
- package/common/mixins/CopyrightMixin.js +0 -24
- package/common/mixins/SearchMixin.js +0 -110
- package/common/mixins/TralisLayerMixin.js +0 -479
- package/common/styles/trackerDefaultStyle.js +0 -197
- package/common/styles/trackerDelayStyle.js +0 -8
- package/common/styles/trackerSimpleStyle.js +0 -18
- package/common/trackerConfig.js +0 -152
- package/common/trackerConfig.test.js +0 -23
- package/common/utils/createTrackerFilters.js +0 -56
- package/common/utils/createTrackerFilters.test.js +0 -79
- package/common/utils/getMapboxMapCopyrights.test.js +0 -40
- package/common/utils/getMapboxStyleUrl.js +0 -22
- package/common/utils/removeDuplicate.test.js +0 -19
- package/common/utils/timeUtils.test.js +0 -10
- package/mapbox/layers/Layer.test.js +0 -182
- package/mapbox/layers/TralisLayer.js +0 -182
- package/mapbox/layers/TralisLayer.test.js +0 -38
- package/mapbox/utils.js +0 -32
- package/ol/controls/CopyrightControl.test.js +0 -165
- package/ol/controls/RoutingControl.test.js +0 -151
- package/ol/controls/StopFinderControl.test.js +0 -48
- package/ol/layers/Layer.test.js +0 -174
- package/ol/layers/MapboxLayer.test.js +0 -160
- package/ol/layers/MapboxStyleLayer.test.js +0 -231
- package/ol/layers/RoutingLayer.test.js +0 -40
- package/ol/layers/TralisLayer.js +0 -185
- package/ol/layers/TralisLayer.test.js +0 -79
- package/ol/layers/VectorLayer.test.js +0 -87
- package/ol/layers/WMSLayer.test.js +0 -76
|
@@ -1,139 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
canvas.style.opacity = opacity;
|
|
22
|
-
this.mbMap.jumpTo({
|
|
23
|
-
center: toLonLat(viewState.center),
|
|
24
|
-
zoom: viewState.zoom - 1,
|
|
25
|
-
bearing: toDegrees(-viewState.rotation),
|
|
26
|
-
animate: false
|
|
27
|
-
});
|
|
28
|
-
if (!canvas.isConnected) {
|
|
29
|
-
this.map.render();
|
|
30
|
-
} else if (canvas.width !== frameState.size[0] || canvas.height !== frameState.size[1]) {
|
|
31
|
-
this.mbMap.resize();
|
|
32
|
-
}
|
|
33
|
-
this.mbMap.redraw();
|
|
34
|
-
return this.mbMap.getContainer();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
super({
|
|
38
|
-
...options,
|
|
39
|
-
olLayer: mbLayer
|
|
40
|
-
});
|
|
41
|
-
this.styleUrl = options.url;
|
|
42
|
-
this.apiKey = options.apiKey;
|
|
43
|
-
this.apiKeyName = options.apiKeyName || "key";
|
|
44
|
-
this.updateAttribution = this.updateAttribution.bind(this);
|
|
45
|
-
}
|
|
46
|
-
attachToMap(map) {
|
|
47
|
-
super.attachToMap(map);
|
|
48
|
-
if (!this.map) {
|
|
49
|
-
return;
|
|
1
|
+
import { Map } from 'maplibre-gl';
|
|
2
|
+
import { getMaplibreRender } from '../../common/utils';
|
|
3
|
+
import MapGlLayer from './MapGlLayer';
|
|
4
|
+
/**
|
|
5
|
+
* A class representing MaplibreLayer to display on BasicMap
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import { MaplibreLayer } from 'mobility-toolbox-js/ol';
|
|
9
|
+
*
|
|
10
|
+
* const layer = new MaplibreLayer({
|
|
11
|
+
* url: 'https://maps.geops.io/styles/travic_v2/style.json',
|
|
12
|
+
* apikey: 'yourApiKey',
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* @classproperty {ol/Map~Map} map - The map where the layer is displayed.
|
|
16
|
+
* @extends {Layer}
|
|
17
|
+
*/
|
|
18
|
+
export default class MaplibreLayer extends MapGlLayer {
|
|
19
|
+
getOlLayerRender() {
|
|
20
|
+
return getMaplibreRender(this);
|
|
50
21
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this.loadMbMap();
|
|
55
|
-
}
|
|
56
|
-
detachFromMap() {
|
|
57
|
-
if (this.mbMap) {
|
|
58
|
-
this.mbMap.off("idle", this.updateAttribution);
|
|
59
|
-
this.mbMap.triggerRepaint = () => {
|
|
60
|
-
};
|
|
61
|
-
this.mbMap.remove();
|
|
62
|
-
this.mbMap = null;
|
|
22
|
+
// eslint-disable-next-line class-methods-use-this
|
|
23
|
+
getMapboxMapClass() {
|
|
24
|
+
return Map;
|
|
63
25
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.olListenersKeys.push(this.map.on("change:target", () => {
|
|
72
|
-
this.loadMbMap();
|
|
73
|
-
}));
|
|
74
|
-
if (!this.map.getTargetElement()) {
|
|
75
|
-
return;
|
|
26
|
+
/**
|
|
27
|
+
* Create a copy of the MapboxLayer.
|
|
28
|
+
* @param {Object} newOptions Options to override
|
|
29
|
+
* @return {MapboxLayer} A MapboxLayer
|
|
30
|
+
*/
|
|
31
|
+
clone(newOptions) {
|
|
32
|
+
return new MaplibreLayer(Object.assign(Object.assign({}, this.options), newOptions));
|
|
76
33
|
}
|
|
77
|
-
if (!this.visible) {
|
|
78
|
-
this.olListenersKeys.push(this.once("change:visible", () => {
|
|
79
|
-
this.loadMbMap();
|
|
80
|
-
}));
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const container = document.createElement("div");
|
|
84
|
-
container.style.position = "absolute";
|
|
85
|
-
container.style.width = "100%";
|
|
86
|
-
container.style.height = "100%";
|
|
87
|
-
this.mbMap = new Map({
|
|
88
|
-
style: this.createStyleUrl(),
|
|
89
|
-
container,
|
|
90
|
-
interactive: false,
|
|
91
|
-
trackResize: false,
|
|
92
|
-
attributionControl: false,
|
|
93
|
-
...this.options.mapOptions || {}
|
|
94
|
-
});
|
|
95
|
-
this.mbMap.once("load", () => {
|
|
96
|
-
this.loaded = true;
|
|
97
|
-
this.dispatchEvent({
|
|
98
|
-
type: "load",
|
|
99
|
-
target: this
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
this.mbMap.on("idle", this.updateAttribution);
|
|
103
|
-
}
|
|
104
|
-
updateAttribution(evt) {
|
|
105
|
-
const newAttributions = getMapboxMapCopyrights(evt.target) || [];
|
|
106
|
-
if (this.copyrights?.toString() !== newAttributions.toString()) {
|
|
107
|
-
this.copyrights = newAttributions;
|
|
108
|
-
this.olLayer.getSource().setAttributions(newAttributions);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
getFeatureInfoAtCoordinate(coordinate, options) {
|
|
112
|
-
if (!options || !this.format || !this.mbMap || !this.mbMap.isStyleLoaded()) {
|
|
113
|
-
return Promise.resolve({ coordinate, features: [], layer: this });
|
|
114
|
-
}
|
|
115
|
-
let pixel = coordinate && this.mbMap.project(toLonLat(coordinate));
|
|
116
|
-
if (this.hitTolerance) {
|
|
117
|
-
const { x, y } = pixel;
|
|
118
|
-
pixel = [
|
|
119
|
-
{ x: x - this.hitTolerance, y: y - this.hitTolerance },
|
|
120
|
-
{ x: x + this.hitTolerance, y: y + this.hitTolerance }
|
|
121
|
-
];
|
|
122
|
-
}
|
|
123
|
-
const features = this.mbMap.queryRenderedFeatures(pixel, options).map((feature) => {
|
|
124
|
-
const olFeature = this.format.readFeature(feature);
|
|
125
|
-
if (olFeature) {
|
|
126
|
-
olFeature.set("mapboxFeature", feature);
|
|
127
|
-
}
|
|
128
|
-
return olFeature;
|
|
129
|
-
});
|
|
130
|
-
return Promise.resolve({
|
|
131
|
-
layer: this,
|
|
132
|
-
features,
|
|
133
|
-
coordinate
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
clone(newOptions) {
|
|
137
|
-
return new MaplibreLayer({ ...this.options, ...newOptions });
|
|
138
|
-
}
|
|
139
34
|
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import GeoJSON from 'ol/format/GeoJSON';
|
|
2
|
+
import Feature, { FeatureLike } from 'ol/Feature';
|
|
3
|
+
import { MapEvent } from 'ol';
|
|
4
|
+
import { Coordinate } from 'ol/coordinate';
|
|
5
|
+
import { ObjectEvent } from 'ol/Object';
|
|
6
|
+
import Layer from './Layer';
|
|
7
|
+
import { RealtimeLayerMixinOptions } from '../../common/mixins/RealtimeLayerMixin';
|
|
8
|
+
import { AnyMap, LayerGetFeatureInfoResponse, RealtimeFullTrajectory, RealtimeTrainId } from '../../types';
|
|
9
|
+
import { RealtimeTrajectory } from '../../api/typedefs';
|
|
10
|
+
import { WebSocketAPIMessageEventData } from '../../common/api/WebSocketAPI';
|
|
11
|
+
export type OlRealtimeLayerOptions = RealtimeLayerMixinOptions & {
|
|
12
|
+
fullTrajectoryStyle: (feature: FeatureLike, resolution: number, options: any) => void;
|
|
13
|
+
allowRenderWhenAnimating?: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare const RealtimeLayer_base: {
|
|
16
|
+
new (options: RealtimeLayerMixinOptions): {
|
|
17
|
+
[x: string]: any;
|
|
18
|
+
debug: boolean;
|
|
19
|
+
trajectories?: {
|
|
20
|
+
[key: string]: GeoJSONFeature;
|
|
21
|
+
} | undefined;
|
|
22
|
+
canvas?: import("../../types").AnyCanvas | undefined;
|
|
23
|
+
mode: import("../../types").RealtimeMode;
|
|
24
|
+
api: import("../../api/RealtimeAPI").default;
|
|
25
|
+
tenant: string;
|
|
26
|
+
time?: Date | undefined;
|
|
27
|
+
live?: boolean | undefined;
|
|
28
|
+
speed?: number | undefined;
|
|
29
|
+
filter?: Function | undefined;
|
|
30
|
+
sort?: Function | undefined;
|
|
31
|
+
style?: import("../../types").RealtimeStyleFunction | undefined;
|
|
32
|
+
styleOptions?: import("../../types").RealtimeStyleOptions | undefined;
|
|
33
|
+
pixelRatio?: number | undefined;
|
|
34
|
+
minZoomInterpolation: number;
|
|
35
|
+
isUpdateBboxOnMoveEnd: boolean;
|
|
36
|
+
hoverVehicleId?: string | undefined;
|
|
37
|
+
selectedVehicleId?: string | undefined;
|
|
38
|
+
renderState?: import("../../types").RealtimeRenderState | undefined;
|
|
39
|
+
useRequestAnimationFrame?: boolean | undefined;
|
|
40
|
+
useDebounce?: boolean | undefined;
|
|
41
|
+
useThrottle?: boolean | undefined;
|
|
42
|
+
mots?: import("../../types").RealtimeMot[] | undefined;
|
|
43
|
+
motsByZoom: import("../../types").RealtimeMot[][];
|
|
44
|
+
generalizationLevel?: import("../../types").RealtimeGeneralizationLevel | undefined;
|
|
45
|
+
generalizationLevelByZoom: import("../../types").RealtimeGeneralizationLevel[];
|
|
46
|
+
renderTimeIntervalByZoom: number[];
|
|
47
|
+
format: GeoJSON;
|
|
48
|
+
requestId?: number | undefined;
|
|
49
|
+
updateTimeInterval?: number | undefined;
|
|
50
|
+
updateTimeDelay?: number | undefined;
|
|
51
|
+
visibilityRef: import("ol/events").EventsKey;
|
|
52
|
+
selectedVehicle: GeoJSONFeature;
|
|
53
|
+
getMotsByZoom: (zoom: number) => import("../../types").RealtimeMot[];
|
|
54
|
+
getGeneralizationLevelByZoom: (zoom: number) => import("../../types").RealtimeGeneralizationLevel;
|
|
55
|
+
getRenderTimeIntervalByZoom: (zoom: number) => number;
|
|
56
|
+
throttleRenderTrajectories: (viewState: import("../../types").ViewState, noInterpolate?: boolean | undefined) => void;
|
|
57
|
+
debounceRenderTrajectories: (viewState: import("../../types").ViewState, noInterpolate?: boolean | undefined) => void;
|
|
58
|
+
onStart?: ((realtimeLayer: any) => void) | undefined;
|
|
59
|
+
onStop?: ((realtimeLayer: any) => void) | undefined;
|
|
60
|
+
defineProperties(options: RealtimeLayerMixinOptions): void;
|
|
61
|
+
attachToMap(map: any): void;
|
|
62
|
+
detachFromMap(): void;
|
|
63
|
+
start(): void;
|
|
64
|
+
startUpdateTime(): void;
|
|
65
|
+
stop(): void;
|
|
66
|
+
stopUpdateTime(): void;
|
|
67
|
+
renderTrajectoriesInternal(viewState: import("../../types").ViewState, noInterpolate?: boolean): boolean;
|
|
68
|
+
renderTrajectories(viewState: import("../../types").ViewState | undefined, noInterpolate: boolean | undefined): void;
|
|
69
|
+
setBbox(extent?: [number, number, number, number] | undefined, zoom?: number | undefined): void;
|
|
70
|
+
getRefreshTimeInMs(zoom?: number | undefined): number;
|
|
71
|
+
getVehicle(filterFc: Function): GeoJSONFeature[];
|
|
72
|
+
getFeatureInfoAtCoordinate(coordinate: Coordinate, options: import("../../types").LayerGetFeatureInfoOptions): Promise<{
|
|
73
|
+
layer: any;
|
|
74
|
+
features: Feature<import("ol/geom/Geometry").default>[];
|
|
75
|
+
coordinate: Coordinate;
|
|
76
|
+
}>;
|
|
77
|
+
getTrajectoryInfos(id: string): Promise<{
|
|
78
|
+
stopSequence: WebSocketAPIMessageEventData<RealtimeFullTrajectory> | WebSocketAPIMessageEventData<GeoJSONFeature[]>;
|
|
79
|
+
fullTrajectory: WebSocketAPIMessageEventData<RealtimeFullTrajectory> | WebSocketAPIMessageEventData<GeoJSONFeature[]>;
|
|
80
|
+
}>;
|
|
81
|
+
purgeOutOfDateTrajectories(): void;
|
|
82
|
+
purgeTrajectory(trajectory: GeoJSONFeature, extent: [number, number, number, number], zoom: number): boolean;
|
|
83
|
+
addTrajectory(trajectory: GeoJSONFeature): void;
|
|
84
|
+
removeTrajectory(trajectoryOrId: any): void;
|
|
85
|
+
onZoomEnd(): void;
|
|
86
|
+
onDocumentVisibilityChange(): void;
|
|
87
|
+
onTrajectoryMessage(data: WebSocketAPIMessageEventData<GeoJSONFeature>): void;
|
|
88
|
+
onDeleteTrajectoryMessage(data: WebSocketAPIMessageEventData<string>): void;
|
|
89
|
+
onFeatureHover(features: Feature<import("ol/geom/Geometry").default>[], layer: import("../../types").AnyRealtimeLayer, coordinate: Coordinate): void;
|
|
90
|
+
onFeatureClick(features: Feature<import("ol/geom/Geometry").default>[], layer: import("../../types").AnyRealtimeLayer, coordinate: Coordinate): void;
|
|
91
|
+
};
|
|
92
|
+
} & typeof Layer;
|
|
93
|
+
/**
|
|
94
|
+
* Responsible for loading and display data from a Realtime service.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* import { RealtimeLayer } from 'mobility-toolbox-js/ol';
|
|
98
|
+
*
|
|
99
|
+
* const layer = new RealtimeLayer({
|
|
100
|
+
* url: [yourUrl],
|
|
101
|
+
* apiKey: [yourApiKey],
|
|
102
|
+
* });
|
|
103
|
+
*
|
|
104
|
+
*
|
|
105
|
+
* @see <a href="/api/class/src/api/RealtimeAPI%20js~RealtimeAPI%20html">RealtimeAPI</a>
|
|
106
|
+
*
|
|
107
|
+
* @extends {Layer}
|
|
108
|
+
* @implements {UserInteractionsLayerInterface}
|
|
109
|
+
* @implements {RealtimeLayerInterface}
|
|
110
|
+
*/
|
|
111
|
+
declare class RealtimeLayer extends RealtimeLayer_base {
|
|
112
|
+
allowRenderWhenAnimating?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Constructor.
|
|
115
|
+
*
|
|
116
|
+
* @param {Object} options
|
|
117
|
+
* @private
|
|
118
|
+
*/
|
|
119
|
+
constructor(options: OlRealtimeLayerOptions);
|
|
120
|
+
attachToMap(map: AnyMap): void;
|
|
121
|
+
/**
|
|
122
|
+
* Destroy the container of the tracker.
|
|
123
|
+
*/
|
|
124
|
+
detachFromMap(): void;
|
|
125
|
+
/**
|
|
126
|
+
* Detect in the canvas if there is data to query at a specific coordinate.
|
|
127
|
+
* @param {ol/coordinate~Coordinate} coordinate The coordinate to test
|
|
128
|
+
* @returns
|
|
129
|
+
*/
|
|
130
|
+
hasFeatureInfoAtCoordinate(coordinate: Coordinate): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Render the trajectories using current map's size, resolution and rotation.
|
|
133
|
+
* @param {boolean} noInterpolate if true, renders the vehicles without interpolating theirs positions.
|
|
134
|
+
* @overrides
|
|
135
|
+
*/
|
|
136
|
+
renderTrajectories(noInterpolate: boolean): void;
|
|
137
|
+
/**
|
|
138
|
+
* Launch renderTrajectories. it avoids duplicating code in renderTrajectories methhod.
|
|
139
|
+
* @private
|
|
140
|
+
* @override
|
|
141
|
+
*/
|
|
142
|
+
renderTrajectoriesInternal(viewState: ViewState, noInterpolate: boolean): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Return the delay in ms before the next rendering.
|
|
145
|
+
*/
|
|
146
|
+
getRefreshTimeInMs(): number;
|
|
147
|
+
getFeatureInfoAtCoordinate(coordinate: Coordinate, options?: {}): Promise<LayerGetFeatureInfoResponse>;
|
|
148
|
+
/**
|
|
149
|
+
* On move end we update the websocket with the new bbox.
|
|
150
|
+
*
|
|
151
|
+
* @private
|
|
152
|
+
* @override
|
|
153
|
+
*/
|
|
154
|
+
onMoveEnd(evt: MapEvent | ObjectEvent): void;
|
|
155
|
+
/**
|
|
156
|
+
* Function called on moveend event only when the zoom has changed.
|
|
157
|
+
*
|
|
158
|
+
* @param {ol/MapEvent~MapEvent} evt Moveend event.
|
|
159
|
+
* @private
|
|
160
|
+
* @override
|
|
161
|
+
*/
|
|
162
|
+
onZoomEnd(): void;
|
|
163
|
+
/**
|
|
164
|
+
* Update the cursor style when hovering a vehicle.
|
|
165
|
+
*
|
|
166
|
+
* @private
|
|
167
|
+
* @override
|
|
168
|
+
*/
|
|
169
|
+
onFeatureHover(features: Feature[], layer: RealtimeLayer, coordinate: Coordinate): void;
|
|
170
|
+
/**
|
|
171
|
+
* Display the complete trajectory of the vehicle.
|
|
172
|
+
*
|
|
173
|
+
* @private
|
|
174
|
+
* @override
|
|
175
|
+
*/
|
|
176
|
+
onFeatureClick(features: Feature[], layer: RealtimeLayer, coordinate: Coordinate): void;
|
|
177
|
+
/**
|
|
178
|
+
* Remove the trajectory form the list if necessary.
|
|
179
|
+
*
|
|
180
|
+
* @private
|
|
181
|
+
*/
|
|
182
|
+
purgeTrajectory(trajectory: RealtimeTrajectory, extent: [number, number, number, number], zoom: number): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Send the current bbox to the websocket
|
|
185
|
+
*
|
|
186
|
+
* @private
|
|
187
|
+
*/
|
|
188
|
+
setBbox(extent?: [number, number, number, number], zoom?: number): void;
|
|
189
|
+
/**
|
|
190
|
+
* Highlight the trajectory of journey.
|
|
191
|
+
* @private
|
|
192
|
+
*/
|
|
193
|
+
highlightTrajectory(id: RealtimeTrainId): Promise<Feature[] | undefined>;
|
|
194
|
+
/**
|
|
195
|
+
* Create a copy of the RealtimeLayer.
|
|
196
|
+
* @param {Object} newOptions Options to override
|
|
197
|
+
* @return {RealtimeLayer} A RealtimeLayer
|
|
198
|
+
*/
|
|
199
|
+
clone(newOptions: OlRealtimeLayerOptions): RealtimeLayer;
|
|
200
|
+
}
|
|
201
|
+
export default RealtimeLayer;
|
|
202
|
+
//# sourceMappingUR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