forked from MapComplete/MapComplete
Remove broken dashArray-code, add check
This commit is contained in:
parent
b4941ace8f
commit
5a93910b6e
6 changed files with 10 additions and 100 deletions
|
@ -268,42 +268,7 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"width": "8",
|
"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": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"tagRenderings": [
|
"tagRenderings": [
|
||||||
|
|
|
@ -101,33 +101,7 @@
|
||||||
"lineRendering": [
|
"lineRendering": [
|
||||||
{
|
{
|
||||||
"color": "#eaba2a",
|
"color": "#eaba2a",
|
||||||
"width": "7",
|
"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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"presets": [],
|
"presets": [],
|
||||||
|
|
|
@ -272,15 +272,6 @@
|
||||||
{
|
{
|
||||||
"#": "left",
|
"#": "left",
|
||||||
"color": "#888",
|
"color": "#888",
|
||||||
"dashArray": {
|
|
||||||
"render": "",
|
|
||||||
"mappings": [
|
|
||||||
{
|
|
||||||
"if": "sidewalk:left=",
|
|
||||||
"then": "1,12"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"width": {
|
"width": {
|
||||||
"render": 6,
|
"render": 6,
|
||||||
"mappings": [
|
"mappings": [
|
||||||
|
@ -300,15 +291,6 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"color": "#888",
|
"color": "#888",
|
||||||
"dashArray": {
|
|
||||||
"render": "",
|
|
||||||
"mappings": [
|
|
||||||
{
|
|
||||||
"if": "sidewalk:right=",
|
|
||||||
"then": "1,12"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"width": {
|
"width": {
|
||||||
"render": 6,
|
"render": 6,
|
||||||
"mappings": [
|
"mappings": [
|
||||||
|
|
|
@ -235,25 +235,6 @@
|
||||||
"then": "#f00"
|
"then": "#f00"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"dashArray": {
|
|
||||||
"render": "",
|
|
||||||
"mappings": [
|
|
||||||
{
|
|
||||||
"if": {
|
|
||||||
"and": [
|
|
||||||
"oneway=yes",
|
|
||||||
{
|
|
||||||
"or": [
|
|
||||||
"oneway:bicycle=yes",
|
|
||||||
"oneway:bicycle="
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"then": "5 6"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -20,6 +20,9 @@ export default class LineRenderingConfig extends WithContextLoader {
|
||||||
this.color = this.tr("color", "#0000ff")
|
this.color = this.tr("color", "#0000ff")
|
||||||
this.width = this.tr("width", "7")
|
this.width = this.tr("width", "7")
|
||||||
this.dashArray = json.dashArray
|
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.lineCap = this.tr("lineCap", "round")
|
||||||
this.fill = this.tr("fill", undefined)
|
this.fill = this.tr("fill", undefined)
|
||||||
this.fillColor = this.tr("fillColor", undefined)
|
this.fillColor = this.tr("fillColor", undefined)
|
||||||
|
|
|
@ -358,8 +358,13 @@ class LineRenderingLayer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this._config.dashArray) {
|
if (this._config.dashArray) {
|
||||||
|
try{
|
||||||
|
|
||||||
layer.paint["line-dasharray"] =
|
layer.paint["line-dasharray"] =
|
||||||
this._config.dashArray?.split(" ")?.map((s) => Number(s)) ?? null
|
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)
|
map.addLayer(layer)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue