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

#include <MobilityVisualizerBase.h>

Inheritance diagram for inet::visualizer::MobilityVisualizerBase:
inet::visualizer::VisualizerBase inet::visualizer::MobilityCanvasVisualizer inet::visualizer::MobilityOsgVisualizer

Classes

class  MobilityVisualization
 

Public Member Functions

virtual ~MobilityVisualizerBase ()
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual void handleParameterChange (const char *name) override
 
virtual void subscribe ()
 
virtual void unsubscribe ()
 
- 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

Parameters
bool displayMovements = false
 
double animationSpeed = NaN
 
ModuleFilter moduleFilter
 
bool displayOrientations = false
 
double orientationArcSize = NaN
 
cFigure::Color orientationLineColor
 
cFigure::LineStyle orientationLineStyle
 
double orientationLineWidth = NaN
 
bool displayVelocities = false
 
double velocityArrowScale = NaN
 
cFigure::Color velocityLineColor
 
cFigure::LineStyle velocityLineStyle
 
double velocityLineWidth = NaN
 
bool displayMovementTrails = false
 
bool autoMovementTrailLineColor = false
 
ColorSet movementTrailLineColorSet
 
cFigure::LineStyle movementTrailLineStyle
 
double movementTrailLineWidth = NaN
 
int trailLength = -1
 
- Protected Attributes inherited from inet::visualizer::VisualizerBase
cModule * visualizerTargetModule = nullptr
 
const char * tags = nullptr
 

Constructor & Destructor Documentation

inet::visualizer::MobilityVisualizerBase::~MobilityVisualizerBase ( )
virtual
31 {
32  if (displayMovements)
33  unsubscribe();
34 }
bool displayMovements
Definition: MobilityVisualizerBase.h:43
virtual void unsubscribe()
Definition: MobilityVisualizerBase.cc:82

Member Function Documentation

void inet::visualizer::MobilityVisualizerBase::handleParameterChange ( const char *  name)
overrideprotectedvirtual
68 {
69  if (name != nullptr) {
70  if (!strcmp(name, "moduleFilter"))
71  moduleFilter.setPattern(par("moduleFilter"));
72  // TODO:
73  }
74 }
ModuleFilter moduleFilter
Definition: MobilityVisualizerBase.h:45
void setPattern(const char *pattern)
Definition: ModuleFilter.cc:24
void inet::visualizer::MobilityVisualizerBase::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::visualizer::VisualizerBase.

Reimplemented in inet::visualizer::MobilityOsgVisualizer, and inet::visualizer::MobilityCanvasVisualizer.

Referenced by inet::visualizer::MobilityCanvasVisualizer::initialize().

37 {
39  if (!hasGUI()) return;
40  if (stage == INITSTAGE_LOCAL) {
41  displayMovements = par("displayMovements");
42  animationSpeed = par("animationSpeed");
43  moduleFilter.setPattern(par("moduleFilter"));
44  // orientation
45  displayOrientations = par("displayOrientations");
46  orientationArcSize = par("orientationArcSize");
47  orientationLineColor = cFigure::parseColor(par("orientationLineColor"));
48  orientationLineStyle = cFigure::parseLineStyle(par("orientationLineStyle"));
49  orientationLineWidth = par("orientationLineWidth");
50  // velocity
51  displayVelocities = par("displayVelocities");
52  velocityArrowScale = par("velocityArrowScale");
53  velocityLineColor = cFigure::parseColor(par("velocityLineColor"));
54  velocityLineStyle = cFigure::parseLineStyle(par("velocityLineStyle"));
55  velocityLineWidth = par("velocityLineWidth");
56  // movement trail
57  displayMovementTrails = par("displayMovementTrails");
58  movementTrailLineColorSet.parseColors(par("movementTrailLineColor"));
59  movementTrailLineStyle = cFigure::parseLineStyle(par("movementTrailLineStyle"));
60  movementTrailLineWidth = par("movementTrailLineWidth");
61  trailLength = par("trailLength");
62  if (displayMovements)
63  subscribe();
64  }
65 }
double velocityLineWidth
Definition: MobilityVisualizerBase.h:57
virtual void subscribe()
Definition: MobilityVisualizerBase.cc:76
int trailLength
Definition: MobilityVisualizerBase.h:64
cFigure::Color velocityLineColor
Definition: MobilityVisualizerBase.h:55
void parseColors(const char *colorNames)
Definition: ColorSet.cc:24
ColorSet movementTrailLineColorSet
Definition: MobilityVisualizerBase.h:61
bool displayVelocities
Definition: MobilityVisualizerBase.h:53
cFigure::LineStyle velocityLineStyle
Definition: MobilityVisualizerBase.h:56
ModuleFilter moduleFilter
Definition: MobilityVisualizerBase.h:45
void setPattern(const char *pattern)
Definition: ModuleFilter.cc:24
bool displayMovements
Definition: MobilityVisualizerBase.h:43
virtual void initialize(int stage) override
Definition: VisualizerBase.cc:29
double animationSpeed
Definition: MobilityVisualizerBase.h:44
Local initializations.
Definition: InitStages.h:35
bool displayMovementTrails
Definition: MobilityVisualizerBase.h:59
double orientationArcSize
Definition: MobilityVisualizerBase.h:48
double movementTrailLineWidth
Definition: MobilityVisualizerBase.h:63
double velocityArrowScale
Definition: MobilityVisualizerBase.h:54
double orientationLineWidth
Definition: MobilityVisualizerBase.h:51
cFigure::LineStyle orientationLineStyle
Definition: MobilityVisualizerBase.h:50
cFigure::LineStyle movementTrailLineStyle
Definition: MobilityVisualizerBase.h:62
cFigure::Color orientationLineColor
Definition: MobilityVisualizerBase.h:49
bool displayOrientations
Definition: MobilityVisualizerBase.h:47
void inet::visualizer::MobilityVisualizerBase::subscribe ( )
protectedvirtual

Referenced by initialize().

77 {
78  auto subscriptionModule = getModuleFromPar<cModule>(par("subscriptionModule"), this);
79  subscriptionModule->subscribe(IMobility::mobilityStateChangedSignal, this);
80 }
static simsignal_t mobilityStateChangedSignal
A signal used to publish mobility state changes.
Definition: IMobility.h:42
void inet::visualizer::MobilityVisualizerBase::unsubscribe ( )
protectedvirtual

Referenced by ~MobilityVisualizerBase().

83 {
84  // NOTE: lookup the module again because it may have been deleted first
85  auto subscriptionModule = getModuleFromPar<cModule>(par("subscriptionModule"), this, false);
86  if (subscriptionModule != nullptr)
87  subscriptionModule->unsubscribe(IMobility::mobilityStateChangedSignal, this);
88 }
static simsignal_t mobilityStateChangedSignal
A signal used to publish mobility state changes.
Definition: IMobility.h:42

Member Data Documentation

double inet::visualizer::MobilityVisualizerBase::animationSpeed = NaN
protected
bool inet::visualizer::MobilityVisualizerBase::autoMovementTrailLineColor = false
protected
bool inet::visualizer::MobilityVisualizerBase::displayMovements = false
protected
bool inet::visualizer::MobilityVisualizerBase::displayMovementTrails = false
protected
bool inet::visualizer::MobilityVisualizerBase::displayOrientations = false
protected
bool inet::visualizer::MobilityVisualizerBase::displayVelocities = false
protected
ModuleFilter inet::visualizer::MobilityVisualizerBase::moduleFilter
protected
ColorSet inet::visualizer::MobilityVisualizerBase::movementTrailLineColorSet
protected
cFigure::LineStyle inet::visualizer::MobilityVisualizerBase::movementTrailLineStyle
protected
double inet::visualizer::MobilityVisualizerBase::movementTrailLineWidth = NaN
protected
double inet::visualizer::MobilityVisualizerBase::orientationArcSize = NaN
protected
cFigure::Color inet::visualizer::MobilityVisualizerBase::orientationLineColor
protected
cFigure::LineStyle inet::visualizer::MobilityVisualizerBase::orientationLineStyle
protected
double inet::visualizer::MobilityVisualizerBase::orientationLineWidth = NaN
protected
int inet::visualizer::MobilityVisualizerBase::trailLength = -1
protected
double inet::visualizer::MobilityVisualizerBase::velocityArrowScale = NaN
protected
cFigure::Color inet::visualizer::MobilityVisualizerBase::velocityLineColor
protected
cFigure::LineStyle inet::visualizer::MobilityVisualizerBase::velocityLineStyle
protected
double inet::visualizer::MobilityVisualizerBase::velocityLineWidth = NaN
protected

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