Merge develop

This commit is contained in:
Pieter Vander Vennet 2022-01-05 18:18:13 +01:00
commit ac1b4a010c
40 changed files with 5706 additions and 4746 deletions

View file

@ -2,7 +2,7 @@ import {Utils} from "../Utils";
export default class Constants {
public static vNumber = "0.13.0-alpha-9";
public static vNumber = "0.14.0-alpha-1";
public static ImgurApiKey = '7070e7167f0a25a'
public static readonly mapillary_client_token_v4 = "MLY|4441509239301885|b40ad2d3ea105435bd40c7e76993ae85"

View file

@ -73,7 +73,13 @@ export default class LayerConfig extends WithContextLoader {
if (json.source.osmTags === undefined) {
throw "Layer " + this.id + " does not define a osmTags in the source section - these should always be present, even for geojson layers (" + context + ")"
}
if(json.id.toLowerCase() !== json.id){
throw `${context}: The id of a layer should be lowercase: ${json.id}`
}
if(json.id.match(/[a-z0-9-_]/) == null){
throw `${context}: The id of a layer should match [a-z0-9-_]*: ${json.id}`
}
this.maxAgeOfCache = json.source.maxCacheAge ?? 24 * 60 * 60 * 30

View file

@ -50,17 +50,21 @@ export default class LayoutConfig {
public readonly overpassMaxZoom: number
public readonly osmApiTileSize: number
public readonly official: boolean;
public readonly trackAllNodes: boolean;
constructor(json: LayoutConfigJson, official = true, context?: string) {
this.official = official;
this.id = json.id;
if(json.id.toLowerCase() !== json.id){
throw "The id of a theme should be lowercase: "+json.id
}
if(json.id.match(/[a-z0-9-_]/) == null){
throw "The id of a theme should match [a-z0-9-_]*: "+json.id
}
context = (context ?? "") + "." + this.id;
this.maintainer = json.maintainer;
this.credits = json.credits;
this.version = json.version;
this.language = [];
this.trackAllNodes = false
if (typeof json.language === "string") {
this.language = [json.language];
@ -105,7 +109,6 @@ export default class LayoutConfig {
this.tileLayerSources = (json.tileLayerSources ?? []).map((config, i) => new TilesourceConfig(config, `${this.id}.tileLayerSources[${i}]`))
// At this point, layers should be expanded and validated either by the generateScript or the LegacyJsonConvert
this.layers = json.layers.map(lyrJson => new LayerConfig(<LayerConfigJson>lyrJson, json.id + ".layers." + lyrJson["id"], official));
this.trackAllNodes = this.layers.some(layer => layer.id === "type_node");
this.clustering = {