Code Documentation 3.1
Social Network Visualizer
Loading...
Searching...
No Matches
GraphicsEdge Class Reference

#include <graphicsedge.h>

Inheritance diagram for GraphicsEdge:
Collaboration diagram for GraphicsEdge:

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
 
GraphicsNodesourceNode () const
 Returns the source node of this graphics edge.
 
void setSourceNode (GraphicsNode *node)
 Sets the source node of this graphics edge.
 
GraphicsNodetargetNode () 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

GraphicsWidgetgraphicsWidget
 
GraphicsNodesource
 
GraphicsNodetarget
 
GraphicsEdgeWeightweightNumber
 
GraphicsEdgeLabeledgeLabel
 
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
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Constructor & Destructor Documentation

◆ GraphicsEdge()

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::~GraphicsEdge ( )

‍**

Member Function Documentation

◆ addLabel()

void GraphicsEdge::addLabel ( )

Adds a graphics edge label to this edge.

◆ addWeightNumber()

void GraphicsEdge::addWeightNumber ( )

Adds a graphics edge weight to this edge.

◆ adjust

void GraphicsEdge::adjust ( )
slot

Leaves some empty space (offset) from node - make the edge weight appear on the centre of the edge.

◆ boundingRect()

QRectF GraphicsEdge::boundingRect ( ) const
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.

Returns

◆ color()

QColor GraphicsEdge::color ( ) const

Returns the edge QColor.

Returns

◆ colorToPajek()

QString GraphicsEdge::colorToPajek ( )

Returns the edge color in pajek-accepted format.

Called from Graph

Returns

◆ directionType()

int GraphicsEdge::directionType ( )

returns the direction type of this edge

Returns

◆ dx()

qreal GraphicsEdge::dx ( ) const

Returns the horizontal difference between target and source nodes.

Returns

◆ dy()

qreal GraphicsEdge::dy ( ) const

Returns the vertical difference between target and source nodes.

Returns

◆ itemChange()

QVariant GraphicsEdge::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
)
protected

Called when the edge changes, i.e. moves, becomes disabled or changes its visibility.

Parameters
change
value
Returns

◆ label()

QString GraphicsEdge::label ( ) const

Returns the edge label text.

Returns
QString

◆ length()

qreal GraphicsEdge::length ( ) const

Returns the euclidean length of the edge.

Returns

◆ paint()

void GraphicsEdge::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
)
protected

Pains the edge.

Parameters
painter
option

◆ pen()

QPen GraphicsEdge::pen ( ) const

Returns the QPen for this edge – the pen changes when the edge state changes/.

Returns

◆ removeRefs()

void GraphicsEdge::removeRefs ( )

Removes any references to this edge in source and target nodes.

◆ setColor()

void GraphicsEdge::setColor ( const QString &  str)

Sets the edge color.

Parameters
str

◆ setDirectionType()

void GraphicsEdge::setDirectionType ( const int &  dirType = 0)

Changes the direction type of edge A->B.

◆ setHighlighted()

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.

Parameters
flag

◆ setHighlighting()

void GraphicsEdge::setHighlighting ( const bool &  toggle)

Toggles edge highlighting on or off.

If enabled, the edge can be highlighted.

Parameters
toggle

◆ setLabel()

void GraphicsEdge::setLabel ( const QString &  label)

Changes the edge label.

Called from MW when user wants to change an edge's label

Parameters
label

◆ setLabelVisibility()

void GraphicsEdge::setLabelVisibility ( const bool &  toggle)

Toggles the graphics edge label visibility.

Parameters
toggle

◆ setMinimumOffsetFromNode()

void GraphicsEdge::setMinimumOffsetFromNode ( const int &  offset)

Updates Minimum Offset From Node and calls adjust to update the edge.

Parameters
offset

◆ setSourceNode()

void GraphicsEdge::setSourceNode ( GraphicsNode node)

Sets the source node of this graphics edge.

Parameters
node

◆ setSourceNodeSize()

void GraphicsEdge::setSourceNodeSize ( const int &  size)

Called from graphicsNode to update edge offset from source node (i.e. when node size changes)

Parameters
offset

◆ setState()

void GraphicsEdge::setState ( const int &  state)

Sets the edge state.

Parameters
state

◆ setStyle()

void GraphicsEdge::setStyle ( const Qt::PenStyle &  style)

Sets the PenStyle of this edge.

Parameters
style

◆ setTargetNode()

void GraphicsEdge::setTargetNode ( GraphicsNode node)

Sets the target node.s.

Parameters
node

◆ setTargetNodeSize()

void GraphicsEdge::setTargetNodeSize ( const int &  size)

Called from graphicsNode to update edge offset from target node (i.e. when node size changes)

Parameters
offset

◆ setWeight()

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.

Parameters
w

◆ setWeightNumberVisibility()

void GraphicsEdge::setWeightNumberVisibility ( const bool &  toggle)

Toggles visibility of weight numbers.

Parameters
toggle

◆ shape()

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.

Returns
QPainterPath

◆ showArrows()

void GraphicsEdge::showArrows ( const bool &  drawArrows)

Toggles displaying edge arrow.

Parameters
drawArrows

◆ sourceNode()

GraphicsNode * GraphicsEdge::sourceNode ( ) const

Returns the source node of this graphics edge.

Returns

◆ sourceNodeNumber()

int GraphicsEdge::sourceNodeNumber ( )

Returns the source node number

Returns
int

◆ style()

Qt::PenStyle GraphicsEdge::style ( ) const

Returns the PenStyle of this edge.

Returns

◆ targetNode()

GraphicsNode * GraphicsEdge::targetNode ( ) const

Returns the target node.

Returns

◆ targetNodeNumber()

int GraphicsEdge::targetNodeNumber ( )

Returns the target node number

Returns
int

◆ type()

int GraphicsEdge::type ( ) const
inline

◆ weight()

qreal GraphicsEdge::weight ( ) const

Returns the weight/value of this edge.

Returns

◆ width()

qreal GraphicsEdge::width ( ) const

Returns the width of the edge as a function of edge weight.

Returns

Field Documentation

◆ angle

qreal GraphicsEdge::angle
private

◆ edgeLabel

GraphicsEdgeLabel* GraphicsEdge::edgeLabel
private

◆ edgeOffset

QPointF GraphicsEdge::edgeOffset
private

◆ graphicsWidget

GraphicsWidget* GraphicsEdge::graphicsWidget
private

◆ line_dx

qreal GraphicsEdge::line_dx
private

◆ line_dy

qreal GraphicsEdge::line_dy
private

◆ line_length

qreal GraphicsEdge::line_length
private

◆ m_arrowSize

qreal GraphicsEdge::m_arrowSize
private

◆ m_Bezier

bool GraphicsEdge::m_Bezier
private

◆ m_color

QColor GraphicsEdge::m_color
private

◆ m_colorNegative

QString GraphicsEdge::m_colorNegative
private

◆ m_drawArrows

bool GraphicsEdge::m_drawArrows
private

◆ m_drawLabel

bool GraphicsEdge::m_drawLabel
private

◆ m_drawWeightNumber

bool GraphicsEdge::m_drawWeightNumber
private

◆ m_edgeDirType

int GraphicsEdge::m_edgeDirType
private

◆ m_hoverHighlighting

bool GraphicsEdge::m_hoverHighlighting
private

◆ m_isClicked

bool GraphicsEdge::m_isClicked
private

◆ m_label

QString GraphicsEdge::m_label
private

◆ m_minOffsetFromNode

qreal GraphicsEdge::m_minOffsetFromNode
private

◆ m_offsetFromSourceNode

qreal GraphicsEdge::m_offsetFromSourceNode
private

◆ m_offsetFromTargetNode

qreal GraphicsEdge::m_offsetFromTargetNode
private

◆ m_path

QPainterPath GraphicsEdge::m_path
private

◆ m_state

int GraphicsEdge::m_state
private

◆ m_style

Qt::PenStyle GraphicsEdge::m_style
private

◆ m_weight

qreal GraphicsEdge::m_weight
private

◆ m_width

qreal GraphicsEdge::m_width
private

◆ source

GraphicsNode* GraphicsEdge::source
private

◆ sourcePoint

QPointF GraphicsEdge::sourcePoint
private

◆ target

GraphicsNode * GraphicsEdge::target
private

◆ targetPoint

QPointF GraphicsEdge::targetPoint
private

◆ weightNumber

GraphicsEdgeWeight* GraphicsEdge::weightNumber
private

The documentation for this class was generated from the following files: