forked from MapComplete/MapComplete
Refactoring: split tagRenderingConfigJson into a version without and with questions
This commit is contained in:
parent
c89bb32c61
commit
9f81628f64
12 changed files with 544 additions and 2348 deletions
|
|
@ -6,6 +6,8 @@ import UnitConfigJson from "./UnitConfigJson";
|
|||
import MoveConfigJson from "./MoveConfigJson";
|
||||
import PointRenderingConfigJson from "./PointRenderingConfigJson";
|
||||
import LineRenderingConfigJson from "./LineRenderingConfigJson";
|
||||
import {QuestionableTagRenderingConfigJson} from "./QuestionableTagRenderingConfigJson";
|
||||
import RewritableConfigJson from "./RewritableConfigJson";
|
||||
|
||||
/**
|
||||
* Configuration for a single layer
|
||||
|
|
@ -40,7 +42,7 @@ export interface LayerConfigJson {
|
|||
* Every source _must_ define which tags _must_ be present in order to be picked up.
|
||||
*
|
||||
*/
|
||||
source:
|
||||
source:
|
||||
({
|
||||
/**
|
||||
* Every source must set which tags have to be present in order to load the given layer.
|
||||
|
|
@ -58,40 +60,40 @@ export interface LayerConfigJson {
|
|||
*/
|
||||
overpassScript?: string
|
||||
} |
|
||||
{
|
||||
/**
|
||||
* The actual source of the data to load, if loaded via geojson.
|
||||
*
|
||||
* # A single geojson-file
|
||||
* source: {geoJson: "https://my.source.net/some-geo-data.geojson"}
|
||||
* fetches a geojson from a third party source
|
||||
*
|
||||
* # A tiled geojson source
|
||||
* source: {geoJson: "https://my.source.net/some-tile-geojson-{layer}-{z}-{x}-{y}.geojson", geoJsonZoomLevel: 14}
|
||||
* to use a tiled geojson source. The web server must offer multiple geojsons. {z}, {x} and {y} are substituted by the location; {layer} is substituted with the id of the loaded layer
|
||||
*
|
||||
* Some API's use a BBOX instead of a tile, this can be used by specifying {y_min}, {y_max}, {x_min} and {x_max}
|
||||
*/
|
||||
geoJson: string,
|
||||
/**
|
||||
* To load a tiled geojson layer, set the zoomlevel of the tiles
|
||||
*/
|
||||
geoJsonZoomLevel?: number,
|
||||
/**
|
||||
* Indicates that the upstream geojson data is OSM-derived.
|
||||
* Useful for e.g. merging or for scripts generating this cache
|
||||
*/
|
||||
isOsmCache?: boolean,
|
||||
/**
|
||||
* Some API's use a mercator-projection (EPSG:900913) instead of WGS84. Set the flag `mercatorCrs: true` in the source for this
|
||||
*/
|
||||
mercatorCrs?: boolean,
|
||||
/**
|
||||
* Some API's have an id-field, but give it a different name.
|
||||
* Setting this key will rename this field into 'id'
|
||||
*/
|
||||
idKey?: string
|
||||
})
|
||||
{
|
||||
/**
|
||||
* The actual source of the data to load, if loaded via geojson.
|
||||
*
|
||||
* # A single geojson-file
|
||||
* source: {geoJson: "https://my.source.net/some-geo-data.geojson"}
|
||||
* fetches a geojson from a third party source
|
||||
*
|
||||
* # A tiled geojson source
|
||||
* source: {geoJson: "https://my.source.net/some-tile-geojson-{layer}-{z}-{x}-{y}.geojson", geoJsonZoomLevel: 14}
|
||||
* to use a tiled geojson source. The web server must offer multiple geojsons. {z}, {x} and {y} are substituted by the location; {layer} is substituted with the id of the loaded layer
|
||||
*
|
||||
* Some API's use a BBOX instead of a tile, this can be used by specifying {y_min}, {y_max}, {x_min} and {x_max}
|
||||
*/
|
||||
geoJson: string,
|
||||
/**
|
||||
* To load a tiled geojson layer, set the zoomlevel of the tiles
|
||||
*/
|
||||
geoJsonZoomLevel?: number,
|
||||
/**
|
||||
* Indicates that the upstream geojson data is OSM-derived.
|
||||
* Useful for e.g. merging or for scripts generating this cache
|
||||
*/
|
||||
isOsmCache?: boolean,
|
||||
/**
|
||||
* Some API's use a mercator-projection (EPSG:900913) instead of WGS84. Set the flag `mercatorCrs: true` in the source for this
|
||||
*/
|
||||
mercatorCrs?: boolean,
|
||||
/**
|
||||
* Some API's have an id-field, but give it a different name.
|
||||
* Setting this key will rename this field into 'id'
|
||||
*/
|
||||
idKey?: string
|
||||
})
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -174,7 +176,9 @@ export interface LayerConfigJson {
|
|||
*/
|
||||
titleIcons?: (string | TagRenderingConfigJson)[] | ["defaults"];
|
||||
|
||||
|
||||
/**
|
||||
* Visualisation of the items on the map
|
||||
*/
|
||||
mapRendering: null | (PointRenderingConfigJson | LineRenderingConfigJson)[]
|
||||
|
||||
/**
|
||||
|
|
@ -260,13 +264,12 @@ export interface LayerConfigJson {
|
|||
* This is mainly create questions for a 'left' and a 'right' side of the road.
|
||||
* These will be grouped and questions will be asked together
|
||||
*/
|
||||
tagRenderings?: (string | { builtin: string, override: any } | TagRenderingConfigJson | {
|
||||
rewrite: {
|
||||
sourceString: string[],
|
||||
into: (string | any)[][]
|
||||
},
|
||||
renderings: (string | { builtin: string, override: any } | TagRenderingConfigJson)[]
|
||||
}) [],
|
||||
tagRenderings?:
|
||||
(string
|
||||
| { builtin: string, override: any }
|
||||
| QuestionableTagRenderingConfigJson
|
||||
| RewritableConfigJson<(string | { builtin: string, override: any } | QuestionableTagRenderingConfigJson)[]>
|
||||
) [],
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -401,7 +404,7 @@ export interface LayerConfigJson {
|
|||
|
||||
/**
|
||||
* If set, synchronizes wether or not this layer is selected.
|
||||
*
|
||||
*
|
||||
* no: Do not sync at all, always revert to default
|
||||
* local: keep selection on local storage
|
||||
* theme-only: sync via OSM, but this layer will only be toggled in this theme
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue