2020-08-30 01:13:18 +02:00
|
|
|
import {TagRenderingConfigJson} from "./TagRenderingConfigJson";
|
|
|
|
import {AndOrTagConfigJson} from "./TagConfigJson";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Configuration for a single layer
|
|
|
|
*/
|
|
|
|
export interface LayerConfigJson {
|
|
|
|
/**
|
|
|
|
* The id of this layer.
|
|
|
|
* This should be a simple, lowercase, human readable string that is used to identify the layer.
|
|
|
|
*/
|
|
|
|
id: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of this layer
|
|
|
|
* Used in the layer control panel and the 'Personal theme'
|
|
|
|
*/
|
|
|
|
name: string | any
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A description for this layer.
|
|
|
|
* Shown in the layer selections and in the personal theme
|
|
|
|
*/
|
|
|
|
description?: string | any;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The tags to load from overpass. Either a simple 'key=value'-string, otherwise an advanced configuration
|
|
|
|
*/
|
|
|
|
overpassTags: AndOrTagConfigJson | string;
|
|
|
|
|
2020-11-17 02:22:48 +01:00
|
|
|
/**
|
|
|
|
* If set, this layer will not query overpass; but it'll still match the tags above which are by chance returned by other layers.
|
|
|
|
* Works well together with 'passAllFeatures', to add decoration
|
|
|
|
*/
|
|
|
|
doNotDownload?: boolean;
|
|
|
|
|
2020-08-30 01:13:18 +02:00
|
|
|
/**
|
|
|
|
* The zoomlevel at which point the data is shown and loaded.
|
|
|
|
*/
|
|
|
|
minzoom: number;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2020-10-27 01:01:34 +01:00
|
|
|
* The title shown in a popup for elements of this layer.
|
2020-08-30 01:13:18 +02:00
|
|
|
*/
|
2020-11-17 02:22:48 +01:00
|
|
|
title?: string | TagRenderingConfigJson;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Small icons shown next to the title.
|
|
|
|
* If not specified, the OsmLink and wikipedia links will be used by default.
|
|
|
|
* Use an empty array to hide them
|
|
|
|
*/
|
2020-10-27 01:01:34 +01:00
|
|
|
titleIcons?: (string | TagRenderingConfigJson)[];
|
2020-08-30 01:13:18 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The icon for an element.
|
|
|
|
* Note that this also doubles as the icon for this layer (rendered with the overpass-tags) ánd the icon in the presets.
|
2020-11-27 13:39:00 +01:00
|
|
|
*
|
|
|
|
* The result of the icon is rendered as follows:
|
|
|
|
* the resulting string is interpreted as a _list_ of items, seperated by ";". The bottommost layer is the first layer.
|
|
|
|
* As a result, on could use a generic pin, then overlay it with a specific icon.
|
|
|
|
* To make things even more practical, one can use all svgs from the folder "assets/svg" and _substitute the color_ in it.
|
|
|
|
* E.g. to draw a red pin, use "pin:#f00", to have a green circle with your icon on top, use `circle:#0f0;<path to my icon.svg>`
|
2020-08-30 01:13:18 +02:00
|
|
|
*/
|
|
|
|
icon?: string | TagRenderingConfigJson;
|
2020-08-31 02:59:47 +02:00
|
|
|
|
2020-11-27 03:05:29 +01:00
|
|
|
/**
|
|
|
|
* IconsOverlays are a list of extra icons/badges to overlay over the icon.
|
|
|
|
* The 'badge'-toggle changes their behaviour.
|
|
|
|
* If badge is set, it will be added as a 25% height icon at the bottom right of the icon, with all the badges in a flex layout.
|
|
|
|
* If badges is false, it'll be a simple overlay
|
2020-11-27 13:39:00 +01:00
|
|
|
*
|
|
|
|
* Note: strings are interpreted as icons, so layering and substituting is supported
|
2020-11-27 03:05:29 +01:00
|
|
|
*/
|
2020-11-27 13:39:00 +01:00
|
|
|
iconOverlays?: {if: string | AndOrTagConfigJson, then: string, badge?: boolean}[]
|
2020-11-27 03:05:29 +01:00
|
|
|
|
2020-08-31 02:59:47 +02:00
|
|
|
/**
|
|
|
|
* A string containing "width,height" or "width,height,anchorpoint" where anchorpoint is any of 'center', 'top', 'bottom', 'left', 'right', 'bottomleft','topright', ...
|
|
|
|
* Default is '40,40,center'
|
|
|
|
*/
|
|
|
|
iconSize?: string | TagRenderingConfigJson;
|
2020-08-30 01:13:18 +02:00
|
|
|
/**
|
2020-11-17 16:29:51 +01:00
|
|
|
* The rotation of an icon, useful for e.g. directions.
|
|
|
|
* Usage: as if it were a css property for 'rotate', thus has to end with 'deg', e.g. `90deg`, `{direction}deg`, `calc(90deg - {camera:direction}deg)``
|
2020-11-17 02:22:48 +01:00
|
|
|
*/
|
|
|
|
rotation?: string | TagRenderingConfigJson;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The color for way-elements and SVG-elements.
|
|
|
|
* If the value starts with "--", the style of the body element will be queried for the corresponding variable instead
|
2020-08-30 01:13:18 +02:00
|
|
|
*/
|
|
|
|
color?: string | TagRenderingConfigJson;
|
|
|
|
/**
|
|
|
|
* The stroke-width for way-elements
|
|
|
|
*/
|
|
|
|
width?: string | TagRenderingConfigJson;
|
|
|
|
|
2020-10-30 00:56:46 +01:00
|
|
|
/**
|
|
|
|
* A dasharray, e.g. "5 6"
|
|
|
|
* The dasharray defines 'pixels of line, pixels of gap, pixels of line, pixels of gap',
|
|
|
|
* Default value: "" (empty string == full line)
|
|
|
|
*/
|
|
|
|
dashArray?: string | TagRenderingConfigJson
|
|
|
|
|
2020-08-30 01:13:18 +02:00
|
|
|
/**
|
|
|
|
* Wayhandling: should a way/area be displayed as:
|
|
|
|
* 0) The way itself
|
|
|
|
* 1) The centerpoint and the way
|
2020-09-02 11:37:34 +02:00
|
|
|
* 2) Only the centerpoint
|
2020-08-30 01:13:18 +02:00
|
|
|
*/
|
|
|
|
wayHandling?: number;
|
|
|
|
|
2020-09-09 18:42:13 +02:00
|
|
|
/**
|
|
|
|
* Consider that we want to show 'Nature Reserves' and 'Forests'. Now, ofter, there are pieces of forest mapped _in_ the nature reserve.
|
|
|
|
* Now, showing those pieces of forest overlapping with the nature reserve truly clutters the map and is very user-unfriendly.
|
|
|
|
*
|
|
|
|
* The features are placed layer by layer. If a feature below a feature on this layer overlaps for more then 'x'-percent, the underlying feature is hidden.
|
|
|
|
*/
|
|
|
|
hideUnderlayingFeaturesMinPercentage?:number;
|
|
|
|
|
2020-11-17 02:22:48 +01:00
|
|
|
/**
|
|
|
|
* If set, this layer will pass all the features it receives onto the next layer
|
|
|
|
*/
|
|
|
|
passAllFeatures?:boolean
|
|
|
|
|
2020-08-30 01:13:18 +02:00
|
|
|
/**
|
|
|
|
* Presets for this layer
|
|
|
|
*/
|
|
|
|
presets?: {
|
|
|
|
title: string | any,
|
2020-08-31 02:59:47 +02:00
|
|
|
tags: string[],
|
2020-08-30 01:13:18 +02:00
|
|
|
description?: string | any,
|
|
|
|
}[],
|
|
|
|
|
|
|
|
/**
|
|
|
|
* All the tag renderings.
|
2020-11-17 02:22:48 +01:00
|
|
|
* A tag rendering is a block that either shows the known value or asks a question.
|
2020-11-18 13:41:31 +01:00
|
|
|
*
|
|
|
|
* Refer to the class `TagRenderingConfigJson` to see the possibilities.
|
|
|
|
*
|
|
|
|
* Note that we can also use a string here - where the string refers to a tagrenering defined in `assets/questions/questions.json`,
|
|
|
|
* where a few very general questions are defined e.g. website, phone number, ...
|
|
|
|
*
|
2020-08-30 01:13:18 +02:00
|
|
|
*/
|
|
|
|
tagRenderings?: (string | TagRenderingConfigJson) []
|
|
|
|
}
|