提交 aeefb59d 编写于 作者: J jmtao 提交者: HongyiSun

tools: mapshow combine commone code

上级 60491e53
......@@ -88,24 +88,8 @@ class Map:
def _draw_lane_id(self, lane, ax, color_val):
"""draw lane id"""
labelxys = []
labelxys.append((40, -40))
labelxys.append((-40, -40))
labelxys.append((40, 40))
labelxys.append((-40, 40))
has = ['right', 'left', 'right', 'left']
vas = ['bottom', 'bottom', 'top', 'top']
idx = random.randint(0, 3)
lxy = labelxys[idx]
x, y = self._find_lane_central_point(lane)
plt.annotate(
lane.id.id,
xy=(x, y), xytext=lxy,
textcoords='offset points', ha=has[idx], va=vas[idx],
bbox=dict(boxstyle='round,pad=0.5', fc=color_val, alpha=0.5),
arrowprops=dict(arrowstyle='-|>', connectionstyle='arc3,rad=-0.2',
fc=color_val, ec=color_val, alpha=0.5))
self._draw_label(lane_id.id, (x,y), ax, color_val);
def _draw_lane_details(self, lane, ax, color_val):
"""draw lane id"""
......@@ -156,7 +140,13 @@ class Map:
cnt += 1
def _draw_pnc_junction_id(self, pnc_junction, ax, color_val):
"""draw pnc_junction id"""
x = pnc_junction.polygon.point[0].x
y = pnc_junction.polygon.point[1].y
self._draw_label(pnc_junction.id.id, (x,y), ax, color_val);
@staticmethod
def _draw_label(label_id, point, ax, color_val):
"""draw label id"""
labelxys = []
labelxys.append((40, -40))
labelxys.append((-40, -40))
......@@ -167,11 +157,9 @@ class Map:
idx = random.randint(0, 3)
lxy = labelxys[idx]
x = pnc_junction.polygon.point[0].x
y = pnc_junction.polygon.point[1].y
plt.annotate(
pnc_junction.id.id,
xy=(x, y), xytext=lxy,
label_id,
xy=(point[0], point[1]), xytext=lxy,
textcoords='offset points', ha=has[idx], va=vas[idx],
bbox=dict(boxstyle='round,pad=0.5', fc=color_val, alpha=0.5),
arrowprops=dict(arrowstyle='-|>', connectionstyle='arc3,rad=-0.2',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册