![]() |
TinkerCell Core 1.0
TinkerCell's Core library providing all basic functionalities
|
A simple figure made from one or more polygons. The class can be represented in an XML file. More...
#include <NodeGraphicsItem.h>
Classes | |
class | ControlPoint |
a control point with a pointer to a NodeGraphicsItem More... | |
class | Shape |
A closed polygon path made from arcs, lines, and beziers. More... | |
Public Types | |
enum | ShapeType { arc, line, bezier, rectangle } |
arc, line, or beizier More... | |
enum | { Type = UserType + 4 } |
for enabling dynamic_cast More... | |
Public Member Functions | |
virtual ItemHandle * | handle () const |
get the handle of this node | |
virtual void | setHandle (ItemHandle *) |
set the handle of this node | |
NodeGraphicsItem (QGraphicsItem *parent=0) | |
NodeGraphicsItem (const QString &filename, QGraphicsItem *parent=0) | |
NodeGraphicsItem (const NodeGraphicsItem ©) | |
virtual NodeGraphicsItem & | operator= (const NodeGraphicsItem ©) |
virtual NodeGraphicsItem * | clone () const |
make a copy of this node item | |
virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option=new QStyleOptionGraphicsItem(), QWidget *widget=0) |
paint method. Call's parent's paint after setting antialiasing to true | |
bool | isValid () const |
checks that this is a valid drawable | |
virtual void | addControlPoint (ControlPoint *control) |
add a new control point | |
virtual void | addShape (Shape *shape) |
add a shape to the set of shapes | |
virtual void | removeControlPoint (ControlPoint *control) |
remove a control point | |
virtual void | removeShape (Shape *shape) |
add a shape to the set of shapes | |
virtual void | setBrush (const QBrush &newBrush) |
change fill color of all shapes | |
virtual void | setAlpha (int value) |
change alpha value for brush and pen of all shapes | |
virtual void | setPen (const QPen &newPen) |
change outline color of all shapes | |
virtual void | resetBrush () |
change fill color of all shapes to the default brush | |
virtual void | resetPen () |
change outline color of all shapes to default pen | |
virtual void | resetToDefaults () |
change color, transformation, and size to defaults | |
virtual QPolygonF | polygon () const |
gets a polygon that represents this graphicsItem | |
virtual QPainterPath | shape () const |
gets a path that represents this graphicsItem | |
virtual void | refresh () |
Updates the graphicsItem by re-initializing the vector of shapes Precondition: shapes.size > 1 Postcondition: NA. | |
virtual void | normalize () |
normalizes a node graphics item so that its center is 0,0 and width*height is 10 | |
virtual void | clear () |
Clear all shapes and control points. | |
virtual QRectF | boundingRect () const |
bounding rect | |
virtual | ~NodeGraphicsItem () |
Destructor: deletes all shapes and control points. | |
virtual QList < Tinkercell::ControlPoint * > | allControlPoints () const |
all the control points that are used in this figure | |
virtual void | adjustBoundaryControlPoints () |
reset of control points that control the bounding box of this figure | |
virtual void | adjustToBoundaryControlPoints () |
set boundary to match control points that control the bounding box of this figure | |
virtual void | setBoundingRect (const QPointF &, const QPointF &) |
set the top left and bottom right corners of this node item | |
virtual void | setBoundingBoxVisible (bool visible=true, bool controlPoints=true) |
show or hide the bounding box of this figure | |
void | showBoundingBox (bool controlPoints=true) |
show the bounding box of this figure. same as setBoundingBoxVisible(true) | |
void | hideBoundingBox (bool controlPoints=true) |
hide the bounding box of this figure. same as setBoundingBoxVisible(false) | |
virtual int | type () const |
for enabling dynamic_cast | |
virtual QList < ConnectionGraphicsItem * > | connections () const |
get all the connection items linked to this node | |
virtual QList< NodeGraphicsItem * > | connectedNodes () const |
get all the nodes connected to all the connections | |
virtual QList < ConnectionGraphicsItem * > | connectionsWithArrows () const |
get all the connection items that have an arrow associated with this node | |
virtual QList < ConnectionGraphicsItem * > | connectionsWithoutArrows () const |
get all the connection items that do NOT have an arrow associated with this node | |
virtual QList < ConnectionGraphicsItem * > | connectionsDisconnected () const |
get all the connection items where this node is disconnected from the main connection, e.g. modifiers | |
virtual QList< QGraphicsItem * > | connectionsAsGraphicsItems () const |
get all the connection items linked to this node as a list of qgraphicsitems | |
virtual QList< NodeGraphicsItem * > | nodesAdjacent () const |
get all the node items that are bordering this node | |
virtual QList< NodeGraphicsItem * > | nodesUpstream () const |
get all the node items that are connected to this node directly or indirectly. only nodes that are coming in are selected (with arrows) Note: if the node contains more than one connections with arrows, this list returns one downstream path from the possible paths | |
virtual QList< NodeGraphicsItem * > | nodesDownstream () const |
get all the node items that are connected to this node directly or indirectly. only nodes that are going out are selected (without arrows) Note: if the node contains more than one connections without arrows, this list returns one downstream path from the possible paths | |
virtual QList< NodeGraphicsItem * > | nodesToLeft () const |
nodes to the left of this node in sequence | |
virtual QList< NodeGraphicsItem * > | nodesToRight () const |
nodes to the right of this node in sequence | |
virtual QList< NodeGraphicsItem * > | nodesAbove () const |
nodes above of this node in sequence | |
virtual QList< NodeGraphicsItem * > | nodesBelow () const |
nodes below of this node in sequence | |
virtual Shape * | tallestShape () const |
get the shape with greatest height inside this group graphics item | |
virtual Shape * | longestShape () const |
get the shape with greatest width inside this group graphics item | |
virtual Shape * | leftMostShape () const |
get the shape with lowest x value nside this group graphics item | |
virtual Shape * | rightMostShape () const |
get the shape with largest x value inside this group graphics item | |
virtual Shape * | topMostShape () const |
get the shape with lowest y value nside this group graphics item | |
virtual Shape * | bottomMostShape () const |
get the shape with largest y value inside this group graphics item | |
Static Public Member Functions | |
static NodeGraphicsItem * | cast (QGraphicsItem *) |
cast a graphics item to a node graphics item using qgraphicsitem_cast | |
static QList< NodeGraphicsItem * > | cast (const QList< QGraphicsItem * > &) |
cast a list of graphics item to a list of node graphics items using qgraphicsitem_cast | |
static NodeGraphicsItem * | topLevelNodeItem (QGraphicsItem *item, bool ignoreControlPoints=false) |
Gets the node item from one of its child items. | |
Public Attributes | |
QString | className |
for safe static casting | |
QString | name |
file where the graphics item is stored | |
QSizeF | defaultSize |
default size for this item | |
QVector< Shape * > | shapes |
shapes that comprise this figure | |
QVector< ControlPoint * > | controlPoints |
control points that control the shapes in this figure | |
QVector< ControlPoint * > | boundaryControlPoints |
set of control points that control the bounding box of this figure | |
QString | groupID |
for identifying which scene this item belongs in | |
Static Public Attributes | |
static const QString | CLASSNAME = QString("NodeGraphicsItem") |
for safe static casting | |
static const int | numShapeTypes = 4 |
number of different type of shapes available | |
Protected Member Functions | |
virtual void | recomputeBoundingRect () |
reconstruct bounding rect | |
virtual qreal | getPenWidthForBoundingRect () |
get pen width based on bounding rect | |
Protected Attributes | |
QRectF | boundingRectangle |
bounding rectangle for the whole group | |
ItemHandle * | itemHandle |
Tinkercell object that this drawable belongs in. | |
QGraphicsRectItem * | boundingBoxItem |
the bounding box of this figure |
A simple figure made from one or more polygons. The class can be represented in an XML file.
Definition at line 47 of file NodeGraphicsItem.h.
anonymous enum |
arc, line, or beizier
Definition at line 92 of file NodeGraphicsItem.h.
Tinkercell::NodeGraphicsItem::NodeGraphicsItem | ( | QGraphicsItem * | parent = 0 | ) |
Constructor: does nothing
Definition at line 74 of file NodeGraphicsItem.cpp.
Tinkercell::NodeGraphicsItem::NodeGraphicsItem | ( | const QString & | filename, |
QGraphicsItem * | parent = 0 |
||
) |
Construct from file using NodeGraphicsReader
Definition at line 110 of file NodeGraphicsItem.cpp.
Tinkercell::NodeGraphicsItem::NodeGraphicsItem | ( | const NodeGraphicsItem & | copy | ) |
Copy Constructor
Copy Constructor: deep copy of all pointers
copy handle
Copy control points and shapes
Definition at line 244 of file NodeGraphicsItem.cpp.
Tinkercell::NodeGraphicsItem::~NodeGraphicsItem | ( | ) | [virtual] |
Destructor: deletes all shapes and control points.
Destructor: deletes all shapes and control points
Definition at line 432 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::addControlPoint | ( | ControlPoint * | control | ) | [virtual] |
add a new control point
Definition at line 869 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::addShape | ( | Shape * | shape | ) | [virtual] |
add a shape to the set of shapes
Definition at line 982 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::adjustBoundaryControlPoints | ( | ) | [virtual] |
reset of control points that control the bounding box of this figure
Definition at line 162 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::adjustToBoundaryControlPoints | ( | ) | [virtual] |
set boundary to match control points that control the bounding box of this figure
Definition at line 489 of file NodeGraphicsItem.cpp.
QList< Tinkercell::ControlPoint * > Tinkercell::NodeGraphicsItem::allControlPoints | ( | ) | const [virtual] |
all the control points that are used in this figure
Definition at line 1585 of file NodeGraphicsItem.cpp.
NodeGraphicsItem::Shape * Tinkercell::NodeGraphicsItem::bottomMostShape | ( | ) | const [virtual] |
get the shape with largest y value inside this group graphics item
Definition at line 1575 of file NodeGraphicsItem.cpp.
QRectF Tinkercell::NodeGraphicsItem::boundingRect | ( | ) | const [virtual] |
bounding rect
Definition at line 957 of file NodeGraphicsItem.cpp.
NodeGraphicsItem * Tinkercell::NodeGraphicsItem::cast | ( | QGraphicsItem * | q | ) | [static] |
cast a graphics item to a node graphics item using qgraphicsitem_cast
QGraphicsItem* | graphics item |
Reimplemented in Tinkercell::ArrowHeadItem.
Definition at line 1598 of file NodeGraphicsItem.cpp.
QList< NodeGraphicsItem * > Tinkercell::NodeGraphicsItem::cast | ( | const QList< QGraphicsItem * > & | list | ) | [static] |
cast a list of graphics item to a list of node graphics items using qgraphicsitem_cast
QList<QGraphicsItem*> | graphics items |
Definition at line 1611 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::clear | ( | ) | [virtual] |
Clear all shapes and control points.
void |
Definition at line 1060 of file NodeGraphicsItem.cpp.
NodeGraphicsItem * Tinkercell::NodeGraphicsItem::clone | ( | ) | const [virtual] |
make a copy of this node item
make a copy of this item
Reimplemented in Tinkercell::ArrowHeadItem.
Definition at line 328 of file NodeGraphicsItem.cpp.
QList< NodeGraphicsItem * > Tinkercell::NodeGraphicsItem::connectedNodes | ( | ) | const [virtual] |
get all the nodes connected to all the connections
get all the connected nodes
Definition at line 1203 of file NodeGraphicsItem.cpp.
QList< ConnectionGraphicsItem * > Tinkercell::NodeGraphicsItem::connections | ( | ) | const [virtual] |
get all the connection items linked to this node
Definition at line 1187 of file NodeGraphicsItem.cpp.
QList< QGraphicsItem * > Tinkercell::NodeGraphicsItem::connectionsAsGraphicsItems | ( | ) | const [virtual] |
get all the connection items linked to this node as a list of qgraphicsitems
get all the connection items linked to this node
Definition at line 1271 of file NodeGraphicsItem.cpp.
QList< ConnectionGraphicsItem * > Tinkercell::NodeGraphicsItem::connectionsDisconnected | ( | ) | const [virtual] |
get all the connection items where this node is disconnected from the main connection, e.g. modifiers
get all the connection items linked to this node
Definition at line 1254 of file NodeGraphicsItem.cpp.
QList< ConnectionGraphicsItem * > Tinkercell::NodeGraphicsItem::connectionsWithArrows | ( | ) | const [virtual] |
get all the connection items that have an arrow associated with this node
get all the connection items linked to this node
Definition at line 1220 of file NodeGraphicsItem.cpp.
QList< ConnectionGraphicsItem * > Tinkercell::NodeGraphicsItem::connectionsWithoutArrows | ( | ) | const [virtual] |
get all the connection items that do NOT have an arrow associated with this node
get all the connection items linked to this node
Definition at line 1237 of file NodeGraphicsItem.cpp.
qreal Tinkercell::NodeGraphicsItem::getPenWidthForBoundingRect | ( | ) | [protected, virtual] |
get pen width based on bounding rect
Definition at line 320 of file NodeGraphicsItem.cpp.
ItemHandle * Tinkercell::NodeGraphicsItem::handle | ( | ) | const [virtual] |
get the handle of this node
Definition at line 34 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::hideBoundingBox | ( | bool | controlPoints = true | ) |
hide the bounding box of this figure. same as setBoundingBoxVisible(false)
Definition at line 238 of file NodeGraphicsItem.cpp.
bool Tinkercell::NodeGraphicsItem::isValid | ( | ) | const |
checks that this is a valid drawable
Definition at line 470 of file NodeGraphicsItem.cpp.
NodeGraphicsItem::Shape * Tinkercell::NodeGraphicsItem::leftMostShape | ( | ) | const [virtual] |
get the shape with lowest x value nside this group graphics item
Definition at line 1545 of file NodeGraphicsItem.cpp.
NodeGraphicsItem::Shape * Tinkercell::NodeGraphicsItem::longestShape | ( | ) | const [virtual] |
get the shape with greatest width inside this group graphics item
Definition at line 1525 of file NodeGraphicsItem.cpp.
QList< NodeGraphicsItem * > Tinkercell::NodeGraphicsItem::nodesAbove | ( | ) | const [virtual] |
nodes above of this node in sequence
Definition at line 1375 of file NodeGraphicsItem.cpp.
QList< NodeGraphicsItem * > Tinkercell::NodeGraphicsItem::nodesAdjacent | ( | ) | const [virtual] |
get all the node items that are bordering this node
Definition at line 1286 of file NodeGraphicsItem.cpp.
QList< NodeGraphicsItem * > Tinkercell::NodeGraphicsItem::nodesBelow | ( | ) | const [virtual] |
nodes below of this node in sequence
Definition at line 1409 of file NodeGraphicsItem.cpp.
QList< NodeGraphicsItem * > Tinkercell::NodeGraphicsItem::nodesDownstream | ( | ) | const [virtual] |
get all the node items that are connected to this node directly or indirectly. only nodes that are going out are selected (without arrows) Note: if the node contains more than one connections without arrows, this list returns one downstream path from the possible paths
Definition at line 1484 of file NodeGraphicsItem.cpp.
QList< NodeGraphicsItem * > Tinkercell::NodeGraphicsItem::nodesToLeft | ( | ) | const [virtual] |
nodes to the left of this node in sequence
Definition at line 1307 of file NodeGraphicsItem.cpp.
QList< NodeGraphicsItem * > Tinkercell::NodeGraphicsItem::nodesToRight | ( | ) | const [virtual] |
nodes to the right of this node in sequence
Definition at line 1341 of file NodeGraphicsItem.cpp.
QList< NodeGraphicsItem * > Tinkercell::NodeGraphicsItem::nodesUpstream | ( | ) | const [virtual] |
get all the node items that are connected to this node directly or indirectly. only nodes that are coming in are selected (with arrows) Note: if the node contains more than one connections with arrows, this list returns one downstream path from the possible paths
Definition at line 1443 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::normalize | ( | ) | [virtual] |
normalizes a node graphics item so that its center is 0,0 and width*height is 10
node | item pointer to normalize |
NodeImage | pointer to normalize |
Definition at line 1095 of file NodeGraphicsItem.cpp.
NodeGraphicsItem & Tinkercell::NodeGraphicsItem::operator= | ( | const NodeGraphicsItem & | copy | ) | [virtual] |
basically does the same as copy constructor
operator =: deep copy of all pointers
Copy control points and shapes
Definition at line 336 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::paint | ( | QPainter * | painter, |
const QStyleOptionGraphicsItem * | option = new QStyleOptionGraphicsItem() , |
||
QWidget * | widget = 0 |
||
) | [virtual] |
paint method. Call's parent's paint after setting antialiasing to true
Reimplemented in Tinkercell::ArrowHeadItem.
Definition at line 552 of file NodeGraphicsItem.cpp.
QPolygonF Tinkercell::NodeGraphicsItem::polygon | ( | ) | const [virtual] |
gets a polygon that represents this graphicsItem
gets a polygon that is constructed by uniting all the shapes
Definition at line 964 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::recomputeBoundingRect | ( | ) | [protected, virtual] |
reconstruct bounding rect
Definition at line 909 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::refresh | ( | ) | [virtual] |
Updates the graphicsItem by re-initializing the vector of shapes Precondition: shapes.size > 1 Postcondition: NA.
void |
Definition at line 1031 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::removeControlPoint | ( | ControlPoint * | control | ) | [virtual] |
remove a control point
Definition at line 991 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::removeShape | ( | Shape * | shape | ) | [virtual] |
add a shape to the set of shapes
Definition at line 1011 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::resetBrush | ( | ) | [virtual] |
change fill color of all shapes to the default brush
change fill color of all shapes to default
Definition at line 671 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::resetPen | ( | ) | [virtual] |
change outline color of all shapes to default pen
change outline color of all shapes to default
Definition at line 683 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::resetToDefaults | ( | ) | [virtual] |
change color, transformation, and size to defaults
change color and size to defaults
Definition at line 152 of file NodeGraphicsItem.cpp.
NodeGraphicsItem::Shape * Tinkercell::NodeGraphicsItem::rightMostShape | ( | ) | const [virtual] |
get the shape with largest x value inside this group graphics item
Definition at line 1555 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::setAlpha | ( | int | value | ) | [virtual] |
change alpha value for brush and pen of all shapes
change alpha value for brush of all shapes
Definition at line 695 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::setBoundingBoxVisible | ( | bool | visible = true , |
bool | controlPoints = true |
||
) | [virtual] |
show or hide the bounding box of this figure
Definition at line 209 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::setBoundingRect | ( | const QPointF & | p1, |
const QPointF & | p2 | ||
) | [virtual] |
set the top left and bottom right corners of this node item
Definition at line 476 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::setBrush | ( | const QBrush & | newBrush | ) | [virtual] |
change fill color of all shapes
Definition at line 647 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::setHandle | ( | ItemHandle * | handle | ) | [virtual] |
set the handle of this node
Definition at line 39 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::setPen | ( | const QPen & | newPen | ) | [virtual] |
change outline color of all shapes
Definition at line 659 of file NodeGraphicsItem.cpp.
QPainterPath Tinkercell::NodeGraphicsItem::shape | ( | ) | const [virtual] |
gets a path that represents this graphicsItem
gets a path that is constructed by uniting all the shape paths
Definition at line 973 of file NodeGraphicsItem.cpp.
void Tinkercell::NodeGraphicsItem::showBoundingBox | ( | bool | controlPoints = true | ) |
show the bounding box of this figure. same as setBoundingBoxVisible(true)
Definition at line 233 of file NodeGraphicsItem.cpp.
NodeGraphicsItem::Shape * Tinkercell::NodeGraphicsItem::tallestShape | ( | ) | const [virtual] |
get the shape with greatest height inside this group graphics item
Definition at line 1535 of file NodeGraphicsItem.cpp.
NodeGraphicsItem * Tinkercell::NodeGraphicsItem::topLevelNodeItem | ( | QGraphicsItem * | item, |
bool | ignoreControlPoints = false |
||
) | [static] |
Gets the node item from one of its child items.
gets the node graphics item from its child item
QGraphicsItem* | the target item |
bool | using true here will return the node item for a control point, otherwise control points are ignored |
Definition at line 1157 of file NodeGraphicsItem.cpp.
NodeGraphicsItem::Shape * Tinkercell::NodeGraphicsItem::topMostShape | ( | ) | const [virtual] |
get the shape with lowest y value nside this group graphics item
Definition at line 1565 of file NodeGraphicsItem.cpp.
virtual int Tinkercell::NodeGraphicsItem::type | ( | ) | const [inline, virtual] |
for enabling dynamic_cast
Reimplemented in Tinkercell::ArrowHeadItem.
Definition at line 254 of file NodeGraphicsItem.h.
set of control points that control the bounding box of this figure
Definition at line 236 of file NodeGraphicsItem.h.
QGraphicsRectItem* Tinkercell::NodeGraphicsItem::boundingBoxItem [protected] |
the bounding box of this figure
Definition at line 315 of file NodeGraphicsItem.h.
QRectF Tinkercell::NodeGraphicsItem::boundingRectangle [protected] |
bounding rectangle for the whole group
Definition at line 307 of file NodeGraphicsItem.h.
const QString Tinkercell::NodeGraphicsItem::CLASSNAME = QString("NodeGraphicsItem") [static] |
for safe static casting
Reimplemented in Tinkercell::ArrowHeadItem.
Definition at line 67 of file NodeGraphicsItem.h.
for safe static casting
Definition at line 65 of file NodeGraphicsItem.h.
control points that control the shapes in this figure
Definition at line 216 of file NodeGraphicsItem.h.
default size for this item
Definition at line 94 of file NodeGraphicsItem.h.
for identifying which scene this item belongs in
Definition at line 260 of file NodeGraphicsItem.h.
ItemHandle* Tinkercell::NodeGraphicsItem::itemHandle [protected] |
Tinkercell object that this drawable belongs in.
Definition at line 313 of file NodeGraphicsItem.h.
file where the graphics item is stored
Definition at line 74 of file NodeGraphicsItem.h.
const int Tinkercell::NodeGraphicsItem::numShapeTypes = 4 [static] |
number of different type of shapes available
Definition at line 90 of file NodeGraphicsItem.h.
QVector<Shape*> Tinkercell::NodeGraphicsItem::shapes |
shapes that comprise this figure
Definition at line 214 of file NodeGraphicsItem.h.