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", | ||||
|       "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": [ | ||||
|  |  | |||
|  | @ -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": [], | ||||
|  |  | |||
|  | @ -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": [ | ||||
|  |  | |||
|  | @ -235,25 +235,6 @@ | |||
|                 "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.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) | ||||
|  |  | |||
|  | @ -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) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue