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

#include <InterfaceTableCanvasVisualizer.h>

Inheritance diagram for inet::visualizer::InterfaceTableCanvasVisualizer:
inet::visualizer::InterfaceTableVisualizerBase inet::visualizer::VisualizerBase

Classes

class  InterfaceCanvasVisualization
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual cModule * getNetworkNode (const InterfaceVisualization *interfaceVisualization)
 
virtual InterfaceEntrygetInterfaceEntry (const InterfaceVisualization *interfaceVisualization)
 
virtual cGate * getOutputGate (cModule *networkNode, InterfaceEntry *interfaceEntry)
 
virtual cGate * getOutputGate (const InterfaceVisualization *interfaceVisualization)
 
virtual InterfaceVisualizationcreateInterfaceVisualization (cModule *networkNode, InterfaceEntry *interfaceEntry) override
 
virtual void addInterfaceVisualization (const InterfaceVisualization *interfaceVisualization) override
 
virtual void removeInterfaceVisualization (const InterfaceVisualization *interfaceVisualization) override
 
virtual void refreshInterfaceVisualization (const InterfaceVisualization *interfaceVisualization, const InterfaceEntry *interfaceEntry) override
 
- Protected Member Functions inherited from inet::visualizer::InterfaceTableVisualizerBase
virtual void handleParameterChange (const char *name) override
 
virtual void subscribe ()
 
virtual void unsubscribe ()
 
virtual const InterfaceVisualizationgetInterfaceVisualization (cModule *networkNode, InterfaceEntry *interfaceEntry)
 
virtual void addAllInterfaceVisualizations ()
 
virtual void removeAllInterfaceVisualizations ()
 
virtual void updateAllInterfaceVisualizations ()
 
virtual std::string getVisualizationText (const InterfaceEntry *interfaceEntry)
 
- 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::InterfaceTableVisualizerBase
std::map< std::pair< int, int >, const InterfaceVisualization * > interfaceVisualizations
 
bool displayInterfaceTables = false
 
bool displayWiredInterfacesAtConnections = false
 
bool displayBackground = false
 
NetworkNodeFilter nodeFilter
 
InterfaceFilter interfaceFilter
 
StringFormat format
 
Displacement displacementHint
 
double displacementPriority
 
cFigure::Font font
 
cFigure::Color textColor
 
cFigure::Color backgroundColor
 
double opacity = NaN
 
- Protected Attributes inherited from inet::visualizer::VisualizerBase
cModule * visualizerTargetModule = nullptr
 
const char * tags = nullptr
 

Additional Inherited Members

- Public Member Functions inherited from inet::visualizer::InterfaceTableVisualizerBase
virtual ~InterfaceTableVisualizerBase ()
 
virtual void receiveSignal (cComponent *source, simsignal_t signal, cObject *object, cObject *details) override
 

Member Function Documentation

void inet::visualizer::InterfaceTableCanvasVisualizer::addInterfaceVisualization ( const InterfaceVisualization interfaceVisualization)
overrideprotectedvirtual

Reimplemented from inet::visualizer::InterfaceTableVisualizerBase.

114 {
116  auto interfaceCanvasVisualization = static_cast<const InterfaceCanvasVisualization *>(interfaceVisualization);
117  auto gate = displayWiredInterfacesAtConnections ? getOutputGate(interfaceVisualization) : nullptr;
118  if (gate != nullptr) {
119  cDisplayString& displayString = gate->getDisplayString();
120  displayString.setTagArg("t", 0, getVisualizationText(getInterfaceEntry(interfaceVisualization)).c_str());
121  displayString.setTagArg("t", 1, "l");
122  }
123  else
124  interfaceCanvasVisualization->networkNodeVisualization->addAnnotation(interfaceCanvasVisualization->figure, interfaceCanvasVisualization->figure->getBounds().getSize(), displacementHint, displacementPriority);
125 }
Displacement displacementHint
Definition: InterfaceTableVisualizerBase.h:66
bool displayWiredInterfacesAtConnections
Definition: InterfaceTableVisualizerBase.h:61
virtual void addInterfaceVisualization(const InterfaceVisualization *interfaceVisualization)
Definition: InterfaceTableVisualizerBase.cc:173
double displacementPriority
Definition: InterfaceTableVisualizerBase.h:67
virtual InterfaceEntry * getInterfaceEntry(const InterfaceVisualization *interfaceVisualization)
Definition: InterfaceTableCanvasVisualizer.cc:80
virtual std::string getVisualizationText(const InterfaceEntry *interfaceEntry)
Definition: InterfaceTableVisualizerBase.cc:222
virtual cGate * getOutputGate(cModule *networkNode, InterfaceEntry *interfaceEntry)
Definition: InterfaceTableCanvasVisualizer.cc:92
InterfaceTableVisualizerBase::InterfaceVisualization * inet::visualizer::InterfaceTableCanvasVisualizer::createInterfaceVisualization ( cModule *  networkNode,
InterfaceEntry interfaceEntry 
)
overrideprotectedvirtual

Implements inet::visualizer::InterfaceTableVisualizerBase.

51 {
52  BoxedLabelFigure *figure = nullptr;
53  auto gate = displayWiredInterfacesAtConnections ? getOutputGate(networkNode, interfaceEntry) : nullptr;
54  if (gate == nullptr) {
55  figure = new BoxedLabelFigure("networkInterface");
56  figure->setTags((std::string("network_interface ") + tags).c_str());
57  figure->setTooltip("This label represents a network interface in a network node");
58  figure->setAssociatedObject(interfaceEntry);
59  figure->setZIndex(zIndex);
60  figure->setFont(font);
61  figure->setText(getVisualizationText(interfaceEntry).c_str());
62  figure->setLabelColor(textColor);
63  figure->setBackgroundColor(backgroundColor);
64  figure->setOpacity(opacity);
65  if (!displayBackground) {
66  figure->setInset(0);
67  figure->getRectangleFigure()->setVisible(false);
68  }
69  }
70  auto networkNodeVisualization = networkNodeVisualizer->getNetworkNodeVisualization(networkNode);
71  return new InterfaceCanvasVisualization(networkNodeVisualization, figure, networkNode->getId(), interfaceEntry->getInterfaceId());
72 }
const char * tags
Definition: VisualizerBase.h:32
double zIndex
Definition: InterfaceTableCanvasVisualizer.h:44
cFigure::Color backgroundColor
Definition: InterfaceTableVisualizerBase.h:70
NetworkNodeCanvasVisualizer * networkNodeVisualizer
Definition: InterfaceTableCanvasVisualizer.h:45
bool displayBackground
Definition: InterfaceTableVisualizerBase.h:62
virtual NetworkNodeCanvasVisualization * getNetworkNodeVisualization(const cModule *networkNode) const
Definition: NetworkNodeCanvasVisualizer.cc:63
double opacity
Definition: InterfaceTableVisualizerBase.h:71
bool displayWiredInterfacesAtConnections
Definition: InterfaceTableVisualizerBase.h:61
cFigure::Color textColor
Definition: InterfaceTableVisualizerBase.h:69
cFigure::Font font
Definition: InterfaceTableVisualizerBase.h:68
virtual std::string getVisualizationText(const InterfaceEntry *interfaceEntry)
Definition: InterfaceTableVisualizerBase.cc:222
virtual cGate * getOutputGate(cModule *networkNode, InterfaceEntry *interfaceEntry)
Definition: InterfaceTableCanvasVisualizer.cc:92
InterfaceEntry * inet::visualizer::InterfaceTableCanvasVisualizer::getInterfaceEntry ( const InterfaceVisualization interfaceVisualization)
protectedvirtual

Referenced by addInterfaceVisualization(), and getOutputGate().

81 {
82  L3AddressResolver addressResolver;
83  auto networkNode = getNetworkNode(interfaceVisualization);
84  if (networkNode == nullptr)
85  return nullptr;
86  auto interfaceTable = addressResolver.findInterfaceTableOf(networkNode);
87  if (interfaceTable == nullptr)
88  return nullptr;
89  return interfaceTable->getInterfaceById(interfaceVisualization->interfaceId);
90 }
virtual cModule * getNetworkNode(const InterfaceVisualization *interfaceVisualization)
Definition: InterfaceTableCanvasVisualizer.cc:74
cModule * inet::visualizer::InterfaceTableCanvasVisualizer::getNetworkNode ( const InterfaceVisualization interfaceVisualization)
protectedvirtual

Referenced by getInterfaceEntry(), and getOutputGate().

75 {
76  L3AddressResolver addressResolver;
77  return getSimulation()->getModule(interfaceVisualization->networkNodeId);
78 }
cGate * inet::visualizer::InterfaceTableCanvasVisualizer::getOutputGate ( cModule *  networkNode,
InterfaceEntry interfaceEntry 
)
protectedvirtual

Referenced by addInterfaceVisualization(), createInterfaceVisualization(), getOutputGate(), refreshInterfaceVisualization(), and removeInterfaceVisualization().

93 {
94  if (interfaceEntry->getNodeOutputGateId() == -1)
95  return nullptr;
96  cGate *outputGate = networkNode->gate(interfaceEntry->getNodeOutputGateId());
97  if (outputGate == nullptr || outputGate->getChannel() == nullptr)
98  return nullptr;
99  else
100  return outputGate;
101 }
cGate * inet::visualizer::InterfaceTableCanvasVisualizer::getOutputGate ( const InterfaceVisualization interfaceVisualization)
protectedvirtual
104 {
105  auto networkNode = getNetworkNode(interfaceVisualization);
106  auto interfaceEntry = getInterfaceEntry(interfaceVisualization);
107  if (interfaceEntry == nullptr)
108  return nullptr;
109  else
110  return getOutputGate(networkNode, interfaceEntry);
111 }
virtual cModule * getNetworkNode(const InterfaceVisualization *interfaceVisualization)
Definition: InterfaceTableCanvasVisualizer.cc:74
virtual InterfaceEntry * getInterfaceEntry(const InterfaceVisualization *interfaceVisualization)
Definition: InterfaceTableCanvasVisualizer.cc:80
virtual cGate * getOutputGate(cModule *networkNode, InterfaceEntry *interfaceEntry)
Definition: InterfaceTableCanvasVisualizer.cc:92
void inet::visualizer::InterfaceTableCanvasVisualizer::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::visualizer::InterfaceTableVisualizerBase.

41 {
43  if (!hasGUI()) return;
44  if (stage == INITSTAGE_LOCAL) {
45  zIndex = par("zIndex");
46  networkNodeVisualizer = getModuleFromPar<NetworkNodeCanvasVisualizer>(par("networkNodeVisualizerModule"), this);
47  }
48 }
virtual void initialize(int stage) override
Definition: InterfaceTableVisualizerBase.cc:110
double zIndex
Definition: InterfaceTableCanvasVisualizer.h:44
NetworkNodeCanvasVisualizer * networkNodeVisualizer
Definition: InterfaceTableCanvasVisualizer.h:45
Local initializations.
Definition: InitStages.h:35
void inet::visualizer::InterfaceTableCanvasVisualizer::refreshInterfaceVisualization ( const InterfaceVisualization interfaceVisualization,
const InterfaceEntry interfaceEntry 
)
overrideprotectedvirtual

Implements inet::visualizer::InterfaceTableVisualizerBase.

139 {
140  auto interfaceCanvasVisualization = static_cast<const InterfaceCanvasVisualization *>(interfaceVisualization);
141  auto gate = displayWiredInterfacesAtConnections ? getOutputGate(interfaceVisualization) : nullptr;
142  if (gate != nullptr)
143  gate->getDisplayString().setTagArg("t", 0, getVisualizationText(interfaceEntry).c_str());
144  else {
145  auto figure = interfaceCanvasVisualization->figure;
146  figure->setText(getVisualizationText(interfaceEntry).c_str());
147  interfaceCanvasVisualization->networkNodeVisualization->setAnnotationSize(figure, figure->getBounds().getSize());
148  }
149 }
bool displayWiredInterfacesAtConnections
Definition: InterfaceTableVisualizerBase.h:61
virtual std::string getVisualizationText(const InterfaceEntry *interfaceEntry)
Definition: InterfaceTableVisualizerBase.cc:222
virtual cGate * getOutputGate(cModule *networkNode, InterfaceEntry *interfaceEntry)
Definition: InterfaceTableCanvasVisualizer.cc:92
void inet::visualizer::InterfaceTableCanvasVisualizer::removeInterfaceVisualization ( const InterfaceVisualization interfaceVisualization)
overrideprotectedvirtual

Reimplemented from inet::visualizer::InterfaceTableVisualizerBase.

128 {
130  auto interfaceCanvasVisualization = static_cast<const InterfaceCanvasVisualization *>(interfaceVisualization);
131  auto gate = displayWiredInterfacesAtConnections ? getOutputGate(interfaceVisualization) : nullptr;
132  if (gate != nullptr)
133  gate->getDisplayString().setTagArg("t", 0, "");
134  else
135  interfaceCanvasVisualization->networkNodeVisualization->removeAnnotation(interfaceCanvasVisualization->figure);
136 }
virtual void removeInterfaceVisualization(const InterfaceVisualization *interfaceVisualization)
Definition: InterfaceTableVisualizerBase.cc:199
bool displayWiredInterfacesAtConnections
Definition: InterfaceTableVisualizerBase.h:61
virtual cGate * getOutputGate(cModule *networkNode, InterfaceEntry *interfaceEntry)
Definition: InterfaceTableCanvasVisualizer.cc:92

Member Data Documentation

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

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