Add option to force loading of a layer, even if it is hidden + automatically set this flag is another layer depends on this layer

This commit is contained in:
Pieter Vander Vennet 2022-02-07 01:59:07 +01:00
parent ad2f7b2bd6
commit 0f95891a47
6 changed files with 28 additions and 7 deletions

View file

@ -23,7 +23,6 @@ import TileFreshnessCalculator from "./TileFreshnessCalculator";
import FullNodeDatabaseSource from "./TiledFeatureSource/FullNodeDatabaseSource";
import MapState from "../State/MapState";
import {ElementStorage} from "../ElementStorage";
import MetaTagging from "../MetaTagging";
/**
@ -373,7 +372,7 @@ export default class FeaturePipeline {
private freshnessForVisibleLayers(z: number, x: number, y: number): Date {
let oldestDate = undefined;
for (const flayer of this.state.filteredLayers.data) {
if (!flayer.isDisplayed.data) {
if (!flayer.isDisplayed.data && !flayer.layerDef.forceLoad) {
continue
}
if (this.state.locationControl.data.zoom < flayer.layerDef.minzoom) {
@ -399,6 +398,9 @@ export default class FeaturePipeline {
return oldestDate
}
/*
* Gives an UIEventSource containing the tileIndexes of the tiles that should be loaded from OSM
* */
private getNeededTilesFromOsm(isSufficientlyZoomed: UIEventSource<boolean>): UIEventSource<number[]> {
const self = this
return this.state.currentBounds.map(bbox => {

View file

@ -27,7 +27,7 @@ export default class DynamicTileSource implements TileHierarchy<FeatureSourceFor
this.loadedTiles = new Map<number, FeatureSourceForLayer & Tiled>()
const neededTiles = state.locationControl.map(
location => {
if (!layer.isDisplayed.data) {
if (!layer.isDisplayed.data && !layer.layerDef.forceLoad) {
// No need to download! - the layer is disabled
return undefined;
}