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

#include <StatisticCanvasVisualizer.h>

Inheritance diagram for inet::visualizer::StatisticCanvasVisualizer:
inet::visualizer::StatisticVisualizerBase inet::visualizer::VisualizerBase

Classes

class  StatisticCanvasVisualization
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual StatisticVisualizationcreateStatisticVisualization (cComponent *source, simsignal_t signal) override
 
virtual void addStatisticVisualization (const StatisticVisualization *statisticVisualization) override
 
virtual void removeStatisticVisualization (const StatisticVisualization *statisticVisualization) override
 
virtual void refreshStatisticVisualization (const StatisticVisualization *statisticVisualization) override
 
- Protected Member Functions inherited from inet::visualizer::StatisticVisualizerBase
virtual void handleParameterChange (const char *name) override
 
virtual void subscribe ()
 
virtual void unsubscribe ()
 
virtual cResultFilter * findResultFilter (cComponent *source, simsignal_t signal)
 
virtual cResultFilter * findResultFilter (cResultFilter *parentResultFilter, cResultListener *resultListener)
 
virtual std::string getText (const StatisticVisualization *statisticVisualization)
 
virtual const char * getUnit (cComponent *source)
 
virtual const StatisticVisualizationgetStatisticVisualization (cComponent *source, simsignal_t signal)
 
virtual void removeAllStatisticVisualizations ()
 
virtual void processSignal (cComponent *source, simsignal_t signal, double value)
 
- 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::StatisticVisualizerBase
std::map< std::pair< int, simsignal_t >, const StatisticVisualization * > statisticVisualizations
 
bool displayStatistics = false
 
ModuleFilter sourceFilter
 
const char * signalName = nullptr
 
const char * statisticName = nullptr
 
StringFormat format
 
std::vector< std::string > units
 
cFigure::Font font
 
cFigure::Color textColor
 
cFigure::Color backgroundColor
 
double opacity = NaN
 
Displacement displacementHint
 
double displacementPriority
 
- Protected Attributes inherited from inet::visualizer::VisualizerBase
cModule * visualizerTargetModule = nullptr
 
const char * tags = nullptr
 

Additional Inherited Members

- Public Member Functions inherited from inet::visualizer::StatisticVisualizerBase
virtual ~StatisticVisualizerBase ()
 
virtual void receiveSignal (cComponent *source, simsignal_t signal, bool b, cObject *details) override
 
virtual void receiveSignal (cComponent *source, simsignal_t signal, long l, cObject *details) override
 
virtual void receiveSignal (cComponent *source, simsignal_t signal, unsigned long l, cObject *details) override
 
virtual void receiveSignal (cComponent *source, simsignal_t signal, double d, cObject *details) override
 
virtual void receiveSignal (cComponent *source, simsignal_t signal, const SimTime &t, cObject *details) override
 
virtual void receiveSignal (cComponent *source, simsignal_t signal, const char *s, cObject *details) override
 
virtual void receiveSignal (cComponent *source, simsignal_t signal, cObject *obj, cObject *details) override
 

Member Function Documentation

void inet::visualizer::StatisticCanvasVisualizer::addStatisticVisualization ( const StatisticVisualization statisticVisualization)
overrideprotectedvirtual

Reimplemented from inet::visualizer::StatisticVisualizerBase.

62 {
64  auto statisticCanvasVisualization = static_cast<const StatisticCanvasVisualization *>(statisticVisualization);
65  statisticCanvasVisualization->networkNodeVisualization->addAnnotation(statisticCanvasVisualization->figure, statisticCanvasVisualization->figure->getBounds().getSize(), displacementHint, displacementPriority);
66 }
double displacementPriority
Definition: StatisticVisualizerBase.h:85
virtual void addStatisticVisualization(const StatisticVisualization *statisticVisualization)
Definition: StatisticVisualizerBase.cc:175
Displacement displacementHint
Definition: StatisticVisualizerBase.h:84
StatisticVisualizerBase::StatisticVisualization * inet::visualizer::StatisticCanvasVisualizer::createStatisticVisualization ( cComponent *  source,
simsignal_t  signal 
)
overrideprotectedvirtual

Implements inet::visualizer::StatisticVisualizerBase.

45 {
46  auto figure = new BoxedLabelFigure("statistic");
47  figure->setTags((std::string("statistic ") + tags).c_str());
48  figure->setTooltip("This label represents the current value of a statistic");
49  figure->setAssociatedObject(source);
50  figure->setZIndex(zIndex);
51  figure->setFont(font);
52  figure->setText("");
53  figure->setLabelColor(textColor);
54  figure->setBackgroundColor(backgroundColor);
55  figure->setOpacity(opacity);
56  auto networkNode = getContainingNode(check_and_cast<cModule *>(source));
57  auto networkNodeVisualization = networkNodeVisualizer->getNetworkNodeVisualization(networkNode);
58  return new StatisticCanvasVisualization(networkNodeVisualization, figure, source->getId(), signal, getUnit(source));
59 }
double opacity
Definition: StatisticVisualizerBase.h:83
const char * tags
Definition: VisualizerBase.h:32
double zIndex
Definition: StatisticCanvasVisualizer.h:43
virtual const char * getUnit(cComponent *source)
Definition: StatisticVisualizerBase.cc:154
cFigure::Color textColor
Definition: StatisticVisualizerBase.h:81
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: StatisticCanvasVisualizer.h:44
cFigure::Font font
Definition: StatisticVisualizerBase.h:80
cFigure::Color backgroundColor
Definition: StatisticVisualizerBase.h:82
void inet::visualizer::StatisticCanvasVisualizer::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::visualizer::StatisticVisualizerBase.

35 {
37  if (!hasGUI()) return;
38  if (stage == INITSTAGE_LOCAL) {
39  zIndex = par("zIndex");
40  networkNodeVisualizer = getModuleFromPar<NetworkNodeCanvasVisualizer>(par("networkNodeVisualizerModule"), this);
41  }
42 }
double zIndex
Definition: StatisticCanvasVisualizer.h:43
virtual void initialize(int stage) override
Definition: StatisticVisualizerBase.cc:66
Local initializations.
Definition: InitStages.h:35
NetworkNodeCanvasVisualizer * networkNodeVisualizer
Definition: StatisticCanvasVisualizer.h:44
void inet::visualizer::StatisticCanvasVisualizer::refreshStatisticVisualization ( const StatisticVisualization statisticVisualization)
overrideprotectedvirtual

Reimplemented from inet::visualizer::StatisticVisualizerBase.

76 {
78  auto statisticCanvasVisualization = static_cast<const StatisticCanvasVisualization *>(statisticVisualization);
79  auto figure = statisticCanvasVisualization->figure;
80  figure->setText(getText(statisticVisualization).c_str());
81  statisticCanvasVisualization->networkNodeVisualization->setAnnotationSize(figure, figure->getBounds().getSize());
82 }
virtual void refreshStatisticVisualization(const StatisticVisualization *statisticVisualization)
Definition: StatisticVisualizerBase.cc:218
virtual std::string getText(const StatisticVisualization *statisticVisualization)
Definition: StatisticVisualizerBase.cc:148
void inet::visualizer::StatisticCanvasVisualizer::removeStatisticVisualization ( const StatisticVisualization statisticVisualization)
overrideprotectedvirtual

Reimplemented from inet::visualizer::StatisticVisualizerBase.

69 {
71  auto statisticCanvasVisualization = static_cast<const StatisticCanvasVisualization *>(statisticVisualization);
72  statisticCanvasVisualization->networkNodeVisualization->removeAnnotation(statisticCanvasVisualization->figure);
73 }
virtual void removeStatisticVisualization(const StatisticVisualization *statisticVisualization)
Definition: StatisticVisualizerBase.cc:181

Member Data Documentation

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

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