#include <edge.h>

Inheritance diagram for Edge:
Collaboration diagram for Edge:

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. More...
 

Public Member Functions

 Edge (GraphicsWidget *, Node *, Node *, const float &weight, const QString &label, const QString &color, const Qt::PenStyle &style, const int &type, const bool &drawArrows, const bool &bezier, const bool &weightNumbers=false)
 
 ~Edge ()
 
int type () const
 
NodesourceNode () const
 
void setSourceNode (Node *node)
 
NodetargetNode () const
 
void setTargetNode (Node *node)
 
void setStartOffset (const int &)
 
void setEndOffset (int)
 
void removeRefs ()
 
int sourceNodeNumber ()
 
int targetNodeNumber ()
 
void setWeight (const float &w)
 Called from MW when user wants to change an edge's weight. Updates both the width and the weightNumber. More...
 
float weight () const
 
void addWeightNumber ()
 
void setWeightNumberVisibility (const bool &toggle)
 
void setLabel (const QString &label)
 Called from MW when user wants to change an edge's label. More...
 
QString label () const
 
void addLabel ()
 
void setLabelVisibility (const bool &toggle)
 
void showArrows (const bool &)
 
void toggleAntialiasing (bool)
 
void setUndirected ()
 
bool isUndirected ()
 
void setDirectedWithOpposite ()
 
float width () const
 
QPen pen () const
 Edge::pen. More...
 
void setState (const int &state)
 
void setStyle (const Qt::PenStyle &style)
 
Qt::PenStyle style () const
 
void setColor (const QString &str)
 
QString color () const
 
QString colorToPajek ()
 Called from Graph::graphSaveToPajekFormat() More...
 
void highlight (const bool &flag)
 Edge::highlight. More...
 
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. More...
 

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. More...
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 
void mousePressEvent (QGraphicsSceneMouseEvent *event)
 

Private Attributes

GraphicsWidgetgraphicsWidget
 
Nodesource
 
Nodetarget
 
QPainterPath * m_path
 
QPainterPath * m_path_up
 
QPainterPath * m_path_down
 
QPainterPath * m_path_shape
 
QPointF sourcePoint
 
QPointF targetPoint
 
qreal m_arrowSize
 
qreal m_startOffset
 
qreal m_endOffset
 
Qt::PenStyle m_style
 
int m_state
 
EdgeWeightweightNumber
 
EdgeLabeledgeLabel
 
QString m_color
 
QString m_colorNegative
 
QString m_label
 
int eFrom
 
int eTo
 
float m_weight
 
int tox1
 
int tox2
 
int toy1
 
int toy2
 
int size
 
int m_edgeType
 
double rad
 
double theta
 
double theta1
 
double theta2
 
qreal angle
 
qreal line_length
 
qreal line_dx
 
qreal line_dy
 
bool m_Bezier
 
bool m_drawArrows
 
bool m_directed_first
 
bool m_drawWeightNumber
 
bool m_drawLabel
 

Member Enumeration Documentation

anonymous enum
Enumerator
Type 

Constructor & Destructor Documentation

Edge::Edge ( GraphicsWidget gw,
Node from,
Node to,
const float &  weight,
const QString &  label,
const QString &  color,
const Qt::PenStyle &  style,
const int &  type,
const bool &  drawArrows,
const bool &  bezier,
const bool &  weightNumbers = false 
)
Edge::~Edge ( )

Member Function Documentation

void Edge::addLabel ( )
void Edge::addWeightNumber ( )
void Edge::adjust ( )
slot

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

QRectF Edge::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
QString Edge::color ( ) const
QString Edge::colorToPajek ( )

Called from Graph::graphSaveToPajekFormat()

Returns
void Edge::highlight ( const bool &  flag)

Edge::highlight.

Parameters
flag
bool Edge::isUndirected ( )
QString Edge::label ( ) const
void Edge::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
protected

handles the events of a click on an edge

void Edge::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
)
protected
QPen Edge::pen ( ) const

Edge::pen.

Returns
void Edge::removeRefs ( )
void Edge::setColor ( const QString &  str)
void Edge::setDirectedWithOpposite ( )
void Edge::setEndOffset ( int  offset)
void Edge::setLabel ( const QString &  label)

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

Parameters
label
void Edge::setLabelVisibility ( const bool &  toggle)
void Edge::setSourceNode ( Node node)
void Edge::setStartOffset ( const int &  offset)
void Edge::setState ( const int &  state)
void Edge::setStyle ( const Qt::PenStyle &  style)
void Edge::setTargetNode ( Node node)
void Edge::setUndirected ( )
void Edge::setWeight ( const float &  w)

Called from MW when user wants to change an edge's weight. Updates both the width and the weightNumber.

Parameters
w
void Edge::setWeightNumberVisibility ( const bool &  toggle)
QPainterPath Edge::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
void Edge::showArrows ( const bool &  drawArrows)
Node * Edge::sourceNode ( ) const
int Edge::sourceNodeNumber ( )
Qt::PenStyle Edge::style ( ) const
Node * Edge::targetNode ( ) const
int Edge::targetNodeNumber ( )
void Edge::toggleAntialiasing ( bool  )
int Edge::type ( ) const
inline
float Edge::weight ( ) const
float Edge::width ( ) const

Controls the width of the edge; is a function of edge weight

Member Data Documentation

qreal Edge::angle
private
EdgeLabel* Edge::edgeLabel
private
int Edge::eFrom
private
int Edge::eTo
private
GraphicsWidget* Edge::graphicsWidget
private
qreal Edge::line_dx
private
qreal Edge::line_dy
private
qreal Edge::line_length
private
qreal Edge::m_arrowSize
private
bool Edge::m_Bezier
private
QString Edge::m_color
private
QString Edge::m_colorNegative
private
bool Edge::m_directed_first
private
bool Edge::m_drawArrows
private
bool Edge::m_drawLabel
private
bool Edge::m_drawWeightNumber
private
int Edge::m_edgeType
private
qreal Edge::m_endOffset
private
QString Edge::m_label
private
QPainterPath* Edge::m_path
private
QPainterPath * Edge::m_path_down
private
QPainterPath * Edge::m_path_shape
private
QPainterPath * Edge::m_path_up
private
qreal Edge::m_startOffset
private
int Edge::m_state
private
Qt::PenStyle Edge::m_style
private
float Edge::m_weight
private
double Edge::rad
private
int Edge::size
private
Node* Edge::source
private
QPointF Edge::sourcePoint
private
Node * Edge::target
private
QPointF Edge::targetPoint
private
double Edge::theta
private
double Edge::theta1
private
double Edge::theta2
private
int Edge::tox1
private
int Edge::tox2
private
int Edge::toy1
private
int Edge::toy2
private
EdgeWeight* Edge::weightNumber
private

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