![]() |
TinkerCell Core 1.0
TinkerCell's Core library providing all basic functionalities
|
A graphics nodes item that draws connection between two or more nodes and the arrow heads at the ends. More...
#include <ConnectionGraphicsItem.h>
Classes | |
class | ControlPoint |
A control point with a pointer to a ConnectionGraphicsItem. More... | |
class | CurveSegment |
A set of control points and two arrow heads. More... | |
Public Types | |
enum | LineType { line, bezier } |
line or beizier More... | |
enum | { Type = UserType + 5 } |
for enabling dynamic_cast More... | |
Public Member Functions | |
ConnectionGraphicsItem (QGraphicsItem *parent=0) | |
ConnectionGraphicsItem (const QList< NodeGraphicsItem * > &, const QList< NodeGraphicsItem * > &, QGraphicsItem *parent=0) | |
ConnectionGraphicsItem (const ConnectionGraphicsItem ©) | |
virtual ConnectionGraphicsItem & | operator= (const ConnectionGraphicsItem ©) |
virtual ConnectionGraphicsItem & | copyPoints (const ConnectionGraphicsItem ©) |
virtual ConnectionGraphicsItem * | clone () const |
make a copy of this connection item | |
virtual bool | isValid () |
returns the bounding rectangle for this reaction figure | |
virtual ItemHandle * | handle () const |
get the handle of this connection | |
virtual void | setHandle (ItemHandle *) |
set the handle of this connection | |
virtual QList< ControlPoint * > | controlPoints (bool includeEnds=false) const |
list of pointers to all the control points | |
virtual QList< QGraphicsItem * > | controlPointsAsGraphicsItems (bool includeEnds=false) const |
list of pointers to all the control points | |
virtual QPainterPath | shape () const |
gets a path that represents this reaction | |
virtual void | setPath (const QPainterPath &path) |
set the path for this connection | |
virtual void | clear (bool all=false) |
Clear all shapes and control points. | |
virtual void | refresh (bool arrows=true) |
refresh the path if any controlpoints have moved | |
virtual void | setPen (QPen pen, bool permanently=false) |
set the color and line width for drawing this connection | |
virtual QPen | pen () const |
get the pen currently being used to draw this connection | |
virtual void | setControlPointsVisible (bool visible=true) |
set visibility of control points | |
void | showControlPoints () |
show control points. same as setControlPointsVisible(true) | |
void | hideControlPoints () |
hide control points. same as setControlPointsVisible(false) | |
virtual bool | isModifier () const |
check is this connection represents a modifier, i.e. points to the centerRegion of another connection | |
virtual QList< NodeGraphicsItem * > | nodes () const |
get all nodes that are connected | |
virtual QList< NodeGraphicsItem * > | nodesWithArrows () const |
get all nodes that have an arrow pointing to them | |
virtual QList< NodeGraphicsItem * > | nodesWithoutArrows () const |
get all nodes that do NOT have an arrow pointing to them | |
virtual QList< NodeGraphicsItem * > | nodesDisconnected () const |
get all nodes that are not directle connected to the main connection, such as modifier nodes | |
virtual QList< QGraphicsItem * > | nodesAsGraphicsItems () const |
get all nodes that are connected | |
virtual QList< ArrowHeadItem * > | arrowHeads () const |
get all the arrowHeads associated with the nodes. The order is the same order as nodes(), so values can be 0 | |
virtual QList< QGraphicsItem * > | arrowHeadsAsGraphicsItems () const |
get all the arrowHeads associated with the nodes The order is the same order as nodes(), so values can be 0 | |
virtual QList< ArrowHeadItem * > | modifierArrowHeads () const |
get all the arrowHeads NOT associated with the nodes | |
virtual NodeGraphicsItem * | nodeAt (int index) const |
get the node that connected to the particular path | |
virtual int | indexOf (QGraphicsItem *node) const |
get the index of the node | |
virtual void | replaceNodeAt (int, NodeGraphicsItem *) |
replace the node at the particular position with a new node | |
virtual void | replaceNode (NodeGraphicsItem *, NodeGraphicsItem *) |
replace one node in the reaction with another | |
virtual ArrowHeadItem * | arrowAt (int index) const |
get the arrow head at the particular index | |
virtual ArrowHeadItem * | modifierArrowAt (int index) const |
get the modifier arrow head at the particular index | |
virtual | ~ConnectionGraphicsItem () |
virtual qreal | slopeAtPoint (const QPointF &point) |
get slope at the given point (or closest point) | |
virtual ControlPoint * | centerPoint () const |
the center point (if one exists) | |
virtual QPointF | centerLocation () const |
the center point (if one exists) | |
virtual QRectF | boundingRect () const |
bounding rect | |
virtual QRectF | sceneBoundingRect () const |
scene bounding rect | |
virtual int | type () const |
for enabling dynamic_cast | |
Static Public Member Functions | |
static ConnectionGraphicsItem * | cast (QGraphicsItem *) |
cast a graphics item to a connection graphics item using qgraphicsitem_cast | |
static QList < ConnectionGraphicsItem * > | cast (const QList< QGraphicsItem * > &) |
cast a list of graphics item to a list of connection graphics items using qgraphicsitem_cast | |
static ConnectionGraphicsItem * | topLevelConnectionItem (QGraphicsItem *item, bool includeControlPoints=false) |
gets the connection graphics item from its child item | |
Public Attributes | |
QString | name |
just a name used identifying the connection | |
QString | className |
used for checking type before static casts | |
QPen | defaultPen |
permanent pen for this control point | |
QString | groupID |
for identifying which scene this item belongs in | |
LineType | lineType |
type of line for this reaction - line or beizier | |
QList< CurveSegment > | curveSegments |
vector of vector of control point | |
qreal | arrowHeadDistance |
distance from arrow head to the item that it is connected to | |
bool | controlPointsVisible |
indicates whether to show lines around the curves | |
QSizeF | centerRegion |
a rectangle that sits at the center of the connector | |
ArrowHeadItem * | centerRegionItem |
the image on the rectangle that sits at the center of the connector | |
Static Public Attributes | |
static const QString | CLASSNAME = QString("ConnectionGraphicsItem") |
used for checking type before static casts | |
static QString | DefaultMiddleItemFile |
used to initialize the middle item for a connection | |
static QString | DefaultArrowHeadFile |
used to initialize the arrow heads for a connection | |
static const int | numLineTypes = 2 |
number of different type of shapes available | |
Protected Member Functions | |
virtual void | refreshBoundaryPath () |
update the boundary path | |
virtual void | adjustEndPoints (bool arrows=true) |
adjust the end control points so that they point straight | |
Protected Attributes | |
ItemHandle * | itemHandle |
Tinkercell object that this drawable belongs in. | |
QGraphicsPathItem * | boundaryPathItem |
path for drawing the boundary region | |
QGraphicsPathItem * | outerPathItem |
path of the outline (usually white) | |
QGraphicsPathItem * | mainPathItem |
path of the main curve | |
QPainterPath | pathShape |
path of the selection region of the entire connection | |
QRectF | pathBoundingRect |
the boundary rectangle for this path. It is recomputed during each refresh. |
A graphics nodes item that draws connection between two or more nodes and the arrow heads at the ends.
Definition at line 99 of file ConnectionGraphicsItem.h.
anonymous enum |
Tinkercell::ConnectionGraphicsItem::ConnectionGraphicsItem | ( | QGraphicsItem * | parent = 0 | ) |
Constructor: does nothing
Constructor: initialize everything
Definition at line 150 of file ConnectionGraphicsItem.cpp.
Tinkercell::ConnectionGraphicsItem::ConnectionGraphicsItem | ( | const QList< NodeGraphicsItem * > & | from, |
const QList< NodeGraphicsItem * > & | to, | ||
QGraphicsItem * | parent = 0 |
||
) |
Constructor: constructs linear curve segments with arrow heads on the second set of nodes
QList<NodeGraphicsItem*> | list of nodes to connect from (no arrow heads) |
QList<NodeGraphicsItem*> | list of nodes to connect to (have arrow heads) |
Definition at line 1924 of file ConnectionGraphicsItem.cpp.
Tinkercell::ConnectionGraphicsItem::ConnectionGraphicsItem | ( | const ConnectionGraphicsItem & | copy | ) |
Copy Constructor: copies handle but not control points
Copy Constructor: deep copy of all pointers
Definition at line 192 of file ConnectionGraphicsItem.cpp.
Tinkercell::ConnectionGraphicsItem::~ConnectionGraphicsItem | ( | ) | [virtual] |
Destructor: deletes all control points
Destructor: deletes all shapes and control points
Definition at line 485 of file ConnectionGraphicsItem.cpp.
void Tinkercell::ConnectionGraphicsItem::adjustEndPoints | ( | bool | arrowTransform = true | ) | [protected, virtual] |
adjust the end control points so that they point straight
bool | adjust arrow transformations |
void |
Definition at line 653 of file ConnectionGraphicsItem.cpp.
ArrowHeadItem * Tinkercell::ConnectionGraphicsItem::arrowAt | ( | int | index | ) | const [virtual] |
get the arrow head at the particular index
find the arrow head at the particular index
index | less than size of curveSegments |
Definition at line 1662 of file ConnectionGraphicsItem.cpp.
QList< ArrowHeadItem * > Tinkercell::ConnectionGraphicsItem::arrowHeads | ( | ) | const [virtual] |
get all the arrowHeads associated with the nodes. The order is the same order as nodes(), so values can be 0
get all the arrow heads in the same order as nodes
Definition at line 1511 of file ConnectionGraphicsItem.cpp.
QList< QGraphicsItem * > Tinkercell::ConnectionGraphicsItem::arrowHeadsAsGraphicsItems | ( | ) | const [virtual] |
get all the arrowHeads associated with the nodes The order is the same order as nodes(), so values can be 0
get all the arrow heads in the same order as nodes
Definition at line 1535 of file ConnectionGraphicsItem.cpp.
QRectF Tinkercell::ConnectionGraphicsItem::boundingRect | ( | ) | const [virtual] |
bounding rect
Definition at line 1296 of file ConnectionGraphicsItem.cpp.
QList< ConnectionGraphicsItem * > Tinkercell::ConnectionGraphicsItem::cast | ( | const QList< QGraphicsItem * > & | list | ) | [static] |
cast a list of graphics item to a list of connection graphics items using qgraphicsitem_cast
QList<QGraphicsItem*> | graphics items |
Definition at line 1913 of file ConnectionGraphicsItem.cpp.
ConnectionGraphicsItem * Tinkercell::ConnectionGraphicsItem::cast | ( | QGraphicsItem * | q | ) | [static] |
cast a graphics item to a connection graphics item using qgraphicsitem_cast
QGraphicsItem* | graphics item |
Definition at line 1906 of file ConnectionGraphicsItem.cpp.
QPointF Tinkercell::ConnectionGraphicsItem::centerLocation | ( | ) | const [virtual] |
the center point (if one exists)
the center location
Definition at line 604 of file ConnectionGraphicsItem.cpp.
ConnectionGraphicsItem::ControlPoint * Tinkercell::ConnectionGraphicsItem::centerPoint | ( | ) | const [virtual] |
the center point (if one exists)
Definition at line 585 of file ConnectionGraphicsItem.cpp.
void Tinkercell::ConnectionGraphicsItem::clear | ( | bool | all = false | ) | [virtual] |
Clear all shapes and control points.
void |
Definition at line 1162 of file ConnectionGraphicsItem.cpp.
ConnectionGraphicsItem * Tinkercell::ConnectionGraphicsItem::clone | ( | ) | const [virtual] |
make a copy of this connection item
make a copy of this item
Definition at line 308 of file ConnectionGraphicsItem.cpp.
QList< ConnectionGraphicsItem::ControlPoint * > Tinkercell::ConnectionGraphicsItem::controlPoints | ( | bool | includeEnds = false | ) | const [virtual] |
list of pointers to all the control points
Definition at line 1308 of file ConnectionGraphicsItem.cpp.
QList< QGraphicsItem * > Tinkercell::ConnectionGraphicsItem::controlPointsAsGraphicsItems | ( | bool | includeEnds = false | ) | const [virtual] |
list of pointers to all the control points
Definition at line 1322 of file ConnectionGraphicsItem.cpp.
ConnectionGraphicsItem & Tinkercell::ConnectionGraphicsItem::copyPoints | ( | const ConnectionGraphicsItem & | copy | ) | [virtual] |
operator =: copy just the control point positions and pen
Definition at line 464 of file ConnectionGraphicsItem.cpp.
ItemHandle * Tinkercell::ConnectionGraphicsItem::handle | ( | ) | const [virtual] |
get the handle of this connection
Definition at line 33 of file ConnectionGraphicsItem.cpp.
void Tinkercell::ConnectionGraphicsItem::hideControlPoints | ( | ) |
hide control points. same as setControlPointsVisible(false)
Definition at line 1290 of file ConnectionGraphicsItem.cpp.
int Tinkercell::ConnectionGraphicsItem::indexOf | ( | QGraphicsItem * | target | ) | const [virtual] |
get the index of the node
find the index of the node
node | in this connection |
Definition at line 1621 of file ConnectionGraphicsItem.cpp.
bool Tinkercell::ConnectionGraphicsItem::isModifier | ( | ) | const [virtual] |
check is this connection represents a modifier, i.e. points to the centerRegion of another connection
Definition at line 1365 of file ConnectionGraphicsItem.cpp.
bool Tinkercell::ConnectionGraphicsItem::isValid | ( | ) | [virtual] |
returns the bounding rectangle for this reaction figure
checks that this is a valid drawable
paint method. Call's parent's after drawing boundary true
checks that this is a valid drawable
Definition at line 493 of file ConnectionGraphicsItem.cpp.
ArrowHeadItem * Tinkercell::ConnectionGraphicsItem::modifierArrowAt | ( | int | index | ) | const [virtual] |
get the modifier arrow head at the particular index
find the modifier arrow head at the particular index
index | less than size of curveSegments |
Definition at line 1710 of file ConnectionGraphicsItem.cpp.
QList< ArrowHeadItem * > Tinkercell::ConnectionGraphicsItem::modifierArrowHeads | ( | ) | const [virtual] |
get all the arrowHeads NOT associated with the nodes
find all the modifier arrow heads in the same order as nodes
Definition at line 1559 of file ConnectionGraphicsItem.cpp.
NodeGraphicsItem * Tinkercell::ConnectionGraphicsItem::nodeAt | ( | int | index | ) | const [virtual] |
get the node that connected to the particular path
find the node that connected to the particular path
index | less than size of curveSegments |
Definition at line 1584 of file ConnectionGraphicsItem.cpp.
QList< NodeGraphicsItem * > Tinkercell::ConnectionGraphicsItem::nodes | ( | ) | const [virtual] |
get all nodes that are connected
find all the nodes that are connected
Definition at line 1394 of file ConnectionGraphicsItem.cpp.
QList< QGraphicsItem * > Tinkercell::ConnectionGraphicsItem::nodesAsGraphicsItems | ( | ) | const [virtual] |
get all nodes that are connected
find all the nodes that are connected
Definition at line 1487 of file ConnectionGraphicsItem.cpp.
QList< NodeGraphicsItem * > Tinkercell::ConnectionGraphicsItem::nodesDisconnected | ( | ) | const [virtual] |
get all nodes that are not directle connected to the main connection, such as modifier nodes
find all the nodes that are connected
Definition at line 1467 of file ConnectionGraphicsItem.cpp.
QList< NodeGraphicsItem * > Tinkercell::ConnectionGraphicsItem::nodesWithArrows | ( | ) | const [virtual] |
get all nodes that have an arrow pointing to them
find all the nodes that are connected
Definition at line 1419 of file ConnectionGraphicsItem.cpp.
QList< NodeGraphicsItem * > Tinkercell::ConnectionGraphicsItem::nodesWithoutArrows | ( | ) | const [virtual] |
get all nodes that do NOT have an arrow pointing to them
find all the nodes that are connected
Definition at line 1443 of file ConnectionGraphicsItem.cpp.
ConnectionGraphicsItem & Tinkercell::ConnectionGraphicsItem::operator= | ( | const ConnectionGraphicsItem & | copy | ) | [virtual] |
operator =: remove everything from original connection and copy everything from the given connection
operator =: copy just the control point positions and pen
Definition at line 316 of file ConnectionGraphicsItem.cpp.
QPen Tinkercell::ConnectionGraphicsItem::pen | ( | ) | const [virtual] |
get the pen currently being used to draw this connection
Definition at line 426 of file ConnectionGraphicsItem.cpp.
void Tinkercell::ConnectionGraphicsItem::refresh | ( | bool | arrowTransform = true | ) | [virtual] |
refresh the path if any controlpoints have moved
bool | tranform arrow heads |
void |
Definition at line 945 of file ConnectionGraphicsItem.cpp.
void Tinkercell::ConnectionGraphicsItem::refreshBoundaryPath | ( | ) | [protected, virtual] |
update the boundary path
Definition at line 1133 of file ConnectionGraphicsItem.cpp.
void Tinkercell::ConnectionGraphicsItem::replaceNode | ( | NodeGraphicsItem * | oldNode, |
NodeGraphicsItem * | newNode | ||
) | [virtual] |
replace one node in the reaction with another
target | node to replace |
new | node |
Definition at line 1720 of file ConnectionGraphicsItem.cpp.
void Tinkercell::ConnectionGraphicsItem::replaceNodeAt | ( | int | index, |
NodeGraphicsItem * | nodeItem | ||
) | [virtual] |
replace the node at the particular position with a new node
index | where to insert the new node |
new | node |
Definition at line 1736 of file ConnectionGraphicsItem.cpp.
QRectF Tinkercell::ConnectionGraphicsItem::sceneBoundingRect | ( | ) | const [virtual] |
scene bounding rect
Definition at line 1302 of file ConnectionGraphicsItem.cpp.
void Tinkercell::ConnectionGraphicsItem::setControlPointsVisible | ( | bool | visible = true | ) | [virtual] |
set visibility of control points
visible | = true, invisible = false |
Definition at line 1248 of file ConnectionGraphicsItem.cpp.
void Tinkercell::ConnectionGraphicsItem::setHandle | ( | ItemHandle * | handle | ) | [virtual] |
set the handle of this connection
Definition at line 38 of file ConnectionGraphicsItem.cpp.
void Tinkercell::ConnectionGraphicsItem::setPath | ( | const QPainterPath & | path | ) | [virtual] |
set the path for this connection
QPainterPath | path |
Definition at line 442 of file ConnectionGraphicsItem.cpp.
void Tinkercell::ConnectionGraphicsItem::setPen | ( | QPen | pen, |
bool | permanently = false |
||
) | [virtual] |
set the color and line width for drawing this connection
QPen | pen |
bool | also set the default pen? |
Definition at line 434 of file ConnectionGraphicsItem.cpp.
QPainterPath Tinkercell::ConnectionGraphicsItem::shape | ( | ) | const [virtual] |
gets a path that represents this reaction
gets a path that is constructed by uniting all the shape paths
Definition at line 579 of file ConnectionGraphicsItem.cpp.
void Tinkercell::ConnectionGraphicsItem::showControlPoints | ( | ) |
show control points. same as setControlPointsVisible(true)
Definition at line 1285 of file ConnectionGraphicsItem.cpp.
qreal Tinkercell::ConnectionGraphicsItem::slopeAtPoint | ( | const QPointF & | point | ) | [virtual] |
get slope at the given point (or closest point)
find slope at the given point (or closest point)
Definition at line 1224 of file ConnectionGraphicsItem.cpp.
ConnectionGraphicsItem * Tinkercell::ConnectionGraphicsItem::topLevelConnectionItem | ( | QGraphicsItem * | item, |
bool | includeControlPoints = false |
||
) | [static] |
gets the connection graphics item from its child item
QGraphicsItem* | the target item |
bool | using true here will return the connection item for a control point, otherwise control points are ignored |
Definition at line 1337 of file ConnectionGraphicsItem.cpp.
virtual int Tinkercell::ConnectionGraphicsItem::type | ( | ) | const [inline, virtual] |
for enabling dynamic_cast
Definition at line 328 of file ConnectionGraphicsItem.h.
distance from arrow head to the item that it is connected to
Definition at line 217 of file ConnectionGraphicsItem.h.
QGraphicsPathItem* Tinkercell::ConnectionGraphicsItem::boundaryPathItem [protected] |
path for drawing the boundary region
Definition at line 337 of file ConnectionGraphicsItem.h.
a rectangle that sits at the center of the connector
Definition at line 318 of file ConnectionGraphicsItem.h.
the image on the rectangle that sits at the center of the connector
Definition at line 320 of file ConnectionGraphicsItem.h.
const QString Tinkercell::ConnectionGraphicsItem::CLASSNAME = QString("ConnectionGraphicsItem") [static] |
used for checking type before static casts
Definition at line 113 of file ConnectionGraphicsItem.h.
used for checking type before static casts
Definition at line 121 of file ConnectionGraphicsItem.h.
indicates whether to show lines around the curves
Definition at line 312 of file ConnectionGraphicsItem.h.
vector of vector of control point
Definition at line 215 of file ConnectionGraphicsItem.h.
QString Tinkercell::ConnectionGraphicsItem::DefaultArrowHeadFile [static] |
used to initialize the arrow heads for a connection
Definition at line 117 of file ConnectionGraphicsItem.h.
QString Tinkercell::ConnectionGraphicsItem::DefaultMiddleItemFile [static] |
used to initialize the middle item for a connection
Definition at line 115 of file ConnectionGraphicsItem.h.
permanent pen for this control point
Definition at line 123 of file ConnectionGraphicsItem.h.
for identifying which scene this item belongs in
Definition at line 153 of file ConnectionGraphicsItem.h.
ItemHandle* Tinkercell::ConnectionGraphicsItem::itemHandle [protected] |
Tinkercell object that this drawable belongs in.
Definition at line 335 of file ConnectionGraphicsItem.h.
type of line for this reaction - line or beizier
Definition at line 158 of file ConnectionGraphicsItem.h.
QGraphicsPathItem* Tinkercell::ConnectionGraphicsItem::mainPathItem [protected] |
path of the main curve
Definition at line 341 of file ConnectionGraphicsItem.h.
just a name used identifying the connection
Definition at line 119 of file ConnectionGraphicsItem.h.
const int Tinkercell::ConnectionGraphicsItem::numLineTypes = 2 [static] |
number of different type of shapes available
Definition at line 151 of file ConnectionGraphicsItem.h.
QGraphicsPathItem* Tinkercell::ConnectionGraphicsItem::outerPathItem [protected] |
path of the outline (usually white)
Definition at line 339 of file ConnectionGraphicsItem.h.
QRectF Tinkercell::ConnectionGraphicsItem::pathBoundingRect [protected] |
the boundary rectangle for this path. It is recomputed during each refresh.
Definition at line 345 of file ConnectionGraphicsItem.h.
QPainterPath Tinkercell::ConnectionGraphicsItem::pathShape [protected] |
path of the selection region of the entire connection
Definition at line 343 of file ConnectionGraphicsItem.h.