Add custom theme for advanced users

This commit is contained in:
Pieter Vander Vennet 2020-07-31 04:58:58 +02:00
parent 004eead4ee
commit 9c42839f01
44 changed files with 635 additions and 326 deletions

View file

@ -11,55 +11,53 @@ import {StreetWidth} from "./Layouts/StreetWidth";
import {Natuurpunt} from "./Layouts/Natuurpunt";
import {ClimbingTrees} from "./Layouts/ClimbingTrees";
import {Smoothness} from "./Layouts/Smoothness";
import {LayerDefinition} from "./LayerDefinition";
import {CustomLayers} from "../Logic/CustomLayers";
export class AllKnownLayouts {
public static allSets = AllKnownLayouts.AllLayouts();
public static allLayers: Map<string, LayerDefinition> = undefined;
public static layoutsList: Layout[] = [
new Groen(),
new GRB(),
new Cyclofix(),
new Bookcases(),
new WalkByBrussels(),
new MetaMap(),
new StreetWidth(),
new Natuurpunt(),
new ClimbingTrees(),
new Artworks(),
new Smoothness(),
new CustomLayers()
/*new Toilets(),
*/
];
public static allSets: Map<string, Layout> = AllKnownLayouts.AllLayouts();
private static AllLayouts(): Map<string, Layout> {
const layouts: Layout[] = [
new Groen(),
new GRB(),
new Cyclofix(),
new Bookcases(),
new WalkByBrussels(),
new MetaMap(),
new StreetWidth(),
new Natuurpunt(),
new ClimbingTrees(),
new Artworks(),
new Smoothness()
/*new Toilets(),
*/
];
const all = new All();
const knownKeys = []
for (const layout of layouts) {
this.allLayers = new Map<string, LayerDefinition>();
for (const layout of this.layoutsList) {
for (const layer of layout.layers) {
const key = layer.overpassFilter.asOverpass().join("");
if (knownKeys.indexOf(key) >= 0) {
const key = layer.id;
if (this.allLayers[layer.id] !== undefined) {
continue;
}
knownKeys.push(key);
this.allLayers[layer.id] = layer;
all.layers.push(layer);
}
}
layouts.push(all)
const allSets: Map<string, Layout> = new Map();
for (const layout of layouts) {
for (const layout of this.layoutsList) {
allSets[layout.name] = layout;
}
allSets[all.name] = all;
return allSets;
}
public static GetSets(layoutNames): any {
const all = new All();
for (const name of layoutNames) {
all.layers = all.layers.concat(AllKnownLayouts.allSets[name].layers);
}
return all;
}
}

View file

@ -51,6 +51,7 @@ export class LayerDefinition {
* ])
*/
overpassFilter: TagsFilter;
public readonly id: string;
/**
* This UIElement is rendered as title element in the popup
@ -90,7 +91,7 @@ export class LayerDefinition {
static WAYHANDLING_CENTER_ONLY = 1;
static WAYHANDLING_CENTER_AND_WAY = 2;
constructor(options: {
constructor(id: string, options: {
name: string,
description: string | UIElement,
presets: {
@ -111,6 +112,7 @@ export class LayerDefinition {
icon: any
}
} = undefined) {
this.id = id;
if (options === undefined) {
return;
}
@ -127,6 +129,4 @@ export class LayerDefinition {
this.wayHandling = options.wayHandling ?? LayerDefinition.WAYHANDLING_DEFAULT;
}
}

View file

@ -10,7 +10,7 @@ import FixedText from "../Questions/FixedText";
export class Artwork extends LayerDefinition {
constructor() {
super();
super("artwork");
this.name = "artwork";
const t = Translations.t.artwork;
this.title = t.title;

View file

@ -16,7 +16,7 @@ export default class BikeCafes extends LayerDefinition {
private readonly to = Translations.t.cyclofix.cafe
constructor() {
super()
super("bikecafe")
this.name = this.to.name
this.icon = "./assets/bike/cafe.svg"
this.overpassFilter = new And([

View file

@ -20,7 +20,7 @@ export default class BikeOtherShops extends LayerDefinition {
private readonly to = Translations.t.cyclofix.nonBikeShop
constructor() {
super();
super("bikeOtherShop");
this.name = this.to.name
this.icon = "./assets/bike/non_bike_repair_shop.svg"
this.overpassFilter = new And([

View file

@ -15,7 +15,7 @@ export default class BikeParkings extends LayerDefinition {
private readonly accessCargoDesignated = new Tag("cargo_bike", "designated");
constructor() {
super();
super("bikeparking");
this.name = Translations.t.cyclofix.parking.name;
this.icon = "./assets/bike/parking.svg";
this.overpassFilter = new Tag("amenity", "bicycle_parking");

View file

@ -21,7 +21,7 @@ export default class BikeShops extends LayerDefinition {
private readonly repairsBikes = new Tag("service:bicycle:repair", "yes")
constructor() {
super();
super("bikeshop");
this.name = Translations.t.cyclofix.shop.name
this.icon = "./assets/bike/repair_shop.svg"
this.overpassFilter = new Tag("shop", "bicycle");

View file

@ -27,7 +27,7 @@ export default class BikeStations extends LayerDefinition {
private readonly to = Translations.t.cyclofix.station
constructor() {
super();
super("bikestation");
this.name = Translations.t.cyclofix.station.name;
this.icon = "./assets/bike/repair_station_pump.svg";

View file

@ -10,7 +10,7 @@ export class Birdhide extends LayerDefinition {
constructor() {
super({
super("birdhide",{
name: "vogelkijkplaats",
description: "Een plaats om vogels te kijken, zoals een vogelkijkhut of kijkwand",
overpassFilter: Birdhide.birdhide,

View file

@ -9,7 +9,7 @@ import T from "../../UI/i18n/Translation";
export class Bookcases extends LayerDefinition {
constructor() {
super();
super("bookcases");
this.name = "boekenkast";
this.presets = [{

View file

@ -10,7 +10,7 @@ import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWi
export class Bos extends LayerDefinition {
constructor() {
super();
super("bos");
this.name = "Bos";
this.icon = "";

View file

@ -8,7 +8,7 @@ export class ClimbingTree extends LayerDefinition {
constructor() {
super();
super("climbingtree");
const t = Translations.t.climbingTrees.layer;
this.title = new FixedText(t.title);
const icon = "assets/walkbybrussels/tree.svg";

View file

@ -10,7 +10,7 @@ import Translations from "../../UI/i18n/Translations";
export class DrinkingWater extends LayerDefinition {
constructor() {
super();
super("drinkingwater");
this.name = Translations.t.cyclofix.drinking_water.title;
this.icon = "./assets/bike/drinking_water.svg";

View file

@ -8,7 +8,7 @@ import L from "leaflet";
export class GhostBike extends LayerDefinition {
constructor() {
super();
super("ghost bike");
this.name = "ghost bike";
this.overpassFilter = new Tag("memorial", "ghost_bike")
this.title = new FixedText("Ghost bike");

View file

@ -5,7 +5,7 @@ import {TagRenderingOptions} from "../TagRendering";
export class GrbToFix extends LayerDefinition {
constructor() {
super();
super("grb");
this.name = "grb";
this.presets = [];

View file

@ -6,7 +6,7 @@ import {And, Tag} from "../../Logic/TagsFilter";
export class InformationBoard extends LayerDefinition {
constructor() {
super({
super("informationBoard",{
name: "Informatiebord",
description: "Een informatiebord of kaart",
minzoom: 12,

View file

@ -6,7 +6,7 @@ import {And, Tag} from "../../Logic/TagsFilter";
export class Map extends LayerDefinition {
constructor() {
super();
super("map");
this.name = "Map";
this.title = new FixedText("Map");
this.minzoom = 12;

View file

@ -11,7 +11,7 @@ import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWi
export class NatureReserves extends LayerDefinition {
constructor(moreQuests: boolean = false) {
super();
super("natureReserve");
this.name = "Natuurgebied";
this.icon = "";
this.overpassFilter =

View file

@ -45,7 +45,7 @@ export class Park extends LayerDefinition {
constructor() {
super();
super("park");
this.name = "Park";
this.icon = undefined;
this.overpassFilter =

View file

@ -1,5 +1,4 @@
import {LayerDefinition} from "../LayerDefinition";
import {Quests} from "../../Quests";
import {FixedUiElement} from "../../UI/Base/FixedUiElement";
import L from "leaflet";
import {Tag} from "../../Logic/TagsFilter";
@ -7,7 +6,7 @@ import {Tag} from "../../Logic/TagsFilter";
export class Toilets extends LayerDefinition{
constructor() {
super();
super("toilets");
this.name="toilet";
this.newElementTags = [new Tag( "amenity", "toilets")];

View file

@ -8,7 +8,7 @@ import {TagRenderingOptions} from "../TagRendering";
export class Viewpoint extends LayerDefinition {
constructor() {
super({
super("viewpoint",{
name: "Bezienswaardigheid",
description: "Wil je een foto toevoegen van iets dat geen park, bos of natuurgebied is? Dit kan hiermee",
presets: [{

View file

@ -113,7 +113,7 @@ export class Widths extends LayerDefinition {
constructor(carWidth: number,
cyclistWidth: number,
pedestrianWidth: number) {
super();
super("width");
this.carWidth = carWidth;
this.cyclistWidth = cyclistWidth;
this.pedestrianWidth = pedestrianWidth;