forked from MapComplete/MapComplete
Merge branch 'bike-pumps'
This commit is contained in:
commit
b24698513d
35 changed files with 850 additions and 282 deletions
|
@ -3,15 +3,15 @@ import {And, Or, Tag} from "../../Logic/TagsFilter";
|
|||
import {OperatorTag} from "../Questions/OperatorTag";
|
||||
import * as L from "leaflet";
|
||||
import FixedText from "../Questions/FixedText";
|
||||
import { BikeParkingType } from "../Questions/BikeParkingType";
|
||||
import ParkingType from "../Questions/bike/ParkingType";
|
||||
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
|
||||
|
||||
export class BikeParkings extends LayerDefinition {
|
||||
|
||||
export default class BikeParkings extends LayerDefinition {
|
||||
constructor() {
|
||||
super();
|
||||
this.name = "bike_parking";
|
||||
this.icon = "./assets/parking.svg";
|
||||
this.icon = "./assets/bike/parking.svg";
|
||||
this.overpassFilter = new Tag("amenity", "bicycle_parking");
|
||||
this.newElementTags = [
|
||||
new Tag("amenity", "bicycle_parking"),
|
||||
|
@ -24,43 +24,21 @@ export class BikeParkings extends LayerDefinition {
|
|||
this.elementsToShow = [
|
||||
new ImageCarouselWithUploadConstructor(),
|
||||
new OperatorTag(),
|
||||
new BikeParkingType()
|
||||
new ParkingType()
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
private generateStyleFunction() {
|
||||
const self = this;
|
||||
return function (properties: any) {
|
||||
// let questionSeverity = 0;
|
||||
// for (const qd of self.elementsToShow) {
|
||||
// if (qd.IsQuestioning(properties)) {
|
||||
// questionSeverity = Math.max(questionSeverity, qd.options.priority ?? 0);
|
||||
// }
|
||||
// }
|
||||
|
||||
// let colormapping = {
|
||||
// 0: "#00bb00",
|
||||
// 1: "#00ff00",
|
||||
// 10: "#dddd00",
|
||||
// 20: "#ff0000"
|
||||
// };
|
||||
|
||||
// let colour = colormapping[questionSeverity];
|
||||
// while (colour == undefined) {
|
||||
// questionSeverity--;
|
||||
// colour = colormapping[questionSeverity];
|
||||
// }
|
||||
|
||||
return {
|
||||
color: "#00bb00",
|
||||
icon: new L.icon({
|
||||
icon: L.icon({
|
||||
iconUrl: self.icon,
|
||||
iconSize: [30, 30]
|
||||
iconSize: [50, 50]
|
||||
})
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
import {LayerDefinition} from "../LayerDefinition";
|
||||
import {And, Tag, TagsFilter} from "../../Logic/TagsFilter";
|
||||
import * as L from "leaflet";
|
||||
import BikeStationChain from "../Questions/BikeStationChain";
|
||||
import BikeStationPumpTools from "../Questions/BikeStationPumpTools";
|
||||
import BikeStationStand from "../Questions/BikeStationStand";
|
||||
import PumpManual from "../Questions/PumpManual";
|
||||
import BikeStationOperator from "../Questions/BikeStationOperator";
|
||||
import BikeStationBrand from "../Questions/BikeStationBrand";
|
||||
import FixedText from "../Questions/FixedText";
|
||||
import {BikePumpManometer} from "../Questions/BikePumpManometer";
|
||||
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
|
||||
import {BikePumpOperationalStatus} from "../Questions/BikePumpOperationalStatus";
|
||||
import {BikePumpValves} from "../Questions/BikePumpValves";
|
||||
|
||||
export default class BikeServices extends LayerDefinition {
|
||||
|
||||
|
||||
private readonly pump: TagsFilter = new Tag("service:bicycle:pump", "yes");
|
||||
private readonly tools: TagsFilter = new Tag("service:bicycle:tools", "yes");
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.name = "bike station or pump";
|
||||
this.icon = "./assets/wrench.svg";
|
||||
|
||||
this.overpassFilter = new And([
|
||||
new Tag("amenity", "bicycle_repair_station")
|
||||
]);
|
||||
|
||||
this.newElementTags = [
|
||||
new Tag("amenity", "bicycle_repair_station")
|
||||
// new Tag("fixme", "Toegevoegd met MapComplete, geometry nog uit te tekenen")
|
||||
];
|
||||
this.maxAllowedOverlapPercentage = 10;
|
||||
|
||||
this.minzoom = 13;
|
||||
this.style = this.generateStyleFunction();
|
||||
this.title = new FixedText("Bike station");
|
||||
|
||||
|
||||
this.elementsToShow = [
|
||||
|
||||
new ImageCarouselWithUploadConstructor(),
|
||||
|
||||
|
||||
new BikeStationPumpTools(),
|
||||
new BikeStationChain().OnlyShowIf(this.tools),
|
||||
new BikeStationStand().OnlyShowIf(this.tools),
|
||||
|
||||
new PumpManual().OnlyShowIf(this.pump),
|
||||
new BikePumpManometer().OnlyShowIf(this.pump),
|
||||
new BikePumpValves().OnlyShowIf(this.pump),
|
||||
new BikePumpOperationalStatus().OnlyShowIf(this.pump),
|
||||
|
||||
new BikeStationOperator(),
|
||||
new BikeStationBrand()
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
private generateStyleFunction() {
|
||||
const self = this;
|
||||
return function (properties: any) {
|
||||
const onlyPump = self.pump.matchesProperties(properties) &&
|
||||
!self.tools.matchesProperties(properties)
|
||||
const iconUrl = onlyPump ? "./assets/pump.svg" : "./assets/wrench.svg"
|
||||
return {
|
||||
color: "#00bb00",
|
||||
icon: new L.icon({
|
||||
iconUrl: iconUrl,
|
||||
iconSize: [40, 40]
|
||||
})
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
89
Customizations/Layers/BikeStations.ts
Normal file
89
Customizations/Layers/BikeStations.ts
Normal file
|
@ -0,0 +1,89 @@
|
|||
import {LayerDefinition} from "../LayerDefinition";
|
||||
import {And, Tag, TagsFilter, Or} from "../../Logic/TagsFilter";
|
||||
import * as L from "leaflet";
|
||||
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 BikeStationOperator from "../Questions/bike/StationOperator";
|
||||
import BikeStationBrand from "../Questions/bike/StationBrand";
|
||||
import FixedText from "../Questions/FixedText";
|
||||
import PumpManometer from "../Questions/bike/PumpManometer";
|
||||
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
|
||||
import PumpOperational from "../Questions/bike/PumpOperational";
|
||||
import PumpValves from "../Questions/bike/PumpValves";
|
||||
|
||||
|
||||
export default class BikeStations extends LayerDefinition {
|
||||
private readonly pump = new Tag("service:bicycle:pump", "yes");
|
||||
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")]);
|
||||
private readonly tools = new Tag("service:bicycle:tools", "yes");
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.name = "bike station or pump";
|
||||
this.icon = "./assets/wrench.svg";
|
||||
|
||||
this.overpassFilter = new And([
|
||||
new Tag("amenity", "bicycle_repair_station")
|
||||
]);
|
||||
|
||||
this.newElementTags = [
|
||||
new Tag("amenity", "bicycle_repair_station")
|
||||
// new Tag("fixme", "Toegevoegd met MapComplete, geometry nog uit te tekenen")
|
||||
];
|
||||
this.maxAllowedOverlapPercentage = 10;
|
||||
|
||||
this.minzoom = 13;
|
||||
this.style = this.generateStyleFunction();
|
||||
this.title = new FixedText("Bike station");
|
||||
|
||||
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.pumpOperationalAny.matchesProperties(properties) || self.pumpOperationalOk.matchesProperties(properties)
|
||||
const hasTools = self.tools.matchesProperties(properties)
|
||||
let iconName = ""
|
||||
if (hasPump) {
|
||||
if (hasTools) {
|
||||
iconName = "repair_station_pump.svg"
|
||||
} else {
|
||||
if (isOperational) {
|
||||
iconName = "pump.svg"
|
||||
} else {
|
||||
iconName = "pump_broken.svg"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
iconName = "repair_station.svg"
|
||||
}
|
||||
const iconUrl = `./assets/bike/${iconName}`
|
||||
return {
|
||||
color: "#00bb00",
|
||||
icon: L.icon({
|
||||
iconUrl: iconUrl,
|
||||
iconSize: [50, 50]
|
||||
})
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
|
@ -58,7 +58,7 @@ export class GhostBike extends LayerDefinition {
|
|||
return {
|
||||
color: "#000000",
|
||||
icon: L.icon({
|
||||
iconUrl: 'assets/ghost_bike.svg',
|
||||
iconUrl: 'assets/bike/ghost.svg',
|
||||
iconSize: [40, 40],
|
||||
iconAnchor: [20, 20],
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue