@maptiler/sdk 3.9.0-rc.4 → 3.9.0-rc.5
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/dist/eslint.mjs +133 -0
- package/dist/maptiler-sdk.d.ts +2 -0
- package/dist/maptiler-sdk.mjs +14208 -0
- package/dist/maptiler-sdk.mjs.map +1 -0
- package/dist/src/ColorRamp.d.ts +359 -0
- package/dist/src/ImageViewer/ImageViewer.d.ts +408 -0
- package/dist/src/ImageViewer/ImageViewerMarker.d.ts +236 -0
- package/dist/src/ImageViewer/events.d.ts +47 -0
- package/dist/src/ImageViewer/index.d.ts +5 -0
- package/dist/src/ImageViewer/monkeyPatchML.d.ts +11 -0
- package/dist/src/ImageViewer/symbols.d.ts +2 -0
- package/dist/src/MLAdapters/AttributionControl.d.ts +5 -0
- package/dist/src/MLAdapters/BoxZoomHandler.d.ts +7 -0
- package/dist/src/MLAdapters/CanvasSource.d.ts +5 -0
- package/dist/src/MLAdapters/CooperativeGesturesHandler.d.ts +5 -0
- package/dist/src/MLAdapters/FullscreenControl.d.ts +5 -0
- package/dist/src/MLAdapters/GeoJSONSource.d.ts +5 -0
- package/dist/src/MLAdapters/GeolocateControl.d.ts +5 -0
- package/dist/src/MLAdapters/ImageSource.d.ts +5 -0
- package/dist/src/MLAdapters/KeyboardHandler.d.ts +5 -0
- package/dist/src/MLAdapters/LogoControl.d.ts +5 -0
- package/dist/src/MLAdapters/MapMouseEvent.d.ts +5 -0
- package/dist/src/MLAdapters/MapTouchEvent.d.ts +5 -0
- package/dist/src/MLAdapters/MapWheelEvent.d.ts +5 -0
- package/dist/src/MLAdapters/Marker.d.ts +5 -0
- package/dist/src/MLAdapters/NavigationControl.d.ts +5 -0
- package/dist/src/MLAdapters/Popup.d.ts +5 -0
- package/dist/src/MLAdapters/RasterDEMTileSource.d.ts +5 -0
- package/dist/src/MLAdapters/RasterTileSource.d.ts +5 -0
- package/dist/src/MLAdapters/ScaleControl.d.ts +5 -0
- package/dist/src/MLAdapters/ScrollZoomHandler.d.ts +5 -0
- package/dist/src/MLAdapters/Style.d.ts +5 -0
- package/dist/src/MLAdapters/TerrainControl.d.ts +5 -0
- package/dist/src/MLAdapters/TwoFingersTouchPitchHandler.d.ts +5 -0
- package/dist/src/MLAdapters/VectorTileSource.d.ts +5 -0
- package/dist/src/MLAdapters/VideoSource.d.ts +5 -0
- package/dist/src/Map.d.ts +470 -0
- package/dist/src/Point.d.ts +177 -0
- package/dist/src/Telemetry.d.ts +23 -0
- package/dist/src/caching.d.ts +4 -0
- package/dist/src/config.d.ts +85 -0
- package/dist/src/constants/defaults.d.ts +15 -0
- package/dist/src/controls/ImageViewerFitImageToBoundsControl.d.ts +13 -0
- package/dist/src/controls/MaptilerCustomControl.d.ts +17 -0
- package/dist/src/controls/MaptilerExternalControl.d.ts +25 -0
- package/dist/src/controls/MaptilerGeolocateControl.d.ts +21 -0
- package/dist/src/controls/MaptilerLogoControl.d.ts +19 -0
- package/dist/src/controls/MaptilerNavigationControl.d.ts +17 -0
- package/dist/src/controls/MaptilerProjectionControl.d.ts +15 -0
- package/dist/src/controls/MaptilerTerrainControl.d.ts +17 -0
- package/dist/src/controls/Minimap.d.ts +57 -0
- package/dist/src/controls/index.d.ts +8 -0
- package/dist/src/converters/index.d.ts +1 -0
- package/dist/src/converters/xml.d.ts +54 -0
- package/dist/src/custom-layers/CubemapLayer/CubemapLayer.d.ts +239 -0
- package/dist/src/custom-layers/CubemapLayer/constants.d.ts +3 -0
- package/dist/src/custom-layers/CubemapLayer/index.d.ts +2 -0
- package/dist/src/custom-layers/CubemapLayer/loadCubemapTexture.d.ts +42 -0
- package/dist/src/custom-layers/CubemapLayer/types.d.ts +67 -0
- package/dist/src/custom-layers/RadialGradientLayer/RadialGradientLayer.d.ts +149 -0
- package/dist/src/custom-layers/RadialGradientLayer/index.d.ts +2 -0
- package/dist/src/custom-layers/RadialGradientLayer/types.d.ts +50 -0
- package/dist/src/custom-layers/extractCustomLayerStyle.d.ts +17 -0
- package/dist/src/custom-layers/index.d.ts +6 -0
- package/dist/src/helpers/index.d.ts +5 -0
- package/dist/src/helpers/screenshot.d.ts +18 -0
- package/dist/src/helpers/stylehelper.d.ts +28 -0
- package/dist/src/helpers/vectorlayerhelpers.d.ts +508 -0
- package/dist/src/index.d.ts +91 -0
- package/dist/src/language.d.ts +107 -0
- package/dist/src/mapstyle.d.ts +18 -0
- package/dist/src/tools.d.ts +84 -0
- package/dist/src/types.d.ts +1 -0
- package/dist/src/utils/dom.d.ts +2 -0
- package/dist/src/utils/errors.d.ts +5 -0
- package/dist/src/utils/geo-utils.d.ts +6 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/math-utils.d.ts +8 -0
- package/dist/src/utils/object.d.ts +1 -0
- package/dist/src/utils/webgl-utils.d.ts +49 -0
- package/package.json +2 -2
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is TypeScript rewrite of the Point class to use instead of the version imported in MapLibre.
|
|
3
|
+
* It also uses a class instead of prototypes.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Row major 2x2 matrix
|
|
7
|
+
*/
|
|
8
|
+
export type Matrix2 = [number, number, number, number];
|
|
9
|
+
/**
|
|
10
|
+
* a point
|
|
11
|
+
*/
|
|
12
|
+
export declare class Point {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
constructor(x: number, y: number);
|
|
16
|
+
private _matMult;
|
|
17
|
+
private _add;
|
|
18
|
+
private _sub;
|
|
19
|
+
private _mult;
|
|
20
|
+
private _div;
|
|
21
|
+
private _multByPoint;
|
|
22
|
+
private _divByPoint;
|
|
23
|
+
private _unit;
|
|
24
|
+
private _perp;
|
|
25
|
+
private _rotate;
|
|
26
|
+
private _rotateAround;
|
|
27
|
+
private _round;
|
|
28
|
+
/**
|
|
29
|
+
* Clone this point, returning a new point that can be modified
|
|
30
|
+
* without affecting the old one.
|
|
31
|
+
* @return {Point} the clone
|
|
32
|
+
*/
|
|
33
|
+
clone(): Point;
|
|
34
|
+
/**
|
|
35
|
+
* Add this point's x & y coordinates to another point,
|
|
36
|
+
* yielding a new point.
|
|
37
|
+
* @param {Point} p the other point
|
|
38
|
+
* @return {Point} output point
|
|
39
|
+
*/
|
|
40
|
+
add(p: Point): Point;
|
|
41
|
+
/**
|
|
42
|
+
* Subtract this point's x & y coordinates to from point,
|
|
43
|
+
* yielding a new point.
|
|
44
|
+
* @param {Point} p the other point
|
|
45
|
+
* @return {Point} output point
|
|
46
|
+
*/
|
|
47
|
+
sub(p: Point): Point;
|
|
48
|
+
/**
|
|
49
|
+
* Multiply this point's x & y coordinates by point,
|
|
50
|
+
* yielding a new point.
|
|
51
|
+
* @param {Point} p the other point
|
|
52
|
+
* @return {Point} output point
|
|
53
|
+
*/
|
|
54
|
+
multByPoint(p: Point): Point;
|
|
55
|
+
/**
|
|
56
|
+
* Divide this point's x & y coordinates by point,
|
|
57
|
+
* yielding a new point.
|
|
58
|
+
* @param {Point} p the other point
|
|
59
|
+
* @return {Point} output point
|
|
60
|
+
*/
|
|
61
|
+
divByPoint(p: Point): Point;
|
|
62
|
+
/**
|
|
63
|
+
* Multiply this point's x & y coordinates by a factor,
|
|
64
|
+
* yielding a new point.
|
|
65
|
+
* @param {Number} k factor
|
|
66
|
+
* @return {Point} output point
|
|
67
|
+
*/
|
|
68
|
+
mult(k: number): Point;
|
|
69
|
+
/**
|
|
70
|
+
* Divide this point's x & y coordinates by a factor,
|
|
71
|
+
* yielding a new point.
|
|
72
|
+
* @param {Point} k factor
|
|
73
|
+
* @return {Point} output point
|
|
74
|
+
*/
|
|
75
|
+
div(k: number): Point;
|
|
76
|
+
/**
|
|
77
|
+
* Rotate this point around the 0, 0 origin by an angle a,
|
|
78
|
+
* given in radians
|
|
79
|
+
* @param {Number} a angle to rotate around, in radians
|
|
80
|
+
* @return {Point} output point
|
|
81
|
+
*/
|
|
82
|
+
rotate(a: number): Point;
|
|
83
|
+
/**
|
|
84
|
+
* Rotate this point around p point by an angle a,
|
|
85
|
+
* given in radians
|
|
86
|
+
* @param {Number} a angle to rotate around, in radians
|
|
87
|
+
* @param {Point} p Point to rotate around
|
|
88
|
+
* @return {Point} output point
|
|
89
|
+
*/
|
|
90
|
+
rotateAround(a: number, p: Point): Point;
|
|
91
|
+
/**
|
|
92
|
+
* Multiply this point by a 4x1 transformation matrix
|
|
93
|
+
* @param {Array<Number>} m transformation matrix
|
|
94
|
+
* @return {Point} output point
|
|
95
|
+
*/
|
|
96
|
+
matMult(m: Matrix2): Point;
|
|
97
|
+
/**
|
|
98
|
+
* Calculate this point but as a unit vector from 0, 0, meaning
|
|
99
|
+
* that the distance from the resulting point to the 0, 0
|
|
100
|
+
* coordinate will be equal to 1 and the angle from the resulting
|
|
101
|
+
* point to the 0, 0 coordinate will be the same as before.
|
|
102
|
+
* @return {Point} unit vector point
|
|
103
|
+
*/
|
|
104
|
+
unit(): Point;
|
|
105
|
+
/**
|
|
106
|
+
* Compute a perpendicular point, where the new y coordinate
|
|
107
|
+
* is the old x coordinate and the new x coordinate is the old y
|
|
108
|
+
* coordinate multiplied by -1
|
|
109
|
+
* @return {Point} perpendicular point
|
|
110
|
+
*/
|
|
111
|
+
perp(): Point;
|
|
112
|
+
/**
|
|
113
|
+
* Return a version of this point with the x & y coordinates
|
|
114
|
+
* rounded to integers.
|
|
115
|
+
* @return {Point} rounded point
|
|
116
|
+
*/
|
|
117
|
+
round(): Point;
|
|
118
|
+
/**
|
|
119
|
+
* Return the magnitude of this point: this is the Euclidean
|
|
120
|
+
* distance from the 0, 0 coordinate to this point's x and y
|
|
121
|
+
* coordinates.
|
|
122
|
+
* @return {Number} magnitude
|
|
123
|
+
*/
|
|
124
|
+
mag(): number;
|
|
125
|
+
/**
|
|
126
|
+
* Judge whether this point is equal to another point, returning
|
|
127
|
+
* true or false.
|
|
128
|
+
* @param {Point} other the other point
|
|
129
|
+
* @return {boolean} whether the points are equal
|
|
130
|
+
*/
|
|
131
|
+
equals(other: Point): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Calculate the distance from this point to another point
|
|
134
|
+
* @param {Point} p the other point
|
|
135
|
+
* @return {Number} distance
|
|
136
|
+
*/
|
|
137
|
+
dist(p: Point): number;
|
|
138
|
+
/**
|
|
139
|
+
* Calculate the distance from this point to another point,
|
|
140
|
+
* without the square root step. Useful if you're comparing
|
|
141
|
+
* relative distances.
|
|
142
|
+
* @param {Point} p the other point
|
|
143
|
+
* @return {Number} distance
|
|
144
|
+
*/
|
|
145
|
+
distSqr(p: Point): number;
|
|
146
|
+
/**
|
|
147
|
+
* Get the angle from the 0, 0 coordinate to this point, in radians
|
|
148
|
+
* coordinates.
|
|
149
|
+
* @return {Number} angle
|
|
150
|
+
*/
|
|
151
|
+
angle(): number;
|
|
152
|
+
/**
|
|
153
|
+
* Get the angle from this point to another point, in radians
|
|
154
|
+
* @param {Point} b the other point
|
|
155
|
+
* @return {Number} angle
|
|
156
|
+
*/
|
|
157
|
+
angleTo(b: Point): number;
|
|
158
|
+
/**
|
|
159
|
+
* Get the angle between this point and another point, in radians
|
|
160
|
+
* @param {Point} b the other point
|
|
161
|
+
* @return {Number} angle
|
|
162
|
+
*/
|
|
163
|
+
angleWith(b: Point): number;
|
|
164
|
+
angleWithSep(x: number, y: number): number;
|
|
165
|
+
/**
|
|
166
|
+
* Construct a point from an array if necessary, otherwise if the input
|
|
167
|
+
* is already a Point, or an unknown type, return it unchanged
|
|
168
|
+
* @param {Array<number> | Point} a any kind of input value
|
|
169
|
+
* @return {Point} constructed point, or passed-through value.
|
|
170
|
+
* @example
|
|
171
|
+
* // this
|
|
172
|
+
* var point = Point.convert([0, 1]);
|
|
173
|
+
* // is equivalent to
|
|
174
|
+
* var point = new Point(0, 1);
|
|
175
|
+
*/
|
|
176
|
+
static convert(a: Point | Array<number>): Point;
|
|
177
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Map as MapSDK } from './Map';
|
|
2
|
+
/**
|
|
3
|
+
* A Telemetry instance sends some usage and merics to a dedicated endpoint at MapTiler Cloud.
|
|
4
|
+
*/
|
|
5
|
+
export declare class Telemetry {
|
|
6
|
+
private map;
|
|
7
|
+
private registeredModules;
|
|
8
|
+
private viewerType;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param map : a Map instance
|
|
12
|
+
* @param delay : a delay in milliseconds after which the payload is sent to MapTiler cloud (cannot be less than 1000ms)
|
|
13
|
+
*/
|
|
14
|
+
constructor(map: MapSDK, delay?: number);
|
|
15
|
+
/**
|
|
16
|
+
* Register a module to the telemetry system of the SDK.
|
|
17
|
+
* The arguments `name` and `version` likely come from the package.json
|
|
18
|
+
* of each module.
|
|
19
|
+
*/
|
|
20
|
+
registerModule(name: string, version: string): void;
|
|
21
|
+
registerViewerType(viewerType?: string): void;
|
|
22
|
+
private preparePayload;
|
|
23
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { default as EventEmitter } from 'events';
|
|
2
|
+
import { LanguageInfo } from './language';
|
|
3
|
+
import { FetchFunction } from '@maptiler/client';
|
|
4
|
+
import { Unit } from './types';
|
|
5
|
+
export declare const MAPTILER_SESSION_ID: string;
|
|
6
|
+
/**
|
|
7
|
+
* Configuration class for the SDK
|
|
8
|
+
*/
|
|
9
|
+
declare class SdkConfig extends EventEmitter {
|
|
10
|
+
/**
|
|
11
|
+
* The primary language. By default, the language of the web browser is used.
|
|
12
|
+
*/
|
|
13
|
+
primaryLanguage: LanguageInfo;
|
|
14
|
+
/**
|
|
15
|
+
* The secondary language, to overwrite the default language defined in the map style.
|
|
16
|
+
* This settings is highly dependant on the style compatibility and may not work in most cases.
|
|
17
|
+
*/
|
|
18
|
+
secondaryLanguage?: LanguageInfo;
|
|
19
|
+
/**
|
|
20
|
+
* Setting on whether of not the SDK runs with a session logic.
|
|
21
|
+
* A "session" is started at the initialization of the SDK and finished when the browser
|
|
22
|
+
* page is being refreshed.
|
|
23
|
+
* When `session` is enabled (default: true), the extra URL param `mtsid` is added to queries
|
|
24
|
+
* on the MapTiler Cloud API. This allows MapTiler to enable "session based billing".
|
|
25
|
+
*/
|
|
26
|
+
session: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Enables client-side caching of requests for tiles and fonts.
|
|
29
|
+
* The cached requests persist multiple browser sessions and will be reused when possible.
|
|
30
|
+
* Works only for requests to the MapTiler Cloud API when sessions are enabled.
|
|
31
|
+
*/
|
|
32
|
+
caching: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Telemetry is enabled by default but can be opted-out by setting this value to `false`.
|
|
35
|
+
* The telemetry is very valuable to the team at MapTiler because it shares information
|
|
36
|
+
* about where to add the extra effort. It also helps spotting some incompatibility issues
|
|
37
|
+
* that may arise between the SDK and a specific version of a module.
|
|
38
|
+
*
|
|
39
|
+
* It consists in sending metrics about usage of the following features:
|
|
40
|
+
* - SDK version [string]
|
|
41
|
+
* - API key [string]
|
|
42
|
+
* - MapTiler sesion ID (if opted-in) [string]
|
|
43
|
+
* - if tile caching is enabled [boolean]
|
|
44
|
+
* - if language specified at initialization [boolean]
|
|
45
|
+
* - if terrain is activated at initialization [boolean]
|
|
46
|
+
* - if globe projection is activated at initialization [boolean]
|
|
47
|
+
*
|
|
48
|
+
* In addition, each official module will be added to a list, alongside its version number.
|
|
49
|
+
*/
|
|
50
|
+
telemetry: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Unit to be used
|
|
53
|
+
*/
|
|
54
|
+
private _unit;
|
|
55
|
+
/**
|
|
56
|
+
* MapTiler Cloud API key
|
|
57
|
+
*/
|
|
58
|
+
private _apiKey;
|
|
59
|
+
/**
|
|
60
|
+
* Set the unit system
|
|
61
|
+
*/
|
|
62
|
+
set unit(u: Unit);
|
|
63
|
+
/**
|
|
64
|
+
* Get the unit system
|
|
65
|
+
*/
|
|
66
|
+
get unit(): Unit;
|
|
67
|
+
/**
|
|
68
|
+
* Set the MapTiler Cloud API key
|
|
69
|
+
*/
|
|
70
|
+
set apiKey(k: string);
|
|
71
|
+
/**
|
|
72
|
+
* Get the MapTiler Cloud API key
|
|
73
|
+
*/
|
|
74
|
+
get apiKey(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Set a the custom fetch function to replace the default one
|
|
77
|
+
*/
|
|
78
|
+
set fetch(f: FetchFunction);
|
|
79
|
+
/**
|
|
80
|
+
* Get the fetch fucntion
|
|
81
|
+
*/
|
|
82
|
+
get fetch(): FetchFunction | null;
|
|
83
|
+
}
|
|
84
|
+
declare const config: SdkConfig;
|
|
85
|
+
export { config, SdkConfig };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Some default settings for the SDK
|
|
3
|
+
*/
|
|
4
|
+
declare const defaults: {
|
|
5
|
+
maptilerLogoURL: string;
|
|
6
|
+
maptilerURL: string;
|
|
7
|
+
maptilerApiHost: string;
|
|
8
|
+
telemetryURL: string;
|
|
9
|
+
rtlPluginURL: string;
|
|
10
|
+
primaryLanguage: import('@maptiler/client').LanguageInfo;
|
|
11
|
+
secondaryLanguage: import('@maptiler/client').LanguageInfo;
|
|
12
|
+
terrainSourceURL: string;
|
|
13
|
+
terrainSourceId: string;
|
|
14
|
+
};
|
|
15
|
+
export { defaults };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IControl } from 'maplibre-gl';
|
|
2
|
+
import { ImageViewer } from '../ImageViewer';
|
|
3
|
+
import { Map as MapSDK } from '../Map';
|
|
4
|
+
export declare class ImageViewerFitImageToBoundsControl implements IControl {
|
|
5
|
+
private viewer;
|
|
6
|
+
private container;
|
|
7
|
+
constructor({ imageViewer }: {
|
|
8
|
+
imageViewer: ImageViewer;
|
|
9
|
+
});
|
|
10
|
+
handleClick: () => void;
|
|
11
|
+
onAdd(_map: MapSDK): HTMLElement;
|
|
12
|
+
onRemove(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Map as SDKMap } from '../Map';
|
|
2
|
+
import { IControl, MapLibreEvent } from 'maplibre-gl';
|
|
3
|
+
export type MaptilerCustomControlCallback<E> = (map: SDKMap, element: HTMLElement, event: E) => void;
|
|
4
|
+
/**
|
|
5
|
+
* The MaptilerCustomControl allows any existing element to become a map control.
|
|
6
|
+
*/
|
|
7
|
+
export declare class MaptilerCustomControl implements IControl {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* @param selectorOrElement Element to be used as control, specified as either reference to element itself or a CSS selector to find the element in DOM
|
|
11
|
+
* @param onClick Function called when the element is clicked
|
|
12
|
+
* @param onRender Function called every time the underlying map renders a new state
|
|
13
|
+
*/
|
|
14
|
+
constructor(selectorOrElement: string | HTMLElement, onClick?: MaptilerCustomControlCallback<Event>, onRender?: MaptilerCustomControlCallback<MapLibreEvent>);
|
|
15
|
+
onAdd(map: SDKMap): HTMLElement;
|
|
16
|
+
onRemove(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Map as SDKMap } from '../Map';
|
|
2
|
+
import { IControl } from 'maplibre-gl';
|
|
3
|
+
import { MaptilerCustomControl, MaptilerCustomControlCallback } from './MaptilerCustomControl';
|
|
4
|
+
export type MaptilerExternalControlType = "zoom-in" | "zoom-out" | "toggle-projection" | "toggle-terrain" | "reset-view" | "reset-bearing" | "reset-pitch" | "reset-roll";
|
|
5
|
+
/**
|
|
6
|
+
* The MaptilerExternalControl allows any existing element to automatically become a map control. Used for detected controls if `customControls` config is turned on.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MaptilerExternalControl extends MaptilerCustomControl implements IControl {
|
|
9
|
+
#private;
|
|
10
|
+
static controlCallbacks: Record<MaptilerExternalControlType, MaptilerCustomControlCallback<Event>>;
|
|
11
|
+
/**
|
|
12
|
+
* Constructs an instance of External Control to have a predefined functionality
|
|
13
|
+
* @param controlElement Element to be used as control, specified as reference to element itself
|
|
14
|
+
* @param controlType One of the predefined types of functionality
|
|
15
|
+
*/
|
|
16
|
+
constructor(controlElement: HTMLElement, controlType?: MaptilerExternalControlType);
|
|
17
|
+
onAdd(map: SDKMap): HTMLElement;
|
|
18
|
+
onRemove(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Configure a child element to be part of this control and to have a predefined functionality added
|
|
21
|
+
* @param controlElement Element that is a descendant of the control element and that optionally should have some functionality
|
|
22
|
+
* @param controlType One of the predefined types of functionality
|
|
23
|
+
*/
|
|
24
|
+
configureGroupItem(controlElement: HTMLElement, controlType: MaptilerExternalControlType | undefined): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GeolocateControl } from '../MLAdapters/GeolocateControl';
|
|
2
|
+
/**
|
|
3
|
+
* The MaptilerGeolocateControl is an extension of the original GeolocateControl
|
|
4
|
+
* with a few changes. In this version, the active mode persists as long as the
|
|
5
|
+
* location is still centered. This means it's robust to rotation, pitch and zoom.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare class MaptilerGeolocateControl extends GeolocateControl {
|
|
9
|
+
private lastUpdatedCenter;
|
|
10
|
+
/**
|
|
11
|
+
* Update the camera location to center on the current position
|
|
12
|
+
*
|
|
13
|
+
* @param {Position} position the Geolocation API Position
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
_updateCamera: (position: GeolocationPosition) => void;
|
|
17
|
+
_finishSetupUI: (supported: boolean) => void;
|
|
18
|
+
_updateCircleRadius(): void;
|
|
19
|
+
_onZoom: () => void;
|
|
20
|
+
_setErrorState(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LogoControlOptions as LogoControlOptionsML } from 'maplibre-gl';
|
|
2
|
+
import { LogoControl } from '../MLAdapters/LogoControl';
|
|
3
|
+
import { Map as SDKMap } from '../Map';
|
|
4
|
+
type LogoControlOptions = LogoControlOptionsML & {
|
|
5
|
+
logoURL?: string;
|
|
6
|
+
linkURL?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* This LogoControl extends the MapLibre LogoControl but instead can use any image URL and
|
|
10
|
+
* any link URL. By default this is using MapTiler logo and URL.
|
|
11
|
+
*/
|
|
12
|
+
export declare class MaptilerLogoControl extends LogoControl {
|
|
13
|
+
_compact: boolean;
|
|
14
|
+
private logoURL;
|
|
15
|
+
private linkURL;
|
|
16
|
+
constructor(options?: LogoControlOptions);
|
|
17
|
+
onAdd(map: SDKMap): HTMLElement;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NavigationControlOptions } from 'maplibre-gl';
|
|
2
|
+
import { NavigationControl } from '../MLAdapters/NavigationControl';
|
|
3
|
+
type HTMLButtonElementPlus = HTMLButtonElement & {
|
|
4
|
+
clickFunction: (e?: Event) => unknown;
|
|
5
|
+
};
|
|
6
|
+
export declare class MaptilerNavigationControl extends NavigationControl {
|
|
7
|
+
constructor(options?: NavigationControlOptions);
|
|
8
|
+
/**
|
|
9
|
+
* Overloading: the button now stores its click callback so that we can later on delete it and replace it
|
|
10
|
+
*/
|
|
11
|
+
_createButton(className: string, fn: (e?: Event) => unknown): HTMLButtonElementPlus;
|
|
12
|
+
/**
|
|
13
|
+
* Overloading: Limit how flat the compass icon can get
|
|
14
|
+
*/
|
|
15
|
+
_rotateCompassArrow: () => void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Map as SDKMap } from '../Map';
|
|
2
|
+
import { IControl } from 'maplibre-gl';
|
|
3
|
+
/**
|
|
4
|
+
* A `MaptilerProjectionControl` control adds a button to switch from Mercator to Globe projection.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MaptilerProjectionControl implements IControl {
|
|
7
|
+
map: SDKMap;
|
|
8
|
+
container: HTMLElement;
|
|
9
|
+
projectionButton: HTMLButtonElement;
|
|
10
|
+
onAdd(map: SDKMap): HTMLElement;
|
|
11
|
+
onRemove(): void;
|
|
12
|
+
private toggleProjection;
|
|
13
|
+
private updateProjectionIcon;
|
|
14
|
+
}
|
|
15
|
+
export declare function toggleProjection(map: SDKMap): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Map as SDKMap } from '../Map';
|
|
2
|
+
import { IControl } from 'maplibre-gl';
|
|
3
|
+
/**
|
|
4
|
+
* A `MaptilerTerrainControl` control adds a button to turn terrain on and off
|
|
5
|
+
* by triggering the terrain logic that is already deployed in the Map object.
|
|
6
|
+
*/
|
|
7
|
+
export declare class MaptilerTerrainControl implements IControl {
|
|
8
|
+
_map: SDKMap;
|
|
9
|
+
_container: HTMLElement;
|
|
10
|
+
_terrainButton: HTMLButtonElement;
|
|
11
|
+
constructor();
|
|
12
|
+
onAdd(map: SDKMap): HTMLElement;
|
|
13
|
+
onRemove(): void;
|
|
14
|
+
_toggleTerrain(): void;
|
|
15
|
+
_updateTerrainIcon(): void;
|
|
16
|
+
}
|
|
17
|
+
export declare function toggleTerrain(map: SDKMap): void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Map as SDKMap, MapOptions } from '../Map';
|
|
2
|
+
import { ControlPosition, CustomLayerInterface, FillLayerSpecification, FilterSpecification, IControl, LayerSpecification, LineLayerSpecification, SourceSpecification, StyleOptions, StyleSetterOptions, StyleSpecification, StyleSwapOptions } from 'maplibre-gl';
|
|
3
|
+
import { MapStyleVariant, ReferenceMapStyle } from '@maptiler/client';
|
|
4
|
+
export interface ParentRect {
|
|
5
|
+
lineLayout: LineLayerSpecification["layout"];
|
|
6
|
+
linePaint: LineLayerSpecification["paint"];
|
|
7
|
+
fillPaint: FillLayerSpecification["paint"];
|
|
8
|
+
}
|
|
9
|
+
export interface MinimapOptionsInput {
|
|
10
|
+
/**
|
|
11
|
+
* Style of the map. Can be:
|
|
12
|
+
* - a full style URL (possibly with API key)
|
|
13
|
+
* - a shorthand with only the MapTIler style name (eg. `"streets-v2"`)
|
|
14
|
+
* - a longer form with the prefix `"maptiler://"` (eg. `"maptiler://streets-v2"`)
|
|
15
|
+
*/
|
|
16
|
+
style?: ReferenceMapStyle | MapStyleVariant | StyleSpecification | string;
|
|
17
|
+
/**
|
|
18
|
+
* Set the zoom difference between the parent and the minimap
|
|
19
|
+
* If the parent is zoomed to 10 and the minimap is zoomed to 8, the zoomAdjust should be 2
|
|
20
|
+
* Default: -4
|
|
21
|
+
*/
|
|
22
|
+
zoomAdjust?: number;
|
|
23
|
+
/** Set a zoom of the minimap and don't allow any future changes */
|
|
24
|
+
lockZoom?: number;
|
|
25
|
+
/** Adjust the pitch only if the user requests */
|
|
26
|
+
pitchAdjust?: boolean;
|
|
27
|
+
/** Set CSS properties of the container using object key-values */
|
|
28
|
+
containerStyle?: Record<string, string>;
|
|
29
|
+
/** Set the position of the minimap at either "top-left", "top-right", "bottom-left", or "bottom-right" */
|
|
30
|
+
position?: ControlPosition;
|
|
31
|
+
/** Set the parentRect fill and/or line options */
|
|
32
|
+
parentRect?: ParentRect;
|
|
33
|
+
}
|
|
34
|
+
export interface MinimapOptions extends Omit<MapOptions, "space" | "halo"> {
|
|
35
|
+
zoomAdjust: number;
|
|
36
|
+
pitchAdjust: boolean;
|
|
37
|
+
containerStyle: Record<string, string>;
|
|
38
|
+
parentRect?: ParentRect;
|
|
39
|
+
}
|
|
40
|
+
export default class Minimap implements IControl {
|
|
41
|
+
#private;
|
|
42
|
+
map: SDKMap;
|
|
43
|
+
constructor(options: MinimapOptionsInput, mapOptions: MapOptions);
|
|
44
|
+
setStyle(style: null | ReferenceMapStyle | MapStyleVariant | StyleSpecification | string, options?: StyleSwapOptions & StyleOptions): void;
|
|
45
|
+
addLayer(layer: (LayerSpecification & {
|
|
46
|
+
source?: string | SourceSpecification;
|
|
47
|
+
}) | CustomLayerInterface, beforeId?: string): SDKMap;
|
|
48
|
+
moveLayer(id: string, beforeId?: string): SDKMap;
|
|
49
|
+
removeLayer(id: string): this;
|
|
50
|
+
setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this;
|
|
51
|
+
setFilter(layerId: string, filter?: FilterSpecification | null, options?: StyleSetterOptions): this;
|
|
52
|
+
setPaintProperty(layerId: string, name: string, value: any, options?: StyleSetterOptions): this;
|
|
53
|
+
setLayoutProperty(layerId: string, name: string, value: any, options?: StyleSetterOptions): this;
|
|
54
|
+
setGlyphs(glyphsUrl: string | null, options?: StyleSetterOptions): this;
|
|
55
|
+
onAdd(parentMap: SDKMap): HTMLElement;
|
|
56
|
+
onRemove(): void;
|
|
57
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './MaptilerCustomControl';
|
|
2
|
+
export * from './MaptilerExternalControl';
|
|
3
|
+
export * from './MaptilerGeolocateControl';
|
|
4
|
+
export * from './MaptilerLogoControl';
|
|
5
|
+
export * from './MaptilerTerrainControl';
|
|
6
|
+
export * from './MaptilerNavigationControl';
|
|
7
|
+
export * from './MaptilerProjectionControl';
|
|
8
|
+
export * from './Minimap';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './xml';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface Link {
|
|
2
|
+
href: string | null;
|
|
3
|
+
}
|
|
4
|
+
export interface XMLProperties {
|
|
5
|
+
links?: Link[];
|
|
6
|
+
}
|
|
7
|
+
export interface PlacemarkProperties {
|
|
8
|
+
name?: string;
|
|
9
|
+
address?: string;
|
|
10
|
+
styleUrl?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
styleHash?: string;
|
|
13
|
+
styleMapHash?: Record<string, string | null>;
|
|
14
|
+
timespan?: {
|
|
15
|
+
begin: string;
|
|
16
|
+
end: string;
|
|
17
|
+
};
|
|
18
|
+
timestamp?: string;
|
|
19
|
+
stroke?: string;
|
|
20
|
+
"stroke-opacity"?: number;
|
|
21
|
+
"stroke-width"?: number;
|
|
22
|
+
fill?: string;
|
|
23
|
+
"fill-opacity"?: number;
|
|
24
|
+
visibility?: string;
|
|
25
|
+
icon?: string;
|
|
26
|
+
coordTimes?: (string | null)[] | (string | null)[][];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* create a function that converts a string to XML
|
|
30
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
|
|
31
|
+
*/
|
|
32
|
+
export declare function str2xml(str: string): Document;
|
|
33
|
+
/**
|
|
34
|
+
* Check one of the top level child node is of a given type ("gpx", "kml").
|
|
35
|
+
* The check is not case sensitive.
|
|
36
|
+
* @param doc
|
|
37
|
+
* @param nodeName
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
export declare function hasChildNodeWithName(doc: Document, nodeName: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* create a function that converts a XML to a string
|
|
43
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/XMLSerializer
|
|
44
|
+
*/
|
|
45
|
+
export declare function xml2str(node: Node): string;
|
|
46
|
+
/**
|
|
47
|
+
* Given a XML document using the GPX spec, return GeoJSON
|
|
48
|
+
*/
|
|
49
|
+
export declare function gpx(doc: string | Document): GeoJSON.FeatureCollection;
|
|
50
|
+
/**
|
|
51
|
+
* Given a XML document using the KML spec, return GeoJSON
|
|
52
|
+
*/
|
|
53
|
+
export declare function kml(doc: string | Document, xml2string?: (node: Node) => string): GeoJSON.FeatureCollection;
|
|
54
|
+
export declare function gpxOrKml(doc: string | Document): GeoJSON.FeatureCollection | null;
|