@deck.gl/geo-layers 8.10.0-alpha.4 → 8.10.0-alpha.5
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 +23 -666
- package/dist/es5/geo-cell-layer/GeoCellLayer.js +66 -69
- package/dist/es5/geo-cell-layer/GeoCellLayer.js.map +1 -1
- package/dist/es5/geohash-layer/geohash-layer.js +18 -22
- package/dist/es5/geohash-layer/geohash-layer.js.map +1 -1
- package/dist/es5/great-circle-layer/great-circle-layer.js +2 -4
- package/dist/es5/great-circle-layer/great-circle-layer.js.map +1 -1
- package/dist/es5/h3-layers/h3-cluster-layer.js +85 -91
- package/dist/es5/h3-layers/h3-cluster-layer.js.map +1 -1
- package/dist/es5/h3-layers/h3-hexagon-layer.js +222 -234
- package/dist/es5/h3-layers/h3-hexagon-layer.js.map +1 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/mesh-layer/mesh-layer.js +126 -136
- package/dist/es5/mesh-layer/mesh-layer.js.map +1 -1
- package/dist/es5/mvt-layer/mvt-layer.js +338 -350
- package/dist/es5/mvt-layer/mvt-layer.js.map +1 -1
- package/dist/es5/quadkey-layer/quadkey-layer.js +23 -27
- package/dist/es5/quadkey-layer/quadkey-layer.js.map +1 -1
- package/dist/es5/s2-layer/s2-layer.js +18 -22
- package/dist/es5/s2-layer/s2-layer.js.map +1 -1
- package/dist/es5/terrain-layer/terrain-layer.js +225 -234
- package/dist/es5/terrain-layer/terrain-layer.js.map +1 -1
- package/dist/es5/tile-3d-layer/tile-3d-layer.js +338 -354
- package/dist/es5/tile-3d-layer/tile-3d-layer.js.map +1 -1
- package/dist/es5/tile-layer/tile-layer.js +219 -234
- package/dist/es5/tile-layer/tile-layer.js.map +1 -1
- package/dist/es5/tileset-2d/tile-2d-header.js +160 -164
- package/dist/es5/tileset-2d/tile-2d-header.js.map +1 -1
- package/dist/es5/tileset-2d/tile-2d-traversal.js +118 -122
- package/dist/es5/tileset-2d/tile-2d-traversal.js.map +1 -1
- package/dist/es5/tileset-2d/tileset-2d.js +397 -411
- package/dist/es5/tileset-2d/tileset-2d.js.map +1 -1
- package/dist/es5/trips-layer/trips-layer.js +48 -52
- package/dist/es5/trips-layer/trips-layer.js.map +1 -1
- package/dist/es5/wms-layer/wms-layer.js +263 -274
- package/dist/es5/wms-layer/wms-layer.js.map +1 -1
- package/dist/esm/geo-cell-layer/GeoCellLayer.js +2 -5
- package/dist/esm/geo-cell-layer/GeoCellLayer.js.map +1 -1
- package/dist/esm/geohash-layer/geohash-layer.js +2 -5
- package/dist/esm/geohash-layer/geohash-layer.js.map +1 -1
- package/dist/esm/great-circle-layer/great-circle-layer.js +2 -5
- package/dist/esm/great-circle-layer/great-circle-layer.js.map +1 -1
- package/dist/esm/h3-layers/h3-cluster-layer.js +2 -5
- package/dist/esm/h3-layers/h3-cluster-layer.js.map +1 -1
- package/dist/esm/h3-layers/h3-hexagon-layer.js +4 -8
- package/dist/esm/h3-layers/h3-hexagon-layer.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/mesh-layer/mesh-layer-fragment.glsl.js +55 -1
- package/dist/esm/mesh-layer/mesh-layer-fragment.glsl.js.map +1 -1
- package/dist/esm/mesh-layer/mesh-layer-vertex.glsl.js +80 -1
- package/dist/esm/mesh-layer/mesh-layer-vertex.glsl.js.map +1 -1
- package/dist/esm/mesh-layer/mesh-layer.js +2 -5
- package/dist/esm/mesh-layer/mesh-layer.js.map +1 -1
- package/dist/esm/mvt-layer/mvt-layer.js +2 -5
- package/dist/esm/mvt-layer/mvt-layer.js.map +1 -1
- package/dist/esm/quadkey-layer/quadkey-layer.js +2 -5
- package/dist/esm/quadkey-layer/quadkey-layer.js.map +1 -1
- package/dist/esm/s2-layer/s2-geometry.js +1 -1
- package/dist/esm/s2-layer/s2-geometry.js.map +1 -1
- package/dist/esm/s2-layer/s2-layer.js +2 -5
- package/dist/esm/s2-layer/s2-layer.js.map +1 -1
- package/dist/esm/terrain-layer/terrain-layer.js +3 -7
- package/dist/esm/terrain-layer/terrain-layer.js.map +1 -1
- package/dist/esm/tile-3d-layer/tile-3d-layer.js +7 -11
- package/dist/esm/tile-3d-layer/tile-3d-layer.js.map +1 -1
- package/dist/esm/tile-layer/tile-layer.js +2 -5
- package/dist/esm/tile-layer/tile-layer.js.map +1 -1
- package/dist/esm/tileset-2d/tile-2d-header.js +19 -39
- package/dist/esm/tileset-2d/tile-2d-header.js.map +1 -1
- package/dist/esm/tileset-2d/tile-2d-traversal.js +6 -13
- package/dist/esm/tileset-2d/tile-2d-traversal.js.map +1 -1
- package/dist/esm/tileset-2d/tileset-2d.js +17 -34
- package/dist/esm/tileset-2d/tileset-2d.js.map +1 -1
- package/dist/esm/tileset-2d/utils.js +1 -1
- package/dist/esm/tileset-2d/utils.js.map +1 -1
- package/dist/esm/trips-layer/trips-layer.js +27 -10
- package/dist/esm/trips-layer/trips-layer.js.map +1 -1
- package/dist/esm/wms-layer/wms-layer.js +3 -7
- package/dist/esm/wms-layer/wms-layer.js.map +1 -1
- package/dist.min.js +111 -56
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/typed/index.d.ts +1 -0
- package/typed/index.d.ts.map +1 -1
|
@@ -69,22 +69,22 @@ var Tileset2D = function () {
|
|
|
69
69
|
var _this = this;
|
|
70
70
|
|
|
71
71
|
(0, _classCallCheck2.default)(this, Tileset2D);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
72
|
+
this.opts = void 0;
|
|
73
|
+
this._requestScheduler = void 0;
|
|
74
|
+
this._cache = void 0;
|
|
75
|
+
this._dirty = void 0;
|
|
76
|
+
this._tiles = void 0;
|
|
77
|
+
this._cacheByteSize = void 0;
|
|
78
|
+
this._viewport = void 0;
|
|
79
|
+
this._zRange = void 0;
|
|
80
|
+
this._selectedTiles = void 0;
|
|
81
|
+
this._frameNumber = void 0;
|
|
82
|
+
this._modelMatrix = void 0;
|
|
83
|
+
this._modelMatrixInverse = void 0;
|
|
84
|
+
this._maxZoom = void 0;
|
|
85
|
+
this._minZoom = void 0;
|
|
86
|
+
this.onTileLoad = void 0;
|
|
87
|
+
this._getCullBounds = (0, _memoize.memoize)(_utils.getCullBounds);
|
|
88
88
|
this.opts = _objectSpread(_objectSpread({}, DEFAULT_TILESET2D_PROPS), opts);
|
|
89
89
|
|
|
90
90
|
this.onTileLoad = function (tile) {
|
|
@@ -115,501 +115,487 @@ var Tileset2D = function () {
|
|
|
115
115
|
this.setOptions(opts);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
key: "tiles",
|
|
120
|
-
get: function get() {
|
|
121
|
-
return this._tiles;
|
|
122
|
-
}
|
|
123
|
-
}, {
|
|
124
|
-
key: "selectedTiles",
|
|
125
|
-
get: function get() {
|
|
126
|
-
return this._selectedTiles;
|
|
127
|
-
}
|
|
128
|
-
}, {
|
|
129
|
-
key: "isLoaded",
|
|
130
|
-
get: function get() {
|
|
131
|
-
return this._selectedTiles !== null && this._selectedTiles.every(function (tile) {
|
|
132
|
-
return tile.isLoaded;
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
}, {
|
|
136
|
-
key: "needsReload",
|
|
137
|
-
get: function get() {
|
|
138
|
-
return this._selectedTiles !== null && this._selectedTiles.some(function (tile) {
|
|
139
|
-
return tile.needsReload;
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
}, {
|
|
143
|
-
key: "setOptions",
|
|
144
|
-
value: function setOptions(opts) {
|
|
145
|
-
Object.assign(this.opts, opts);
|
|
118
|
+
var _proto = Tileset2D.prototype;
|
|
146
119
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
120
|
+
_proto.setOptions = function setOptions(opts) {
|
|
121
|
+
Object.assign(this.opts, opts);
|
|
150
122
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
123
|
+
if (Number.isFinite(opts.maxZoom)) {
|
|
124
|
+
this._maxZoom = Math.floor(opts.maxZoom);
|
|
154
125
|
}
|
|
155
|
-
}, {
|
|
156
|
-
key: "finalize",
|
|
157
|
-
value: function finalize() {
|
|
158
|
-
var _iterator = _createForOfIteratorHelper(this._cache.values()),
|
|
159
|
-
_step;
|
|
160
126
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
127
|
+
if (Number.isFinite(opts.minZoom)) {
|
|
128
|
+
this._minZoom = Math.ceil(opts.minZoom);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
164
131
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
132
|
+
_proto.finalize = function finalize() {
|
|
133
|
+
var _iterator = _createForOfIteratorHelper(this._cache.values()),
|
|
134
|
+
_step;
|
|
135
|
+
|
|
136
|
+
try {
|
|
137
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
138
|
+
var _tile = _step.value;
|
|
139
|
+
|
|
140
|
+
if (_tile.isLoading) {
|
|
141
|
+
_tile.abort();
|
|
168
142
|
}
|
|
169
|
-
} catch (err) {
|
|
170
|
-
_iterator.e(err);
|
|
171
|
-
} finally {
|
|
172
|
-
_iterator.f();
|
|
173
143
|
}
|
|
144
|
+
} catch (err) {
|
|
145
|
+
_iterator.e(err);
|
|
146
|
+
} finally {
|
|
147
|
+
_iterator.f();
|
|
148
|
+
}
|
|
174
149
|
|
|
175
|
-
|
|
150
|
+
this._cache.clear();
|
|
176
151
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}, {
|
|
181
|
-
key: "reloadAll",
|
|
182
|
-
value: function reloadAll() {
|
|
183
|
-
var _iterator2 = _createForOfIteratorHelper(this._cache.keys()),
|
|
184
|
-
_step2;
|
|
152
|
+
this._tiles = [];
|
|
153
|
+
this._selectedTiles = null;
|
|
154
|
+
};
|
|
185
155
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
156
|
+
_proto.reloadAll = function reloadAll() {
|
|
157
|
+
var _iterator2 = _createForOfIteratorHelper(this._cache.keys()),
|
|
158
|
+
_step2;
|
|
189
159
|
|
|
190
|
-
|
|
160
|
+
try {
|
|
161
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
162
|
+
var id = _step2.value;
|
|
191
163
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
164
|
+
var _tile2 = this._cache.get(id);
|
|
165
|
+
|
|
166
|
+
if (!this._selectedTiles || !this._selectedTiles.includes(_tile2)) {
|
|
167
|
+
this._cache.delete(id);
|
|
168
|
+
} else {
|
|
169
|
+
_tile2.setNeedsReload();
|
|
197
170
|
}
|
|
198
|
-
} catch (err) {
|
|
199
|
-
_iterator2.e(err);
|
|
200
|
-
} finally {
|
|
201
|
-
_iterator2.f();
|
|
202
171
|
}
|
|
172
|
+
} catch (err) {
|
|
173
|
+
_iterator2.e(err);
|
|
174
|
+
} finally {
|
|
175
|
+
_iterator2.f();
|
|
203
176
|
}
|
|
204
|
-
}
|
|
205
|
-
key: "update",
|
|
206
|
-
value: function update(viewport) {
|
|
207
|
-
var _this2 = this;
|
|
177
|
+
};
|
|
208
178
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
modelMatrix = _ref.modelMatrix;
|
|
179
|
+
_proto.update = function update(viewport) {
|
|
180
|
+
var _this2 = this;
|
|
212
181
|
|
|
213
|
-
|
|
214
|
-
|
|
182
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
183
|
+
zRange = _ref.zRange,
|
|
184
|
+
modelMatrix = _ref.modelMatrix;
|
|
215
185
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
this._modelMatrixInverse = modelMatrixAsMatrix4.clone().invert();
|
|
219
|
-
this._modelMatrix = modelMatrixAsMatrix4;
|
|
220
|
-
}
|
|
186
|
+
var modelMatrixAsMatrix4 = new _core.Matrix4(modelMatrix);
|
|
187
|
+
var isModelMatrixNew = !modelMatrixAsMatrix4.equals(this._modelMatrix);
|
|
221
188
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
maxZoom: this._maxZoom,
|
|
227
|
-
minZoom: this._minZoom,
|
|
228
|
-
zRange: zRange,
|
|
229
|
-
modelMatrix: this._modelMatrix,
|
|
230
|
-
modelMatrixInverse: this._modelMatrixInverse
|
|
231
|
-
});
|
|
232
|
-
this._selectedTiles = tileIndices.map(function (index) {
|
|
233
|
-
return _this2._getTile(index, true);
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
if (this._dirty) {
|
|
237
|
-
this._rebuildTree();
|
|
238
|
-
}
|
|
239
|
-
} else if (this.needsReload) {
|
|
240
|
-
this._selectedTiles = this._selectedTiles.map(function (tile) {
|
|
241
|
-
return _this2._getTile(tile.index, true);
|
|
242
|
-
});
|
|
189
|
+
if (!this._viewport || !viewport.equals(this._viewport) || !(0, _core.equals)(this._zRange, zRange) || isModelMatrixNew) {
|
|
190
|
+
if (isModelMatrixNew) {
|
|
191
|
+
this._modelMatrixInverse = modelMatrixAsMatrix4.clone().invert();
|
|
192
|
+
this._modelMatrix = modelMatrixAsMatrix4;
|
|
243
193
|
}
|
|
244
194
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
this.
|
|
195
|
+
this._viewport = viewport;
|
|
196
|
+
this._zRange = zRange;
|
|
197
|
+
var tileIndices = this.getTileIndices({
|
|
198
|
+
viewport: viewport,
|
|
199
|
+
maxZoom: this._maxZoom,
|
|
200
|
+
minZoom: this._minZoom,
|
|
201
|
+
zRange: zRange,
|
|
202
|
+
modelMatrix: this._modelMatrix,
|
|
203
|
+
modelMatrixInverse: this._modelMatrixInverse
|
|
204
|
+
});
|
|
205
|
+
this._selectedTiles = tileIndices.map(function (index) {
|
|
206
|
+
return _this2._getTile(index, true);
|
|
207
|
+
});
|
|
248
208
|
|
|
249
209
|
if (this._dirty) {
|
|
250
|
-
this.
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
if (changed) {
|
|
254
|
-
this._frameNumber++;
|
|
210
|
+
this._rebuildTree();
|
|
255
211
|
}
|
|
256
|
-
|
|
257
|
-
|
|
212
|
+
} else if (this.needsReload) {
|
|
213
|
+
this._selectedTiles = this._selectedTiles.map(function (tile) {
|
|
214
|
+
return _this2._getTile(tile.index, true);
|
|
215
|
+
});
|
|
258
216
|
}
|
|
259
|
-
}, {
|
|
260
|
-
key: "isTileVisible",
|
|
261
|
-
value: function isTileVisible(tile, cullRect) {
|
|
262
|
-
if (!tile.isVisible) {
|
|
263
|
-
return false;
|
|
264
|
-
}
|
|
265
217
|
|
|
266
|
-
|
|
267
|
-
var boundsArr = this._getCullBounds({
|
|
268
|
-
viewport: this._viewport,
|
|
269
|
-
z: this._zRange,
|
|
270
|
-
cullRect: cullRect
|
|
271
|
-
});
|
|
218
|
+
var changed = this.updateTileStates();
|
|
272
219
|
|
|
273
|
-
|
|
220
|
+
this._pruneRequests();
|
|
274
221
|
|
|
275
|
-
|
|
276
|
-
|
|
222
|
+
if (this._dirty) {
|
|
223
|
+
this._resizeCache();
|
|
224
|
+
}
|
|
277
225
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
minX = _step3$value[0],
|
|
282
|
-
minY = _step3$value[1],
|
|
283
|
-
maxX = _step3$value[2],
|
|
284
|
-
maxY = _step3$value[3];
|
|
285
|
-
|
|
286
|
-
var overlaps = void 0;
|
|
287
|
-
|
|
288
|
-
if ('west' in bbox) {
|
|
289
|
-
overlaps = bbox.west < maxX && bbox.east > minX && bbox.south < maxY && bbox.north > minY;
|
|
290
|
-
} else {
|
|
291
|
-
var y0 = Math.min(bbox.top, bbox.bottom);
|
|
292
|
-
var y1 = Math.max(bbox.top, bbox.bottom);
|
|
293
|
-
overlaps = bbox.left < maxX && bbox.right > minX && y0 < maxY && y1 > minY;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
if (overlaps) {
|
|
297
|
-
return true;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
} catch (err) {
|
|
301
|
-
_iterator3.e(err);
|
|
302
|
-
} finally {
|
|
303
|
-
_iterator3.f();
|
|
304
|
-
}
|
|
226
|
+
if (changed) {
|
|
227
|
+
this._frameNumber++;
|
|
228
|
+
}
|
|
305
229
|
|
|
306
|
-
|
|
307
|
-
|
|
230
|
+
return this._frameNumber;
|
|
231
|
+
};
|
|
308
232
|
|
|
309
|
-
|
|
233
|
+
_proto.isTileVisible = function isTileVisible(tile, cullRect) {
|
|
234
|
+
if (!tile.isVisible) {
|
|
235
|
+
return false;
|
|
310
236
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
zRange = _ref2.zRange,
|
|
318
|
-
modelMatrix = _ref2.modelMatrix,
|
|
319
|
-
modelMatrixInverse = _ref2.modelMatrixInverse;
|
|
320
|
-
var _this$opts2 = this.opts,
|
|
321
|
-
tileSize = _this$opts2.tileSize,
|
|
322
|
-
extent = _this$opts2.extent,
|
|
323
|
-
zoomOffset = _this$opts2.zoomOffset;
|
|
324
|
-
return (0, _utils.getTileIndices)({
|
|
325
|
-
viewport: viewport,
|
|
326
|
-
maxZoom: maxZoom,
|
|
327
|
-
minZoom: minZoom,
|
|
328
|
-
zRange: zRange,
|
|
329
|
-
tileSize: tileSize,
|
|
330
|
-
extent: extent,
|
|
331
|
-
modelMatrix: modelMatrix,
|
|
332
|
-
modelMatrixInverse: modelMatrixInverse,
|
|
333
|
-
zoomOffset: zoomOffset
|
|
237
|
+
|
|
238
|
+
if (cullRect && this._viewport) {
|
|
239
|
+
var boundsArr = this._getCullBounds({
|
|
240
|
+
viewport: this._viewport,
|
|
241
|
+
z: this._zRange,
|
|
242
|
+
cullRect: cullRect
|
|
334
243
|
});
|
|
335
|
-
}
|
|
336
|
-
}, {
|
|
337
|
-
key: "getTileId",
|
|
338
|
-
value: function getTileId(index) {
|
|
339
|
-
return "".concat(index.x, "-").concat(index.y, "-").concat(index.z);
|
|
340
|
-
}
|
|
341
|
-
}, {
|
|
342
|
-
key: "getTileZoom",
|
|
343
|
-
value: function getTileZoom(index) {
|
|
344
|
-
return index.z;
|
|
345
|
-
}
|
|
346
|
-
}, {
|
|
347
|
-
key: "getTileMetadata",
|
|
348
|
-
value: function getTileMetadata(index) {
|
|
349
|
-
var tileSize = this.opts.tileSize;
|
|
350
|
-
return {
|
|
351
|
-
bbox: (0, _utils.tileToBoundingBox)(this._viewport, index.x, index.y, index.z, tileSize)
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
}, {
|
|
355
|
-
key: "getParentIndex",
|
|
356
|
-
value: function getParentIndex(index) {
|
|
357
|
-
var x = Math.floor(index.x / 2);
|
|
358
|
-
var y = Math.floor(index.y / 2);
|
|
359
|
-
var z = index.z - 1;
|
|
360
|
-
return {
|
|
361
|
-
x: x,
|
|
362
|
-
y: y,
|
|
363
|
-
z: z
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
}, {
|
|
367
|
-
key: "updateTileStates",
|
|
368
|
-
value: function updateTileStates() {
|
|
369
|
-
var refinementStrategy = this.opts.refinementStrategy || STRATEGY_DEFAULT;
|
|
370
|
-
var visibilities = new Array(this._cache.size);
|
|
371
|
-
var i = 0;
|
|
372
244
|
|
|
373
|
-
var
|
|
374
|
-
|
|
245
|
+
var bbox = tile.bbox;
|
|
246
|
+
|
|
247
|
+
var _iterator3 = _createForOfIteratorHelper(boundsArr),
|
|
248
|
+
_step3;
|
|
375
249
|
|
|
376
250
|
try {
|
|
377
|
-
for (
|
|
378
|
-
var
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
251
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
252
|
+
var _step3$value = (0, _slicedToArray2.default)(_step3.value, 4),
|
|
253
|
+
minX = _step3$value[0],
|
|
254
|
+
minY = _step3$value[1],
|
|
255
|
+
maxX = _step3$value[2],
|
|
256
|
+
maxY = _step3$value[3];
|
|
257
|
+
|
|
258
|
+
var overlaps = void 0;
|
|
259
|
+
|
|
260
|
+
if ('west' in bbox) {
|
|
261
|
+
overlaps = bbox.west < maxX && bbox.east > minX && bbox.south < maxY && bbox.north > minY;
|
|
262
|
+
} else {
|
|
263
|
+
var y0 = Math.min(bbox.top, bbox.bottom);
|
|
264
|
+
var y1 = Math.max(bbox.top, bbox.bottom);
|
|
265
|
+
overlaps = bbox.left < maxX && bbox.right > minX && y0 < maxY && y1 > minY;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (overlaps) {
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
382
271
|
}
|
|
383
272
|
} catch (err) {
|
|
384
|
-
|
|
273
|
+
_iterator3.e(err);
|
|
385
274
|
} finally {
|
|
386
|
-
|
|
275
|
+
_iterator3.f();
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return true;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
_proto.getTileIndices = function getTileIndices(_ref2) {
|
|
285
|
+
var viewport = _ref2.viewport,
|
|
286
|
+
maxZoom = _ref2.maxZoom,
|
|
287
|
+
minZoom = _ref2.minZoom,
|
|
288
|
+
zRange = _ref2.zRange,
|
|
289
|
+
modelMatrix = _ref2.modelMatrix,
|
|
290
|
+
modelMatrixInverse = _ref2.modelMatrixInverse;
|
|
291
|
+
var _this$opts2 = this.opts,
|
|
292
|
+
tileSize = _this$opts2.tileSize,
|
|
293
|
+
extent = _this$opts2.extent,
|
|
294
|
+
zoomOffset = _this$opts2.zoomOffset;
|
|
295
|
+
return (0, _utils.getTileIndices)({
|
|
296
|
+
viewport: viewport,
|
|
297
|
+
maxZoom: maxZoom,
|
|
298
|
+
minZoom: minZoom,
|
|
299
|
+
zRange: zRange,
|
|
300
|
+
tileSize: tileSize,
|
|
301
|
+
extent: extent,
|
|
302
|
+
modelMatrix: modelMatrix,
|
|
303
|
+
modelMatrixInverse: modelMatrixInverse,
|
|
304
|
+
zoomOffset: zoomOffset
|
|
305
|
+
});
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
_proto.getTileId = function getTileId(index) {
|
|
309
|
+
return "".concat(index.x, "-").concat(index.y, "-").concat(index.z);
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
_proto.getTileZoom = function getTileZoom(index) {
|
|
313
|
+
return index.z;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
_proto.getTileMetadata = function getTileMetadata(index) {
|
|
317
|
+
var tileSize = this.opts.tileSize;
|
|
318
|
+
return {
|
|
319
|
+
bbox: (0, _utils.tileToBoundingBox)(this._viewport, index.x, index.y, index.z, tileSize)
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
_proto.getParentIndex = function getParentIndex(index) {
|
|
324
|
+
var x = Math.floor(index.x / 2);
|
|
325
|
+
var y = Math.floor(index.y / 2);
|
|
326
|
+
var z = index.z - 1;
|
|
327
|
+
return {
|
|
328
|
+
x: x,
|
|
329
|
+
y: y,
|
|
330
|
+
z: z
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
_proto.updateTileStates = function updateTileStates() {
|
|
335
|
+
var refinementStrategy = this.opts.refinementStrategy || STRATEGY_DEFAULT;
|
|
336
|
+
var visibilities = new Array(this._cache.size);
|
|
337
|
+
var i = 0;
|
|
338
|
+
|
|
339
|
+
var _iterator4 = _createForOfIteratorHelper(this._cache.values()),
|
|
340
|
+
_step4;
|
|
341
|
+
|
|
342
|
+
try {
|
|
343
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
344
|
+
var _tile3 = _step4.value;
|
|
345
|
+
visibilities[i++] = _tile3.isVisible;
|
|
346
|
+
_tile3.isSelected = false;
|
|
347
|
+
_tile3.isVisible = false;
|
|
387
348
|
}
|
|
349
|
+
} catch (err) {
|
|
350
|
+
_iterator4.e(err);
|
|
351
|
+
} finally {
|
|
352
|
+
_iterator4.f();
|
|
353
|
+
}
|
|
388
354
|
|
|
389
|
-
|
|
390
|
-
|
|
355
|
+
var _iterator5 = _createForOfIteratorHelper(this._selectedTiles),
|
|
356
|
+
_step5;
|
|
391
357
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
} catch (err) {
|
|
399
|
-
_iterator5.e(err);
|
|
400
|
-
} finally {
|
|
401
|
-
_iterator5.f();
|
|
358
|
+
try {
|
|
359
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
360
|
+
var _tile4 = _step5.value;
|
|
361
|
+
_tile4.isSelected = true;
|
|
362
|
+
_tile4.isVisible = true;
|
|
402
363
|
}
|
|
364
|
+
} catch (err) {
|
|
365
|
+
_iterator5.e(err);
|
|
366
|
+
} finally {
|
|
367
|
+
_iterator5.f();
|
|
368
|
+
}
|
|
403
369
|
|
|
404
|
-
|
|
405
|
-
|
|
370
|
+
(typeof refinementStrategy === 'function' ? refinementStrategy : STRATEGIES[refinementStrategy])(Array.from(this._cache.values()));
|
|
371
|
+
i = 0;
|
|
406
372
|
|
|
407
|
-
|
|
408
|
-
|
|
373
|
+
var _iterator6 = _createForOfIteratorHelper(this._cache.values()),
|
|
374
|
+
_step6;
|
|
409
375
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
376
|
+
try {
|
|
377
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
378
|
+
var _tile5 = _step6.value;
|
|
413
379
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
380
|
+
if (visibilities[i++] !== _tile5.isVisible) {
|
|
381
|
+
return true;
|
|
417
382
|
}
|
|
418
|
-
} catch (err) {
|
|
419
|
-
_iterator6.e(err);
|
|
420
|
-
} finally {
|
|
421
|
-
_iterator6.f();
|
|
422
383
|
}
|
|
423
|
-
|
|
424
|
-
|
|
384
|
+
} catch (err) {
|
|
385
|
+
_iterator6.e(err);
|
|
386
|
+
} finally {
|
|
387
|
+
_iterator6.f();
|
|
425
388
|
}
|
|
426
|
-
}, {
|
|
427
|
-
key: "_pruneRequests",
|
|
428
|
-
value: function _pruneRequests() {
|
|
429
|
-
var _this$opts$maxRequest = this.opts.maxRequests,
|
|
430
|
-
maxRequests = _this$opts$maxRequest === void 0 ? 0 : _this$opts$maxRequest;
|
|
431
|
-
var abortCandidates = [];
|
|
432
|
-
var ongoingRequestCount = 0;
|
|
433
389
|
|
|
434
|
-
|
|
435
|
-
|
|
390
|
+
return false;
|
|
391
|
+
};
|
|
436
392
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
393
|
+
_proto._pruneRequests = function _pruneRequests() {
|
|
394
|
+
var _this$opts$maxRequest = this.opts.maxRequests,
|
|
395
|
+
maxRequests = _this$opts$maxRequest === void 0 ? 0 : _this$opts$maxRequest;
|
|
396
|
+
var abortCandidates = [];
|
|
397
|
+
var ongoingRequestCount = 0;
|
|
398
|
+
|
|
399
|
+
var _iterator7 = _createForOfIteratorHelper(this._cache.values()),
|
|
400
|
+
_step7;
|
|
401
|
+
|
|
402
|
+
try {
|
|
403
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
404
|
+
var _tile7 = _step7.value;
|
|
440
405
|
|
|
441
|
-
|
|
442
|
-
|
|
406
|
+
if (_tile7.isLoading) {
|
|
407
|
+
ongoingRequestCount++;
|
|
443
408
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
}
|
|
409
|
+
if (!_tile7.isSelected && !_tile7.isVisible) {
|
|
410
|
+
abortCandidates.push(_tile7);
|
|
447
411
|
}
|
|
448
412
|
}
|
|
449
|
-
} catch (err) {
|
|
450
|
-
_iterator7.e(err);
|
|
451
|
-
} finally {
|
|
452
|
-
_iterator7.f();
|
|
453
413
|
}
|
|
414
|
+
} catch (err) {
|
|
415
|
+
_iterator7.e(err);
|
|
416
|
+
} finally {
|
|
417
|
+
_iterator7.f();
|
|
418
|
+
}
|
|
454
419
|
|
|
455
|
-
|
|
456
|
-
|
|
420
|
+
while (maxRequests > 0 && ongoingRequestCount > maxRequests && abortCandidates.length > 0) {
|
|
421
|
+
var _tile6 = abortCandidates.shift();
|
|
457
422
|
|
|
458
|
-
|
|
423
|
+
_tile6.abort();
|
|
459
424
|
|
|
460
|
-
|
|
461
|
-
}
|
|
425
|
+
ongoingRequestCount--;
|
|
462
426
|
}
|
|
463
|
-
}
|
|
464
|
-
key: "_rebuildTree",
|
|
465
|
-
value: function _rebuildTree() {
|
|
466
|
-
var _cache = this._cache;
|
|
427
|
+
};
|
|
467
428
|
|
|
468
|
-
|
|
469
|
-
|
|
429
|
+
_proto._rebuildTree = function _rebuildTree() {
|
|
430
|
+
var _cache = this._cache;
|
|
470
431
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
var _tile8 = _step8.value;
|
|
474
|
-
_tile8.parent = null;
|
|
432
|
+
var _iterator8 = _createForOfIteratorHelper(_cache.values()),
|
|
433
|
+
_step8;
|
|
475
434
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
435
|
+
try {
|
|
436
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
437
|
+
var _tile8 = _step8.value;
|
|
438
|
+
_tile8.parent = null;
|
|
439
|
+
|
|
440
|
+
if (_tile8.children) {
|
|
441
|
+
_tile8.children.length = 0;
|
|
479
442
|
}
|
|
480
|
-
} catch (err) {
|
|
481
|
-
_iterator8.e(err);
|
|
482
|
-
} finally {
|
|
483
|
-
_iterator8.f();
|
|
484
443
|
}
|
|
444
|
+
} catch (err) {
|
|
445
|
+
_iterator8.e(err);
|
|
446
|
+
} finally {
|
|
447
|
+
_iterator8.f();
|
|
448
|
+
}
|
|
485
449
|
|
|
486
|
-
|
|
487
|
-
|
|
450
|
+
var _iterator9 = _createForOfIteratorHelper(_cache.values()),
|
|
451
|
+
_step9;
|
|
488
452
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
453
|
+
try {
|
|
454
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
455
|
+
var _tile9 = _step9.value;
|
|
492
456
|
|
|
493
|
-
|
|
457
|
+
var parent = this._getNearestAncestor(_tile9);
|
|
494
458
|
|
|
495
|
-
|
|
459
|
+
_tile9.parent = parent;
|
|
496
460
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}
|
|
461
|
+
if (parent !== null && parent !== void 0 && parent.children) {
|
|
462
|
+
parent.children.push(_tile9);
|
|
500
463
|
}
|
|
501
|
-
} catch (err) {
|
|
502
|
-
_iterator9.e(err);
|
|
503
|
-
} finally {
|
|
504
|
-
_iterator9.f();
|
|
505
464
|
}
|
|
465
|
+
} catch (err) {
|
|
466
|
+
_iterator9.e(err);
|
|
467
|
+
} finally {
|
|
468
|
+
_iterator9.f();
|
|
506
469
|
}
|
|
507
|
-
}
|
|
508
|
-
key: "_resizeCache",
|
|
509
|
-
value: function _resizeCache() {
|
|
510
|
-
var _cache = this._cache,
|
|
511
|
-
opts = this.opts;
|
|
512
|
-
var maxCacheSize = opts.maxCacheSize || (opts.maxCacheByteSize ? Infinity : DEFAULT_CACHE_SCALE * this.selectedTiles.length);
|
|
513
|
-
var maxCacheByteSize = opts.maxCacheByteSize || Infinity;
|
|
514
|
-
var overflown = _cache.size > maxCacheSize || this._cacheByteSize > maxCacheByteSize;
|
|
515
|
-
|
|
516
|
-
if (overflown) {
|
|
517
|
-
var _iterator10 = _createForOfIteratorHelper(_cache),
|
|
518
|
-
_step10;
|
|
470
|
+
};
|
|
519
471
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
472
|
+
_proto._resizeCache = function _resizeCache() {
|
|
473
|
+
var _cache = this._cache,
|
|
474
|
+
opts = this.opts;
|
|
475
|
+
var maxCacheSize = opts.maxCacheSize || (opts.maxCacheByteSize ? Infinity : DEFAULT_CACHE_SCALE * this.selectedTiles.length);
|
|
476
|
+
var maxCacheByteSize = opts.maxCacheByteSize || Infinity;
|
|
477
|
+
var overflown = _cache.size > maxCacheSize || this._cacheByteSize > maxCacheByteSize;
|
|
525
478
|
|
|
526
|
-
|
|
527
|
-
|
|
479
|
+
if (overflown) {
|
|
480
|
+
var _iterator10 = _createForOfIteratorHelper(_cache),
|
|
481
|
+
_step10;
|
|
528
482
|
|
|
529
|
-
|
|
483
|
+
try {
|
|
484
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
485
|
+
var _step10$value = (0, _slicedToArray2.default)(_step10.value, 2),
|
|
486
|
+
id = _step10$value[0],
|
|
487
|
+
_tile10 = _step10$value[1];
|
|
530
488
|
|
|
531
|
-
|
|
489
|
+
if (!_tile10.isVisible && !_tile10.isSelected) {
|
|
490
|
+
var _this$opts$onTileUnlo, _this$opts3;
|
|
532
491
|
|
|
533
|
-
|
|
534
|
-
}
|
|
492
|
+
this._cacheByteSize -= opts.maxCacheByteSize ? _tile10.byteLength : 0;
|
|
535
493
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
494
|
+
_cache.delete(id);
|
|
495
|
+
|
|
496
|
+
(_this$opts$onTileUnlo = (_this$opts3 = this.opts).onTileUnload) === null || _this$opts$onTileUnlo === void 0 ? void 0 : _this$opts$onTileUnlo.call(_this$opts3, _tile10);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
if (_cache.size <= maxCacheSize && this._cacheByteSize <= maxCacheByteSize) {
|
|
500
|
+
break;
|
|
539
501
|
}
|
|
540
|
-
} catch (err) {
|
|
541
|
-
_iterator10.e(err);
|
|
542
|
-
} finally {
|
|
543
|
-
_iterator10.f();
|
|
544
502
|
}
|
|
503
|
+
} catch (err) {
|
|
504
|
+
_iterator10.e(err);
|
|
505
|
+
} finally {
|
|
506
|
+
_iterator10.f();
|
|
507
|
+
}
|
|
545
508
|
|
|
546
|
-
|
|
509
|
+
this._rebuildTree();
|
|
547
510
|
|
|
548
|
-
|
|
549
|
-
|
|
511
|
+
this._dirty = true;
|
|
512
|
+
}
|
|
550
513
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
}
|
|
514
|
+
if (this._dirty) {
|
|
515
|
+
this._tiles = Array.from(this._cache.values()).sort(function (t1, t2) {
|
|
516
|
+
return t1.zoom - t2.zoom;
|
|
517
|
+
});
|
|
518
|
+
this._dirty = false;
|
|
557
519
|
}
|
|
558
|
-
}
|
|
559
|
-
key: "_getTile",
|
|
560
|
-
value: function _getTile(index, create) {
|
|
561
|
-
var id = this.getTileId(index);
|
|
520
|
+
};
|
|
562
521
|
|
|
563
|
-
|
|
522
|
+
_proto._getTile = function _getTile(index, create) {
|
|
523
|
+
var id = this.getTileId(index);
|
|
564
524
|
|
|
565
|
-
|
|
525
|
+
var tile = this._cache.get(id);
|
|
566
526
|
|
|
567
|
-
|
|
568
|
-
tile = new _tile2dHeader.Tile2DHeader(index);
|
|
569
|
-
Object.assign(tile, this.getTileMetadata(tile.index));
|
|
570
|
-
Object.assign(tile, {
|
|
571
|
-
id: id,
|
|
572
|
-
zoom: this.getTileZoom(tile.index)
|
|
573
|
-
});
|
|
574
|
-
needsReload = true;
|
|
527
|
+
var needsReload = false;
|
|
575
528
|
|
|
576
|
-
|
|
529
|
+
if (!tile && create) {
|
|
530
|
+
tile = new _tile2dHeader.Tile2DHeader(index);
|
|
531
|
+
Object.assign(tile, this.getTileMetadata(tile.index));
|
|
532
|
+
Object.assign(tile, {
|
|
533
|
+
id: id,
|
|
534
|
+
zoom: this.getTileZoom(tile.index)
|
|
535
|
+
});
|
|
536
|
+
needsReload = true;
|
|
577
537
|
|
|
578
|
-
|
|
579
|
-
} else if (tile && tile.needsReload) {
|
|
580
|
-
needsReload = true;
|
|
581
|
-
}
|
|
538
|
+
this._cache.set(id, tile);
|
|
582
539
|
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
onLoad: this.onTileLoad,
|
|
588
|
-
onError: this.opts.onTileError
|
|
589
|
-
});
|
|
590
|
-
}
|
|
540
|
+
this._dirty = true;
|
|
541
|
+
} else if (tile && tile.needsReload) {
|
|
542
|
+
needsReload = true;
|
|
543
|
+
}
|
|
591
544
|
|
|
592
|
-
|
|
545
|
+
if (tile && needsReload) {
|
|
546
|
+
tile.loadData({
|
|
547
|
+
getData: this.opts.getTileData,
|
|
548
|
+
requestScheduler: this._requestScheduler,
|
|
549
|
+
onLoad: this.onTileLoad,
|
|
550
|
+
onError: this.opts.onTileError
|
|
551
|
+
});
|
|
593
552
|
}
|
|
594
|
-
}, {
|
|
595
|
-
key: "_getNearestAncestor",
|
|
596
|
-
value: function _getNearestAncestor(tile) {
|
|
597
|
-
var _this$_minZoom = this._minZoom,
|
|
598
|
-
_minZoom = _this$_minZoom === void 0 ? 0 : _this$_minZoom;
|
|
599
553
|
|
|
600
|
-
|
|
554
|
+
return tile;
|
|
555
|
+
};
|
|
601
556
|
|
|
602
|
-
|
|
603
|
-
|
|
557
|
+
_proto._getNearestAncestor = function _getNearestAncestor(tile) {
|
|
558
|
+
var _this$_minZoom = this._minZoom,
|
|
559
|
+
_minZoom = _this$_minZoom === void 0 ? 0 : _this$_minZoom;
|
|
604
560
|
|
|
605
|
-
|
|
561
|
+
var index = tile.index;
|
|
606
562
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
563
|
+
while (this.getTileZoom(index) > _minZoom) {
|
|
564
|
+
index = this.getParentIndex(index);
|
|
565
|
+
|
|
566
|
+
var parent = this._getTile(index);
|
|
567
|
+
|
|
568
|
+
if (parent) {
|
|
569
|
+
return parent;
|
|
610
570
|
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
return null;
|
|
574
|
+
};
|
|
611
575
|
|
|
612
|
-
|
|
576
|
+
(0, _createClass2.default)(Tileset2D, [{
|
|
577
|
+
key: "tiles",
|
|
578
|
+
get: function get() {
|
|
579
|
+
return this._tiles;
|
|
580
|
+
}
|
|
581
|
+
}, {
|
|
582
|
+
key: "selectedTiles",
|
|
583
|
+
get: function get() {
|
|
584
|
+
return this._selectedTiles;
|
|
585
|
+
}
|
|
586
|
+
}, {
|
|
587
|
+
key: "isLoaded",
|
|
588
|
+
get: function get() {
|
|
589
|
+
return this._selectedTiles !== null && this._selectedTiles.every(function (tile) {
|
|
590
|
+
return tile.isLoaded;
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
}, {
|
|
594
|
+
key: "needsReload",
|
|
595
|
+
get: function get() {
|
|
596
|
+
return this._selectedTiles !== null && this._selectedTiles.some(function (tile) {
|
|
597
|
+
return tile.needsReload;
|
|
598
|
+
});
|
|
613
599
|
}
|
|
614
600
|
}]);
|
|
615
601
|
return Tileset2D;
|