@tangram.gl/basemap-layers 0.0.0 → 10.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -7
- package/THIRD-PARTY-NOTICES.md +7 -5
- package/dist/geojson-task-worker.js +3166 -0
- package/dist/geojson-task-worker.js.map +6 -0
- package/dist/geojson-worker.js +1089 -7
- package/dist/geojson-worker.js.map +3 -3
- package/dist/index.cjs +9588 -2093
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +9599 -2090
- package/dist/index.js.map +3 -3
- package/dist/map-style.cjs +456 -20
- package/dist/map-style.cjs.map +3 -3
- package/dist/map-style.js +456 -19
- package/dist/map-style.js.map +2 -2
- package/dist/types/basemap-error.d.ts +52 -0
- package/dist/types/basemap-layer.d.ts +378 -25
- package/dist/types/basemap-protocol.d.ts +91 -0
- package/dist/types/basemap-request.d.ts +73 -0
- package/dist/types/circle-layer.d.ts +65 -8
- package/dist/types/color-relief-layer.d.ts +184 -0
- package/dist/types/dem-pixels.d.ts +40 -0
- package/dist/types/feature-state.d.ts +55 -0
- package/dist/types/fill-extrusion-lighting-extension.d.ts +1 -2
- package/dist/types/fill-outline-extension.d.ts +2 -3
- package/dist/types/fill-pattern.d.ts +35 -3
- package/dist/types/fill-style-extensions.d.ts +11 -59
- package/dist/types/geojson-resource.d.ts +18 -0
- package/dist/types/geojson-source.d.ts +13 -2
- package/dist/types/geojson-task-handler.d.ts +2 -0
- package/dist/types/geojson-task.d.ts +26 -0
- package/dist/types/geojson-tiler.d.ts +29 -2
- package/dist/types/geojson-worker.d.ts +5 -1
- package/dist/types/globe-horizon-extension.d.ts +2 -45
- package/dist/types/globe-layers.d.ts +141 -45
- package/dist/types/globe-line-angle-extension.d.ts +20 -17
- package/dist/types/glyph-store.d.ts +10 -1
- package/dist/types/heatmap-layer.d.ts +99 -0
- package/dist/types/hillshade-layer.d.ts +159 -27
- package/dist/types/icon-text-fit.d.ts +92 -0
- package/dist/types/image-source-layer.d.ts +142 -0
- package/dist/types/index.d.ts +25 -1
- package/dist/types/line-blur-extension.d.ts +3 -11
- package/dist/types/line-dash-extension.d.ts +53 -0
- package/dist/types/line-gradient-extension.d.ts +69 -0
- package/dist/types/line-metrics.d.ts +24 -0
- package/dist/types/line-pattern-extension.d.ts +50 -0
- package/dist/types/line-shape-extension.d.ts +76 -0
- package/dist/types/map-style-loader.d.ts +1 -1
- package/dist/types/map-style.d.ts +2 -2
- package/dist/types/mvt-label-layer.d.ts +111 -20
- package/dist/types/pmtiles-source.d.ts +38 -0
- package/dist/types/projected-background-layer.d.ts +63 -0
- package/dist/types/projected-bitmap-layer.d.ts +58 -0
- package/dist/types/projected-tile-data.d.ts +16 -0
- package/dist/types/projected-tile-selection.d.ts +72 -0
- package/dist/types/projected-tileset.d.ts +92 -0
- package/dist/types/projected-viewport.d.ts +76 -0
- package/dist/types/raster-color-extension.d.ts +4 -7
- package/dist/types/raster-fade.d.ts +155 -0
- package/dist/types/raster-tile-fingerprint.d.ts +11 -0
- package/dist/types/raster-tile-loader.d.ts +80 -0
- package/dist/types/shader-injection-plugin.d.ts +8 -0
- package/dist/types/source-features.d.ts +58 -0
- package/dist/types/source-tiles.d.ts +32 -0
- package/dist/types/sprite.d.ts +37 -3
- package/dist/types/stretch-icon-layer.d.ts +28 -0
- package/dist/types/style-accessor.d.ts +50 -12
- package/dist/types/style-expression.d.ts +22 -2
- package/dist/types/style-resolver.d.ts +47 -2
- package/dist/types/terrain-query.d.ts +39 -0
- package/dist/types/zoom-load-gate.d.ts +22 -0
- package/dist/types/zoom-paint-extension.d.ts +80 -11
- package/package.json +24 -21
- package/src/basemap-error.ts +82 -0
- package/src/basemap-layer.ts +1289 -101
- package/src/basemap-protocol.ts +353 -0
- package/src/basemap-request.ts +212 -0
- package/src/circle-layer.ts +430 -54
- package/src/color-relief-layer.ts +572 -0
- package/src/dem-pixels.ts +174 -0
- package/src/feature-state.ts +164 -0
- package/src/fill-extrusion-lighting-extension.ts +126 -9
- package/src/fill-outline-extension.ts +4 -4
- package/src/fill-pattern.ts +87 -9
- package/src/fill-style-extensions.ts +114 -44
- package/src/geojson-resource.ts +58 -0
- package/src/geojson-source.ts +106 -85
- package/src/geojson-task-handler.ts +11 -0
- package/src/geojson-task-worker.ts +8 -0
- package/src/geojson-task.ts +34 -0
- package/src/geojson-tiler.ts +270 -4
- package/src/geojson-worker.ts +36 -6
- package/src/globe-horizon-extension.ts +14 -4
- package/src/globe-layers.ts +1905 -406
- package/src/globe-line-angle-extension.ts +183 -23
- package/src/glyph-store.ts +28 -6
- package/src/heatmap-layer.ts +591 -0
- package/src/hillshade-layer.ts +309 -88
- package/src/icon-text-fit.ts +358 -0
- package/src/image-source-layer.ts +380 -0
- package/src/index.ts +58 -1
- package/src/line-blur-extension.ts +14 -12
- package/src/line-dash-extension.ts +303 -0
- package/src/line-gradient-extension.ts +191 -0
- package/src/line-metrics.ts +90 -0
- package/src/line-pattern-extension.ts +173 -0
- package/src/line-shape-extension.ts +272 -0
- package/src/map-style-loader.ts +5 -4
- package/src/map-style.ts +2 -1
- package/src/mvt-label-layer.ts +568 -144
- package/src/pmtiles-source.ts +276 -0
- package/src/projected-background-layer.ts +202 -0
- package/src/projected-bitmap-layer.ts +262 -0
- package/src/projected-tile-data.ts +132 -0
- package/src/projected-tile-selection.ts +605 -0
- package/src/projected-tileset.ts +183 -0
- package/src/projected-viewport.ts +254 -0
- package/src/raster-color-extension.ts +43 -18
- package/src/raster-fade.ts +319 -0
- package/src/raster-tile-fingerprint.ts +31 -0
- package/src/raster-tile-loader.ts +211 -0
- package/src/shader-injection-plugin.ts +25 -0
- package/src/source-features.ts +170 -0
- package/src/source-tiles.ts +102 -0
- package/src/sprite.ts +122 -15
- package/src/stretch-icon-layer.ts +87 -0
- package/src/style-accessor.ts +105 -17
- package/src/style-expression.ts +80 -3
- package/src/style-resolver.ts +200 -22
- package/src/terrain-query.ts +86 -0
- package/src/text-layout.ts +2 -3
- package/src/zoom-load-gate.ts +57 -0
- package/src/zoom-paint-extension.ts +245 -47
- package/dist/types/arabic-shaping.d.ts +0 -7
- package/dist/types/bidi.d.ts +0 -8
- package/dist/types/polylabel.d.ts +0 -17
- package/src/arabic-shaping.ts +0 -366
- package/src/bidi.ts +0 -199
- package/src/polylabel.ts +0 -312
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Portions of this file are adapted from MapLibre GL JS v6.13.0, src/source/image_source.ts and
|
|
4
|
+
* src/shaders/glsl/raster.vertex.glsl, under this license (see also THIRD-PARTY-NOTICES.md):
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2023, MapLibre contributors
|
|
7
|
+
*
|
|
8
|
+
* All rights reserved.
|
|
9
|
+
*
|
|
10
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
|
11
|
+
* are permitted provided that the following conditions are met:
|
|
12
|
+
*
|
|
13
|
+
* * Redistributions of source code must retain the above copyright notice,
|
|
14
|
+
* this list of conditions and the following disclaimer.
|
|
15
|
+
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
16
|
+
* this list of conditions and the following disclaimer in the documentation
|
|
17
|
+
* and/or other materials provided with the distribution.
|
|
18
|
+
* * Neither the name of MapLibre GL JS nor the names of its contributors
|
|
19
|
+
* may be used to endorse or promote products derived from this software
|
|
20
|
+
* without specific prior written permission.
|
|
21
|
+
*
|
|
22
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
26
|
+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
27
|
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
28
|
+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
29
|
+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
30
|
+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
31
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
32
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
import { CompositeLayer } from '@deck.gl/core';
|
|
35
|
+
import type { CompositeLayerProps, DefaultProps } from '@deck.gl/core';
|
|
36
|
+
import type { BitmapBoundingBox } from '@deck.gl/layers';
|
|
37
|
+
import { BitmapLayer } from '@deck.gl/layers';
|
|
38
|
+
import type { BasemapLoadOptions, BasemapSource } from "./style-resolver.js";
|
|
39
|
+
/** A longitude and a latitude, in degrees. */
|
|
40
|
+
export type ImageSourceCorner = [number, number];
|
|
41
|
+
/**
|
|
42
|
+
* The corners of an `image` source, as the style specification lists them: top left, top right,
|
|
43
|
+
* bottom right and bottom left.
|
|
44
|
+
*/
|
|
45
|
+
export type ImageSourceCorners = [
|
|
46
|
+
ImageSourceCorner,
|
|
47
|
+
ImageSourceCorner,
|
|
48
|
+
ImageSourceCorner,
|
|
49
|
+
ImageSourceCorner
|
|
50
|
+
];
|
|
51
|
+
/**
|
|
52
|
+
* The `coordinates` of an `image` source, or null unless they are four `[longitude, latitude]`
|
|
53
|
+
* corners of finite numbers, with latitudes within the Web Mercator world (±85.051129°) and
|
|
54
|
+
* longitudes within ±540°.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getImageSourceCorners(source: BasemapSource): ImageSourceCorners | null;
|
|
57
|
+
/** Whether a source is an `image` source that can draw: one with a `url` and valid corners. */
|
|
58
|
+
export declare function isDrawableImageSource(source: BasemapSource | undefined): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* The `bounds` of a `BitmapLayer` over the corners of an image: bottom left, top left, top right
|
|
61
|
+
* and bottom right. `ImageQuadLayer` draws its own mesh, but a change of bounds rebuilds it.
|
|
62
|
+
*/
|
|
63
|
+
export declare function getImageSourceBounds([topLeft, topRight, bottomRight, bottomLeft]: ImageSourceCorners): BitmapBoundingBox;
|
|
64
|
+
/** The most grid cells along each side of the mesh of an image, however large it is. */
|
|
65
|
+
export declare const MAX_IMAGE_GRID_CELLS = 256;
|
|
66
|
+
/**
|
|
67
|
+
* How an image is warped onto its corners, as MapLibre GL JS warps it (`ImageSource` with its
|
|
68
|
+
* default `auto` warp): `[perspectiveX, perspectiveY, blend]`. The first two are the perspective
|
|
69
|
+
* terms of the projective mapping of the unit square onto the corners, and `blend` mixes that
|
|
70
|
+
* mapping towards the bilinear one: 0 is purely projective, 1 purely bilinear. A parallelogram,
|
|
71
|
+
* and a quad with no perspective view (concave, self-crossing or collinear), is warped bilinearly.
|
|
72
|
+
*/
|
|
73
|
+
export type ImageWarp = [number, number, number];
|
|
74
|
+
/**
|
|
75
|
+
* The warp of an image onto its corners, with MapLibre GL JS's `calculateImageWarp`, in Web
|
|
76
|
+
* Mercator space. A warp is the same in any frame that differs by an affine map, so y up gives
|
|
77
|
+
* the warp of MapLibre's y-down tile space.
|
|
78
|
+
*/
|
|
79
|
+
export declare function getImageWarp(corners: ImageSourceCorners): ImageWarp;
|
|
80
|
+
/**
|
|
81
|
+
* The place of a point of the image, `u` right and `v` down from its top left corner in 0 to 1, in
|
|
82
|
+
* the same units as the corners: MapLibre's raster vertex shader.
|
|
83
|
+
*/
|
|
84
|
+
export declare function warpImagePoint([topLeft, topRight, bottomRight, bottomLeft]: [number, number][], [perspectiveX, perspectiveY, blend]: ImageWarp, u: number, v: number): [number, number];
|
|
85
|
+
/**
|
|
86
|
+
* The grid cells along each side of the mesh of an image (see `createImageMesh`): one for a
|
|
87
|
+
* parallelogram, `WARP_GRID_CELLS` for another quad, more where `subdivisionStep` asks for them,
|
|
88
|
+
* and never more than `MAX_IMAGE_GRID_CELLS`.
|
|
89
|
+
*/
|
|
90
|
+
export declare function getImageGridCells(corners: ImageSourceCorners, subdivisionStep?: number): number;
|
|
91
|
+
/** A mesh of an image, as `BitmapLayer` draws it. */
|
|
92
|
+
export type ImageMesh = {
|
|
93
|
+
/** The count of indices. */
|
|
94
|
+
vertexCount: number;
|
|
95
|
+
/** Longitude, latitude and 0 of each vertex. */
|
|
96
|
+
positions: Float64Array;
|
|
97
|
+
indices: Uint32Array;
|
|
98
|
+
/** The image coordinates of each vertex, with v down. */
|
|
99
|
+
texCoords: Float32Array;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* The mesh of an image warped onto its corners (see `getImageWarp`). A parallelogram is one cell,
|
|
103
|
+
* split from its bottom left to its top right corner as MapLibre splits it; another quad is a grid
|
|
104
|
+
* of `WARP_GRID_CELLS`, or of more cells where `subdivisionStep` (degrees, on a globe) asks for
|
|
105
|
+
* them, up to `MAX_IMAGE_GRID_CELLS`. The vertices are placed in Web Mercator space, so the image is uniform there, as in MapLibre.
|
|
106
|
+
*/
|
|
107
|
+
export declare function createImageMesh(corners: ImageSourceCorners, subdivisionStep?: number): ImageMesh;
|
|
108
|
+
/**
|
|
109
|
+
* Whether the corners are listed counterclockwise on the map, which mirrors the image. Its
|
|
110
|
+
* triangles then face away, and a globe, which culls back faces, must cull front faces instead, as
|
|
111
|
+
* MapLibre GL JS does. Measured in Web Mercator space, as MapLibre measures it.
|
|
112
|
+
*/
|
|
113
|
+
export declare function hasFlippedWinding([topLeft, topRight, bottomRight]: ImageSourceCorners): boolean;
|
|
114
|
+
/** A `BitmapLayer` that draws an image warped onto four corners (see `createImageMesh`). */
|
|
115
|
+
declare class ImageQuadLayer extends BitmapLayer<{
|
|
116
|
+
corners: ImageSourceCorners;
|
|
117
|
+
}> {
|
|
118
|
+
static layerName: string;
|
|
119
|
+
protected _createMesh(): ReturnType<BitmapLayer["_createMesh"]>;
|
|
120
|
+
}
|
|
121
|
+
/** Props of {@link ImageSourceLayer}. */
|
|
122
|
+
export type ImageSourceLayerProps = CompositeLayerProps & {
|
|
123
|
+
/** The URL of the image, loaded with the layer's `fetch` and `loadOptions`. */
|
|
124
|
+
image: string;
|
|
125
|
+
/** The corners the image is drawn at (see {@link getImageSourceCorners}). */
|
|
126
|
+
corners: ImageSourceCorners;
|
|
127
|
+
/** The texture parameters of the image, or null for the defaults of `BitmapLayer`. */
|
|
128
|
+
textureParameters?: Record<string, unknown> | null;
|
|
129
|
+
/** The load options of the basemap, for the image. */
|
|
130
|
+
loadOptions?: BasemapLoadOptions | null;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Draws a `raster` style layer over an `image` source: one image warped onto four corners, as
|
|
134
|
+
* MapLibre GL JS draws it. The layer's extensions (`RasterColorExtension`) pass to the image, as
|
|
135
|
+
* they pass to each tile of a raster tile layer.
|
|
136
|
+
*/
|
|
137
|
+
export declare class ImageSourceLayer extends CompositeLayer<ImageSourceLayerProps> {
|
|
138
|
+
static layerName: string;
|
|
139
|
+
static defaultProps: DefaultProps<ImageSourceLayerProps>;
|
|
140
|
+
renderLayers(): ImageQuadLayer;
|
|
141
|
+
}
|
|
142
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,33 @@
|
|
|
1
|
-
/** Runtime exports for `@
|
|
1
|
+
/** Runtime exports for `@tangram.gl/basemap-layers`. */
|
|
2
2
|
export { BasemapLayer } from "./basemap-layer.js";
|
|
3
|
+
export type { BasemapTile } from "./basemap-layer.js";
|
|
4
|
+
export type { BasemapSourceData } from "./basemap-layer.js";
|
|
5
|
+
export type { BasemapInsertion } from "./basemap-layer.js";
|
|
6
|
+
export type { BasemapGlobeConfig, BasemapLayerLoadOptions, BasemapLayerProps } from "./basemap-layer.js";
|
|
7
|
+
export type { BasemapLoadOptions, BasemapSource, BasemapStyle, BasemapStyleLayer, ResolvedBasemapStyle, ResolvedBasemapStyleLayer } from "./style-resolver.js";
|
|
8
|
+
export { BasemapLoadError } from "./basemap-error.js";
|
|
9
|
+
export type { BasemapLoadErrorDetails, BasemapLoadErrorKind } from "./basemap-error.js";
|
|
10
|
+
export { DemPixelReadError } from "./dem-pixels.js";
|
|
11
|
+
export type { BasemapSourceFeature, QuerySourceFeaturesOptions } from "./source-features.js";
|
|
12
|
+
export { pickTerrainSurface } from "./terrain-query.js";
|
|
13
|
+
export type { TerrainSurface, TerrainSurfaceHit } from "./terrain-query.js";
|
|
14
|
+
export type { BasemapFeatureState, BasemapPickedFeature, FeatureState, FeatureStates } from "./feature-state.js";
|
|
3
15
|
export { createDemTileset, getBasemapLayers, getGlobeBaseLayers, getGlobeTopLayers } from "./globe-layers.js";
|
|
16
|
+
export type { StyleLayerSubLayerProps } from "./globe-layers.js";
|
|
4
17
|
export { getSpriteIconMapping, getSpriteSources, loadSpriteAtlases } from "./sprite.js";
|
|
5
18
|
export type { SpriteAtlas, SpriteIconMappingEntry, SpriteSource } from "./sprite.js";
|
|
6
19
|
export { getLabelFont } from "./text-font.js";
|
|
7
20
|
export type { LabelFont, LabelFontFamily } from "./text-font.js";
|
|
21
|
+
export { createRasterTileFingerprintFilter, getRasterTileFingerprint } from "./raster-tile-fingerprint.js";
|
|
22
|
+
export type { RasterTileIndex, RasterTileResponse, RejectRasterTile } from "./raster-tile-loader.js";
|
|
23
|
+
export type { BasemapResourceType, BasemapTransformedRequest, BasemapTransformRequest } from "./basemap-request.js";
|
|
8
24
|
export { GlyphStore } from "./glyph-store.js";
|
|
9
25
|
export type { GlyphStoreOptions } from "./glyph-store.js";
|
|
26
|
+
export { ProjectedBitmapLayer } from "./projected-bitmap-layer.js";
|
|
27
|
+
export { DEFAULT_MAX_STRETCH, getProjectedTileIndices } from "./projected-tile-selection.js";
|
|
28
|
+
export type { ProjectedTileIndex, ProjectedTileSelectionOptions } from "./projected-tile-selection.js";
|
|
29
|
+
export { ProjectedTileLayer, ProjectedTileset2D } from "./projected-tileset.js";
|
|
30
|
+
export { getMercatorZoom } from "./projected-viewport.js";
|
|
31
|
+
export type { ProjectedViewportLike } from "./projected-viewport.js";
|
|
32
|
+
export { registerBasemapProtocol, unregisterBasemapProtocol } from "./basemap-protocol.js";
|
|
33
|
+
export type { BasemapProtocolHandler, BasemapRequestParameters, BasemapRequestType, BasemapResourceResponse } from "./basemap-protocol.js";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LayerExtension } from '@deck.gl/core';
|
|
2
2
|
import type { Layer, UpdateParameters } from '@deck.gl/core';
|
|
3
|
-
import type { ShaderModule } from '@luma.gl/shadertools';
|
|
4
3
|
export type LineBlurExtensionOptions = {
|
|
5
4
|
/**
|
|
6
5
|
* Reads `getBlur` per path, from an attribute. Otherwise `getBlur` must be a constant, which a
|
|
@@ -9,11 +8,6 @@ export type LineBlurExtensionOptions = {
|
|
|
9
8
|
*/
|
|
10
9
|
perFeature: boolean;
|
|
11
10
|
};
|
|
12
|
-
type LineBlurProps = {
|
|
13
|
-
blur: number;
|
|
14
|
-
gapOffset: number;
|
|
15
|
-
gapSide: number;
|
|
16
|
-
};
|
|
17
11
|
/**
|
|
18
12
|
* Adds `getBlur` to the `PathLayer`s of a layer drawn with `antialiasing` (for a `GeoJsonLayer`,
|
|
19
13
|
* `lineAntialiasing`): per path, the CSS pixels over which the edges fade out, as MapLibre GL JS
|
|
@@ -51,14 +45,13 @@ export declare class LineBlurExtension extends LayerExtension<LineBlurExtensionO
|
|
|
51
45
|
initializeState(this: Layer, context: unknown, extension: this): void;
|
|
52
46
|
updateState(this: Layer<any>, params: UpdateParameters<Layer<any>>, extension: this): void;
|
|
53
47
|
getShaders(this: Layer, extension: this): {
|
|
54
|
-
|
|
48
|
+
plugins?: undefined;
|
|
55
49
|
defines?: undefined;
|
|
56
50
|
} | {
|
|
57
|
-
|
|
51
|
+
plugins: import("@luma.gl/shaders").ShaderPlugin[];
|
|
58
52
|
defines: {
|
|
53
|
+
LINE_BLUR_ENABLED: boolean;
|
|
59
54
|
LINE_BLUR_PER_FEATURE: boolean;
|
|
60
|
-
} | {
|
|
61
|
-
LINE_BLUR_PER_FEATURE?: undefined;
|
|
62
55
|
};
|
|
63
56
|
};
|
|
64
57
|
}
|
|
@@ -70,4 +63,3 @@ export declare class LineBlurExtension extends LayerExtension<LineBlurExtensionO
|
|
|
70
63
|
* edges. Lines without a gap, or without width, keep their width.
|
|
71
64
|
*/
|
|
72
65
|
export declare function getBlurredLineWidth(width: number, gapWidth: number, blur: number): number;
|
|
73
|
-
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { LayerExtension } from '@deck.gl/core';
|
|
2
|
+
import type { Accessor, CompositeLayer, Layer } from '@deck.gl/core';
|
|
3
|
+
/** The most dash intervals a pattern can store before it falls back to one dash and gap. */
|
|
4
|
+
export declare const MAX_DASH_INTERVALS = 32;
|
|
5
|
+
type DashArray = readonly [number, number];
|
|
6
|
+
type DashPattern = {
|
|
7
|
+
intervals: readonly DashArray[];
|
|
8
|
+
period: number;
|
|
9
|
+
dashLength: number;
|
|
10
|
+
merged: DashArray;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Registers normalized lengths in line widths and returns their stable row, or -1 if the
|
|
14
|
+
* pattern exceeds the atlas limits. Intervals use half widths to match PathLayer's coordinates.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getDashPatternRow(pattern: number[]): number;
|
|
17
|
+
/** The pattern stored in an atlas row, in half line widths. */
|
|
18
|
+
export declare function getDashPattern(row: number): DashPattern | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Draws every dash and gap of a `line-dasharray`, as MapLibre GL JS does, on the `PathLayer`s of
|
|
21
|
+
* a layer that also has `PathStyleExtension({dash: true, dashMode: 'path'})`, listed after it.
|
|
22
|
+
* `getDashArray` returns `[period, -(row + 1)]` (see `getDashPatternRow`): it takes no vertex
|
|
23
|
+
* attribute of its own, as a dashed path with offsets has none left. The negative gap turns
|
|
24
|
+
* deck.gl's own dash test off; the pattern's dashes come from a data texture shared by the
|
|
25
|
+
* device's layers. Dashes are box-filtered along the path, and end in semicircles with round
|
|
26
|
+
* caps, so a zero-length dash draws a dot. A gap of 0 or more is drawn by deck.gl as before. WebGL
|
|
27
|
+
* only: on WebGPU, `getDashArray` is replaced by the pattern's total dash and gap lengths.
|
|
28
|
+
*/
|
|
29
|
+
export declare class LineDashExtension extends LayerExtension {
|
|
30
|
+
static extensionName: string;
|
|
31
|
+
static defaultProps: {
|
|
32
|
+
getDashArray: {
|
|
33
|
+
type: string;
|
|
34
|
+
value: number[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/** Whether this layer can run the pattern shader. */
|
|
38
|
+
isEnabled(layer: Layer): boolean;
|
|
39
|
+
/** On WebGPU, forward the merged dash and gap to PathStyleExtension. */
|
|
40
|
+
getSubLayerProps(this: CompositeLayer, extension: this): {
|
|
41
|
+
getDashArray?: Accessor<unknown, DashArray>;
|
|
42
|
+
updateTriggers: Record<string, unknown>;
|
|
43
|
+
};
|
|
44
|
+
/** Bind the current device atlas, including rows registered since the last draw. */
|
|
45
|
+
draw(this: Layer, params: unknown, extension: this): void;
|
|
46
|
+
/** Install the ordered dash calculations on supported PathLayers. */
|
|
47
|
+
getShaders(this: Layer, extension: this): {
|
|
48
|
+
plugins: import("@luma.gl/shaders").ShaderPlugin[];
|
|
49
|
+
} | {
|
|
50
|
+
plugins?: undefined;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { LayerExtension } from '@deck.gl/core';
|
|
2
|
+
import type { CompositeLayer, Layer } from '@deck.gl/core';
|
|
3
|
+
/** `geojson-vt`'s properties for a line's part in a tile, with `lineMetrics`. */
|
|
4
|
+
export declare const LINE_CLIP_START = "geojsonvt_clip_start";
|
|
5
|
+
export declare const LINE_CLIP_END = "geojsonvt_clip_end";
|
|
6
|
+
/** A `line-gradient` ramp, and the sampler parameters to draw it with. */
|
|
7
|
+
export type LineGradientRamp = {
|
|
8
|
+
image: ImageData | {
|
|
9
|
+
data: Uint8ClampedArray;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
13
|
+
textureParameters: Record<string, string>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The `line-gradient` of a style layer as a one-row RGBA ramp, from `line-progress` 0 at its first
|
|
17
|
+
* pixel to 1 at its last, unpremultiplied, as MapLibre GL JS renders it (`renderColorRamp`). A
|
|
18
|
+
* `step` gradient is sampled with the nearest pixel, as MapLibre does, the others linearly. Null
|
|
19
|
+
* without a valid `line-gradient`. Cached per style layer while its value is unchanged.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getLineGradientRamp(styleLayer: {
|
|
22
|
+
paint?: Record<string, unknown>;
|
|
23
|
+
}): LineGradientRamp | null;
|
|
24
|
+
/** A tiled line's part of its whole line, `[start, end]`, from its `lineMetrics` properties. */
|
|
25
|
+
export declare function getLineClip(feature: {
|
|
26
|
+
properties?: Record<string, unknown>;
|
|
27
|
+
}): [number, number];
|
|
28
|
+
/**
|
|
29
|
+
* Adds `line-gradient` to the `PathLayer`s of a layer: each fragment takes the color of
|
|
30
|
+
* `lineGradientImage`, a ramp of `line-gradient` from progress 0 at its left edge to 1 at its
|
|
31
|
+
* right, at the fragment's `line-progress`, times the stroke's own color, as MapLibre GL JS
|
|
32
|
+
* multiplies the ramp by `line-opacity`. The stroke color should be white with the opacity.
|
|
33
|
+
*
|
|
34
|
+
* `getLineClip` gives a path's part of its whole line, `[start, end]` in 0 to 1, as geojson-vt
|
|
35
|
+
* records it for a source with `lineMetrics` (`geojsonvt_clip_start`, `geojsonvt_clip_end`). The
|
|
36
|
+
* progress runs from `start` to `end` along the path, by distance, as in MapLibre. WebGL only:
|
|
37
|
+
* on WebGPU the paths draw `getLineGradientFallbackColor`, the line-color.
|
|
38
|
+
*/
|
|
39
|
+
export declare class LineGradientExtension extends LayerExtension {
|
|
40
|
+
static extensionName: string;
|
|
41
|
+
static defaultProps: {
|
|
42
|
+
lineGradientImage: {
|
|
43
|
+
type: string;
|
|
44
|
+
value: null;
|
|
45
|
+
async: boolean;
|
|
46
|
+
};
|
|
47
|
+
getLineClip: {
|
|
48
|
+
type: string;
|
|
49
|
+
value: number[];
|
|
50
|
+
};
|
|
51
|
+
getLineGradientFallbackColor: {
|
|
52
|
+
type: string;
|
|
53
|
+
value: number[];
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
isEnabled(layer: Layer): boolean;
|
|
57
|
+
initializeState(this: Layer, context: unknown, extension: this): void;
|
|
58
|
+
/**
|
|
59
|
+
* On WebGPU, where the ramp shader does not run, the paths draw `getLineGradientFallbackColor`
|
|
60
|
+
* in place of the white stroke color that the ramp multiplies.
|
|
61
|
+
*/
|
|
62
|
+
getSubLayerProps(this: CompositeLayer, extension: this): any;
|
|
63
|
+
draw(this: Layer<any>, params: unknown, extension: this): void;
|
|
64
|
+
getShaders(this: Layer, extension: this): {
|
|
65
|
+
plugins?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
plugins: import("@luma.gl/shaders").ShaderPlugin[];
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Attribute, Layer } from '@deck.gl/core';
|
|
2
|
+
/** The distances of one rendered segment of a path, in common units. */
|
|
3
|
+
export type SegmentDistances = {
|
|
4
|
+
/** From the start of the path to the segment's start. */
|
|
5
|
+
start: number;
|
|
6
|
+
/** From the start of the path to the segment's end. */
|
|
7
|
+
end: number;
|
|
8
|
+
/** The path's length. */
|
|
9
|
+
length: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* An attribute `update` for a `PathLayer` that writes `size` values per rendered segment, from
|
|
13
|
+
* `getValues` given the segment's distances and its path's object. The distances are measured
|
|
14
|
+
* between the positions as deck.gl projects them, in the order the path runs, from 0 at each
|
|
15
|
+
* path's start: as MapLibre GL JS measures a line's distance from the start of the line within its
|
|
16
|
+
* tile. Padding and joint vertices get 0.
|
|
17
|
+
*
|
|
18
|
+
* WebGL2 guarantees 16 vertex attributes, and a `PathLayer` with dashes and offsets uses all of
|
|
19
|
+
* them: each value of a segment that a layer can compute on the CPU goes in one such attribute.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createSegmentAttributeUpdate(getValues: (distances: SegmentDistances, object: any, objectInfo: any) => number[]): (this: Layer, attribute: Attribute, { startRow, endRow }: {
|
|
22
|
+
startRow: number;
|
|
23
|
+
endRow: number;
|
|
24
|
+
}) => void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { LayerExtension } from '@deck.gl/core';
|
|
2
|
+
import type { CompositeLayer, Layer } from '@deck.gl/core';
|
|
3
|
+
/**
|
|
4
|
+
* Adds `line-pattern` to the `PathLayer`s of a layer, as MapLibre GL JS draws it: the image is
|
|
5
|
+
* stretched across the line's width and repeated along it, at its own aspect ratio. Its height is
|
|
6
|
+
* the line's `line-width` at the integer zoom (`getLinePatternWidth`), and its length is measured
|
|
7
|
+
* from the start of each line in the tile, in pixels at the integer zoom: between integer zooms
|
|
8
|
+
* the pattern scales with the map. Each fragment takes the image's color times the stroke's own
|
|
9
|
+
* color, which should be white with the line's opacity.
|
|
10
|
+
*
|
|
11
|
+
* `linePatternAtlas` holds the images, each with a 1 pixel border copied from its opposite edge
|
|
12
|
+
* (see `getPatternAtlas`), at `linePatternMapping`'s rectangles; `getLinePattern` names a path's
|
|
13
|
+
* image. `linePatternPixelsPerUnit` is 2 to the integer zoom: pixels per common unit at that
|
|
14
|
+
* zoom. WebGL only: on WebGPU the paths draw nothing.
|
|
15
|
+
*/
|
|
16
|
+
export declare class LinePatternExtension extends LayerExtension {
|
|
17
|
+
static extensionName: string;
|
|
18
|
+
static defaultProps: {
|
|
19
|
+
linePatternAtlas: {
|
|
20
|
+
type: string;
|
|
21
|
+
value: null;
|
|
22
|
+
async: boolean;
|
|
23
|
+
};
|
|
24
|
+
linePatternMapping: {
|
|
25
|
+
type: string;
|
|
26
|
+
value: {};
|
|
27
|
+
async: boolean;
|
|
28
|
+
};
|
|
29
|
+
linePatternPixelsPerUnit: number;
|
|
30
|
+
getLinePattern: {
|
|
31
|
+
type: string;
|
|
32
|
+
value: string;
|
|
33
|
+
};
|
|
34
|
+
getLinePatternWidth: {
|
|
35
|
+
type: string;
|
|
36
|
+
value: number;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
isEnabled(layer: Layer): boolean;
|
|
40
|
+
initializeState(this: Layer<any>, context: unknown, extension: this): void;
|
|
41
|
+
/** On WebGPU, where the pattern shader does not run, the paths draw nothing. */
|
|
42
|
+
getSubLayerProps(this: CompositeLayer, extension: this): any;
|
|
43
|
+
updateState(this: Layer<any>, { props, oldProps }: any, extension: this): void;
|
|
44
|
+
draw(this: Layer<any>, params: unknown, extension: this): void;
|
|
45
|
+
getShaders(this: Layer, extension: this): {
|
|
46
|
+
plugins?: undefined;
|
|
47
|
+
} | {
|
|
48
|
+
plugins: import("@luma.gl/shaders").ShaderPlugin[];
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { LayerExtension } from '@deck.gl/core';
|
|
2
|
+
import type { Accessor, CompositeLayer, Layer, LayerContext, UpdateParameters } from '@deck.gl/core';
|
|
3
|
+
import { PathStyleExtension } from '@deck.gl/extensions';
|
|
4
|
+
import type { PathStyleExtensionProps } from '@deck.gl/extensions';
|
|
5
|
+
import type { ShaderPlugin } from '@luma.gl/shaders';
|
|
6
|
+
type LineShapeProps = {
|
|
7
|
+
lineCapSquare?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/** The largest miter ratio that the line shape shader can measure. */
|
|
10
|
+
export declare const MAX_LINE_SHAPE_MITER_RATIO: number;
|
|
11
|
+
/**
|
|
12
|
+
* Draws a `PathLayer`'s caps and joins as MapLibre GL JS draws `line-cap` and `line-join`, which
|
|
13
|
+
* deck.gl does not: with `lineCapSquare`, each end of a path extends past its endpoint by half
|
|
14
|
+
* the line's width, or by half the gap plus the line width for a gap. A join whose miter exceeds
|
|
15
|
+
* `miterLimit + 1` half widths is bevelled (see `GET_JOINT_CUT`). Set `capRounded: false` for
|
|
16
|
+
* a square cap. Adds no vertex attribute. WebGL
|
|
17
|
+
* only, and not on billboard paths; joins of paths with `PathStyleExtension`'s offsets keep
|
|
18
|
+
* deck.gl's flat cut.
|
|
19
|
+
*/
|
|
20
|
+
export declare class LineShapeExtension extends LayerExtension {
|
|
21
|
+
static extensionName: string;
|
|
22
|
+
static defaultProps: {
|
|
23
|
+
lineCapSquare: boolean;
|
|
24
|
+
};
|
|
25
|
+
/** Forward the cap choice to the shader. */
|
|
26
|
+
updateState(this: Layer<LineShapeProps>, { props }: UpdateParameters<Layer<LineShapeProps>>): void;
|
|
27
|
+
/** Install the shape shader on supported PathLayers. */
|
|
28
|
+
getShaders(this: Layer): {
|
|
29
|
+
plugins: ShaderPlugin[];
|
|
30
|
+
} | {
|
|
31
|
+
plugins?: undefined;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Carries the distance to a square gap cap alongside the lateral offset. WebGL2 only guarantees
|
|
36
|
+
* 16 vertex attributes, all of which a dashed and offset path already uses.
|
|
37
|
+
*/
|
|
38
|
+
export declare class GapCapOffsetExtension extends PathStyleExtension {
|
|
39
|
+
static extensionName: string;
|
|
40
|
+
static defaultProps: {
|
|
41
|
+
getSquareGapCap: {
|
|
42
|
+
type: string;
|
|
43
|
+
value: number;
|
|
44
|
+
};
|
|
45
|
+
getDashArray: {
|
|
46
|
+
type: string;
|
|
47
|
+
value: number[];
|
|
48
|
+
};
|
|
49
|
+
getOffset: {
|
|
50
|
+
type: string;
|
|
51
|
+
value: number;
|
|
52
|
+
};
|
|
53
|
+
dashJustified: boolean;
|
|
54
|
+
dashGapPickable: boolean;
|
|
55
|
+
dashUnits: string;
|
|
56
|
+
};
|
|
57
|
+
/** Pack the lateral offset and the per-feature square cap length into one accessor on WebGL. */
|
|
58
|
+
getSubLayerProps(this: CompositeLayer, extension: this): {
|
|
59
|
+
getOffset: Accessor<unknown, number>;
|
|
60
|
+
getSquareGapCap: Accessor<unknown, number>;
|
|
61
|
+
updateTriggers: Record<string, unknown>;
|
|
62
|
+
} | {
|
|
63
|
+
getOffset: import("@deck.gl/core").AccessorFunction<unknown, [number, number]>;
|
|
64
|
+
updateTriggers: {
|
|
65
|
+
getOffset: unknown[];
|
|
66
|
+
};
|
|
67
|
+
getSquareGapCap: Accessor<unknown, number>;
|
|
68
|
+
};
|
|
69
|
+
/** Use the packed buffer from the first model build. */
|
|
70
|
+
initializeState(this: Layer<PathStyleExtensionProps>, context: LayerContext, extension: this): void;
|
|
71
|
+
/** Refresh the layout if an existing path starts drawing with an offset. */
|
|
72
|
+
updateState(this: Layer<PathStyleExtensionProps>, params: UpdateParameters<Layer<PathStyleExtensionProps>>, extension: this): void;
|
|
73
|
+
/** Adapt the existing PathStyle shader to read the first component for lateral offsets. */
|
|
74
|
+
getShaders(this: Layer<PathStyleExtensionProps>, extension: this): any;
|
|
75
|
+
}
|
|
76
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LoaderContext, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
1
|
+
import type { LoaderContext, LoaderOptions } from '@loaders.gl/core/loader-utils';
|
|
2
2
|
import type { BasemapLoadOptions, ResolvedBasemapStyle } from "./style-resolver.js";
|
|
3
3
|
/** Namespaced loaders.gl options for {@link MapStyleLoader}. */
|
|
4
4
|
export type MapStyleLoaderOptions = LoaderOptions & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** Map-style helpers exported from `@
|
|
1
|
+
/** Map-style helpers exported from `@tangram.gl/basemap-layers/map-style`. */
|
|
2
2
|
export { filterFeatures, findFeaturesStyledByLayer, parseProperties } from "./mapbox-style.js";
|
|
3
3
|
export { BasemapSourceSchema, BasemapStyleLayerSchema, BasemapStyleSchema, ResolvedBasemapStyleSchema } from "./map-style-schema.js";
|
|
4
4
|
export { MapStyleLoader } from "./map-style-loader.js";
|
|
5
5
|
export type { MapStyleLoaderOptions } from "./map-style-loader.js";
|
|
6
|
-
export { resolveBasemapStyle, type BasemapLoadOptions, type BasemapSource, type BasemapStyle, type BasemapStyleLayer, type ResolvedBasemapStyleLayer, type ResolvedBasemapStyle } from "./style-resolver.js";
|
|
6
|
+
export { isResolvedBasemapStyle, resolveBasemapStyle, type BasemapLoadOptions, type BasemapSource, type BasemapStyle, type BasemapStyleLayer, type ResolvedBasemapStyleLayer, type ResolvedBasemapStyle } from "./style-resolver.js";
|