mobility-toolbox-js 3.0.0-beta.20 → 3.0.0-beta.21
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.js +1 -3
- package/mbt.js +242 -217
- package/mbt.js.map +4 -4
- package/mbt.min.js +15 -15
- package/mbt.min.js.map +4 -4
- package/ol/layers/Layer.d.ts +1 -1
- package/ol/layers/Layer.js +11 -3
- package/ol/layers/MaplibreLayer.d.ts +14 -14
- package/ol/layers/MaplibreLayer.js +44 -38
- package/ol/layers/MaplibreStyleLayer.d.ts +1 -6
- package/ol/layers/MaplibreStyleLayer.js +20 -22
- package/ol/layers/VectorLayer.d.ts +3 -3
- package/ol/layers/VectorLayer.js +8 -8
- package/ol/mixins/MobilityLayerMixin.d.ts +2 -4
- package/ol/mixins/PropertiesLayerMixin.js +10 -6
- package/package.json +1 -1
package/ol/layers/Layer.d.ts
CHANGED
|
@@ -92,7 +92,7 @@ declare const Layer_base: {
|
|
|
92
92
|
} & typeof OLLayer;
|
|
93
93
|
/**
|
|
94
94
|
* An OpenLayers layer here only for backward compatibility v2.
|
|
95
|
-
* @deprecated
|
|
95
|
+
* @deprecated Use an OpenLayers Layer instead.
|
|
96
96
|
*/
|
|
97
97
|
declare class Layer extends Layer_base {
|
|
98
98
|
constructor(options: MobilityLayerOptions);
|
package/ol/layers/Layer.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
+
import debounce from 'lodash.debounce';
|
|
1
2
|
import OLLayer from 'ol/layer/Layer';
|
|
2
3
|
import MobilityLayerMixin from '../mixins/MobilityLayerMixin';
|
|
4
|
+
let deprecated = () => { };
|
|
5
|
+
if (typeof window !== 'undefined' &&
|
|
6
|
+
new URLSearchParams(window.location.search).get('deprecated')) {
|
|
7
|
+
deprecated = debounce((message) => {
|
|
8
|
+
// eslint-disable-next-line no-console
|
|
9
|
+
console.warn(message);
|
|
10
|
+
}, 1000);
|
|
11
|
+
}
|
|
3
12
|
/**
|
|
4
13
|
* An OpenLayers layer here only for backward compatibility v2.
|
|
5
|
-
* @deprecated
|
|
14
|
+
* @deprecated Use an OpenLayers Layer instead.
|
|
6
15
|
*/
|
|
7
16
|
class Layer extends MobilityLayerMixin(OLLayer) {
|
|
8
17
|
constructor(options) {
|
|
9
18
|
super(options);
|
|
10
|
-
|
|
11
|
-
console.warn('Layer is deprecated. Use an OpenLayers Layer instead.');
|
|
19
|
+
deprecated('Layer is deprecated. Use an OpenLayers Layer instead.');
|
|
12
20
|
}
|
|
13
21
|
clone(newOptions) {
|
|
14
22
|
return new Layer(Object.assign(Object.assign({}, (this.options || {})), (newOptions || {})));
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import OlMap from 'ol/Map';
|
|
2
1
|
import { MapLibreLayer } from '@geoblocks/ol-maplibre-layer';
|
|
3
|
-
import
|
|
2
|
+
import OlMap from 'ol/Map';
|
|
4
3
|
import { MobilityLayerOptions } from '../mixins/MobilityLayerMixin';
|
|
5
|
-
|
|
4
|
+
import type { MapLibreLayerOptions, MapLibreOptions } from '@geoblocks/ol-maplibre-layer/lib/types/MapLibreLayer';
|
|
5
|
+
export type MaplibreLayerOptions = {
|
|
6
6
|
apiKey?: string;
|
|
7
7
|
apiKeyName?: string;
|
|
8
|
-
style?: null | string | maplibregl.StyleSpecification;
|
|
9
|
-
url?: string;
|
|
10
8
|
mapLibreOptions?: MapLibreOptions;
|
|
11
|
-
|
|
9
|
+
style?: maplibregl.StyleSpecification | null | string;
|
|
10
|
+
url?: string;
|
|
11
|
+
} & MapLibreLayerOptions & MobilityLayerOptions;
|
|
12
12
|
declare const MaplibreLayer_base: {
|
|
13
13
|
new (...args: any[]): {
|
|
14
14
|
olEventsKeys: import("ol/events").EventsKey[];
|
|
@@ -126,12 +126,6 @@ declare const MaplibreLayer_base: {
|
|
|
126
126
|
* @public
|
|
127
127
|
*/
|
|
128
128
|
declare class MaplibreLayer extends MaplibreLayer_base {
|
|
129
|
-
get mbMap(): maplibregl.Map | undefined;
|
|
130
|
-
get maplibreMap(): maplibregl.Map | undefined;
|
|
131
|
-
get style(): string;
|
|
132
|
-
set style(newValue: string);
|
|
133
|
-
get url(): string;
|
|
134
|
-
set url(newValue: string);
|
|
135
129
|
/**
|
|
136
130
|
* Constructor.
|
|
137
131
|
*
|
|
@@ -148,13 +142,19 @@ declare class MaplibreLayer extends MaplibreLayer_base {
|
|
|
148
142
|
* @param {ol/Map~Map} map
|
|
149
143
|
*/
|
|
150
144
|
attachToMap(map: OlMap): void;
|
|
151
|
-
getStyle(): string;
|
|
152
|
-
updateMaplibreMap(): void;
|
|
153
145
|
/**
|
|
154
146
|
* Create a copy of the MaplibreLayer.
|
|
155
147
|
* @param {MaplibreLayerOptions} newOptions Options to override
|
|
156
148
|
* @return {MaplibreLayer} A MaplibreLayer layer
|
|
157
149
|
*/
|
|
158
150
|
clone(newOptions: MaplibreLayerOptions): MaplibreLayer;
|
|
151
|
+
getStyle(): string;
|
|
152
|
+
updateMaplibreMap(): void;
|
|
153
|
+
get maplibreMap(): maplibregl.Map | undefined;
|
|
154
|
+
get mbMap(): maplibregl.Map | undefined;
|
|
155
|
+
get style(): string;
|
|
156
|
+
set style(newValue: string);
|
|
157
|
+
get url(): string;
|
|
158
|
+
set url(newValue: string);
|
|
159
159
|
}
|
|
160
160
|
export default MaplibreLayer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import debounce from 'lodash.debounce';
|
|
2
1
|
import { MapLibreLayer } from '@geoblocks/ol-maplibre-layer';
|
|
2
|
+
import debounce from 'lodash.debounce';
|
|
3
3
|
import { getUrlWithParams } from '../../common/utils';
|
|
4
4
|
import MobilityLayerMixin from '../mixins/MobilityLayerMixin';
|
|
5
5
|
const buildStyleUrl = (url, style, apiKey, apiKeyName) => {
|
|
@@ -7,6 +7,14 @@ const buildStyleUrl = (url, style, apiKey, apiKeyName) => {
|
|
|
7
7
|
[apiKeyName]: apiKey,
|
|
8
8
|
}).toString();
|
|
9
9
|
};
|
|
10
|
+
let deprecated = () => { };
|
|
11
|
+
if (typeof window !== 'undefined' &&
|
|
12
|
+
new URLSearchParams(window.location.search).get('deprecated')) {
|
|
13
|
+
deprecated = debounce((message) => {
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
15
|
+
console.warn(message);
|
|
16
|
+
}, 1000);
|
|
17
|
+
}
|
|
10
18
|
/**
|
|
11
19
|
* An OpenLayers layer able to display data from the [geOps Maps API](https://developer.geops.io/apis/maps).
|
|
12
20
|
*
|
|
@@ -34,36 +42,6 @@ const buildStyleUrl = (url, style, apiKey, apiKeyName) => {
|
|
|
34
42
|
* @public
|
|
35
43
|
*/
|
|
36
44
|
class MaplibreLayer extends MobilityLayerMixin(MapLibreLayer) {
|
|
37
|
-
get mbMap() {
|
|
38
|
-
// eslint-disable-next-line no-console
|
|
39
|
-
console.warn('MaplibreLayer.mbMap is deprecated. Use layer.maplibreMap.');
|
|
40
|
-
return this.maplibreMap;
|
|
41
|
-
}
|
|
42
|
-
get maplibreMap() {
|
|
43
|
-
// eslint-disable-next-line no-console
|
|
44
|
-
console.warn('MaplibreLayer.maplibreMap is deprecated. Use layer.mapLibreMap.');
|
|
45
|
-
return this.mapLibreMap;
|
|
46
|
-
}
|
|
47
|
-
// get queryRenderedFeaturesOptions(): maplibregl.QueryRenderedFeaturesOptions {
|
|
48
|
-
// return this.get('queryRenderedFeaturesOptions');
|
|
49
|
-
// }
|
|
50
|
-
// set queryRenderedFeaturesOptions(
|
|
51
|
-
// newValue: maplibregl.QueryRenderedFeaturesOptions,
|
|
52
|
-
// ) {
|
|
53
|
-
// this.set('queryRenderedFeaturesOptions', newValue);
|
|
54
|
-
// }
|
|
55
|
-
get style() {
|
|
56
|
-
return this.get('style');
|
|
57
|
-
}
|
|
58
|
-
set style(newValue) {
|
|
59
|
-
this.set('style', newValue);
|
|
60
|
-
}
|
|
61
|
-
get url() {
|
|
62
|
-
return this.get('url');
|
|
63
|
-
}
|
|
64
|
-
set url(newValue) {
|
|
65
|
-
this.set('url', newValue);
|
|
66
|
-
}
|
|
67
45
|
/**
|
|
68
46
|
* Constructor.
|
|
69
47
|
*
|
|
@@ -97,6 +75,22 @@ class MaplibreLayer extends MobilityLayerMixin(MapLibreLayer) {
|
|
|
97
75
|
}
|
|
98
76
|
}));
|
|
99
77
|
}
|
|
78
|
+
// get queryRenderedFeaturesOptions(): maplibregl.QueryRenderedFeaturesOptions {
|
|
79
|
+
// return this.get('queryRenderedFeaturesOptions');
|
|
80
|
+
// }
|
|
81
|
+
// set queryRenderedFeaturesOptions(
|
|
82
|
+
// newValue: maplibregl.QueryRenderedFeaturesOptions,
|
|
83
|
+
// ) {
|
|
84
|
+
// this.set('queryRenderedFeaturesOptions', newValue);
|
|
85
|
+
// }
|
|
86
|
+
/**
|
|
87
|
+
* Create a copy of the MaplibreLayer.
|
|
88
|
+
* @param {MaplibreLayerOptions} newOptions Options to override
|
|
89
|
+
* @return {MaplibreLayer} A MaplibreLayer layer
|
|
90
|
+
*/
|
|
91
|
+
clone(newOptions) {
|
|
92
|
+
return new MaplibreLayer(Object.assign(Object.assign({}, (this.options || {})), (newOptions || {})));
|
|
93
|
+
}
|
|
100
94
|
getStyle() {
|
|
101
95
|
// If the style is a complete style object, use it directly.
|
|
102
96
|
if (this.style &&
|
|
@@ -122,13 +116,25 @@ class MaplibreLayer extends MobilityLayerMixin(MapLibreLayer) {
|
|
|
122
116
|
console.error('Error while updating MaplibreMap', e);
|
|
123
117
|
}
|
|
124
118
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
return
|
|
119
|
+
get maplibreMap() {
|
|
120
|
+
deprecated('MaplibreLayer.maplibreMap is deprecated. Use layer.mapLibreMap.');
|
|
121
|
+
return this.mapLibreMap;
|
|
122
|
+
}
|
|
123
|
+
get mbMap() {
|
|
124
|
+
deprecated('MaplibreLayer.mbMap is deprecated. Use layer.maplibreMap.');
|
|
125
|
+
return this.maplibreMap;
|
|
126
|
+
}
|
|
127
|
+
get style() {
|
|
128
|
+
return this.get('style');
|
|
129
|
+
}
|
|
130
|
+
set style(newValue) {
|
|
131
|
+
this.set('style', newValue);
|
|
132
|
+
}
|
|
133
|
+
get url() {
|
|
134
|
+
return this.get('url');
|
|
135
|
+
}
|
|
136
|
+
set url(newValue) {
|
|
137
|
+
this.set('url', newValue);
|
|
132
138
|
}
|
|
133
139
|
}
|
|
134
140
|
export default MaplibreLayer;
|
|
@@ -23,12 +23,7 @@ declare const MaplibreStyleLayer_base: {
|
|
|
23
23
|
detachFromMap(): void;
|
|
24
24
|
flat(): any[];
|
|
25
25
|
onChildrenChange(oldValue: Layer[]): void;
|
|
26
|
-
setMapInternal: ((map: Map) => void) & ((map: import("ol/Map"
|
|
27
|
-
* Set if features are hovered or not.
|
|
28
|
-
* @param {Array<ol/Feature~Feature>} features
|
|
29
|
-
* @param {boolean} state Is the feature hovered
|
|
30
|
-
* @private
|
|
31
|
-
*/).default | null) => void);
|
|
26
|
+
setMapInternal: ((map: Map) => void) & ((map: import("ol/Map").default | null) => void);
|
|
32
27
|
children: Layer<Source, import("ol/renderer/Layer").default<any>>[];
|
|
33
28
|
get copyrights(): string;
|
|
34
29
|
set copyrights(newCopyrights: string | string[]);
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import debounce from 'lodash.debounce';
|
|
1
2
|
import { Layer } from 'ol/layer';
|
|
2
3
|
import { Source } from 'ol/source';
|
|
3
4
|
import { VECTOR_TILE_FEATURE_PROPERTY } from '../../common';
|
|
4
5
|
import MobilityLayerMixin from '../mixins/MobilityLayerMixin';
|
|
5
6
|
import MaplibreStyleLayerRenderer from '../renderers/MaplibreStyleLayerRenderer';
|
|
7
|
+
let deprecated = () => { };
|
|
8
|
+
if (typeof window !== 'undefined' &&
|
|
9
|
+
new URLSearchParams(window.location.search).get('deprecated')) {
|
|
10
|
+
deprecated = debounce((...messages) => {
|
|
11
|
+
// eslint-disable-next-line no-console
|
|
12
|
+
console.warn(...messages);
|
|
13
|
+
}, 1000);
|
|
14
|
+
}
|
|
6
15
|
/**
|
|
7
16
|
* Layer for visualizing a specific set of layer from a MapboxLayer.
|
|
8
17
|
*
|
|
@@ -37,8 +46,7 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
|
|
|
37
46
|
}) {
|
|
38
47
|
/** Manage renamed property for backward compatibility with v2 */
|
|
39
48
|
if (options.mapboxLayer) {
|
|
40
|
-
|
|
41
|
-
console.warn('options.mapboxLayer is deprecated. Use options.maplibreLayer instead.');
|
|
49
|
+
deprecated('options.mapboxLayer is deprecated. Use options.maplibreLayer instead.');
|
|
42
50
|
// eslint-disable-next-line no-param-reassign
|
|
43
51
|
options.maplibreLayer = options.mapboxLayer;
|
|
44
52
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -196,8 +204,7 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
|
|
|
196
204
|
*/
|
|
197
205
|
getFeatureInfoAtCoordinate(coordinate) {
|
|
198
206
|
var _a;
|
|
199
|
-
|
|
200
|
-
console.warn(`Deprecated. getFeatureInfoAtCoordinate([layer], coordinate) from ol package instead.`);
|
|
207
|
+
deprecated(`Deprecated. getFeatureInfoAtCoordinate([layer], coordinate) from ol package instead.`);
|
|
201
208
|
if (!((_a = this.maplibreLayer) === null || _a === void 0 ? void 0 : _a.mapLibreMap)) {
|
|
202
209
|
return Promise.resolve({ coordinate, features: [], layer: this });
|
|
203
210
|
}
|
|
@@ -248,8 +255,7 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
|
|
|
248
255
|
*/
|
|
249
256
|
highlight(features = []) {
|
|
250
257
|
var _a;
|
|
251
|
-
|
|
252
|
-
console.warn(`Deprecated. Use layer.setFeatureState(features, {highlighted: true}) instead.`);
|
|
258
|
+
deprecated(`Deprecated. Use layer.setFeatureState(features, {highlighted: true}) instead.`);
|
|
253
259
|
// Filter out selected features
|
|
254
260
|
const filtered = ((_a = this.highlightedFeatures) === null || _a === void 0 ? void 0 : _a.filter((feature) => !(this.selectedFeatures || [])
|
|
255
261
|
.map((feat) => feat.getId())
|
|
@@ -316,8 +322,7 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
|
|
|
316
322
|
* @private
|
|
317
323
|
*/
|
|
318
324
|
select(features = []) {
|
|
319
|
-
|
|
320
|
-
console.warn(`Deprecated. Use layer.setFeatureState(features, {selected: true}) instead.`);
|
|
325
|
+
deprecated(`Deprecated. Use layer.setFeatureState(features, {selected: true}) instead.`);
|
|
321
326
|
this.setHoverState(this.selectedFeatures || [], false);
|
|
322
327
|
this.selectedFeatures = features;
|
|
323
328
|
this.setHoverState(this.selectedFeatures || [], true);
|
|
@@ -338,8 +343,7 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
|
|
|
338
343
|
const { source, sourceLayer } = feature.get(VECTOR_TILE_FEATURE_PROPERTY) || {};
|
|
339
344
|
if ((!source && !sourceLayer) || !feature.getId()) {
|
|
340
345
|
if (!feature.getId()) {
|
|
341
|
-
|
|
342
|
-
console.warn("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/Maplibre/tippecanoe#adding-calculated-attributes.", feature.getId(), feature.getProperties());
|
|
346
|
+
deprecated("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/Maplibre/tippecanoe#adding-calculated-attributes.", feature.getProperties());
|
|
343
347
|
}
|
|
344
348
|
return;
|
|
345
349
|
}
|
|
@@ -357,8 +361,7 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
|
|
|
357
361
|
* @private
|
|
358
362
|
*/
|
|
359
363
|
setHoverState(features, state) {
|
|
360
|
-
|
|
361
|
-
console.warn(`Deprecated. Use layer.setFeatureState(features, {hover: ${state}}) instead.`);
|
|
364
|
+
deprecated(`Deprecated. Use layer.setFeatureState(features, {hover: ${state}}) instead.`);
|
|
362
365
|
this.setFeatureState(features, { hover: state });
|
|
363
366
|
}
|
|
364
367
|
get beforeId() {
|
|
@@ -380,8 +383,7 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
|
|
|
380
383
|
this.set('layersFilter', newValue);
|
|
381
384
|
}
|
|
382
385
|
get mapboxLayer() {
|
|
383
|
-
|
|
384
|
-
console.warn('Deprecated. Use maplibreLayer instead.');
|
|
386
|
+
deprecated('Deprecated. Use maplibreLayer instead.');
|
|
385
387
|
return this.get('maplibreLayer');
|
|
386
388
|
}
|
|
387
389
|
get maplibreLayer() {
|
|
@@ -422,16 +424,14 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
|
|
|
422
424
|
* @deprecated
|
|
423
425
|
*/
|
|
424
426
|
get styleLayer() {
|
|
425
|
-
|
|
426
|
-
console.warn('MaplibreStyleLayer.styleLayer is deprecated. Use MaplibreStyleLayer.layer instead.');
|
|
427
|
+
deprecated('MaplibreStyleLayer.styleLayer is deprecated. Use MaplibreStyleLayer.layer instead.');
|
|
427
428
|
return this.layers[0];
|
|
428
429
|
}
|
|
429
430
|
/**
|
|
430
431
|
* @deprecated
|
|
431
432
|
*/
|
|
432
433
|
set styleLayer(newValue) {
|
|
433
|
-
|
|
434
|
-
console.warn('MaplibreStyleLayer.styleLayer is deprecated. Use MaplibreStyleLayer.layer instead.');
|
|
434
|
+
deprecated('MaplibreStyleLayer.styleLayer is deprecated. Use MaplibreStyleLayer.layer instead.');
|
|
435
435
|
this.layers = [newValue];
|
|
436
436
|
}
|
|
437
437
|
/**
|
|
@@ -441,16 +441,14 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
|
|
|
441
441
|
* @deprecated
|
|
442
442
|
*/
|
|
443
443
|
get styleLayers() {
|
|
444
|
-
|
|
445
|
-
console.warn('MaplibreStyleLayer.styleLayers is deprecated. Use MaplibreStyleLayer.layers instead.');
|
|
444
|
+
deprecated('MaplibreStyleLayer.styleLayers is deprecated. Use MaplibreStyleLayer.layers instead.');
|
|
446
445
|
return this.layers;
|
|
447
446
|
}
|
|
448
447
|
/**
|
|
449
448
|
* @deprecated
|
|
450
449
|
*/
|
|
451
450
|
set styleLayers(newValue) {
|
|
452
|
-
|
|
453
|
-
console.warn('MaplibreStyleLayer.styleLayers is deprecated. Use MaplibreStyleLayer.layers instead.');
|
|
451
|
+
deprecated('MaplibreStyleLayer.styleLayers is deprecated. Use MaplibreStyleLayer.layers instead.');
|
|
454
452
|
this.layers = newValue;
|
|
455
453
|
}
|
|
456
454
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Coordinate } from 'ol/coordinate';
|
|
2
2
|
import { LayerGetFeatureInfoResponse } from '../../types';
|
|
3
|
-
import Layer from './Layer';
|
|
4
3
|
import { MobilityLayerOptions } from '../mixins/MobilityLayerMixin';
|
|
4
|
+
import Layer from './Layer';
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated
|
|
7
7
|
*/
|
|
@@ -9,10 +9,10 @@ declare class VectorLayer extends Layer {
|
|
|
9
9
|
/**
|
|
10
10
|
* @deprecated
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
clone(newOptions: MobilityLayerOptions): VectorLayer;
|
|
13
13
|
/**
|
|
14
14
|
* @deprecated
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
getFeatureInfoAtCoordinate(coordinate: Coordinate): Promise<LayerGetFeatureInfoResponse>;
|
|
17
17
|
}
|
|
18
18
|
export default VectorLayer;
|
package/ol/layers/VectorLayer.js
CHANGED
|
@@ -3,6 +3,12 @@ import Layer from './Layer';
|
|
|
3
3
|
* @deprecated
|
|
4
4
|
*/
|
|
5
5
|
class VectorLayer extends Layer {
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated
|
|
8
|
+
*/
|
|
9
|
+
clone(newOptions) {
|
|
10
|
+
return new VectorLayer(Object.assign(Object.assign({}, this.options), newOptions));
|
|
11
|
+
}
|
|
6
12
|
/**
|
|
7
13
|
* @deprecated
|
|
8
14
|
*/
|
|
@@ -11,21 +17,15 @@ class VectorLayer extends Layer {
|
|
|
11
17
|
if (this.map) {
|
|
12
18
|
const pixel = this.map.getPixelFromCoordinate(coordinate);
|
|
13
19
|
features = this.map.getFeaturesAtPixel(pixel, {
|
|
14
|
-
layerFilter: (l) => l === this.olLayer,
|
|
15
20
|
hitTolerance: this.hitTolerance || 5,
|
|
21
|
+
layerFilter: (l) => l === this.olLayer,
|
|
16
22
|
});
|
|
17
23
|
}
|
|
18
24
|
return Promise.resolve({
|
|
25
|
+
coordinate,
|
|
19
26
|
features,
|
|
20
27
|
layer: this,
|
|
21
|
-
coordinate,
|
|
22
28
|
});
|
|
23
29
|
}
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated
|
|
26
|
-
*/
|
|
27
|
-
clone(newOptions) {
|
|
28
|
-
return new VectorLayer(Object.assign(Object.assign({}, this.options), newOptions));
|
|
29
|
-
}
|
|
30
30
|
}
|
|
31
31
|
export default VectorLayer;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Layer } from 'ol/layer';
|
|
2
2
|
import { PropertiesLayerMixinOptions } from './PropertiesLayerMixin';
|
|
3
|
-
export type MobilityLayerOptions = PropertiesLayerMixinOptions &
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
type GConstructor<T = {}> = new (...args: any[]) => T;
|
|
3
|
+
export type MobilityLayerOptions = PropertiesLayerMixinOptions & Record<string, any>;
|
|
4
|
+
type GConstructor<T = object> = new (...args: any[]) => T;
|
|
7
5
|
export type Layerable = GConstructor<Omit<Layer, keyof string>>;
|
|
8
6
|
declare function MobilityLayerMixin<TBase extends Layerable>(Base: TBase): {
|
|
9
7
|
new (...args: any[]): {
|
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
import debounce from 'lodash.debounce';
|
|
3
3
|
import { getUid } from 'ol';
|
|
4
4
|
import getLayersAsFlatArray from '../../common/utils/getLayersAsFlatArray';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
let deprecated = () => { };
|
|
6
|
+
if (typeof window !== 'undefined' &&
|
|
7
|
+
new URLSearchParams(window.location.search).get('deprecated')) {
|
|
8
|
+
deprecated = debounce((message) => {
|
|
9
|
+
// eslint-disable-next-line no-console
|
|
10
|
+
console.warn(message);
|
|
11
|
+
}, 1000);
|
|
12
|
+
}
|
|
9
13
|
/**
|
|
10
14
|
* This mixin adds some properties to access ol custom properties easily.
|
|
11
15
|
*/
|
|
@@ -37,7 +41,7 @@ function PropertiesLayerMixin(Base) {
|
|
|
37
41
|
* @param {ol/Map~Map} map A map.
|
|
38
42
|
*/
|
|
39
43
|
attachToMap(map) {
|
|
40
|
-
// @ts-expect-error
|
|
44
|
+
// @ts-expect-error attachToMap not necessarily exists
|
|
41
45
|
(super.attachToMap || (() => { }))(map);
|
|
42
46
|
(this.get('children') || []).forEach((child) => {
|
|
43
47
|
map.addLayer(child);
|
|
@@ -50,7 +54,7 @@ function PropertiesLayerMixin(Base) {
|
|
|
50
54
|
(this.get('children') || []).forEach((child) => {
|
|
51
55
|
this.map.removeLayer(child);
|
|
52
56
|
});
|
|
53
|
-
// @ts-expect-error
|
|
57
|
+
// @ts-expect-error detachToMap not necessarily exists
|
|
54
58
|
(super.detachFromMap || (() => { }))();
|
|
55
59
|
}
|
|
56
60
|
/**
|
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.0-beta.
|
|
5
|
+
"version": "3.0.0-beta.21",
|
|
6
6
|
"homepage": "https://mobility-toolbox-js.geops.io/",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./index.js",
|