VPTissue Reference Manual
|
The graphical view on the tissue. More...
#include <TissueGraphicsView.h>
Public Slots | |
void | CancelAction () |
Cancel the current action. More... | |
void | CopyAttributes () |
Copy attributes action (only available in CELL mode). More... | |
void | CreateCell () |
Create a cell. | |
void | DeleteItem () |
Delete the selected item. | |
void | SetBackground () |
Opens the dialog to set the background image of the workspace. | |
void | SetDisplayModePreferences () |
Set the preferences of the display mode ('NONE'). More... | |
void | SetTransparentCells (bool transparent) |
Set background of cells transparent. More... | |
void | SplitCell () |
Split a cell through the selected nodes. More... | |
void | SplitEdge () |
Split the selected edge. More... | |
void | UpdateMovedNode () |
Update the moved node in the scene. | |
Signals | |
void | ItemsSelected (unsigned int count) |
Emitted when the selection has changed. More... | |
void | ModeChanged () |
Emitted when the mode has changed. More... | |
void | StatusInfoChanged (const std::string &info) |
Emitted when certain info about the view has changed. More... | |
Public Member Functions | |
TissueGraphicsView (QWidget *parent) | |
Constructor. More... | |
virtual | ~TissueGraphicsView () |
Destructor. | |
EditableCellItem * | AddCell (std::list< EditableNodeItem * > endpoints, std::list< EditableEdgeItem * > edges, SimPT_Sim::Cell *cell) |
Adds a cell to the scene. More... | |
EditableEdgeItem * | AddEdge (EditableNodeItem *endpoint1, EditableNodeItem *endpoint2) |
Adds an edge to the scene. More... | |
EditableNodeItem * | AddNode (SimPT_Sim::Node *node) |
Adds a node to the scene. More... | |
void | Cleanup () |
Cleans the scene. More... | |
void | GenerateRegularPattern () |
Generates a regular cell pattern in the selected cell. | |
void | GenerateVoronoiPattern () |
Generates a cell pattern using Voronoi Tesselation in the selected cell. | |
Mode | GetMode () const |
Returns the current mode. | |
SelectByIDWidget * | GetSelectByIDWidget () const |
Returns the widget for selecting items by ID. | |
void | Initialize (std::shared_ptr< EditControlLogic > tissue, Mode mode=Mode::DISPLAY) |
Adds the items in the tissue to the scene. More... | |
bool | SelectedIsAtBoundary () const |
Checks whether the selected (editable) items are at the boundary of the cell complex. More... | |
bool | SelectedIsDeletable () const |
Checks whether the selected (editable) items are deletable. More... | |
bool | SelectedIsSplitable () const |
Checks whether two selected nodes can split a single cell. More... | |
void | SetColorComponent (const boost::property_tree::ptree ¶meters) |
Set the colorizer map for coloring the cells in 'NONE'-mode. More... | |
void | SetMode (Mode mode) |
Set the editing mode of the view. More... | |
Public Member Functions inherited from SimShell::Gui::PanAndZoomView | |
PanAndZoomView (double zoomMin=0.07, double zoomMax=100.0, QWidget *parent=nullptr) | |
Constructor. More... | |
virtual | ~PanAndZoomView () |
Destructor. | |
virtual void | enterEvent (QEvent *event) |
Overriding enterEvent to grab focus when the view is entered. More... | |
virtual void | keyPressEvent (QKeyEvent *event) |
Overriding keyPressEvent to detect when control key is pressed. More... | |
virtual void | keyReleaseEvent (QKeyEvent *event) |
Overriding releasePressEvent to detect when control key is released. More... | |
void | ResetZoom () |
Resets the view to the normal zoom level. | |
void | ScaleView (double factor) |
Scales the view, bounded by the minimum and maximum zooming factor. More... | |
double | Scaling () |
Gets the current scaling of the view (assuming the view was only scaled with ScaleView() and the horizontal and vertical scaling are the same) More... | |
virtual void | wheelEvent (QWheelEvent *event) |
Overriding wheelEvent to scroll the view when control key is held down. More... | |
The graphical view on the tissue.
Definition at line 73 of file TissueGraphicsView.h.
SimPT_Editor::TissueGraphicsView::TissueGraphicsView | ( | QWidget * | parent | ) |
Constructor.
parent | The parent of this object. |
Definition at line 66 of file TissueGraphicsView.cpp.
EditableCellItem * SimPT_Editor::TissueGraphicsView::AddCell | ( | std::list< EditableNodeItem * > | endpoints, |
std::list< EditableEdgeItem * > | edges, | ||
SimPT_Sim::Cell * | cell | ||
) |
Adds a cell to the scene.
The endpoints should be listed in order of connection.
endpoints | The endpoints of the cell. |
edges | The edges of the cell. |
cell | The logical representation of the cell. |
Definition at line 207 of file TissueGraphicsView.cpp.
References SimPT_Editor::EditableCellItem::SetTransparent().
Referenced by Initialize().
EditableEdgeItem * SimPT_Editor::TissueGraphicsView::AddEdge | ( | EditableNodeItem * | endpoint1, |
EditableNodeItem * | endpoint2 | ||
) |
Adds an edge to the scene.
Remember that the order of the endpoints doesn't matter.
endpoint1 | The first endpoint of the edge. |
endpoint2 | The second endpoint of the edge. |
Definition at line 216 of file TissueGraphicsView.cpp.
Referenced by Initialize().
EditableNodeItem * SimPT_Editor::TissueGraphicsView::AddNode | ( | SimPT_Sim::Node * | node | ) |
Adds a node to the scene.
node | The logical representation of the node. |
Definition at line 224 of file TissueGraphicsView.cpp.
Referenced by Initialize(), and SplitEdge().
|
slot |
Cancel the current action.
(only available in CELL_CREATE and CELL_SLICE mode)
Definition at line 375 of file TissueGraphicsView.cpp.
References ItemsSelected(), and ModeChanged().
void SimPT_Editor::TissueGraphicsView::Cleanup | ( | ) |
Cleans the scene.
The background image is kept, as the scene isn't its owner.
Definition at line 353 of file TissueGraphicsView.cpp.
References SetMode().
Referenced by Initialize(), and ~TissueGraphicsView().
|
slot |
Copy attributes action (only available in CELL mode).
The user will be asked to give a source cell and attributes. Those attributes will be copied to the selected cells.
Definition at line 416 of file TissueGraphicsView.cpp.
References SetMode().
void SimPT_Editor::TissueGraphicsView::Initialize | ( | std::shared_ptr< EditControlLogic > | tissue, |
Mode | mode = Mode::DISPLAY |
||
) |
Adds the items in the tissue to the scene.
tissue | The given tissue. |
mode | The mode which the view will be initialized with. (default = DISPLAY) |
Definition at line 102 of file TissueGraphicsView.cpp.
References AddCell(), AddEdge(), AddNode(), Cleanup(), SimPT_Sim::Container::make_const_circular(), SimPT_Sim::Container::next(), SetMode(), SetTransparentCells(), StatusInfoChanged(), and UpdateMovedNode().
Referenced by GenerateRegularPattern(), GenerateVoronoiPattern(), and SplitCell().
|
signal |
Emitted when the selection has changed.
(only emitted when in a global mode [NODE, EDGE or CELL]).
unsigned | int The number of items selected. |
Referenced by CancelAction().
|
signal |
Emitted when the mode has changed.
(only emitted when changed to a global mode [NODE, EDGE or CELL]).
Referenced by CancelAction(), and SetMode().
bool SimPT_Editor::TissueGraphicsView::SelectedIsAtBoundary | ( | ) | const |
Checks whether the selected (editable) items are at the boundary of the cell complex.
Definition at line 144 of file TissueGraphicsView.cpp.
References SimPT_Editor::EditableItem::IsAtBoundary().
Referenced by SimPT_Editor::EditorActions::ItemsSelected().
bool SimPT_Editor::TissueGraphicsView::SelectedIsDeletable | ( | ) | const |
Checks whether the selected (editable) items are deletable.
A cell or node is deletable if they are respectively at the boundary and of degree two in a cell with more than 3 nodes.
Definition at line 161 of file TissueGraphicsView.cpp.
References SimPT_Editor::EditableCellItem::Cell(), and SimPT_Editor::EditableNodeItem::Node().
Referenced by SimPT_Editor::EditorActions::ItemsSelected().
bool SimPT_Editor::TissueGraphicsView::SelectedIsSplitable | ( | ) | const |
Checks whether two selected nodes can split a single cell.
This means the nodes shouldn't be directly adjacent, but still should be part of the same cell (excluding the boundary polygon).
Definition at line 193 of file TissueGraphicsView.cpp.
References SimPT_Editor::EditableNodeItem::Node().
Referenced by SimPT_Editor::EditorActions::ItemsSelected().
void SimPT_Editor::TissueGraphicsView::SetColorComponent | ( | const boost::property_tree::ptree & | parameters | ) |
Set the colorizer map for coloring the cells in 'NONE'-mode.
parameters | The parameters to initialize the colorizer map. |
Definition at line 346 of file TissueGraphicsView.cpp.
References SimPT_Sim::ComponentFactoryProxy::Create().
|
slot |
Set the preferences of the display mode ('NONE').
The selected preference will determine the coloring of the cells in this mode.
Definition at line 516 of file TissueGraphicsView.cpp.
References SetMode().
void SimPT_Editor::TissueGraphicsView::SetMode | ( | Mode | mode | ) |
Set the editing mode of the view.
Invariant: When the mode is set, only items of the corresponding type can be selected.
Definition at line 241 of file TissueGraphicsView.cpp.
References ModeChanged(), SimPT_Editor::SelectByIDWidget::SetMaxID(), and StatusInfoChanged().
Referenced by Cleanup(), CopyAttributes(), CreateCell(), Initialize(), and SetDisplayModePreferences().
|
slot |
Set background of cells transparent.
transparent | True if the cells should be transparent. |
Definition at line 536 of file TissueGraphicsView.cpp.
Referenced by Initialize().
|
slot |
Split a cell through the selected nodes.
(only available in NODE mode)
Definition at line 485 of file TissueGraphicsView.cpp.
References Initialize(), and SimPT_Editor::EditableNodeItem::Node().
|
slot |
Split the selected edge.
(only available in EDGE mode)
Definition at line 459 of file TissueGraphicsView.cpp.
References AddNode().
|
signal |
Emitted when certain info about the view has changed.
This includes the four basic modes ('DISPLAY', 'NODE', 'EDGE', 'CELL').
info | The information in string form. |
Referenced by Initialize(), and SetMode().