mobility-toolbox-js 3.0.0-beta.9 → 3.0.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/README.md +11 -3
- package/api/HttpAPI.d.ts +5 -16
- package/api/HttpAPI.js +1 -14
- package/api/RealtimeAPI.d.ts +188 -143
- package/api/RealtimeAPI.js +265 -206
- package/api/RoutingAPI.d.ts +21 -11
- package/api/RoutingAPI.js +17 -7
- package/api/StopsAPI.d.ts +20 -14
- package/api/StopsAPI.js +17 -11
- package/api/WebSocketAPI.d.ts +60 -66
- package/api/WebSocketAPI.js +164 -165
- package/api/index.js +1 -1
- package/api/typedefs.d.ts +0 -102
- package/api/typedefs.js +27 -42
- package/common/controls/StopFinderControlCommon.d.ts +13 -13
- package/common/controls/StopFinderControlCommon.js +32 -32
- package/common/index.d.ts +1 -1
- package/common/index.js +1 -1
- package/common/styles/realtimeDefaultStyle.js +6 -11
- package/common/styles/realtimeHeadingStyle.js +5 -10
- package/common/styles/realtimeSimpleStyle.d.ts +0 -1
- package/common/styles/realtimeSimpleStyle.js +0 -1
- package/common/typedefs.d.ts +11 -121
- package/common/typedefs.js +6 -31
- package/common/utils/RealtimeEngine.d.ts +214 -0
- package/common/utils/RealtimeEngine.js +554 -0
- package/common/utils/compareDepartures.d.ts +2 -2
- package/common/utils/compareDepartures.js +2 -2
- package/common/utils/debounceWebsocketMessages.d.ts +1 -1
- package/common/utils/getLayersAsFlatArray.d.ts +0 -1
- package/common/utils/getLayersAsFlatArray.js +0 -1
- package/common/utils/getMapGlCopyrights.d.ts +1 -1
- package/common/utils/getMapGlCopyrights.js +3 -3
- package/common/utils/getRealtimeModeSuffix.d.ts +1 -0
- package/common/utils/getRealtimeModeSuffix.js +1 -0
- package/common/utils/getVehiclePosition.d.ts +5 -4
- package/common/utils/getVehiclePosition.js +6 -3
- package/common/utils/realtimeConfig.d.ts +1 -1
- package/common/utils/realtimeConfig.js +0 -1
- package/common/utils/renderTrajectories.d.ts +2 -1
- package/common/utils/renderTrajectories.js +7 -6
- package/common/utils/sortAndFilterDepartures.d.ts +2 -1
- package/common/utils/sortAndFilterDepartures.js +2 -1
- package/common/utils/sortByDelay.d.ts +2 -2
- package/common/utils/sortByDelay.js +5 -1
- package/maplibre/controls/CopyrightControl.d.ts +9 -6
- package/maplibre/controls/CopyrightControl.js +11 -8
- package/maplibre/layers/Layer.d.ts +8 -7
- package/maplibre/layers/Layer.js +2 -3
- package/maplibre/layers/RealtimeLayer.d.ts +82 -118
- package/maplibre/layers/RealtimeLayer.js +154 -118
- package/maplibre/utils/getSourceCoordinates.d.ts +1 -0
- package/maplibre/utils/getSourceCoordinates.js +6 -5
- package/mbt.js +14611 -14591
- package/mbt.js.map +4 -4
- package/mbt.min.js +75 -75
- package/mbt.min.js.map +4 -4
- package/ol/controls/CopyrightControl.d.ts +13 -5
- package/ol/controls/CopyrightControl.js +13 -5
- package/ol/controls/RoutingControl.d.ts +105 -101
- package/ol/controls/RoutingControl.js +250 -264
- package/ol/controls/StopFinderControl.d.ts +24 -5
- package/ol/controls/StopFinderControl.js +24 -5
- package/ol/layers/Layer.d.ts +26 -0
- package/ol/layers/Layer.js +39 -0
- package/ol/layers/MaplibreLayer.d.ts +56 -28
- package/ol/layers/MaplibreLayer.js +154 -31
- package/ol/layers/MaplibreStyleLayer.d.ts +71 -149
- package/ol/layers/MaplibreStyleLayer.js +281 -210
- package/ol/layers/RealtimeLayer.d.ts +95 -230
- package/ol/layers/RealtimeLayer.js +209 -211
- package/ol/layers/VectorLayer.d.ts +17 -0
- package/ol/layers/VectorLayer.js +33 -0
- package/ol/layers/index.d.ts +2 -0
- package/ol/layers/index.js +3 -0
- package/ol/renderers/MaplibreLayerRenderer.d.ts +0 -20
- package/ol/renderers/MaplibreLayerRenderer.js +142 -114
- package/ol/renderers/MaplibreStyleLayerRenderer.d.ts +6 -6
- package/ol/renderers/MaplibreStyleLayerRenderer.js +20 -23
- package/ol/renderers/RealtimeLayerRenderer.d.ts +7 -7
- package/ol/renderers/RealtimeLayerRenderer.js +46 -66
- package/ol/styles/fullTrajectoryDelayStyle.js +5 -7
- package/ol/styles/fullTrajectoryStyle.d.ts +1 -2
- package/ol/styles/fullTrajectoryStyle.js +5 -7
- package/ol/styles/routingStyle.d.ts +0 -1
- package/ol/styles/routingStyle.js +13 -10
- package/ol/utils/defineDeprecatedProperties.d.ts +10 -0
- package/ol/utils/defineDeprecatedProperties.js +180 -0
- package/ol/utils/getFeatureInfoAtCoordinate.d.ts +1 -1
- package/ol/utils/getFeatureInfoAtCoordinate.js +11 -17
- package/package.json +44 -44
- package/setupTests.js +17 -4
- package/types/common.d.ts +53 -69
- package/types/index.d.ts +1 -1
- package/types/realtime.d.ts +98 -95
- package/types/routing.d.ts +60 -60
- package/types/stops.d.ts +62 -62
- package/common/mixins/RealtimeLayerMixin.d.ts +0 -273
- package/common/mixins/RealtimeLayerMixin.js +0 -743
- package/ol/layers/MapGlLayer.d.ts +0 -144
- package/ol/layers/MapGlLayer.js +0 -144
- package/ol/mixins/MobilityLayerMixin.d.ts +0 -98
- package/ol/mixins/MobilityLayerMixin.js +0 -6
- package/ol/mixins/PropertiesLayerMixin.d.ts +0 -127
- package/ol/mixins/PropertiesLayerMixin.js +0 -143
|
@@ -13,12 +13,12 @@ class StopFinderControlCommon {
|
|
|
13
13
|
* @param {Object} options Options
|
|
14
14
|
* @param {HTMLElement} options.element HTML element where to attach input and suggestions.
|
|
15
15
|
* @param {string} options.apiKey Access key for [geOps services](https://developer.geops.io/). See StopsAPI.
|
|
16
|
-
* @param {string} [options.url='https://api.geops.io/
|
|
16
|
+
* @param {string} [options.url='https://api.geops.io/stops/v1/'] Stops service url. See StopsAPI.
|
|
17
17
|
* @param {string} [options.placeholder='Search for a stop...'] Input field placeholder.
|
|
18
18
|
* @param {StopsSearchParams} [options.apiParams={ limit: 20 }] Request parameters. See [Stops service documentation](https://developer.geops.io/apis/5dcbd702a256d90001cf1361/).
|
|
19
19
|
*/
|
|
20
20
|
constructor(options) {
|
|
21
|
-
const { apiParams,
|
|
21
|
+
const { apiKey, apiParams, placeholder, url } = options || {};
|
|
22
22
|
this.apiParams = Object.assign({ limit: 20 }, (apiParams || {}));
|
|
23
23
|
this.placeholder = placeholder || 'Search for a stop...';
|
|
24
24
|
const apiOptions = { apiKey };
|
|
@@ -30,26 +30,16 @@ class StopFinderControlCommon {
|
|
|
30
30
|
this.createElement(options);
|
|
31
31
|
this.options = options;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Clear the search field and close the control.
|
|
35
|
+
*/
|
|
36
|
+
clear() {
|
|
37
|
+
if (!this.suggestionsElt || !this.inputElt || !this.clearElt) {
|
|
36
38
|
return;
|
|
37
39
|
}
|
|
38
|
-
this.
|
|
40
|
+
this.inputElt.value = '';
|
|
39
41
|
this.suggestionsElt.innerHTML = '';
|
|
40
|
-
|
|
41
|
-
var _a, _b;
|
|
42
|
-
const suggElt = document.createElement('div');
|
|
43
|
-
suggElt.innerHTML = (_a = suggestion === null || suggestion === void 0 ? void 0 : suggestion.properties) === null || _a === void 0 ? void 0 : _a.name;
|
|
44
|
-
suggElt.onclick = (evt) => {
|
|
45
|
-
var _a, _b;
|
|
46
|
-
(_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.onSuggestionClick) === null || _b === void 0 ? void 0 : _b.call(_a, suggestion, evt);
|
|
47
|
-
};
|
|
48
|
-
Object.assign(suggElt.style, {
|
|
49
|
-
padding: '5px 12px',
|
|
50
|
-
});
|
|
51
|
-
(_b = this.suggestionsElt) === null || _b === void 0 ? void 0 : _b.appendChild(suggElt);
|
|
52
|
-
});
|
|
42
|
+
this.clearElt.style.display = 'none';
|
|
53
43
|
}
|
|
54
44
|
createElement({ element }) {
|
|
55
45
|
// Create input element
|
|
@@ -61,7 +51,7 @@ class StopFinderControlCommon {
|
|
|
61
51
|
var _a;
|
|
62
52
|
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
63
53
|
this.abortController = new AbortController();
|
|
64
|
-
// @ts-
|
|
54
|
+
// @ts-expect-error - Improve ts
|
|
65
55
|
this.search(evt.target.value, this.abortController);
|
|
66
56
|
};
|
|
67
57
|
Object.assign(this.inputElt.style, {
|
|
@@ -72,38 +62,48 @@ class StopFinderControlCommon {
|
|
|
72
62
|
this.suggestionsElt = document.createElement('div');
|
|
73
63
|
Object.assign(this.suggestionsElt.style, {
|
|
74
64
|
backgroundColor: 'white',
|
|
75
|
-
overflowY: 'auto',
|
|
76
65
|
cursor: 'pointer',
|
|
66
|
+
overflowY: 'auto',
|
|
77
67
|
});
|
|
78
68
|
element.appendChild(this.suggestionsElt);
|
|
79
69
|
this.clearElt = document.createElement('div');
|
|
80
70
|
Object.assign(this.clearElt.style, {
|
|
71
|
+
cursor: 'pointer',
|
|
81
72
|
display: 'none',
|
|
73
|
+
fontSize: '200%',
|
|
74
|
+
padding: '0 10px',
|
|
82
75
|
position: 'absolute',
|
|
83
76
|
right: '0',
|
|
84
|
-
padding: '0 10px',
|
|
85
|
-
fontSize: '200%',
|
|
86
|
-
cursor: 'pointer',
|
|
87
77
|
});
|
|
88
78
|
this.clearElt.innerHTML = '×';
|
|
89
79
|
this.clearElt.onclick = () => this.clear();
|
|
90
80
|
element.appendChild(this.clearElt);
|
|
91
81
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
clear() {
|
|
96
|
-
if (!this.suggestionsElt || !this.inputElt || !this.clearElt) {
|
|
82
|
+
render(featureCollection) {
|
|
83
|
+
const suggestions = (featureCollection === null || featureCollection === void 0 ? void 0 : featureCollection.features) || [];
|
|
84
|
+
if (!this.suggestionsElt) {
|
|
97
85
|
return;
|
|
98
86
|
}
|
|
99
|
-
this.
|
|
87
|
+
this.suggestionsElt.style.display = suggestions.length ? 'block' : 'none';
|
|
100
88
|
this.suggestionsElt.innerHTML = '';
|
|
101
|
-
|
|
89
|
+
suggestions.forEach((suggestion) => {
|
|
90
|
+
var _a, _b;
|
|
91
|
+
const suggElt = document.createElement('div');
|
|
92
|
+
suggElt.innerHTML = (_a = suggestion === null || suggestion === void 0 ? void 0 : suggestion.properties) === null || _a === void 0 ? void 0 : _a.name;
|
|
93
|
+
suggElt.onclick = (evt) => {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
(_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.onSuggestionClick) === null || _b === void 0 ? void 0 : _b.call(_a, suggestion, evt);
|
|
96
|
+
};
|
|
97
|
+
Object.assign(suggElt.style, {
|
|
98
|
+
padding: '5px 12px',
|
|
99
|
+
});
|
|
100
|
+
(_b = this.suggestionsElt) === null || _b === void 0 ? void 0 : _b.appendChild(suggElt);
|
|
101
|
+
});
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* Launch a search.
|
|
105
105
|
*
|
|
106
|
-
* @param {String}
|
|
106
|
+
* @param {String} q The query to search for.
|
|
107
107
|
* @param {AbortController} abortController Abort controller used to cancel the request.
|
|
108
108
|
* @return {Promise<Array<GeoJSONFeature>>} An array of GeoJSON features with coordinates in [EPSG:4326](http://epsg.io/4326).
|
|
109
109
|
*/
|
package/common/index.d.ts
CHANGED
package/common/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import createCanvas from '../utils/createCanvas';
|
|
2
|
-
/** @private */
|
|
3
2
|
const cacheDelayBg = {};
|
|
4
3
|
/**
|
|
5
4
|
* Draw circle delay background
|
|
@@ -25,7 +24,6 @@ export const getDelayBgCanvas = (origin, radius, color) => {
|
|
|
25
24
|
}
|
|
26
25
|
return cacheDelayBg[key];
|
|
27
26
|
};
|
|
28
|
-
/** @private */
|
|
29
27
|
const cacheDelayText = {};
|
|
30
28
|
/**
|
|
31
29
|
* Draw delay text
|
|
@@ -55,7 +53,6 @@ export const getDelayTextCanvas = (text, fontSize, font, delayColor, delayOutlin
|
|
|
55
53
|
}
|
|
56
54
|
return cacheDelayText[key];
|
|
57
55
|
};
|
|
58
|
-
/** @private */
|
|
59
56
|
const cacheCircle = {};
|
|
60
57
|
/**
|
|
61
58
|
* Draw colored circle with black border
|
|
@@ -90,7 +87,6 @@ export const getCircleCanvas = (origin, radius, color, hasStroke, hasDash, pixel
|
|
|
90
87
|
}
|
|
91
88
|
return cacheCircle[key];
|
|
92
89
|
};
|
|
93
|
-
/** @private */
|
|
94
90
|
const cacheText = {};
|
|
95
91
|
/**
|
|
96
92
|
* Draw text in the circle
|
|
@@ -129,7 +125,6 @@ export const getTextCanvas = (text, origin, textSize, fillColor, strokeColor, ha
|
|
|
129
125
|
}
|
|
130
126
|
return cacheText[key];
|
|
131
127
|
};
|
|
132
|
-
/** @private */
|
|
133
128
|
const cache = {};
|
|
134
129
|
/**
|
|
135
130
|
* A tracker style that take in account the delay.
|
|
@@ -141,11 +136,11 @@ const cache = {};
|
|
|
141
136
|
* @private
|
|
142
137
|
*/
|
|
143
138
|
const realtimeDefaultStyle = (trajectory, viewState, options) => {
|
|
144
|
-
const {
|
|
145
|
-
const {
|
|
139
|
+
const { delayDisplay = 300000, delayOutlineColor = '#000', getBgColor = () => '#000', getDelayColor = () => '#000', getDelayFont = (fontSize) => `bold ${fontSize}px arial, sans-serif`, getDelayText = () => null, getMaxRadiusForStrokeAndDelay = () => 7, getMaxRadiusForText = () => 10, getRadius = () => 0, getText = (text) => text, getTextColor = () => '#000', getTextFont = (fontSize) => `bold ${fontSize}px arial, sans-serif`, getTextSize = () => 14, hoverVehicleId, selectedVehicleId, useDelayStyle, } = options;
|
|
140
|
+
const { pixelRatio = 1, zoom } = viewState;
|
|
146
141
|
let { type } = trajectory.properties;
|
|
147
|
-
const {
|
|
148
|
-
let { name, text_color: textColor
|
|
142
|
+
const { delay, line, operator_provides_realtime_journey: operatorProvidesRealtime, state, train_id: id, } = trajectory.properties;
|
|
143
|
+
let { color, name, text_color: textColor } = line || {};
|
|
149
144
|
name = getText(name);
|
|
150
145
|
const cancelled = state === 'JOURNEY_CANCELLED';
|
|
151
146
|
if (!type) {
|
|
@@ -157,10 +152,10 @@ const realtimeDefaultStyle = (trajectory, viewState, options) => {
|
|
|
157
152
|
if (!textColor) {
|
|
158
153
|
textColor = '#000000';
|
|
159
154
|
}
|
|
160
|
-
if (color && color
|
|
155
|
+
if (color && !color.startsWith('#')) {
|
|
161
156
|
color = `#${color}`;
|
|
162
157
|
}
|
|
163
|
-
if (textColor
|
|
158
|
+
if (!textColor.startsWith('#')) {
|
|
164
159
|
textColor = `#${textColor}`;
|
|
165
160
|
}
|
|
166
161
|
const z = Math.min(Math.floor(zoom || 1), 16);
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import createCanvas from '../utils/createCanvas';
|
|
2
2
|
import { getBgColor } from '../utils/realtimeConfig';
|
|
3
3
|
import realtimeDefaultStyle from './realtimeDefaultStyle';
|
|
4
|
-
/** @private */
|
|
5
4
|
const rotateCanvas = (canvas, rotation) => {
|
|
6
5
|
const ctx = canvas.getContext('2d');
|
|
7
6
|
ctx === null || ctx === void 0 ? void 0 : ctx.translate(canvas.width / 2, canvas.height / 2);
|
|
8
7
|
ctx === null || ctx === void 0 ? void 0 : ctx.rotate(rotation);
|
|
9
8
|
ctx === null || ctx === void 0 ? void 0 : ctx.translate(-canvas.width / 2, -canvas.height / 2);
|
|
10
9
|
};
|
|
11
|
-
/** @private */
|
|
12
10
|
const arrowCache = {};
|
|
13
|
-
/** @private */
|
|
14
11
|
const getArrowCanvas = (fillColor) => {
|
|
15
12
|
const key = `${fillColor}`;
|
|
16
13
|
if (!arrowCache[key]) {
|
|
@@ -35,9 +32,7 @@ const getArrowCanvas = (fillColor) => {
|
|
|
35
32
|
}
|
|
36
33
|
return arrowCache[key];
|
|
37
34
|
};
|
|
38
|
-
/** @private */
|
|
39
35
|
const bufferArrowCache = {};
|
|
40
|
-
/** @private */
|
|
41
36
|
const getBufferArrowCanvas = (canvas, fillColor, rotation) => {
|
|
42
37
|
const margin = 20;
|
|
43
38
|
const bufferKey = `${fillColor},${canvas.width},${canvas.height},${rotation}`;
|
|
@@ -67,9 +62,8 @@ const getBufferArrowCanvas = (canvas, fillColor, rotation) => {
|
|
|
67
62
|
* @private
|
|
68
63
|
*/
|
|
69
64
|
const realtimeHeadingStyle = (trajectory, viewState, options) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const { rotation, type, line } = trajectory.properties;
|
|
65
|
+
// @ts-expect-error improve types
|
|
66
|
+
const { line, rotation, type } = trajectory.properties;
|
|
73
67
|
const { color } = line || {};
|
|
74
68
|
const canvas = realtimeDefaultStyle(trajectory, viewState, options);
|
|
75
69
|
if (canvas && rotation !== null) {
|
|
@@ -78,8 +72,9 @@ const realtimeHeadingStyle = (trajectory, viewState, options) => {
|
|
|
78
72
|
if (bufferArrow) {
|
|
79
73
|
const bufferSize = (bufferArrow.width - canvas.width) / 2;
|
|
80
74
|
const vehicleWithArrow = createCanvas(bufferArrow.width, bufferArrow.height);
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
const context = vehicleWithArrow === null || vehicleWithArrow === void 0 ? void 0 : vehicleWithArrow.getContext('2d');
|
|
76
|
+
context === null || context === void 0 ? void 0 : context.drawImage(bufferArrow, 0, 0, bufferArrow.width, bufferArrow.height);
|
|
77
|
+
context === null || context === void 0 ? void 0 : context.drawImage(canvas, bufferSize, bufferSize, canvas.width, canvas.height);
|
|
83
78
|
return vehicleWithArrow;
|
|
84
79
|
}
|
|
85
80
|
}
|
package/common/typedefs.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export default dummy;
|
|
2
2
|
export type FilterFunction = Function;
|
|
3
3
|
export type SortFunction = Function;
|
|
4
|
+
export type getMotsByZoomFunction = Function;
|
|
4
5
|
export type ViewState = {
|
|
5
6
|
/**
|
|
6
7
|
* A time in ms.
|
|
@@ -13,11 +14,11 @@ export type ViewState = {
|
|
|
13
14
|
/**
|
|
14
15
|
* An Extent in mercator coordinates.
|
|
15
16
|
*/
|
|
16
|
-
extent:
|
|
17
|
+
extent: number[4];
|
|
17
18
|
/**
|
|
18
19
|
* A size ([width, height]).
|
|
19
20
|
*/
|
|
20
|
-
size:
|
|
21
|
+
size: number[2];
|
|
21
22
|
/**
|
|
22
23
|
* A rotation in radians.
|
|
23
24
|
*/
|
|
@@ -47,104 +48,18 @@ export type FeatureInfo = {
|
|
|
47
48
|
/**
|
|
48
49
|
* The coordinate where to find the featue.
|
|
49
50
|
*/
|
|
50
|
-
coordinate:
|
|
51
|
-
};
|
|
52
|
-
export type MaplibreLayerOptions = {
|
|
53
|
-
/**
|
|
54
|
-
* Access key for [geOps apis](https://developer.geops.io/).
|
|
55
|
-
*/
|
|
56
|
-
apiKey: string;
|
|
57
|
-
/**
|
|
58
|
-
* geOps Maps api key name.
|
|
59
|
-
*/
|
|
60
|
-
apiKeyName: string;
|
|
61
|
-
/**
|
|
62
|
-
* Maplibre map options.
|
|
63
|
-
*/
|
|
64
|
-
mapOptions: maplibregl.MapOptions;
|
|
65
|
-
/**
|
|
66
|
-
* geOps Maps api style.
|
|
67
|
-
*/
|
|
68
|
-
style: string;
|
|
69
|
-
/**
|
|
70
|
-
* geOps Maps api url.
|
|
71
|
-
*/
|
|
72
|
-
url: string;
|
|
73
|
-
};
|
|
74
|
-
export type ControlCommonOptions = {
|
|
75
|
-
/**
|
|
76
|
-
* Whether the control is active or not.
|
|
77
|
-
*/
|
|
78
|
-
active?: boolean | undefined;
|
|
79
|
-
/**
|
|
80
|
-
* The HTML element used to render the control.
|
|
81
|
-
*/
|
|
82
|
-
element: HTMLElement;
|
|
83
|
-
/**
|
|
84
|
-
* The HTML element where to render the element property. Default is the map's element.
|
|
85
|
-
*/
|
|
86
|
-
target: HTMLElement;
|
|
87
|
-
/**
|
|
88
|
-
* Render function called whenever the control needs to be rerendered.
|
|
89
|
-
*/
|
|
90
|
-
render: Function;
|
|
91
|
-
};
|
|
92
|
-
export type LayerCommonOptions = {
|
|
93
|
-
/**
|
|
94
|
-
* Identifier of the layer. Must be unique.
|
|
95
|
-
*/
|
|
96
|
-
key: string;
|
|
97
|
-
/**
|
|
98
|
-
* Name of the layer.
|
|
99
|
-
*/
|
|
100
|
-
name: string;
|
|
101
|
-
/**
|
|
102
|
-
* Group of the layer.
|
|
103
|
-
*/
|
|
104
|
-
group: string;
|
|
105
|
-
/**
|
|
106
|
-
* List of copyrights.
|
|
107
|
-
*/
|
|
108
|
-
copyrights: string[];
|
|
109
|
-
/**
|
|
110
|
-
* List of children layers.
|
|
111
|
-
*/
|
|
112
|
-
children: Layer[];
|
|
113
|
-
/**
|
|
114
|
-
* Define if the layer is currently display on the map.
|
|
115
|
-
*/
|
|
116
|
-
visible: boolean;
|
|
117
|
-
/**
|
|
118
|
-
* Define if the layer is currently display on the map but can't be seen (extent, zoom ,data restrictions).
|
|
119
|
-
*/
|
|
120
|
-
disabled: boolean;
|
|
121
|
-
/**
|
|
122
|
-
* Hit-detection tolerance in css pixels. Pixels inside the radius around the given position will be checked for features.
|
|
123
|
-
*/
|
|
124
|
-
hittolerance: number;
|
|
125
|
-
/**
|
|
126
|
-
* - Custom properties.
|
|
127
|
-
*/
|
|
128
|
-
properties: Object;
|
|
129
|
-
/**
|
|
130
|
-
* - The map used to display the layer.
|
|
131
|
-
*/
|
|
132
|
-
map: AnyMap;
|
|
51
|
+
coordinate: number[2];
|
|
133
52
|
};
|
|
134
53
|
export type VehiclePosition = {
|
|
135
54
|
/**
|
|
136
55
|
* Coordinate of the vehicle position in Mercator .
|
|
137
56
|
*/
|
|
138
|
-
coord:
|
|
57
|
+
coord: number[2];
|
|
139
58
|
/**
|
|
140
59
|
* An angle in radians representing the direction (from the true north) towards which the vehicle is facing.
|
|
141
60
|
*/
|
|
142
61
|
rotation: number;
|
|
143
62
|
};
|
|
144
|
-
/**
|
|
145
|
-
* /Map~Map|maplibregl.Map} AnyMap
|
|
146
|
-
*/
|
|
147
|
-
type dummy = ol;
|
|
148
63
|
/**
|
|
149
64
|
* @typedef {function} FilterFunction
|
|
150
65
|
* @param {Vehicle} vehicle Vehicle to filter.
|
|
@@ -156,6 +71,12 @@ type dummy = ol;
|
|
|
156
71
|
* @param {any} b Object b to compare.
|
|
157
72
|
* @returns number
|
|
158
73
|
*/
|
|
74
|
+
/**
|
|
75
|
+
* @typedef {function} getMotsByZoomFunction
|
|
76
|
+
* @param {number} zoom Curent zoom level.
|
|
77
|
+
* @param {RealtimeMot[][]} motsByZoom Default array of mots by zoom.
|
|
78
|
+
* @returns number
|
|
79
|
+
*/
|
|
159
80
|
/**
|
|
160
81
|
* @typedef {Object} ViewState
|
|
161
82
|
* @property {number|undefined} time A time in ms.
|
|
@@ -173,37 +94,6 @@ type dummy = ol;
|
|
|
173
94
|
* @property {Feature[]} features An array of features.
|
|
174
95
|
* @property {number[2]} coordinate The coordinate where to find the featue.
|
|
175
96
|
*/
|
|
176
|
-
/**
|
|
177
|
-
* @typedef {ol/Map~Map|maplibregl.Map} AnyMap
|
|
178
|
-
*/
|
|
179
|
-
/**
|
|
180
|
-
* @typedef {Object} MaplibreLayerOptions
|
|
181
|
-
* @property {string} apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
182
|
-
* @property {string} apiKeyName geOps Maps api key name.
|
|
183
|
-
* @property {maplibregl.MapOptions} options.mapOptions Maplibre map options.
|
|
184
|
-
* @property {string} style geOps Maps api style.
|
|
185
|
-
* @property {string} url geOps Maps api url.
|
|
186
|
-
*/
|
|
187
|
-
/**
|
|
188
|
-
* @typedef {Object} ControlCommonOptions
|
|
189
|
-
* @property {boolean} [active = true] Whether the control is active or not.
|
|
190
|
-
* @property {HTMLElement} element The HTML element used to render the control.
|
|
191
|
-
* @property {HTMLElement} target The HTML element where to render the element property. Default is the map's element.
|
|
192
|
-
* @property {function} render Render function called whenever the control needs to be rerendered.
|
|
193
|
-
*/
|
|
194
|
-
/**
|
|
195
|
-
* @typedef {Object} LayerCommonOptions
|
|
196
|
-
* @property {string!} key Identifier of the layer. Must be unique.
|
|
197
|
-
* @property {string!} name Name of the layer.
|
|
198
|
-
* @property {string!} group Group of the layer.
|
|
199
|
-
* @property {string[]!} copyrights List of copyrights.
|
|
200
|
-
* @property {Layer[]!} children List of children layers.
|
|
201
|
-
* @property {boolean!} visible Define if the layer is currently display on the map.
|
|
202
|
-
* @property {boolean!} disabled Define if the layer is currently display on the map but can't be seen (extent, zoom ,data restrictions).
|
|
203
|
-
* @property {number!} hittolerance Hit-detection tolerance in css pixels. Pixels inside the radius around the given position will be checked for features.
|
|
204
|
-
* @property {Object!} properties - Custom properties.
|
|
205
|
-
* @property {AnyMap!} map - The map used to display the layer.
|
|
206
|
-
*/
|
|
207
97
|
/**
|
|
208
98
|
* @typedef {Object} VehiclePosition
|
|
209
99
|
* @property {number[2]} coord Coordinate of the vehicle position in Mercator .
|
package/common/typedefs.js
CHANGED
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
* @param {any} b Object b to compare.
|
|
10
10
|
* @returns number
|
|
11
11
|
*/
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {function} getMotsByZoomFunction
|
|
14
|
+
* @param {number} zoom Curent zoom level.
|
|
15
|
+
* @param {RealtimeMot[][]} motsByZoom Default array of mots by zoom.
|
|
16
|
+
* @returns number
|
|
17
|
+
*/
|
|
12
18
|
/**
|
|
13
19
|
* @typedef {Object} ViewState
|
|
14
20
|
* @property {number|undefined} time A time in ms.
|
|
@@ -26,37 +32,6 @@
|
|
|
26
32
|
* @property {Feature[]} features An array of features.
|
|
27
33
|
* @property {number[2]} coordinate The coordinate where to find the featue.
|
|
28
34
|
*/
|
|
29
|
-
/**
|
|
30
|
-
* @typedef {ol/Map~Map|maplibregl.Map} AnyMap
|
|
31
|
-
*/
|
|
32
|
-
/**
|
|
33
|
-
* @typedef {Object} MaplibreLayerOptions
|
|
34
|
-
* @property {string} apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
35
|
-
* @property {string} apiKeyName geOps Maps api key name.
|
|
36
|
-
* @property {maplibregl.MapOptions} options.mapOptions Maplibre map options.
|
|
37
|
-
* @property {string} style geOps Maps api style.
|
|
38
|
-
* @property {string} url geOps Maps api url.
|
|
39
|
-
*/
|
|
40
|
-
/**
|
|
41
|
-
* @typedef {Object} ControlCommonOptions
|
|
42
|
-
* @property {boolean} [active = true] Whether the control is active or not.
|
|
43
|
-
* @property {HTMLElement} element The HTML element used to render the control.
|
|
44
|
-
* @property {HTMLElement} target The HTML element where to render the element property. Default is the map's element.
|
|
45
|
-
* @property {function} render Render function called whenever the control needs to be rerendered.
|
|
46
|
-
*/
|
|
47
|
-
/**
|
|
48
|
-
* @typedef {Object} LayerCommonOptions
|
|
49
|
-
* @property {string!} key Identifier of the layer. Must be unique.
|
|
50
|
-
* @property {string!} name Name of the layer.
|
|
51
|
-
* @property {string!} group Group of the layer.
|
|
52
|
-
* @property {string[]!} copyrights List of copyrights.
|
|
53
|
-
* @property {Layer[]!} children List of children layers.
|
|
54
|
-
* @property {boolean!} visible Define if the layer is currently display on the map.
|
|
55
|
-
* @property {boolean!} disabled Define if the layer is currently display on the map but can't be seen (extent, zoom ,data restrictions).
|
|
56
|
-
* @property {number!} hittolerance Hit-detection tolerance in css pixels. Pixels inside the radius around the given position will be checked for features.
|
|
57
|
-
* @property {Object!} properties - Custom properties.
|
|
58
|
-
* @property {AnyMap!} map - The map used to display the layer.
|
|
59
|
-
*/
|
|
60
35
|
/**
|
|
61
36
|
* @typedef {Object} VehiclePosition
|
|
62
37
|
* @property {number[2]} coord Coordinate of the vehicle position in Mercator .
|