Monitor
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
GraphWidget Class Reference

#include <graphwidget.h>

List of all members.

Public Member Functions

 GraphWidget (QWidget *parent=0, CommModel *comm=0)
void itemMoved ()
void updateGraph (std::vector< node * > _nodes)
void setSelectedIP (uint32_t newIP)
uint32_t getSelectedIP ()
void setSourceMac (mac_t newMac)
mac_t getSourceMac ()
void setDestinationMac (mac_t newMac)
mac_t getDestinationMac ()
void updateNodesAndEdges ()
MainWindowgetMainWindow ()
void setMainWindow (MainWindow *_mainWindow)
bool sameMacAddr (node *n1, node *n2)
void plotNodes ()
void setDoPhysics (bool val)
bool getDoPhysics ()
void highlightPath (std::vector< node * > path)

Public Attributes

QList< Node * > allNodes

Protected Member Functions

void timerEvent (QTimerEvent *event)
void drawBackground (QPainter *painter, const QRectF &rect)
bool checkIp (uint32_t ip_addr)
bool checkMac (node *nx)
NodegetNode (node *n)
bool hasEdge (Node *n, node *nb)

Protected Attributes

bool _doPhysics

Detailed Description

This is the viewer. It contains the graphical nodes and edges.

Definition at line 71 of file graphwidget.h.


Constructor & Destructor Documentation

GraphWidget::GraphWidget ( QWidget *  parent = 0,
CommModel *  comModel = 0 
)

Constructor for GraphWidget

Parameters:
parentthe parent of this widget
comModelreference to the CommModel

Definition at line 57 of file graphwidget.cpp.


Member Function Documentation

bool GraphWidget::checkIp ( uint32_t  ip_addr) [protected]

Searches the nodes for a matching ip address

Parameters:
ip_addrthe ip address to look for
Returns:
true if a node with a matching ip address was found

Definition at line 123 of file graphwidget.cpp.

bool GraphWidget::checkMac ( node *  nx) [protected]

Checks the mac address of a node

Parameters:
nxthe node to check
Returns:
true if the mac address matches

Definition at line 141 of file graphwidget.cpp.

void GraphWidget::drawBackground ( QPainter *  painter,
const QRectF &  rect 
) [protected]

Draws the background of the widget

Parameters:
painterthe painter used for drawing the background
rectthe bounding box of the background

Definition at line 363 of file graphwidget.cpp.

mac_t GraphWidget::getDestinationMac ( )

Gets the destination mac address

Returns:
destination mac address

Definition at line 473 of file graphwidget.cpp.

bool GraphWidget::getDoPhysics ( )

Gets the private physics variable value

Returns:
true if phyics are enabled

Definition at line 591 of file graphwidget.cpp.

MainWindow * GraphWidget::getMainWindow ( )

Gets the main window

Returns:
main window

Definition at line 79 of file graphwidget.cpp.

Node * GraphWidget::getNode ( node *  n) [protected]

Gets the graphical node representation for a model node

Parameters:
nthe model node
Returns:
graphical node representing this node, NULL if it doesn't exist

Definition at line 160 of file graphwidget.cpp.

mac_t GraphWidget::getSourceMac ( )

Gets the source mac address

Returns:
source mac address

Definition at line 482 of file graphwidget.cpp.

bool GraphWidget::hasEdge ( Node n,
node *  nb 
) [protected]

Checks if two model nodes are connected

Parameters:
nnode a
nbnode b
Returns:
true if the two nodes are neighbors

Definition at line 182 of file graphwidget.cpp.

void GraphWidget::highlightPath ( std::vector< node * >  path)

Highlights a set of edges that form a path

Parameters:
patha vector nodes that are connected

Definition at line 599 of file graphwidget.cpp.

void GraphWidget::itemMoved ( )

starts the timer when it item moves

Definition at line 96 of file graphwidget.cpp.

void GraphWidget::plotNodes ( )

Plots the nodes in a circle

Definition at line 526 of file graphwidget.cpp.

bool GraphWidget::sameMacAddr ( node *  n1,
node *  n2 
)

Compares the mac addresses of the two nodes

Parameters:
n1node 1
n2node 2
Returns:
true if n1 and n2 have the same mac address

Definition at line 108 of file graphwidget.cpp.

void GraphWidget::setDestinationMac ( mac_t  newMac)

Sets the destination mac address

Parameters:
newMacmac address of the new destination node

Definition at line 456 of file graphwidget.cpp.

void GraphWidget::setDoPhysics ( bool  val)

Sets the private physics variable value

Parameters:
valnew physics variable

Definition at line 583 of file graphwidget.cpp.

void GraphWidget::setMainWindow ( MainWindow _mainWindow)

Sets the main window

Parameters:
_mainWindowvalue for mainWindow

Definition at line 88 of file graphwidget.cpp.

void GraphWidget::setSelectedIP ( uint32_t  newIP)

Sets a selected node ip of the selected node

Definition at line 425 of file graphwidget.cpp.

void GraphWidget::setSourceMac ( mac_t  newMac)

Sets the source mac address

Parameters:
newMacmac address of the new source node

Definition at line 439 of file graphwidget.cpp.

void GraphWidget::timerEvent ( QTimerEvent *  event) [protected]

Handles timer events

Parameters:
eventthe event that is being handled

Definition at line 313 of file graphwidget.cpp.

void GraphWidget::updateGraph ( std::vector< node * >  nodes)

Updates the graph

Parameters:
nodesa vector of all the nodes

Definition at line 199 of file graphwidget.cpp.

void GraphWidget::updateNodesAndEdges ( )

a list of all the graphical nodes

Updates the location and appearance of nodes and egdges

Definition at line 491 of file graphwidget.cpp.


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