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

#include <QueueFigure.h>

Inheritance diagram for inet::QueueFigure:

Public Member Functions

 QueueFigure (const char *name=nullptr)
 
cFigure::Color getColor () const
 
void setColor (cFigure::Color color)
 
double getSpacing () const
 
void setSpacing (double spacing)
 
void setElementCount (int elementCount)
 
void setMaxElementCount (int maxElementCount)
 

Protected Attributes

cFigure::Color color
 
bool continuous = false
 
double spacing = 2
 
double elementWidth = 16
 
double elementHeight = 4
 
int elementCount = -1
 
int maxElementCount = -1
 
std::vector< cRectangleFigure * > boxes
 

Constructor & Destructor Documentation

◆ QueueFigure()

inet::QueueFigure::QueueFigure ( const char *  name = nullptr)
12  :
13  cRectangleFigure(name)
14 {
15 }

Member Function Documentation

◆ getColor()

cFigure::Color inet::QueueFigure::getColor ( ) const
inline
30 { return color; }

◆ getSpacing()

double inet::QueueFigure::getSpacing ( ) const
inline
33 { return spacing; }

◆ setColor()

void inet::QueueFigure::setColor ( cFigure::Color  color)
inline
31 { this->color = color; }

◆ setElementCount()

void inet::QueueFigure::setElementCount ( int  elementCount)
53 {
54  if (this->elementCount != elementCount) {
55  this->elementCount = elementCount;
56  if (continuous) {
57  const auto& bounds = getBounds();
58  double width = bounds.width - 2 * spacing;
59  double height = (bounds.height - 2 * spacing) * elementCount / maxElementCount;
60  boxes[0]->setBounds(cFigure::Rectangle(spacing, bounds.height - spacing - height, width, height));
61  }
62  else
63  for (size_t i = 0; i < boxes.size(); i++)
64  boxes[i]->setVisible((boxes.size() - i) <= (size_t)elementCount);
65  }
66 }

◆ setMaxElementCount()

void inet::QueueFigure::setMaxElementCount ( int  maxElementCount)
18 {
19  if (this->maxElementCount != maxElementCount) {
21  for (auto box : boxes) {
22  removeFigure(box);
23  delete box;
24  }
25  boxes.clear();
26  const auto& bounds = getBounds();
27  elementWidth = bounds.width - 2 * spacing;
28  elementHeight = (bounds.height - (maxElementCount + 1) * spacing) / maxElementCount;
30  if (continuous) {
31  auto box = new cRectangleFigure("box");
32  box->setOutlined(false);
33  box->setFilled(true);
34  box->setFillColor(color);
35  boxes.push_back(box);
36  addFigure(box);
37  }
38  else {
39  for (int i = 0; i < maxElementCount; i++) {
40  auto box = new cRectangleFigure("box");
41  box->setOutlined(false);
42  box->setFilled(true);
43  box->setFillColor(color);
44  box->setBounds(cFigure::Rectangle(spacing, spacing + i * (elementHeight + spacing), elementWidth, elementHeight));
45  boxes.push_back(box);
46  addFigure(box);
47  }
48  }
49  }
50 }

◆ setSpacing()

void inet::QueueFigure::setSpacing ( double  spacing)
inline
34 { this->spacing = spacing; }

Member Data Documentation

◆ boxes

std::vector<cRectangleFigure *> inet::QueueFigure::boxes
protected

◆ color

cFigure::Color inet::QueueFigure::color
protected

Referenced by setMaxElementCount().

◆ continuous

bool inet::QueueFigure::continuous = false
protected

◆ elementCount

int inet::QueueFigure::elementCount = -1
protected

Referenced by setElementCount().

◆ elementHeight

double inet::QueueFigure::elementHeight = 4
protected

Referenced by setMaxElementCount().

◆ elementWidth

double inet::QueueFigure::elementWidth = 16
protected

Referenced by setMaxElementCount().

◆ maxElementCount

int inet::QueueFigure::maxElementCount = -1
protected

◆ spacing

double inet::QueueFigure::spacing = 2
protected

The documentation for this class was generated from the following files:
inet::QueueFigure::elementCount
int elementCount
Definition: QueueFigure.h:23
inet::QueueFigure::elementHeight
double elementHeight
Definition: QueueFigure.h:22
inet::QueueFigure::boxes
std::vector< cRectangleFigure * > boxes
Definition: QueueFigure.h:25
inet::QueueFigure::elementWidth
double elementWidth
Definition: QueueFigure.h:21
inet::QueueFigure::continuous
bool continuous
Definition: QueueFigure.h:19
inet::QueueFigure::spacing
double spacing
Definition: QueueFigure.h:20
inet::QueueFigure::maxElementCount
int maxElementCount
Definition: QueueFigure.h:24
inet::QueueFigure::color
cFigure::Color color
Definition: QueueFigure.h:18