mobility-toolbox-js 3.0.0-beta.14 → 3.0.0-beta.16

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.
@@ -3,13 +3,13 @@ import { MobilityLayerOptions } from '../mixins/MobilityLayerMixin';
3
3
  declare const Layer_base: {
4
4
  new (...args: any[]): {
5
5
  options?: import("../mixins/PropertiesLayerMixin").PropertiesLayerMixinOptions | undefined;
6
- olListenersKeys: import("ol/events").EventsKey[];
6
+ olEventsKeys: import("ol/events").EventsKey[];
7
7
  children: OLLayer<import("ol/source").Source, import("ol/renderer/Layer").default<any>>[];
8
8
  get copyrights(): string;
9
9
  set copyrights(newCopyrights: string | string[]);
10
10
  disabled: boolean;
11
11
  readonly group: string;
12
- readonly hitTolerance: boolean;
12
+ readonly hitTolerance: number;
13
13
  readonly key: string;
14
14
  readonly map: import("ol").Map;
15
15
  readonly name: string;
@@ -1,36 +1,32 @@
1
- import Source from 'ol/source/Source';
2
1
  import OlMap from 'ol/Map';
3
- import BaseEvent from 'ol/events/Event';
4
- import Layer from 'ol/layer/Layer';
5
- import { Map, MapOptions } from 'maplibre-gl';
2
+ import { MapLibreLayer } from '@geoblocks/ol-maplibre-layer';
3
+ import type { MapLibreLayerOptions, MapLibreOptions } from '@geoblocks/ol-maplibre-layer/lib/types/MapLibreLayer';
6
4
  import { MobilityLayerOptions } from '../mixins/MobilityLayerMixin';
7
- import MaplibreLayerRenderer from '../renderers/MaplibreLayerRenderer';
8
- export type MaplibreLayerOptions = MobilityLayerOptions & {
5
+ export type MaplibreLayerOptions = MobilityLayerOptions & MapLibreLayerOptions & {
9
6
  apiKey?: string;
10
7
  apiKeyName?: string;
11
8
  style?: string | maplibregl.StyleSpecification;
12
9
  url?: string;
13
- mapOptions?: maplibregl.MapOptions;
14
- queryRenderedFeaturesOptions?: maplibregl.QueryRenderedFeaturesOptions;
10
+ mapLibreOptions?: MapLibreOptions;
15
11
  };
16
12
  declare const MaplibreLayer_base: {
17
13
  new (...args: any[]): {
18
14
  options?: import("../mixins/PropertiesLayerMixin").PropertiesLayerMixinOptions | undefined;
19
- olListenersKeys: import("ol/events").EventsKey[];
20
- children: Layer<Source, import("ol/renderer/Layer").default<any>>[];
15
+ olEventsKeys: import("ol/events").EventsKey[];
16
+ children: import("ol/layer").Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>>[];
21
17
  get copyrights(): string;
22
18
  set copyrights(newCopyrights: string | string[]);
23
19
  disabled: boolean;
24
20
  readonly group: string;
25
- readonly hitTolerance: boolean;
21
+ readonly hitTolerance: number;
26
22
  readonly key: string;
27
23
  readonly map: OlMap;
28
24
  readonly name: string;
29
- olLayer: Layer<Source, import("ol/renderer/Layer").default<any>>;
30
- parent: Layer<Source, import("ol/renderer/Layer").default<any>>;
25
+ olLayer: import("ol/layer").Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>>;
26
+ parent: import("ol/layer").Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>>;
31
27
  visible: boolean;
32
28
  setMapInternal: ((map: OlMap) => void) & ((map: OlMap | null) => void);
33
- onChildrenChange(oldValue: Layer<Source, import("ol/renderer/Layer").default<any>>[]): void;
29
+ onChildrenChange(oldValue: import("ol/layer").Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>>[]): void;
34
30
  attachToMap(map: OlMap): void;
35
31
  detachFromMap(): void;
36
32
  flat(): any[];
@@ -40,8 +36,8 @@ declare const MaplibreLayer_base: {
40
36
  render: (frameState: import("ol/Map").FrameState | null, target: HTMLElement) => HTMLElement | null;
41
37
  once: import("ol/layer/Layer").LayerOnSignature<import("ol/events").EventsKey>;
42
38
  un: import("ol/layer/Layer").LayerOnSignature<void>;
43
- getSource: () => Source | null;
44
- getRenderSource: () => Source | null;
39
+ getSource: () => import("ol/source").Source | null;
40
+ getRenderSource: () => import("ol/source").Source | null;
45
41
  getFeatures: (pixel: import("ol/pixel").Pixel) => Promise<import("ol/Feature").FeatureLike[]>;
46
42
  getData: (pixel: import("ol/pixel").Pixel) => Float32Array | Uint8ClampedArray | Uint8Array | DataView | null;
47
43
  isVisible: (view?: import("ol").View | import("ol/View").ViewStateLayerStateExtent | undefined) => boolean;
@@ -52,13 +48,13 @@ declare const MaplibreLayer_base: {
52
48
  renderDeferred: (frameState: import("ol/Map").FrameState) => void;
53
49
  getMapInternal: () => OlMap | null;
54
50
  setMap: (map: OlMap | null) => void;
55
- setSource: (source: Source | null) => void;
51
+ setSource: (source: import("ol/source").Source | null) => void;
56
52
  getRenderer: () => import("ol/renderer/Layer").default<any> | null;
57
53
  hasRenderer: () => boolean;
58
54
  getBackground: () => false | import("ol/layer/Base").BackgroundColor;
59
55
  getClassName: () => string;
60
56
  getLayerState: (managed?: boolean | undefined) => import("ol/layer/Layer").State;
61
- getLayersArray: (array?: Layer<Source, import("ol/renderer/Layer").default<any>>[] | undefined) => Layer<Source, import("ol/renderer/Layer").default<any>>[];
57
+ getLayersArray: (array?: import("ol/layer").Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>>[] | undefined) => import("ol/layer").Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>>[];
62
58
  getLayerStatesArray: (states?: import("ol/layer/Layer").State[] | undefined) => import("ol/layer/Layer").State[];
63
59
  getExtent: () => import("ol/extent").Extent | undefined;
64
60
  getMaxResolution: () => number;
@@ -97,12 +93,12 @@ declare const MaplibreLayer_base: {
97
93
  unset: (key: string, silent?: boolean | undefined) => void;
98
94
  changed: () => void;
99
95
  getRevision: () => number;
100
- dispatchEvent: (event: string | BaseEvent) => boolean | undefined;
96
+ dispatchEvent: (event: string | import("ol/events/Event").default) => boolean | undefined;
101
97
  getListeners: (type: string) => import("ol/events").Listener[] | undefined;
102
98
  hasListener: (type?: string | undefined) => boolean;
103
99
  dispose: () => void;
104
100
  };
105
- } & typeof Layer;
101
+ } & typeof MapLibreLayer;
106
102
  /**
107
103
  * An OpenLayers layer able to display data from the [geOps Maps API](https://developer.geops.io/apis/maps).
108
104
  *
@@ -112,7 +108,7 @@ declare const MaplibreLayer_base: {
112
108
  * const layer = new MaplibreLayer({
113
109
  * apiKey: 'yourApiKey',
114
110
  * // apiKeyName: 'key',
115
- * // mapOptions: {
111
+ * // mapLibreOptions: {
116
112
  * // interactive: false,
117
113
  * // trackResize: false,
118
114
  * // attributionControl: false,
@@ -124,22 +120,14 @@ declare const MaplibreLayer_base: {
124
120
  * // url: 'https://maps.geops.io',
125
121
  * });
126
122
  *
127
- * @classproperty {maplibregl.Map} maplibreMap - The Maplibre map object. Readonly.
128
- * @classproperty {maplibregl.QueryRenderedFeaturesOptions} queryRenderedFeaturesOptions - Options used when we query features using map.getFeaturesAtPixel().
123
+ * @classproperty {maplibregl.Map} mapLibreMap - The Maplibre map object. Readonly.
129
124
  * @classproperty {string} style - geOps Maps api style.
130
125
  * @extends {ol/layer/Layer~Layer}
131
126
  * @public
132
127
  */
133
128
  declare class MaplibreLayer extends MaplibreLayer_base {
134
- loaded: boolean;
135
- maplibreMap?: Map;
136
- get apiKey(): string;
137
- set apiKey(newValue: string);
138
- get apiKeyName(): string;
139
- set apiKeyName(newValue: string);
140
129
  get mbMap(): maplibregl.Map | undefined;
141
- get queryRenderedFeaturesOptions(): maplibregl.QueryRenderedFeaturesOptions;
142
- set queryRenderedFeaturesOptions(newValue: maplibregl.QueryRenderedFeaturesOptions);
130
+ get maplibreMap(): maplibregl.Map | undefined;
143
131
  get style(): string;
144
132
  set style(newValue: string);
145
133
  get url(): string;
@@ -150,7 +138,7 @@ declare class MaplibreLayer extends MaplibreLayer_base {
150
138
  * @param {MaplibreLayerOptions} options
151
139
  * @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
152
140
  * @param {string} [options.apiKeyName="key"] The geOps Maps API key name.
153
- * @param {maplibregl.MapOptions} [options.mapOptions={ interactive: false, trackResize: false, attributionControl: false }] Maplibre map options.
141
+ * @param {maplibregl.MapOptions} [options.mapLibreOptions={ interactive: false, trackResize: false, attributionControl: false }] Maplibre map options.
154
142
  * @param {string} [options.style="travic_v2"] The geOps Maps API style.
155
143
  * @param {string} [options.url="https://maps.geops.io"] The geOps Maps API url.
156
144
  */
@@ -160,18 +148,7 @@ declare class MaplibreLayer extends MaplibreLayer_base {
160
148
  * @param {ol/Map~Map} map
161
149
  */
162
150
  attachToMap(map: OlMap): void;
163
- /**
164
- * Terminate what was initialized in init function. Remove layer, events...
165
- */
166
- detachFromMap(): void;
167
- /**
168
- * Create the Maplibre map.
169
- * @private
170
- */
171
- loadMbMap(): void;
172
151
  getStyle(): string;
173
- createMap(options: MapOptions): Map;
174
- createRenderer(): MaplibreLayerRenderer;
175
152
  updateMaplibreMap(): void;
176
153
  /**
177
154
  * Create a copy of the MaplibreLayer.
@@ -1,11 +1,12 @@
1
- import Source from 'ol/source/Source';
2
- import BaseEvent from 'ol/events/Event';
3
- import Layer from 'ol/layer/Layer';
4
1
  import debounce from 'lodash.debounce';
5
- import { Map } from 'maplibre-gl';
6
- import { getUrlWithParams, getMapGlCopyrights } from '../../common/utils';
2
+ import { MapLibreLayer } from '@geoblocks/ol-maplibre-layer';
3
+ import { getUrlWithParams } from '../../common/utils';
7
4
  import MobilityLayerMixin from '../mixins/MobilityLayerMixin';
8
- import MaplibreLayerRenderer from '../renderers/MaplibreLayerRenderer';
5
+ const buildStyleUrl = (url, style, apiKey, apiKeyName) => {
6
+ return getUrlWithParams(`${url}/styles/${style}/style.json`, {
7
+ [apiKeyName]: apiKey,
8
+ }).toString();
9
+ };
9
10
  /**
10
11
  * An OpenLayers layer able to display data from the [geOps Maps API](https://developer.geops.io/apis/maps).
11
12
  *
@@ -15,7 +16,7 @@ import MaplibreLayerRenderer from '../renderers/MaplibreLayerRenderer';
15
16
  * const layer = new MaplibreLayer({
16
17
  * apiKey: 'yourApiKey',
17
18
  * // apiKeyName: 'key',
18
- * // mapOptions: {
19
+ * // mapLibreOptions: {
19
20
  * // interactive: false,
20
21
  * // trackResize: false,
21
22
  * // attributionControl: false,
@@ -27,35 +28,30 @@ import MaplibreLayerRenderer from '../renderers/MaplibreLayerRenderer';
27
28
  * // url: 'https://maps.geops.io',
28
29
  * });
29
30
  *
30
- * @classproperty {maplibregl.Map} maplibreMap - The Maplibre map object. Readonly.
31
- * @classproperty {maplibregl.QueryRenderedFeaturesOptions} queryRenderedFeaturesOptions - Options used when we query features using map.getFeaturesAtPixel().
31
+ * @classproperty {maplibregl.Map} mapLibreMap - The Maplibre map object. Readonly.
32
32
  * @classproperty {string} style - geOps Maps api style.
33
33
  * @extends {ol/layer/Layer~Layer}
34
34
  * @public
35
35
  */
36
- class MaplibreLayer extends MobilityLayerMixin(Layer) {
37
- get apiKey() {
38
- return this.get('apiKey');
39
- }
40
- set apiKey(newValue) {
41
- this.set('apiKey', newValue);
42
- }
43
- get apiKeyName() {
44
- return this.get('apiKeyName');
45
- }
46
- set apiKeyName(newValue) {
47
- this.set('apiKeyName', newValue);
48
- }
36
+ class MaplibreLayer extends MobilityLayerMixin(MapLibreLayer) {
49
37
  get mbMap() {
50
- console.warn('Deprecated. Use layer.maplibreMap.');
38
+ // eslint-disable-next-line no-console
39
+ console.warn('.mbMap deprecated. Use layer.maplibreMap.');
51
40
  return this.maplibreMap;
52
41
  }
53
- get queryRenderedFeaturesOptions() {
54
- return this.get('queryRenderedFeaturesOptions');
55
- }
56
- set queryRenderedFeaturesOptions(newValue) {
57
- this.set('queryRenderedFeaturesOptions', newValue);
58
- }
42
+ get maplibreMap() {
43
+ // eslint-disable-next-line no-console
44
+ console.warn('.maplibreMap eprecated. 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
+ // }
59
55
  get style() {
60
56
  return this.get('style');
61
57
  }
@@ -74,18 +70,16 @@ class MaplibreLayer extends MobilityLayerMixin(Layer) {
74
70
  * @param {MaplibreLayerOptions} options
75
71
  * @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
76
72
  * @param {string} [options.apiKeyName="key"] The geOps Maps API key name.
77
- * @param {maplibregl.MapOptions} [options.mapOptions={ interactive: false, trackResize: false, attributionControl: false }] Maplibre map options.
73
+ * @param {maplibregl.MapOptions} [options.mapLibreOptions={ interactive: false, trackResize: false, attributionControl: false }] Maplibre map options.
78
74
  * @param {string} [options.style="travic_v2"] The geOps Maps API style.
79
75
  * @param {string} [options.url="https://maps.geops.io"] The geOps Maps API url.
80
76
  */
81
77
  constructor(options) {
82
- super(Object.assign(Object.assign({ source: new Source({
83
- attributions: () => {
84
- return ((this.maplibreMap && getMapGlCopyrights(this.maplibreMap)) || []);
85
- },
86
- }), apiKeyName: 'key', style: 'travic_v2', url: 'https://maps.geops.io' }, (options || {})), {
87
- // @ts-expect-error mapOptions must be saved by the mixin in this.options
88
- mapOptions: Object.assign({ interactive: false, trackResize: false, attributionControl: false }, ((options === null || options === void 0 ? void 0 : options.mapOptions) || {})), queryRenderedFeaturesOptions: Object.assign({}, ((options === null || options === void 0 ? void 0 : options.queryRenderedFeaturesOptions) || {})) }));
78
+ const newOptions = Object.assign(Object.assign({ apiKeyName: 'key', style: 'travic_v2', url: 'https://maps.geops.io' }, (options || {})), { mapLibreOptions: Object.assign({}, (options.mapLibreOptions || {})) });
79
+ if (!newOptions.mapLibreOptions.style && newOptions.apiKey) {
80
+ newOptions.mapLibreOptions.style = buildStyleUrl(newOptions.url, newOptions.style, newOptions.apiKey, newOptions.apiKeyName);
81
+ }
82
+ super(newOptions);
89
83
  }
90
84
  /**
91
85
  * Initialize the layer and listen to feature clicks.
@@ -93,66 +87,14 @@ class MaplibreLayer extends MobilityLayerMixin(Layer) {
93
87
  */
94
88
  attachToMap(map) {
95
89
  super.attachToMap(map);
96
- this.loadMbMap();
90
+ this.updateMaplibreMap();
97
91
  const updateMaplibreMapDebounced = debounce(this.updateMaplibreMap.bind(this), 150);
98
- this.olListenersKeys.push(this.on('propertychange', (evt) => {
99
- if (/(apiKey|apiKeyName|url|style)/.test(evt.key)) {
92
+ this.olEventsKeys.push(this.on('propertychange', (evt) => {
93
+ if (/(url|style)/.test(evt.key)) {
100
94
  updateMaplibreMapDebounced();
101
95
  }
102
96
  }));
103
97
  }
104
- /**
105
- * Terminate what was initialized in init function. Remove layer, events...
106
- */
107
- detachFromMap() {
108
- if (this.maplibreMap) {
109
- // Some asynchrone repaints are triggered even if the mbMap has been removed,
110
- // to avoid display of errors we set an empty function.
111
- this.maplibreMap.triggerRepaint = () => { };
112
- this.maplibreMap.remove();
113
- this.maplibreMap = undefined;
114
- }
115
- this.loaded = false;
116
- super.detachFromMap();
117
- }
118
- /**
119
- * Create the Maplibre map.
120
- * @private
121
- */
122
- loadMbMap() {
123
- var _a, _b, _c;
124
- this.loaded = false;
125
- this.olListenersKeys.push(
126
- // @ts-ignore
127
- (_a = this.map) === null || _a === void 0 ? void 0 : _a.on('change:target', this.loadMbMap.bind(this)));
128
- if (!((_b = this.map) === null || _b === void 0 ? void 0 : _b.getTargetElement())) {
129
- return;
130
- }
131
- if (!this.visible) {
132
- // On next change of visibility we load the map
133
- this.olListenersKeys.push(
134
- // @ts-ignore
135
- this.once('change:visible', this.loadMbMap.bind(this)));
136
- return;
137
- }
138
- const container = document.createElement('div');
139
- container.style.position = 'absolute';
140
- container.style.width = '100%';
141
- container.style.height = '100%';
142
- /**
143
- * A Maplibre map
144
- * @type {maplibregl.Map}
145
- */
146
- this.maplibreMap = this.createMap(Object.assign({ style: this.getStyle(), container }, (((_c = this.options) === null || _c === void 0 ? void 0 : _c.mapOptions) || {})));
147
- this.maplibreMap.on('sourcedata', () => {
148
- var _a;
149
- (_a = this.getSource()) === null || _a === void 0 ? void 0 : _a.refresh(); // Refresh attribution
150
- });
151
- this.maplibreMap.once('load', () => {
152
- this.loaded = true;
153
- this.dispatchEvent(new BaseEvent('load'));
154
- });
155
- }
156
98
  getStyle() {
157
99
  // If the style is a complete style object, use it directly.
158
100
  if (this.style &&
@@ -166,20 +108,11 @@ class MaplibreLayer extends MobilityLayerMixin(Layer) {
166
108
  return this.url;
167
109
  }
168
110
  /// Otherwise build the complete style url.
169
- return getUrlWithParams(`${this.url}/styles/${this.style}/style.json`, {
170
- [this.apiKeyName]: this.apiKey,
171
- }).toString();
172
- }
173
- // eslint-disable-next-line class-methods-use-this
174
- createMap(options) {
175
- return new Map(options);
176
- }
177
- createRenderer() {
178
- return new MaplibreLayerRenderer(this);
111
+ return buildStyleUrl(this.url, this.style, this.get('apiKey'), this.get('apiKeyName'));
179
112
  }
180
113
  updateMaplibreMap() {
181
114
  var _a;
182
- (_a = this.maplibreMap) === null || _a === void 0 ? void 0 : _a.setStyle(this.getStyle(), { diff: false });
115
+ (_a = this.mapLibreMap) === null || _a === void 0 ? void 0 : _a.setStyle(this.getStyle(), { diff: false });
183
116
  }
184
117
  /**
185
118
  * Create a copy of the MaplibreLayer.
@@ -18,13 +18,13 @@ export type MaplibreStyleLayerOptions = MaplibreLayerOptions & {
18
18
  declare const MaplibreStyleLayer_base: {
19
19
  new (...args: any[]): {
20
20
  options?: import("../mixins/PropertiesLayerMixin").PropertiesLayerMixinOptions | undefined;
21
- olListenersKeys: import("ol/events").EventsKey[];
21
+ olEventsKeys: import("ol/events").EventsKey[];
22
22
  children: Layer<Source, import("ol/renderer/Layer").default<any>>[];
23
23
  get copyrights(): string;
24
24
  set copyrights(newCopyrights: string | string[]);
25
25
  disabled: boolean;
26
26
  readonly group: string;
27
- readonly hitTolerance: boolean;
27
+ readonly hitTolerance: number;
28
28
  readonly key: string;
29
29
  readonly map: Map;
30
30
  readonly name: string;
@@ -105,7 +105,9 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
105
105
  * @param {FilterFunction} [options.layersFilter] Filter function to decide which style layer to apply visiblity on. If not provided, the 'layers' property is used.
106
106
  * @param {FilterFunction} [options.queryRenderedLayersFilter] Filter function to decide which style layer are available for query.
107
107
  */
108
- constructor(options = {}) {
108
+ constructor(options = {
109
+ mapLibreOptions: { style: { version: 8, sources: {}, layers: [] } },
110
+ }) {
109
111
  /** Manage renamed property for backward compatibility with v2 */
110
112
  if (options.mapboxLayer) {
111
113
  // eslint-disable-next-line no-console
@@ -147,7 +149,7 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
147
149
  if (!this.map.getTargetElement()) {
148
150
  // If ther e is no target element the maplibreMap is not yet created, we
149
151
  // relaunch the initialisation when it's the case.
150
- this.olListenersKeys.push(this.map.on('change:target', () => {
152
+ this.olEventsKeys.push(this.map.on('change:target', () => {
151
153
  this.attachToMap(map);
152
154
  }));
153
155
  return;
@@ -167,7 +169,7 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
167
169
  }
168
170
  }
169
171
  // Apply the visibiltity when layer's visibility change.
170
- this.olListenersKeys.push(
172
+ this.olEventsKeys.push(
171
173
  // @ts-expect-error 'load' is a custom event
172
174
  this.maplibreLayer.on('load', this.onLoad.bind(this)), this.on('change:visible', (evt) => {
173
175
  // Once the map is loaded we can apply visiblity without waiting
@@ -25,7 +25,7 @@ declare const RealtimeLayer_base: {
25
25
  tenant: string;
26
26
  bboxParameters?: {
27
27
  [index: string]: string | number | boolean | string[] | number[] | boolean[];
28
- } | undefined; /** @private */
28
+ } | undefined;
29
29
  time?: Date | undefined;
30
30
  live?: boolean | undefined;
31
31
  speed?: number | undefined;
@@ -46,8 +46,7 @@ declare const RealtimeLayer_base: {
46
46
  motsByZoom: import("../../types").RealtimeMot[][];
47
47
  generalizationLevel?: import("../../types").RealtimeGeneralizationLevel | undefined;
48
48
  generalizationLevelByZoom: import("../../types").RealtimeGeneralizationLevel[];
49
- renderTimeIntervalByZoom: number[];
50
- /**
49
+ renderTimeIntervalByZoom: number[]; /**
51
50
  * Destroy the container of the tracker.
52
51
  * @private
53
52
  */
@@ -95,13 +94,13 @@ declare const RealtimeLayer_base: {
95
94
  } & {
96
95
  new (...args: any[]): {
97
96
  options?: import("../mixins/PropertiesLayerMixin").PropertiesLayerMixinOptions | undefined;
98
- olListenersKeys: import("ol/events").EventsKey[];
97
+ olEventsKeys: import("ol/events").EventsKey[];
99
98
  children: Layer<Source, import("ol/renderer/Layer").default<any>>[];
100
99
  get copyrights(): string;
101
100
  set copyrights(newCopyrights: string | string[]);
102
101
  disabled: boolean;
103
102
  readonly group: string;
104
- readonly hitTolerance: boolean;
103
+ readonly hitTolerance: number;
105
104
  readonly key: string;
106
105
  readonly map: Map;
107
106
  readonly name: string;
@@ -89,7 +89,7 @@ class RealtimeLayer extends RealtimeLayerMixin(MobilityLayerMixin(Layer)) {
89
89
  // @ts-expect-error - bad ts check RealtimeLayer is a BaseLayer
90
90
  const index = this.map.getLayers().getArray().indexOf(this);
91
91
  this.map.getLayers().insertAt(index, this.vectorLayer);
92
- this.olListenersKeys.push(...this.map.on(['moveend', 'change:target'],
92
+ this.olEventsKeys.push(...this.map.on(['moveend', 'change:target'],
93
93
  // @ts-expect-error - bad ol definitions
94
94
  (evt) => {
95
95
  const view = (evt.map || evt.target).getView();
@@ -0,0 +1,18 @@
1
+ import { Coordinate } from 'ol/coordinate';
2
+ import { LayerGetFeatureInfoResponse } from '../../types';
3
+ import Layer from './Layer';
4
+ import { MobilityLayerOptions } from '../mixins/MobilityLayerMixin';
5
+ /**
6
+ * @deprecated
7
+ */
8
+ declare class VectorLayer extends Layer {
9
+ /**
10
+ * @deprecated
11
+ */
12
+ getFeatureInfoAtCoordinate(coordinate: Coordinate): Promise<LayerGetFeatureInfoResponse>;
13
+ /**
14
+ * @deprecated
15
+ */
16
+ clone(newOptions: MobilityLayerOptions): VectorLayer;
17
+ }
18
+ export default VectorLayer;
@@ -0,0 +1,31 @@
1
+ import Layer from './Layer';
2
+ /**
3
+ * @deprecated
4
+ */
5
+ class VectorLayer extends Layer {
6
+ /**
7
+ * @deprecated
8
+ */
9
+ getFeatureInfoAtCoordinate(coordinate) {
10
+ let features = [];
11
+ if (this.map) {
12
+ const pixel = this.map.getPixelFromCoordinate(coordinate);
13
+ features = this.map.getFeaturesAtPixel(pixel, {
14
+ layerFilter: (l) => l === this.olLayer,
15
+ hitTolerance: this.hitTolerance || 5,
16
+ });
17
+ }
18
+ return Promise.resolve({
19
+ features,
20
+ layer: this,
21
+ coordinate,
22
+ });
23
+ }
24
+ /**
25
+ * @deprecated
26
+ */
27
+ clone(newOptions) {
28
+ return new VectorLayer(Object.assign(Object.assign({}, this.options), newOptions));
29
+ }
30
+ }
31
+ export default VectorLayer;
@@ -2,3 +2,4 @@ export { default as MaplibreLayer } from "./MaplibreLayer";
2
2
  export { default as MaplibreStyleLayer } from "./MaplibreStyleLayer";
3
3
  export { default as RealtimeLayer } from "./RealtimeLayer";
4
4
  export { default as Layer } from "./Layer";
5
+ export { default as VectorLayer } from "./VectorLayer";
@@ -1,4 +1,6 @@
1
1
  export { default as MaplibreLayer } from './MaplibreLayer';
2
2
  export { default as MaplibreStyleLayer } from './MaplibreStyleLayer';
3
3
  export { default as RealtimeLayer } from './RealtimeLayer';
4
+ // Deprecated export
4
5
  export { default as Layer } from './Layer';
6
+ export { default as VectorLayer } from './VectorLayer';
@@ -8,13 +8,13 @@ export type Layerable = GConstructor<Omit<Layer, keyof string>>;
8
8
  declare function MobilityLayerMixin<TBase extends Layerable>(Base: TBase): {
9
9
  new (...args: any[]): {
10
10
  options?: PropertiesLayerMixinOptions | undefined;
11
- olListenersKeys: import("ol/events").EventsKey[];
11
+ olEventsKeys: import("ol/events").EventsKey[];
12
12
  children: Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>>[];
13
13
  get copyrights(): string;
14
14
  set copyrights(newCopyrights: string | string[]);
15
15
  disabled: boolean;
16
16
  readonly group: string;
17
- readonly hitTolerance: boolean;
17
+ readonly hitTolerance: number;
18
18
  readonly key: string;
19
19
  readonly map: import("ol").Map;
20
20
  readonly name: string;
@@ -25,18 +25,28 @@ export type PropertiesLayerMixinOptions = Options & {
25
25
  declare function PropertiesLayerMixin<TBase extends Layerable>(Base: TBase): {
26
26
  new (...args: any[]): {
27
27
  options?: PropertiesLayerMixinOptions | undefined;
28
- olListenersKeys: EventsKey[];
28
+ olEventsKeys: EventsKey[];
29
+ /** @deprecated */
29
30
  children: Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>>[];
31
+ /** @deprecated */
30
32
  get copyrights(): string;
33
+ /** @deprecated */
31
34
  set copyrights(newCopyrights: string | string[]);
35
+ /** @deprecated */
32
36
  disabled: boolean;
37
+ /** @deprecated */
33
38
  readonly group: string;
34
- readonly hitTolerance: boolean;
39
+ /** @deprecated */
40
+ readonly hitTolerance: number;
35
41
  readonly key: string;
36
42
  readonly map: Map;
43
+ /** @deprecated */
37
44
  readonly name: string;
45
+ /** @deprecated */
38
46
  olLayer: Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>>;
47
+ /** @deprecated */
39
48
  parent: Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>>;
49
+ /** @deprecated */
40
50
  visible: boolean;
41
51
  setMapInternal(map: Map): void;
42
52
  /** @private */
@@ -53,6 +63,7 @@ declare function PropertiesLayerMixin<TBase extends Layerable>(Base: TBase): {
53
63
  detachFromMap(): void;
54
64
  /**
55
65
  * Return the an array containing all the descendants of the layer in a flat array. Including the current layer.
66
+ * @deprecated
56
67
  */
57
68
  flat(): any[];
58
69
  addEventListener: (type: string, listener: import("ol/events").Listener) => void;