Add default outlines if not set; Put outlines on top of symbol layers

This commit is contained in:
Fuhrmann 2024-12-09 11:11:49 +01:00
parent 530c3a6823
commit e8d04ada05

View file

@ -4,12 +4,13 @@ import arcpy # type: ignore
DEFAULT_LINE_WIDTH = 0.7 DEFAULT_LINE_WIDTH = 0.7
DEFAULT_COLOR = [ DEFAULT_COLOR = [
59.61, 0,
50.98, 0,
50.59, 0,
19.61, 57,
100, 100,
] ]
CODE_BLK = "BLK"
class Toolbox: class Toolbox:
@ -432,7 +433,14 @@ class FeatureRenderer:
if leg_id in outline_codes: if leg_id in outline_codes:
# Set user defined outline color # Set user defined outline color
outline_code = outline_codes[leg_id] outline_code = outline_codes[leg_id]
if (
not outline_code
) or outline_code == "#":
outline_code = CODE_BLK
color_value = get_symbol_color(outline_code) color_value = get_symbol_color(outline_code)
color = ( color = (
arcpy.cim.CreateCIMObjectFromClassName( arcpy.cim.CreateCIMObjectFromClassName(
"CIMCMYKColor", "V3" "CIMCMYKColor", "V3"
@ -477,6 +485,10 @@ class FeatureRenderer:
if leg_id in outline_codes: if leg_id in outline_codes:
# Set user defined outline color # Set user defined outline color
outline_code = outline_codes[leg_id] outline_code = outline_codes[leg_id]
if (not outline_code) or outline_code == "#":
outline_code = CODE_BLK
color_value = get_symbol_color(outline_code) color_value = get_symbol_color(outline_code)
color = arcpy.cim.CreateCIMObjectFromClassName( color = arcpy.cim.CreateCIMObjectFromClassName(
"CIMCMYKColor", "V3" "CIMCMYKColor", "V3"
@ -572,8 +584,10 @@ class FeatureRenderer:
stroke_symbol.width = stroke_symbol_props[ stroke_symbol.width = stroke_symbol_props[
leg_id leg_id
]["width"] ]["width"]
unique_value_class.symbol.symbol.symbolLayers.append(
stroke_symbol # Insert at the beginning such that it appears on top of solid fill layer
unique_value_class.symbol.symbol.symbolLayers.insert(
0, stroke_symbol
) )
# Regroup items # Regroup items