Merge branch 'master' into develop

This commit is contained in:
Pieter Vander Vennet 2024-03-04 15:36:34 +01:00
commit 5215662a0c
67 changed files with 1571 additions and 1276 deletions

View file

@ -92,7 +92,6 @@ export default class CreateNoteImportLayer extends Conversion<LayerConfigJson, L
this._includeClosedNotesDays +
"&bbox={x_min},{y_min},{x_max},{y_max}",
geoJsonZoomLevel: 10,
maxCacheAge: 0,
},
/* We need to set 'pass_all_features'
There are probably many note_import-layers, and we don't want the first one to gobble up all notes and then discard them...

View file

@ -135,6 +135,10 @@ export class UpdateLegacyLayer extends DesugaringStep<
delete config["rotation"]
delete config["wayHandling"]
delete config["hideUnderlayingFeaturesMinPercentage"]
const src = config.source
delete src["isOsmCache"]
delete src["maxCacheAge"]
delete src["widenFactor"]
for (const mapRenderingElement of config["mapRendering"] ?? []) {
if (mapRenderingElement["iconOverlays"] !== undefined) {

View file

@ -1622,6 +1622,18 @@ export class ValidateLayer extends Conversion<
context.enters("doCount").err("Use `isCounted` instead of `doCount`")
}
if (json.source) {
const src = json.source
if (src["isOsmCache"] !== undefined) {
context.enters("source").err("isOsmCache is deprecated")
}
if (src["maxCacheAge"] !== undefined) {
context
.enters("source")
.err("maxCacheAge is deprecated; it is " + src["maxCacheAge"])
}
}
return { raw: json, parsed: layerConfig }
}
}

View file

@ -74,15 +74,6 @@ export interface LayerConfigJson {
* Every source must set which tags have to be present in order to load the given layer.
*/
osmTags: TagConfigJson
/**
* question: How long (in seconds) is the data allowed to remain cached until it must be refreshed?
* The maximum amount of seconds that a tile is allowed to linger in the cache
*
* type: nat
* default: 30 days
* group: expert
*/
maxCacheAge?: number
}
| {
/**
@ -109,17 +100,6 @@ export interface LayerConfigJson {
* ifunset: This is not a tiled geojson
*/
geoJsonZoomLevel?: number
/**
* Indicates that the upstream geojson data is OSM-derived.
* Useful for e.g. merging or for scripts generating this cache.
* This also indicates that making changes on this data is possible
*
* question: Is this geojson a cache of OpenStreetMap data?
* ifunset: This is not an OpenStreetMap cache
* iftrue: this is based on OpenStreetMap and can thus be edited
* group: expert
*/
isOsmCache?: boolean
/**
* Some API's use a mercator-projection (EPSG:900913) instead of WGS84. Set the flag `mercatorCrs: true` in the source for this
*

View file

@ -417,14 +417,6 @@ export interface LayoutConfigJson {
*/
overpassTimeout?: number
/**
* When a query is run, the data within bounds of the visible map is loaded.
* However, users tend to pan and zoom a lot. It is pretty annoying if every single pan means a reloading of the data.
* For this, the bounds are widened in order to make a small pan still within bounds of the loaded data.
*
* IF widenfactor is 1, this feature is disabled. A recommended value is between 1 and 3
*/
widenFactor?: number
/**
* At low zoom levels, overpass is used to query features.
* At high zoom level, the OSM api is used to fetch one or more BBOX aligning with a slippy tile.

View file

@ -146,6 +146,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
* Triggered by navigating the map with arrows or by pressing 'space' or 'enter'
*/
public readonly visualFeedback: UIEventSource<boolean> = new UIEventSource<boolean>(false)
public readonly toCacheSavers: ReadonlyMap<string, SaveFeatureSourceToLocalStorage>
constructor(layout: LayoutConfig, mvtAvailableLayers: Set<string>) {
Utils.initDomPurify()
@ -295,16 +296,6 @@ export default class ThemeViewState implements SpecialVisualizationState {
)
this.perLayer = perLayer.perLayer
}
this.perLayer.forEach((fs) => {
new SaveFeatureSourceToLocalStorage(
this.osmConnection.Backend(),
fs.layer.layerDef.id,
15,
fs,
this.featureProperties,
fs.layer.layerDef.maxAgeOfCache
)
})
this.floors = this.featuresInView.features.stabilized(500).map((features) => {
if (!features) {
@ -366,6 +357,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
this.favourites = new FavouritesFeatureSource(this)
this.featureSummary = this.setupSummaryLayer()
this.toCacheSavers = this.initSaveToLocalStorage()
this.initActors()
this.drawSpecialLayers()
this.initHotkeys()
@ -391,6 +383,25 @@ export default class ThemeViewState implements SpecialVisualizationState {
})
}
public initSaveToLocalStorage() {
const toLocalStorage = new Map<string, SaveFeatureSourceToLocalStorage>()
this.perLayer.forEach((fs, layerId) => {
if (fs.layer.layerDef.source.geojsonSource !== undefined) {
return // We don't cache external data layers
}
console.log("Setting up a local store feature sink for", layerId)
const storage = new SaveFeatureSourceToLocalStorage(
this.osmConnection.Backend(),
fs.layer.layerDef.id,
LayoutSource.fromCacheZoomLevel,
fs,
this.featureProperties,
fs.layer.layerDef.maxAgeOfCache
)
toLocalStorage.set(layerId, storage)
})
return toLocalStorage
}
public showNormalDataOn(map: Store<MlMap>): ReadonlyMap<string, FilteringFeatureSource> {
const filteringFeatureSource = new Map<string, FilteringFeatureSource>()
this.perLayer.forEach((fs, layerName) => {