mobility-toolbox-js 3.0.0-beta.2 → 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/HttpAPI.d.ts +20 -0
- package/api/HttpAPI.js +0 -11
- package/api/RealtimeAPI.d.ts +404 -0
- package/api/RealtimeAPI.js +342 -276
- package/api/RoutingAPI.d.ts +47 -0
- package/api/RoutingAPI.js +17 -7
- package/api/StopsAPI.d.ts +44 -0
- package/api/StopsAPI.js +16 -10
- package/api/WebSocketAPI.d.ts +147 -0
- package/api/WebSocketAPI.js +164 -164
- package/api/index.d.ts +3 -0
- package/api/index.js +1 -1
- package/api/typedefs.d.ts +76 -0
- package/api/typedefs.js +27 -42
- package/common/controls/StopFinderControlCommon.d.ts +53 -0
- package/common/controls/StopFinderControlCommon.js +31 -31
- package/common/index.d.ts +2 -0
- package/common/index.js +1 -1
- package/common/mixins/RealtimeLayerMixin.d.ts +267 -0
- package/common/mixins/RealtimeLayerMixin.js +401 -393
- package/common/styles/index.d.ts +4 -0
- package/common/styles/realtimeDefaultStyle.d.ts +36 -0
- package/common/styles/realtimeDefaultStyle.js +6 -6
- package/common/styles/realtimeDelayStyle.d.ts +12 -0
- package/common/styles/realtimeHeadingStyle.d.ts +12 -0
- package/common/styles/realtimeHeadingStyle.js +5 -5
- package/common/styles/realtimeSimpleStyle.d.ts +4 -0
- package/common/typedefs.d.ts +219 -0
- package/common/typedefs.js +7 -1
- package/common/utils/compareDepartures.d.ts +10 -0
- package/common/utils/compareDepartures.js +2 -2
- package/common/utils/constants.d.ts +5 -0
- package/common/utils/createCanvas.d.ts +10 -0
- package/common/utils/createDefaultCopyrightElt.d.ts +5 -0
- package/common/utils/createDefaultStopFinderElt.d.ts +5 -0
- package/common/utils/createRealtimeFilters.d.ts +12 -0
- package/common/utils/debounceDeparturesMessages.d.ts +12 -0
- package/common/utils/debounceWebsocketMessages.d.ts +11 -0
- package/common/utils/getLayersAsFlatArray.d.ts +3 -0
- package/common/utils/getLayersAsFlatArray.js +5 -1
- package/common/utils/getMapGlCopyrights.d.ts +17 -0
- package/common/utils/getMapGlCopyrights.js +3 -3
- package/common/utils/getRealtimeModeSuffix.d.ts +10 -0
- package/common/utils/getRealtimeModeSuffix.js +1 -0
- package/common/utils/getUrlWithParams.d.ts +8 -0
- package/common/utils/getVehiclePosition.d.ts +17 -0
- package/common/utils/getVehiclePosition.js +9 -3
- package/common/utils/index.d.ts +16 -0
- package/common/utils/realtimeConfig.d.ts +64 -0
- package/common/utils/removeDuplicate.d.ts +9 -0
- package/common/utils/renderTrajectories.d.ts +16 -0
- package/common/utils/renderTrajectories.js +6 -6
- package/common/utils/sortAndFilterDepartures.d.ts +15 -0
- package/common/utils/sortAndFilterDepartures.js +1 -1
- package/common/utils/sortByDelay.d.ts +3 -0
- package/common/utils/sortByDelay.js +5 -1
- package/common/utils/timeUtils.d.ts +23 -0
- package/common/utils/toMercatorExtent.d.ts +5 -0
- package/iife.d.ts +2 -0
- package/index.d.ts +9 -0
- package/maplibre/controls/CopyrightControl.d.ts +35 -0
- package/maplibre/controls/index.d.ts +1 -0
- package/maplibre/index.d.ts +5 -0
- package/maplibre/layers/Layer.d.ts +28 -0
- package/maplibre/layers/Layer.js +1 -1
- package/maplibre/layers/RealtimeLayer.d.ts +181 -0
- package/maplibre/layers/RealtimeLayer.js +29 -5
- package/maplibre/layers/index.d.ts +2 -0
- package/maplibre/utils/getMercatorResolution.d.ts +7 -0
- package/maplibre/utils/getSourceCoordinates.d.ts +7 -0
- package/maplibre/utils/getSourceCoordinates.js +5 -5
- package/maplibre/utils/index.d.ts +2 -0
- package/mbt.js +22103 -14430
- package/mbt.js.map +4 -4
- package/mbt.min.js +61 -58
- package/mbt.min.js.map +4 -4
- package/ol/controls/CopyrightControl.d.ts +31 -0
- package/ol/controls/CopyrightControl.js +18 -8
- package/ol/controls/RoutingControl.d.ts +202 -0
- package/ol/controls/RoutingControl.js +220 -219
- package/ol/controls/StopFinderControl.d.ts +37 -0
- package/ol/controls/StopFinderControl.js +4 -1
- package/ol/controls/index.d.ts +3 -0
- package/ol/index.d.ts +7 -0
- package/ol/index.js +1 -0
- package/ol/layers/Layer.d.ts +101 -0
- package/ol/layers/Layer.js +25 -0
- package/ol/layers/MaplibreLayer.d.ts +160 -0
- package/ol/layers/MaplibreLayer.js +97 -27
- package/ol/layers/MaplibreStyleLayer.d.ts +237 -0
- package/ol/layers/MaplibreStyleLayer.js +291 -267
- package/ol/layers/RealtimeLayer.d.ts +283 -0
- package/ol/layers/RealtimeLayer.js +143 -128
- package/ol/layers/VectorLayer.d.ts +18 -0
- package/ol/layers/VectorLayer.js +31 -0
- package/ol/layers/index.d.ts +5 -0
- package/ol/layers/index.js +3 -0
- package/ol/mixins/MobilityLayerMixin.d.ts +96 -0
- package/ol/mixins/MobilityLayerMixin.js +1 -4
- package/ol/mixins/PropertiesLayerMixin.d.ts +135 -0
- package/ol/mixins/PropertiesLayerMixin.js +112 -140
- package/ol/mixins/index.d.ts +1 -0
- package/ol/mixins/index.js +2 -0
- package/ol/renderers/MaplibreLayerRenderer.d.ts +0 -0
- package/ol/renderers/MaplibreLayerRenderer.js +142 -114
- package/ol/renderers/MaplibreStyleLayerRenderer.d.ts +20 -0
- package/ol/renderers/MaplibreStyleLayerRenderer.js +20 -23
- package/ol/renderers/RealtimeLayerRenderer.d.ts +22 -0
- package/ol/renderers/RealtimeLayerRenderer.js +58 -53
- package/ol/styles/fullTrajectoryDelayStyle.d.ts +6 -0
- package/ol/styles/fullTrajectoryStyle.d.ts +5 -0
- package/ol/styles/index.d.ts +3 -0
- package/ol/styles/routingStyle.d.ts +4 -0
- package/ol/utils/getFeatureInfoAtCoordinate.d.ts +8 -0
- package/ol/utils/getFeatureInfoAtCoordinate.js +12 -18
- package/ol/utils/index.d.ts +1 -0
- package/package.json +31 -31
- package/setupTests.d.ts +1 -0
- package/setupTests.js +3 -4
- package/types/common.d.ts +55 -48
- package/types/index.d.ts +1 -1
- package/types/realtime.d.ts +91 -93
- package/types/routing.d.ts +60 -60
- package/types/stops.d.ts +62 -62
- package/ol/layers/MapGlLayer.js +0 -142
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { FeatureState } from 'maplibre-gl';
|
|
2
|
+
import { Feature, Map } from 'ol';
|
|
3
|
+
import { Coordinate } from 'ol/coordinate';
|
|
4
|
+
import { Layer } from 'ol/layer';
|
|
5
|
+
import { ObjectEvent } from 'ol/Object';
|
|
6
|
+
import { Source } from 'ol/source';
|
|
7
|
+
import { FilterFunction } from '../../common/typedefs';
|
|
8
|
+
import { LayerGetFeatureInfoResponse } from '../../types';
|
|
9
|
+
import MaplibreStyleLayerRenderer from '../renderers/MaplibreStyleLayerRenderer';
|
|
10
|
+
import MaplibreLayer, { MaplibreLayerOptions } from './MaplibreLayer';
|
|
11
|
+
export type MaplibreStyleLayerOptions = {
|
|
12
|
+
beforeId?: string;
|
|
13
|
+
layers?: maplibregl.AddLayerObject[];
|
|
14
|
+
layersFilter?: FilterFunction;
|
|
15
|
+
maplibreLayer?: MaplibreLayer;
|
|
16
|
+
queryRenderedLayersFilter?: FilterFunction;
|
|
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
|
+
/**
|
|
109
|
+
* Layer for visualizing a specific set of layer from a MapboxLayer.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* import { MapboxLayer, MapboxStyleLayer } from 'mobility-toolbox-js/ol';
|
|
113
|
+
*
|
|
114
|
+
* const maplibreLayer = new MapboxLayer({
|
|
115
|
+
* url: 'https://maps.geops.io/styles/travic_v2/style.json?key=[yourApiKey]',
|
|
116
|
+
* });
|
|
117
|
+
*
|
|
118
|
+
* const layer = new MapboxStyleLayer({
|
|
119
|
+
* maplibreLayer: maplibreLayer,
|
|
120
|
+
* styleLayersFilter: () => {},
|
|
121
|
+
* });
|
|
122
|
+
*
|
|
123
|
+
* @classproperty {ol/Map~Map} map - The map where the layer is displayed.
|
|
124
|
+
* @extends {ol/layer/Layer~Layer}
|
|
125
|
+
*/
|
|
126
|
+
declare class MaplibreStyleLayer extends MaplibreStyleLayer_base {
|
|
127
|
+
highlightedFeatures: Feature[];
|
|
128
|
+
selectedFeatures: Feature[];
|
|
129
|
+
/**
|
|
130
|
+
* Constructor.
|
|
131
|
+
*
|
|
132
|
+
* @param {Object} options
|
|
133
|
+
* @param {MapboxLayer} [options.maplibreLayer] The MaplibreLayer to use.
|
|
134
|
+
* @param {maplibregl.SourceSpecification[]} [options.sources] The source to add to the style on load.
|
|
135
|
+
* @param {maplibregl.AddLayerObject[]} [options.layers] The layers to add to the style on load.
|
|
136
|
+
* @param {FilterFunction} [options.layersFilter] Filter function to decide which style layer to apply visiblity on. If not provided, the 'layers' property is used.
|
|
137
|
+
* @param {FilterFunction} [options.queryRenderedLayersFilter] Filter function to decide which style layer are available for query.
|
|
138
|
+
*/
|
|
139
|
+
constructor(options?: MaplibreStyleLayerOptions);
|
|
140
|
+
/** @private */
|
|
141
|
+
addLayers(): void;
|
|
142
|
+
/** @private */
|
|
143
|
+
addSources(): void;
|
|
144
|
+
applyLayoutVisibility(evt?: ObjectEvent): void;
|
|
145
|
+
/**
|
|
146
|
+
* Initialize the layer.
|
|
147
|
+
* @param {ol/Map~Map} map the Maplibre map.
|
|
148
|
+
* @override
|
|
149
|
+
*/
|
|
150
|
+
attachToMap(map: Map): void;
|
|
151
|
+
/**
|
|
152
|
+
* Create a copy of the MapboxStyleLayer.
|
|
153
|
+
* @param {Object} newOptions Options to override.
|
|
154
|
+
* @return {MapboxStyleLayer} A MapboxStyleLayer.
|
|
155
|
+
*/
|
|
156
|
+
clone(newOptions: MaplibreStyleLayerOptions): MaplibreStyleLayer;
|
|
157
|
+
createRenderer(): MaplibreStyleLayerRenderer;
|
|
158
|
+
/**
|
|
159
|
+
* Terminate the layer.
|
|
160
|
+
* @override
|
|
161
|
+
*/
|
|
162
|
+
detachFromMap(): void;
|
|
163
|
+
/**
|
|
164
|
+
* Request feature information for a given coordinate.
|
|
165
|
+
* @param {ol/coordinate~Coordinate} coordinate Coordinate to request the information at.
|
|
166
|
+
* @return {Promise<FeatureInfo>} Promise with features, layer and coordinate.
|
|
167
|
+
*/
|
|
168
|
+
getFeatureInfoAtCoordinate(coordinate: Coordinate): Promise<LayerGetFeatureInfoResponse>;
|
|
169
|
+
/**
|
|
170
|
+
* Highlight a list of features.
|
|
171
|
+
* @param {Array<ol/Feature~Feature>} [features=[]] Features to highlight.
|
|
172
|
+
* @private
|
|
173
|
+
*/
|
|
174
|
+
highlight(features?: Feature[]): void;
|
|
175
|
+
/**
|
|
176
|
+
* On Maplibre map load callback function. Add style layers and dynaimc filters.
|
|
177
|
+
* @private
|
|
178
|
+
*/
|
|
179
|
+
onLoad(): void;
|
|
180
|
+
/** @private */
|
|
181
|
+
removeLayers(): void;
|
|
182
|
+
/** @private */
|
|
183
|
+
removeSources(): void;
|
|
184
|
+
/**
|
|
185
|
+
* Select a list of features.
|
|
186
|
+
* @param {Array<ol/Feature~Feature>} [features=[]] Features to select.
|
|
187
|
+
* @private
|
|
188
|
+
*/
|
|
189
|
+
select(features?: Feature[]): void;
|
|
190
|
+
/**
|
|
191
|
+
* Set the feature state of the features.
|
|
192
|
+
* @param {Array<ol/Feature~Feature>} features
|
|
193
|
+
* @param {{[key:string]:boolean}} state The feature state
|
|
194
|
+
* @public
|
|
195
|
+
*/
|
|
196
|
+
setFeatureState(features: Feature[], state: FeatureState): void;
|
|
197
|
+
/**
|
|
198
|
+
* Set if features are hovered or not.
|
|
199
|
+
* @param {Array<ol/Feature~Feature>} features
|
|
200
|
+
* @param {boolean} state Is the feature hovered
|
|
201
|
+
* @private
|
|
202
|
+
*/
|
|
203
|
+
setHoverState(features: Feature[], state: boolean): void;
|
|
204
|
+
get beforeId(): string;
|
|
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[]);
|
|
236
|
+
}
|
|
237
|
+
export default MaplibreStyleLayer;
|