forked from MapComplete/MapComplete
Porting repair_station to JSON configuration file
This commit is contained in:
parent
b7b1bc13e4
commit
9e9d80c045
18 changed files with 455 additions and 503 deletions
|
@ -15,6 +15,7 @@ import * as drinkingWater from "../../assets/layers/drinking_water/drinking_wate
|
|||
import * as ghostbikes from "../../assets/layers/ghost_bike/ghost_bike.json"
|
||||
import * as viewpoint from "../../assets/layers/viewpoint/viewpoint.json"
|
||||
import * as bike_parking from "../../assets/layers/bike_parking/bike_parking.json"
|
||||
import * as bike_repair_station from "../../assets/layers/bike_repair_station/bike_repair_station.json"
|
||||
import * as birdhides from "../../assets/layers/bird_hide/birdhides.json"
|
||||
|
||||
import {Utils} from "../../Utils";
|
||||
|
@ -31,6 +32,7 @@ export class FromJSON {
|
|||
FromJSON.Layer(ghostbikes),
|
||||
FromJSON.Layer(viewpoint),
|
||||
FromJSON.Layer(bike_parking),
|
||||
FromJSON.Layer(bike_repair_station),
|
||||
FromJSON.Layer(birdhides),
|
||||
];
|
||||
|
||||
|
|
|
@ -1,117 +0,0 @@
|
|||
import {LayerDefinition} from "../LayerDefinition";
|
||||
import {And, Or, Tag} from "../../Logic/Tags";
|
||||
import BikeStationChain from "../Questions/bike/StationChain";
|
||||
import BikeStationPumpTools from "../Questions/bike/StationPumpTools";
|
||||
import BikeStationStand from "../Questions/bike/StationStand";
|
||||
import PumpManual from "../Questions/bike/PumpManual";
|
||||
import PumpManometer from "../Questions/bike/PumpManometer";
|
||||
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
|
||||
import PumpOperational from "../Questions/bike/PumpOperational";
|
||||
import PumpValves from "../Questions/bike/PumpValves";
|
||||
import Translations from "../../UI/i18n/Translations";
|
||||
import {TagRenderingOptions} from "../TagRenderingOptions";
|
||||
|
||||
|
||||
export default class BikeStations extends LayerDefinition {
|
||||
private readonly repairStation = new Tag("amenity", "bicycle_repair_station");
|
||||
private readonly pump = new Tag("service:bicycle:pump", "yes");
|
||||
private readonly nopump = new Tag("service:bicycle:pump", "no");
|
||||
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 notools = new Tag("service:bicycle:tools", "no");
|
||||
|
||||
private readonly to = Translations.t.cyclofix.station
|
||||
|
||||
constructor() {
|
||||
super("bikestation");
|
||||
this.name = Translations.t.cyclofix.station.name;
|
||||
this.icon = "./assets/bike/repair_station_pump.svg";
|
||||
|
||||
const tr = Translations.t.cyclofix.station
|
||||
this.overpassFilter = this.repairStation;
|
||||
this.presets = [
|
||||
{
|
||||
title: tr.titlePump,
|
||||
description: tr.services.pump,
|
||||
tags: [this.repairStation, this.pump, this.notools]
|
||||
},
|
||||
{
|
||||
title: tr.titleRepair,
|
||||
description: tr.services.tools,
|
||||
tags: [this.repairStation, this.tools, this.nopump]
|
||||
},
|
||||
{
|
||||
title: tr.titlePumpAndRepair,
|
||||
description: tr.services.both,
|
||||
tags: [this.repairStation, this.tools, this.pump]
|
||||
},
|
||||
|
||||
]
|
||||
|
||||
this.maxAllowedOverlapPercentage = 10;
|
||||
|
||||
this.minzoom = 13;
|
||||
this.style = this.generateStyleFunction();
|
||||
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 = [
|
||||
new ImageCarouselWithUploadConstructor(),
|
||||
|
||||
new BikeStationPumpTools(),
|
||||
new BikeStationChain().OnlyShowIf(this.tools),
|
||||
new BikeStationStand().OnlyShowIf(this.tools),
|
||||
|
||||
new PumpManual().OnlyShowIf(this.pump),
|
||||
new PumpManometer().OnlyShowIf(this.pump),
|
||||
new PumpValves().OnlyShowIf(this.pump),
|
||||
new PumpOperational().OnlyShowIf(this.pump),
|
||||
|
||||
// new BikeStationOperator(),
|
||||
// new BikeStationBrand() DISABLED
|
||||
];
|
||||
}
|
||||
|
||||
private generateStyleFunction() {
|
||||
const self = this;
|
||||
return function (properties: any) {
|
||||
const hasPump = self.pump.matchesProperties(properties)
|
||||
const isOperational = self.pumpOperationalOk.matchesProperties(properties)
|
||||
const hasTools = self.tools.matchesProperties(properties)
|
||||
let iconName = "repair_station.svg";
|
||||
if (hasTools && hasPump && isOperational) {
|
||||
iconName = "repair_station_pump.svg"
|
||||
} else if(hasTools) {
|
||||
iconName = "repair_station.svg"
|
||||
} else if(hasPump) {
|
||||
if (isOperational) {
|
||||
iconName = "pump.svg"
|
||||
} else {
|
||||
iconName = "broken_pump_2.svg"
|
||||
}
|
||||
}
|
||||
|
||||
const iconUrl = `./assets/bike/${iconName}`
|
||||
return {
|
||||
color: "#00bb00",
|
||||
icon: {
|
||||
iconUrl: iconUrl,
|
||||
iconSize: [50, 50],
|
||||
iconAnchor: [25, 50]
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
import {Layout} from "../Layout";
|
||||
import BikeServices from "../Layers/BikeStations";
|
||||
import BikeShops from "../Layers/BikeShops";
|
||||
import Translations from "../../UI/i18n/Translations";
|
||||
import Combine from "../../UI/Base/Combine";
|
||||
|
@ -13,7 +12,9 @@ export default class Cyclofix extends Layout {
|
|||
"cyclofix",
|
||||
["en", "nl", "fr","gl"],
|
||||
Translations.t.cyclofix.title,
|
||||
[new BikeServices(), new BikeShops(), "drinking_water", "bike_parking", new BikeOtherShops(), new BikeCafes()],
|
||||
["bike_repair_station", new BikeShops(), "drinking_water", "bike_parking", new BikeOtherShops(), new BikeCafes(),
|
||||
// The first of november, we remember our dead
|
||||
...(new Date().getMonth() + 1 == 11 && new Date().getDay() + 1 == 1 ? ["ghost_bike"] : [])],
|
||||
16,
|
||||
50.8465573,
|
||||
4.3516970,
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
import {Tag} from "../../../Logic/Tags";
|
||||
import Translations from "../../../UI/i18n/Translations";
|
||||
import {TagRenderingOptions} from "../../TagRenderingOptions";
|
||||
|
||||
|
||||
export default class PumpManometer extends TagRenderingOptions {
|
||||
constructor() {
|
||||
const to = Translations.t.cyclofix.station.manometer
|
||||
super({
|
||||
question: to.question,
|
||||
mappings: [
|
||||
{k: new Tag("manometer", "yes"), txt: to.yes},
|
||||
{k: new Tag("manometer", "no"), txt: to.no},
|
||||
{k: new Tag("manometer", "broken"), txt: to.broken}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
import {Tag} from "../../../Logic/Tags";
|
||||
import Translations from "../../../UI/i18n/Translations";
|
||||
import {TagRenderingOptions} from "../../TagRenderingOptions";
|
||||
|
||||
|
||||
export default class PumpManual extends TagRenderingOptions {
|
||||
constructor() {
|
||||
const to = Translations.t.cyclofix.station.electric
|
||||
super({
|
||||
priority: 5,
|
||||
question: to.question,
|
||||
mappings: [
|
||||
{k: new Tag("manual", "yes"), txt: to.manual},
|
||||
{k: new Tag("manual", "no"), txt: to.electric}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
import {Tag} from "../../../Logic/Tags";
|
||||
import Translations from "../../../UI/i18n/Translations";
|
||||
import {TagRenderingOptions} from "../../TagRenderingOptions";
|
||||
|
||||
|
||||
export default class PumpOperational extends TagRenderingOptions {
|
||||
constructor() {
|
||||
const to = Translations.t.cyclofix.station.operational
|
||||
super({
|
||||
question: to.question,
|
||||
mappings: [
|
||||
{k: new Tag("service:bicycle:pump:operational_status","broken"), txt: to.broken},
|
||||
{k: new Tag("service:bicycle:pump:operational_status",""), txt: to.operational}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
import {Tag} from "../../../Logic/Tags";
|
||||
import Translations from "../../../UI/i18n/Translations";
|
||||
import {TagRenderingOptions} from "../../TagRenderingOptions";
|
||||
|
||||
|
||||
export default class
|
||||
PumpValves extends TagRenderingOptions{
|
||||
constructor() {
|
||||
const to = Translations.t.cyclofix.station.valves
|
||||
super({
|
||||
question: to.question,
|
||||
mappings: [
|
||||
{
|
||||
k: new Tag("valves", "sclaverand;schrader;dunlop"),
|
||||
txt: to.default
|
||||
},
|
||||
{k: new Tag("valves", "dunlop"), txt: to.dunlop},
|
||||
{k: new Tag("valves", "sclaverand"), txt: to.sclaverand},
|
||||
{k: new Tag("valves", "auto"), txt: to.auto},
|
||||
],
|
||||
freeform: {
|
||||
extraTags: new Tag("fixme", "Freeform valves= tag used: possibly a wrong value"),
|
||||
key: "valves",
|
||||
template: to.template,
|
||||
renderTemplate: to.render
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
import {Tag} from "../../../Logic/Tags";
|
||||
import Translations from "../../../UI/i18n/Translations";
|
||||
import {TagRenderingOptions} from "../../TagRenderingOptions";
|
||||
|
||||
|
||||
export default class StationChain extends TagRenderingOptions {
|
||||
constructor() {
|
||||
const to = Translations.t.cyclofix.station.chain
|
||||
super({
|
||||
priority: 5,
|
||||
question: to.question,
|
||||
mappings: [
|
||||
{k: new Tag("service:bicycle:chain_tool", "yes"), txt: to.yes},
|
||||
{k: new Tag("service:bicycle:chain_tool", "no"), txt: to.no},
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
import {Tag} from "../../../Logic/Tags";
|
||||
import Translations from "../../../UI/i18n/Translations";
|
||||
import {TagRenderingOptions} from "../../TagRenderingOptions";
|
||||
|
||||
|
||||
export default class BikeStationOperator extends TagRenderingOptions {
|
||||
constructor() {
|
||||
const to = Translations.t.cyclofix.station.operator
|
||||
super({
|
||||
priority: 15,
|
||||
question: to.question,
|
||||
mappings: [
|
||||
{k: new Tag("operator", "KU Leuven"), txt: "KU Leuven"},
|
||||
{k: new Tag("operator", "Stad Halle"), txt: "Stad Halle"},
|
||||
{k: new Tag("operator", "Saint Gilles - Sint Gillis"), txt: "Saint Gilles - Sint Gillis"},
|
||||
{k: new Tag("operator", "Jette"), txt: "Jette"},
|
||||
{k: new Tag("operator", "private"), txt: to.private}
|
||||
],
|
||||
freeform: {
|
||||
key: "operator",
|
||||
template: to.template,
|
||||
renderTemplate: to.render,
|
||||
placeholder: "organisatie"
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
import {Tag, And} from "../../../Logic/Tags";
|
||||
import Translations from "../../../UI/i18n/Translations";
|
||||
import {TagRenderingOptions} from "../../TagRenderingOptions";
|
||||
|
||||
|
||||
export default class BikeStationPumpTools extends TagRenderingOptions {
|
||||
constructor() {
|
||||
const to = Translations.t.cyclofix.station.services
|
||||
super({
|
||||
priority: 15,
|
||||
question: to.question,
|
||||
mappings: [
|
||||
{k: new And([new Tag("service:bicycle:tools", "no"), new Tag("service:bicycle:pump", "yes")]), txt: to.pump},
|
||||
{k: new And([new Tag("service:bicycle:tools", "yes"), new Tag("service:bicycle:pump", "no")]), txt: to.tools},
|
||||
{k: new And([new Tag("service:bicycle:tools", "yes"), new Tag("service:bicycle:pump", "yes")]), txt: to.both}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
import {Tag} from "../../../Logic/Tags";
|
||||
import Translations from "../../../UI/i18n/Translations";
|
||||
import {TagRenderingOptions} from "../../TagRenderingOptions";
|
||||
|
||||
|
||||
export default class BikeStationStand extends TagRenderingOptions {
|
||||
constructor() {
|
||||
const to = Translations.t.cyclofix.station.stand;
|
||||
super({
|
||||
priority: 10,
|
||||
question: to.question,
|
||||
mappings: [
|
||||
{k: new Tag("service:bicycle:stand", "yes"), txt: to.yes},
|
||||
{k: new Tag("service:bicycle:stand", "no"), txt: to.no},
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue