diff --git a/assets/layers/cycleways_and_roads/cycleways_and_roads.json b/assets/layers/cycleways_and_roads/cycleways_and_roads.json index 5d058b4104..805160d546 100644 --- a/assets/layers/cycleways_and_roads/cycleways_and_roads.json +++ b/assets/layers/cycleways_and_roads/cycleways_and_roads.json @@ -268,42 +268,7 @@ } ] }, - "width": "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": "" - } - ] - } + "width": "8" } ], "tagRenderings": [ diff --git a/assets/layers/slow_roads/slow_roads.json b/assets/layers/slow_roads/slow_roads.json index f14bdc3497..afb6f9763e 100644 --- a/assets/layers/slow_roads/slow_roads.json +++ b/assets/layers/slow_roads/slow_roads.json @@ -101,33 +101,7 @@ "lineRendering": [ { "color": "#eaba2a", - "width": "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" - } - ] - } + "width": "7" } ], "presets": [], diff --git a/assets/themes/sidewalks/sidewalks.json b/assets/themes/sidewalks/sidewalks.json index 459225a4a7..62e9ef6b99 100644 --- a/assets/themes/sidewalks/sidewalks.json +++ b/assets/themes/sidewalks/sidewalks.json @@ -272,15 +272,6 @@ { "#": "left", "color": "#888", - "dashArray": { - "render": "", - "mappings": [ - { - "if": "sidewalk:left=", - "then": "1,12" - } - ] - }, "width": { "render": 6, "mappings": [ @@ -300,15 +291,6 @@ }, { "color": "#888", - "dashArray": { - "render": "", - "mappings": [ - { - "if": "sidewalk:right=", - "then": "1,12" - } - ] - }, "width": { "render": 6, "mappings": [ diff --git a/assets/themes/width/width.json b/assets/themes/width/width.json index b8598267d4..e68bcce7c3 100644 --- a/assets/themes/width/width.json +++ b/assets/themes/width/width.json @@ -235,25 +235,6 @@ "then": "#f00" } ] - }, - "dashArray": { - "render": "", - "mappings": [ - { - "if": { - "and": [ - "oneway=yes", - { - "or": [ - "oneway:bicycle=yes", - "oneway:bicycle=" - ] - } - ] - }, - "then": "5 6" - } - ] } } ] diff --git a/src/Models/ThemeConfig/LineRenderingConfig.ts b/src/Models/ThemeConfig/LineRenderingConfig.ts index 57897166f6..fb59535b4e 100644 --- a/src/Models/ThemeConfig/LineRenderingConfig.ts +++ b/src/Models/ThemeConfig/LineRenderingConfig.ts @@ -20,6 +20,9 @@ export default class LineRenderingConfig extends WithContextLoader { this.color = this.tr("color", "#0000ff") this.width = this.tr("width", "7") this.dashArray = json.dashArray + if(this.dashArray !== undefined && typeof this.dashArray !== "string"){ + throw "Invalid dasharray at "+context+"; this should be a string but is a "+typeof this.dashArray + } this.lineCap = this.tr("lineCap", "round") this.fill = this.tr("fill", undefined) this.fillColor = this.tr("fillColor", undefined) diff --git a/src/UI/Map/ShowDataLayer.ts b/src/UI/Map/ShowDataLayer.ts index c542e094d7..7e86e290bc 100644 --- a/src/UI/Map/ShowDataLayer.ts +++ b/src/UI/Map/ShowDataLayer.ts @@ -358,8 +358,13 @@ class LineRenderingLayer { } } if (this._config.dashArray) { + try{ + layer.paint["line-dasharray"] = this._config.dashArray?.split(" ")?.map((s) => Number(s)) ?? null + }catch (e) { + console.error(`Invalid dasharray in layer ${this._layername}:`, this._config.dashArray) + } } map.addLayer(layer)