2020-08-22 02:12:46 +02:00
|
|
|
import * as bookcases from "../assets/themes/bookcases/Bookcases.json";
|
|
|
|
import * as aed from "../assets/themes/aed/aed.json";
|
2020-08-22 16:00:33 +02:00
|
|
|
import * as toilets from "../assets/themes/toilets/toilets.json";
|
2020-08-25 02:12:26 +02:00
|
|
|
import * as artworks from "../assets/themes/artwork/artwork.json";
|
2020-08-27 18:44:16 +02:00
|
|
|
import * as cyclestreets from "../assets/themes/cyclestreets/cyclestreets.json";
|
2020-08-31 02:59:47 +02:00
|
|
|
import * as ghostbikes from "../assets/themes/ghostbikes/ghostbikes.json"
|
2020-09-17 13:13:02 +02:00
|
|
|
import * as cyclofix from "../assets/themes/cyclofix/cyclofix.json"
|
|
|
|
import * as buurtnatuur from "../assets/themes/buurtnatuur/buurtnatuur.json"
|
2020-09-19 13:37:04 +02:00
|
|
|
import * as nature from "../assets/themes/nature/nature.json"
|
|
|
|
import * as maps from "../assets/themes/maps/maps.json"
|
2020-10-10 13:44:10 +02:00
|
|
|
import * as shops from "../assets/themes/shops/shops.json"
|
2020-10-17 22:27:27 +02:00
|
|
|
import * as bike_monitoring_stations from "../assets/themes/bike_monitoring_station/bike_monitoring_stations.json"
|
2020-10-19 12:08:42 +02:00
|
|
|
import * as fritures from "../assets/themes/fritures/fritures.json"
|
2020-10-23 11:49:39 +02:00
|
|
|
import * as benches from "../assets/themes/benches/benches.json";
|
2020-10-23 19:26:08 +02:00
|
|
|
import * as charging_stations from "../assets/themes/charging_stations/charging_stations.json"
|
2020-10-30 00:56:46 +01:00
|
|
|
import * as widths from "../assets/themes/widths/width.json"
|
2020-11-11 16:23:49 +01:00
|
|
|
import * as drinking_water from "../assets/themes/drinking_water/drinking_water.json"
|
2020-11-16 12:20:20 +01:00
|
|
|
import * as climbing from "../assets/themes/climbing/climbing.json"
|
2020-11-13 23:58:11 +01:00
|
|
|
import * as surveillance_cameras from "../assets/themes/surveillance_cameras/surveillance_cameras.json"
|
2020-12-27 14:23:45 +01:00
|
|
|
import * as trees from "../assets/themes/trees/trees.json"
|
2020-11-11 16:23:49 +01:00
|
|
|
import * as personal from "../assets/themes/personalLayout/personalLayout.json"
|
2020-12-31 21:09:22 +01:00
|
|
|
import * as playgrounds from "../assets/themes/playgrounds/playgrounds.json"
|
2021-01-06 02:09:04 +01:00
|
|
|
import * as bicycle_lib from "../assets/themes/bicycle_library/bicycle_library.json"
|
2021-03-04 21:58:00 +01:00
|
|
|
import * as campersites from "../assets/themes/campersites/campersites.json"
|
2020-11-13 23:58:11 +01:00
|
|
|
import LayerConfig from "./JSON/LayerConfig";
|
2020-11-11 16:23:49 +01:00
|
|
|
import LayoutConfig from "./JSON/LayoutConfig";
|
2021-02-26 17:22:24 +01:00
|
|
|
import AllKnownLayers from "./AllKnownLayers";
|
2020-07-05 18:59:47 +02:00
|
|
|
|
|
|
|
export class AllKnownLayouts {
|
|
|
|
|
2020-10-27 01:01:34 +01:00
|
|
|
public static allLayers: Map<string, LayerConfig> = undefined;
|
2020-08-31 02:59:47 +02:00
|
|
|
|
2020-11-11 16:23:49 +01:00
|
|
|
private static GenerateCycloFix(): LayoutConfig {
|
|
|
|
const layout = new LayoutConfig(cyclofix)
|
2020-09-17 13:13:02 +02:00
|
|
|
const now = new Date();
|
|
|
|
const m = now.getMonth() + 1;
|
2020-11-09 19:55:29 +01:00
|
|
|
const day = new Date().getDate() + 1;
|
2020-09-17 13:13:02 +02:00
|
|
|
const date = day + "/" + m;
|
|
|
|
if (date === "31/10" || date === "1/11" || date === "2/11") {
|
2020-11-09 19:55:29 +01:00
|
|
|
console.log("The current date is ",date,", which means we remember our dead")
|
2020-09-17 13:13:02 +02:00
|
|
|
// Around Halloween/Fiesta de muerte/Allerzielen, we remember the dead
|
|
|
|
layout.layers.push(
|
2021-02-26 17:22:24 +01:00
|
|
|
AllKnownLayers.sharedLayers.get("ghost_bike")
|
2020-09-17 13:13:02 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
return layout;
|
|
|
|
|
|
|
|
}
|
2020-11-11 16:23:49 +01:00
|
|
|
public static layoutsList: LayoutConfig[] = [
|
|
|
|
new LayoutConfig(personal),
|
2020-09-20 23:01:08 +02:00
|
|
|
AllKnownLayouts.GenerateCycloFix(),
|
2020-11-11 16:23:49 +01:00
|
|
|
new LayoutConfig(aed),
|
2020-12-14 01:14:22 +01:00
|
|
|
new LayoutConfig(bookcases),
|
2020-11-11 16:23:49 +01:00
|
|
|
new LayoutConfig(toilets),
|
2020-12-14 01:14:22 +01:00
|
|
|
new LayoutConfig(artworks),
|
|
|
|
new LayoutConfig(ghostbikes),
|
2020-11-11 16:23:49 +01:00
|
|
|
new LayoutConfig(shops),
|
|
|
|
new LayoutConfig(drinking_water),
|
|
|
|
new LayoutConfig(nature),
|
|
|
|
new LayoutConfig(cyclestreets),
|
2021-01-06 02:09:04 +01:00
|
|
|
new LayoutConfig(bicycle_lib),
|
2020-12-14 01:14:22 +01:00
|
|
|
new LayoutConfig(maps),
|
|
|
|
new LayoutConfig(fritures),
|
2020-11-11 16:23:49 +01:00
|
|
|
new LayoutConfig(benches),
|
|
|
|
new LayoutConfig(charging_stations),
|
2020-12-14 01:14:22 +01:00
|
|
|
new LayoutConfig(widths),
|
|
|
|
new LayoutConfig(buurtnatuur),
|
|
|
|
new LayoutConfig(bike_monitoring_stations),
|
2020-12-18 01:36:45 +01:00
|
|
|
new LayoutConfig(surveillance_cameras),
|
2020-12-31 21:09:22 +01:00
|
|
|
new LayoutConfig(climbing),
|
2021-01-04 19:08:22 +01:00
|
|
|
new LayoutConfig(playgrounds),
|
2020-12-27 14:23:45 +01:00
|
|
|
new LayoutConfig(trees),
|
2021-03-04 21:58:00 +01:00
|
|
|
new LayoutConfig(campersites)
|
2020-07-31 04:58:58 +02:00
|
|
|
];
|
2020-09-17 13:13:02 +02:00
|
|
|
|
2020-07-31 04:58:58 +02:00
|
|
|
|
2020-11-11 16:23:49 +01:00
|
|
|
public static allSets: Map<string, LayoutConfig> = AllKnownLayouts.AllLayouts();
|
2020-07-25 01:07:02 +02:00
|
|
|
|
2020-11-11 16:23:49 +01:00
|
|
|
private static AllLayouts(): Map<string, LayoutConfig> {
|
2020-10-27 01:01:34 +01:00
|
|
|
this.allLayers = new Map<string, LayerConfig>();
|
2020-07-31 04:58:58 +02:00
|
|
|
for (const layout of this.layoutsList) {
|
2020-08-31 02:59:47 +02:00
|
|
|
for (let i = 0; i < layout.layers.length; i++) {
|
|
|
|
let layer = layout.layers[i];
|
|
|
|
if (typeof (layer) === "string") {
|
2021-02-26 17:22:24 +01:00
|
|
|
layer = layout.layers[i] = AllKnownLayers.sharedLayers.get(layer);
|
2020-09-11 02:14:16 +02:00
|
|
|
if(layer === undefined){
|
2021-02-26 17:22:24 +01:00
|
|
|
console.log("Defined layers are ", AllKnownLayers.sharedLayers.keys())
|
2020-09-11 02:14:16 +02:00
|
|
|
throw `Layer ${layer} was not found or defined - probably a type was made`
|
|
|
|
}
|
2020-08-31 02:59:47 +02:00
|
|
|
}
|
|
|
|
|
2020-07-31 04:58:58 +02:00
|
|
|
if (this.allLayers[layer.id] !== undefined) {
|
2020-07-25 01:07:02 +02:00
|
|
|
continue;
|
|
|
|
}
|
2020-07-31 04:58:58 +02:00
|
|
|
this.allLayers[layer.id] = layer;
|
2020-08-28 03:16:21 +02:00
|
|
|
this.allLayers[layer.id.toLowerCase()] = layer;
|
2020-07-25 01:07:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-11 16:23:49 +01:00
|
|
|
const allSets: Map<string, LayoutConfig> = new Map();
|
2020-07-31 04:58:58 +02:00
|
|
|
for (const layout of this.layoutsList) {
|
2020-08-30 01:13:18 +02:00
|
|
|
allSets[layout.id] = layout;
|
|
|
|
allSets[layout.id.toLowerCase()] = layout;
|
2020-07-05 18:59:47 +02:00
|
|
|
}
|
|
|
|
return allSets;
|
|
|
|
}
|
2020-07-15 15:55:08 +02:00
|
|
|
|
2020-07-05 18:59:47 +02:00
|
|
|
}
|