ol 7.0.1-dev.1661428378889 → 7.0.1-dev.1661441395492
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/interaction/Draw.d.ts +1 -1
- package/interaction/Draw.d.ts.map +1 -1
- package/interaction/Draw.js +24 -10
- package/interaction/Modify.d.ts +2 -2
- package/interaction/Modify.js +1 -1
- package/layer/WebGLTile.d.ts.map +1 -1
- package/layer/WebGLTile.js +3 -0
- package/package.json +1 -1
- package/renderer/canvas/TileLayer.d.ts.map +1 -1
- package/renderer/canvas/TileLayer.js +4 -1
- package/renderer/webgl/TileLayer.d.ts +8 -1
- package/renderer/webgl/TileLayer.d.ts.map +1 -1
- package/renderer/webgl/TileLayer.js +64 -9
- package/util.js +1 -1
package/interaction/Draw.d.ts
CHANGED
|
@@ -99,7 +99,7 @@ export type Options = {
|
|
|
99
99
|
/**
|
|
100
100
|
* Style for sketch features.
|
|
101
101
|
*/
|
|
102
|
-
style?: import("../style/Style.js").StyleLike | undefined;
|
|
102
|
+
style?: import("../style/Style.js").StyleLike | import("../style/flat.js").FlatStyleLike | undefined;
|
|
103
103
|
/**
|
|
104
104
|
* Function that is called when a geometry's coordinates are updated.
|
|
105
105
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Draw.d.ts","sourceRoot":"","sources":["Draw.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Draw.d.ts","sourceRoot":"","sources":["Draw.js"],"names":[],"mappings":"AA8zDA;;;;;;;;;;;;GAYG;AACH,8FAHY,gBAAgB,CAmC3B;AAED;;;;;;GAMG;AACH,6BAHY,gBAAgB,CAiC3B;AA7tDD;;;;GAIG;AACH;IACE;;;OAGG;IACH,kBAHW,aAAa,WACb,OAAO,EAWjB;IANC;;;;OAIG;IACH,SAHU,OAAO,CAGK;CAEzB;;;;;;;UA5Ja,OAAO,qBAAqB,EAAE,IAAI;;;;;;;;;;;;;;;;;;;;;;;;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;;OAKG;IACH,YAFW,OAAO,WAAW,EAAE,OAAO,QAKrC;IAED;;;;OAIG;IACH,+BAEC;IA4GD;;OAEG;IACH,yBAEC;IAED;;;;OAIG;IACH,0BAkCC;IAED;;;;OAIG;IACH,sCA2BC;IAED;;;;OAIG;IACH,iCAyBC;IAED;;;;;OAKG;IACH,8BA+BC;IAED;;;;OAIG;IACH,qBAqDC;IAmDD;;;;OAIG;IACH,2BA2BC;IAED;;;;;;OAMG;IACH,kBA8CC;IAED;;;OAGG;IACH,mCAQC;IAED;;;OAGG;IACH,wCAmBC;IAED;;;;OAIG;IACH,sBAgCC;IAED;;;;OAIG;IACH,uBAwCC;IAED;;;;OAIG;IACH,sBAsCC;IAED;;OAEG;IACH,qBAFW,MAAM,QA8ChB;IAED;;;;OAIG;IACH,wBAEC;IAED;;;;;OAKG;IACH,sBA4CC;IAED;;;;OAIG;IACH,sBASC;IAED;;;OAGG;IACH,qBAKC;IAED;;;;;;;;OAQG;IACH,oDAmCC;IAED;;;;;;;;;;;OAWG;IACH,gBAHY,QAAQ,UAAU,CAAC,QAgB9B;IAED;;;OAGG;IACH,8BAcC;IAED;;OAEG;IACH,qBAOC;CACF"}
|
package/interaction/Draw.js
CHANGED
|
@@ -70,7 +70,7 @@ import {getStrideForLayout} from '../geom/SimpleGeometry.js';
|
|
|
70
70
|
* that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
|
71
71
|
* boolean to indicate whether the drawing can be finished. Not used when drawing
|
|
72
72
|
* POINT or MULTI_POINT geometries.
|
|
73
|
-
* @property {import("../style/Style.js").StyleLike} [style]
|
|
73
|
+
* @property {import("../style/Style.js").StyleLike|import("../style/flat.js").FlatStyleLike} [style]
|
|
74
74
|
* Style for sketch features.
|
|
75
75
|
* @property {GeometryFunction} [geometryFunction]
|
|
76
76
|
* Function that is called when a geometry's coordinates are updated.
|
|
@@ -355,10 +355,12 @@ const sharedUpdateInfo = {index: -1, endIndex: NaN};
|
|
|
355
355
|
/**
|
|
356
356
|
* @param {import("../coordinate.js").Coordinate} coordinate The coordinate.
|
|
357
357
|
* @param {TraceState} traceState The trace state.
|
|
358
|
+
* @param {import("../Map.js").default} map The map.
|
|
359
|
+
* @param {number} snapTolerance The snap tolerance.
|
|
358
360
|
* @return {TraceTargetUpdateInfo} Information about the new trace target. The returned
|
|
359
361
|
* object is reused between calls and must not be modified by the caller.
|
|
360
362
|
*/
|
|
361
|
-
function getTraceTargetUpdate(coordinate, traceState) {
|
|
363
|
+
function getTraceTargetUpdate(coordinate, traceState, map, snapTolerance) {
|
|
362
364
|
const x = coordinate[0];
|
|
363
365
|
const y = coordinate[1];
|
|
364
366
|
|
|
@@ -412,14 +414,24 @@ function getTraceTargetUpdate(coordinate, traceState) {
|
|
|
412
414
|
}
|
|
413
415
|
}
|
|
414
416
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
const
|
|
420
|
-
|
|
417
|
+
const newTarget = traceState.targets[newTargetIndex];
|
|
418
|
+
let considerBothDirections = newTarget.ring;
|
|
419
|
+
if (traceState.targetIndex === newTargetIndex && considerBothDirections) {
|
|
420
|
+
// only consider switching trace direction if close to the start
|
|
421
|
+
const newCoordinate = interpolateCoordinate(
|
|
422
|
+
newTarget.coordinates,
|
|
423
|
+
newEndIndex
|
|
424
|
+
);
|
|
425
|
+
const pixel = map.getPixelFromCoordinate(newCoordinate);
|
|
426
|
+
if (distance(pixel, traceState.startPx) > snapTolerance) {
|
|
427
|
+
considerBothDirections = false;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
if (considerBothDirections) {
|
|
432
|
+
const coordinates = newTarget.coordinates;
|
|
421
433
|
const count = coordinates.length;
|
|
422
|
-
const startIndex =
|
|
434
|
+
const startIndex = newTarget.startIndex;
|
|
423
435
|
const endIndex = newEndIndex;
|
|
424
436
|
if (startIndex < endIndex) {
|
|
425
437
|
const forwardDistance = getCumulativeSquaredDistance(
|
|
@@ -1239,7 +1251,9 @@ class Draw extends PointerInteraction {
|
|
|
1239
1251
|
|
|
1240
1252
|
const updatedTraceTarget = getTraceTargetUpdate(
|
|
1241
1253
|
event.coordinate,
|
|
1242
|
-
traceState
|
|
1254
|
+
traceState,
|
|
1255
|
+
this.getMap(),
|
|
1256
|
+
this.snapTolerance_
|
|
1243
1257
|
);
|
|
1244
1258
|
|
|
1245
1259
|
if (traceState.targetIndex !== updatedTraceTarget.index) {
|
package/interaction/Modify.d.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* features. Default is {@link module:ol/events/condition.always}.
|
|
26
26
|
* @property {number} [pixelTolerance=10] Pixel tolerance for considering the
|
|
27
27
|
* pointer close enough to a segment or vertex for editing.
|
|
28
|
-
* @property {import("../style/Style.js").StyleLike} [style]
|
|
28
|
+
* @property {import("../style/Style.js").StyleLike|import("../style/flat.js").FlatStyleLike} [style]
|
|
29
29
|
* Style used for the modification point or vertex. For linestrings and polygons, this will
|
|
30
30
|
* be the affected vertex, for circles a point along the circle, and for points the actual
|
|
31
31
|
* point. If not configured, the default edit style is used (see {@link module:ol/style/Style~Style}).
|
|
@@ -142,7 +142,7 @@ export type Options = {
|
|
|
142
142
|
* in the same order. The `geometries` are only useful when modifying geometry collections, where
|
|
143
143
|
* the geometry will be the particular geometry from the collection that is being modified.
|
|
144
144
|
*/
|
|
145
|
-
style?: import("../style/Style.js").StyleLike | undefined;
|
|
145
|
+
style?: import("../style/Style.js").StyleLike | import("../style/flat.js").FlatStyleLike | undefined;
|
|
146
146
|
/**
|
|
147
147
|
* The vector source with
|
|
148
148
|
* features to modify. If a vector source is not provided, a feature collection
|
package/interaction/Modify.js
CHANGED
|
@@ -106,7 +106,7 @@ const ModifyEventType = {
|
|
|
106
106
|
* features. Default is {@link module:ol/events/condition.always}.
|
|
107
107
|
* @property {number} [pixelTolerance=10] Pixel tolerance for considering the
|
|
108
108
|
* pointer close enough to a segment or vertex for editing.
|
|
109
|
-
* @property {import("../style/Style.js").StyleLike} [style]
|
|
109
|
+
* @property {import("../style/Style.js").StyleLike|import("../style/flat.js").FlatStyleLike} [style]
|
|
110
110
|
* Style used for the modification point or vertex. For linestrings and polygons, this will
|
|
111
111
|
* be the affected vertex, for circles a point along the circle, and for points the actual
|
|
112
112
|
* point. If not configured, the default edit style is used (see {@link module:ol/style/Style~Style}).
|
package/layer/WebGLTile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGLTile.d.ts","sourceRoot":"","sources":["WebGLTile.js"],"names":[],"mappings":";yBAkBa,OAAO,uBAAuB,EAAE,OAAO,GAAC,OAAO,wBAAwB,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCA+CpD,OAAO,cAAc,EAAE,MAAM,QAAE,MAAM,KAAE,MAAM,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;kBAgBnF,MAAM;;;;oBACN,MAAM;;;;;YACC,MAAM,GAAC,OAAO,oBAAoB,EAAE,YAAY;;;;;qBACvD,MAAM,OAAO,4BAA4B,EAAE,OAAO,CAAC;;AAgNjE;;;;;;;;;;;GAWG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAkDjB;IArCC;;;OAGG;IACH,iBAA+B;IAE/B;;;OAGG;IACH,wBAA2B;IAE3B;;;OAGG;IACH,4BAA8B;IAE9B;;;OAGG;IACH,eAAmB;IAEnB;;;OAGG;IACH,mBAA2B;IAE3B;;;OAGG;IACH,wBAAkD;IAKpD;;;;;OAKG;IACH,mBAJW,OAAO,cAAc,EAAE,MAAM,cAC7B,MAAM,GACL,MAAM,UAAU,CAAC,CAW5B;IAED;;OAEG;IACH,mBAFY,UAAU,CAIrB;IAUD;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"WebGLTile.d.ts","sourceRoot":"","sources":["WebGLTile.js"],"names":[],"mappings":";yBAkBa,OAAO,uBAAuB,EAAE,OAAO,GAAC,OAAO,wBAAwB,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCA+CpD,OAAO,cAAc,EAAE,MAAM,QAAE,MAAM,KAAE,MAAM,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;kBAgBnF,MAAM;;;;oBACN,MAAM;;;;;YACC,MAAM,GAAC,OAAO,oBAAoB,EAAE,YAAY;;;;;qBACvD,MAAM,OAAO,4BAA4B,EAAE,OAAO,CAAC;;AAgNjE;;;;;;;;;;;GAWG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAkDjB;IArCC;;;OAGG;IACH,iBAA+B;IAE/B;;;OAGG;IACH,wBAA2B;IAE3B;;;OAGG;IACH,4BAA8B;IAE9B;;;OAGG;IACH,eAAmB;IAEnB;;;OAGG;IACH,mBAA2B;IAE3B;;;OAGG;IACH,wBAAkD;IAKpD;;;;;OAKG;IACH,mBAJW,OAAO,cAAc,EAAE,MAAM,cAC7B,MAAM,GACL,MAAM,UAAU,CAAC,CAW5B;IAED;;OAEG;IACH,mBAFY,UAAU,CAIrB;IAUD;;OAEG;IACH,4BAOC;IAED;;;OAGG;IACH,4BAMC;IAcD;;;;OAIG;IACH,0BAJW,OAAO,QAAQ,EAAE,UAAU,WAC3B,MAAM,UAAU,CAAC,GAChB,WAAW,CAYtB;IA8CD;;;;;;;OAOG;IACH,gBAFW,KAAK,QAcf;IAED;;;;OAIG;IACH;YAHkB,MAAM,GAAE,MAAM;aAM/B;CACF"}
|
package/layer/WebGLTile.js
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileLayer.d.ts","sourceRoot":"","sources":["TileLayer.js"],"names":[],"mappings":";AA8BA;;;;;;GAMG;AACH;IACE;;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GhD;;;;OAIG;IACH,+BAHW,OAAO,eAAe,EAAE,OAAO,GAC9B,OAAO,CAWlB;IAED;;;;;;OAMG;IACH,WANW,MAAM,KACN,MAAM,KACN,MAAM,cACN,OAAO,cAAc,EAAE,UAAU,GAC/B,OAAO,eAAe,EAAE,OAAO,CAkB3C;IAED;;;OAGG;IACH,eAHW,OAAO,gBAAgB,EAAE,KAAK,GAC7B,iBAAiB,CA4E5B;IAoWD;;;;;;;;;OASG;IACH,oBATW,OAAO,oBAAoB,EAAE,OAAO,cACpC,OAAO,cAAc,EAAE,UAAU,KACjC,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,cACN,OAAO,QAqCjB;IAED;;OAEG;IACH,YAFY,iBAAiB,CAK5B;IAED;;;;;OAKG;IACH,6BAJW,OAAO,oBAAoB,EAAE,OAAO,GACnC,iBAAiB,GAAC,gBAAgB,GAAC,gBAAgB,CAK9D;IAED;;;;OAIG;IACH,0CAJW,OAAO,cAAc,EAAE,UAAU,cACjC,OAAO,sBAAsB,EAAE,OAAO,QA0BhD;IAED;;;;;OAKG;IACH;YALmB,MAAM;gBAAU,MAAM,GAAE,OAAO;;mBACvC,OAAO,sBAAsB,EAAE,OAAO,QACtC,OAAO,eAAe,EAAE,OAAO,QAUzC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,wCAXW,OAAO,cAAc,EAAE,UAAU,cACjC,OAAO,sBAAsB,EAAE,OAAO,YACtC,OAAO,4BAA4B,EAAE,OAAO,cAC5C,MAAM,cACN,OAAO,0BAA0B,EAAE,OAAO,UAC1C,OAAO,iBAAiB,EAAE,MAAM,YAChC,MAAM,WACN,MAAM,yBACG,OAAO,eAAe,EAAE,OAAO,KAAE,IAAI,qBAmExD;CACF"}
|
|
@@ -181,7 +181,10 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
|
|
|
181
181
|
pixelRatio,
|
|
182
182
|
projection
|
|
183
183
|
);
|
|
184
|
-
if (
|
|
184
|
+
if (
|
|
185
|
+
!(tile instanceof ImageTile || tile instanceof ReprojTile) ||
|
|
186
|
+
(tile instanceof ReprojTile && tile.getState() === TileState.EMPTY)
|
|
187
|
+
) {
|
|
185
188
|
return null;
|
|
186
189
|
}
|
|
187
190
|
|
|
@@ -143,6 +143,11 @@ declare class WebGLTileLayerRenderer extends WebGLLayerRenderer<import("../../la
|
|
|
143
143
|
* @type {import("../../Map.js").FrameState|null}
|
|
144
144
|
*/
|
|
145
145
|
private frameState_;
|
|
146
|
+
/**
|
|
147
|
+
* @private
|
|
148
|
+
* @type {import("../../proj/Projection.js").default}
|
|
149
|
+
*/
|
|
150
|
+
private projection_;
|
|
146
151
|
/**
|
|
147
152
|
* @param {Options} options Options.
|
|
148
153
|
*/
|
|
@@ -158,10 +163,11 @@ declare class WebGLTileLayerRenderer extends WebGLLayerRenderer<import("../../la
|
|
|
158
163
|
* @param {import("../../extent.js").Extent} extent The extent to be rendered.
|
|
159
164
|
* @param {number} initialZ The zoom level.
|
|
160
165
|
* @param {Object<number, Array<TileTexture>>} tileTexturesByZ The zoom level.
|
|
166
|
+
* @param {number} preload Number of additional levels to load.
|
|
161
167
|
*/
|
|
162
168
|
enqueueTiles(frameState: import("../../Map.js").FrameState, extent: import("../../extent.js").Extent, initialZ: number, tileTexturesByZ: {
|
|
163
169
|
[x: number]: Array<TileTexture>;
|
|
164
|
-
}): void;
|
|
170
|
+
}, preload: number): void;
|
|
165
171
|
/**
|
|
166
172
|
* Render the layer.
|
|
167
173
|
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
@@ -185,6 +191,7 @@ declare class WebGLTileLayerRenderer extends WebGLLayerRenderer<import("../../la
|
|
|
185
191
|
* @private
|
|
186
192
|
*/
|
|
187
193
|
private findAltTiles_;
|
|
194
|
+
clearCache(): void;
|
|
188
195
|
}
|
|
189
196
|
import WebGLLayerRenderer from "./Layer.js";
|
|
190
197
|
import TileTexture from "../../webgl/TileTexture.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileLayer.d.ts","sourceRoot":"","sources":["TileLayer.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"TileLayer.d.ts","sourceRoot":"","sources":["TileLayer.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;kBAkIc,MAAM;;;;oBACN,MAAM;;;;;;;;;;;;;;;;;wBAQP,OAAO,0BAA0B,EAAE,OAAO;AAXvD;;;;;;;;GAQG;AAEH;;GAEG;AAEH;;;;;GAKG;AACH;IACE;;;OAGG;IACH,uBAHW,SAAS,WACT,OAAO,EAyGjB;IAlGC;;;OAGG;IACH,gBAFU,OAAO,CAEU;IAE3B;;;;OAIG;IACH,uBAAuC;IAEvC;;;OAGG;IACH,kBAA6B;IAE7B;;;OAGG;IACH,uBAA+C;IAE/C;;;OAGG;IACH,uBAA8C;IAE9C;;;OAGG;IACH,kBAAuB;IAEvB;;;OAGG;IACH,iBAAa;IAEb;;OAEG;IACH,sBAAyC;IAEzC;;OAEG;IACH,wBAA6C;IAE7C;;;;;;;;;;;;;;;;OAgBG;IACH,iBAAuE;IAKvE;;;OAGG;IACH,0BAAgD;IAEhD;;;OAGG;IACH,yBAAqD;IAErD;;;OAGG;IACH,oBAAuB;IAEvB;;;OAGG;IACH,oBAA4B;IAG9B;;OAEG;IACH,eAFW,OAAO,QAgBjB;IAWD;;;;OAIG;IACH,wBASC;IA2BD;;;;;;OAMG;IACH,yBANW,OAAO,cAAc,EAAE,UAAU,UACjC,OAAO,iBAAiB,EAAE,MAAM,YAChC,MAAM;YACC,MAAM,GAAE,MAAM,WAAW,CAAC;gBACjC,MAAM,QAwGhB;IAED;;;;OAIG;IACH,wBAHW,OAAO,cAAc,EAAE,UAAU,GAChC,WAAW,CAkStB;IAED;;;OAGG;IACH,eAHW,OAAO,gBAAgB,EAAE,KAAK,GAC7B,iBAAiB,GAAC,UAAU,GAAC,YAAY,GAAC,QAAQ,CAyF7D;IAED;;;;;;;;;;OAUG;IACH,sBA+BC;IAED,mBAIC;CA6BF"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @module ol/renderer/webgl/TileLayer
|
|
3
3
|
*/
|
|
4
4
|
import LRUCache from '../../structs/LRUCache.js';
|
|
5
|
+
import ReprojTile from '../../reproj/Tile.js';
|
|
5
6
|
import TileRange from '../../TileRange.js';
|
|
6
7
|
import TileState from '../../TileState.js';
|
|
7
8
|
import TileTexture from '../../webgl/TileTexture.js';
|
|
@@ -247,6 +248,12 @@ class WebGLTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
247
248
|
* @type {import("../../Map.js").FrameState|null}
|
|
248
249
|
*/
|
|
249
250
|
this.frameState_ = null;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* @private
|
|
254
|
+
* @type {import("../../proj/Projection.js").default}
|
|
255
|
+
*/
|
|
256
|
+
this.projection_ = undefined;
|
|
250
257
|
}
|
|
251
258
|
|
|
252
259
|
/**
|
|
@@ -299,6 +306,13 @@ class WebGLTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
299
306
|
* @return {boolean} Layer is ready to be rendered.
|
|
300
307
|
*/
|
|
301
308
|
prepareFrameInternal(frameState) {
|
|
309
|
+
if (!this.projection_) {
|
|
310
|
+
this.projection_ = frameState.viewState.projection;
|
|
311
|
+
} else if (frameState.viewState.projection !== this.projection_) {
|
|
312
|
+
this.clearCache();
|
|
313
|
+
this.projection_ = frameState.viewState.projection;
|
|
314
|
+
}
|
|
315
|
+
|
|
302
316
|
const layer = this.getLayer();
|
|
303
317
|
const source = layer.getRenderSource();
|
|
304
318
|
if (!source) {
|
|
@@ -316,8 +330,9 @@ class WebGLTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
316
330
|
* @param {import("../../extent.js").Extent} extent The extent to be rendered.
|
|
317
331
|
* @param {number} initialZ The zoom level.
|
|
318
332
|
* @param {Object<number, Array<TileTexture>>} tileTexturesByZ The zoom level.
|
|
333
|
+
* @param {number} preload Number of additional levels to load.
|
|
319
334
|
*/
|
|
320
|
-
enqueueTiles(frameState, extent, initialZ, tileTexturesByZ) {
|
|
335
|
+
enqueueTiles(frameState, extent, initialZ, tileTexturesByZ, preload) {
|
|
321
336
|
const viewState = frameState.viewState;
|
|
322
337
|
const tileLayer = this.getLayer();
|
|
323
338
|
const tileSource = tileLayer.getRenderSource();
|
|
@@ -330,12 +345,23 @@ class WebGLTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
330
345
|
}
|
|
331
346
|
|
|
332
347
|
const wantedTiles = frameState.wantedTiles[tileSourceKey];
|
|
333
|
-
|
|
334
348
|
const tileTextureCache = this.tileTextureCache_;
|
|
349
|
+
|
|
350
|
+
const map = tileLayer.getMapInternal();
|
|
335
351
|
const minZ = Math.max(
|
|
336
|
-
initialZ -
|
|
352
|
+
initialZ - preload,
|
|
337
353
|
tileGrid.getMinZoom(),
|
|
338
|
-
|
|
354
|
+
tileGrid.getZForResolution(
|
|
355
|
+
Math.min(
|
|
356
|
+
tileLayer.getMaxResolution(),
|
|
357
|
+
map
|
|
358
|
+
? map
|
|
359
|
+
.getView()
|
|
360
|
+
.getResolutionForZoom(Math.max(tileLayer.getMinZoom(), 0))
|
|
361
|
+
: tileGrid.getResolution(0)
|
|
362
|
+
),
|
|
363
|
+
tileSource.zDirection
|
|
364
|
+
)
|
|
339
365
|
);
|
|
340
366
|
for (let z = initialZ; z >= minZ; --z) {
|
|
341
367
|
const tileRange = tileGrid.getTileRangeForExtentAndZ(
|
|
@@ -437,16 +463,34 @@ class WebGLTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
437
463
|
*/
|
|
438
464
|
const tileTexturesByZ = {};
|
|
439
465
|
|
|
466
|
+
const preload = tileLayer.getPreload();
|
|
440
467
|
if (frameState.nextExtent) {
|
|
441
468
|
const targetZ = tileGrid.getZForResolution(
|
|
442
469
|
viewState.nextResolution,
|
|
443
470
|
tileSource.zDirection
|
|
444
471
|
);
|
|
445
472
|
const nextExtent = getRenderExtent(frameState, frameState.nextExtent);
|
|
446
|
-
this.enqueueTiles(
|
|
473
|
+
this.enqueueTiles(
|
|
474
|
+
frameState,
|
|
475
|
+
nextExtent,
|
|
476
|
+
targetZ,
|
|
477
|
+
tileTexturesByZ,
|
|
478
|
+
preload
|
|
479
|
+
);
|
|
447
480
|
}
|
|
448
481
|
|
|
449
|
-
this.enqueueTiles(frameState, extent, z, tileTexturesByZ);
|
|
482
|
+
this.enqueueTiles(frameState, extent, z, tileTexturesByZ, 0);
|
|
483
|
+
if (preload > 0) {
|
|
484
|
+
setTimeout(() => {
|
|
485
|
+
this.enqueueTiles(
|
|
486
|
+
frameState,
|
|
487
|
+
extent,
|
|
488
|
+
z - 1,
|
|
489
|
+
tileTexturesByZ,
|
|
490
|
+
preload - 1
|
|
491
|
+
);
|
|
492
|
+
}, 0);
|
|
493
|
+
}
|
|
450
494
|
|
|
451
495
|
/**
|
|
452
496
|
* A lookup of alpha values for tiles at the target rendering resolution
|
|
@@ -465,6 +509,9 @@ class WebGLTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
465
509
|
for (let i = 0, ii = tileTextures.length; i < ii; ++i) {
|
|
466
510
|
const tileTexture = tileTextures[i];
|
|
467
511
|
const tile = tileTexture.tile;
|
|
512
|
+
if (tile instanceof ReprojTile && tile.getState() === TileState.EMPTY) {
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
468
515
|
const tileCoord = tile.tileCoord;
|
|
469
516
|
|
|
470
517
|
if (tileTexture.loaded) {
|
|
@@ -753,6 +800,10 @@ class WebGLTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
753
800
|
continue;
|
|
754
801
|
}
|
|
755
802
|
const tileTexture = tileTextureCache.get(cacheKey);
|
|
803
|
+
const tile = tileTexture.tile;
|
|
804
|
+
if (tile instanceof ReprojTile && tile.getState() === TileState.EMPTY) {
|
|
805
|
+
return null;
|
|
806
|
+
}
|
|
756
807
|
if (!tileTexture.loaded) {
|
|
757
808
|
continue;
|
|
758
809
|
}
|
|
@@ -817,11 +868,15 @@ class WebGLTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
817
868
|
return covered;
|
|
818
869
|
}
|
|
819
870
|
|
|
871
|
+
clearCache() {
|
|
872
|
+
const tileTextureCache = this.tileTextureCache_;
|
|
873
|
+
tileTextureCache.forEach((tileTexture) => tileTexture.dispose());
|
|
874
|
+
tileTextureCache.clear();
|
|
875
|
+
}
|
|
876
|
+
|
|
820
877
|
removeHelper() {
|
|
821
878
|
if (this.helper) {
|
|
822
|
-
|
|
823
|
-
tileTextureCache.forEach((tileTexture) => tileTexture.dispose());
|
|
824
|
-
tileTextureCache.clear();
|
|
879
|
+
this.clearCache();
|
|
825
880
|
}
|
|
826
881
|
|
|
827
882
|
super.removeHelper();
|
package/util.js
CHANGED