flatland.utils.editor_model module#
- class flatland.utils.editor_model.EditorModel(env, env_filename='temp.pkl')[source]#
Bases:
AbstractModel
- 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
- 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.
- 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).