flatland.utils.editor_model module#

class flatland.utils.editor_model.EditorModel(env, env_filename='temp.pkl')[source]#

Bases: AbstractModel

add_target(rc_cell)[source]#
clear()[source]#
clear_cell(cell_row_col)[source]#
clear_stroke()[source]#
click_agent(cell_row_col)[source]#

The user has clicked on a cell - * If there is an agent, select it

  • If that agent was already selected, then deselect it

  • If there is no agent selected, and no agent in the cell, create one

  • If there is an agent selected, and no agent in the cell, move the selected agent to the cell

debug(*args, **kwargs)[source]#
debug_cell(rc_cell)[source]#
debug_event(event: dict)[source]#
drag_path_element(rc_cell)[source]#

Mouse motion event handler for drawing. Only stores the row,col location of the drag, at the start, or when we enter a new cell, ie cross a boundary / transition.

find_agent_at(cell_row_col)[source]#
fix_env()[source]#
get_len_stroke()[source]#
interpolate_pair(rcLast, rc_cell)[source]#
interpolate_path(lrcPath)[source]#
load()[source]#
log(*args, **kwargs)[source]#
mod_path(bAddRemove)[source]#
mod_rail_2cells(lrcCells, bAddRemove=True, iCellToMod=0, bPop=False)[source]#

Add transitions for rail between two cells lrcCells – list of two rc cells bAddRemove – whether to add (True) or remove (False) the transition iCellToMod – the index of the cell to modify: either 0 or 1

mod_rail_3cells(lrcStroke, bAddRemove=True, bPop=True)[source]#

Add transitions for rail spanning three cells. lrcStroke – list containing “stroke” of cells across grid bAddRemove – whether to add (True) or remove (False) the transition The transition is added to or removed from the 2nd cell, consistent with entering from the 1st cell, and exiting into the 3rd. Both the forward and backward transitions are added, eg rcCells [(3,4), (2,4), (2,5)] would result in the transitions N->E and W->S in cell (2,4).

mod_rail_cell_seq(lrcStroke, bAddRemove=True)[source]#
redraw()[source]#
regenerate(method=None, nAgents=0, env=None)[source]#
reset(regenerate_schedule=False, nAgents=0)[source]#
restart_agents()[source]#
save()[source]#
save_image()[source]#
set_debug(debug)[source]#
set_debug_move(debug)[source]#
set_draw_mode(draw_mode)[source]#
set_env(env)[source]#

set a new env for the editor, used by load and regenerate.

set_filename(filename)[source]#
set_regen_height(size)[source]#
set_regen_width(size)[source]#