INET Framework for OMNeT++/OMNEST
inet::TrailFigure Class Reference

#include <TrailFigure.h>

Inheritance diagram for inet::TrailFigure:

Public Member Functions

 TrailFigure (int maxCount, bool fadeOut, const char *name=nullptr)
 
virtual void addFigure (cFigure *figure) override
 

Protected Attributes

int maxCount
 
int fadeCounter
 
bool fadeOut
 

Constructor & Destructor Documentation

inet::TrailFigure::TrailFigure ( int  maxCount,
bool  fadeOut,
const char *  name = nullptr 
)
22  :
23  cGroupFigure(name),
25  fadeCounter(0),
27 {
28 }
int maxCount
Definition: TrailFigure.h:28
int fadeCounter
Definition: TrailFigure.h:29
bool fadeOut
Definition: TrailFigure.h:30

Member Function Documentation

void inet::TrailFigure::addFigure ( cFigure *  figure)
overridevirtual

Referenced by inet::visualizer::MobilityCanvasVisualizer::ensureMobilityVisualization(), and inet::visualizer::MobilityCanvasVisualizer::extendMovementTrail().

31 {
32  cGroupFigure::addFigure(figure);
33  if (getNumFigures() > maxCount)
34  delete removeFigure(0);
35  if (fadeOut) {
36  if (fadeCounter > 0)
37  fadeCounter--;
38  else {
39  int count = getNumFigures();
40  fadeCounter = count / 10;
41  for (int i = 0; i < count; i++) {
42  cFigure *figure = getFigure(i);
43  cAbstractLineFigure *lineFigure = dynamic_cast<cAbstractLineFigure *>(figure);
44  if (lineFigure)
45  lineFigure->setLineOpacity((double)i / count);
46  }
47  }
48  }
49 }
int count(const std::vector< T > &v, const T &a)
Definition: stlutils.h:58
int maxCount
Definition: TrailFigure.h:28
int fadeCounter
Definition: TrailFigure.h:29
bool fadeOut
Definition: TrailFigure.h:30

Member Data Documentation

int inet::TrailFigure::fadeCounter
protected

Referenced by addFigure().

bool inet::TrailFigure::fadeOut
protected

Referenced by addFigure().

int inet::TrailFigure::maxCount
protected

Referenced by addFigure().


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