@maptiler/sdk 1.0.7 → 1.0.9
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/CHANGELOG.md +55 -0
- package/demos/maptiler-sdk.umd.js +240 -79
- package/demos/simple.html +3 -2
- package/dist/maptiler-sdk.d.ts +200 -30
- package/dist/maptiler-sdk.min.mjs +1 -1
- package/dist/maptiler-sdk.mjs +144 -45
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/maptiler-sdk.umd.js +240 -79
- package/dist/maptiler-sdk.umd.js.map +1 -1
- package/dist/maptiler-sdk.umd.min.js +30 -30
- package/package.json +2 -2
- package/readme.md +9 -5
- package/src/AttributionControl.ts +13 -0
- package/src/CanvasSource.ts +13 -0
- package/src/FullscreenControl.ts +13 -0
- package/src/GeoJSONSource.ts +13 -0
- package/src/GeolocateControl.ts +13 -0
- package/src/ImageSource.ts +13 -0
- package/src/LogoControl.ts +13 -0
- package/src/Map.ts +36 -43
- package/src/MaptilerGeolocateControl.ts +1 -1
- package/src/MaptilerLogoControl.ts +2 -1
- package/src/MaptilerNavigationControl.ts +2 -2
- package/src/Marker.ts +13 -0
- package/src/NavigationControl.ts +13 -0
- package/src/Popup.ts +13 -0
- package/src/RasterDEMTileSource.ts +13 -0
- package/src/RasterTileSource.ts +13 -0
- package/src/ScaleControl.ts +13 -0
- package/src/Style.ts +13 -0
- package/src/TerrainControl.ts +13 -0
- package/src/VectorTileSource.ts +13 -0
- package/src/VideoSource.ts +13 -0
- package/src/index.ts +111 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maptiler/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
|
|
5
5
|
"module": "dist/maptiler-sdk.mjs",
|
|
6
6
|
"types": "dist/maptiler-sdk.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"typescript": "^4.8.4"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@maptiler/client": "^1.
|
|
65
|
+
"@maptiler/client": "^1.3.0",
|
|
66
66
|
"events": "^3.3.0",
|
|
67
67
|
"js-base64": "^3.7.4",
|
|
68
68
|
"maplibre-gl": "^3.0.0-pre.3",
|
package/readme.md
CHANGED
|
@@ -165,10 +165,13 @@ Here is the full list:
|
|
|
165
165
|
- `MapStyle.STREETS.DARK` (variant)
|
|
166
166
|
- `MapStyle.STREETS.LIGHT` (variant)
|
|
167
167
|
- `MapStyle.STREETS.PASTEL` (variant)
|
|
168
|
-
- `MapStyle.OUTDOOR` reference style for adventure
|
|
169
|
-
- `MapStyle.WINTER` reference style for winter adventure
|
|
170
168
|
- `MapStyle.SATELLITE` reference style satellite and airborne imagery (no variants)
|
|
171
169
|
- `MapStyle.HYBRID` reference style satellite and airborne imagery with labels (no variants)
|
|
170
|
+
- `MapStyle.OUTDOOR` reference style for adventure
|
|
171
|
+
- `MapStyle.WINTER` reference style for winter adventure
|
|
172
|
+
- `MapStyle.DATAVIZ`, the perfect style for data visualization, with very little noise
|
|
173
|
+
- `MapStyle.DATAVIZ.DARK` (variant)
|
|
174
|
+
- `MapStyle.DATAVIZ.LIGHT` (variant)
|
|
172
175
|
- `MapStyle.BASIC` reference style for minimalist design and general purpose
|
|
173
176
|
- `MapStyle.BASIC.DARK` (variant)
|
|
174
177
|
- `MapStyle.BASIC.LIGHT` (variant)
|
|
@@ -189,9 +192,7 @@ Here is the full list:
|
|
|
189
192
|
- `MapStyle.TONER.LITE` (variant)
|
|
190
193
|
- `MapStyle.TONER.LINES` (variant)
|
|
191
194
|
- `MapStyle.OPENSTREETMAP` (reference style, this one does not have any variants)
|
|
192
|
-
|
|
193
|
-
- `MapStyle.DATAVIZ.DARK` (variant)
|
|
194
|
-
- `MapStyle.DATAVIZ.LIGHT` (variant)
|
|
195
|
+
|
|
195
196
|
|
|
196
197
|
All reference styles (instances of `ReferenceMapStyle`) and style variants (instances of `MapStyleVariant`) have methods to know the alternative styles and variant that belong to the same reference style (`.getVariants()`). This is handy to provide a default/dark/light alternative color scheme, yet preserving the same level of details as in the reference style. Read more about about [ReferenceMapStyle](docsmd/classes/ReferenceMapStyle.md) and [MapStyleVariant](docsmd/classes/MapStyleVariant.md).
|
|
197
198
|
</details>
|
|
@@ -508,9 +509,12 @@ In the following static map functions, the `option` object features a `style` pr
|
|
|
508
509
|
- `MapStyle.STREETS`, reference style for navigation and city exploration
|
|
509
510
|
- `MapStyle.STREETS.DARK` (variant)
|
|
510
511
|
- `MapStyle.STREETS.LIGHT` (variant)
|
|
512
|
+
- `MapStyle.STREETS.NIGHT` (variant)
|
|
511
513
|
- `MapStyle.STREETS.PASTEL` (variant)
|
|
512
514
|
- `MapStyle.OUTDOOR` reference style for adventure
|
|
515
|
+
- `MapStyle.OUTDOOR.DARK` (variant)
|
|
513
516
|
- `MapStyle.WINTER` reference style for winter adventure
|
|
517
|
+
- `MapStyle.WINTER.DARK` (variant)
|
|
514
518
|
- `MapStyle.SATELLITE` reference style satellite and airborne imagery (no variants)
|
|
515
519
|
- `MapStyle.HYBRID` reference style satellite and airborne imagery with labels (no variants)
|
|
516
520
|
- `MapStyle.BASIC` reference style for minimalist design and general purpose
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre AttributionControl to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class AttributionControl extends maplibregl.AttributionControl {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
return super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre CanvasSource to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class CanvasSource extends maplibregl.CanvasSource {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre FullscreenControl to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class FullscreenControl extends maplibregl.FullscreenControl {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
return super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre GeoJSONSource to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class GeoJSONSource extends maplibregl.GeoJSONSource {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre GeolocateControl to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class GeolocateControl extends maplibregl.GeolocateControl {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
return super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre ImageSource to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class ImageSource extends maplibregl.ImageSource {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre LogoControl to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class LogoControl extends maplibregl.LogoControl {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
return super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/Map.ts
CHANGED
|
@@ -23,6 +23,9 @@ import { MaptilerTerrainControl } from "./MaptilerTerrainControl";
|
|
|
23
23
|
import { MaptilerNavigationControl } from "./MaptilerNavigationControl";
|
|
24
24
|
import { geolocation } from "@maptiler/client";
|
|
25
25
|
import { MaptilerGeolocateControl } from "./MaptilerGeolocateControl";
|
|
26
|
+
import { AttributionControl } from "./AttributionControl";
|
|
27
|
+
import { ScaleControl } from "./ScaleControl";
|
|
28
|
+
import { FullscreenControl } from "./FullscreenControl";
|
|
26
29
|
|
|
27
30
|
// StyleSwapOptions is not exported by Maplibre, but we can redefine it (used for setStyle)
|
|
28
31
|
export type TransformStyleFunction = (
|
|
@@ -136,16 +139,12 @@ export type MapOptions = Omit<MapOptionsML, "style" | "maplibreLogo"> & {
|
|
|
136
139
|
* The Map class can be instanciated to display a map in a `<div>`
|
|
137
140
|
*/
|
|
138
141
|
export class Map extends maplibregl.Map {
|
|
139
|
-
private languageShouldUpdate = false;
|
|
140
|
-
private isStyleInitialized = false;
|
|
141
142
|
private isTerrainEnabled = false;
|
|
142
143
|
private terrainExaggeration = 1;
|
|
144
|
+
private primaryLanguage: LanguageString | null = null;
|
|
145
|
+
private secondaryLanguage: LanguageString | null = null;
|
|
143
146
|
|
|
144
147
|
constructor(options: MapOptions) {
|
|
145
|
-
// if (options.language) {
|
|
146
|
-
// config.primaryLanguage = options.language;
|
|
147
|
-
// }
|
|
148
|
-
|
|
149
148
|
if (options.apiKey) {
|
|
150
149
|
config.apiKey = options.apiKey;
|
|
151
150
|
}
|
|
@@ -197,11 +196,15 @@ export class Map extends maplibregl.Map {
|
|
|
197
196
|
},
|
|
198
197
|
});
|
|
199
198
|
|
|
199
|
+
this.primaryLanguage = options.language ?? config.primaryLanguage;
|
|
200
|
+
this.secondaryLanguage = config.secondaryLanguage;
|
|
201
|
+
|
|
200
202
|
// Map centering and geolocation
|
|
201
203
|
this.once("styledata", async () => {
|
|
202
204
|
// Not using geolocation centering if...
|
|
203
205
|
|
|
204
|
-
|
|
206
|
+
// the geolcoate option is not provided or is falsy
|
|
207
|
+
if (!options.geolocate) {
|
|
205
208
|
return;
|
|
206
209
|
}
|
|
207
210
|
|
|
@@ -271,40 +274,10 @@ export class Map extends maplibregl.Map {
|
|
|
271
274
|
}
|
|
272
275
|
});
|
|
273
276
|
|
|
274
|
-
// Check if language has been modified and. If so, it will be updated during the next lifecycle step
|
|
275
|
-
this.on("styledataloading", () => {
|
|
276
|
-
this.languageShouldUpdate =
|
|
277
|
-
!!config.primaryLanguage || !!config.secondaryLanguage;
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
// To flag if the language was already initialized at build time
|
|
281
|
-
// so that the language optionnaly passed in constructor is
|
|
282
|
-
// considered only once and at instanciation time.
|
|
283
|
-
let initLanguageFromConstructor = true;
|
|
284
|
-
|
|
285
277
|
// If the config includes language changing, we must update the map language
|
|
286
278
|
this.on("styledata", () => {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
if (options.language && initLanguageFromConstructor) {
|
|
290
|
-
this.setPrimaryLanguage(options.language);
|
|
291
|
-
} else if (
|
|
292
|
-
config.primaryLanguage &&
|
|
293
|
-
(this.languageShouldUpdate || !this.isStyleInitialized)
|
|
294
|
-
) {
|
|
295
|
-
this.setPrimaryLanguage(config.primaryLanguage);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
if (
|
|
299
|
-
config.secondaryLanguage &&
|
|
300
|
-
(this.languageShouldUpdate || !this.isStyleInitialized)
|
|
301
|
-
) {
|
|
302
|
-
this.setSecondaryLanguage(config.secondaryLanguage);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
this.languageShouldUpdate = false;
|
|
306
|
-
this.isStyleInitialized = true;
|
|
307
|
-
initLanguageFromConstructor = false;
|
|
279
|
+
this.setPrimaryLanguage(this.primaryLanguage);
|
|
280
|
+
this.setSecondaryLanguage(this.secondaryLanguage);
|
|
308
281
|
});
|
|
309
282
|
|
|
310
283
|
// this even is in charge of reaplying the terrain elevation after the
|
|
@@ -360,7 +333,7 @@ export class Map extends maplibregl.Map {
|
|
|
360
333
|
|
|
361
334
|
// if attribution in option is `false` but the the logo shows up in the tileJson, then the attribution must show anyways
|
|
362
335
|
if (options.attributionControl === false) {
|
|
363
|
-
this.addControl(new
|
|
336
|
+
this.addControl(new AttributionControl(options));
|
|
364
337
|
}
|
|
365
338
|
} else if (options.maptilerLogo) {
|
|
366
339
|
this.addControl(new MaptilerLogoControl(), options.logoPosition);
|
|
@@ -378,7 +351,7 @@ export class Map extends maplibregl.Map {
|
|
|
378
351
|
: options.scaleControl
|
|
379
352
|
) as ControlPosition;
|
|
380
353
|
|
|
381
|
-
const scaleControl = new
|
|
354
|
+
const scaleControl = new ScaleControl({ unit: config.unit });
|
|
382
355
|
this.addControl(scaleControl, position);
|
|
383
356
|
config.on("unit", (unit) => {
|
|
384
357
|
scaleControl.setUnit(unit);
|
|
@@ -445,7 +418,7 @@ export class Map extends maplibregl.Map {
|
|
|
445
418
|
: options.fullscreenControl
|
|
446
419
|
) as ControlPosition;
|
|
447
420
|
|
|
448
|
-
this.addControl(new
|
|
421
|
+
this.addControl(new FullscreenControl({}), position);
|
|
449
422
|
}
|
|
450
423
|
});
|
|
451
424
|
|
|
@@ -495,6 +468,8 @@ export class Map extends maplibregl.Map {
|
|
|
495
468
|
return;
|
|
496
469
|
}
|
|
497
470
|
|
|
471
|
+
this.primaryLanguage = language;
|
|
472
|
+
|
|
498
473
|
this.onStyleReady(() => {
|
|
499
474
|
if (language === Language.AUTO) {
|
|
500
475
|
return this.setPrimaryLanguage(getBrowserLanguage());
|
|
@@ -649,7 +624,7 @@ export class Map extends maplibregl.Map {
|
|
|
649
624
|
}
|
|
650
625
|
|
|
651
626
|
/**
|
|
652
|
-
* Define the secondary language of the map.
|
|
627
|
+
* Define the secondary language of the map. Note that this is not supported by all the map styles
|
|
653
628
|
* Note that most styles do not allow a secondary language and this function only works if the style allows (no force adding)
|
|
654
629
|
* @param language
|
|
655
630
|
*/
|
|
@@ -658,6 +633,8 @@ export class Map extends maplibregl.Map {
|
|
|
658
633
|
return;
|
|
659
634
|
}
|
|
660
635
|
|
|
636
|
+
this.secondaryLanguage = language;
|
|
637
|
+
|
|
661
638
|
this.onStyleReady(() => {
|
|
662
639
|
if (language === Language.AUTO) {
|
|
663
640
|
return this.setSecondaryLanguage(getBrowserLanguage());
|
|
@@ -780,6 +757,22 @@ export class Map extends maplibregl.Map {
|
|
|
780
757
|
});
|
|
781
758
|
}
|
|
782
759
|
|
|
760
|
+
/**
|
|
761
|
+
* Get the primary language
|
|
762
|
+
* @returns
|
|
763
|
+
*/
|
|
764
|
+
getPrimaryLanguage(): LanguageString {
|
|
765
|
+
return this.primaryLanguage;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* Get the secondary language
|
|
770
|
+
* @returns
|
|
771
|
+
*/
|
|
772
|
+
getSecondaryLanguage(): LanguageString {
|
|
773
|
+
return this.secondaryLanguage;
|
|
774
|
+
}
|
|
775
|
+
|
|
783
776
|
/**
|
|
784
777
|
* Get the exaggeration factor applied to the terrain
|
|
785
778
|
* @returns
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { LngLatLike } from "maplibre-gl";
|
|
2
2
|
import maplibregl from "maplibre-gl";
|
|
3
|
+
import { GeolocateControl } from "./GeolocateControl";
|
|
3
4
|
import { DOMcreate } from "./tools";
|
|
4
5
|
|
|
5
|
-
const GeolocateControl = maplibregl.GeolocateControl;
|
|
6
6
|
const Marker = maplibregl.Marker;
|
|
7
7
|
const LngLat = maplibregl.LngLat;
|
|
8
8
|
|
|
@@ -2,6 +2,7 @@ import maplibregl from "maplibre-gl";
|
|
|
2
2
|
import type { LogoOptions as LogoOptionsML } from "maplibre-gl";
|
|
3
3
|
import { defaults } from "./defaults";
|
|
4
4
|
import { Map } from "./Map";
|
|
5
|
+
import { LogoControl } from "./LogoControl";
|
|
5
6
|
|
|
6
7
|
type LogoOptions = LogoOptionsML & {
|
|
7
8
|
logoURL?: string;
|
|
@@ -12,7 +13,7 @@ type LogoOptions = LogoOptionsML & {
|
|
|
12
13
|
* This LogoControl extends the MapLibre LogoControl but instead can use any image URL and
|
|
13
14
|
* any link URL. By default this is using MapTiler logo and URL.
|
|
14
15
|
*/
|
|
15
|
-
export class MaptilerLogoControl extends
|
|
16
|
+
export class MaptilerLogoControl extends LogoControl {
|
|
16
17
|
private logoURL = "";
|
|
17
18
|
private linkURL = "";
|
|
18
19
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { NavigationControl } from "./NavigationControl";
|
|
2
2
|
|
|
3
3
|
type HTMLButtonElementPlus = HTMLButtonElement & {
|
|
4
4
|
clickFunction: (e?: any) => unknown;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
export class MaptilerNavigationControl extends
|
|
7
|
+
export class MaptilerNavigationControl extends NavigationControl {
|
|
8
8
|
constructor() {
|
|
9
9
|
super({
|
|
10
10
|
showCompass: true,
|
package/src/Marker.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre Marker to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class Marker extends maplibregl.Marker {
|
|
10
|
+
addTo(map: Map | MapMLGL): this {
|
|
11
|
+
return super.addTo(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre NavigationControl to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class NavigationControl extends maplibregl.NavigationControl {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
return super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/Popup.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre Popup to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class Popup extends maplibregl.Popup {
|
|
10
|
+
addTo(map: Map | MapMLGL): this {
|
|
11
|
+
return super.addTo(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre RasterDEMTileSource to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class RasterDEMTileSource extends maplibregl.RasterDEMTileSource {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre RasterTileSource to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class RasterTileSource extends maplibregl.RasterTileSource {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre ScaleControl to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class ScaleControl extends maplibregl.ScaleControl {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
return super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/Style.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre Style to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL, StyleOptions } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class Style extends maplibregl.Style {
|
|
10
|
+
constructor(map: Map, options: StyleOptions = {}) {
|
|
11
|
+
super(map as MapMLGL, options);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre TerrainControl to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class TerrainControl extends maplibregl.TerrainControl {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
return super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre VectorTileSource to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class VectorTileSource extends maplibregl.VectorTileSource {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre VideoSource to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class VideoSource extends maplibregl.VideoSource {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|