Improve tag optimazations, fixes rendering of climbing map

This commit is contained in:
Pieter Vander Vennet 2022-04-14 00:53:38 +02:00
parent 01ba686270
commit 01567a4b80
16 changed files with 875 additions and 303 deletions

View file

@ -127,6 +127,7 @@ export default class LayerConfig extends WithContextLoader {
idKey: json.source["idKey"]
},
Constants.priviliged_layers.indexOf(this.id) > 0,
json.id
);

View file

@ -1,5 +1,6 @@
import {TagsFilter} from "../../Logic/Tags/TagsFilter";
import {RegexTag} from "../../Logic/Tags/RegexTag";
import {param} from "jquery";
export default class SourceConfig {
@ -19,7 +20,7 @@ export default class SourceConfig {
isOsmCache?: boolean,
geojsonSourceLevel?: number,
idKey?: string
}, context?: string) {
}, isSpecialLayer: boolean, context?: string) {
let defined = 0;
if (params.osmTags) {
@ -43,6 +44,15 @@ export default class SourceConfig {
throw `Source defines a geojson-zoomLevel, but does not specify {x} nor {y} (or equivalent), this is probably a bug (in context ${context})`
}
}
if(params.osmTags !== undefined && !isSpecialLayer){
const optimized = params.osmTags.optimize()
if(optimized === false){
throw "Error at "+context+": the specified tags are conflicting with each other: they will never match anything at all"
}
if(optimized === true){
throw "Error at "+context+": the specified tags are very wide: they will always match everything"
}
}
this.osmTags = params.osmTags ?? new RegexTag("id", /.*/);
this.overpassScript = params.overpassScript;
this.geojsonSource = params.geojsonSource;