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

#include <InfoCanvasVisualizer.h>

Inheritance diagram for inet::visualizer::InfoCanvasVisualizer:
inet::visualizer::InfoVisualizerBase inet::visualizer::VisualizerBase

Classes

class  InfoCanvasVisualization
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual InfoVisualizationcreateInfoVisualization (cModule *module) const override
 
virtual void addInfoVisualization (const InfoVisualization *infoVisualization) override
 
virtual void removeInfoVisualization (const InfoVisualization *infoVisualization) override
 
virtual void refreshInfoVisualization (const InfoVisualization *infoVisualization, const char *info) const override
 
- Protected Member Functions inherited from inet::visualizer::InfoVisualizerBase
virtual void handleParameterChange (const char *name) override
 
virtual void refreshDisplay () const override
 
virtual void addInfoVisualizations ()
 
virtual void removeAllInfoVisualizations ()
 
virtual const char * getInfoVisualizationText (cModule *module) const
 
- 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::InfoVisualizerBase
std::vector< const InfoVisualization * > infoVisualizations
 
bool displayInfos = false
 
ModuleFilter modules
 
StringFormat format
 
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
 

Member Function Documentation

void inet::visualizer::InfoCanvasVisualizer::addInfoVisualization ( const InfoVisualization infoVisualization)
overrideprotectedvirtual

Reimplemented from inet::visualizer::InfoVisualizerBase.

67 {
69  auto infoCanvasVisualization = static_cast<const InfoCanvasVisualization *>(infoVisualization);
70  auto figure = infoCanvasVisualization->figure;
71  infoCanvasVisualization->networkNodeVisualization->addAnnotation(figure, figure->getBounds().getSize(), displacementHint, displacementPriority);
72 }
double displacementPriority
Definition: InfoVisualizerBase.h:65
Displacement displacementHint
Definition: InfoVisualizerBase.h:64
virtual void addInfoVisualization(const InfoVisualization *infoVisualization)
Definition: InfoVisualizerBase.cc:97
InfoVisualizerBase::InfoVisualization * inet::visualizer::InfoCanvasVisualizer::createInfoVisualization ( cModule *  module) const
overrideprotectedvirtual

Implements inet::visualizer::InfoVisualizerBase.

50 {
51  auto figure = new BoxedLabelFigure("info");
52  figure->setTags((std::string("info ") + tags).c_str());
53  figure->setTooltip("This label represents some module information");
54  figure->setAssociatedObject(module);
55  figure->setZIndex(zIndex);
56  figure->setFont(font);
57  figure->setText(getInfoVisualizationText(module));
58  figure->setLabelColor(textColor);
59  figure->setBackgroundColor(backgroundColor);
60  figure->setOpacity(opacity);
61  auto networkNode = getContainingNode(module);
62  auto networkNodeVisualization = networkNodeVisualizer->getNetworkNodeVisualization(networkNode);
63  return new InfoCanvasVisualization(networkNodeVisualization, figure, module->getId());
64 }
virtual const char * getInfoVisualizationText(cModule *module) const
Definition: InfoVisualizerBase.cc:127
const char * tags
Definition: VisualizerBase.h:32
double zIndex
Definition: InfoCanvasVisualizer.h:44
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
cFigure::Color textColor
Definition: InfoVisualizerBase.h:61
cFigure::Color backgroundColor
Definition: InfoVisualizerBase.h:62
double opacity
Definition: InfoVisualizerBase.h:63
NetworkNodeCanvasVisualizer * networkNodeVisualizer
Definition: InfoCanvasVisualizer.h:45
cFigure::Font font
Definition: InfoVisualizerBase.h:60
void inet::visualizer::InfoCanvasVisualizer::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::visualizer::InfoVisualizerBase.

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: InfoCanvasVisualizer.h:44
virtual void initialize(int stage) override
Definition: InfoVisualizerBase.cc:54
Local initializations.
Definition: InitStages.h:35
NetworkNodeCanvasVisualizer * networkNodeVisualizer
Definition: InfoCanvasVisualizer.h:45
void inet::visualizer::InfoCanvasVisualizer::refreshInfoVisualization ( const InfoVisualization infoVisualization,
const char *  info 
) const
overrideprotectedvirtual

Implements inet::visualizer::InfoVisualizerBase.

83 {
84  auto infoCanvasVisualization = static_cast<const InfoCanvasVisualization *>(infoVisualization);
85  auto figure = infoCanvasVisualization->figure;
86  figure->setText(info);
87  infoCanvasVisualization->networkNodeVisualization->setAnnotationSize(figure, figure->getBounds().getSize());
88 }
void inet::visualizer::InfoCanvasVisualizer::removeInfoVisualization ( const InfoVisualization infoVisualization)
overrideprotectedvirtual

Reimplemented from inet::visualizer::InfoVisualizerBase.

75 {
77  auto infoCanvasVisualization = static_cast<const InfoCanvasVisualization *>(infoVisualization);
78  auto figure = infoCanvasVisualization->figure;
79  infoCanvasVisualization->networkNodeVisualization->removeAnnotation(figure);
80 }
virtual void removeInfoVisualization(const InfoVisualization *infoVisualization)
Definition: InfoVisualizerBase.cc:102

Member Data Documentation

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

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