VPTissue Reference Manual
EditableCellItem.h
Go to the documentation of this file.
1 #ifndef SIMPT_EDITOR_EDITABLE_CELL_ITEM_H_INCLUDED
2 #define SIMPT_EDITOR_EDITABLE_CELL_ITEM_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 #include "editor/EditableItem.h"
23 #include "bio/Cell.h"
24 
25 #include <QGraphicsPolygonItem>
26 #include <QGraphicsScene>
27 
28 namespace SimPT_Editor {
29 
30 class EditableEdgeItem;
31 class EditableNodeItem;
32 
37 {
38  Q_OBJECT
39 public:
49  EditableCellItem(const std::list<EditableNodeItem*>& nodes, const std::list<EditableEdgeItem*>& edges, SimPT_Sim::Cell* cell);
50 
54  virtual ~EditableCellItem();
55 
61  virtual bool IsAtBoundary() const;
62 
66  SimPT_Sim::Cell* Cell() const;
67 
71  const std::list<EditableNodeItem*>& Nodes() const;
72 
76  const std::list<EditableEdgeItem*>& Edges() const;
77 
84  bool ContainsNode(EditableNodeItem* node) const;
85 
92  bool ContainsEdge(EditableEdgeItem* edge) const;
93 
99  virtual void Highlight(bool highlighted);
100 
107  void SetColor(const QColor& color);
108 
115  virtual void SetHighlightColor(const QColor& color = DEFAULT_HIGHLIGHT_COLOR);
116 
122  void SetTransparent(bool transparent);
123 
124 public slots:
133 
142 
146  void Update();
147 
148 private:
150  virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
151 
152 private:
153  SimPT_Sim::Cell* m_cell;
154  std::list<EditableEdgeItem*> m_edges;
155  std::list<EditableNodeItem*> m_nodes;
156 
157  QColor m_color;
158  QColor m_highlight_color;
159 
160 private:
161  static const QColor DEFAULT_HIGHLIGHT_COLOR;
162 };
163 
164 } // namespace
165 
166 #endif // end_of_include_guard
A cell contains walls and nodes.
Definition: Cell.h:48
Interface for an editable graphical representation.
Definition: EditableItem.h:30
Namespace for SimPT tissue editor package.
Definition: Cell.h:32
virtual void SetHighlightColor(const QColor &color=DEFAULT_HIGHLIGHT_COLOR)
Set the color the item should get when it gets highlighted.
void SetColor(const QColor &color)
Set the color of the cell.
void SetTransparent(bool transparent)
Set the transparency of a cell.
const std::list< EditableNodeItem * > & Nodes() const
Get the nodes in this cell.
const std::list< EditableEdgeItem * > & Edges() const
Get the edges in this cell.
see the online Qt documentation
void ReplaceTwoEdgesWithEdge(EditableEdgeItem *oldEdge1, EditableEdgeItem *oldEdge2, EditableEdgeItem *edge)
Replaces two given edges with one other edge.
Interface for Cell.
Editable graphical representation for Edge.
virtual bool IsAtBoundary() const
Checks whether the cell is at the boundary of the cell complex.
Editable graphical representation for Node.
EditableCellItem(const std::list< EditableNodeItem * > &nodes, const std::list< EditableEdgeItem * > &edges, SimPT_Sim::Cell *cell)
Constructor.
Editable graphical representation for Cell.
bool ContainsEdge(EditableEdgeItem *edge) const
Checks whether this cell contains the given edge.
SimPT_Sim::Cell * Cell() const
Get the logical cell.
Interface for EditableItem.
void Update()
Update the cell.
see the online Qt documentation
virtual void Highlight(bool highlighted)
Highlights the node in the canvas.
bool ContainsNode(EditableNodeItem *node) const
Checks whether this cell contains the given node.
virtual ~EditableCellItem()
Destructor.
void ReplaceEdgeWithTwoEdges(EditableEdgeItem *oldEdge, EditableEdgeItem *edge1, EditableEdgeItem *edge2)
Replaces a given edge with two other edges.