Add field for outline width
This commit is contained in:
parent
6c5f9a6ca0
commit
387c891134
1 changed files with 29 additions and 14 deletions
|
@ -3,7 +3,9 @@
|
|||
import arcpy # type: ignore
|
||||
|
||||
# Define constants
|
||||
DEFAULT_LINE_WIDTH = 0.7
|
||||
# 1 point = 1/72 inch
|
||||
# 1 inch = 25.4 mm
|
||||
DEFAULT_LINE_WIDTH = 0.23
|
||||
DEFAULT_COLOR = [
|
||||
0,
|
||||
0,
|
||||
|
@ -63,7 +65,7 @@ class FeatureRenderer:
|
|||
|
||||
# Define parameter for selecting a primary key
|
||||
field_param_1 = arcpy.Parameter(
|
||||
displayName="Select Primary Key Field (LEG_ID)",
|
||||
displayName="Select Primary Key Field",
|
||||
name="primary_key",
|
||||
datatype="Field",
|
||||
parameterType="Required",
|
||||
|
@ -205,6 +207,18 @@ class FeatureRenderer:
|
|||
|
||||
outline_field.parameterDependencies = [table_param.name]
|
||||
|
||||
# Define parameter for outline width
|
||||
outline_width = arcpy.Parameter(
|
||||
name="outline_width",
|
||||
displayName="Set outline width in pt",
|
||||
datatype="GPDouble",
|
||||
direction="Input",
|
||||
parameterType="Optional",
|
||||
category="Define Outlines",
|
||||
)
|
||||
|
||||
outline_field.parameterDependencies = [table_param.name]
|
||||
|
||||
# Return parameter definitions as a list
|
||||
return [
|
||||
style_files,
|
||||
|
@ -220,6 +234,7 @@ class FeatureRenderer:
|
|||
heading_field,
|
||||
draw_outlines,
|
||||
outline_field,
|
||||
outline_width,
|
||||
]
|
||||
|
||||
def isLicensed(self):
|
||||
|
@ -249,6 +264,7 @@ class FeatureRenderer:
|
|||
heading_field = parameters[10].valueAsText
|
||||
draw_outlines = parameters[11].value
|
||||
outline_field = parameters[12].valueAsText
|
||||
outline_width = parameters[13].value
|
||||
|
||||
# Retrieve currently active map
|
||||
active_map = project.activeMap
|
||||
|
@ -480,19 +496,12 @@ class FeatureRenderer:
|
|||
"color"
|
||||
] = color
|
||||
|
||||
if draw_outlines:
|
||||
# Get symbol layer line width
|
||||
if symbol_layer.width:
|
||||
# Set width as it was before
|
||||
stroke_symbol_props[leg_id][
|
||||
"width"
|
||||
] = symbol_layer.width
|
||||
else:
|
||||
# Set default width
|
||||
stroke_symbol_props[leg_id][
|
||||
"width"
|
||||
] = DEFAULT_LINE_WIDTH
|
||||
else:
|
||||
stroke_symbol_props[leg_id]["width"] = 0
|
||||
|
||||
break
|
||||
|
||||
|
@ -519,13 +528,19 @@ class FeatureRenderer:
|
|||
color.values = DEFAULT_COLOR
|
||||
stroke_symbol_props[leg_id]["color"] = color
|
||||
|
||||
if not stroke_symbol_props[leg_id]["width"]:
|
||||
if draw_outlines:
|
||||
# Set outline width
|
||||
if draw_outlines:
|
||||
if outline_width:
|
||||
stroke_symbol_props[leg_id][
|
||||
"width"
|
||||
] = DEFAULT_LINE_WIDTH
|
||||
] = outline_width
|
||||
else:
|
||||
stroke_symbol_props[leg_id]["width"] = 0
|
||||
if not stroke_symbol_props[leg_id]["width"]:
|
||||
stroke_symbol_props[leg_id][
|
||||
"width"
|
||||
] = DEFAULT_LINE_WIDTH
|
||||
else:
|
||||
stroke_symbol_props[leg_id]["width"] = 0
|
||||
|
||||
new_groups = []
|
||||
for group in cim_lyr.renderer.groups:
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue