ol 10.6.2-dev.1760985568257 → 10.6.2-dev.1761594660005
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/ol.js +1 -1
- package/dist/ol.js.map +1 -1
- package/package.json +1 -1
- package/renderer/canvas/VectorTileLayer.d.ts.map +1 -1
- package/renderer/canvas/VectorTileLayer.js +27 -3
- package/source/VectorTile.d.ts +2 -2
- package/source/VectorTile.d.ts.map +1 -1
- package/source/VectorTile.js +76 -19
- package/util.js +1 -1
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorTileLayer.d.ts","sourceRoot":"","sources":["VectorTileLayer.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"VectorTileLayer.d.ts","sourceRoot":"","sources":["VectorTileLayer.js"],"names":[],"mappings":";AA6DA;;;;;GAKG;AACH;IACE;;;OAGG;IACH,mBAHW,OAAO,2BAA2B,EAAE,OAAO,WAC3C,OAAO,gBAAgB,EAAE,OAAO,EA2C1C;IAtCC,eAAe;IACf,qCAA2E;IAE3E;;;OAGG;IACH,+BAA2B;IAE3B;;;OAGG;IACH,4CAA+C;IAE/C;;;OAGG;IACH,0BAAsB;IAEtB;;;OAGG;IACH,yBAAyB;IAEzB;;;OAGG;IACH,sBAAsC;IAEtC;;;OAGG;IACH,0BAA6B;IAY/B;;;;;;;;;;OAUG;IACH,wBAVW,OAAO,2BAA2B,EAAE,OAAO,cAC3C,OAAO,cAAc,EAAE,UAAU,KACjC,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,cACN,OAAO,QAajB;IAoDD;;;;;OAKG;IACH,6BA4IC;IAyMD;;;OAGG;IACH,4BAHW,OAAO,iBAAiB,EAAE,MAAM,GAC/B,KAAK,CAAC,OAAO,kBAAkB,EAAE,WAAW,CAAC,CA4CxD;IAaD;;;;OAIG;IACH,gCAEC;IAED;;;;OAIG;IACH,4BAHW,OAAO,cAAc,EAAE,UAAU,cACjC,OAAO,sBAAsB,EAAE,KAAK,QAyC9C;IA6DD;;;;OAIG;IACH,6BAJW,OAAO,2BAA2B,EAAE,OAAO,cAC3C,OAAO,cAAc,EAAE,UAAU,GAChC,OAAO,oBAAoB,EAAE,SAAS,CAkCjD;IAqID;;;;;;;;OAQG;IACH,uBARW,OAAO,kBAAkB,EAAE,WAAW,oBACtC,MAAM,UACN,OAAO,sBAAsB,EAAE,OAAO,GAAC,KAAK,CAAC,OAAO,sBAAsB,EAAE,OAAO,CAAC,gBACpF,OAAO,qCAAqC,EAAE,OAAO,cACrD,OAAO,UACP,MAAM,GACL,OAAO,CAyClB;IAED;;;;OAIG;IACH,8BAcC;IAED;;;;OAIG;IACH,yBAwDC;CACF;oCAl9BmC,gBAAgB"}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
getTopLeft,
|
|
15
15
|
intersects,
|
|
16
16
|
} from '../../extent.js';
|
|
17
|
+
import {equivalent, getTransform, transformExtent} from '../../proj.js';
|
|
17
18
|
import CanvasBuilderGroup from '../../render/canvas/BuilderGroup.js';
|
|
18
19
|
import CanvasExecutorGroup, {
|
|
19
20
|
DECLUTTER,
|
|
@@ -234,9 +235,22 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|
|
234
235
|
if (sourceTile.getState() != TileState.LOADED) {
|
|
235
236
|
continue;
|
|
236
237
|
}
|
|
238
|
+
const sourceProjection = source.getProjection();
|
|
237
239
|
const sourceTileCoord = sourceTile.tileCoord;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
+
let sourceTileExtent = sourceTileGrid.getTileCoordExtent(sourceTileCoord);
|
|
241
|
+
if (
|
|
242
|
+
projection &&
|
|
243
|
+
sourceProjection &&
|
|
244
|
+
!equivalent(projection, sourceProjection)
|
|
245
|
+
) {
|
|
246
|
+
sourceTileExtent = transformExtent(
|
|
247
|
+
sourceTileExtent,
|
|
248
|
+
sourceProjection,
|
|
249
|
+
projection,
|
|
250
|
+
32,
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
240
254
|
const sharedExtent = getIntersection(tileExtent, sourceTileExtent);
|
|
241
255
|
const builderExtent = buffer(
|
|
242
256
|
sharedExtent,
|
|
@@ -287,7 +301,17 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|
|
287
301
|
features.sort(renderOrder);
|
|
288
302
|
}
|
|
289
303
|
for (let i = 0, ii = features.length; i < ii; ++i) {
|
|
290
|
-
|
|
304
|
+
let feature = features[i];
|
|
305
|
+
if (
|
|
306
|
+
projection &&
|
|
307
|
+
sourceTile.projection &&
|
|
308
|
+
!equivalent(projection, sourceTile.projection)
|
|
309
|
+
) {
|
|
310
|
+
feature = feature.clone();
|
|
311
|
+
feature
|
|
312
|
+
.getGeometry()
|
|
313
|
+
.applyTransform(getTransform(sourceTile.projection, projection));
|
|
314
|
+
}
|
|
291
315
|
if (
|
|
292
316
|
!bufferedExtent ||
|
|
293
317
|
intersects(bufferedExtent, feature.getGeometry().getExtent())
|
package/source/VectorTile.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export type Options<FeatureType extends import("../Feature.js").FeatureLike = im
|
|
|
35
35
|
*/
|
|
36
36
|
overlaps?: boolean | undefined;
|
|
37
37
|
/**
|
|
38
|
-
* Projection of the tile
|
|
38
|
+
* Projection of the tile source.
|
|
39
39
|
*/
|
|
40
40
|
projection?: import("../proj.js").ProjectionLike;
|
|
41
41
|
/**
|
|
@@ -142,7 +142,7 @@ export type Options<FeatureType extends import("../Feature.js").FeatureLike = im
|
|
|
142
142
|
* to `false` (e.g. for sources with polygons that represent administrative
|
|
143
143
|
* boundaries or TopoJSON sources) allows the renderer to optimise fill and
|
|
144
144
|
* stroke operations.
|
|
145
|
-
* @property {import("../proj.js").ProjectionLike} [projection='EPSG:3857'] Projection of the tile
|
|
145
|
+
* @property {import("../proj.js").ProjectionLike} [projection='EPSG:3857'] Projection of the tile source.
|
|
146
146
|
* @property {import("./Source.js").State} [state] Source state.
|
|
147
147
|
* @property {typeof import("../VectorTile.js").default} [tileClass] Class used to instantiate tiles.
|
|
148
148
|
* Default is {@link module:ol/VectorTile~VectorTile}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorTile.d.ts","sourceRoot":"","sources":["VectorTile.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VectorTile.d.ts","sourceRoot":"","sources":["VectorTile.js"],"names":[],"mappings":"AAgfA;;;;;GAKG;AACH,oCAJoD,WAAW,SAAlD,OAAQ,eAAe,EAAE,WAAY,iDACvC,OAAO,kBAAkB,EAAE,OAAO,CAAC,WAAW,CAAC,OAC/C,MAAM,QAqBhB;;oBA9emD,WAAW,SAAlD,OAAQ,eAAe,EAAE,WAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAWpC,OAAO,YAAY,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAZjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAEH;;;;;;;;;;;;;GAaG;AACH,yBAFoD,WAAW,SAAlD,OAAQ,eAAe,EAAE,WAAY;IAGhD;;OAEG;IACH,qBAFY,OAAO,CAAC,WAAW,CAAC,EAsE/B;IAlCC;;;OAGG;IACH,gBAAqD;IAErD;;;OAGG;IACH,iCAAkC;IAElC;;OAEG;IACH;;MAAsB;IAEtB;;;OAGG;IACH,kBAAwE;IAExE;;;OAGG;IACH,iCAA6D;IAE7D;;;OAGG;IACH,mBAAoB;IAGtB;;OAEG;IACH,eAFY,OAAO,CAIlB;IAED;;;;;OAKG;IACH,2BALW,MAAM,cACN,OAAO,oBAAoB,EAAE,OAAO,QACpC,gBAAgB,GACf,KAAK,CAAC,SAA+B,CAAC,CAmHjD;IAED;;OAEG;IACH,wBAFW,gBAAgB,QAqB1B;IAED;;;;;;;;OAQG;IACH,oBARW,MAAM,KACN,MAAM,KACN,MAAM,cACN,MAAM,cACN,OAAO,uBAAuB,EAAE,OAAO,GACrC,gBAAgB,CA2E5B;IAwED;;OAEG;IACH,sBAFW,OAAO,QAKjB;CACF;iBAtegB,kBAAkB;qBAWd,yBAAyB;oBAO1B,cAAc;6BAnBL,wBAAwB"}
|
package/source/VectorTile.js
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import TileState from '../TileState.js';
|
|
6
6
|
import VectorRenderTile from '../VectorRenderTile.js';
|
|
7
7
|
import Tile from '../VectorTile.js';
|
|
8
|
-
import {assert} from '../asserts.js';
|
|
9
8
|
import EventType from '../events/EventType.js';
|
|
10
9
|
import {
|
|
11
10
|
buffer as bufferExtent,
|
|
@@ -14,11 +13,15 @@ import {
|
|
|
14
13
|
} from '../extent.js';
|
|
15
14
|
import {loadFeaturesXhr} from '../featureloader.js';
|
|
16
15
|
import {isEmpty} from '../obj.js';
|
|
17
|
-
import {equivalent} from '../proj.js';
|
|
16
|
+
import {equivalent, transformExtent} from '../proj.js';
|
|
18
17
|
import {toSize} from '../size.js';
|
|
19
18
|
import TileGrid from '../tilegrid/TileGrid.js';
|
|
20
19
|
import {DEFAULT_MAX_ZOOM} from '../tilegrid/common.js';
|
|
21
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
createXYZ,
|
|
22
|
+
extentFromProjection,
|
|
23
|
+
getForProjection,
|
|
24
|
+
} from '../tilegrid.js';
|
|
22
25
|
import UrlTile from './UrlTile.js';
|
|
23
26
|
|
|
24
27
|
/**
|
|
@@ -33,7 +36,7 @@ import UrlTile from './UrlTile.js';
|
|
|
33
36
|
* to `false` (e.g. for sources with polygons that represent administrative
|
|
34
37
|
* boundaries or TopoJSON sources) allows the renderer to optimise fill and
|
|
35
38
|
* stroke operations.
|
|
36
|
-
* @property {import("../proj.js").ProjectionLike} [projection='EPSG:3857'] Projection of the tile
|
|
39
|
+
* @property {import("../proj.js").ProjectionLike} [projection='EPSG:3857'] Projection of the tile source.
|
|
37
40
|
* @property {import("./Source.js").State} [state] Source state.
|
|
38
41
|
* @property {typeof import("../VectorTile.js").default} [tileClass] Class used to instantiate tiles.
|
|
39
42
|
* Default is {@link module:ol/VectorTile~VectorTile}.
|
|
@@ -193,18 +196,37 @@ class VectorTile extends UrlTile {
|
|
|
193
196
|
tile.setState(TileState.LOADING);
|
|
194
197
|
const urlTileCoord = tile.wrappedTileCoord;
|
|
195
198
|
const tileGrid = this.getTileGridForProjection(projection);
|
|
196
|
-
|
|
199
|
+
let extent = tileGrid.getTileCoordExtent(urlTileCoord);
|
|
197
200
|
const z = urlTileCoord[0];
|
|
198
201
|
const resolution = tileGrid.getResolution(z);
|
|
199
202
|
// make extent 1 pixel smaller so we don't load tiles for < 0.5 pixel render space
|
|
200
203
|
bufferExtent(extent, -resolution, extent);
|
|
204
|
+
const sourceProjection = this.projection;
|
|
205
|
+
if (
|
|
206
|
+
projection &&
|
|
207
|
+
this.projection &&
|
|
208
|
+
!equivalent(projection, sourceProjection)
|
|
209
|
+
) {
|
|
210
|
+
extent = transformExtent(extent, projection, sourceProjection);
|
|
211
|
+
}
|
|
201
212
|
const sourceTileGrid = this.tileGrid;
|
|
202
213
|
const sourceExtent = sourceTileGrid.getExtent();
|
|
203
214
|
if (sourceExtent) {
|
|
204
215
|
getIntersection(extent, sourceExtent, extent);
|
|
205
216
|
}
|
|
217
|
+
let sourceResolution = resolution;
|
|
218
|
+
if (
|
|
219
|
+
projection &&
|
|
220
|
+
sourceProjection &&
|
|
221
|
+
!equivalent(projection, sourceProjection)
|
|
222
|
+
) {
|
|
223
|
+
sourceResolution =
|
|
224
|
+
resolution /
|
|
225
|
+
sourceProjection.getMetersPerUnit() /
|
|
226
|
+
projection.getMetersPerUnit();
|
|
227
|
+
}
|
|
206
228
|
const sourceZ = sourceTileGrid.getZForResolution(
|
|
207
|
-
|
|
229
|
+
sourceResolution,
|
|
208
230
|
this.zDirection,
|
|
209
231
|
);
|
|
210
232
|
|
|
@@ -263,7 +285,7 @@ class VectorTile extends UrlTile {
|
|
|
263
285
|
if (sourceTileState === TileState.IDLE) {
|
|
264
286
|
sourceTile.extent =
|
|
265
287
|
sourceTileGrid.getTileCoordExtent(sourceTileCoord);
|
|
266
|
-
sourceTile.projection = projection;
|
|
288
|
+
sourceTile.projection = this.projection;
|
|
267
289
|
sourceTile.resolution = sourceTileGrid.getResolution(
|
|
268
290
|
sourceTileCoord[0],
|
|
269
291
|
);
|
|
@@ -324,12 +346,22 @@ class VectorTile extends UrlTile {
|
|
|
324
346
|
projection,
|
|
325
347
|
);
|
|
326
348
|
const sourceExtent = this.getTileGrid().getExtent();
|
|
349
|
+
const sourceProjection = this.projection;
|
|
327
350
|
const tileGrid = this.getTileGridForProjection(projection);
|
|
328
351
|
if (urlTileCoord && sourceExtent) {
|
|
329
352
|
const tileExtent = tileGrid.getTileCoordExtent(urlTileCoord);
|
|
330
353
|
// make extent 1 pixel smaller so we don't load tiles for < 0.5 pixel render space
|
|
331
354
|
bufferExtent(tileExtent, -tileGrid.getResolution(z), tileExtent);
|
|
332
|
-
if (
|
|
355
|
+
if (
|
|
356
|
+
!intersects(
|
|
357
|
+
sourceExtent,
|
|
358
|
+
!projection ||
|
|
359
|
+
!sourceProjection ||
|
|
360
|
+
equivalent(projection, sourceProjection)
|
|
361
|
+
? tileExtent
|
|
362
|
+
: transformExtent(tileExtent, projection, sourceProjection),
|
|
363
|
+
)
|
|
364
|
+
) {
|
|
333
365
|
urlTileCoord = null;
|
|
334
366
|
}
|
|
335
367
|
}
|
|
@@ -337,15 +369,38 @@ class VectorTile extends UrlTile {
|
|
|
337
369
|
if (urlTileCoord !== null) {
|
|
338
370
|
const sourceTileGrid = this.tileGrid;
|
|
339
371
|
const resolution = tileGrid.getResolution(z);
|
|
340
|
-
|
|
372
|
+
let sourceResolution = resolution;
|
|
373
|
+
if (
|
|
374
|
+
projection &&
|
|
375
|
+
sourceProjection &&
|
|
376
|
+
!equivalent(projection, sourceProjection)
|
|
377
|
+
) {
|
|
378
|
+
sourceResolution =
|
|
379
|
+
resolution /
|
|
380
|
+
sourceProjection.getMetersPerUnit() /
|
|
381
|
+
projection.getMetersPerUnit();
|
|
382
|
+
}
|
|
383
|
+
const sourceZ = sourceTileGrid.getZForResolution(sourceResolution, 1);
|
|
341
384
|
// make extent 1 pixel smaller so we don't load tiles for < 0.5 pixel render space
|
|
342
385
|
const extent = tileGrid.getTileCoordExtent(urlTileCoord);
|
|
343
386
|
bufferExtent(extent, -resolution, extent);
|
|
344
|
-
sourceTileGrid.forEachTileCoord(
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
387
|
+
sourceTileGrid.forEachTileCoord(
|
|
388
|
+
!projection ||
|
|
389
|
+
!sourceProjection ||
|
|
390
|
+
equivalent(projection, sourceProjection)
|
|
391
|
+
? extent
|
|
392
|
+
: transformExtent(extent, projection, sourceProjection),
|
|
393
|
+
sourceZ,
|
|
394
|
+
(sourceTileCoord) => {
|
|
395
|
+
empty =
|
|
396
|
+
empty &&
|
|
397
|
+
!this.tileUrlFunction(
|
|
398
|
+
sourceTileCoord,
|
|
399
|
+
pixelRatio,
|
|
400
|
+
sourceProjection,
|
|
401
|
+
);
|
|
402
|
+
},
|
|
403
|
+
);
|
|
349
404
|
}
|
|
350
405
|
const newTile = new VectorRenderTile(
|
|
351
406
|
tileCoord,
|
|
@@ -367,11 +422,13 @@ class VectorTile extends UrlTile {
|
|
|
367
422
|
const code = projection.getCode();
|
|
368
423
|
let tileGrid = this.tileGrids_[code];
|
|
369
424
|
if (!tileGrid) {
|
|
370
|
-
const sourceProjection = this.
|
|
371
|
-
|
|
372
|
-
sourceProjection
|
|
373
|
-
|
|
374
|
-
)
|
|
425
|
+
const sourceProjection = this.projection;
|
|
426
|
+
if (
|
|
427
|
+
sourceProjection !== null &&
|
|
428
|
+
!equivalent(sourceProjection, projection)
|
|
429
|
+
) {
|
|
430
|
+
return getForProjection(projection);
|
|
431
|
+
}
|
|
375
432
|
|
|
376
433
|
// A tile grid that matches the tile size of the source tile grid is more
|
|
377
434
|
// likely to have 1:1 relationships between source tiles and rendered tiles.
|
package/util.js
CHANGED