Skip to content

Commit

Permalink
Merge pull request #173 from MIERUNE/fix/custom-dashed-pattern
Browse files Browse the repository at this point in the history
Handle custom dash pattern
  • Loading branch information
nbayashi authored Jun 6, 2024
2 parents f5f364d + b83cdfe commit 700f9d2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion translator/vector/symbol/penstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def _get_penstyle_from_line(symbol_layer: QgsLineSymbolLayer) -> dict:
convert_to_point(dash_value, symbol_layer.customDashPatternUnit())
for dash_value in symbol_layer.customDashVector()
]

else:
# preset dash pattern: each value is multiplier to width
dash_pattern_mul = PRESET_DASHPATTERN_MULTIPLIER.get(
Expand All @@ -137,6 +138,14 @@ def _get_penstyle_from_line(symbol_layer: QgsLineSymbolLayer) -> dict:
for dash_value in dash_pattern_mul
]

penstyle["dash_pattern"] = dash_pattern
elif penstyle["stroke"] == "solid" and symbol_layer.useCustomDashPattern():
# customized patterns occurs NOT with dash strole but solid stroke
penstyle["stroke"] = "dash"
dash_pattern = [
convert_to_point(dash_value, symbol_layer.customDashPatternUnit())
for dash_value in symbol_layer.customDashVector()
]

penstyle["dash_pattern"] = dash_pattern

return penstyle

0 comments on commit 700f9d2

Please sign in to comment.