Refactoring: fix GPX-track view

This commit is contained in:
Pieter Vander Vennet 2023-04-20 18:58:31 +02:00
parent 4172af6a72
commit c6e12fdd6b
23 changed files with 217 additions and 347 deletions

View file

@ -891,7 +891,7 @@ export class ValidateLayer extends DesugaringStep<LayerConfigJson> {
throw "A special layer cannot have presets"
}
// Check that a preset will be picked up by the layer itself
const baseTags = TagUtils.Tag(json.source.osmTags)
const baseTags = TagUtils.Tag(json.source["osmTags"])
for (let i = 0; i < json.presets.length; i++) {
const preset = json.presets[i]
const tags: { k: string; v: string }[] = new And(

View file

@ -618,17 +618,26 @@ export default class LayerConfig extends WithContextLoader {
filterDocs.push(new Title("Filters", 4))
filterDocs.push(...this.filters.map((filter) => filter.GenerateDocs()))
}
const tagsDescription = []
if (this.source === null) {
tagsDescription.push(
new Title("Basic tags for this layer", 2),
"Elements must have the all of following tags to be shown on this layer:",
new List(neededTags.map((t) => t.asHumanString(true, false, {}))),
overpassLink
)
} else {
tagsDescription.push("This is a special layer - data is not sourced from OpenStreetMap")
}
return new Combine([
new Combine([new Title(this.id, 1), iconImg, this.description, "\n"]).SetClass(
"flex flex-col"
),
new List(extraProps),
...usingLayer,
new Title("Basic tags for this layer", 2),
"Elements must have the all of following tags to be shown on this layer:",
new List(neededTags.map((t) => t.asHumanString(true, false, {}))),
overpassLink,
...tagsDescription,
new Title("Supported attributes", 2),
quickOverview,
...this.tagRenderings.map((tr) => tr.GenerateDocumentation()),

View file

@ -291,6 +291,9 @@ export default class LayoutConfig implements LayoutInformation {
return undefined
}
for (const layer of this.layers) {
if (!layer.source) {
continue
}
if (layer.source.osmTags.matchesProperties(tags)) {
return layer
}