mobility-toolbox-js 2.0.0-beta.70 → 2.0.0-beta.72
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 +1 -1
- package/api/RealtimeAPI.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.d.ts +8 -4
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.js +9 -1
- package/common/utils/getVehiclePosition.d.ts.map +1 -1
- package/common/utils/getVehiclePosition.js +5 -1
- package/mapbox/layers/RealtimeLayer.d.ts +2 -0
- package/mapbox/layers/RealtimeLayer.d.ts.map +1 -1
- package/mbt.js +24 -4
- package/mbt.js.map +2 -2
- package/mbt.min.js +2 -2
- package/mbt.min.js.map +3 -3
- package/ol/layers/RealtimeLayer.d.ts +3 -1
- package/ol/layers/RealtimeLayer.d.ts.map +1 -1
- package/ol/layers/RealtimeLayer.js +15 -3
- package/package.json +1 -1
|
@@ -55,6 +55,8 @@ declare const RealtimeLayer_base: {
|
|
|
55
55
|
getRenderTimeIntervalByZoom: (zoom: number) => number;
|
|
56
56
|
throttleRenderTrajectories: (viewState: import("../../types").ViewState, noInterpolate?: boolean | undefined) => void;
|
|
57
57
|
debounceRenderTrajectories: (viewState: import("../../types").ViewState, noInterpolate?: boolean | undefined) => void;
|
|
58
|
+
onStart?: ((realtimeLayer: any) => void) | undefined;
|
|
59
|
+
onStop?: ((realtimeLayer: any) => void) | undefined;
|
|
58
60
|
defineProperties(options: RealtimeLayerMixinOptions): void;
|
|
59
61
|
attachToMap(map: any): void;
|
|
60
62
|
detachFromMap(): void;
|
|
@@ -188,7 +190,7 @@ declare class RealtimeLayer extends RealtimeLayer_base {
|
|
|
188
190
|
* Highlight the trajectory of journey.
|
|
189
191
|
* @private
|
|
190
192
|
*/
|
|
191
|
-
highlightTrajectory(id: RealtimeTrainId):
|
|
193
|
+
highlightTrajectory(id: RealtimeTrainId): Promise<Feature[] | undefined>;
|
|
192
194
|
/**
|
|
193
195
|
* Create a copy of the RealtimeLayer.
|
|
194
196
|
* @param {Object} newOptions Options to override
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealtimeLayer.d.ts","sourceRoot":"","sources":["../../../src/ol/layers/RealtimeLayer.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAKxC,OAAO,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAc,EACZ,yBAAyB,EAC1B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,2BAA2B,EAC3B,sBAAsB,EACtB,eAAe,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAK7E,oBAAY,sBAAsB,GAAG,yBAAyB,GAAG;IAC/D,mBAAmB,EAAE,CACnB,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,GAAG,KACT,IAAI,CAAC;IACV,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC,CAAC
|
|
1
|
+
{"version":3,"file":"RealtimeLayer.d.ts","sourceRoot":"","sources":["../../../src/ol/layers/RealtimeLayer.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAKxC,OAAO,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,UAAU,EA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AAG,WAAW;IAerC;;;;;;OAMG;IAEH,SAAS;IAiBT;;;;;OAKG;IACH,cAAc,CACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,UAAU;IAQxB;;;;;OAKG;IACH,cAAc,CACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,UAAU;IAWxB;;;;OAIG;IACH,eAAe,CACb,UAAU,EAAE,kBAAkB,EAC9B,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EACxC,IAAI,EAAE,MAAM;IAed;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM;IAUhE;;;OAGG;IACH,mBAAmB,CAAC,EAAE,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC;IAoBxE;;;;OAIG;IACH,KAAK,CAAC,UAAU,EAAE,sBAAsB;CAGzC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -156,9 +156,14 @@ class RealtimeLayer extends mixin(Layer) {
|
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
158
|
const view = this.map.getView();
|
|
159
|
+
// it could happen that the view is set but without center yet,
|
|
160
|
+
// so the calcualteExtent will trigger an error.
|
|
161
|
+
if (!view.getCenter()) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
159
164
|
super.renderTrajectories({
|
|
160
165
|
size: this.map.getSize(),
|
|
161
|
-
center:
|
|
166
|
+
center: view.getCenter(),
|
|
162
167
|
extent: view.calculateExtent(),
|
|
163
168
|
resolution: view.getResolution(),
|
|
164
169
|
rotation: view.getRotation(),
|
|
@@ -281,6 +286,12 @@ class RealtimeLayer extends mixin(Layer) {
|
|
|
281
286
|
* @private
|
|
282
287
|
*/
|
|
283
288
|
purgeTrajectory(trajectory, extent, zoom) {
|
|
289
|
+
const center = this.map.getView().getCenter();
|
|
290
|
+
if (!extent && !center) {
|
|
291
|
+
// In that case the view is not zoomed yet so we can't calculate the extent of the map,
|
|
292
|
+
// it will trigger a js error on calculateExtent function.
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
284
295
|
return super.purgeTrajectory(trajectory, extent || this.map.getView().calculateExtent(), zoom || this.map.getView().getZoom());
|
|
285
296
|
}
|
|
286
297
|
/**
|
|
@@ -302,7 +313,7 @@ class RealtimeLayer extends mixin(Layer) {
|
|
|
302
313
|
* @private
|
|
303
314
|
*/
|
|
304
315
|
highlightTrajectory(id) {
|
|
305
|
-
this.api
|
|
316
|
+
return this.api
|
|
306
317
|
.getFullTrajectory(id, this.mode, this.generalizationLevel)
|
|
307
318
|
.then((data) => {
|
|
308
319
|
const fullTrajectory = data.content;
|
|
@@ -310,10 +321,11 @@ class RealtimeLayer extends mixin(Layer) {
|
|
|
310
321
|
if (!fullTrajectory ||
|
|
311
322
|
!fullTrajectory.features ||
|
|
312
323
|
!fullTrajectory.features.length) {
|
|
313
|
-
return;
|
|
324
|
+
return undefined;
|
|
314
325
|
}
|
|
315
326
|
const features = format.readFeatures(fullTrajectory);
|
|
316
327
|
this.vectorLayer.getSource().addFeatures(features);
|
|
328
|
+
return features;
|
|
317
329
|
});
|
|
318
330
|
}
|
|
319
331
|
/**
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "mobility-toolbox-js",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"description": "Toolbox for JavaScript applications in the domains of mobility and logistics.",
|
|
5
|
-
"version": "2.0.0-beta.
|
|
5
|
+
"version": "2.0.0-beta.72",
|
|
6
6
|
"homepage": "https://mobility-toolbox-js.geops.io/",
|
|
7
7
|
"module": "index.js",
|
|
8
8
|
"exports": {
|