INET Framework for OMNeT++/OMNEST
inet::visualizer::QueueCanvasVisualizer Class Reference

#include <QueueCanvasVisualizer.h>

Inheritance diagram for inet::visualizer::QueueCanvasVisualizer:
inet::visualizer::QueueVisualizerBase inet::visualizer::VisualizerBase

Classes

class  QueueCanvasVisualization
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual QueueVisualizationcreateQueueVisualization (PacketQueue *queue) const override
 
virtual void addQueueVisualization (const QueueVisualization *queueVisualization) override
 
virtual void removeQueueVisualization (const QueueVisualization *queueVisualization) override
 
virtual void refreshQueueVisualization (const QueueVisualization *queueVisualization) const override
 
- Protected Member Functions inherited from inet::visualizer::QueueVisualizerBase
virtual void handleParameterChange (const char *name) override
 
virtual void refreshDisplay () const override
 
virtual void addQueueVisualizations ()
 
virtual void removeAllQueueVisualizations ()
 
- Protected Member Functions inherited from inet::visualizer::VisualizerBase
virtual int numInitStages () const override
 
virtual Coord getPosition (const cModule *networkNode) const
 
virtual Coord getContactPosition (const cModule *networkNode, const Coord &fromPosition, const char *contactMode, double contactSpacing) const
 
virtual InterfaceEntrygetInterfaceEntry (cModule *networkNode, cModule *module) const
 

Protected Attributes

double zIndex = NaN
 
NetworkNodeCanvasVisualizernetworkNodeVisualizer = nullptr
 
- Protected Attributes inherited from inet::visualizer::QueueVisualizerBase
std::vector< const QueueVisualization * > queueVisualizations
 
bool displayQueues = false
 
QueueFilter queueFilter
 
cFigure::Color color
 
double width
 
double height
 
double spacing
 
Displacement displacementHint
 
double displacementPriority
 
- Protected Attributes inherited from inet::visualizer::VisualizerBase
cModule * visualizerTargetModule = nullptr
 
const char * tags = nullptr
 

Member Function Documentation

void inet::visualizer::QueueCanvasVisualizer::addQueueVisualization ( const QueueVisualization queueVisualization)
overrideprotectedvirtual

Reimplemented from inet::visualizer::QueueVisualizerBase.

66 {
68  auto queueCanvasVisualization = static_cast<const QueueCanvasVisualization *>(queueVisualization);
69  auto figure = queueCanvasVisualization->figure;
70  queueCanvasVisualization->networkNodeVisualization->addAnnotation(figure, figure->getBounds().getSize(), displacementHint, displacementPriority);
71 }
virtual void addQueueVisualization(const QueueVisualization *queueVisualization)
Definition: QueueVisualizerBase.cc:71
double displacementPriority
Definition: QueueVisualizerBase.h:63
Displacement displacementHint
Definition: QueueVisualizerBase.h:62
QueueVisualizerBase::QueueVisualization * inet::visualizer::QueueCanvasVisualizer::createQueueVisualization ( PacketQueue queue) const
overrideprotectedvirtual

Implements inet::visualizer::QueueVisualizerBase.

50 {
51  auto module = check_and_cast<cModule *>(queue->getOwner());
52  auto figure = new QueueFigure("queue");
53  figure->setTags((std::string("queue ") + tags).c_str());
54  figure->setTooltip("This figure represents a queue");
55  figure->setAssociatedObject(queue);
56  figure->setColor(color);
57  figure->setSpacing(spacing);
58  figure->setBounds(cFigure::Rectangle(0, 0, width, height));
59  figure->setMaxElementCount(queue->getMaxPacketLength());
60  auto networkNode = getContainingNode(module);
61  auto networkNodeVisualization = networkNodeVisualizer->getNetworkNodeVisualization(networkNode);
62  return new QueueCanvasVisualization(networkNodeVisualization, figure, queue);
63 }
double width
Definition: QueueVisualizerBase.h:59
const char * tags
Definition: VisualizerBase.h:32
double spacing
Definition: QueueVisualizerBase.h:61
cFigure::Color color
Definition: QueueVisualizerBase.h:58
virtual NetworkNodeCanvasVisualization * getNetworkNodeVisualization(const cModule *networkNode) const
Definition: NetworkNodeCanvasVisualizer.cc:63
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:65
NetworkNodeCanvasVisualizer * networkNodeVisualizer
Definition: QueueCanvasVisualizer.h:45
double height
Definition: QueueVisualizerBase.h:60
void inet::visualizer::QueueCanvasVisualizer::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::visualizer::QueueVisualizerBase.

40 {
42  if (!hasGUI()) return;
43  if (stage == INITSTAGE_LOCAL) {
44  zIndex = par("zIndex");
45  networkNodeVisualizer = getModuleFromPar<NetworkNodeCanvasVisualizer>(par("networkNodeVisualizerModule"), this);
46  }
47 }
double zIndex
Definition: QueueCanvasVisualizer.h:44
virtual void initialize(int stage) override
Definition: QueueVisualizerBase.cc:37
Local initializations.
Definition: InitStages.h:35
NetworkNodeCanvasVisualizer * networkNodeVisualizer
Definition: QueueCanvasVisualizer.h:45
void inet::visualizer::QueueCanvasVisualizer::refreshQueueVisualization ( const QueueVisualization queueVisualization) const
overrideprotectedvirtual

Implements inet::visualizer::QueueVisualizerBase.

82 {
83  auto queueCanvasVisualization = static_cast<const QueueCanvasVisualization *>(queueVisualization);
84  auto queue = queueVisualization->queue;
85  auto figure = queueCanvasVisualization->figure;
86  figure->setElementCount(queue->getLength());
87 }
void inet::visualizer::QueueCanvasVisualizer::removeQueueVisualization ( const QueueVisualization queueVisualization)
overrideprotectedvirtual

Reimplemented from inet::visualizer::QueueVisualizerBase.

74 {
76  auto queueCanvasVisualization = static_cast<const QueueCanvasVisualization *>(queueVisualization);
77  auto figure = queueCanvasVisualization->figure;
78  queueCanvasVisualization->networkNodeVisualization->removeAnnotation(figure);
79 }
virtual void removeQueueVisualization(const QueueVisualization *queueVisualization)
Definition: QueueVisualizerBase.cc:76

Member Data Documentation

NetworkNodeCanvasVisualizer* inet::visualizer::QueueCanvasVisualizer::networkNodeVisualizer = nullptr
protected
double inet::visualizer::QueueCanvasVisualizer::zIndex = NaN
protected

Referenced by initialize().


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