@deck.gl/geo-layers 8.8.0-beta.3 → 8.8.0-beta.4

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.
Files changed (42) hide show
  1. package/dist/dist.dev.js +1622 -1612
  2. package/dist/es5/h3-layers/h3-cluster-layer.js +7 -0
  3. package/dist/es5/h3-layers/h3-cluster-layer.js.map +1 -1
  4. package/dist/es5/h3-layers/h3-hexagon-layer.js +3 -0
  5. package/dist/es5/h3-layers/h3-hexagon-layer.js.map +1 -1
  6. package/dist/esm/h3-layers/h3-cluster-layer.js +5 -0
  7. package/dist/esm/h3-layers/h3-cluster-layer.js.map +1 -1
  8. package/dist/esm/h3-layers/h3-hexagon-layer.js +4 -0
  9. package/dist/esm/h3-layers/h3-hexagon-layer.js.map +1 -1
  10. package/dist.min.js +1 -1
  11. package/package.json +2 -2
  12. package/src/h3-layers/h3-cluster-layer.ts +5 -0
  13. package/src/h3-layers/h3-hexagon-layer.ts +4 -0
  14. package/typed/geo-cell-layer/GeoCellLayer.js +49 -0
  15. package/typed/great-circle-layer/great-circle-layer.js +29 -0
  16. package/typed/h3-layers/h3-cluster-layer.d.ts +1 -0
  17. package/typed/h3-layers/h3-cluster-layer.d.ts.map +1 -1
  18. package/typed/h3-layers/h3-cluster-layer.js +33 -0
  19. package/typed/h3-layers/h3-hexagon-layer.d.ts +1 -0
  20. package/typed/h3-layers/h3-hexagon-layer.d.ts.map +1 -1
  21. package/typed/h3-layers/h3-hexagon-layer.js +251 -0
  22. package/typed/index.js +33 -0
  23. package/typed/mesh-layer/mesh-layer-fragment.glsl.js +55 -0
  24. package/typed/mesh-layer/mesh-layer-vertex.glsl.js +80 -0
  25. package/typed/mesh-layer/mesh-layer.js +110 -0
  26. package/typed/mvt-layer/coordinate-transform.js +41 -0
  27. package/typed/mvt-layer/find-index-binary.js +96 -0
  28. package/typed/mvt-layer/mvt-layer.js +297 -0
  29. package/typed/quadkey-layer/quadkey-layer.js +18 -0
  30. package/typed/quadkey-layer/quadkey-utils.js +26 -0
  31. package/typed/s2-layer/s2-geometry.js +123 -0
  32. package/typed/s2-layer/s2-layer.js +37 -0
  33. package/typed/s2-layer/s2-utils.js +88 -0
  34. package/typed/terrain-layer/terrain-layer.js +226 -0
  35. package/typed/tile-3d-layer/tile-3d-layer.js +294 -0
  36. package/typed/tile-layer/tile-2d-header.js +113 -0
  37. package/typed/tile-layer/tile-2d-traversal.js +181 -0
  38. package/typed/tile-layer/tile-layer.js +192 -0
  39. package/typed/tile-layer/tileset-2d.js +399 -0
  40. package/typed/tile-layer/types.js +1 -0
  41. package/typed/tile-layer/utils.js +197 -0
  42. package/typed/trips-layer/trips-layer.js +92 -0
@@ -0,0 +1,123 @@
1
+ /*
2
+ Adapted from s2-geometry
3
+
4
+ ISC License (ISC)
5
+
6
+ Copyright (c) 2012-2016, Jon Atkins <github@jonatkins.com>
7
+ Copyright (c) 2016, AJ ONeal <aj@daplie.com>
8
+
9
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
12
+ */
13
+ import Long from 'long';
14
+ //
15
+ // Functional Style
16
+ //
17
+ const FACE_BITS = 3;
18
+ const MAX_LEVEL = 30;
19
+ const POS_BITS = 2 * MAX_LEVEL + 1; // 61 (60 bits of data, 1 bit lsb marker)
20
+ const RADIAN_TO_DEGREE = 180 / Math.PI;
21
+ export function IJToST(ij, order, offsets) {
22
+ const maxSize = 1 << order;
23
+ return [(ij[0] + offsets[0]) / maxSize, (ij[1] + offsets[1]) / maxSize];
24
+ }
25
+ function singleSTtoUV(st) {
26
+ if (st >= 0.5) {
27
+ return (1 / 3.0) * (4 * st * st - 1);
28
+ }
29
+ return (1 / 3.0) * (1 - 4 * (1 - st) * (1 - st));
30
+ }
31
+ export function STToUV(st) {
32
+ return [singleSTtoUV(st[0]), singleSTtoUV(st[1])];
33
+ }
34
+ export function FaceUVToXYZ(face, [u, v]) {
35
+ switch (face) {
36
+ case 0:
37
+ return [1, u, v];
38
+ case 1:
39
+ return [-u, 1, v];
40
+ case 2:
41
+ return [-u, -v, 1];
42
+ case 3:
43
+ return [-1, -v, -u];
44
+ case 4:
45
+ return [v, -1, -u];
46
+ case 5:
47
+ return [v, u, -1];
48
+ default:
49
+ throw new Error('Invalid face');
50
+ }
51
+ }
52
+ export function XYZToLngLat([x, y, z]) {
53
+ const lat = Math.atan2(z, Math.sqrt(x * x + y * y));
54
+ const lng = Math.atan2(y, x);
55
+ return [lng * RADIAN_TO_DEGREE, lat * RADIAN_TO_DEGREE];
56
+ }
57
+ export function toHilbertQuadkey(idS) {
58
+ let bin = Long.fromString(idS, true, 10).toString(2);
59
+ while (bin.length < FACE_BITS + POS_BITS) {
60
+ // eslint-disable-next-line prefer-template
61
+ bin = '0' + bin;
62
+ }
63
+ // MUST come AFTER binstr has been left-padded with '0's
64
+ const lsbIndex = bin.lastIndexOf('1');
65
+ // substr(start, len)
66
+ // substring(start, end) // includes start, does not include end
67
+ const faceB = bin.substring(0, 3);
68
+ // posB will always be a multiple of 2 (or it's invalid)
69
+ const posB = bin.substring(3, lsbIndex);
70
+ const levelN = posB.length / 2;
71
+ const faceS = Long.fromString(faceB, true, 2).toString(10);
72
+ let posS = Long.fromString(posB, true, 2).toString(4);
73
+ while (posS.length < levelN) {
74
+ // eslint-disable-next-line prefer-template
75
+ posS = '0' + posS;
76
+ }
77
+ return `${faceS}/${posS}`;
78
+ }
79
+ function rotateAndFlipQuadrant(n, point, rx, ry) {
80
+ if (ry === 0) {
81
+ if (rx === 1) {
82
+ point[0] = n - 1 - point[0];
83
+ point[1] = n - 1 - point[1];
84
+ }
85
+ const x = point[0];
86
+ point[0] = point[1];
87
+ point[1] = x;
88
+ }
89
+ }
90
+ export function FromHilbertQuadKey(hilbertQuadkey) {
91
+ const parts = hilbertQuadkey.split('/');
92
+ const face = parseInt(parts[0], 10);
93
+ const position = parts[1];
94
+ const maxLevel = position.length;
95
+ const point = [0, 0];
96
+ let level;
97
+ for (let i = maxLevel - 1; i >= 0; i--) {
98
+ level = maxLevel - i;
99
+ const bit = position[i];
100
+ let rx = 0;
101
+ let ry = 0;
102
+ if (bit === '1') {
103
+ ry = 1;
104
+ }
105
+ else if (bit === '2') {
106
+ rx = 1;
107
+ ry = 1;
108
+ }
109
+ else if (bit === '3') {
110
+ rx = 1;
111
+ }
112
+ const val = Math.pow(2, level - 1);
113
+ rotateAndFlipQuadrant(val, point, rx, ry);
114
+ point[0] += val * rx;
115
+ point[1] += val * ry;
116
+ }
117
+ if (face % 2 === 1) {
118
+ const t = point[0];
119
+ point[0] = point[1];
120
+ point[1] = t;
121
+ }
122
+ return { face, ij: point, level };
123
+ }
@@ -0,0 +1,37 @@
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 GeoCellLayer from '../geo-cell-layer/GeoCellLayer';
21
+ import { getS2Polygon } from './s2-utils';
22
+ const defaultProps = {
23
+ getS2Token: { type: 'accessor', value: d => d.token }
24
+ };
25
+ export default class S2Layer extends GeoCellLayer {
26
+ indexToBounds() {
27
+ const { data, getS2Token } = this.props;
28
+ return {
29
+ data,
30
+ _normalize: false,
31
+ positionFormat: 'XY',
32
+ getPolygon: (x, objectInfo) => getS2Polygon(getS2Token(x, objectInfo))
33
+ };
34
+ }
35
+ }
36
+ S2Layer.layerName = 'S2Layer';
37
+ S2Layer.defaultProps = defaultProps;
@@ -0,0 +1,88 @@
1
+ // s2-geometry is a pure JavaScript port of Google/Niantic's S2 Geometry library
2
+ // which is perfect since it works in the browser.
3
+ import { toHilbertQuadkey, FromHilbertQuadKey, IJToST, STToUV, FaceUVToXYZ, XYZToLngLat } from './s2-geometry';
4
+ import Long from 'long';
5
+ /**
6
+ * Given an S2 token this function convert the token to 64 bit id
7
+ https://github.com/google/s2-geometry-library-java/blob/c04b68bf3197a9c34082327eeb3aec7ab7c85da1/src/com/google/common/geometry/S2CellId.java#L439
8
+ * */
9
+ function getIdFromToken(token) {
10
+ // pad token with zeros to make the length 16
11
+ const paddedToken = token.padEnd(16, '0');
12
+ return Long.fromString(paddedToken, 16);
13
+ }
14
+ const MAX_RESOLUTION = 100;
15
+ /* Adapted from s2-geometry's S2Cell.getCornerLatLngs */
16
+ /* eslint-disable max-statements */
17
+ function getGeoBounds({ face, ij, level }) {
18
+ const offsets = [
19
+ [0, 0],
20
+ [0, 1],
21
+ [1, 1],
22
+ [1, 0],
23
+ [0, 0]
24
+ ];
25
+ // The S2 cell edge is curved: http://s2geometry.io/
26
+ // This is more prominent at lower levels
27
+ // resolution is the number of segments to generate per edge.
28
+ // We exponentially reduce resolution as level increases so it doesn't affect perf
29
+ // when there are a large number of cells
30
+ const resolution = Math.max(1, Math.ceil(MAX_RESOLUTION * Math.pow(2, -level)));
31
+ const result = new Float64Array(4 * resolution * 2 + 2);
32
+ let ptIndex = 0;
33
+ let prevLng = 0;
34
+ for (let i = 0; i < 4; i++) {
35
+ const offset = offsets[i].slice(0);
36
+ const nextOffset = offsets[i + 1];
37
+ const stepI = (nextOffset[0] - offset[0]) / resolution;
38
+ const stepJ = (nextOffset[1] - offset[1]) / resolution;
39
+ for (let j = 0; j < resolution; j++) {
40
+ offset[0] += stepI;
41
+ offset[1] += stepJ;
42
+ // Cell can be represented by coordinates IJ, ST, UV, XYZ
43
+ // http://s2geometry.io/devguide/s2cell_hierarchy#coordinate-systems
44
+ const st = IJToST(ij, level, offset);
45
+ const uv = STToUV(st);
46
+ const xyz = FaceUVToXYZ(face, uv);
47
+ const lngLat = XYZToLngLat(xyz);
48
+ // Adjust longitude for Web Mercator projection
49
+ if (Math.abs(lngLat[1]) > 89.999) {
50
+ lngLat[0] = prevLng;
51
+ }
52
+ const deltaLng = lngLat[0] - prevLng;
53
+ lngLat[0] += deltaLng > 180 ? -360 : deltaLng < -180 ? 360 : 0;
54
+ result[ptIndex++] = lngLat[0];
55
+ result[ptIndex++] = lngLat[1];
56
+ prevLng = lngLat[0];
57
+ }
58
+ }
59
+ // close the loop
60
+ result[ptIndex++] = result[0];
61
+ result[ptIndex++] = result[1];
62
+ return result;
63
+ }
64
+ /* eslint-enable max-statements */
65
+ export function getS2QuadKey(token) {
66
+ if (typeof token === 'string') {
67
+ if (token.indexOf('/') > 0) {
68
+ // is Hilbert quad key
69
+ return token;
70
+ }
71
+ // is S2 token
72
+ token = getIdFromToken(token);
73
+ }
74
+ // is Long id
75
+ return toHilbertQuadkey(token.toString());
76
+ }
77
+ /**
78
+ * Get a polygon with corner coordinates for an s2 cell
79
+ * @param {*} cell - This can be an S2 key or token
80
+ * @return {Array} - a simple polygon in array format: [[lng, lat], ...]
81
+ * - each coordinate is an array [lng, lat]
82
+ * - the polygon is closed, i.e. last coordinate is a copy of the first coordinate
83
+ */
84
+ export function getS2Polygon(token) {
85
+ const key = getS2QuadKey(token);
86
+ const s2cell = FromHilbertQuadKey(key);
87
+ return getGeoBounds(s2cell);
88
+ }
@@ -0,0 +1,226 @@
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 { CompositeLayer, log } from '@deck.gl/core';
21
+ import { SimpleMeshLayer } from '@deck.gl/mesh-layers';
22
+ import { COORDINATE_SYSTEM } from '@deck.gl/core';
23
+ import { TerrainWorkerLoader } from '@loaders.gl/terrain';
24
+ import TileLayer from '../tile-layer/tile-layer';
25
+ import { urlType, getURLFromTemplate } from '../tile-layer/utils';
26
+ const DUMMY_DATA = [1];
27
+ const defaultProps = {
28
+ ...TileLayer.defaultProps,
29
+ // Image url that encodes height data
30
+ elevationData: urlType,
31
+ // Image url to use as texture
32
+ texture: { ...urlType, optional: true },
33
+ // Martini error tolerance in meters, smaller number -> more detailed mesh
34
+ meshMaxError: { type: 'number', value: 4.0 },
35
+ // Bounding box of the terrain image, [minX, minY, maxX, maxY] in world coordinates
36
+ bounds: { type: 'array', value: null, optional: true, compare: true },
37
+ // Color to use if texture is unavailable
38
+ color: { type: 'color', value: [255, 255, 255] },
39
+ // Object to decode height data, from (r, g, b) to height in meters
40
+ elevationDecoder: {
41
+ type: 'object',
42
+ value: {
43
+ rScaler: 1,
44
+ gScaler: 0,
45
+ bScaler: 0,
46
+ offset: 0
47
+ }
48
+ },
49
+ // Supply url to local terrain worker bundle. Only required if running offline and cannot access CDN.
50
+ workerUrl: { type: 'string', value: null },
51
+ // Same as SimpleMeshLayer wireframe
52
+ wireframe: false,
53
+ material: true,
54
+ loaders: [TerrainWorkerLoader]
55
+ };
56
+ // Turns array of templates into a single string to work around shallow change
57
+ function urlTemplateToUpdateTrigger(template) {
58
+ if (Array.isArray(template)) {
59
+ return template.join(';');
60
+ }
61
+ return template;
62
+ }
63
+ /**
64
+ * state: {
65
+ * isTiled: True renders TileLayer of many SimpleMeshLayers, false renders one SimpleMeshLayer
66
+ * terrain: Mesh object. Only defined when isTiled is false.
67
+ * }
68
+ */
69
+ export default class TerrainLayer extends CompositeLayer {
70
+ updateState({ props, oldProps }) {
71
+ const elevationDataChanged = props.elevationData !== oldProps.elevationData;
72
+ if (elevationDataChanged) {
73
+ const { elevationData } = props;
74
+ const isTiled = elevationData &&
75
+ (Array.isArray(elevationData) ||
76
+ (elevationData.includes('{x}') && elevationData.includes('{y}')));
77
+ this.setState({ isTiled });
78
+ }
79
+ // Reloading for single terrain mesh
80
+ const shouldReload = elevationDataChanged ||
81
+ props.meshMaxError !== oldProps.meshMaxError ||
82
+ props.elevationDecoder !== oldProps.elevationDecoder ||
83
+ props.bounds !== oldProps.bounds;
84
+ if (!this.state.isTiled && shouldReload) {
85
+ const terrain = this.loadTerrain(props);
86
+ this.setState({ terrain });
87
+ }
88
+ // TODO - remove in v9
89
+ if (props.workerUrl) {
90
+ log.removed('workerUrl', 'loadOptions.terrain.workerUrl')();
91
+ }
92
+ }
93
+ loadTerrain({ elevationData, bounds, elevationDecoder, meshMaxError, signal }) {
94
+ if (!elevationData) {
95
+ return null;
96
+ }
97
+ let loadOptions = this.getLoadOptions();
98
+ loadOptions = {
99
+ ...loadOptions,
100
+ terrain: {
101
+ skirtHeight: this.state.isTiled ? meshMaxError * 2 : 0,
102
+ ...loadOptions?.terrain,
103
+ bounds,
104
+ meshMaxError,
105
+ elevationDecoder
106
+ }
107
+ };
108
+ const { fetch } = this.props;
109
+ return fetch(elevationData, { propName: 'elevationData', layer: this, loadOptions, signal });
110
+ }
111
+ getTiledTerrainData(tile) {
112
+ const { elevationData, fetch, texture, elevationDecoder, meshMaxError } = this.props;
113
+ const { viewport } = this.context;
114
+ const dataUrl = getURLFromTemplate(elevationData, tile);
115
+ const textureUrl = getURLFromTemplate(texture, tile);
116
+ const { bbox, signal } = tile;
117
+ const bottomLeft = viewport.isGeospatial
118
+ ? viewport.projectFlat([bbox.west, bbox.south])
119
+ : [bbox.left, bbox.bottom];
120
+ const topRight = viewport.isGeospatial
121
+ ? viewport.projectFlat([bbox.east, bbox.north])
122
+ : [bbox.right, bbox.top];
123
+ const bounds = [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]];
124
+ const terrain = this.loadTerrain({
125
+ elevationData: dataUrl,
126
+ bounds,
127
+ elevationDecoder,
128
+ meshMaxError,
129
+ signal
130
+ });
131
+ const surface = textureUrl
132
+ ? // If surface image fails to load, the tile should still be displayed
133
+ fetch(textureUrl, { propName: 'texture', layer: this, loaders: [], signal }).catch(_ => null)
134
+ : Promise.resolve(null);
135
+ return Promise.all([terrain, surface]);
136
+ }
137
+ renderSubLayers(props) {
138
+ const SubLayerClass = this.getSubLayerClass('mesh', SimpleMeshLayer);
139
+ const { data, color } = props;
140
+ if (!data) {
141
+ return null;
142
+ }
143
+ const [mesh, texture] = data;
144
+ return new SubLayerClass(props, {
145
+ data: DUMMY_DATA,
146
+ mesh,
147
+ texture,
148
+ _instanced: false,
149
+ coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
150
+ getPosition: d => [0, 0, 0],
151
+ getColor: color
152
+ });
153
+ }
154
+ // Update zRange of viewport
155
+ onViewportLoad(tiles) {
156
+ if (!tiles) {
157
+ return;
158
+ }
159
+ const { zRange } = this.state;
160
+ const ranges = tiles
161
+ .map(tile => tile.content)
162
+ .filter(Boolean)
163
+ .map(arr => {
164
+ const bounds = arr[0].header.boundingBox;
165
+ return bounds.map(bound => bound[2]);
166
+ });
167
+ if (ranges.length === 0) {
168
+ return;
169
+ }
170
+ const minZ = Math.min(...ranges.map(x => x[0]));
171
+ const maxZ = Math.max(...ranges.map(x => x[1]));
172
+ if (!zRange || minZ < zRange[0] || maxZ > zRange[1]) {
173
+ this.setState({ zRange: [minZ, maxZ] });
174
+ }
175
+ }
176
+ renderLayers() {
177
+ const { color, material, elevationData, texture, wireframe, meshMaxError, elevationDecoder, tileSize, maxZoom, minZoom, extent, maxRequests, onTileLoad, onTileUnload, onTileError, maxCacheSize, maxCacheByteSize, refinementStrategy } = this.props;
178
+ if (this.state.isTiled) {
179
+ return new TileLayer(this.getSubLayerProps({
180
+ id: 'tiles'
181
+ }), {
182
+ wireframe,
183
+ color,
184
+ material,
185
+ getTileData: this.getTiledTerrainData.bind(this),
186
+ renderSubLayers: this.renderSubLayers.bind(this),
187
+ updateTriggers: {
188
+ getTileData: {
189
+ elevationData: urlTemplateToUpdateTrigger(elevationData),
190
+ texture: urlTemplateToUpdateTrigger(texture),
191
+ meshMaxError,
192
+ elevationDecoder
193
+ }
194
+ },
195
+ onViewportLoad: this.onViewportLoad.bind(this),
196
+ zRange: this.state.zRange || null,
197
+ tileSize,
198
+ maxZoom,
199
+ minZoom,
200
+ extent,
201
+ maxRequests,
202
+ onTileLoad,
203
+ onTileUnload,
204
+ onTileError,
205
+ maxCacheSize,
206
+ maxCacheByteSize,
207
+ refinementStrategy
208
+ });
209
+ }
210
+ const SubLayerClass = this.getSubLayerClass('mesh', SimpleMeshLayer);
211
+ return new SubLayerClass(this.getSubLayerProps({
212
+ id: 'mesh'
213
+ }), {
214
+ data: DUMMY_DATA,
215
+ mesh: this.state.terrain,
216
+ texture,
217
+ _instanced: false,
218
+ getPosition: d => [0, 0, 0],
219
+ getColor: color,
220
+ material,
221
+ wireframe
222
+ });
223
+ }
224
+ }
225
+ TerrainLayer.layerName = 'TerrainLayer';
226
+ TerrainLayer.defaultProps = defaultProps;