Skip to content

Commit

Permalink
updated obstacle lines to be plottet width a width
Browse files Browse the repository at this point in the history
  • Loading branch information
lausdahl committed Nov 29, 2023
1 parent ae353e5 commit eaa695b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# For a discussion on single-sourcing the version across setup.py and the
# project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='1.2.2', # Required
version='1.2.3', # Required

# This is a one-line description or tagline of what your project does. This
# corresponds to the "Summary" metadata field:
Expand Down
30 changes: 25 additions & 5 deletions src/isoxmlviz/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,16 +443,36 @@ def plot_all_lsg(ax, parent_map, web_map, ref, root, line_type_groups, gpn_filte
# patch = PatchCollection([polygon], linewidths=1, edgecolors="none", facecolor="red", alpha=0.3)
# ax.add_patch(patch)
base_line_string = LineString([(p[0], p[1]) for p in points])
patch = LineCollection([base_line_string], linewidths=1.5,
edgecolors="red", zorder=7)

if type not in line_type_groups:
line_type_groups[type] = web_map.create_group("Obstacles")
group_obstacles = line_type_groups[type]

web_map.add(base_line_string, tooltip=designator, style={'color': get_color(line.attrib, 'E', 'red')},
group=group_obstacles)
ax.add_collection(patch)
if "C" in line.attrib.keys():
# it is a polygon as a width is given
width = int(line.attrib.get("C")) / 1000 if "C" in line.attrib.keys() else 1

poly =base_line_string.parallel_offset(width /2.0, 'left',
join_style=JOIN_STYLE.mitre).union(base_line_string.parallel_offset(width /2.0, 'right',
join_style=JOIN_STYLE.mitre)).convex_hull

web_map.add(poly, tooltip=designator, style={'color': get_color(line.attrib, 'E', 'red')},
group=group_obstacles)

patch = PolygonPatch(poly, alpha=0.1, zorder=2, facecolor="red")
ax.add_patch(patch)


else:
#it is a line
patch = LineCollection([base_line_string], linewidths=1.5,
edgecolors="red", zorder=7)



web_map.add(base_line_string, tooltip=designator, style={'color': get_color(line.attrib, 'E', 'red')},
group=group_obstacles)
ax.add_collection(patch)
elif type == 3: # tramlines
color = get_color(line.attrib, 'E', 'brown')
designator = line.attrib.get("B")
Expand Down

0 comments on commit eaa695b

Please sign in to comment.