Code Documentation 3.1
Social Network Visualizer
|
#include <graphicsedge.h>
Public Types | |
enum | { Type = UserType + 2 } |
Public Slots | |
void | adjust () |
Leaves some empty space (offset) from node - make the edge weight appear on the centre of the edge. | |
Public Member Functions | |
GraphicsEdge (GraphicsWidget *, GraphicsNode *, GraphicsNode *, const qreal &weight, const QString &label, const QString &color, const Qt::PenStyle &style, const int &type, const bool &drawArrows, const bool &bezier, const bool &weightNumbers=false, const bool &highlighting=true) | |
~GraphicsEdge () | |
** | |
int | type () const |
GraphicsNode * | sourceNode () const |
Returns the source node of this graphics edge. | |
void | setSourceNode (GraphicsNode *node) |
Sets the source node of this graphics edge. | |
GraphicsNode * | targetNode () const |
Returns the target node. | |
void | setTargetNode (GraphicsNode *node) |
Sets the target node.s. | |
int | sourceNodeNumber () |
int | targetNodeNumber () |
qreal | dx () const |
Returns the horizontal difference between target and source nodes. | |
qreal | dy () const |
Returns the vertical difference between target and source nodes. | |
qreal | length () const |
Returns the euclidean length of the edge. | |
void | setSourceNodeSize (const int &size) |
Called from graphicsNode to update edge offset from source node (i.e. when node size changes) | |
void | setTargetNodeSize (const int &size) |
Called from graphicsNode to update edge offset from target node (i.e. when node size changes) | |
void | setMinimumOffsetFromNode (const int &offset) |
Updates Minimum Offset From Node and calls adjust to update the edge. | |
void | removeRefs () |
Removes any references to this edge in source and target nodes. | |
void | setWeight (const qreal &w) |
Changes the edge weight - Updates both the width and the weightNumber. | |
qreal | weight () const |
Returns the weight/value of this edge. | |
void | addWeightNumber () |
Adds a graphics edge weight to this edge. | |
void | setWeightNumberVisibility (const bool &toggle) |
Toggles visibility of weight numbers. | |
void | setLabel (const QString &label) |
Changes the edge label. | |
QString | label () const |
Returns the edge label text. | |
void | addLabel () |
Adds a graphics edge label to this edge. | |
void | setLabelVisibility (const bool &toggle) |
Toggles the graphics edge label visibility. | |
void | showArrows (const bool &) |
Toggles displaying edge arrow. | |
void | setDirectionType (const int &dirType=0) |
Changes the direction type of edge A->B. | |
int | directionType () |
returns the direction type of this edge | |
qreal | width () const |
Returns the width of the edge as a function of edge weight. | |
QPen | pen () const |
Returns the QPen for this edge – the pen changes when the edge state changes/. | |
void | setState (const int &state) |
Sets the edge state. | |
void | setStyle (const Qt::PenStyle &style) |
Sets the PenStyle of this edge. | |
Qt::PenStyle | style () const |
Returns the PenStyle of this edge. | |
void | setColor (const QString &str) |
Sets the edge color. | |
QColor | color () const |
Returns the edge QColor. | |
QString | colorToPajek () |
Returns the edge color in pajek-accepted format. | |
void | setHighlighted (const bool &flag) |
Toggles the highlighted state of the the edge, if highlighting is allowed. | |
void | setHighlighting (const bool &toggle) |
Toggles edge highlighting on or off. | |
QPainterPath | shape () const |
Returns the shape of this edge as a QPainterPath in local coordinates. The shape is used for many things, including collision detection, hit tests, and for the QGraphicsScene::items() functions. The default implementation calls boundingRect() to return a simple rectangular shape, but we reimplement it to return a more accurate shape for non-rectangular items. | |
Protected Member Functions | |
QRectF | boundingRect () const |
Defines the outer bounds of the edge as a rectangle; All painting will be restricted to inside the edge's bounding rect. Qt uses this bounding rect to determine whether the edge requires redrawing. | |
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
Pains the edge. | |
QVariant | itemChange (GraphicsItemChange change, const QVariant &value) |
Called when the edge changes, i.e. moves, becomes disabled or changes its visibility. | |
Private Attributes | |
GraphicsWidget * | graphicsWidget |
GraphicsNode * | source |
GraphicsNode * | target |
GraphicsEdgeWeight * | weightNumber |
GraphicsEdgeLabel * | edgeLabel |
QPainterPath | m_path |
QPointF | sourcePoint |
QPointF | targetPoint |
QPointF | edgeOffset |
qreal | m_arrowSize |
qreal | m_minOffsetFromNode |
qreal | m_offsetFromTargetNode |
qreal | m_offsetFromSourceNode |
Qt::PenStyle | m_style |
int | m_state |
QString | m_colorNegative |
QString | m_label |
QColor | m_color |
qreal | m_weight |
qreal | m_width |
int | m_edgeDirType |
qreal | angle |
qreal | line_length |
qreal | line_dx |
qreal | line_dy |
bool | m_Bezier |
bool | m_drawArrows |
bool | m_drawWeightNumber |
bool | m_drawLabel |
bool | m_hoverHighlighting |
bool | m_isClicked |
SOCNETV_USE_NAMESPACE GraphicsEdge::GraphicsEdge | ( | GraphicsWidget * | gw, |
GraphicsNode * | from, | ||
GraphicsNode * | to, | ||
const qreal & | weight, | ||
const QString & | label, | ||
const QString & | color, | ||
const Qt::PenStyle & | style, | ||
const int & | type, | ||
const bool & | drawArrows, | ||
const bool & | bezier, | ||
const bool & | weightNumbers = false , |
||
const bool & | highlighting = true |
||
) |
GraphicsEdge::~GraphicsEdge | ( | ) |
**
void GraphicsEdge::addLabel | ( | ) |
Adds a graphics edge label to this edge.
void GraphicsEdge::addWeightNumber | ( | ) |
Adds a graphics edge weight to this edge.
|
slot |
Leaves some empty space (offset) from node - make the edge weight appear on the centre of the edge.
|
protected |
Defines the outer bounds of the edge as a rectangle; All painting will be restricted to inside the edge's bounding rect. Qt uses this bounding rect to determine whether the edge requires redrawing.
QColor GraphicsEdge::color | ( | ) | const |
Returns the edge QColor.
QString GraphicsEdge::colorToPajek | ( | ) |
int GraphicsEdge::directionType | ( | ) |
returns the direction type of this edge
qreal GraphicsEdge::dx | ( | ) | const |
Returns the horizontal difference between target and source nodes.
qreal GraphicsEdge::dy | ( | ) | const |
Returns the vertical difference between target and source nodes.
|
protected |
Called when the edge changes, i.e. moves, becomes disabled or changes its visibility.
change | |
value |
QString GraphicsEdge::label | ( | ) | const |
Returns the edge label text.
qreal GraphicsEdge::length | ( | ) | const |
Returns the euclidean length of the edge.
|
protected |
Pains the edge.
painter | |
option |
QPen GraphicsEdge::pen | ( | ) | const |
Returns the QPen for this edge – the pen changes when the edge state changes/.
void GraphicsEdge::removeRefs | ( | ) |
Removes any references to this edge in source and target nodes.
void GraphicsEdge::setColor | ( | const QString & | str | ) |
Sets the edge color.
str |
void GraphicsEdge::setDirectionType | ( | const int & | dirType = 0 | ) |
Changes the direction type of edge A->B.
void GraphicsEdge::setHighlighted | ( | const bool & | flag | ) |
Toggles the highlighted state of the the edge, if highlighting is allowed.
Called from GraphicsNode when the user hovers over the node.
flag |
void GraphicsEdge::setHighlighting | ( | const bool & | toggle | ) |
Toggles edge highlighting on or off.
If enabled, the edge can be highlighted.
toggle |
void GraphicsEdge::setLabel | ( | const QString & | label | ) |
Changes the edge label.
Called from MW when user wants to change an edge's label
label |
void GraphicsEdge::setLabelVisibility | ( | const bool & | toggle | ) |
Toggles the graphics edge label visibility.
toggle |
void GraphicsEdge::setMinimumOffsetFromNode | ( | const int & | offset | ) |
Updates Minimum Offset From Node and calls adjust to update the edge.
offset |
void GraphicsEdge::setSourceNode | ( | GraphicsNode * | node | ) |
Sets the source node of this graphics edge.
node |
void GraphicsEdge::setSourceNodeSize | ( | const int & | size | ) |
Called from graphicsNode to update edge offset from source node (i.e. when node size changes)
offset |
void GraphicsEdge::setState | ( | const int & | state | ) |
Sets the edge state.
state |
void GraphicsEdge::setStyle | ( | const Qt::PenStyle & | style | ) |
Sets the PenStyle of this edge.
style |
void GraphicsEdge::setTargetNode | ( | GraphicsNode * | node | ) |
Sets the target node.s.
node |
void GraphicsEdge::setTargetNodeSize | ( | const int & | size | ) |
Called from graphicsNode to update edge offset from target node (i.e. when node size changes)
offset |
void GraphicsEdge::setWeight | ( | const qreal & | w | ) |
Changes the edge weight - Updates both the width and the weightNumber.
Called from MW when user wants to change an edge's weight.
w |
void GraphicsEdge::setWeightNumberVisibility | ( | const bool & | toggle | ) |
Toggles visibility of weight numbers.
toggle |
QPainterPath GraphicsEdge::shape | ( | ) | const |
Returns the shape of this edge as a QPainterPath in local coordinates. The shape is used for many things, including collision detection, hit tests, and for the QGraphicsScene::items() functions. The default implementation calls boundingRect() to return a simple rectangular shape, but we reimplement it to return a more accurate shape for non-rectangular items.
void GraphicsEdge::showArrows | ( | const bool & | drawArrows | ) |
Toggles displaying edge arrow.
drawArrows |
GraphicsNode * GraphicsEdge::sourceNode | ( | ) | const |
Returns the source node of this graphics edge.
int GraphicsEdge::sourceNodeNumber | ( | ) |
Returns the source node number
Qt::PenStyle GraphicsEdge::style | ( | ) | const |
Returns the PenStyle of this edge.
GraphicsNode * GraphicsEdge::targetNode | ( | ) | const |
Returns the target node.
int GraphicsEdge::targetNodeNumber | ( | ) |
Returns the target node number
|
inline |
qreal GraphicsEdge::weight | ( | ) | const |
Returns the weight/value of this edge.
qreal GraphicsEdge::width | ( | ) | const |
Returns the width of the edge as a function of edge weight.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |