forked from MapComplete/MapComplete
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 {
|
||||
|
|
|
@ -5,6 +5,7 @@ import BikeShops from "../Layers/BikeShops";
|
|||
import Translations from "../../UI/i18n/Translations";
|
||||
import {DrinkingWater} from "../Layers/DrinkingWater";
|
||||
import Combine from "../../UI/Base/Combine";
|
||||
import BikeOtherShops from "../Layers/BikeOtherShops";
|
||||
|
||||
|
||||
export default class Cyclofix extends Layout {
|
||||
|
@ -13,7 +14,7 @@ export default class Cyclofix extends Layout {
|
|||
"cyclofix",
|
||||
["en", "nl", "fr"],
|
||||
Translations.t.cyclofix.title,
|
||||
[new BikeServices(), new BikeShops(), new DrinkingWater(), new BikeParkings()],
|
||||
[new BikeServices(), new BikeShops(), new DrinkingWater(), new BikeParkings(), new BikeOtherShops()],
|
||||
16,
|
||||
50.8465573,
|
||||
4.3516970,
|
||||
|
|
17
Customizations/Questions/Website.ts
Normal file
17
Customizations/Questions/Website.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import {TagRenderingOptions} from "../TagRendering";
|
||||
import {UIElement} from "../../UI/UIElement";
|
||||
import Translations from "../../UI/i18n/Translations";
|
||||
|
||||
|
||||
export default class Website extends TagRenderingOptions {
|
||||
constructor(category: string | UIElement) {
|
||||
super({
|
||||
question: Translations.t.general.questions.websiteOf.Subs({category: category}),
|
||||
freeform: {
|
||||
renderTemplate: Translations.t.general.questions.websiteIs.Subs({category: category}),
|
||||
template: "$phone$",
|
||||
key: "phone"
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
20
Customizations/Questions/bike/ParkingAccessCargo.ts
Normal file
20
Customizations/Questions/bike/ParkingAccessCargo.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { TagRenderingOptions } from "../../TagRendering";
|
||||
import { Tag } from "../../../Logic/TagsFilter";
|
||||
import Translations from "../../../UI/i18n/Translations";
|
||||
|
||||
|
||||
export default class ParkingAccessCargo extends TagRenderingOptions {
|
||||
constructor() {
|
||||
const key = "cargo_bike"
|
||||
const to = Translations.t.cyclofix.parking.access_cargo
|
||||
super({
|
||||
priority: 15,
|
||||
question: to.question.Render(),
|
||||
mappings: [
|
||||
{k: new Tag(key, "yes"), txt: to.yes},
|
||||
{k: new Tag(key, "designated"), txt: to.designated},
|
||||
{k: new Tag(key, "no"), txt: to.no}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
18
Customizations/Questions/bike/ParkingCapacity.ts
Normal file
18
Customizations/Questions/bike/ParkingCapacity.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import Translations from "../../../UI/i18n/Translations";
|
||||
import { TagRenderingOptions } from "../../TagRendering";
|
||||
|
||||
|
||||
export default class ParkingCapacity extends TagRenderingOptions {
|
||||
constructor() {
|
||||
const to = Translations.t.cyclofix.parking.capacity
|
||||
super({
|
||||
priority: 15,
|
||||
question: to.question,
|
||||
freeform: {
|
||||
key: "capacity",
|
||||
renderTemplate: to.render,
|
||||
template: to.template
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
19
Customizations/Questions/bike/ParkingCapacityCargo.ts
Normal file
19
Customizations/Questions/bike/ParkingCapacityCargo.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import Translations from "../../../UI/i18n/Translations";
|
||||
import { TagRenderingOptions } from "../../TagRendering";
|
||||
import Combine from "../../../UI/Base/Combine";
|
||||
|
||||
|
||||
export default class ParkingCapacityCargo extends TagRenderingOptions {
|
||||
constructor() {
|
||||
const to = Translations.t.cyclofix.parking.capacity_cargo
|
||||
super({
|
||||
priority: 10,
|
||||
question: to.question,
|
||||
freeform: {
|
||||
key: "capacity:cargo_bike",
|
||||
renderTemplate: to.render,
|
||||
template: to.template
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
import { TagRenderingOptions } from "../../TagRendering";
|
||||
import { Tag } from "../../../Logic/TagsFilter";
|
||||
import Translations from "../../../UI/i18n/Translations";
|
||||
|
||||
|
||||
export default class ParkingCovered extends TagRenderingOptions {
|
||||
constructor() {
|
||||
const key = 'covered'
|
||||
const to = Translations.t.cyclofix.parking.covered
|
||||
super({
|
||||
priority: 15,
|
||||
question: to.question.Render(),
|
||||
mappings: [
|
||||
{k: new Tag(key, "yes"), txt: to.yes},
|
||||
{k: new Tag(key, "no"), txt: to.no}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue