flatland.utils.graphics_pil module#
- class flatland.utils.graphics_pil.PILGL(width, height, jupyter=False, screen_width=800, screen_height=600)[source]#
Bases:
GraphicsLayer
- AGENT_LAYER = 3#
- PREDICTION_PATH_LAYER = 1#
- RAIL_LAYER = 0#
- SELECTED_AGENT_LAYER = 4#
- SELECTED_TARGET_LAYER = 5#
- TARGET_LAYER = 2#
- get_image()[source]#
return a blended / alpha composited image composed of all the layers, with layer 0 at the “back”.
- idle(seconds=1e-05)[source]#
process any display events eg redraw, resize. Return only after the given number of seconds, ie idle / loop until that number.
- plot(gX, gY, color=None, linewidth=3, layer=0, opacity=255, **kwargs)[source]#
Draw a line joining the points in gX, GY - each an
- class flatland.utils.graphics_pil.PILSVG(width, height, jupyter=False, screen_width=800, screen_height=600)[source]#
Bases:
PILGL
Note : This class should now ideally be called as PILPNG, but for backward compatibility, and to not introduce any breaking changes at this point we are sticking to the legacy name of PILSVG (when in practice we are not using SVG anymore)
- load_pngs(file_directory, rotate=False, agent_colors=False, background_image=None, whitefilter=None)[source]#
- set_agent_at(agent_idx, row, col, in_direction, out_direction, is_selected, rail_grid=None, show_debug=False, clear_debug_text=True, malfunction=False)[source]#
- set_rail_at(row, col, binary_trans, target=None, is_selected=False, rail_grid=None, num_agents=None, show_debug=True)[source]#
Set the rail at cell (row, col) to have transitions binTrans. The target argument can contain the index of the agent to indicate that agent’s target is at that cell, so that a station can be rendered in the static rail layer.