forked from MapComplete/MapComplete
Add cycle_highways theme, add configurable overpass backend as feature switch (settable via theme and URL)
This commit is contained in:
parent
f4ea36de9a
commit
ef0826ebb6
21 changed files with 377 additions and 48 deletions
|
@ -1,4 +1,5 @@
|
|||
|
||||
|
||||
Metatags
|
||||
==========
|
||||
|
||||
|
|
BIN
Docs/Tools/graphs/Changesets per host in 2020.png
Normal file
BIN
Docs/Tools/graphs/Changesets per host in 2020.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 80 KiB |
BIN
Docs/Tools/graphs/Changesets per host in 2021.png
Normal file
BIN
Docs/Tools/graphs/Changesets per host in 2021.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 247 KiB |
BIN
Docs/Tools/graphs/Changesets per host.png
Normal file
BIN
Docs/Tools/graphs/Changesets per host.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 199 KiB |
|
@ -150,6 +150,17 @@ The language to display mapcomplete in. Will be ignored in case a logged-in-user
|
|||
If true, shows some extra debugging help such as all the available tags on every object The default value is _false_
|
||||
|
||||
|
||||
overpassUrl
|
||||
-------------
|
||||
|
||||
Point mapcomplete to a different overpass-instance. Example: https://overpass-api.de/api/interpreter The default value is _https://overpass.kumi.de/api/interpreter_
|
||||
|
||||
|
||||
overpassTimeout
|
||||
-----------------
|
||||
|
||||
Set a different timeout (in seconds) for queries in overpass The default value is _60_
|
||||
|
||||
fake-user
|
||||
-----------
|
||||
|
||||
|
|
|
@ -393,7 +393,9 @@ export class InitUiElements {
|
|||
const updater = new LoadFromOverpass(
|
||||
state.locationControl,
|
||||
state.layoutToUse,
|
||||
state.leafletMap
|
||||
state.leafletMap,
|
||||
state.overpassUrl,
|
||||
state.overpassTimeout
|
||||
);
|
||||
State.state.layerUpdater = updater;
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ export default class OverpassFeatureSource implements FeatureSource {
|
|||
private readonly _location: UIEventSource<Loc>;
|
||||
private readonly _layoutToUse: UIEventSource<LayoutConfig>;
|
||||
private readonly _leafletMap: UIEventSource<L.Map>;
|
||||
private readonly _interpreterUrl: UIEventSource<string>;
|
||||
private readonly _timeout: UIEventSource<number>;
|
||||
|
||||
/**
|
||||
* The most important layer should go first, as that one gets first pick for the questions
|
||||
|
@ -42,10 +44,14 @@ export default class OverpassFeatureSource implements FeatureSource {
|
|||
constructor(
|
||||
location: UIEventSource<Loc>,
|
||||
layoutToUse: UIEventSource<LayoutConfig>,
|
||||
leafletMap: UIEventSource<L.Map>) {
|
||||
leafletMap: UIEventSource<L.Map>,
|
||||
interpreterUrl: UIEventSource<string>,
|
||||
timeout: UIEventSource<number>,) {
|
||||
this._location = location;
|
||||
this._layoutToUse = layoutToUse;
|
||||
this._leafletMap = leafletMap;
|
||||
this._interpreterUrl = interpreterUrl;
|
||||
this._timeout = timeout;
|
||||
const self = this;
|
||||
|
||||
this.sufficientlyZoomed = location.map(location => {
|
||||
|
@ -123,7 +129,7 @@ export default class OverpassFeatureSource implements FeatureSource {
|
|||
if (filters.length + extraScripts.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
return new Overpass(new Or(filters), extraScripts);
|
||||
return new Overpass(new Or(filters), extraScripts, this._interpreterUrl, this._timeout);
|
||||
}
|
||||
|
||||
private update(): void {
|
||||
|
|
|
@ -3,6 +3,7 @@ import Bounds from "../../Models/Bounds";
|
|||
import {TagsFilter} from "../Tags/TagsFilter";
|
||||
import ExtractRelations from "./ExtractRelations";
|
||||
import {Utils} from "../../Utils";
|
||||
import {UIEventSource} from "../UIEventSource";
|
||||
|
||||
/**
|
||||
* Interfaces overpass to get all the latest data
|
||||
|
@ -10,10 +11,17 @@ import {Utils} from "../../Utils";
|
|||
export class Overpass {
|
||||
public static testUrl: string = null
|
||||
private _filter: TagsFilter
|
||||
private readonly _interpreterUrl: UIEventSource<string>;
|
||||
private readonly _timeout: UIEventSource<number>;
|
||||
private readonly _extraScripts: string[];
|
||||
private _includeMeta: boolean;
|
||||
|
||||
constructor(filter: TagsFilter, extraScripts: string[], includeMeta = true) {
|
||||
|
||||
constructor(filter: TagsFilter, extraScripts: string[],
|
||||
interpreterUrl: UIEventSource<string>,
|
||||
timeout: UIEventSource<number>,
|
||||
includeMeta = true) {
|
||||
this._timeout = timeout;
|
||||
this._interpreterUrl = interpreterUrl;
|
||||
this._filter = filter
|
||||
this._extraScripts = extraScripts;
|
||||
this._includeMeta = includeMeta;
|
||||
|
@ -54,7 +62,7 @@ export class Overpass {
|
|||
filter += '(' + extraScript + ');';
|
||||
}
|
||||
const query =
|
||||
`[out:json][timeout:25]${bbox};(${filter});out body;${this._includeMeta ? 'out meta;' : ''}>;out skel qt;`
|
||||
return "https://overpass-api.de/api/interpreter?data=" + encodeURIComponent(query)
|
||||
`[out:json][timeout:${this._timeout.data}]${bbox};(${filter});out body;${this._includeMeta ? 'out meta;' : ''}>;out skel qt;`
|
||||
return `${this._interpreterUrl.data}?data=${encodeURIComponent(query)}`
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Utils } from "../Utils";
|
|||
|
||||
export default class Constants {
|
||||
|
||||
public static vNumber = "0.9.1";
|
||||
public static vNumber = "0.9.2";
|
||||
|
||||
// The user journey states thresholds when a new feature gets unlocked
|
||||
public static userJourney = {
|
||||
|
|
|
@ -339,4 +339,12 @@ export interface LayoutConfigJson {
|
|||
enableDownload?: boolean;
|
||||
enablePdfDownload?: boolean;
|
||||
|
||||
/**
|
||||
* Set a different overpass URL. Default: https://overpass-api.de/api/interpreter
|
||||
*/
|
||||
overpassUrl?: string;
|
||||
/**
|
||||
* Set a different timeout for overpass queries - in seconds. Default: 30s
|
||||
*/
|
||||
overpassTimeout?: number
|
||||
}
|
|
@ -53,6 +53,9 @@ export default class LayoutConfig {
|
|||
public readonly cacheTimeout?: number;
|
||||
public readonly units: Unit[] = []
|
||||
private readonly _official: boolean;
|
||||
|
||||
public readonly overpassUrl: string;
|
||||
public readonly overpassTimeout: number;
|
||||
|
||||
constructor(json: LayoutConfigJson, official = true, context?: string) {
|
||||
this._official = official;
|
||||
|
@ -160,7 +163,8 @@ export default class LayoutConfig {
|
|||
this.enablePdfDownload = json.enablePdfDownload ?? false;
|
||||
this.customCss = json.customCss;
|
||||
this.cacheTimeout = json.cacheTimout ?? (60 * 24 * 60 * 60)
|
||||
|
||||
this.overpassUrl = json.overpassUrl ?? "https://overpass-api.de/api/interpreter"
|
||||
this.overpassTimeout = json.overpassTimeout ?? 30
|
||||
|
||||
}
|
||||
|
||||
|
|
14
State.ts
14
State.ts
|
@ -94,6 +94,8 @@ export default class State {
|
|||
public readonly featureSwitchEnableExport: UIEventSource<boolean>;
|
||||
public readonly featureSwitchFakeUser: UIEventSource<boolean>;
|
||||
public readonly featureSwitchExportAsPdf: UIEventSource<boolean>;
|
||||
public readonly overpassUrl: UIEventSource<string>;
|
||||
public readonly overpassTimeout: UIEventSource<number>;
|
||||
|
||||
public featurePipeline: FeaturePipeline;
|
||||
|
||||
|
@ -254,7 +256,7 @@ export default class State {
|
|||
(layoutToUse) => layoutToUse?.enableBackgroundLayerSelection ?? true,
|
||||
"Disables/Enables the background layer control"
|
||||
);
|
||||
|
||||
|
||||
this.featureSwitchFilter = featSw(
|
||||
"fs-filter",
|
||||
(layoutToUse) => layoutToUse?.enableLayers ?? true,
|
||||
|
@ -307,6 +309,7 @@ export default class State {
|
|||
"Enable the PDF download button"
|
||||
);
|
||||
|
||||
|
||||
this.featureSwitchIsTesting = QueryParameters.GetQueryParameter(
|
||||
"test",
|
||||
"false",
|
||||
|
@ -338,6 +341,15 @@ export default class State {
|
|||
"The OSM backend to use - can be used to redirect mapcomplete to the testing backend when using 'osm-test'"
|
||||
);
|
||||
|
||||
this.overpassUrl = QueryParameters.GetQueryParameter("overpassUrl",
|
||||
layoutToUse?.overpassUrl,
|
||||
"Point mapcomplete to a different overpass-instance. Example: https://overpass-api.de/api/interpreter"
|
||||
)
|
||||
|
||||
this.overpassTimeout = QueryParameters.GetQueryParameter("overpassTimeout",
|
||||
"" + layoutToUse?.overpassTimeout,
|
||||
"Set a different timeout (in seconds) for queries in overpass")
|
||||
.map(str => Number(str), [], n => "" + n)
|
||||
|
||||
this.featureSwitchUserbadge.addCallbackAndRun(userbadge => {
|
||||
if (!userbadge) {
|
||||
|
|
|
@ -50,21 +50,26 @@ export default class Table extends BaseUIElement {
|
|||
let row = this._contents[i];
|
||||
const tr = document.createElement("tr")
|
||||
for (let j = 0; j < row.length; j++) {
|
||||
let elem = row[j];
|
||||
const htmlElem = elem?.ConstructElement()
|
||||
if (htmlElem === undefined) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
|
||||
let style = undefined;
|
||||
if (this._contentStyle !== undefined && this._contentStyle[i] !== undefined && this._contentStyle[j] !== undefined) {
|
||||
style = this._contentStyle[i][j]
|
||||
}
|
||||
let elem = row[j];
|
||||
const htmlElem = elem?.ConstructElement()
|
||||
if (htmlElem === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const td = document.createElement("td")
|
||||
td.style.cssText = style;
|
||||
td.appendChild(htmlElem)
|
||||
tr.appendChild(td)
|
||||
let style = undefined;
|
||||
if (this._contentStyle !== undefined && this._contentStyle[i] !== undefined && this._contentStyle[j] !== undefined) {
|
||||
style = this._contentStyle[i][j]
|
||||
}
|
||||
|
||||
const td = document.createElement("td")
|
||||
td.style.cssText = style;
|
||||
td.appendChild(htmlElem)
|
||||
tr.appendChild(td)
|
||||
} catch (e) {
|
||||
console.error("Could not render an element in a table due to", e, row[j])
|
||||
}
|
||||
}
|
||||
table.appendChild(tr)
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@ export default class Translations {
|
|||
if (typeof (s) === "string") {
|
||||
return new FixedUiElement(s);
|
||||
}
|
||||
if(typeof s === "number"){
|
||||
return new FixedUiElement(""+s)
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
[
|
||||
{
|
||||
"authors": [
|
||||
"Pieter Vander Vennet"
|
||||
],
|
||||
"path": "add_pin.svg",
|
||||
"license": "CC0",
|
||||
"sources": []
|
||||
},
|
||||
{
|
||||
"authors": [
|
||||
"Pieter Vander Vennet"
|
||||
|
@ -1346,5 +1354,11 @@
|
|||
"path": "location_unlocked.svg",
|
||||
"license": "CC0",
|
||||
"sources": []
|
||||
},
|
||||
{
|
||||
"authors": [],
|
||||
"path": "loading.svg",
|
||||
"license": "CC0; trivial",
|
||||
"sources": []
|
||||
}
|
||||
]
|
176
assets/themes/cycle_highways/cycle_highways.json
Normal file
176
assets/themes/cycle_highways/cycle_highways.json
Normal file
|
@ -0,0 +1,176 @@
|
|||
{
|
||||
"id": "cycle_highways",
|
||||
"title": {
|
||||
"en": "Cycle highways"
|
||||
},
|
||||
"hideFromOverview": true,
|
||||
"maintainer": "L'imaginaire",
|
||||
"icon": "./assets/themes/cycle_highways/fietssnelwegen-logo.svg",
|
||||
"overpassUrl": "https://overpass.kumi.de/api/interpreter",
|
||||
"overpassTimeout": 60,
|
||||
"description": {
|
||||
"en": "This map shows cycle highways"
|
||||
},
|
||||
"language": [
|
||||
"en"
|
||||
],
|
||||
"version": "2021-05-22",
|
||||
"startLat": 51.1599,
|
||||
"startLon": 3.3475,
|
||||
"startZoom": 8,
|
||||
"clustering": {
|
||||
"maxZoom": 1
|
||||
},
|
||||
"enableDownload": true,
|
||||
"enablePdfDownload": true,
|
||||
"layers": [
|
||||
{
|
||||
"id": "cycle_highways",
|
||||
"tagRenderings": [
|
||||
{
|
||||
"render": "The name is <b>{name}</b>",
|
||||
"question": "What is the name of this cycle highway?",
|
||||
"freeform": {
|
||||
"key": "name"
|
||||
}
|
||||
},
|
||||
{
|
||||
"render": "Referentienummer is <b>{ref}</b>",
|
||||
"question": "What is the reference number of this cycle highway?",
|
||||
"freeform": {
|
||||
"key": "ref"
|
||||
}
|
||||
},
|
||||
{
|
||||
"render": "The current state of this link is {state}",
|
||||
"question": "What is the state of this link?",
|
||||
"freeform": {
|
||||
"key": "state"
|
||||
},
|
||||
"mappings": [
|
||||
{
|
||||
"if": "state=proposed",
|
||||
"then": "This is a proposed route"
|
||||
},
|
||||
{
|
||||
"if": "state=temporary",
|
||||
"then": "This is a temporary deviation"
|
||||
},
|
||||
{
|
||||
"if": "state=",
|
||||
"then": "This link is operational and signposted"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"render": "This part is {_length:km}km long"
|
||||
},
|
||||
"website",
|
||||
{
|
||||
"render":"{all_tags()}"
|
||||
}
|
||||
],
|
||||
"name": {
|
||||
"en": "cycle highways"
|
||||
},
|
||||
"source": {
|
||||
"osmTags": "cycle_network=BE-VLG:cycle_highway"
|
||||
},
|
||||
"minzoom": 8,
|
||||
"title": {
|
||||
"render": {
|
||||
"en": "cycle highway"
|
||||
}
|
||||
},
|
||||
"width": {
|
||||
"render": "4"
|
||||
},
|
||||
"color": {
|
||||
"render": "#ff7392",
|
||||
"mappings": [
|
||||
{
|
||||
"if": "state=",
|
||||
"then": "#00acfc"
|
||||
},
|
||||
{
|
||||
"if": "state=temporary",
|
||||
"then": "#00acfc"
|
||||
}
|
||||
]
|
||||
},
|
||||
"dashArray": {
|
||||
"render": "",
|
||||
"mappings": [
|
||||
{
|
||||
"if": "state=temporary",
|
||||
"then": "12 10"
|
||||
}
|
||||
]
|
||||
},
|
||||
"filter": [
|
||||
{
|
||||
"options": [
|
||||
{
|
||||
"question": "Name contains 'alt'",
|
||||
"osmTags": "name~.*[aA]lt.*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"options": [
|
||||
{
|
||||
"question": "Name contains 'wenslijn'",
|
||||
"osmTags": "name~.*[wW]enslijn.*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"options": [
|
||||
{
|
||||
"question": "Name contains 'omleiding'",
|
||||
"osmTags": "name~.*[oO]mleiding.*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"options": [
|
||||
{
|
||||
"question": "Reference contains 'alt'",
|
||||
"osmTags": "ref~.*[aA]lt.*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"options": [
|
||||
{
|
||||
"question": "No filter"
|
||||
},
|
||||
{
|
||||
"question": "state=proposed",
|
||||
"osmTags": "state=proposed"
|
||||
},
|
||||
{
|
||||
"question": "state=temporary",
|
||||
"osmTags": "state=temporary"
|
||||
},
|
||||
{
|
||||
"question": "state unset",
|
||||
"osmTags": "state="
|
||||
},
|
||||
{
|
||||
"question": "Other state",
|
||||
"osmTags": {
|
||||
"and": [
|
||||
"state!=",
|
||||
"state!=proposed",
|
||||
"state!=temporary"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"defaultBackgroundId": "CartoDB.Positron"
|
||||
}
|
64
assets/themes/cycle_highways/fietssnelwegen-logo.svg
Normal file
64
assets/themes/cycle_highways/fietssnelwegen-logo.svg
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg preserveAspectRatio="none" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="165px" height="155px" viewBox="0 0 165 155" style="enable-background:new 0 0 165 155;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#1582DE;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
</style>
|
||||
<path id="Polygon_2_copy_19" class="st0" d="M81.8,0c-6.4,0-12,3.1-14.8,6.9C56.6,21.2,47,36,38.3,51.4
|
||||
c-14.1,24.8-23.5,43.4-26.9,52.8c-1.8,5.3-1.2,11.1,1.7,15.8c2.7,4.9,7.5,8.2,13,9c11.7,1.3,28,2.9,55.4,2.8c0.1,0-0.1,0,0,0
|
||||
c27.4,0.2,44-1.4,55.7-2.7c5.5-0.8,10.4-4.1,13.1-9c2.9-4.8,3.5-10.6,1.7-15.9c-3.4-9.4-12.8-28-26.9-52.8
|
||||
c-8.7-15.4-18.3-30.3-28.8-44.6C93.6,3.1,87.9,0,81.5,0"/>
|
||||
<path id="F" class="st1" d="M65.8,105.3c0,4.7,3,7.3,7,7.3s7-2.6,7-7.3V85h14.4c3.5,0.2,6.5-2.5,6.7-6c0-0.2,0-0.4,0-0.5
|
||||
c0.1-3.4-2.7-6.3-6.1-6.3c-0.2,0-0.4,0-0.5,0H79.7V58.6h17.1c4.2,0,6.2-3.3,6.2-6.4c0-3.3-2.1-6.4-6.2-6.4H73
|
||||
c-3.8-0.1-7.1,2.9-7.2,6.7c0,0.2,0,0.4,0,0.6L65.8,105.3L65.8,105.3z"/>
|
||||
<path id="Fietssnelwegen.be" class="st1" d="M0,153.4c-0.1,0.7,0.5,1.4,1.2,1.4c0.1,0,0.1,0,0.2,0c0.7,0,1.4-0.5,1.4-1.3
|
||||
c0-0.1,0-0.1,0-0.2v-4.1h2.9c0.7,0,1.3-0.5,1.3-1.2c0,0,0-0.1,0-0.1c0-0.7-0.5-1.3-1.2-1.3c0,0-0.1,0-0.1,0H2.8v-2.7h3.4
|
||||
c0.7,0,1.3-0.6,1.2-1.3c0-0.7-0.6-1.2-1.2-1.2H1.5c-0.8,0-1.4,0.6-1.4,1.3c0,0,0,0.1,0,0.1L0,153.4L0,153.4z M8.5,153.4
|
||||
c-0.1,0.7,0.5,1.4,1.2,1.4c0.1,0,0.1,0,0.2,0c0.7,0,1.4-0.5,1.4-1.3c0-0.1,0-0.1,0-0.2v-10.6c0.1-0.7-0.5-1.4-1.2-1.4
|
||||
c-0.1,0-0.1,0-0.2,0c-0.7,0-1.4,0.5-1.4,1.3c0,0.1,0,0.1,0,0.2V153.4z M13.2,153.3c0,0.7,0.6,1.4,1.3,1.4c0,0,0.1,0,0.1,0h4.8
|
||||
c0.7,0,1.3-0.5,1.3-1.2c0,0,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.4,1.4
|
||||
s1.4-0.7,1.4-1.4c0-0.8-0.6-1.4-1.4-1.4C142.1,152.1,141.4,152.7,141.4,153.5C141.4,153.5,141.4,153.5,141.4,153.5L141.4,153.5z
|
||||
M146.5,153.3c0,0.8,0.6,1.4,1.3,1.4c0.1,0,0.1,0,0.2,0h3.8c2.6,0,4.3-1.4,4.3-4c0-1.6-1.2-3-2.8-3.2v0c1.1-0.4,1.8-1.5,1.7-2.7
|
||||
c0-1.8-1.5-3.3-3.3-3.3c-0.1,0-0.1,0-0.2,0h-3.6c-0.7-0.1-1.4,0.5-1.5,1.2c0,0.1,0,0.1,0,0.2L146.5,153.3L146.5,153.3z M149.3,144
|
||||
h1.4c0.7-0.1,1.4,0.4,1.5,1.2c0,0.1,0,0.1,0,0.2c0.1,0.8-0.5,1.4-1.3,1.5c-0.1,0-0.2,0-0.2,0h-1.4V144z M149.3,149.2h2
|
||||
c1.3,0,2,0.6,2,1.5c0,0.9-0.7,1.6-1.5,1.6c-0.1,0-0.1,0-0.2,0h-2.2V149.2z M157.4,153.3c0,0.7,0.6,1.4,1.3,1.4c0,0,0.1,0,0.1,0h4.8
|
||||
c0.7,0,1.3-0.5,1.3-1.2c0,0,0-0.1,0-0.1c0-0.7-0.5-1.3-1.2-1.3c0,0-0.1,0-0.1,0h-3.4v-2.8h3c0.7,0,1.3-0.5,1.3-1.2c0,0,0-0.1,0-0.1
|
||||
c0-0.7-0.5-1.3-1.2-1.3c0,0-0.1,0-0.1,0h-3v-2.7h3.3c0.7,0,1.3-0.5,1.3-1.2c0,0,0-0.1,0-0.1c0-0.7-0.5-1.3-1.2-1.3c0,0-0.1,0-0.1,0
|
||||
h-4.6c-0.8,0-1.4,0.6-1.5,1.4c0,0.1,0,0.2,0,0.3V153.3L157.4,153.3z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 6.8 KiB |
12
assets/themes/cycle_highways/license_info.json
Normal file
12
assets/themes/cycle_highways/license_info.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
[
|
||||
{
|
||||
"authors": [
|
||||
"De Vlaamse Provincies"
|
||||
],
|
||||
"path": "fietssnelwegen-logo.svg",
|
||||
"license": "Logo by the government",
|
||||
"sources": [
|
||||
"https://fietssnelwegen.be/"
|
||||
]
|
||||
}
|
||||
]
|
|
@ -17,7 +17,7 @@
|
|||
"nl"
|
||||
],
|
||||
"maintainer": "MapComplete",
|
||||
"hideFromOverview": true,
|
||||
"hideFromOverview": false,
|
||||
"defaultBackgroundId": "CartoDB.Voyager",
|
||||
"icon": "./assets/themes/cycle_infra/cycle-infra.svg",
|
||||
"version": "0",
|
||||
|
|
|
@ -52,7 +52,8 @@ function createOverpassObject(theme: LayoutConfig) {
|
|||
if (filters.length + extraScripts.length === 0) {
|
||||
throw "Nothing to download! The theme doesn't declare anything to download"
|
||||
}
|
||||
return new Overpass(new Or(filters), extraScripts);
|
||||
return new Overpass(new Or(filters), extraScripts, new UIEventSource<string>("https://overpass-api.de/api/interpreter"),
|
||||
new UIEventSource<number>(60));
|
||||
}
|
||||
|
||||
function rawJsonName(targetDir: string, x: number, y: number, z: number): string {
|
||||
|
|
48
test.ts
48
test.ts
|
@ -1,29 +1,31 @@
|
|||
import {UIEventSource} from "./Logic/UIEventSource";
|
||||
import AllKnownLayers from "./Customizations/AllKnownLayers";
|
||||
import {FixedUiElement} from "./UI/Base/FixedUiElement";
|
||||
import {VariableUiElement} from "./UI/Base/VariableUIElement";
|
||||
import {TagUtils} from "./Logic/Tags/TagUtils";
|
||||
import Hash from "./Logic/Web/Hash";
|
||||
import {InitUiElements} from "./InitUiElements";
|
||||
import {Utils} from "./Utils";
|
||||
import {UIEventSource} from "./Logic/UIEventSource";
|
||||
import {LocalStorageSource} from "./Logic/Web/LocalStorageSource";
|
||||
import LZString from "lz-string";
|
||||
import {LayoutConfigJson} from "./Models/ThemeConfig/Json/LayoutConfigJson";
|
||||
import Combine from "./UI/Base/Combine";
|
||||
import Svg from "./Svg";
|
||||
import Translations from "./UI/i18n/Translations";
|
||||
import LayerConfig from "./Models/ThemeConfig/LayerConfig";
|
||||
import AddNewMarker from "./UI/BigComponents/AddNewMarker";
|
||||
|
||||
|
||||
function genMarker(filteredLayers: UIEventSource<{ appliedFilters: undefined; isDisplayed: UIEventSource<boolean>; layerDef: LayerConfig }[]>) {
|
||||
return new AddNewMarker(filteredLayers)
|
||||
|
||||
}
|
||||
|
||||
let filteredLayers = new UIEventSource([
|
||||
{
|
||||
layerDef: AllKnownLayers.sharedLayers.get("toilet"),
|
||||
isDisplayed: new UIEventSource<boolean>(true),
|
||||
appliedFilters: undefined
|
||||
new VariableUiElement(Hash.hash.map(
|
||||
hash => {
|
||||
let json: {};
|
||||
try {
|
||||
json = atob(hash);
|
||||
} catch (e) {
|
||||
// We try to decode with lz-string
|
||||
json =
|
||||
Utils.UnMinify(LZString.decompressFromBase64(hash))
|
||||
}
|
||||
return new Combine([
|
||||
new FixedUiElement("Base64 decoded: " + atob(hash)),
|
||||
new FixedUiElement("LZ: " + LZString.decompressFromBase64(hash)),
|
||||
new FixedUiElement("Base64 + unminify: " + Utils.UnMinify(atob(hash))),
|
||||
new FixedUiElement("LZ + unminify: " + Utils.UnMinify(LZString.decompressFromBase64(hash)))
|
||||
]).SetClass("flex flex-col m-1")
|
||||
}
|
||||
])
|
||||
genMarker(filteredLayers).SetStyle("width: 50px; height: 70px")
|
||||
.SetClass("block border-black border")
|
||||
.AttachTo("maindiv")
|
||||
|
||||
new FixedUiElement("").AttachTo("extradiv")
|
||||
))
|
||||
.AttachTo("maindiv")
|
Loading…
Reference in a new issue