forked from MapComplete/MapComplete
Add tests for tags, add check for duplicate names as layer ids, fix #393
This commit is contained in:
parent
fa9313a3b7
commit
33e2dca7e4
7 changed files with 95 additions and 60 deletions
|
@ -8,7 +8,7 @@ export class Or extends TagsFilter {
|
|||
super();
|
||||
this.or = or;
|
||||
}
|
||||
|
||||
|
||||
matchesProperties(properties: any): boolean {
|
||||
for (const tagsFilter of this.or) {
|
||||
if (tagsFilter.matchesProperties(properties)) {
|
||||
|
@ -23,9 +23,7 @@ export class Or extends TagsFilter {
|
|||
const choices = [];
|
||||
for (const tagsFilter of this.or) {
|
||||
const subChoices = tagsFilter.asOverpass();
|
||||
for (const subChoice of subChoices) {
|
||||
choices.push(subChoice)
|
||||
}
|
||||
choices.push(...subChoices)
|
||||
}
|
||||
return choices;
|
||||
}
|
||||
|
|
|
@ -34,9 +34,9 @@ export class RegexTag extends TagsFilter {
|
|||
|
||||
asOverpass(): string[] {
|
||||
if (typeof this.key === "string") {
|
||||
return [`['${this.key}'${this.invert ? "!" : ""}~'${RegexTag.source(this.value)}']`];
|
||||
return [`["${this.key}"${this.invert ? "!" : ""}~"${RegexTag.source(this.value)}"]`];
|
||||
}
|
||||
return [`[~'${this.key.source}'${this.invert ? "!" : ""}~'${RegexTag.source(this.value)}']`];
|
||||
return [`[~"${this.key.source}"${this.invert ? "!" : ""}~"${RegexTag.source(this.value)}"]`];
|
||||
}
|
||||
|
||||
isUsableAsAnswer(): boolean {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue