@maptiler/sdk 3.1.0-rc6 → 3.1.0-rc8
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/.husky/pre-commit +1 -0
- package/dist/eslint.config.d.mts +2 -0
- package/dist/maptiler-sdk.d.ts +2 -0
- package/dist/maptiler-sdk.mjs +11939 -0
- package/dist/maptiler-sdk.mjs.map +1 -0
- package/dist/src/ColorRamp.d.ts +359 -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 +422 -0
- package/dist/src/Point.d.ts +177 -0
- package/dist/src/Telemetry.d.ts +21 -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/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 +14 -0
- package/dist/src/controls/MaptilerTerrainControl.d.ts +16 -0
- package/dist/src/controls/Minimap.d.ts +57 -0
- package/dist/src/controls/index.d.ts +6 -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 +29 -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 +6 -0
- package/dist/src/custom-layers/CubemapLayer/types.d.ts +37 -0
- package/dist/src/custom-layers/RadialGradientLayer/RadialGradientLayer.d.ts +23 -0
- package/dist/src/custom-layers/RadialGradientLayer/index.d.ts +2 -0
- package/dist/src/custom-layers/RadialGradientLayer/types.d.ts +11 -0
- package/dist/src/custom-layers/extractCustomLayerStyle.d.ts +17 -0
- package/dist/src/custom-layers/index.d.ts +5 -0
- package/dist/src/helpers/index.d.ts +13 -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 +87 -0
- package/dist/src/language.d.ts +107 -0
- package/dist/src/mapstyle.d.ts +17 -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/geo-utils.d.ts +6 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/math-utils.d.ts +4 -0
- package/dist/src/utils/webgl-utils.d.ts +49 -0
- package/dist/vite.config-test.d.ts +2 -0
- package/dist/vitest-setup-tests.d.ts +1 -0
- package/package.json +5 -1
|
@@ -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,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,14 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
|
@@ -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 MapOptions {
|
|
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 @@
|
|
|
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;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CustomLayerInterface, CustomRenderMethodInput } from 'maplibre-gl';
|
|
2
|
+
import { Map as MapSDK } from '../../Map';
|
|
3
|
+
import { WebGLContext } from '../../utils/webgl-utils';
|
|
4
|
+
import { CubemapDefinition, CubemapLayerConstructorOptions } from './types';
|
|
5
|
+
declare class CubemapLayer implements CustomLayerInterface {
|
|
6
|
+
id: string;
|
|
7
|
+
type: CustomLayerInterface["type"];
|
|
8
|
+
renderingMode: CustomLayerInterface["renderingMode"];
|
|
9
|
+
private map;
|
|
10
|
+
private faces?;
|
|
11
|
+
private useCubemapTexture;
|
|
12
|
+
private currentFadeOpacity;
|
|
13
|
+
private cubeMapNeedsUpdate;
|
|
14
|
+
private bgColor;
|
|
15
|
+
private gl;
|
|
16
|
+
private cubemap?;
|
|
17
|
+
private texture?;
|
|
18
|
+
constructor(cubemapConfig: CubemapLayerConstructorOptions | true);
|
|
19
|
+
updateCubemap(): void;
|
|
20
|
+
onAdd(map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
21
|
+
onRemove(_map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
22
|
+
prerender(gl: WebGLContext, _options: CustomRenderMethodInput): void;
|
|
23
|
+
private animateIn;
|
|
24
|
+
render(gl: WebGLRenderingContext | WebGL2RenderingContext, _options: CustomRenderMethodInput): void;
|
|
25
|
+
setCubemap(cubemap: CubemapDefinition): void;
|
|
26
|
+
show(): void;
|
|
27
|
+
hide(): void;
|
|
28
|
+
}
|
|
29
|
+
export { CubemapLayer };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare enum CubemapImagesPresets {
|
|
2
|
+
UNIVERSE_DARK = "universe-dark"
|
|
3
|
+
}
|
|
4
|
+
export type CubemapLayerConstructorOptions = CubemapDefinition & {};
|
|
5
|
+
export type CubemapDefinition = {
|
|
6
|
+
path: {
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
format?: "png" | "jpg" | "webp";
|
|
9
|
+
};
|
|
10
|
+
faces?: never;
|
|
11
|
+
preset?: never;
|
|
12
|
+
color?: string;
|
|
13
|
+
} | {
|
|
14
|
+
faces: CubemapFaces;
|
|
15
|
+
path?: never;
|
|
16
|
+
preset?: never;
|
|
17
|
+
color?: string;
|
|
18
|
+
} | {
|
|
19
|
+
preset: string;
|
|
20
|
+
path?: never;
|
|
21
|
+
faces?: never;
|
|
22
|
+
color?: string;
|
|
23
|
+
} | {
|
|
24
|
+
color: string;
|
|
25
|
+
path?: never;
|
|
26
|
+
faces?: never;
|
|
27
|
+
preset?: never;
|
|
28
|
+
};
|
|
29
|
+
export declare enum CubemapFaceNames {
|
|
30
|
+
POSITIVE_X = "pX",
|
|
31
|
+
NEGATIVE_X = "nX",
|
|
32
|
+
POSITIVE_Y = "pY",
|
|
33
|
+
NEGATIVE_Y = "nY",
|
|
34
|
+
POSITIVE_Z = "pZ",
|
|
35
|
+
NEGATIVE_Z = "nZ"
|
|
36
|
+
}
|
|
37
|
+
export type CubemapFaces = Record<CubemapFaceNames, string>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CustomLayerInterface, CustomRenderMethodInput } from 'maplibre-gl';
|
|
2
|
+
import { Map as MapSDK } from '../../Map';
|
|
3
|
+
import { GradientDefinition, RadialGradientLayerOptions } from './types';
|
|
4
|
+
export declare class RadialGradientLayer implements CustomLayerInterface {
|
|
5
|
+
id: string;
|
|
6
|
+
type: CustomLayerInterface["type"];
|
|
7
|
+
renderingMode: CustomLayerInterface["renderingMode"];
|
|
8
|
+
private gradient;
|
|
9
|
+
private scale;
|
|
10
|
+
private map;
|
|
11
|
+
private plane?;
|
|
12
|
+
constructor(gradient: RadialGradientLayerOptions | boolean);
|
|
13
|
+
onAdd(map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
14
|
+
onRemove(_map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
15
|
+
prerender(_gl: WebGLRenderingContext | WebGL2RenderingContext, _options: CustomRenderMethodInput): void;
|
|
16
|
+
render(gl: WebGLRenderingContext | WebGL2RenderingContext, options: CustomRenderMethodInput): void;
|
|
17
|
+
/**
|
|
18
|
+
* Value settings methods
|
|
19
|
+
*/
|
|
20
|
+
setGradient(gradient: GradientDefinition): void;
|
|
21
|
+
show(): void;
|
|
22
|
+
hide(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Object3D } from '../../utils/webgl-utils';
|
|
2
|
+
export type Color = string;
|
|
3
|
+
export type GradientStop = number;
|
|
4
|
+
export type RadialGradientLayerOptions = GradientDefinition;
|
|
5
|
+
export type GradientDefinition = {
|
|
6
|
+
stops: Array<[GradientStop, Color]>;
|
|
7
|
+
scale: number;
|
|
8
|
+
};
|
|
9
|
+
export type GradientAttributeKey = "vertexPosition";
|
|
10
|
+
export type GradientUniformKey = "stopsNumber" | "stops" | "colors";
|
|
11
|
+
export type GradientPlaneObject3D = Pick<Object3D<GradientAttributeKey, GradientUniformKey>, "shaderProgram" | "programInfo" | "positionBuffer">;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Map as MapSDK } from '../Map';
|
|
2
|
+
import { StyleSpecification } from 'maplibre-gl';
|
|
3
|
+
import { CubemapLayerConstructorOptions, RadialGradientLayerOptions } from 'custom-layers';
|
|
4
|
+
export type StyleSpecificationWithMetaData = StyleSpecification & {
|
|
5
|
+
metadata?: {
|
|
6
|
+
"maptiler:copyright": string;
|
|
7
|
+
maptiler?: {
|
|
8
|
+
halo: RadialGradientLayerOptions;
|
|
9
|
+
space: CubemapLayerConstructorOptions;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export interface IExtractCustomLayerStyleOptions {
|
|
14
|
+
map: MapSDK;
|
|
15
|
+
property: "halo" | "space";
|
|
16
|
+
}
|
|
17
|
+
export default function extractCustomLayerStyle<T extends CubemapLayerConstructorOptions | RadialGradientLayerOptions | null>(options: IExtractCustomLayerStyleOptions): T | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { takeScreenshot } from './screenshot';
|
|
2
|
+
import { addPolyline, addPolygon, addPoint, addHeatmap } from './vectorlayerhelpers';
|
|
3
|
+
export type { ZoomStringValues, ZoomNumberValues, PropertyValues, CommonShapeLayerOptions, PolylineLayerOptions, PolygonLayerOptions, PointLayerOptions, HeatmapLayerOptions, } from './vectorlayerhelpers';
|
|
4
|
+
/**
|
|
5
|
+
* Helpers are a set of functions to facilitate the creation of sources and layers
|
|
6
|
+
*/
|
|
7
|
+
export declare const helpers: {
|
|
8
|
+
addPolyline: typeof addPolyline;
|
|
9
|
+
addPolygon: typeof addPolygon;
|
|
10
|
+
addPoint: typeof addPoint;
|
|
11
|
+
addHeatmap: typeof addHeatmap;
|
|
12
|
+
takeScreenshot: typeof takeScreenshot;
|
|
13
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Map as MapSDK } from '../Map';
|
|
2
|
+
/**
|
|
3
|
+
* Takes a screenshot (PNG file) of the curent map view.
|
|
4
|
+
* Depending on the options, this function can automatically trigger a download of te file.
|
|
5
|
+
*/
|
|
6
|
+
export declare function takeScreenshot(map: MapSDK, options?: {
|
|
7
|
+
/**
|
|
8
|
+
* If `true`, this function will trigger a download in addition to returning a blob.
|
|
9
|
+
* Default: `false`
|
|
10
|
+
*/
|
|
11
|
+
download?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Only if `options.download` is `true`. Indicates the filename under which
|
|
14
|
+
* the file will be downloaded.
|
|
15
|
+
* Default: `"maptiler_screenshot.png"`
|
|
16
|
+
*/
|
|
17
|
+
filename?: string;
|
|
18
|
+
}): Promise<Blob>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DataDrivenPropertyValueSpecification, ExpressionSpecification } from 'maplibre-gl';
|
|
2
|
+
import { ColorRamp } from '../ColorRamp';
|
|
3
|
+
import { DataDrivenStyle, PropertyValues, ZoomNumberValues, ZoomStringValues } from './vectorlayerhelpers';
|
|
4
|
+
export type ColorPalette = [string, string, string, string];
|
|
5
|
+
export declare const colorPalettes: Array<ColorPalette>;
|
|
6
|
+
export declare function getRandomColor(): string;
|
|
7
|
+
export declare function generateRandomSourceName(): string;
|
|
8
|
+
export declare function generateRandomLayerName(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Linera interpolation to find a value at an arbitrary zoom level, given a list of tuple zoom-value
|
|
11
|
+
*/
|
|
12
|
+
export declare function lerpZoomNumberValues(znv: ZoomNumberValues, z: number): number;
|
|
13
|
+
export declare function paintColorOptionsToPaintSpec(color: ZoomStringValues): DataDrivenPropertyValueSpecification<string>;
|
|
14
|
+
export declare function rampedOptionsToLayerPaintSpec(ramp: ZoomNumberValues): DataDrivenPropertyValueSpecification<number>;
|
|
15
|
+
export declare function computeRampedOutlineWidth(lineWidth: number | ZoomNumberValues, outlineWidth: number | ZoomNumberValues): number | DataDrivenPropertyValueSpecification<number>;
|
|
16
|
+
export declare function rampedPropertyValueWeight(ramp: PropertyValues, property: string): DataDrivenPropertyValueSpecification<number>;
|
|
17
|
+
/**
|
|
18
|
+
* Create a dash array from a string pattern that uses underscore and whitespace characters
|
|
19
|
+
*/
|
|
20
|
+
export declare function dashArrayMaker(pattern: string): Array<number>;
|
|
21
|
+
export declare function colorDrivenByProperty(style: DataDrivenStyle, property: string): DataDrivenPropertyValueSpecification<string>;
|
|
22
|
+
export declare function radiusDrivenByProperty(style: DataDrivenStyle, property: string, zoomCompensation?: boolean): DataDrivenPropertyValueSpecification<number>;
|
|
23
|
+
export declare function radiusDrivenByPropertyHeatmap(style: PropertyValues, property: string, zoomCompensation?: boolean): DataDrivenPropertyValueSpecification<number>;
|
|
24
|
+
/**
|
|
25
|
+
* Turns a ColorRamp instance into a MapLibre style for ramping the opacity, driven by a property
|
|
26
|
+
*/
|
|
27
|
+
export declare function opacityDrivenByProperty(colorramp: ColorRamp, property: string): DataDrivenPropertyValueSpecification<number>;
|
|
28
|
+
export declare function heatmapIntensityFromColorRamp(colorRamp: ColorRamp, steps?: number): ExpressionSpecification;
|