Monitor
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
Node Class Reference

#include <node.h>

List of all members.

Public Types

enum  { Type = UserType + 1 }

Public Member Functions

 Node (GraphWidget *graphWidget, bool _center, uint32_t _ip_addr, node *_node)
void addEdge (Edge *edge)
QList< Edge * > edges () const
int type () const
void calculateForces (bool doPhysics)
bool advance ()
QRectF boundingRect () const
QPainterPath shape () const
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
uint32_t getIpAddr () const
QString getIpAddrQString () const
bool isActive () const
void setInactive ()
void setActive ()
QPointF getPosition ()
node * getNodePointer ()
void settPosition (QPointF *np)

Static Public Member Functions

static bool macEqual (mac_t m1, mac_t m2)

Protected Member Functions

QVariant itemChange (GraphicsItemChange change, const QVariant &value)
void mousePressEvent (QGraphicsSceneMouseEvent *event)
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)

Detailed Description

Graphical representation of a model node

Definition at line 59 of file node.h.


Constructor & Destructor Documentation

Node::Node ( GraphWidget graphWidget,
bool  _center,
uint32_t  _ip_addr,
node *  _node 
)

Constructor for Creating a new graphical ndoe

Parameters:
graphWidgetthe widget it is placed on
_centerthe center of this graphical node
_ip_addrethe ip address of this node
_nodethe model node that this graphical node represents

Definition at line 60 of file node.cpp.


Member Function Documentation

void Node::addEdge ( Edge edge)

adds and edge to this node

Parameters:
edgethe edge used to connect this node to another node

Definition at line 85 of file node.cpp.

bool Node::advance ( )

Updates the position of this node

Definition at line 207 of file node.cpp.

QRectF Node::boundingRect ( ) const

Gets the bounding rectangle of this node

Returns:
the bounding rectangle of this node

Definition at line 220 of file node.cpp.

void Node::calculateForces ( bool  doPhysics)

Calcualtes the forces, when physics are enabled

Parameters:
doPhysicswhether or not do enable physics

Definition at line 147 of file node.cpp.

QList< Edge * > Node::edges ( ) const

Gets the list of edges

Returns:
QList with all of this graphical node's edges

Definition at line 104 of file node.cpp.

uint32_t Node::getIpAddr ( ) const

Gets the ip address of the model node

Returns:
the ip address of the model node

Definition at line 113 of file node.cpp.

QString Node::getIpAddrQString ( ) const

Gets the String representation of this nodes ip address

Definition at line 381 of file node.cpp.

node * Node::getNodePointer ( )

Gets the model node

Returns:
model node that it's representing

Definition at line 95 of file node.cpp.

QPointF Node::getPosition ( )

Gets the new position of this node

Returns:
the new postion of this node

Definition at line 373 of file node.cpp.

bool Node::isActive ( ) const

Gets the active state of this node

Returns:
true if active

Definition at line 122 of file node.cpp.

QVariant Node::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
) [protected]

Gets the change variant

Parameters:
changethe graphical item change
valuethe address of the change
Returns:
QVariant of the chang

Definition at line 314 of file node.cpp.

static bool Node::macEqual ( mac_t  m1,
mac_t  m2 
) [inline, static]

compares two mac addresses

Returns:
true if they're equl

Definition at line 93 of file node.h.

void Node::mousePressEvent ( QGraphicsSceneMouseEvent *  event) [protected]

Handles mouse presses

Parameters:
eventthe mouse press event

Definition at line 333 of file node.cpp.

void Node::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event) [protected]

Handles the mouse release event

Parameters:
eventthe mouse release event

Definition at line 363 of file node.cpp.

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

Paints the grpahical node using the painter

Parameters:
painterused to paint this graphical node
optionoptions for painting this node

Definition at line 243 of file node.cpp.

void Node::setActive ( )

Sets as active

Definition at line 138 of file node.cpp.

void Node::setInactive ( )

Sets the node as inactive

Definition at line 130 of file node.cpp.

void Node::settPosition ( QPointF *  np)

Sets the position of this node

Parameters:
npthe new position

Definition at line 390 of file node.cpp.

QPainterPath Node::shape ( ) const

Gets the path used to draw this node

Returns:
the path used to draw this node

Definition at line 231 of file node.cpp.

int Node::type ( ) const [inline]

the user type

Definition at line 68 of file node.h.


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