diff --git a/Models/ThemeConfig/Json/LayerConfigJson.ts b/Models/ThemeConfig/Json/LayerConfigJson.ts index eefd18085..6c6bc107a 100644 --- a/Models/ThemeConfig/Json/LayerConfigJson.ts +++ b/Models/ThemeConfig/Json/LayerConfigJson.ts @@ -5,6 +5,7 @@ import {DeleteConfigJson} from "./DeleteConfigJson"; import UnitConfigJson from "./UnitConfigJson"; import MoveConfigJson from "./MoveConfigJson"; import PointRenderingConfigJson from "./PointRenderingConfigJson"; +import LineRenderingConfigJson from "./LineRenderingConfigJson"; /** * Configuration for a single layer @@ -121,24 +122,8 @@ export interface LayerConfigJson { titleIcons?: (string | TagRenderingConfigJson)[]; - mapRendering: PointRenderingConfigJson[] + mapRendering: (PointRenderingConfigJson | LineRenderingConfigJson)[] - /** - * 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 - */ - color?: string | TagRenderingConfigJson; - /** - * The stroke-width for way-elements - */ - width?: string | TagRenderingConfigJson; - - /** - * 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 /** * Wayhandling: should a way/area be displayed as: diff --git a/Models/ThemeConfig/Json/LineRenderingConfigJson.ts b/Models/ThemeConfig/Json/LineRenderingConfigJson.ts new file mode 100644 index 000000000..5330373c9 --- /dev/null +++ b/Models/ThemeConfig/Json/LineRenderingConfigJson.ts @@ -0,0 +1,30 @@ +import {TagRenderingConfigJson} from "./TagRenderingConfigJson"; +import {AndOrTagConfigJson} from "./TagConfigJson"; + +/** + * The LineRenderingConfig gives all details onto how to render a single line of a feature. + * + * This can be used if: + * + * - The feature is a line + * - The feature is an area + */ +export default interface LineRenderingConfigJson { + + /** + * 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 + */ + color?: string | TagRenderingConfigJson; + /** + * The stroke-width for way-elements + */ + width?: string | TagRenderingConfigJson; + + /** + * 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 +} \ No newline at end of file diff --git a/Models/ThemeConfig/LayerConfig.ts b/Models/ThemeConfig/LayerConfig.ts index 6241a37ff..ff3e9baca 100644 --- a/Models/ThemeConfig/LayerConfig.ts +++ b/Models/ThemeConfig/LayerConfig.ts @@ -15,6 +15,9 @@ import DeleteConfig from "./DeleteConfig"; import MoveConfig from "./MoveConfig"; import PointRenderingConfig from "./PointRenderingConfig"; import WithContextLoader from "./WithContextLoader"; +import LineRenderingConfig from "./LineRenderingConfig"; +import PointRenderingConfigJson from "./Json/PointRenderingConfigJson"; +import LineRenderingConfigJson from "./Json/LineRenderingConfigJson"; export default class LayerConfig extends WithContextLoader{ static WAYHANDLING_DEFAULT = 0; @@ -36,10 +39,8 @@ export default class LayerConfig extends WithContextLoader{ titleIcons: TagRenderingConfig[]; public readonly mapRendering: PointRenderingConfig[] + public readonly lineRendering: LineRenderingConfig[] - color: TagRenderingConfig; - width: TagRenderingConfig; - dashArray: TagRenderingConfig; wayHandling: number; public readonly units: Unit[]; public readonly deletion: DeleteConfig | null; @@ -200,8 +201,15 @@ export default class LayerConfig extends WithContextLoader{ - this.mapRendering = json.mapRendering.map((r, i) => new PointRenderingConfig(r, context+".mapRendering["+i+"]")) - + this.mapRendering = json.mapRendering + .filter(r => r["icon"] !== undefined || r["label"] !== undefined) + .map((r, i) => new PointRenderingConfig(r, context+".mapRendering["+i+"]")) + + this.lineRendering = json.mapRendering + .filter(r => r["icon"] === undefined && r["label"] === undefined) + .map((r, i) => new LineRenderingConfig(r, context+".mapRendering["+i+"]")) + + if(this.mapRendering.length > 1){ throw "Invalid maprendering for "+this.id+", currently only one mapRendering is supported!" } @@ -243,10 +251,7 @@ export default class LayerConfig extends WithContextLoader{ this.title = this.tr("title", undefined); this.isShown = this.tr("isShown", "yes"); - this.color = this.tr("color", "#0000ff"); - this.width = this.tr("width", "7"); - this.dashArray = this.tr("dashArray", ""); - + this.deletion = null; if (json.deletion === true) { json.deletion = {}; @@ -299,41 +304,12 @@ export default class LayerConfig extends WithContextLoader{ dashArray: number[]; } { - function rendernum(tr: TagRenderingConfig, deflt: number) { - const str = Number(render(tr, "" + deflt)); - const n = Number(str); - if (isNaN(n)) { - return deflt; - } - return n; - } - - function render(tr: TagRenderingConfig, deflt?: string) { - if (tags === undefined) { - return deflt - } - const str = tr?.GetRenderValue(tags.data)?.txt ?? deflt; - return Utils.SubstituteKeys(str, tags.data).replace(/{.*}/g, ""); - } - - const dashArray = render(this.dashArray)?.split(" ")?.map(Number); - let color = render(this.color, "#00f"); - - if (color.startsWith("--")) { - color = getComputedStyle(document.body).getPropertyValue( - "--catch-detail-color" - ); - } - - const weight = rendernum(this.width, 5); const icon = this.mapRendering[0].GenerateLeafletStyle(tags, clickable) - + const lineStyle = this.lineRendering[0].GenerateLeafletStyle(tags) return { icon, - color: color, - weight: weight, - dashArray: dashArray, + ...lineStyle }; } diff --git a/Models/ThemeConfig/LineRenderingConfig.ts b/Models/ThemeConfig/LineRenderingConfig.ts new file mode 100644 index 000000000..f1656c725 --- /dev/null +++ b/Models/ThemeConfig/LineRenderingConfig.ts @@ -0,0 +1,66 @@ +import PointRenderingConfigJson from "./Json/PointRenderingConfigJson"; +import WithContextLoader from "./WithContextLoader"; +import {UIEventSource} from "../../Logic/UIEventSource"; +import TagRenderingConfig from "./TagRenderingConfig"; +import {Utils} from "../../Utils"; +import LineRenderingConfigJson from "./Json/LineRenderingConfigJson"; + +export default class LineRenderingConfig extends WithContextLoader { + + + public readonly color: TagRenderingConfig; + public readonly width: TagRenderingConfig; + public readonly dashArray: TagRenderingConfig; + + constructor(json: LineRenderingConfigJson, context: string) { + super(json, context) + this.color = this.tr("color", "#0000ff"); + this.width = this.tr("width", "7"); + this.dashArray = this.tr("dashArray", ""); + + } + + + public GenerateLeafletStyle( + tags: UIEventSource + ): + { + color: string, + weight: number, + dashArray: number[] + } + { + function rendernum(tr: TagRenderingConfig, deflt: number) { + const str = Number(render(tr, "" + deflt)); + const n = Number(str); + if (isNaN(n)) { + return deflt; + } + return n; + } + function render(tr: TagRenderingConfig, deflt?: string) { + if (tags === undefined) { + return deflt + } + const str = tr?.GetRenderValue(tags.data)?.txt ?? deflt; + return Utils.SubstituteKeys(str, tags.data).replace(/{.*}/g, ""); + } + + const dashArray = render(this.dashArray)?.split(" ")?.map(Number); + let color = render(this.color, "#00f"); + + if (color.startsWith("--")) { + color = getComputedStyle(document.body).getPropertyValue( + "--catch-detail-color" + ); + } + + const weight = rendernum(this.width, 5); + return { + color, + weight, + dashArray + } + } + +} \ No newline at end of file diff --git a/assets/layers/artwork/artwork.json b/assets/layers/artwork/artwork.json index 82e27e9c7..e535bab72 100644 --- a/assets/layers/artwork/artwork.json +++ b/assets/layers/artwork/artwork.json @@ -404,6 +404,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#0000ff" + }, + "width": { + "render": "10" + } } ] } \ No newline at end of file diff --git a/assets/layers/barrier/barrier.json b/assets/layers/barrier/barrier.json index 8461abce3..7df7101d4 100644 --- a/assets/layers/barrier/barrier.json +++ b/assets/layers/barrier/barrier.json @@ -330,6 +330,9 @@ "location": [ "point" ] + }, + { + "width": "5" } ] } \ No newline at end of file diff --git a/assets/layers/bench_at_pt/bench_at_pt.json b/assets/layers/bench_at_pt/bench_at_pt.json index c43ec58e6..bc15ac3ba 100644 --- a/assets/layers/bench_at_pt/bench_at_pt.json +++ b/assets/layers/bench_at_pt/bench_at_pt.json @@ -160,6 +160,14 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#00f" + }, + "width": { + "render": "8" + } } ] } \ No newline at end of file diff --git a/assets/layers/bicycle_library/bicycle_library.json b/assets/layers/bicycle_library/bicycle_library.json index 3d5dcc455..327f22c57 100644 --- a/assets/layers/bicycle_library/bicycle_library.json +++ b/assets/layers/bicycle_library/bicycle_library.json @@ -312,6 +312,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#c00" + }, + "width": { + "render": "1" + } } ] } \ No newline at end of file diff --git a/assets/layers/bicycle_tube_vending_machine/bicycle_tube_vending_machine.json b/assets/layers/bicycle_tube_vending_machine/bicycle_tube_vending_machine.json index 5b44f6882..55918d203 100644 --- a/assets/layers/bicycle_tube_vending_machine/bicycle_tube_vending_machine.json +++ b/assets/layers/bicycle_tube_vending_machine/bicycle_tube_vending_machine.json @@ -299,6 +299,9 @@ "point", "centroid" ] + }, + { + "color": "#6bc4f7" } ] } \ No newline at end of file diff --git a/assets/layers/bike_cafe/bike_cafe.json b/assets/layers/bike_cafe/bike_cafe.json index 53caf147b..8c453ebad 100644 --- a/assets/layers/bike_cafe/bike_cafe.json +++ b/assets/layers/bike_cafe/bike_cafe.json @@ -378,6 +378,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#694E2D" + }, + "width": { + "render": "2" + } } ] } \ No newline at end of file diff --git a/assets/layers/bike_parking/bike_parking.json b/assets/layers/bike_parking/bike_parking.json index 94880bfe7..574a06910 100644 --- a/assets/layers/bike_parking/bike_parking.json +++ b/assets/layers/bike_parking/bike_parking.json @@ -562,6 +562,10 @@ "point", "centroid" ] + }, + { + "color": "#00f", + "width": "1" } ] } \ No newline at end of file diff --git a/assets/layers/bike_repair_station/bike_repair_station.json b/assets/layers/bike_repair_station/bike_repair_station.json index 0a44bf6ce..abf579d52 100644 --- a/assets/layers/bike_repair_station/bike_repair_station.json +++ b/assets/layers/bike_repair_station/bike_repair_station.json @@ -840,6 +840,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#00f" + }, + "width": { + "render": "1" + } } ] } \ No newline at end of file diff --git a/assets/layers/bike_shop/bike_shop.json b/assets/layers/bike_shop/bike_shop.json index ef57895f1..9f52b53ef 100644 --- a/assets/layers/bike_shop/bike_shop.json +++ b/assets/layers/bike_shop/bike_shop.json @@ -775,13 +775,19 @@ "badge": true }, { - "if": "opening_hours~*", - "then": "isOpen", + "if": "service:bicycle:pump=yes", + "then": "circle:#e2783d;./assets/layers/bike_repair_station/pump.svg", "badge": true }, { - "if": "service:bicycle:pump=yes", - "then": "circle:#e2783d;./assets/layers/bike_repair_station/pump.svg", + "if": { + "and": [ + "service:bicycle:cleaning~*" + ] + }, + "then": { + "render": "./assets/layers/bike_cleaning/bike_cleaning_icon.svg" + }, "badge": true } ], @@ -792,6 +798,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#c00" + }, + "width": { + "render": "1" + } } ] } \ No newline at end of file diff --git a/assets/layers/bike_themed_object/bike_themed_object.json b/assets/layers/bike_themed_object/bike_themed_object.json index a6653c8b7..0a7e4322b 100644 --- a/assets/layers/bike_themed_object/bike_themed_object.json +++ b/assets/layers/bike_themed_object/bike_themed_object.json @@ -82,6 +82,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#AB76D5" + }, + "width": { + "render": "2" + } } ] } \ No newline at end of file diff --git a/assets/layers/binocular/binocular.json b/assets/layers/binocular/binocular.json index 4e44ad7d9..6bbb7ca6a 100644 --- a/assets/layers/binocular/binocular.json +++ b/assets/layers/binocular/binocular.json @@ -139,6 +139,14 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#00f" + }, + "width": { + "render": "8" + } } ] } \ No newline at end of file diff --git a/assets/layers/cluster_style/cluster_style.json b/assets/layers/cluster_style/cluster_style.json index 16bd123c7..caaa33559 100644 --- a/assets/layers/cluster_style/cluster_style.json +++ b/assets/layers/cluster_style/cluster_style.json @@ -51,6 +51,28 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#3c3", + "mappings": [ + { + "if": "showCount>200", + "then": "#f33" + }, + { + "if": "showCount>100", + "then": "#c93" + }, + { + "if": "showCount>50", + "then": "#cc3" + } + ] + }, + "width": { + "render": "1" + } } ] } \ No newline at end of file diff --git a/assets/layers/crossings/crossings.json b/assets/layers/crossings/crossings.json index a4e005b6e..0f7f00600 100644 --- a/assets/layers/crossings/crossings.json +++ b/assets/layers/crossings/crossings.json @@ -351,6 +351,9 @@ "location": [ "point" ] + }, + { + "width": "5" } ] } \ No newline at end of file diff --git a/assets/layers/cycleways_and_roads/cycleways_and_roads.json b/assets/layers/cycleways_and_roads/cycleways_and_roads.json index c6eb50400..f8a58aa6a 100644 --- a/assets/layers/cycleways_and_roads/cycleways_and_roads.json +++ b/assets/layers/cycleways_and_roads/cycleways_and_roads.json @@ -1188,6 +1188,75 @@ "location": [ "point" ] + }, + { + "color": { + "render": "rgba(170, 170, 170, 0.7)", + "mappings": [ + { + "if": "highway=cycleway", + "then": "rgba(0, 189, 141, 0.7)" + }, + { + "if": "highway=path", + "then": "rgba(204, 74, 207, 0.7)" + }, + { + "if": "cycleway=track", + "then": "rgba(113, 3, 200, 0.7)" + }, + { + "if": "cycleway=shared_lane", + "then": "rgba(74, 59, 247, 0.7)" + }, + { + "if": "cycleway=lane", + "then": "rgba(254, 155, 6, 0.9)" + }, + { + "if": "cyclestreet=yes", + "then": "rgba(57, 159, 191, 0.7)" + } + ] + }, + "width": { + "render": "8" + }, + "dashArray": { + "render": "", + "mappings": [ + { + "if": { + "or": [ + "oneway=yes", + { + "or": [ + "highway=cycleway", + "highway=path" + ] + } + ] + }, + "then": "" + }, + { + "if": "cycleway=track", + "then": "" + }, + { + "if": "cycleway=shared_lane", + "then": "15 30" + }, + { + "if": "cycleway=lane", + "then": "25 15 15 15 25" + }, + { + "if": "cyclestreet=yes", + "then": "" + } + ] + } } ] } \ No newline at end of file diff --git a/assets/layers/defibrillator/defibrillator.json b/assets/layers/defibrillator/defibrillator.json index a994361e4..9b1b02f8f 100644 --- a/assets/layers/defibrillator/defibrillator.json +++ b/assets/layers/defibrillator/defibrillator.json @@ -573,6 +573,9 @@ "location": [ "point" ] + }, + { + "color": "#0000ff" } ] } \ No newline at end of file diff --git a/assets/layers/direction/direction.json b/assets/layers/direction/direction.json index cb5b8b7da..ca7b58b4c 100644 --- a/assets/layers/direction/direction.json +++ b/assets/layers/direction/direction.json @@ -64,6 +64,9 @@ "rotation": { "render": "{_direction:numerical}deg" } + }, + { + "color": "--catch-detail-color" } ] } \ No newline at end of file diff --git a/assets/layers/etymology/etymology.json b/assets/layers/etymology/etymology.json index 48cd87fe4..f914b9432 100644 --- a/assets/layers/etymology/etymology.json +++ b/assets/layers/etymology/etymology.json @@ -190,6 +190,25 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#05d7fcaa", + "mappings": [ + { + "if": { + "and": [ + "name:etymology=", + "name:etymology:wikidata=" + ] + }, + "then": "#fcca05aa" + } + ] + }, + "width": { + "render": "8" + } } ] } \ No newline at end of file diff --git a/assets/layers/grass_in_parks/grass_in_parks.json b/assets/layers/grass_in_parks/grass_in_parks.json index 321cebcb3..e95a104b1 100644 --- a/assets/layers/grass_in_parks/grass_in_parks.json +++ b/assets/layers/grass_in_parks/grass_in_parks.json @@ -60,6 +60,10 @@ "point", "centroid" ] + }, + { + "color": "#0f0", + "width": "1" } ] } \ No newline at end of file diff --git a/assets/layers/home_location/home_location.json b/assets/layers/home_location/home_location.json index 1cb233440..0fb1af576 100644 --- a/assets/layers/home_location/home_location.json +++ b/assets/layers/home_location/home_location.json @@ -25,6 +25,11 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#00f" + } } ] } \ No newline at end of file diff --git a/assets/layers/information_board/information_board.json b/assets/layers/information_board/information_board.json index 2f93526a8..630461e50 100644 --- a/assets/layers/information_board/information_board.json +++ b/assets/layers/information_board/information_board.json @@ -80,6 +80,11 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#00f" + } } ] } \ No newline at end of file diff --git a/assets/layers/map/map.json b/assets/layers/map/map.json index ca7a5c389..79e02791b 100644 --- a/assets/layers/map/map.json +++ b/assets/layers/map/map.json @@ -281,6 +281,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#00f" + }, + "width": { + "render": "8" + } } ] } \ No newline at end of file diff --git a/assets/layers/nature_reserve/nature_reserve.json b/assets/layers/nature_reserve/nature_reserve.json index 28b27071c..051cf6c4b 100644 --- a/assets/layers/nature_reserve/nature_reserve.json +++ b/assets/layers/nature_reserve/nature_reserve.json @@ -474,6 +474,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#3c3" + }, + "width": { + "render": "1" + } } ] } \ No newline at end of file diff --git a/assets/layers/play_forest/play_forest.json b/assets/layers/play_forest/play_forest.json index 257f9249c..4244e81f5 100644 --- a/assets/layers/play_forest/play_forest.json +++ b/assets/layers/play_forest/play_forest.json @@ -129,6 +129,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#007055" + }, + "width": { + "render": "2" + } } ] } \ No newline at end of file diff --git a/assets/layers/playground/playground.json b/assets/layers/playground/playground.json index eb489ed71..87dc9b3ca 100644 --- a/assets/layers/playground/playground.json +++ b/assets/layers/playground/playground.json @@ -578,6 +578,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#5dbaa9" + }, + "width": { + "render": "1" + } } ] } \ No newline at end of file diff --git a/assets/layers/public_bookcase/public_bookcase.json b/assets/layers/public_bookcase/public_bookcase.json index 3f9abe815..7011728b0 100644 --- a/assets/layers/public_bookcase/public_bookcase.json +++ b/assets/layers/public_bookcase/public_bookcase.json @@ -503,6 +503,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#0000ff" + }, + "width": { + "render": "8" + } } ] } \ No newline at end of file diff --git a/assets/layers/shops/shops.json b/assets/layers/shops/shops.json index 15ced87ad..c0761f84b 100644 --- a/assets/layers/shops/shops.json +++ b/assets/layers/shops/shops.json @@ -342,6 +342,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#00f" + }, + "width": { + "render": "8" + } } ] } \ No newline at end of file diff --git a/assets/layers/slow_roads/slow_roads.json b/assets/layers/slow_roads/slow_roads.json index f1624c853..e1c344bde 100644 --- a/assets/layers/slow_roads/slow_roads.json +++ b/assets/layers/slow_roads/slow_roads.json @@ -259,6 +259,40 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#eaba2a" + }, + "width": { + "render": "7" + }, + "dashArray": { + "render": "", + "mappings": [ + { + "if": "highway=cycleway", + "then": "" + }, + { + "if": "highway=path", + "then": "0 12" + }, + { + "if": { + "or": [ + "highway=footway", + "highway=pedestrian" + ] + }, + "then": "12 18" + }, + { + "if": "highway=living_street", + "then": "12 12 0 12" + } + ] + } } ] } \ No newline at end of file diff --git a/assets/layers/surveillance_camera/surveillance_camera.json b/assets/layers/surveillance_camera/surveillance_camera.json index e1efe7c79..f43765388 100644 --- a/assets/layers/surveillance_camera/surveillance_camera.json +++ b/assets/layers/surveillance_camera/surveillance_camera.json @@ -531,6 +531,14 @@ } ] } + }, + { + "color": { + "render": "#f00" + }, + "width": { + "render": "8" + } } ] } \ No newline at end of file diff --git a/assets/layers/trail/trail.json b/assets/layers/trail/trail.json index e7579f24b..fe3d6b84f 100644 --- a/assets/layers/trail/trail.json +++ b/assets/layers/trail/trail.json @@ -228,6 +228,23 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#335D9F", + "mappings": [ + { + "if": "colour~*", + "then": "{colour}" + } + ] + }, + "width": { + "render": "3" + }, + "dashArray": { + "render": "5 5" + } } ] } \ No newline at end of file diff --git a/assets/layers/viewpoint/viewpoint.json b/assets/layers/viewpoint/viewpoint.json index 08c05640f..0a5342709 100644 --- a/assets/layers/viewpoint/viewpoint.json +++ b/assets/layers/viewpoint/viewpoint.json @@ -78,6 +78,10 @@ "location": [ "point" ] + }, + { + "color": "#ffffff", + "width": "5" } ] } \ No newline at end of file diff --git a/assets/layers/village_green/village_green.json b/assets/layers/village_green/village_green.json index 447bfe0e9..24b12263c 100644 --- a/assets/layers/village_green/village_green.json +++ b/assets/layers/village_green/village_green.json @@ -44,6 +44,10 @@ "point", "centroid" ] + }, + { + "color": "#937f20", + "width": "1" } ] } \ No newline at end of file diff --git a/assets/layers/waste_basket/waste_basket.json b/assets/layers/waste_basket/waste_basket.json index 9172dd452..05b19dcbe 100644 --- a/assets/layers/waste_basket/waste_basket.json +++ b/assets/layers/waste_basket/waste_basket.json @@ -203,6 +203,14 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#00f" + }, + "width": { + "render": "8" + } } ] } \ No newline at end of file diff --git a/assets/themes/aed/aed_brugge.json b/assets/themes/aed/aed_brugge.json index 516569d11..0de0fcb89 100644 --- a/assets/themes/aed/aed_brugge.json +++ b/assets/themes/aed/aed_brugge.json @@ -42,6 +42,24 @@ "iconSize": "20,20,center", "tagRenderings": [ "all_tags" + ], + "mapRendering": [ + { + "icon": { + "render": "circle:red", + "mappings": [ + { + "if": "_has_closeby_feature=yes", + "then": "circle:#008000aa" + } + ] + }, + "iconSize": "20,20,center", + "location": [ + "point" + ] + }, + {} ] } ], diff --git a/assets/themes/buurtnatuur/buurtnatuur.json b/assets/themes/buurtnatuur/buurtnatuur.json index 0f1c8648a..dde19b991 100644 --- a/assets/themes/buurtnatuur/buurtnatuur.json +++ b/assets/themes/buurtnatuur/buurtnatuur.json @@ -123,6 +123,51 @@ "nl": "Voeg een ontbrekend, erkend natuurreservaat toe, bv. een gebied dat beheerd wordt door het ANB of natuurpunt" } } + ], + "mapRendering": [ + { + "icon": { + "render": "circle:#ffffff;./assets/themes/buurtnatuur/nature_reserve.svg" + }, + "iconSize": { + "render": "50,50,center" + }, + "location": [ + "point" + ] + }, + { + "color": { + "render": "#3c3", + "mappings": [ + { + "if": { + "and": [ + "name=", + "noname=", + "operator=", + "access=", + "access:description=", + "leisure=park" + ] + }, + "then": "#cc1100" + }, + { + "if": { + "and": [ + "name=", + "noname=" + ] + }, + "then": "#fccb37" + } + ] + }, + "width": { + "render": "5" + } + } ] }, { @@ -221,6 +266,38 @@ "nl": "Voeg een ontbrekend park toe" } } + ], + "mapRendering": [ + { + "icon": { + "render": "circle:#ffffff;./assets/themes/buurtnatuur/park.svg" + }, + "iconSize": { + "render": "40,40,center" + }, + "location": [ + "point" + ] + }, + { + "color": { + "render": "#3c3", + "mappings": [ + { + "if": { + "and": [ + "name=", + "noname=" + ] + }, + "then": "#fccb37" + } + ] + }, + "width": { + "render": "5" + } + } ] }, { @@ -338,6 +415,56 @@ "nl": "Voeg een ontbrekend bos toe aan de kaart" } } + ], + "mapRendering": [ + { + "icon": { + "render": "circle:#ffffff;./assets/themes/buurtnatuur/forest.svg" + }, + "iconSize": { + "render": "40,40,center" + }, + "location": [ + "point" + ] + }, + { + "color": { + "render": "#3a3", + "mappings": [ + { + "if": { + "and": [ + "operator=", + "access=", + "access:description=" + ] + }, + "then": "#cc1100" + }, + { + "if": { + "and": [ + "operator=" + ] + }, + "then": "#cccc00" + }, + { + "if": { + "and": [ + "name=", + "noname=" + ] + }, + "then": "#fccb37" + } + ] + }, + "width": { + "render": "5" + } + } ] }, "viewpoint" diff --git a/assets/themes/campersite/campersite.json b/assets/themes/campersite/campersite.json index f7d6586c6..bbc377c63 100644 --- a/assets/themes/campersite/campersite.json +++ b/assets/themes/campersite/campersite.json @@ -699,6 +699,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#00f" + }, + "width": { + "render": "8" + } } ] }, @@ -1111,6 +1119,14 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#00f" + }, + "width": { + "render": "8" + } } ] } diff --git a/assets/themes/climbing/climbing.json b/assets/themes/climbing/climbing.json index 5174911cc..7ebb37693 100644 --- a/assets/themes/climbing/climbing.json +++ b/assets/themes/climbing/climbing.json @@ -585,6 +585,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#0f0" + }, + "width": { + "render": "4" + } } ] }, @@ -868,6 +876,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#d38d5fAA" + }, + "width": { + "render": "8" + } } ] }, @@ -1005,6 +1021,14 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#ddff55AA" + }, + "width": { + "render": "2" + } } ] } diff --git a/assets/themes/cycle_highways/cycle_highways.json b/assets/themes/cycle_highways/cycle_highways.json index 01653d649..884ddf2ad 100644 --- a/assets/themes/cycle_highways/cycle_highways.json +++ b/assets/themes/cycle_highways/cycle_highways.json @@ -239,6 +239,41 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#ff7392", + "mappings": [ + { + "if": "state=", + "then": "#00acfc" + }, + { + "if": "state=temporary", + "then": "#00acfc" + } + ] + }, + "width": { + "render": "4" + }, + "dashArray": { + "render": "", + "mappings": [ + { + "if": "state=temporary", + "then": "12 10" + }, + { + "if": "note:state=has_highway_no", + "then": "0 8" + }, + { + "if": "note:state=has_highway_under_construction", + "then": "12 10" + } + ] + } } ] } diff --git a/assets/themes/cyclestreets/cyclestreets.json b/assets/themes/cyclestreets/cyclestreets.json index 9f332e157..406d7cf9a 100644 --- a/assets/themes/cyclestreets/cyclestreets.json +++ b/assets/themes/cyclestreets/cyclestreets.json @@ -84,6 +84,18 @@ "width": "10", "tagRenderings": [ "images" + ], + "mapRendering": [ + { + "icon": "./assets/themes/cyclestreets/F111.svg", + "location": [ + "point" + ] + }, + { + "color": "#0000ff", + "width": "10" + } ] }, { @@ -136,6 +148,18 @@ "width": "5", "tagRenderings": [ "images" + ], + "mapRendering": [ + { + "icon": "./assets/themes/cyclestreets/F113.svg", + "location": [ + "point" + ] + }, + { + "color": "#09f9dd", + "width": "5" + } ] }, { @@ -201,6 +225,30 @@ }, "tagRenderings": [ "images" + ], + "mapRendering": [ + { + "icon": "./assets/svg/pencil.svg", + "location": [ + "point" + ] + }, + { + "color": { + "render": "#aaaaaa", + "mappings": [ + { + "then": "#0000ff", + "if": "cyclestreet=yes" + }, + { + "then": "#09f9dd", + "if": "proposed:cyclestreet=yes" + } + ] + }, + "width": "5" + } ] } ], diff --git a/assets/themes/fruit_trees/fruit_trees.json b/assets/themes/fruit_trees/fruit_trees.json index 88b145e6b..b6af011b1 100644 --- a/assets/themes/fruit_trees/fruit_trees.json +++ b/assets/themes/fruit_trees/fruit_trees.json @@ -80,6 +80,14 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#00f" + }, + "width": { + "render": "8" + } } ] }, @@ -195,6 +203,14 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#00f" + }, + "width": { + "render": "8" + } } ] } diff --git a/assets/themes/grb.json b/assets/themes/grb.json index d279a6409..616466aea 100644 --- a/assets/themes/grb.json +++ b/assets/themes/grb.json @@ -215,6 +215,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#00f" + }, + "width": { + "render": "2" + } } ] } diff --git a/assets/themes/hackerspaces/hackerspaces.json b/assets/themes/hackerspaces/hackerspaces.json index 8744e94c9..7cad69310 100644 --- a/assets/themes/hackerspaces/hackerspaces.json +++ b/assets/themes/hackerspaces/hackerspaces.json @@ -259,6 +259,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#00f" + }, + "width": { + "render": "8" + } } ] } diff --git a/assets/themes/hailhydrant/hailhydrant.json b/assets/themes/hailhydrant/hailhydrant.json index 1481a652f..665086669 100644 --- a/assets/themes/hailhydrant/hailhydrant.json +++ b/assets/themes/hailhydrant/hailhydrant.json @@ -329,6 +329,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#00f" + }, + "width": { + "render": "8" + } } ] }, @@ -697,6 +705,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#c22" + }, + "width": { + "render": "1" + } } ] }, @@ -912,6 +928,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#00f" + }, + "width": { + "render": "1" + } } ] } diff --git a/assets/themes/postboxes/postboxes.json b/assets/themes/postboxes/postboxes.json index 6a881b29a..d8ca6024a 100644 --- a/assets/themes/postboxes/postboxes.json +++ b/assets/themes/postboxes/postboxes.json @@ -92,6 +92,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#DADADA" + }, + "width": { + "render": "1" + } } ] }, @@ -202,6 +210,14 @@ "point", "centroid" ] + }, + { + "color": { + "render": "#DADADA" + }, + "width": { + "render": "1" + } } ] } diff --git a/assets/themes/speelplekken/speelplekken.json b/assets/themes/speelplekken/speelplekken.json index 702087d8c..175f7685b 100644 --- a/assets/themes/speelplekken/speelplekken.json +++ b/assets/themes/speelplekken/speelplekken.json @@ -42,6 +42,12 @@ "location": [ "point" ] + }, + { + "color": "#444444", + "width": { + "render": "1" + } } ] }, @@ -266,6 +272,24 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#6d6", + "mappings": [ + { + "if": "color~*", + "then": "{color}" + }, + { + "if": "colour~*", + "then": "{colour}" + } + ] + }, + "width": { + "render": "9" + } } ] } diff --git a/assets/themes/uk_addresses/uk_addresses.json b/assets/themes/uk_addresses/uk_addresses.json index ee782ca10..c79225b12 100644 --- a/assets/themes/uk_addresses/uk_addresses.json +++ b/assets/themes/uk_addresses/uk_addresses.json @@ -305,6 +305,30 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#00f", + "mappings": [ + { + "if": { + "or": [ + { + "and": [ + "addr:housenumber=", + "nohousenumber!=yes" + ] + }, + "addr:street=" + ] + }, + "then": "#ff0" + } + ] + }, + "width": { + "render": "8" + } } ] }, @@ -330,6 +354,14 @@ "location": [ "point" ] + }, + { + "color": { + "render": "#ccc" + }, + "width": { + "render": "0" + } } ] } diff --git a/scripts/lint.ts b/scripts/lint.ts index 70558fa4c..771328366 100644 --- a/scripts/lint.ts +++ b/scripts/lint.ts @@ -7,6 +7,8 @@ import ScriptUtils from "./ScriptUtils"; import {writeFileSync} from "fs"; import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson"; +import LineRenderingConfig from "../Models/ThemeConfig/LineRenderingConfig"; +import LineRenderingConfigJson from "../Models/ThemeConfig/Json/LineRenderingConfigJson"; /** * In place fix @@ -26,10 +28,11 @@ function fixLayerConfig(config: LayerConfigJson): void { } } - if(config.mapRendering === undefined){ + if(config.mapRendering === undefined || true){ // This is a legacy format, lets create a pointRendering let location: ("point"|"centroid")[] = ["point"] - if(config.wayHandling === 2){ + let wayHandling: number = config.wayHandling + if(wayHandling === 2){ location = ["point", "centroid"] } config.mapRendering = [ @@ -43,6 +46,27 @@ function fixLayerConfig(config: LayerConfigJson): void { } ] + if(wayHandling !== 1){ + const lineRenderConfig = { + color: config["color"], + width: config["width"], + dashArray: config["dashArray"] + } + if(Object.keys(lineRenderConfig).length > 0){ + config.mapRendering.push(lineRenderConfig) + } + } + /*delete config["color"] + delete config["width"] + delete config["dashArray"] + + delete config["icon"] + delete config["iconOverlays"] + delete config["label"] + delete config["iconSize"] + delete config["rotation"] + */ + }