Added cyclofix capacity cargo; covered; non-bike shop; pump dyn title
This commit is contained in:
parent
a7bb4a1fcc
commit
948ff74a8b
23 changed files with 624 additions and 91 deletions
0
Customizations/Layers/BikeCafes.ts
Normal file
0
Customizations/Layers/BikeCafes.ts
Normal file
114
Customizations/Layers/BikeOtherShops.ts
Normal file
114
Customizations/Layers/BikeOtherShops.ts
Normal file
|
@ -0,0 +1,114 @@
|
|||
import { LayerDefinition } from "../LayerDefinition";
|
||||
import Translations from "../../UI/i18n/Translations";
|
||||
import {And, Tag, Or} from "../../Logic/TagsFilter";
|
||||
import { ImageCarouselWithUploadConstructor } from "../../UI/Image/ImageCarouselWithUpload";
|
||||
import ShopRetail from "../Questions/bike/ShopRetail";
|
||||
import ShopPump from "../Questions/bike/ShopPump";
|
||||
import ShopRental from "../Questions/bike/ShopRental";
|
||||
import ShopRepair from "../Questions/bike/ShopRepair";
|
||||
import ShopDiy from "../Questions/bike/ShopDiy";
|
||||
import ShopName from "../Questions/bike/ShopName";
|
||||
import ShopSecondHand from "../Questions/bike/ShopSecondHand";
|
||||
import { TagRenderingOptions } from "../TagRendering";
|
||||
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")
|
||||
private readonly rentsBikes = new Tag("service:bicycle:rental", "yes")
|
||||
private readonly hasPump = new Tag("service:bicycle:pump", "yes")
|
||||
private readonly hasDiy = new Tag("service:bicycle:diy", "yes")
|
||||
private readonly sellsSecondHand = anyValueExcept("service:bicycle:repair", "no")
|
||||
private readonly hasBikeServices = new Or([
|
||||
this.sellsBikes,
|
||||
this.repairsBikes,
|
||||
// this.rentsBikes,
|
||||
// this.hasPump,
|
||||
// this.hasDiy,
|
||||
// this.sellsSecondHand
|
||||
])
|
||||
|
||||
private readonly to = Translations.t.cyclofix.nonBikeShop
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.name = this.to.name
|
||||
this.icon = "./assets/bike/non_bike_repair_shop.svg"
|
||||
this.overpassFilter = new And([
|
||||
anyValueExcept("shop", "bicycle"),
|
||||
this.hasBikeServices
|
||||
])
|
||||
this.newElementTags = undefined
|
||||
this.maxAllowedOverlapPercentage = 10
|
||||
this.wayHandling = LayerDefinition.WAYHANDLING_CENTER_AND_WAY
|
||||
|
||||
this.minzoom = 13;
|
||||
this.style = this.generateStyleFunction();
|
||||
this.title = new TagRenderingOptions({
|
||||
mappings: [
|
||||
{
|
||||
k: new And([new Tag("name", "*"), this.sellsBikes]),
|
||||
txt: this.to.titleShopNamed
|
||||
},
|
||||
{
|
||||
k: new And([new Tag("name", "*"), new Tag("service:bicycle:retail", "")]),
|
||||
txt: this.to.titleShop
|
||||
},
|
||||
{
|
||||
k: new And([new Tag("name", "*"), new Tag("service:bicycle:retail", "no")]),
|
||||
txt: this.to.titleRepairNamed
|
||||
},
|
||||
{k: this.sellsBikes, txt: this.to.titleShop},
|
||||
{k: new Tag("service:bicycle:retail", " "), txt: this.to.title},
|
||||
{k: new Tag("service:bicycle:retail", "no"), txt: this.to.titleRepair},
|
||||
{
|
||||
k: new And([new Tag("name", "*")]),
|
||||
txt: this.to.titleNamed
|
||||
},
|
||||
{k: null, txt: this.to.title},
|
||||
]
|
||||
})
|
||||
|
||||
this.elementsToShow = [
|
||||
new ImageCarouselWithUploadConstructor(),
|
||||
new ShopName(),
|
||||
new PhoneNumberQuestion("{name}"),
|
||||
new Website("{name}"),
|
||||
new ShopRetail(),
|
||||
new ShopRental(),
|
||||
new ShopRepair(),
|
||||
new ShopPump(),
|
||||
new ShopDiy(),
|
||||
new ShopSecondHand()
|
||||
]
|
||||
}
|
||||
|
||||
private generateStyleFunction() {
|
||||
const self = this;
|
||||
return function (tags: any) {
|
||||
let icon = "assets/bike/non_bike_repair_shop.svg";
|
||||
|
||||
if (self.sellsBikes.matchesProperties(tags)) {
|
||||
icon = "assets/bike/non_bike_shop.svg";
|
||||
}
|
||||
|
||||
return {
|
||||
color: "#00bb00",
|
||||
icon: {
|
||||
iconUrl: icon,
|
||||
iconSize: [50, 50],
|
||||
iconAnchor: [25, 50]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +1,19 @@
|
|||
import {LayerDefinition} from "../LayerDefinition";
|
||||
import {And, Or, Tag} from "../../Logic/TagsFilter";
|
||||
import {And, Or, Tag, TagsFilter} from "../../Logic/TagsFilter";
|
||||
import {OperatorTag} from "../Questions/OperatorTag";
|
||||
import FixedText from "../Questions/FixedText";
|
||||
import ParkingType from "../Questions/bike/ParkingType";
|
||||
import ParkingCapacity from "../Questions/bike/ParkingCapacity";
|
||||
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
|
||||
import BikeStationOperator from "../Questions/bike/StationOperator";
|
||||
import Translations from "../../UI/i18n/Translations";
|
||||
import ParkingOperator from "../Questions/bike/ParkingOperator";
|
||||
import {TagRenderingOptions} from "../TagRendering";
|
||||
import ParkingAccessCargo from "../Questions/bike/ParkingAccessCargo";
|
||||
import ParkingCapacityCargo from "../Questions/bike/ParkingCapacityCargo";
|
||||
|
||||
|
||||
export default class BikeParkings extends LayerDefinition {
|
||||
private readonly accessCargoDesignated = new Tag("cargo_bike", "designated");
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.name = Translations.t.cyclofix.parking.name;
|
||||
|
@ -28,14 +31,9 @@ export default class BikeParkings extends LayerDefinition {
|
|||
new ImageCarouselWithUploadConstructor(),
|
||||
//new ParkingOperator(),
|
||||
new ParkingType(),
|
||||
new TagRenderingOptions({
|
||||
question: "How many bicycles fit in this bicycle parking?",
|
||||
freeform: {
|
||||
key: "capacity",
|
||||
renderTemplate: "Place for {capacity} bikes",
|
||||
template: "$nat$ bikes fit in here"
|
||||
}
|
||||
})
|
||||
new ParkingCapacity(),
|
||||
new ParkingAccessCargo(),
|
||||
new ParkingCapacityCargo().OnlyShowIf(this.accessCargoDesignated)
|
||||
];
|
||||
this.wayHandling = LayerDefinition.WAYHANDLING_CENTER_AND_WAY;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { LayerDefinition } from "../LayerDefinition";
|
||||
import Translations from "../../UI/i18n/Translations";
|
||||
import {And, Tag} from "../../Logic/TagsFilter";
|
||||
import {And, Tag, Or} from "../../Logic/TagsFilter";
|
||||
import FixedText from "../Questions/FixedText";
|
||||
import { ImageCarouselWithUploadConstructor } from "../../UI/Image/ImageCarouselWithUpload";
|
||||
import ShopRetail from "../Questions/bike/ShopRetail";
|
||||
|
@ -12,6 +12,7 @@ import ShopName from "../Questions/bike/ShopName";
|
|||
import ShopSecondHand from "../Questions/bike/ShopSecondHand";
|
||||
import { TagRenderingOptions } from "../TagRendering";
|
||||
import {PhoneNumberQuestion} from "../Questions/PhoneNumberQuestion";
|
||||
import Website from "../Questions/Website";
|
||||
|
||||
|
||||
export default class BikeShops extends LayerDefinition {
|
||||
|
@ -52,6 +53,7 @@ export default class BikeShops extends LayerDefinition {
|
|||
new ImageCarouselWithUploadConstructor(),
|
||||
new ShopName(),
|
||||
new PhoneNumberQuestion("{name}"),
|
||||
new Website("{name}"),
|
||||
new ShopRetail(),
|
||||
new ShopRental(),
|
||||
new ShopRepair(),
|
||||
|
|
|
@ -12,6 +12,7 @@ import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWi
|
|||
import PumpOperational from "../Questions/bike/PumpOperational";
|
||||
import PumpValves from "../Questions/bike/PumpValves";
|
||||
import Translations from "../../UI/i18n/Translations";
|
||||
import { TagRenderingOptions } from "../TagRendering";
|
||||
|
||||
|
||||
export default class BikeStations extends LayerDefinition {
|
||||
|
@ -19,6 +20,7 @@ export default class BikeStations extends LayerDefinition {
|
|||
private readonly pumpOperationalAny = new Tag("service:bicycle:pump:operational_status", "yes");
|
||||
private readonly pumpOperationalOk = new Or([new Tag("service:bicycle:pump:operational_status", "yes"), new Tag("service:bicycle:pump:operational_status", "operational"), new Tag("service:bicycle:pump:operational_status", "ok"), new Tag("service:bicycle:pump:operational_status", "")]);
|
||||
private readonly tools = new Tag("service:bicycle:tools", "yes");
|
||||
private readonly to = Translations.t.cyclofix.station
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -36,7 +38,19 @@ export default class BikeStations extends LayerDefinition {
|
|||
|
||||
this.minzoom = 13;
|
||||
this.style = this.generateStyleFunction();
|
||||
this.title = new FixedText(Translations.t.cyclofix.station.title)
|
||||
this.title = new TagRenderingOptions({
|
||||
mappings: [
|
||||
{
|
||||
k: new And([this.pump, this.tools]),
|
||||
txt: this.to.titlePumpAndRepair
|
||||
},
|
||||
{
|
||||
k: new And([this.pump]),
|
||||
txt: this.to.titlePump
|
||||
},
|
||||
{k: null, txt: this.to.titleRepair},
|
||||
]
|
||||
})
|
||||
this.wayHandling = LayerDefinition.WAYHANDLING_CENTER_AND_WAY
|
||||
|
||||
this.elementsToShow = [
|
||||
|
@ -65,9 +79,9 @@ export default class BikeStations extends LayerDefinition {
|
|||
let iconName = "repair_station.svg";
|
||||
if (hasTools && hasPump && isOperational) {
|
||||
iconName = "repair_station_pump.svg"
|
||||
}else if(hasTools){
|
||||
} else if(hasTools) {
|
||||
iconName = "repair_station.svg"
|
||||
}else if(hasPump){
|
||||
} else if(hasPump) {
|
||||
if (isOperational) {
|
||||
iconName = "pump.svg"
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue