mobility-toolbox-js 3.0.1-beta.0 → 3.0.1-beta.2
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.js +1 -3
- package/api/RealtimeAPI.d.ts +47 -47
- package/api/RealtimeAPI.js +74 -74
- package/api/WebSocketAPI.js +0 -1
- package/common/controls/StopFinderControlCommon.d.ts +1 -1
- package/common/controls/StopFinderControlCommon.js +1 -1
- package/common/styles/realtimeDefaultStyle.js +0 -5
- package/common/styles/realtimeHeadingStyle.js +0 -5
- package/common/styles/realtimeSimpleStyle.d.ts +0 -1
- package/common/styles/realtimeSimpleStyle.js +0 -1
- package/common/typedefs.d.ts +0 -117
- package/common/typedefs.js +0 -31
- package/common/utils/RealtimeEngine.d.ts +214 -0
- package/common/utils/RealtimeEngine.js +554 -0
- package/common/utils/getLayersAsFlatArray.d.ts +0 -1
- package/common/utils/getLayersAsFlatArray.js +0 -1
- package/common/utils/getVehiclePosition.js +1 -4
- package/common/utils/realtimeConfig.d.ts +1 -1
- package/common/utils/realtimeConfig.js +0 -1
- package/common/utils/renderTrajectories.d.ts +1 -0
- package/common/utils/renderTrajectories.js +1 -0
- package/common/utils/sortAndFilterDepartures.d.ts +1 -0
- package/common/utils/sortAndFilterDepartures.js +1 -0
- package/maplibre/controls/CopyrightControl.d.ts +9 -6
- package/maplibre/controls/CopyrightControl.js +11 -8
- package/maplibre/layers/Layer.d.ts +7 -6
- package/maplibre/layers/Layer.js +1 -2
- package/maplibre/layers/RealtimeLayer.d.ts +54 -111
- package/maplibre/layers/RealtimeLayer.js +126 -114
- package/maplibre/utils/getSourceCoordinates.d.ts +1 -0
- package/maplibre/utils/getSourceCoordinates.js +5 -4
- package/mbt.js +6960 -14605
- package/mbt.js.map +4 -4
- package/mbt.min.js +68 -71
- 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 +29 -18
- package/ol/controls/RoutingControl.js +44 -56
- package/ol/controls/StopFinderControl.d.ts +21 -2
- package/ol/controls/StopFinderControl.js +22 -3
- package/ol/index.d.ts +0 -1
- package/ol/index.js +0 -1
- package/ol/layers/Layer.d.ts +17 -92
- package/ol/layers/Layer.js +17 -3
- package/ol/layers/MaplibreLayer.d.ts +47 -114
- package/ol/layers/MaplibreLayer.js +102 -46
- package/ol/layers/MaplibreStyleLayer.d.ts +67 -147
- package/ol/layers/MaplibreStyleLayer.js +170 -123
- package/ol/layers/RealtimeLayer.d.ts +85 -218
- package/ol/layers/RealtimeLayer.js +170 -181
- package/ol/layers/VectorLayer.d.ts +1 -2
- package/ol/layers/VectorLayer.js +7 -6
- package/ol/renderers/MaplibreLayerRenderer.d.ts +9 -0
- package/ol/renderers/MaplibreLayerRenderer.js +35 -137
- package/ol/renderers/MaplibreStyleLayerRenderer.js +2 -2
- package/ol/renderers/RealtimeLayerRenderer.d.ts +1 -1
- package/ol/renderers/RealtimeLayerRenderer.js +6 -31
- 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/package.json +40 -39
- package/setupTests.js +14 -0
- package/types/common.d.ts +4 -27
- package/types/realtime.d.ts +7 -2
- package/common/mixins/RealtimeLayerMixin.d.ts +0 -267
- package/common/mixins/RealtimeLayerMixin.js +0 -751
- package/ol/mixins/MobilityLayerMixin.d.ts +0 -96
- package/ol/mixins/MobilityLayerMixin.js +0 -6
- package/ol/mixins/PropertiesLayerMixin.d.ts +0 -136
- package/ol/mixins/PropertiesLayerMixin.js +0 -178
- package/ol/mixins/index.d.ts +0 -1
- package/ol/mixins/index.js +0 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FeatureState } from 'maplibre-gl';
|
|
2
2
|
import { Feature, Map } from 'ol';
|
|
3
3
|
import { Coordinate } from 'ol/coordinate';
|
|
4
|
+
import { EventsKey } from 'ol/events';
|
|
4
5
|
import { Layer } from 'ol/layer';
|
|
5
6
|
import { ObjectEvent } from 'ol/Object';
|
|
6
|
-
import { Source } from 'ol/source';
|
|
7
7
|
import { FilterFunction } from '../../common/typedefs';
|
|
8
8
|
import { LayerGetFeatureInfoResponse } from '../../types';
|
|
9
9
|
import MaplibreStyleLayerRenderer from '../renderers/MaplibreStyleLayerRenderer';
|
|
@@ -15,131 +15,81 @@ export type MaplibreStyleLayerOptions = {
|
|
|
15
15
|
maplibreLayer?: MaplibreLayer;
|
|
16
16
|
queryRenderedLayersFilter?: FilterFunction;
|
|
17
17
|
} & MaplibreLayerOptions;
|
|
18
|
-
declare const MaplibreStyleLayer_base: {
|
|
19
|
-
new (...args: any[]): {
|
|
20
|
-
olEventsKeys: import("ol/events").EventsKey[];
|
|
21
|
-
options?: import("../mixins/PropertiesLayerMixin").PropertiesLayerMixinOptions;
|
|
22
|
-
attachToMap(map: Map): void;
|
|
23
|
-
detachFromMap(): void;
|
|
24
|
-
flat(): any[];
|
|
25
|
-
onChildrenChange(oldValue: Layer[]): void;
|
|
26
|
-
setMapInternal: ((map: Map) => void) & ((map: import("ol/Map").default | null) => void);
|
|
27
|
-
children: Layer<Source, import("ol/renderer/Layer").default<any>>[];
|
|
28
|
-
get copyrights(): string;
|
|
29
|
-
set copyrights(newCopyrights: string | string[]);
|
|
30
|
-
disabled: boolean;
|
|
31
|
-
readonly group: string;
|
|
32
|
-
readonly hitTolerance: number;
|
|
33
|
-
readonly key: string;
|
|
34
|
-
readonly map: Map;
|
|
35
|
-
readonly name: string;
|
|
36
|
-
olLayer: Layer;
|
|
37
|
-
parent: Layer<Source, import("ol/renderer/Layer").default<any>>;
|
|
38
|
-
visible: boolean;
|
|
39
|
-
on: import("ol/layer/Layer").LayerOnSignature<import("ol/events").EventsKey>;
|
|
40
|
-
once: import("ol/layer/Layer").LayerOnSignature<import("ol/events").EventsKey>;
|
|
41
|
-
un: import("ol/layer/Layer").LayerOnSignature<void>;
|
|
42
|
-
render: (frameState: import("ol/Map").FrameState | null, target: HTMLElement) => HTMLElement | null;
|
|
43
|
-
getSource: () => Source | null;
|
|
44
|
-
getRenderSource: () => Source | null;
|
|
45
|
-
getFeatures: (pixel: import("ol/pixel").Pixel) => Promise<Array<import("ol/Feature").FeatureLike>>;
|
|
46
|
-
getData: (pixel: import("ol/pixel").Pixel) => Uint8ClampedArray | Uint8Array | Float32Array | DataView | null;
|
|
47
|
-
isVisible: (view?: import("ol").View | import("ol/View").ViewStateLayerStateExtent | undefined) => boolean;
|
|
48
|
-
getAttributions: (view?: import("ol").View | import("ol/View").ViewStateLayerStateExtent | undefined) => Array<string>;
|
|
49
|
-
unrender: () => void;
|
|
50
|
-
getDeclutter: () => string;
|
|
51
|
-
renderDeclutter: (frameState: import("ol/Map").FrameState, layerState: import("ol/layer/Layer").State) => void;
|
|
52
|
-
renderDeferred: (frameState: import("ol/Map").FrameState) => void;
|
|
53
|
-
getMapInternal: () => import("ol/Map").default | null;
|
|
54
|
-
setMap: (map: import("ol/Map").default | null) => void;
|
|
55
|
-
setSource: (source: Source | null) => void;
|
|
56
|
-
getRenderer: () => import("ol/renderer/Layer").default<any> | null;
|
|
57
|
-
hasRenderer: () => boolean;
|
|
58
|
-
getBackground: () => import("ol/layer/Base").BackgroundColor | false;
|
|
59
|
-
getClassName: () => string;
|
|
60
|
-
getLayerState: (managed?: boolean | undefined) => import("ol/layer/Layer").State;
|
|
61
|
-
getLayersArray: (array?: import("ol/layer/Layer").default<import("ol/source/Source").default, import("ol/renderer/Layer").default<any>>[] | undefined) => Array<import("ol/layer/Layer").default>;
|
|
62
|
-
getLayerStatesArray: (states?: import("ol/layer/Layer").State[] | undefined) => Array<import("ol/layer/Layer").State>;
|
|
63
|
-
getExtent: () => import("ol/extent").Extent | undefined;
|
|
64
|
-
getMaxResolution: () => number;
|
|
65
|
-
getMinResolution: () => number;
|
|
66
|
-
getMinZoom: () => number;
|
|
67
|
-
getMaxZoom: () => number;
|
|
68
|
-
getOpacity: () => number;
|
|
69
|
-
getSourceState: () => import("ol/source/Source").State;
|
|
70
|
-
getVisible: () => boolean;
|
|
71
|
-
getZIndex: () => number | undefined;
|
|
72
|
-
setBackground: (background?: import("ol/layer/Base").BackgroundColor | undefined) => void;
|
|
73
|
-
setExtent: (extent: import("ol/extent").Extent | undefined) => void;
|
|
74
|
-
setMaxResolution: (maxResolution: number) => void;
|
|
75
|
-
setMinResolution: (minResolution: number) => void;
|
|
76
|
-
setMaxZoom: (maxZoom: number) => void;
|
|
77
|
-
setMinZoom: (minZoom: number) => void;
|
|
78
|
-
setOpacity: (opacity: number) => void;
|
|
79
|
-
setVisible: (visible: boolean) => void;
|
|
80
|
-
setZIndex: (zindex: number) => void;
|
|
81
|
-
get: (key: string) => any;
|
|
82
|
-
getKeys: () => Array<string>;
|
|
83
|
-
getProperties: () => {
|
|
84
|
-
[x: string]: any;
|
|
85
|
-
};
|
|
86
|
-
getPropertiesInternal: () => {
|
|
87
|
-
[x: string]: any;
|
|
88
|
-
} | null;
|
|
89
|
-
hasProperties: () => boolean;
|
|
90
|
-
notify: (key: string, oldValue: any) => void;
|
|
91
|
-
addChangeListener: (key: string, listener: import("ol/events").Listener) => void;
|
|
92
|
-
removeChangeListener: (key: string, listener: import("ol/events").Listener) => void;
|
|
93
|
-
set: (key: string, value: any, silent?: boolean | undefined) => void;
|
|
94
|
-
setProperties: (values: {
|
|
95
|
-
[x: string]: any;
|
|
96
|
-
}, silent?: boolean | undefined) => void;
|
|
97
|
-
unset: (key: string, silent?: boolean | undefined) => void;
|
|
98
|
-
changed: () => void;
|
|
99
|
-
getRevision: () => number;
|
|
100
|
-
addEventListener: (type: string, listener: import("ol/events").Listener) => void;
|
|
101
|
-
dispatchEvent: (event: import("ol/events/Event").default | string) => boolean | undefined;
|
|
102
|
-
getListeners: (type: string) => Array<import("ol/events").Listener> | undefined;
|
|
103
|
-
hasListener: (type?: string | undefined) => boolean;
|
|
104
|
-
removeEventListener: (type: string, listener: import("ol/events").Listener) => void;
|
|
105
|
-
dispose: () => void;
|
|
106
|
-
};
|
|
107
|
-
} & typeof Layer;
|
|
108
18
|
/**
|
|
109
|
-
* Layer
|
|
19
|
+
* Layer that helps show/hide a specific subset of style layers of a [MaplibreLayer](./MaplibreLayer.js~MaplibreLayer.html).
|
|
110
20
|
*
|
|
111
21
|
* @example
|
|
112
|
-
* import {
|
|
22
|
+
* import { MaplibreLayer, MaplibreStyleLayer } from 'mobility-toolbox-js/ol';
|
|
113
23
|
*
|
|
114
|
-
* const maplibreLayer = new
|
|
115
|
-
*
|
|
24
|
+
* const maplibreLayer = new MaplibreLayer({
|
|
25
|
+
* apiKey: 'yourApiKey',
|
|
116
26
|
* });
|
|
117
27
|
*
|
|
118
|
-
* const layer = new
|
|
28
|
+
* const layer = new MaplibreStyleLayer({
|
|
119
29
|
* maplibreLayer: maplibreLayer,
|
|
120
|
-
*
|
|
30
|
+
* layersFilter: (layer) => {
|
|
31
|
+
* // show/hide only style layers related to stations
|
|
32
|
+
* return /station/.test(layer.id);
|
|
33
|
+
* },
|
|
121
34
|
* });
|
|
122
35
|
*
|
|
123
|
-
* @
|
|
36
|
+
* @see <a href="/example/ol-maplibre-style-layer">OpenLayers MaplibreStyle layer example</a>
|
|
124
37
|
* @extends {ol/layer/Layer~Layer}
|
|
38
|
+
* @public
|
|
125
39
|
*/
|
|
126
|
-
declare class MaplibreStyleLayer extends
|
|
40
|
+
declare class MaplibreStyleLayer extends Layer {
|
|
127
41
|
highlightedFeatures: Feature[];
|
|
42
|
+
olEventsKeys: EventsKey[];
|
|
128
43
|
selectedFeatures: Feature[];
|
|
44
|
+
get beforeId(): string;
|
|
45
|
+
set beforeId(newValue: string | undefined);
|
|
46
|
+
get layers(): maplibregl.AddLayerObject[];
|
|
47
|
+
set layers(newValue: maplibregl.AddLayerObject[]);
|
|
48
|
+
get layersFilter(): (layer: maplibregl.LayerSpecification) => boolean;
|
|
49
|
+
set layersFilter(newValue: (layer: maplibregl.LayerSpecification) => boolean);
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated Use MaplibreStyleLayer.maplibreLayer instead.
|
|
52
|
+
*/
|
|
53
|
+
get mapboxLayer(): MaplibreLayer | undefined;
|
|
54
|
+
get maplibreLayer(): MaplibreLayer;
|
|
55
|
+
set maplibreLayer(newValue: MaplibreLayer);
|
|
56
|
+
get queryRenderedLayersFilter(): (layer: maplibregl.LayerSpecification) => boolean;
|
|
57
|
+
set queryRenderedLayersFilter(newValue: (layer: maplibregl.LayerSpecification) => boolean);
|
|
58
|
+
get sources(): Record<string, maplibregl.SourceSpecification>;
|
|
59
|
+
set sources(newValue: Record<string, maplibregl.SourceSpecification>);
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated Use MaplibreStyleLayer.layer instead.
|
|
62
|
+
*/
|
|
63
|
+
get styleLayer(): maplibregl.AddLayerObject;
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated
|
|
66
|
+
*/
|
|
67
|
+
set styleLayer(newValue: maplibregl.AddLayerObject);
|
|
68
|
+
/**
|
|
69
|
+
* Apply visibility to style layers that fits the styleLayersFilter function.
|
|
70
|
+
*/
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated
|
|
73
|
+
*/
|
|
74
|
+
get styleLayers(): maplibregl.AddLayerObject[];
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated
|
|
77
|
+
*/
|
|
78
|
+
set styleLayers(newValue: maplibregl.AddLayerObject[]);
|
|
129
79
|
/**
|
|
130
80
|
* Constructor.
|
|
131
81
|
*
|
|
132
82
|
* @param {Object} options
|
|
133
|
-
* @param {
|
|
134
|
-
* @param {maplibregl.SourceSpecification[]} [options.sources] The source to add to the style on load.
|
|
83
|
+
* @param {string} [options.beforeId] The style layer id to use when the options.layers property is defined, unsused otherwise.
|
|
135
84
|
* @param {maplibregl.AddLayerObject[]} [options.layers] The layers to add to the style on load.
|
|
136
85
|
* @param {FilterFunction} [options.layersFilter] Filter function to decide which style layer to apply visiblity on. If not provided, the 'layers' property is used.
|
|
86
|
+
* @param {MaplibreLayer} [options.maplibreLayer] The MaplibreLayer to use.
|
|
137
87
|
* @param {FilterFunction} [options.queryRenderedLayersFilter] Filter function to decide which style layer are available for query.
|
|
88
|
+
* @param {{[id: string]:maplibregl.SourceSpecification}} [options.sources] The sources to add to the style on load.
|
|
89
|
+
* @public
|
|
138
90
|
*/
|
|
139
91
|
constructor(options?: MaplibreStyleLayerOptions);
|
|
140
|
-
/** @private */
|
|
141
92
|
addLayers(): void;
|
|
142
|
-
/** @private */
|
|
143
93
|
addSources(): void;
|
|
144
94
|
applyLayoutVisibility(evt?: ObjectEvent): void;
|
|
145
95
|
/**
|
|
@@ -149,9 +99,11 @@ declare class MaplibreStyleLayer extends MaplibreStyleLayer_base {
|
|
|
149
99
|
*/
|
|
150
100
|
attachToMap(map: Map): void;
|
|
151
101
|
/**
|
|
152
|
-
* Create a copy of the
|
|
153
|
-
*
|
|
154
|
-
* @
|
|
102
|
+
* Create a copy of the MaplibreStyleLayer.
|
|
103
|
+
*
|
|
104
|
+
* @param {Object} newOptions Options to override. See constructor.
|
|
105
|
+
* @return {MapboxStyleLayer} A MaplibreStyleLayer.
|
|
106
|
+
* @public
|
|
155
107
|
*/
|
|
156
108
|
clone(newOptions: MaplibreStyleLayerOptions): MaplibreStyleLayer;
|
|
157
109
|
createRenderer(): MaplibreStyleLayerRenderer;
|
|
@@ -164,33 +116,32 @@ declare class MaplibreStyleLayer extends MaplibreStyleLayer_base {
|
|
|
164
116
|
* Request feature information for a given coordinate.
|
|
165
117
|
* @param {ol/coordinate~Coordinate} coordinate Coordinate to request the information at.
|
|
166
118
|
* @return {Promise<FeatureInfo>} Promise with features, layer and coordinate.
|
|
119
|
+
* @deprecated Use getFeatureInfoAtCoordinate([layer], coordinate) from mobility-toolbox-ol package instead.
|
|
167
120
|
*/
|
|
168
121
|
getFeatureInfoAtCoordinate(coordinate: Coordinate): Promise<LayerGetFeatureInfoResponse>;
|
|
169
122
|
/**
|
|
170
123
|
* Highlight a list of features.
|
|
171
124
|
* @param {Array<ol/Feature~Feature>} [features=[]] Features to highlight.
|
|
172
|
-
* @
|
|
125
|
+
* @deprecated Use layer.setFeatureState(features, {hover: true|false}) instead.
|
|
173
126
|
*/
|
|
174
127
|
highlight(features?: Feature[]): void;
|
|
175
128
|
/**
|
|
176
129
|
* On Maplibre map load callback function. Add style layers and dynaimc filters.
|
|
177
|
-
* @private
|
|
178
130
|
*/
|
|
179
131
|
onLoad(): void;
|
|
180
|
-
/** @private */
|
|
181
132
|
removeLayers(): void;
|
|
182
|
-
/** @private */
|
|
183
133
|
removeSources(): void;
|
|
184
134
|
/**
|
|
185
135
|
* Select a list of features.
|
|
186
136
|
* @param {Array<ol/Feature~Feature>} [features=[]] Features to select.
|
|
187
|
-
* @
|
|
137
|
+
* @deprecated Use layer.setFeatureState(features, {selected: true|false}) instead.
|
|
188
138
|
*/
|
|
189
139
|
select(features?: Feature[]): void;
|
|
190
140
|
/**
|
|
191
|
-
* Set the feature state of the features.
|
|
192
|
-
*
|
|
193
|
-
* @param {
|
|
141
|
+
* Set the [feature state](https://maplibre.org/maplibre-style-spec/expressions/#feature-state) of the features.
|
|
142
|
+
*
|
|
143
|
+
* @param {ol/Feature~Feature[]} features
|
|
144
|
+
* @param {{[key: string]: any}} state The feature state
|
|
194
145
|
* @public
|
|
195
146
|
*/
|
|
196
147
|
setFeatureState(features: Feature[], state: FeatureState): void;
|
|
@@ -198,40 +149,9 @@ declare class MaplibreStyleLayer extends MaplibreStyleLayer_base {
|
|
|
198
149
|
* Set if features are hovered or not.
|
|
199
150
|
* @param {Array<ol/Feature~Feature>} features
|
|
200
151
|
* @param {boolean} state Is the feature hovered
|
|
201
|
-
* @
|
|
152
|
+
* @deprecated Use layer.setFeatureState(features, {hover: true|false}) instead.
|
|
202
153
|
*/
|
|
203
154
|
setHoverState(features: Feature[], state: boolean): void;
|
|
204
|
-
|
|
205
|
-
set beforeId(newValue: string[]);
|
|
206
|
-
get layers(): maplibregl.AddLayerObject[];
|
|
207
|
-
set layers(newValue: maplibregl.AddLayerObject[]);
|
|
208
|
-
get layersFilter(): (layer: maplibregl.LayerSpecification) => boolean;
|
|
209
|
-
set layersFilter(newValue: (layer: maplibregl.LayerSpecification) => boolean);
|
|
210
|
-
get mapboxLayer(): MaplibreLayer | undefined;
|
|
211
|
-
get maplibreLayer(): MaplibreLayer;
|
|
212
|
-
set maplibreLayer(newValue: MaplibreLayer);
|
|
213
|
-
get queryRenderedLayersFilter(): (layer: maplibregl.LayerSpecification) => boolean;
|
|
214
|
-
set queryRenderedLayersFilter(newValue: (layer: maplibregl.LayerSpecification) => boolean);
|
|
215
|
-
get sources(): Record<string, maplibregl.SourceSpecification>;
|
|
216
|
-
set sources(newValue: Record<string, maplibregl.SourceSpecification>);
|
|
217
|
-
/**
|
|
218
|
-
* @deprecated
|
|
219
|
-
*/
|
|
220
|
-
get styleLayer(): maplibregl.AddLayerObject;
|
|
221
|
-
/**
|
|
222
|
-
* @deprecated
|
|
223
|
-
*/
|
|
224
|
-
set styleLayer(newValue: maplibregl.AddLayerObject);
|
|
225
|
-
/**
|
|
226
|
-
* Apply visibility to style layers that fits the styleLayersFilter function.
|
|
227
|
-
*/
|
|
228
|
-
/**
|
|
229
|
-
* @deprecated
|
|
230
|
-
*/
|
|
231
|
-
get styleLayers(): maplibregl.AddLayerObject[];
|
|
232
|
-
/**
|
|
233
|
-
* @deprecated
|
|
234
|
-
*/
|
|
235
|
-
set styleLayers(newValue: maplibregl.AddLayerObject[]);
|
|
155
|
+
setMapInternal(map: Map): void;
|
|
236
156
|
}
|
|
237
157
|
export default MaplibreStyleLayer;
|