def get_intersection_image(intersection_data, alpha=1.0): """ Get an image of intersection lanes in PNG format :param intersection_data: dictionary :param alpha: transparency: between 0.0 amd 1.0 :return: matplotlib.figure.Figure """ fig, ax = plot_lanes( intersection_data['merged_lanes'], fig=None, ax=None, cropped_intersection=intersection_data['cropped_intersection'], fig_height=15, fig_width=15, axis_off=False, edge_linewidth=1, margin=0.02, bgcolor='#CCFFE5', edge_color='w', # '#FF9933',o alpha=alpha) fig, ax = plot_lanes(intersection_data['merged_tracks'], fig=fig, ax=ax, cropped_intersection=None, fig_height=15, fig_width=15, axis_off=False, edge_linewidth=1, margin=0.02, fcolor='#C0C0C0', edge_color='#000000', alpha=alpha, linestyle='solid') fig, ax = plot_lanes(intersection_data['merged_cycleways'], fig=fig, ax=ax, cropped_intersection=None, fig_height=15, fig_width=15, axis_off=False, edge_linewidth=1, margin=0.02, fcolor='#00FF00', edge_color='#00FF00', alpha=alpha, linestyle='solid') return fig
def get_guideway_image(guideways, intersection_data, fc='#FFFF66', ec='b', alpha=1.0): """ Get an image of guideways in PNG format :param guideways: list of dictionaries :param intersection_data: dictionary :param alpha: transparency: between 0.0 amd 1.0 :return: matplotlib.figure.Figure """ fig, ax = plot_lanes( intersection_data['merged_lanes'], fig=None, ax=None, cropped_intersection=intersection_data['cropped_intersection'], fig_height=15, fig_width=15, axis_off=False, edge_linewidth=1, margin=0.02, bgcolor='#CCFFE5', edge_color='#FF9933', alpha=alpha) fig, ax = plot_lanes(intersection_data['merged_tracks'], fig=fig, ax=ax, cropped_intersection=None, fig_height=15, fig_width=15, axis_off=False, edge_linewidth=1, margin=0.02, fcolor='#C0C0C0', edge_color='#000000', alpha=alpha, linestyle='solid') guideway_fig, guideway_ax = plot_guideways(guideways, fig=fig, ax=ax, alpha=alpha, fc=fc, ec=ec) return guideway_fig
def get_blind_zone_image(blind_zone, current_guideway, intersection_data, blocks=None, alpha=1.0, fc='r', ec='r'): """ Get an image of a list of conflict zones in PNG format :param blind_zone: blind zone dictionary :param current_guideway: guideway dictionary :param intersection_data: intersection dictionary :param fc: foreground color :param ec: edge color :param alpha: transparency: between 0.0 amd 1.0 :param blocks: reserved for future use :return: matplotlib.figure.Figure """ fig, ax = plot_lanes( intersection_data['merged_lanes'], fig=None, ax=None, cropped_intersection=intersection_data['cropped_intersection'], fig_height=15, fig_width=15, axis_off=False, edge_linewidth=1, margin=0.02, bgcolor='#CCFFE5', edge_color='#FF9933', alpha=alpha) fig, ax = plot_lanes(intersection_data['merged_tracks'], fig=fig, ax=ax, cropped_intersection=None, fig_height=15, fig_width=15, axis_off=False, edge_linewidth=1, margin=0.02, fcolor='#C0C0C0', edge_color='#000000', alpha=alpha, linestyle='solid') if blind_zone is None: return fig blind_zone_fig, blind_zone_ax = plot_sector( current_guideway=current_guideway, x_data=intersection_data, blocks=blocks, point_of_view=blind_zone['geo_point'], conflict_zone=blind_zone['conflict_zone'], fig=fig, ax=ax, blind_zone=blind_zone['polygon'], fc=fc, ec=ec) return blind_zone_fig