Huge refactoring of state and initial UI setup

This commit is contained in:
Pieter Vander Vennet 2021-10-15 05:20:02 +02:00
parent 4e43673de5
commit eff6b5bfad
37 changed files with 5232 additions and 4907 deletions

View file

@ -1,6 +1,5 @@
import {TagRenderingConfigJson} from "./TagRenderingConfigJson";
import {LayerConfigJson} from "./LayerConfigJson";
import TilesourceConfig from "../TilesourceConfig";
import TilesourceConfigJson from "./TilesourceConfigJson";
/**
@ -16,7 +15,7 @@ import TilesourceConfigJson from "./TilesourceConfigJson";
* General remark: a type (string | any) indicates either a fixed or a translatable string.
*/
export interface LayoutConfigJson {
/**
* The id of this layout.
*
@ -106,7 +105,20 @@ export interface LayoutConfigJson {
* 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.
* The overpassMaxZoom controls the flipoverpoint: if the zoom is this or lower, overpass is used.
*/
overpassMaxZoom?: 17 | number
/**
* When the OSM-api is used to fetch features, it does so in a tiled fashion.
* These tiles are using a ceratin zoom level, that can be controlled here
* Default: overpassMaxZoom + 1
*/
osmApiTileSize: number
/**
* A tagrendering depicts how to show some tags or how to show a question for it.
*
@ -269,6 +281,7 @@ export interface LayoutConfigJson {
enableShowAllQuestions?: boolean;
enableDownload?: boolean;
enablePdfDownload?: boolean;
enableIframePopout?: true | boolean;
/**
* Set one or more overpass URLs to use for this theme..

View file

@ -46,6 +46,7 @@ export default class LayoutConfig {
public readonly enableShowAllQuestions: boolean;
public readonly enableExportButton: boolean;
public readonly enablePdfDownload: boolean;
public readonly enableIframePopout: boolean;
public readonly customCss?: string;
/*
@ -54,8 +55,10 @@ export default class LayoutConfig {
public readonly cacheTimeout?: number;
public readonly overpassUrl: string[];
public readonly overpassTimeout: number;
public readonly overpassMaxZoom: number
public readonly osmApiTileSize: number
public readonly official: boolean;
constructor(json: LayoutConfigJson, official = true, context?: string) {
this.official = official;
this.id = json.id;
@ -171,6 +174,7 @@ export default class LayoutConfig {
this.enableShowAllQuestions = json.enableShowAllQuestions ?? false;
this.enableExportButton = json.enableDownload ?? false;
this.enablePdfDownload = json.enablePdfDownload ?? false;
this.enableIframePopout = json.enableIframePopout ?? true
this.customCss = json.customCss;
this.cacheTimeout = json.cacheTimout ?? (60 * 24 * 60 * 60)
this.overpassUrl = Constants.defaultOverpassUrls
@ -182,6 +186,8 @@ export default class LayoutConfig {
}
}
this.overpassTimeout = json.overpassTimeout ?? 30
this.overpassMaxZoom = json.overpassMaxZoom ?? 17
this.osmApiTileSize = json.osmApiTileSize ?? this.overpassMaxZoom + 1
}