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

#include <NetworkNodeCanvasVisualizer.h>

Inheritance diagram for inet::visualizer::NetworkNodeCanvasVisualizer:
inet::visualizer::NetworkNodeVisualizerBase inet::visualizer::VisualizerBase

Public Member Functions

virtual NetworkNodeCanvasVisualizationgetNetworkNodeVisualization (const cModule *networkNode) const
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual void refreshDisplay () const override
 
virtual NetworkNodeCanvasVisualizationcreateNetworkNodeVisualization (cModule *networkNode) const
 
virtual void setNetworkNodeVisualization (const cModule *networkNode, NetworkNodeCanvasVisualization *networkNodeVisualization)
 
- Protected Member Functions inherited from inet::visualizer::NetworkNodeVisualizerBase
virtual void handleParameterChange (const char *name) override
 
- 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

const CanvasProjectioncanvasProjection = nullptr
 
double zIndex = NaN
 
std::map< const cModule *, NetworkNodeCanvasVisualization * > networkNodeVisualizations
 
- Protected Attributes inherited from inet::visualizer::NetworkNodeVisualizerBase
NetworkNodeFilter nodeFilter
 
double annotationSpacing
 
double displacementPenalty
 
- Protected Attributes inherited from inet::visualizer::VisualizerBase
cModule * visualizerTargetModule = nullptr
 
const char * tags = nullptr
 

Member Function Documentation

NetworkNodeCanvasVisualization * inet::visualizer::NetworkNodeCanvasVisualizer::createNetworkNodeVisualization ( cModule *  networkNode) const
protectedvirtual

Referenced by initialize().

59 {
60  return new NetworkNodeCanvasVisualization(networkNode, annotationSpacing, displacementPenalty);
61 }
double displacementPenalty
Definition: NetworkNodeVisualizerBase.h:33
double annotationSpacing
Definition: NetworkNodeVisualizerBase.h:32
NetworkNodeCanvasVisualization * inet::visualizer::NetworkNodeCanvasVisualizer::getNetworkNodeVisualization ( const cModule *  networkNode) const
virtual

Referenced by inet::visualizer::TransportConnectionCanvasVisualizer::addConnectionVisualization(), inet::visualizer::EnergyStorageCanvasVisualizer::createEnergyStorageVisualization(), inet::visualizer::Ieee80211CanvasVisualizer::createIeee80211Visualization(), inet::visualizer::InfoCanvasVisualizer::createInfoVisualization(), inet::visualizer::InterfaceTableCanvasVisualizer::createInterfaceVisualization(), inet::visualizer::QueueCanvasVisualizer::createQueueVisualization(), inet::visualizer::RadioCanvasVisualizer::createRadioVisualization(), inet::visualizer::StatisticCanvasVisualizer::createStatisticVisualization(), inet::visualizer::MobilityCanvasVisualizer::ensureMobilityVisualization(), inet::visualizer::MediumCanvasVisualizer::radioAdded(), inet::visualizer::MediumCanvasVisualizer::radioRemoved(), inet::visualizer::MediumCanvasVisualizer::receptionEnded(), inet::visualizer::MediumCanvasVisualizer::receptionStarted(), inet::visualizer::TransportConnectionCanvasVisualizer::removeConnectionVisualization(), inet::visualizer::MediumCanvasVisualizer::transmissionEnded(), and inet::visualizer::MediumCanvasVisualizer::transmissionStarted().

64 {
65  auto it = networkNodeVisualizations.find(networkNode);
66  return it == networkNodeVisualizations.end() ? nullptr : it->second;
67 }
std::map< const cModule *, NetworkNodeCanvasVisualization * > networkNodeVisualizations
Definition: NetworkNodeCanvasVisualizer.h:34
void inet::visualizer::NetworkNodeCanvasVisualizer::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::visualizer::NetworkNodeVisualizerBase.

28 {
30  if (!hasGUI()) return;
31  if (stage == INITSTAGE_LOCAL) {
32  zIndex = par("zIndex");
33  auto canvas = visualizerTargetModule->getCanvas();
35  for (cModule::SubmoduleIterator it(getSystemModule()); !it.end(); it++) {
36  auto networkNode = *it;
37  if (isNetworkNode(networkNode) && nodeFilter.matches(networkNode)) {
38  auto visualization = createNetworkNodeVisualization(networkNode);
39  visualization->setZIndex(zIndex);
40  setNetworkNodeVisualization(networkNode, visualization);
41  visualizerTargetModule->getCanvas()->addFigure(visualization);
42  }
43  }
44  }
45 }
const CanvasProjection * canvasProjection
Definition: NetworkNodeCanvasVisualizer.h:32
bool matches(const cModule *module) const
Definition: NetworkNodeFilter.cc:29
bool isNetworkNode(const cModule *mod)
Returns true if the given module is a network node, i.e.
Definition: ModuleAccess.cc:28
virtual void setNetworkNodeVisualization(const cModule *networkNode, NetworkNodeCanvasVisualization *networkNodeVisualization)
Definition: NetworkNodeCanvasVisualizer.cc:69
Local initializations.
Definition: InitStages.h:35
NetworkNodeFilter nodeFilter
Definition: NetworkNodeVisualizerBase.h:31
double zIndex
Definition: NetworkNodeCanvasVisualizer.h:33
cModule * visualizerTargetModule
Definition: VisualizerBase.h:31
virtual void initialize(int stage) override
Definition: NetworkNodeVisualizerBase.cc:25
virtual NetworkNodeCanvasVisualization * createNetworkNodeVisualization(cModule *networkNode) const
Definition: NetworkNodeCanvasVisualizer.cc:58
static const CanvasProjection * getCanvasProjection(const cCanvas *canvas)
Definition: CanvasProjection.cc:38
void inet::visualizer::NetworkNodeCanvasVisualizer::refreshDisplay ( ) const
overrideprotectedvirtual
48 {
49  for (auto it : networkNodeVisualizations) {
50  auto networkNode = it.first;
51  auto visualization = it.second;
52  auto position = canvasProjection->computeCanvasPoint(getPosition(networkNode));
53  visualization->setTransform(cFigure::Transform().translate(position.x, position.y));
54  visualization->refreshDisplay();
55  }
56 }
const CanvasProjection * canvasProjection
Definition: NetworkNodeCanvasVisualizer.h:32
virtual Coord getPosition(const cModule *networkNode) const
Definition: VisualizerBase.cc:42
std::map< const cModule *, NetworkNodeCanvasVisualization * > networkNodeVisualizations
Definition: NetworkNodeCanvasVisualizer.h:34
cFigure::Point computeCanvasPoint(const Coord &point) const
Definition: CanvasProjection.cc:32
void inet::visualizer::NetworkNodeCanvasVisualizer::setNetworkNodeVisualization ( const cModule *  networkNode,
NetworkNodeCanvasVisualization networkNodeVisualization 
)
protectedvirtual

Referenced by initialize().

70 {
71  networkNodeVisualizations[networkNode] = networkNodeVisualization;
72 }
std::map< const cModule *, NetworkNodeCanvasVisualization * > networkNodeVisualizations
Definition: NetworkNodeCanvasVisualizer.h:34

Member Data Documentation

const CanvasProjection* inet::visualizer::NetworkNodeCanvasVisualizer::canvasProjection = nullptr
protected

Referenced by initialize(), and refreshDisplay().

std::map<const cModule *, NetworkNodeCanvasVisualization *> inet::visualizer::NetworkNodeCanvasVisualizer::networkNodeVisualizations
protected
double inet::visualizer::NetworkNodeCanvasVisualizer::zIndex = NaN
protected

Referenced by initialize().


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