Add bike cafes
This commit is contained in:
parent
e4df5ffcb4
commit
581ec9d2a7
11 changed files with 292 additions and 90 deletions
|
@ -0,0 +1,73 @@
|
|||
import {LayerDefinition} from "../LayerDefinition";
|
||||
import FixedText from "../Questions/FixedText";
|
||||
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
|
||||
import Translations from "../../UI/i18n/Translations";
|
||||
import CafeName from "../Questions/bike/CafeName";
|
||||
import { Or, And, Tag, anyValueExcept, Regex } from "../../Logic/TagsFilter";
|
||||
import { PhoneNumberQuestion } from "../Questions/PhoneNumberQuestion";
|
||||
import Website from "../Questions/Website";
|
||||
import CafeRepair from "../Questions/bike/CafeRepair";
|
||||
import CafeDiy from "../Questions/bike/CafeDiy";
|
||||
import CafePump from "../Questions/bike/CafePump";
|
||||
|
||||
|
||||
export default class BikeCafes extends LayerDefinition {
|
||||
private readonly repairsBikes = anyValueExcept("service:bicycle:repair", "no")
|
||||
private readonly hasPump = new Tag("service:bicycle:pump", "yes")
|
||||
private readonly diy = new Tag("service:bicycle:diy", "yes")
|
||||
private readonly bikeServices = [
|
||||
this.diy,
|
||||
this.repairsBikes,
|
||||
this.hasPump
|
||||
]
|
||||
private readonly to = Translations.t.cyclofix.cafe
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.name = this.to.name;
|
||||
this.icon = "./assets/bike/cafe.svg";
|
||||
this.overpassFilter = new And([
|
||||
new Or([
|
||||
new Regex("amenity", "^pub|bar|cafe")
|
||||
]),
|
||||
new Or([
|
||||
...this.bikeServices,
|
||||
new Tag("pub", "cycling")
|
||||
])
|
||||
])
|
||||
this.newElementTags = [
|
||||
new Tag("amenity", "pub"),
|
||||
new Tag("pub", "cycling"),
|
||||
];
|
||||
this.maxAllowedOverlapPercentage = 10;
|
||||
|
||||
this.minzoom = 13;
|
||||
this.style = this.generateStyleFunction();
|
||||
this.title = new FixedText(this.to.title)
|
||||
this.elementsToShow = [
|
||||
new ImageCarouselWithUploadConstructor(),
|
||||
new CafeName(),
|
||||
new PhoneNumberQuestion("{name}"),
|
||||
new Website("{name}"),
|
||||
new CafeRepair(),
|
||||
new CafeDiy(),
|
||||
new CafePump()
|
||||
];
|
||||
this.wayHandling = LayerDefinition.WAYHANDLING_CENTER_AND_WAY;
|
||||
|
||||
}
|
||||
|
||||
private generateStyleFunction() {
|
||||
const self = this;
|
||||
return function (properties: any) {
|
||||
return {
|
||||
color: "#00bb00",
|
||||
icon: {
|
||||
iconUrl: self.icon,
|
||||
iconSize: [50, 50],
|
||||
iconAnchor: [25,50]
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
import { LayerDefinition } from "../LayerDefinition";
|
||||
import Translations from "../../UI/i18n/Translations";
|
||||
import {And, Tag, Or} from "../../Logic/TagsFilter";
|
||||
import {And, Tag, Or, anyValueExcept} from "../../Logic/TagsFilter";
|
||||
import { ImageCarouselWithUploadConstructor } from "../../UI/Image/ImageCarouselWithUpload";
|
||||
import ShopRetail from "../Questions/bike/ShopRetail";
|
||||
import ShopPump from "../Questions/bike/ShopPump";
|
||||
|
@ -14,13 +14,6 @@ import { PhoneNumberQuestion } from "../Questions/PhoneNumberQuestion";
|
|||
import Website from "../Questions/Website";
|
||||
|
||||
|
||||
function anyValueExcept(key: string, exceptValue: string) {
|
||||
return new And([
|
||||
new Tag(key, "*"),
|
||||
new Tag(key, exceptValue, true)
|
||||
])
|
||||
}
|
||||
|
||||
export default class BikeOtherShops extends LayerDefinition {
|
||||
private readonly sellsBikes = new Tag("service:bicycle:retail", "yes")
|
||||
private readonly repairsBikes = anyValueExcept("service:bicycle:repair", "no")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue