mobility-toolbox-js 3.0.1-beta.8 → 3.0.1-beta.9
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/mbt.js +13 -4
- package/mbt.js.map +2 -2
- package/mbt.min.js +1 -1
- package/mbt.min.js.map +2 -2
- package/ol/layers/RealtimeLayer.d.ts +1 -0
- package/ol/layers/RealtimeLayer.js +19 -8
- package/package.json +1 -1
|
@@ -157,6 +157,11 @@ class RealtimeLayer extends Layer {
|
|
|
157
157
|
}));
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
+
cleanVectorLayer() {
|
|
161
|
+
var _a, _b, _c;
|
|
162
|
+
(_b = (_a = this.vectorLayer) === null || _a === void 0 ? void 0 : _a.getSource()) === null || _b === void 0 ? void 0 : _b.clear(true);
|
|
163
|
+
(_c = this.vectorLayer.getMapInternal()) === null || _c === void 0 ? void 0 : _c.removeLayer(this.vectorLayer);
|
|
164
|
+
}
|
|
160
165
|
/**
|
|
161
166
|
* Create a copy of the RealtimeLayer.
|
|
162
167
|
*
|
|
@@ -259,29 +264,35 @@ class RealtimeLayer extends Layer {
|
|
|
259
264
|
*/
|
|
260
265
|
highlightTrajectory(id) {
|
|
261
266
|
return __awaiter(this, void 0, void 0, function* () {
|
|
262
|
-
var _a, _b, _c, _d, _e, _f
|
|
263
|
-
(_b = (_a = this.vectorLayer) === null || _a === void 0 ? void 0 : _a.getSource()) === null || _b === void 0 ? void 0 : _b.clear(true);
|
|
264
|
-
(_c = this.vectorLayer.getMapInternal()) === null || _c === void 0 ? void 0 : _c.removeLayer(this.vectorLayer);
|
|
267
|
+
var _a, _b, _c, _d, _e, _f;
|
|
265
268
|
if (!id) {
|
|
269
|
+
this.cleanVectorLayer();
|
|
266
270
|
return;
|
|
267
271
|
}
|
|
268
272
|
const features = yield this.getFullTrajectory(id);
|
|
269
273
|
if (!(features === null || features === void 0 ? void 0 : features.length)) {
|
|
274
|
+
this.cleanVectorLayer();
|
|
270
275
|
return;
|
|
271
276
|
}
|
|
272
277
|
if (features.length) {
|
|
273
|
-
(
|
|
278
|
+
(_b = (_a = this.vectorLayer) === null || _a === void 0 ? void 0 : _a.getSource()) === null || _b === void 0 ? void 0 : _b.addFeatures(features);
|
|
279
|
+
}
|
|
280
|
+
if (this.vectorLayer.getMapInternal() &&
|
|
281
|
+
this.vectorLayer.getMapInternal() !== this.getMapInternal()) {
|
|
282
|
+
(_c = this.vectorLayer.getMapInternal()) === null || _c === void 0 ? void 0 : _c.removeLayer(this.vectorLayer);
|
|
274
283
|
}
|
|
275
284
|
// Add the vector layer to the map
|
|
276
285
|
const zIndex = this.getZIndex();
|
|
277
286
|
if (zIndex !== undefined) {
|
|
278
287
|
this.vectorLayer.setZIndex(zIndex - 1);
|
|
279
|
-
(
|
|
288
|
+
if (!this.vectorLayer.getMapInternal()) {
|
|
289
|
+
(_d = this.getMapInternal()) === null || _d === void 0 ? void 0 : _d.addLayer(this.vectorLayer);
|
|
290
|
+
}
|
|
280
291
|
}
|
|
281
|
-
else {
|
|
282
|
-
const index = ((
|
|
292
|
+
else if (!this.vectorLayer.getMapInternal()) {
|
|
293
|
+
const index = ((_e = this.getMapInternal()) === null || _e === void 0 ? void 0 : _e.getLayers().getArray().indexOf(this)) || 0;
|
|
283
294
|
if (index) {
|
|
284
|
-
(
|
|
295
|
+
(_f = this.getMapInternal()) === null || _f === void 0 ? void 0 : _f.getLayers().insertAt(index, this.vectorLayer);
|
|
285
296
|
}
|
|
286
297
|
}
|
|
287
298
|
return features;
|
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": "3.0.1-beta.
|
|
5
|
+
"version": "3.0.1-beta.9",
|
|
6
6
|
"homepage": "https://mobility-toolbox-js.geops.io/",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./index.js",
|