@deck.gl/geo-layers 8.8.0-beta.2 → 8.8.0-beta.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/dist/dist.dev.js +1867 -1646
- package/dist/es5/geohash-layer/geohash-layer.js +71 -0
- package/dist/es5/geohash-layer/geohash-layer.js.map +1 -0
- package/dist/es5/geohash-layer/geohash-utils.js +77 -0
- package/dist/es5/geohash-layer/geohash-utils.js.map +1 -0
- package/dist/es5/index.js +8 -0
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/terrain-layer/terrain-layer.js +57 -34
- package/dist/es5/terrain-layer/terrain-layer.js.map +1 -1
- package/dist/es5/tile-3d-layer/tile-3d-layer.js.map +1 -1
- package/dist/es5/tile-layer/tile-layer.js +4 -2
- package/dist/es5/tile-layer/tile-layer.js.map +1 -1
- package/dist/es5/tile-layer/tileset-2d.js +38 -1
- package/dist/es5/tile-layer/tileset-2d.js.map +1 -1
- package/dist/es5/tile-layer/utils.js +46 -12
- package/dist/es5/tile-layer/utils.js.map +1 -1
- package/dist/esm/geohash-layer/geohash-layer.js +29 -0
- package/dist/esm/geohash-layer/geohash-layer.js.map +1 -0
- package/dist/esm/geohash-layer/geohash-utils.js +56 -0
- package/dist/esm/geohash-layer/geohash-utils.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/terrain-layer/terrain-layer.js +35 -13
- package/dist/esm/terrain-layer/terrain-layer.js.map +1 -1
- package/dist/esm/tile-3d-layer/tile-3d-layer.js.map +1 -1
- package/dist/esm/tile-layer/tile-layer.js +6 -2
- package/dist/esm/tile-layer/tile-layer.js.map +1 -1
- package/dist/esm/tile-layer/tileset-2d.js +36 -3
- package/dist/esm/tile-layer/tileset-2d.js.map +1 -1
- package/dist/esm/tile-layer/utils.js +36 -0
- package/dist/esm/tile-layer/utils.js.map +1 -1
- package/dist.min.js +2 -2
- package/package.json +2 -2
- package/src/geohash-layer/geohash-layer.ts +38 -0
- package/src/geohash-layer/geohash-utils.ts +54 -0
- package/src/index.ts +3 -0
- package/src/terrain-layer/{terrain-layer.js → terrain-layer.ts} +119 -37
- package/src/tile-3d-layer/tile-3d-layer.ts +4 -4
- package/src/tile-layer/tile-layer.ts +4 -2
- package/src/tile-layer/tileset-2d.ts +41 -5
- package/src/tile-layer/utils.ts +44 -0
- package/typed/geohash-layer/geohash-layer.d.ts +20 -0
- package/typed/geohash-layer/geohash-layer.d.ts.map +1 -0
- package/typed/geohash-layer/geohash-utils.d.ts +3 -0
- package/typed/geohash-layer/geohash-utils.d.ts.map +1 -0
- package/typed/index.d.ts +3 -0
- package/typed/index.d.ts.map +1 -1
- package/typed/terrain-layer/terrain-layer.d.ts +61 -26
- package/typed/terrain-layer/terrain-layer.d.ts.map +1 -1
- package/typed/tile-3d-layer/tile-3d-layer.d.ts +3 -3
- package/typed/tile-layer/tile-layer.d.ts +2 -4
- package/typed/tile-layer/tile-layer.d.ts.map +1 -1
- package/typed/tile-layer/tileset-2d.d.ts +10 -2
- package/typed/tile-layer/tileset-2d.d.ts.map +1 -1
- package/typed/tile-layer/utils.d.ts +14 -0
- package/typed/tile-layer/utils.d.ts.map +1 -1
- package/typed/geo-cell-layer/GeoCellLayer.js +0 -49
- package/typed/great-circle-layer/great-circle-layer.js +0 -29
- package/typed/h3-layers/h3-cluster-layer.js +0 -33
- package/typed/h3-layers/h3-hexagon-layer.js +0 -251
- package/typed/index.js +0 -33
- package/typed/mesh-layer/mesh-layer-fragment.glsl.js +0 -55
- package/typed/mesh-layer/mesh-layer-vertex.glsl.js +0 -80
- package/typed/mesh-layer/mesh-layer.js +0 -110
- package/typed/mvt-layer/coordinate-transform.js +0 -41
- package/typed/mvt-layer/find-index-binary.js +0 -96
- package/typed/mvt-layer/mvt-layer.js +0 -297
- package/typed/quadkey-layer/quadkey-layer.js +0 -18
- package/typed/quadkey-layer/quadkey-utils.js +0 -26
- package/typed/s2-layer/s2-geometry.js +0 -123
- package/typed/s2-layer/s2-layer.js +0 -37
- package/typed/s2-layer/s2-utils.js +0 -88
- package/typed/terrain-layer/terrain-layer.js +0 -226
- package/typed/tile-3d-layer/tile-3d-layer.js +0 -294
- package/typed/tile-layer/tile-2d-header.js +0 -113
- package/typed/tile-layer/tile-2d-traversal.js +0 -181
- package/typed/tile-layer/tile-layer.js +0 -192
- package/typed/tile-layer/tileset-2d.js +0 -399
- package/typed/tile-layer/types.js +0 -1
- package/typed/tile-layer/utils.js +0 -197
- package/typed/trips-layer/trips-layer.js +0 -92
|
@@ -1,28 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
* state: {
|
|
3
|
-
* isTiled: True renders TileLayer of many SimpleMeshLayers, false renders one SimpleMeshLayer
|
|
4
|
-
* terrain: Mesh object. Only defined when isTiled is false.
|
|
5
|
-
* }
|
|
6
|
-
*/
|
|
7
|
-
declare class TerrainLayer extends CompositeLayer<any> {
|
|
8
|
-
constructor(...propObjects: Partial<any>[]);
|
|
9
|
-
loadTerrain({ elevationData, bounds, elevationDecoder, meshMaxError, signal }: {
|
|
10
|
-
elevationData: any;
|
|
11
|
-
bounds: any;
|
|
12
|
-
elevationDecoder: any;
|
|
13
|
-
meshMaxError: any;
|
|
14
|
-
signal: any;
|
|
15
|
-
}): any;
|
|
16
|
-
getTiledTerrainData(tile: any): Promise<[any, any]>;
|
|
17
|
-
renderSubLayers(props: any): SimpleMeshLayer<any, {}> | null;
|
|
18
|
-
onViewportLoad(tiles: any): void;
|
|
19
|
-
}
|
|
20
|
-
declare namespace TerrainLayer {
|
|
21
|
-
export const layerName: string;
|
|
22
|
-
export { defaultProps };
|
|
23
|
-
}
|
|
24
|
-
export default TerrainLayer;
|
|
25
|
-
import { CompositeLayer } from '@deck.gl/core/typed';
|
|
1
|
+
import { Color, CompositeLayer, CompositeLayerProps, DefaultProps, Layer, LayersList, Material, Texture, UpdateParameters } from '@deck.gl/core/typed';
|
|
26
2
|
import { SimpleMeshLayer } from '@deck.gl/mesh-layers/typed';
|
|
27
|
-
|
|
3
|
+
import type { MeshAttributes } from '@loaders.gl/schema';
|
|
4
|
+
import { TileLayerProps } from '../tile-layer/tile-layer';
|
|
5
|
+
import Tile2DHeader from '../tile-layer/tile-2d-header';
|
|
6
|
+
import { Bounds, TileLoadProps, ZRange } from '../tile-layer/types';
|
|
7
|
+
declare type URLTemplate = string | string[];
|
|
8
|
+
declare type ElevationDecoder = {
|
|
9
|
+
rScaler: number;
|
|
10
|
+
gScaler: number;
|
|
11
|
+
bScaler: number;
|
|
12
|
+
offset: number;
|
|
13
|
+
};
|
|
14
|
+
declare type TerrainLoadProps = {
|
|
15
|
+
bounds: Bounds;
|
|
16
|
+
elevationData: string | null;
|
|
17
|
+
elevationDecoder: ElevationDecoder;
|
|
18
|
+
meshMaxError: number;
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
};
|
|
21
|
+
declare type MeshAndTexture = [MeshAttributes | null, Texture | null];
|
|
22
|
+
/** All properties supported by TerrainLayer */
|
|
23
|
+
export declare type TerrainLayerProps = _TerrainLayerProps & TileLayerProps<MeshAndTexture> & CompositeLayerProps;
|
|
24
|
+
/** Props added by the TerrainLayer */
|
|
25
|
+
declare type _TerrainLayerProps = {
|
|
26
|
+
/** Image url that encodes height data. **/
|
|
27
|
+
elevationData: URLTemplate;
|
|
28
|
+
/** Image url to use as texture. **/
|
|
29
|
+
texture?: URLTemplate | null;
|
|
30
|
+
/** Martini error tolerance in meters, smaller number -> more detailed mesh. **/
|
|
31
|
+
meshMaxError?: number;
|
|
32
|
+
/** Bounding box of the terrain image, [minX, minY, maxX, maxY] in world coordinates. **/
|
|
33
|
+
bounds?: Bounds | null;
|
|
34
|
+
/** Color to use if texture is unavailable. **/
|
|
35
|
+
color?: Color;
|
|
36
|
+
/** Object to decode height data, from (r, g, b) to height in meters. **/
|
|
37
|
+
elevationDecoder?: ElevationDecoder;
|
|
38
|
+
/** Whether to render the mesh in wireframe mode. **/
|
|
39
|
+
wireframe?: boolean;
|
|
40
|
+
/** Material props for lighting effect. **/
|
|
41
|
+
material?: Material;
|
|
42
|
+
};
|
|
43
|
+
export default class TerrainLayer<ExtraPropsT = {}> extends CompositeLayer<ExtraPropsT & Required<_TerrainLayerProps & Required<TileLayerProps<MeshAndTexture>>>> {
|
|
44
|
+
static defaultProps: DefaultProps<TerrainLayerProps>;
|
|
45
|
+
static layerName: string;
|
|
46
|
+
state: {
|
|
47
|
+
isTiled?: boolean;
|
|
48
|
+
terrain: MeshAttributes;
|
|
49
|
+
zRange?: ZRange | null;
|
|
50
|
+
};
|
|
51
|
+
updateState({ props, oldProps }: UpdateParameters<this>): void;
|
|
52
|
+
loadTerrain({ elevationData, bounds, elevationDecoder, meshMaxError, signal }: TerrainLoadProps): Promise<MeshAttributes> | null;
|
|
53
|
+
getTiledTerrainData(tile: TileLoadProps): Promise<MeshAndTexture>;
|
|
54
|
+
renderSubLayers(props: TileLayerProps<MeshAndTexture> & {
|
|
55
|
+
id: string;
|
|
56
|
+
data: MeshAndTexture;
|
|
57
|
+
tile: Tile2DHeader<MeshAndTexture>;
|
|
58
|
+
}): SimpleMeshLayer<any, {}> | null;
|
|
59
|
+
onViewportLoad(tiles?: Tile2DHeader<MeshAndTexture>[]): void;
|
|
60
|
+
renderLayers(): Layer | null | LayersList;
|
|
61
|
+
}
|
|
62
|
+
export {};
|
|
28
63
|
//# sourceMappingURL=terrain-layer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terrain-layer.d.ts","sourceRoot":"","sources":["../../src/terrain-layer/terrain-layer.
|
|
1
|
+
{"version":3,"file":"terrain-layer.d.ts","sourceRoot":"","sources":["../../src/terrain-layer/terrain-layer.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,KAAK,EACL,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,KAAK,EACL,UAAU,EAEV,QAAQ,EACR,OAAO,EACP,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,eAAe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D, Tile3D } from '@loaders.gl/tiles';
|
|
3
3
|
import { Tiles3DLoader } from '@loaders.gl/3d-tiles';
|
|
4
4
|
/** All properties supported by Tile3DLayer */
|
|
5
|
-
export declare type
|
|
5
|
+
export declare type Tile3DLayerProps<DataT = any> = _Tile3DLayerProps<DataT> & CompositeLayerProps<DataT>;
|
|
6
6
|
/** Props added by the Tile3DLayer */
|
|
7
|
-
declare type
|
|
7
|
+
declare type _Tile3DLayerProps<DataT> = {
|
|
8
8
|
/** Color Accessor for point clouds. **/
|
|
9
9
|
getPointColor?: Accessor<DataT, Color>;
|
|
10
10
|
/** Global radius of all points in pixels. **/
|
|
@@ -24,7 +24,7 @@ declare type _Tile3dLayerProps<DataT> = {
|
|
|
24
24
|
/** (Experimental) Accessor to change color of mesh based on properties. **/
|
|
25
25
|
_getMeshColor?: (tile: Tile3D) => Color;
|
|
26
26
|
};
|
|
27
|
-
export default class Tile3DLayer<DataT = any, ExtraPropsT = {}> extends CompositeLayer<ExtraPropsT & Required<
|
|
27
|
+
export default class Tile3DLayer<DataT = any, ExtraPropsT = {}> extends CompositeLayer<ExtraPropsT & Required<_Tile3DLayerProps<DataT>>> {
|
|
28
28
|
static defaultProps: any;
|
|
29
29
|
static layerName: string;
|
|
30
30
|
state: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CompositeLayer, CompositeLayerProps, Layer, LayerProps, UpdateParameters, PickingInfo, GetPickingInfoParams } from '@deck.gl/core/typed';
|
|
1
|
+
import { CompositeLayer, CompositeLayerProps, Layer, LayerProps, UpdateParameters, PickingInfo, GetPickingInfoParams, FilterContext } from '@deck.gl/core/typed';
|
|
2
2
|
import { LayersList } from 'modules/core/src/lib/layer-manager';
|
|
3
3
|
import Tile2DHeader from './tile-2d-header';
|
|
4
4
|
import Tileset2D, { RefinementStrategy, Tileset2DProps } from './tileset-2d';
|
|
@@ -110,9 +110,7 @@ export default class TileLayer<DataT = any, ExtraPropsT = {}> extends CompositeL
|
|
|
110
110
|
getPickingInfo({ info, sourceLayer }: GetPickingInfoParams): TiledPickingInfo<DataT>;
|
|
111
111
|
protected _updateAutoHighlight(info: PickingInfo): void;
|
|
112
112
|
renderLayers(): Layer | null | LayersList;
|
|
113
|
-
filterSubLayer({ layer }:
|
|
114
|
-
layer: any;
|
|
115
|
-
}): any;
|
|
113
|
+
filterSubLayer({ layer, cullRect }: FilterContext): any;
|
|
116
114
|
}
|
|
117
115
|
export {};
|
|
118
116
|
//# sourceMappingURL=tile-layer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-layer.d.ts","sourceRoot":"","sources":["../../src/tile-layer/tile-layer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,oBAAoB,
|
|
1
|
+
{"version":3,"file":"tile-layer.d.ts","sourceRoot":"","sources":["../../src/tile-layer/tile-layer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EAEpB,aAAa,EAEd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,UAAU,EAAC,MAAM,oCAAoC,CAAC;AAC9D,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAE5C,OAAO,SAAS,EAAE,EAAC,kBAAkB,EAAoB,cAAc,EAAC,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAC,aAAa,EAAE,MAAM,EAAC,MAAM,SAAS,CAAC;AA2B9C,2CAA2C;AAC3C,oBAAY,cAAc,CAAC,KAAK,GAAG,GAAG,IAAI,mBAAmB,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;AAE5F,mCAAmC;AACnC,aAAK,eAAe,CAAC,KAAK,IAAI;IAC5B;;OAEG;IACH,YAAY,EAAE,OAAO,SAAS,CAAC;IAC/B;;OAEG;IACH,e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CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;KAC3B,GACA,KAAK,GAAG,IAAI,GAAG,UAAU;IAI5B,sBAAsB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI;IAItE,cAAc,CAAC,EAAC,IAAI,EAAE,WAAW,EAAC,EAAE,oBAAoB,GAAG,gBAAgB,CAAC,KAAK,CAAC;IAKlF,SAAS,CAAC,oBAAoB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAMvD,YAAY,IAAI,KAAK,GAAG,IAAI,GAAG,UAAU;IAiCzC,cAAc,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAC,EAAE,aAAa;CAIhD"}
|
|
@@ -26,6 +26,7 @@ export default class Tileset2D {
|
|
|
26
26
|
private _tiles;
|
|
27
27
|
private _cacheByteSize;
|
|
28
28
|
private _viewport;
|
|
29
|
+
private _zRange?;
|
|
29
30
|
private _selectedTiles;
|
|
30
31
|
private _frameNumber;
|
|
31
32
|
private _modelMatrix;
|
|
@@ -52,6 +53,12 @@ export default class Tileset2D {
|
|
|
52
53
|
zRange?: ZRange;
|
|
53
54
|
modelMatrix?: Matrix4;
|
|
54
55
|
}): number;
|
|
56
|
+
isTileVisible(tile: Tile2DHeader, cullRect?: {
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
width: number;
|
|
60
|
+
height: number;
|
|
61
|
+
}): boolean;
|
|
55
62
|
/** Returns array of tile indices in the current viewport */
|
|
56
63
|
getTileIndices({ viewport, maxZoom, minZoom, zRange, modelMatrix, modelMatrixInverse }: {
|
|
57
64
|
viewport: Viewport;
|
|
@@ -76,8 +83,9 @@ export default class Tileset2D {
|
|
|
76
83
|
z: number;
|
|
77
84
|
};
|
|
78
85
|
private updateTileStates;
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
private _getCullBounds;
|
|
87
|
+
private _pruneRequests;
|
|
88
|
+
private _rebuildTree;
|
|
81
89
|
/**
|
|
82
90
|
* Clear tiles that are not visible when the cache is full
|
|
83
91
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tileset-2d.d.ts","sourceRoot":"","sources":["../../src/tile-layer/tileset-2d.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"tileset-2d.d.ts","sourceRoot":"","sources":["../../src/tile-layer/tileset-2d.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAC,OAAO,EAAS,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAS,SAAS,EAAE,MAAM,EAAC,MAAM,SAAS,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAyB5C,eAAO,MAAM,cAAc,UAAU,CAAC;AACtC,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAC7C,eAAO,MAAM,gBAAgB,mBAAmB,CAAC;AAEjD,oBAAY,0BAA0B,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;AACzE,oBAAY,kBAAkB,GAC1B,OAAO,cAAc,GACrB,OAAO,gBAAgB,GACvB,OAAO,gBAAgB,GACvB,0BAA0B,CAAC;AAU/B,oBAAY,cAAc,GAAG,IAAI,CAC/B,QAAQ,CAAC,cAAc,CAAC,EACtB,UAAU,GACV,cAAc,GACd,kBAAkB,GAClB,oBAAoB,GACpB,QAAQ,GACR,SAAS,GACT,SAAS,GACT,aAAa,GACb,YAAY,CACf,GAAG;IACF,WAAW,EAAE,WAAW,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC;IACxD,UAAU,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IACzC,YAAY,EAA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CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,GAC/D,OAAO;IAyBV,4DAA4D;IAC5D,cAAc,CAAC,EACb,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,EACN,WAAW,EACX,kBAAkB,EACnB,EAAE;QACD,QAAQ,EAAE,QAAQ,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;QAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,SAAS,EAAE;IAef,iDAAiD;IACjD,SAAS,CAAC,KAAK,EAAE,SAAS;IAI1B,4CAA4C;IAC5C,WAAW,CAAC,KAAK,EAAE,SAAS;IAI5B,kEAAkE;IAClE,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAMtD,uCAAuC;IACvC,cAAc,CAAC,KAAK,EAAE,SAAS;;;;;IAQ/B,OAAO,CAAC,gBAAgB;IAoCxB,OAAO,CAAC,cAAc,CAA0B;IAEhD,OAAO,CAAC,cAAc;IAwBtB,OAAO,CAAC,YAAY;IAqBpB;;OAEG;IAEH,OAAO,CAAC,YAAY;IAmCpB,OAAO,CAAC,QAAQ;IA8BhB,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,GAAG,IAAI;CAa7D"}
|
|
@@ -11,6 +11,20 @@ export declare function getURLFromTemplate(template: string | string[], tile: {
|
|
|
11
11
|
index: TileIndex;
|
|
12
12
|
id: string;
|
|
13
13
|
}): string | null;
|
|
14
|
+
/** Get culling bounds in world space */
|
|
15
|
+
export declare function getCullBounds({ viewport, z, cullRect }: {
|
|
16
|
+
/** Current viewport */
|
|
17
|
+
viewport: Viewport;
|
|
18
|
+
/** Current z range */
|
|
19
|
+
z: ZRange | number | undefined;
|
|
20
|
+
/** Culling rectangle in screen space */
|
|
21
|
+
cullRect: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
};
|
|
27
|
+
}): [number, number, number, number];
|
|
14
28
|
export declare function osmTile2lngLat(x: number, y: number, z: number): [number, number];
|
|
15
29
|
export declare function tileToBoundingBox(viewport: Viewport, x: number, y: number, z: number, tileSize?: number): TileBoundingBox;
|
|
16
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/tile-layer/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAC,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,SAAS,CAAC;AAKnF,eAAO,MAAM,OAAO;;;;;CAyBnB,CAAC;AA8BF,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,IAAI,EAAE;IACJ,KAAK,EAAE,SAAS,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ,GACA,MAAM,GAAG,IAAI,CAsBf;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/tile-layer/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAC,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAC,MAA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AAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,eA0BA;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,cAAc,CAO5D"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { CompositeLayer } from '@deck.gl/core';
|
|
2
|
-
import { PolygonLayer } from '@deck.gl/layers';
|
|
3
|
-
const defaultProps = {
|
|
4
|
-
...PolygonLayer.defaultProps
|
|
5
|
-
};
|
|
6
|
-
export default class GeoCellLayer extends CompositeLayer {
|
|
7
|
-
/** Implement to generate props to create geometry. */
|
|
8
|
-
indexToBounds() {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
renderLayers() {
|
|
12
|
-
// Rendering props underlying layer
|
|
13
|
-
const { elevationScale, extruded, wireframe, filled, stroked, lineWidthUnits, lineWidthScale, lineWidthMinPixels, lineWidthMaxPixels, lineJointRounded, lineMiterLimit, lineDashJustified, getElevation, getFillColor, getLineColor, getLineWidth } = this.props;
|
|
14
|
-
// Accessor props for underlying layers
|
|
15
|
-
const { updateTriggers, material, transitions } = this.props;
|
|
16
|
-
// Filled Polygon Layer
|
|
17
|
-
const CellLayer = this.getSubLayerClass('cell', PolygonLayer);
|
|
18
|
-
return new CellLayer({
|
|
19
|
-
filled,
|
|
20
|
-
wireframe,
|
|
21
|
-
extruded,
|
|
22
|
-
elevationScale,
|
|
23
|
-
stroked,
|
|
24
|
-
lineWidthUnits,
|
|
25
|
-
lineWidthScale,
|
|
26
|
-
lineWidthMinPixels,
|
|
27
|
-
lineWidthMaxPixels,
|
|
28
|
-
lineJointRounded,
|
|
29
|
-
lineMiterLimit,
|
|
30
|
-
lineDashJustified,
|
|
31
|
-
material,
|
|
32
|
-
transitions,
|
|
33
|
-
getElevation,
|
|
34
|
-
getFillColor,
|
|
35
|
-
getLineColor,
|
|
36
|
-
getLineWidth
|
|
37
|
-
}, this.getSubLayerProps({
|
|
38
|
-
id: 'cell',
|
|
39
|
-
updateTriggers: updateTriggers && {
|
|
40
|
-
getElevation: updateTriggers.getElevation,
|
|
41
|
-
getFillColor: updateTriggers.getFillColor,
|
|
42
|
-
getLineColor: updateTriggers.getLineColor,
|
|
43
|
-
getLineWidth: updateTriggers.getLineWidth
|
|
44
|
-
}
|
|
45
|
-
}), this.indexToBounds());
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
GeoCellLayer.layerName = 'GeoCellLayer';
|
|
49
|
-
GeoCellLayer.defaultProps = defaultProps;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
20
|
-
import { ArcLayer } from '@deck.gl/layers';
|
|
21
|
-
// This layer has been merged into the core ArcLayer
|
|
22
|
-
// Keeping for backward-compatibility
|
|
23
|
-
export default class GreatCircleLayer extends ArcLayer {
|
|
24
|
-
}
|
|
25
|
-
GreatCircleLayer.layerName = 'GreatCircleLayer';
|
|
26
|
-
GreatCircleLayer.defaultProps = {
|
|
27
|
-
getHeight: { type: 'accessor', value: 0 },
|
|
28
|
-
greatCircle: true
|
|
29
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { h3SetToMultiPolygon } from 'h3-js';
|
|
2
|
-
import { createIterable } from '@deck.gl/core';
|
|
3
|
-
import GeoCellLayer from '../geo-cell-layer/GeoCellLayer';
|
|
4
|
-
const defaultProps = {
|
|
5
|
-
getHexagons: { type: 'accessor', value: d => d.hexagons }
|
|
6
|
-
};
|
|
7
|
-
export default class H3ClusterLayer extends GeoCellLayer {
|
|
8
|
-
updateState({ props, oldProps, changeFlags }) {
|
|
9
|
-
if (changeFlags.dataChanged ||
|
|
10
|
-
(changeFlags.updateTriggers && changeFlags.updateTriggers.getHexagons)) {
|
|
11
|
-
const { data, getHexagons } = props;
|
|
12
|
-
const polygons = [];
|
|
13
|
-
const { iterable, objectInfo } = createIterable(data);
|
|
14
|
-
for (const object of iterable) {
|
|
15
|
-
objectInfo.index++;
|
|
16
|
-
const hexagons = getHexagons(object, objectInfo);
|
|
17
|
-
const multiPolygon = h3SetToMultiPolygon(hexagons, true);
|
|
18
|
-
for (const polygon of multiPolygon) {
|
|
19
|
-
polygons.push(this.getSubLayerRow({ polygon }, object, objectInfo.index));
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
this.setState({ polygons });
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
indexToBounds() {
|
|
26
|
-
return {
|
|
27
|
-
data: this.state.polygons,
|
|
28
|
-
getPolygon: d => d.polygon
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
H3ClusterLayer.defaultProps = defaultProps;
|
|
33
|
-
H3ClusterLayer.layerName = 'H3ClusterLayer';
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import { h3ToGeoBoundary, h3GetResolution, h3ToGeo, geoToH3, h3IsPentagon, h3Distance, edgeLength, UNITS } from 'h3-js';
|
|
2
|
-
import { lerp } from '@math.gl/core';
|
|
3
|
-
import { CompositeLayer, createIterable } from '@deck.gl/core';
|
|
4
|
-
import { ColumnLayer, PolygonLayer } from '@deck.gl/layers';
|
|
5
|
-
// There is a cost to updating the instanced geometries when using highPrecision: false
|
|
6
|
-
// This constant defines the distance between two hexagons that leads to "significant
|
|
7
|
-
// distortion." Smaller value makes the column layer more sensitive to viewport change.
|
|
8
|
-
const UPDATE_THRESHOLD_KM = 10;
|
|
9
|
-
// normalize longitudes w.r.t center (refLng), when not provided first vertex
|
|
10
|
-
export function normalizeLongitudes(vertices, refLng) {
|
|
11
|
-
refLng = refLng === undefined ? vertices[0][0] : refLng;
|
|
12
|
-
for (const pt of vertices) {
|
|
13
|
-
const deltaLng = pt[0] - refLng;
|
|
14
|
-
if (deltaLng > 180) {
|
|
15
|
-
pt[0] -= 360;
|
|
16
|
-
}
|
|
17
|
-
else if (deltaLng < -180) {
|
|
18
|
-
pt[0] += 360;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
// scale polygon vertices w.r.t center (hexId)
|
|
23
|
-
export function scalePolygon(hexId, vertices, factor) {
|
|
24
|
-
const [lat, lng] = h3ToGeo(hexId);
|
|
25
|
-
const actualCount = vertices.length;
|
|
26
|
-
// normalize with respect to center
|
|
27
|
-
normalizeLongitudes(vertices, lng);
|
|
28
|
-
// `h3ToGeoBoundary` returns same array object for first and last vertex (closed polygon),
|
|
29
|
-
// if so skip scaling the last vertex
|
|
30
|
-
const vertexCount = vertices[0] === vertices[actualCount - 1] ? actualCount - 1 : actualCount;
|
|
31
|
-
for (let i = 0; i < vertexCount; i++) {
|
|
32
|
-
vertices[i][0] = lerp(lng, vertices[i][0], factor);
|
|
33
|
-
vertices[i][1] = lerp(lat, vertices[i][1], factor);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function getHexagonCentroid(getHexagon, object, objectInfo) {
|
|
37
|
-
const hexagonId = getHexagon(object, objectInfo);
|
|
38
|
-
const [lat, lng] = h3ToGeo(hexagonId);
|
|
39
|
-
return [lng, lat];
|
|
40
|
-
}
|
|
41
|
-
function h3ToPolygon(hexId, coverage = 1, flatten) {
|
|
42
|
-
const vertices = h3ToGeoBoundary(hexId, true);
|
|
43
|
-
if (coverage !== 1) {
|
|
44
|
-
// scale and normalize vertices w.r.t to center
|
|
45
|
-
scalePolygon(hexId, vertices, coverage);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
// normalize w.r.t to start vertex
|
|
49
|
-
normalizeLongitudes(vertices);
|
|
50
|
-
}
|
|
51
|
-
if (flatten) {
|
|
52
|
-
const positions = new Float64Array(vertices.length * 2);
|
|
53
|
-
let i = 0;
|
|
54
|
-
for (const pt of vertices) {
|
|
55
|
-
positions[i++] = pt[0];
|
|
56
|
-
positions[i++] = pt[1];
|
|
57
|
-
}
|
|
58
|
-
return positions;
|
|
59
|
-
}
|
|
60
|
-
return vertices;
|
|
61
|
-
}
|
|
62
|
-
function mergeTriggers(getHexagon, coverage) {
|
|
63
|
-
let trigger;
|
|
64
|
-
if (getHexagon === undefined || getHexagon === null) {
|
|
65
|
-
trigger = coverage;
|
|
66
|
-
}
|
|
67
|
-
else if (typeof getHexagon === 'object') {
|
|
68
|
-
trigger = { ...getHexagon, coverage };
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
trigger = { getHexagon, coverage };
|
|
72
|
-
}
|
|
73
|
-
return trigger;
|
|
74
|
-
}
|
|
75
|
-
const defaultProps = {
|
|
76
|
-
...PolygonLayer.defaultProps,
|
|
77
|
-
highPrecision: 'auto',
|
|
78
|
-
coverage: { type: 'number', min: 0, max: 1, value: 1 },
|
|
79
|
-
centerHexagon: null,
|
|
80
|
-
getHexagon: { type: 'accessor', value: x => x.hexagon },
|
|
81
|
-
extruded: true
|
|
82
|
-
};
|
|
83
|
-
// not supported
|
|
84
|
-
delete defaultProps.getLineDashArray;
|
|
85
|
-
/**
|
|
86
|
-
* A subclass of HexagonLayer that uses H3 hexagonIds in data objects
|
|
87
|
-
* rather than centroid lat/longs. The shape of each hexagon is determined
|
|
88
|
-
* based on a single "center" hexagon, which can be selected by passing in
|
|
89
|
-
* a center lat/lon pair. If not provided, the map center will be used.
|
|
90
|
-
*
|
|
91
|
-
* Also sets the `hexagonId` field in the onHover/onClick callback's info
|
|
92
|
-
* objects. Since this is calculated using math, hexagonId will be present
|
|
93
|
-
* even when no corresponding hexagon is in the data set. You can check
|
|
94
|
-
* index !== -1 to see if picking matches an actual object.
|
|
95
|
-
*/
|
|
96
|
-
export default class H3HexagonLayer extends CompositeLayer {
|
|
97
|
-
shouldUpdateState({ changeFlags }) {
|
|
98
|
-
return this._shouldUseHighPrecision()
|
|
99
|
-
? changeFlags.propsOrDataChanged
|
|
100
|
-
: changeFlags.somethingChanged;
|
|
101
|
-
}
|
|
102
|
-
updateState({ props, oldProps, changeFlags }) {
|
|
103
|
-
if (props.highPrecision !== true &&
|
|
104
|
-
(changeFlags.dataChanged ||
|
|
105
|
-
(changeFlags.updateTriggers && changeFlags.updateTriggers.getHexagon))) {
|
|
106
|
-
const dataProps = this._calculateH3DataProps(props);
|
|
107
|
-
this.setState(dataProps);
|
|
108
|
-
}
|
|
109
|
-
this._updateVertices(this.context.viewport);
|
|
110
|
-
}
|
|
111
|
-
_calculateH3DataProps(props) {
|
|
112
|
-
let resolution = -1;
|
|
113
|
-
let hasPentagon = false;
|
|
114
|
-
let hasMultipleRes = false;
|
|
115
|
-
const { iterable, objectInfo } = createIterable(props.data);
|
|
116
|
-
for (const object of iterable) {
|
|
117
|
-
objectInfo.index++;
|
|
118
|
-
const hexId = props.getHexagon(object, objectInfo);
|
|
119
|
-
// Take the resolution of the first hex
|
|
120
|
-
const hexResolution = h3GetResolution(hexId);
|
|
121
|
-
if (resolution < 0) {
|
|
122
|
-
resolution = hexResolution;
|
|
123
|
-
if (!props.highPrecision)
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
else if (resolution !== hexResolution) {
|
|
127
|
-
hasMultipleRes = true;
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
if (h3IsPentagon(hexId)) {
|
|
131
|
-
hasPentagon = true;
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return {
|
|
136
|
-
resolution,
|
|
137
|
-
edgeLengthKM: resolution >= 0 ? edgeLength(resolution, UNITS.km) : 0,
|
|
138
|
-
hasMultipleRes,
|
|
139
|
-
hasPentagon
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
_shouldUseHighPrecision() {
|
|
143
|
-
if (this.props.highPrecision === 'auto') {
|
|
144
|
-
const { resolution, hasPentagon, hasMultipleRes } = this.state;
|
|
145
|
-
const { viewport } = this.context;
|
|
146
|
-
return (viewport.resolution || hasMultipleRes || hasPentagon || (resolution >= 0 && resolution <= 5));
|
|
147
|
-
}
|
|
148
|
-
return this.props.highPrecision;
|
|
149
|
-
}
|
|
150
|
-
_updateVertices(viewport) {
|
|
151
|
-
if (this._shouldUseHighPrecision()) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
const { resolution, edgeLengthKM, centerHex } = this.state;
|
|
155
|
-
if (resolution < 0) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
const hex = this.props.centerHexagon || geoToH3(viewport.latitude, viewport.longitude, resolution);
|
|
159
|
-
if (centerHex === hex) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
if (centerHex) {
|
|
163
|
-
const distance = h3Distance(centerHex, hex);
|
|
164
|
-
// h3Distance returns a negative number if the distance could not be computed
|
|
165
|
-
// due to the two indexes very far apart or on opposite sides of a pentagon.
|
|
166
|
-
if (distance >= 0 && distance * edgeLengthKM < UPDATE_THRESHOLD_KM) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
const { unitsPerMeter } = viewport.distanceScales;
|
|
171
|
-
let vertices = h3ToPolygon(hex);
|
|
172
|
-
const [centerLat, centerLng] = h3ToGeo(hex);
|
|
173
|
-
const [centerX, centerY] = viewport.projectFlat([centerLng, centerLat]);
|
|
174
|
-
vertices = vertices.map(p => {
|
|
175
|
-
const worldPosition = viewport.projectFlat(p);
|
|
176
|
-
return [
|
|
177
|
-
(worldPosition[0] - centerX) / unitsPerMeter[0],
|
|
178
|
-
(worldPosition[1] - centerY) / unitsPerMeter[1]
|
|
179
|
-
];
|
|
180
|
-
});
|
|
181
|
-
this.setState({ centerHex: hex, vertices });
|
|
182
|
-
}
|
|
183
|
-
renderLayers() {
|
|
184
|
-
return this._shouldUseHighPrecision() ? this._renderPolygonLayer() : this._renderColumnLayer();
|
|
185
|
-
}
|
|
186
|
-
_getForwardProps() {
|
|
187
|
-
const { elevationScale, material, coverage, extruded, wireframe, stroked, filled, lineWidthUnits, lineWidthScale, lineWidthMinPixels, lineWidthMaxPixels, getFillColor, getElevation, getLineColor, getLineWidth, transitions, updateTriggers } = this.props;
|
|
188
|
-
return {
|
|
189
|
-
elevationScale,
|
|
190
|
-
extruded,
|
|
191
|
-
coverage,
|
|
192
|
-
wireframe,
|
|
193
|
-
stroked,
|
|
194
|
-
filled,
|
|
195
|
-
lineWidthUnits,
|
|
196
|
-
lineWidthScale,
|
|
197
|
-
lineWidthMinPixels,
|
|
198
|
-
lineWidthMaxPixels,
|
|
199
|
-
material,
|
|
200
|
-
getElevation,
|
|
201
|
-
getFillColor,
|
|
202
|
-
getLineColor,
|
|
203
|
-
getLineWidth,
|
|
204
|
-
transitions,
|
|
205
|
-
updateTriggers: {
|
|
206
|
-
getFillColor: updateTriggers.getFillColor,
|
|
207
|
-
getElevation: updateTriggers.getElevation,
|
|
208
|
-
getLineColor: updateTriggers.getLineColor,
|
|
209
|
-
getLineWidth: updateTriggers.getLineWidth
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
_renderPolygonLayer() {
|
|
214
|
-
const { data, getHexagon, updateTriggers, coverage } = this.props;
|
|
215
|
-
const SubLayerClass = this.getSubLayerClass('hexagon-cell-hifi', PolygonLayer);
|
|
216
|
-
const forwardProps = this._getForwardProps();
|
|
217
|
-
forwardProps.updateTriggers.getPolygon = mergeTriggers(updateTriggers.getHexagon, coverage);
|
|
218
|
-
return new SubLayerClass(forwardProps, this.getSubLayerProps({
|
|
219
|
-
id: 'hexagon-cell-hifi',
|
|
220
|
-
updateTriggers: forwardProps.updateTriggers
|
|
221
|
-
}), {
|
|
222
|
-
data,
|
|
223
|
-
_normalize: false,
|
|
224
|
-
_windingOrder: 'CCW',
|
|
225
|
-
positionFormat: 'XY',
|
|
226
|
-
getPolygon: (object, objectInfo) => {
|
|
227
|
-
const hexagonId = getHexagon(object, objectInfo);
|
|
228
|
-
return h3ToPolygon(hexagonId, coverage, true);
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
_renderColumnLayer() {
|
|
233
|
-
const { data, getHexagon, updateTriggers } = this.props;
|
|
234
|
-
const SubLayerClass = this.getSubLayerClass('hexagon-cell', ColumnLayer);
|
|
235
|
-
const forwardProps = this._getForwardProps();
|
|
236
|
-
forwardProps.updateTriggers.getPosition = updateTriggers.getHexagon;
|
|
237
|
-
return new SubLayerClass(forwardProps, this.getSubLayerProps({
|
|
238
|
-
id: 'hexagon-cell',
|
|
239
|
-
flatShading: true,
|
|
240
|
-
updateTriggers: forwardProps.updateTriggers
|
|
241
|
-
}), {
|
|
242
|
-
data,
|
|
243
|
-
diskResolution: 6,
|
|
244
|
-
radius: 1,
|
|
245
|
-
vertices: this.state.vertices,
|
|
246
|
-
getPosition: getHexagonCentroid.bind(null, getHexagon)
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
H3HexagonLayer.defaultProps = defaultProps;
|
|
251
|
-
H3HexagonLayer.layerName = 'H3HexagonLayer';
|
package/typed/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
20
|
-
/* eslint-disable max-len */
|
|
21
|
-
export { default as GreatCircleLayer } from './great-circle-layer/great-circle-layer';
|
|
22
|
-
export { default as S2Layer } from './s2-layer/s2-layer';
|
|
23
|
-
export { default as QuadkeyLayer } from './quadkey-layer/quadkey-layer';
|
|
24
|
-
export { default as TileLayer } from './tile-layer/tile-layer';
|
|
25
|
-
export { default as TripsLayer } from './trips-layer/trips-layer';
|
|
26
|
-
export { default as H3ClusterLayer } from './h3-layers/h3-cluster-layer';
|
|
27
|
-
export { default as H3HexagonLayer } from './h3-layers/h3-hexagon-layer';
|
|
28
|
-
export { default as Tile3DLayer } from './tile-3d-layer/tile-3d-layer';
|
|
29
|
-
export { default as TerrainLayer } from './terrain-layer/terrain-layer';
|
|
30
|
-
export { default as MVTLayer } from './mvt-layer/mvt-layer';
|
|
31
|
-
export { getURLFromTemplate as _getURLFromTemplate } from './tile-layer/utils';
|
|
32
|
-
export { default as _Tileset2D } from './tile-layer/tileset-2d';
|
|
33
|
-
export { default as _Tile2DHeader } from './tile-layer/tile-2d-header';
|