forked from MapComplete/MapComplete
Themes(cafe_pub, toilets): add toilet information to pubs; forward wheelchair accessibility information to 'toilet_at_amenity'
This commit is contained in:
parent
7a0eed35e3
commit
455b2c641c
9 changed files with 75 additions and 118 deletions
|
@ -1,7 +1,6 @@
|
|||
import { LayerConfigJson } from "./Json/LayerConfigJson"
|
||||
|
||||
export interface LevelInfo {
|
||||
level: number,
|
||||
ids: string[],
|
||||
loop?: boolean
|
||||
}
|
||||
|
@ -54,14 +53,11 @@ export class LayerConfigDependencyGraph {
|
|||
public static buildLevels(dependsOn: Map<string, string[]>): LevelInfo[]{
|
||||
|
||||
const levels: LevelInfo[] = []
|
||||
let levelIndex = 0
|
||||
const seenIds = new Set<string>()
|
||||
while (Array.from(dependsOn.keys()).length > 0) {
|
||||
const currentLevel: LevelInfo = {
|
||||
ids: <string[]>[],
|
||||
level: levelIndex,
|
||||
}
|
||||
levelIndex++
|
||||
levels.push(currentLevel)
|
||||
for (const layerId of dependsOn.keys()) {
|
||||
const dependencies = dependsOn.get(layerId)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
export let selectedElement: Feature
|
||||
export let tags: UIEventSource<OsmTags>
|
||||
export let labels: string[]
|
||||
export let blacklist: string[]
|
||||
export let header: string
|
||||
export let layer: LayerConfig
|
||||
|
||||
|
@ -22,11 +23,15 @@
|
|||
}
|
||||
let tagRenderings: TagRenderingConfig[] = []
|
||||
let seenIds = new Set<string>()
|
||||
let blacklistSet = new Set(blacklist)
|
||||
for (const label of labels) {
|
||||
for (const tr of layer.tagRenderings) {
|
||||
if (seenIds.has(tr.id)) {
|
||||
continue
|
||||
}
|
||||
if (blacklistSet.has(tr.id) || tr.labels.some(l => blacklistSet.has(l))) {
|
||||
continue
|
||||
}
|
||||
if (label === tr.id || tr.labels.some((l) => l === label)) {
|
||||
tagRenderings.push(tr)
|
||||
seenIds.add(tr.id)
|
||||
|
|
|
@ -226,7 +226,9 @@
|
|||
</button>
|
||||
{/if}
|
||||
{#if $debug}
|
||||
Skipped questions are {Array.from($skippedQuestions).join(", ")}
|
||||
<span class="subtle">
|
||||
DBG:Skipped questions are {Array.from($skippedQuestions).join(", ")}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
</LoginToggle>
|
||||
|
|
|
@ -186,6 +186,11 @@ export default class TagrenderingManipulationSpecialVisualisations {
|
|||
name: "labels",
|
||||
doc: "A `;`-separated list of either identifiers or label names. All tagRenderings matching this value will be shown in the accordion",
|
||||
},
|
||||
{
|
||||
name: "blacklist",
|
||||
required: false,
|
||||
doc: "A `;`-separated list of either identifiers or label names. Matching tagrenderings will _not_ be included, even if they are in `labels`"
|
||||
}
|
||||
],
|
||||
constr(
|
||||
state: SpecialVisualizationState,
|
||||
|
@ -194,8 +199,9 @@ export default class TagrenderingManipulationSpecialVisualisations {
|
|||
selectedElement: Feature,
|
||||
layer: LayerConfig
|
||||
): SvelteUIElement {
|
||||
const [header, labelsStr] = argument
|
||||
const [header, labelsStr, blacklistStr] = argument
|
||||
const labels = labelsStr.split(";").map((x) => x.trim())
|
||||
const blacklist = blacklistStr?.split(";")?.map(x => x.trim()) ?? []
|
||||
return new SvelteUIElement(GroupedView, {
|
||||
state,
|
||||
tags,
|
||||
|
@ -203,6 +209,7 @@ export default class TagrenderingManipulationSpecialVisualisations {
|
|||
layer,
|
||||
header,
|
||||
labels,
|
||||
blacklist
|
||||
})
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue