Monitor
|
#include <graphwidget.h>
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 () |
MainWindow * | getMainWindow () |
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) |
Node * | getNode (node *n) |
bool | hasEdge (Node *n, node *nb) |
Protected Attributes | |
bool | _doPhysics |
This is the viewer. It contains the graphical nodes and edges.
Definition at line 71 of file graphwidget.h.
GraphWidget::GraphWidget | ( | QWidget * | parent = 0 , |
CommModel * | comModel = 0 |
||
) |
Constructor for GraphWidget
parent | the parent of this widget |
comModel | reference to the CommModel |
Definition at line 57 of file graphwidget.cpp.
bool GraphWidget::checkIp | ( | uint32_t | ip_addr | ) | [protected] |
Searches the nodes for a matching ip address
ip_addr | the ip address to look for |
Definition at line 123 of file graphwidget.cpp.
bool GraphWidget::checkMac | ( | node * | nx | ) | [protected] |
Checks the mac address of a node
nx | the node to check |
Definition at line 141 of file graphwidget.cpp.
void GraphWidget::drawBackground | ( | QPainter * | painter, |
const QRectF & | rect | ||
) | [protected] |
Draws the background of the widget
painter | the painter used for drawing the background |
rect | the bounding box of the background |
Definition at line 363 of file graphwidget.cpp.
mac_t GraphWidget::getDestinationMac | ( | ) |
Gets the destination mac address
Definition at line 473 of file graphwidget.cpp.
bool GraphWidget::getDoPhysics | ( | ) |
Gets the private physics variable value
Definition at line 591 of file graphwidget.cpp.
MainWindow * GraphWidget::getMainWindow | ( | ) |
Node * GraphWidget::getNode | ( | node * | n | ) | [protected] |
Gets the graphical node representation for a model node
n | the model node |
Definition at line 160 of file graphwidget.cpp.
mac_t GraphWidget::getSourceMac | ( | ) |
Gets the 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
n | node a |
nb | node b |
Definition at line 182 of file graphwidget.cpp.
void GraphWidget::highlightPath | ( | std::vector< node * > | path | ) |
Highlights a set of edges that form a path
path | a 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
n1 | node 1 |
n2 | node 2 |
Definition at line 108 of file graphwidget.cpp.
void GraphWidget::setDestinationMac | ( | mac_t | newMac | ) |
Sets the destination mac address
newMac | mac 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
val | new physics variable |
Definition at line 583 of file graphwidget.cpp.
void GraphWidget::setMainWindow | ( | MainWindow * | _mainWindow | ) |
Sets the main window
_mainWindow | value 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
newMac | mac address of the new source node |
Definition at line 439 of file graphwidget.cpp.
void GraphWidget::timerEvent | ( | QTimerEvent * | event | ) | [protected] |
Handles timer events
event | the event that is being handled |
Definition at line 313 of file graphwidget.cpp.
void GraphWidget::updateGraph | ( | std::vector< node * > | nodes | ) |
Updates the graph
nodes | a 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.