Always use load extent with real world center

This commit is contained in:
Andreas Hocevar
2020-03-29 18:14:31 +02:00
parent 0c9324f398
commit 190cd202a1
4 changed files with 35 additions and 42 deletions

View File

@@ -437,8 +437,7 @@ class Graticule extends VectorLayer {
features: new Collection(),
overlaps: false,
useSpatialIndex: false,
wrapX: options.wrapX,
loadWrapX: false
wrapX: options.wrapX
})
);

View File

@@ -361,7 +361,7 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
const center = viewState.center.slice();
const extent = buffer(frameStateExtent,
vectorLayerRenderBuffer * resolution);
let loadExtent = extent.slice();
const loadExtent = extent.slice();
const projectionExtent = viewState.projection.getExtent();
if (vectorSource.getWrapX() && viewState.projection.canWrapX() &&
@@ -375,11 +375,10 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
const gutter = Math.max(getWidth(extent) / 2, worldWidth);
extent[0] = projectionExtent[0] - gutter;
extent[2] = projectionExtent[2] + gutter;
if (vectorSource.getLoadWrapX()) {
loadExtent = extent;
}
const worldsAway = Math.floor((center[0] - projectionExtent[0]) / worldWidth);
center[0] -= (worldsAway * worldWidth);
loadExtent[0] -= (worldsAway * worldWidth);
loadExtent[2] -= (worldsAway * worldWidth);
}
if (!this.dirty_ &&

View File

@@ -146,10 +146,6 @@ export class VectorSourceEvent extends Event {
* @property {boolean} [wrapX=true] Wrap the world horizontally. For vector editing across the
* -180° and 180° meridians to work properly, this should be set to `false`. The
* resulting geometry coordinates will then exceed the world bounds.
* @property {boolean} [loadWrapX=true] Call the loader with one world width either side
* of the projection extent when the world is wrapped horizontally. This allows features
* to be loaded in a single request, but may be inefficient. If `false` only the viewport
* extent is used and the loader must determine the appropriate real world requests.
*/
@@ -190,12 +186,6 @@ class VectorSource extends Source {
*/
this.format_ = options.format;
/**
* @private
* @type {boolean}
*/
this.loadWrapX_ = options.loadWrapX === undefined ? true : options.loadWrapX;
/**
* @private
* @type {boolean}
@@ -811,14 +801,6 @@ class VectorSource extends Source {
}
/**
* @return {boolean} The loadWrapX option used to construct the source.
*/
getLoadWrapX() {
return this.loadWrapX_;
}
/**
* @return {boolean} The source can have overlapping geometries.
*/