|
INET Framework for OMNeT++/OMNEST
|
#include <ThermometerFigure.h>
◆ ThermometerFigure()
| inet::ThermometerFigure::ThermometerFigure |
( |
const char * |
name = nullptr | ) |
|
◆ ~ThermometerFigure()
| inet::ThermometerFigure::~ThermometerFigure |
( |
| ) |
|
|
virtual |
◆ addChildren()
| void inet::ThermometerFigure::addChildren |
( |
| ) |
|
|
protected |
◆ getAllowedPropertyKeys()
| const char ** inet::ThermometerFigure::getAllowedPropertyKeys |
( |
| ) |
const |
|
overrideprotectedvirtual |
192 static const char *
keys[32];
194 const char *localKeys[] = {
195 PKEY_MERCURY_COLOR, PKEY_LABEL, PKEY_LABEL_FONT,
196 PKEY_LABEL_COLOR, PKEY_MIN_VALUE, PKEY_MAX_VALUE, PKEY_TICK_SIZE,
197 PKEY_INITIAL_VALUE, PKEY_POS, PKEY_SIZE, PKEY_ANCHOR, PKEY_BOUNDS, PKEY_LABEL_OFFSET,
nullptr
199 concatArrays(
keys, cGroupFigure::getAllowedPropertyKeys(), localKeys);
◆ getBounds()
| const cFigure::Rectangle & inet::ThermometerFigure::getBounds |
( |
| ) |
const |
◆ getContainerGeometry()
| void inet::ThermometerFigure::getContainerGeometry |
( |
double & |
x, |
|
|
double & |
y, |
|
|
double & |
width, |
|
|
double & |
height, |
|
|
double & |
offset |
|
) |
| |
|
protected |
◆ getLabel()
| const char * inet::ThermometerFigure::getLabel |
( |
| ) |
const |
◆ getLabelColor()
| const cFigure::Color & inet::ThermometerFigure::getLabelColor |
( |
| ) |
const |
◆ getLabelFont()
| const cFigure::Font & inet::ThermometerFigure::getLabelFont |
( |
| ) |
const |
◆ getLabelOffset()
| int inet::ThermometerFigure::getLabelOffset |
( |
| ) |
const |
◆ getMaxValue()
| double inet::ThermometerFigure::getMaxValue |
( |
| ) |
const |
◆ getMercuryColor()
| const cFigure::Color & inet::ThermometerFigure::getMercuryColor |
( |
| ) |
const |
◆ getMinValue()
| double inet::ThermometerFigure::getMinValue |
( |
| ) |
const |
◆ getSize()
| virtual const Point inet::ThermometerFigure::getSize |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ getTickSize()
| double inet::ThermometerFigure::getTickSize |
( |
| ) |
const |
◆ layout()
| void inet::ThermometerFigure::layout |
( |
| ) |
|
|
protected |
◆ parse()
| void inet::ThermometerFigure::parse |
( |
cProperty * |
property | ) |
|
|
overrideprotectedvirtual |
161 cGroupFigure::parse(property);
169 if ((
s = property->getValue(PKEY_MERCURY_COLOR)) !=
nullptr)
171 if ((
s = property->getValue(PKEY_LABEL)) !=
nullptr)
173 if ((
s = property->getValue(PKEY_LABEL_OFFSET)) !=
nullptr)
175 if ((
s = property->getValue(PKEY_LABEL_FONT)) !=
nullptr)
177 if ((
s = property->getValue(PKEY_LABEL_COLOR)) !=
nullptr)
180 if ((
s = property->getValue(PKEY_TICK_SIZE)) !=
nullptr)
182 if ((
s = property->getValue(PKEY_MIN_VALUE)) !=
nullptr)
184 if ((
s = property->getValue(PKEY_MAX_VALUE)) !=
nullptr)
186 if ((
s = property->getValue(PKEY_INITIAL_VALUE)) !=
nullptr)
◆ redrawTicks()
| void inet::ThermometerFigure::redrawTicks |
( |
| ) |
|
|
protected |
326 double fraction = std::abs(fmod(
min /
tickSize, 1));
338 cLineFigure *tick =
new cLineFigure();
339 cTextFigure *number =
new cTextFigure();
343 number->setAnchor(cFigure::ANCHOR_W);
351 for (
int i =
numTicks; i < prevNumTicks; ++i) {
357 for (
int i = prevNumTicks; i <
numTicks; ++i) {
364 for (
int i = 0; i <
numTicks; ++i) {
368 if (std::abs(number) <
tickSize / 2)
372 sprintf(buf,
"%g", number);
Referenced by parse(), setMaxValue(), setMinValue(), and setTickSize().
◆ refresh()
| void inet::ThermometerFigure::refresh |
( |
| ) |
|
|
protected |
◆ setBounds()
| void inet::ThermometerFigure::setBounds |
( |
const Rectangle & |
rect | ) |
|
◆ setLabel()
| void inet::ThermometerFigure::setLabel |
( |
const char * |
text | ) |
|
◆ setLabelColor()
| void inet::ThermometerFigure::setLabelColor |
( |
const Color & |
color | ) |
|
◆ setLabelFont()
| void inet::ThermometerFigure::setLabelFont |
( |
const Font & |
font | ) |
|
◆ setLabelOffset()
| void inet::ThermometerFigure::setLabelOffset |
( |
int |
offset | ) |
|
◆ setMaxValue()
| void inet::ThermometerFigure::setMaxValue |
( |
double |
value | ) |
|
◆ setMercuryAndContainerGeometry()
| void inet::ThermometerFigure::setMercuryAndContainerGeometry |
( |
| ) |
|
|
protected |
281 double x, y, width, height, offset;
288 containerFigure->addArcRel(width / 2, width / 2, 0,
true,
false, width, 0);
290 containerFigure->addArcRel(width / 2, width / 2, 0,
true,
false, -width, 0);
294 if (std::isnan(
value))
298 mercuryFigure->addArcRel(width / 2, width / 2, 0,
true,
false, width, 0);
305 overflow = 2 * offset;
311 mercuryFigure->addMoveTo(x, y + offset + height * (1 - mercuryLevel));
312 mercuryFigure->addLineRel(0, height * mercuryLevel + overflow + offset);
315 mercuryFigure->addArcRel(width / 2, width / 2, 0,
true,
false, width, 0);
316 mercuryFigure->addLineRel(0, -height * mercuryLevel - overflow - offset);
318 mercuryFigure->addArcRel(width / 2, width / 2, 0,
true,
false, -width, 0);
Referenced by layout(), and refresh().
◆ setMercuryColor()
| void inet::ThermometerFigure::setMercuryColor |
( |
const Color & |
color | ) |
|
◆ setMinValue()
| void inet::ThermometerFigure::setMinValue |
( |
double |
value | ) |
|
◆ setNumberGeometry()
| void inet::ThermometerFigure::setNumberGeometry |
( |
cTextFigure * |
number, |
|
|
int |
index |
|
) |
| |
|
protected |
261 double x, y, width, height, offset;
264 double lineWidth =
getBounds().height * TICK_LINE_WIDTH_PERCENT;
265 x += width + lineWidth +
getBounds().width * TICK_LENGTH_PERCENT;
268 double pointSize =
getBounds().height * FONT_SIZE_PERCENT;
270 number->setPosition(Point(x + pointSize * NUMBER_DISTANCE_FROM_TICK_PERCENT, y));
271 number->setFont(cFigure::Font(
"", pointSize, 0));
Referenced by layout(), and redrawTicks().
◆ setTickGeometry()
| void inet::ThermometerFigure::setTickGeometry |
( |
cLineFigure * |
tick, |
|
|
int |
index |
|
) |
| |
|
protected |
236 double x, y, width, height, offset;
239 double lineWidth =
getBounds().height * TICK_LINE_WIDTH_PERCENT / 2;
240 x += width + lineWidth;
242 tick->setStart(Point(x, y));
243 tick->setEnd(Point(x +
getBounds().width * TICK_LENGTH_PERCENT, y));
244 tick->setLineWidth(lineWidth);
Referenced by layout(), and redrawTicks().
◆ setTickSize()
| void inet::ThermometerFigure::setTickSize |
( |
double |
value | ) |
|
◆ setValue()
| void inet::ThermometerFigure::setValue |
( |
int |
series, |
|
|
simtime_t |
timestamp, |
|
|
double |
value |
|
) |
| |
|
overridevirtual |
◆ bounds
| cFigure::Rectangle inet::ThermometerFigure::bounds |
|
protected |
◆ containerFigure
| cPathFigure* inet::ThermometerFigure::containerFigure |
|
protected |
◆ labelFigure
| cTextFigure* inet::ThermometerFigure::labelFigure |
|
protected |
◆ labelOffset
| int inet::ThermometerFigure::labelOffset = 10 |
|
protected |
◆ max
| double inet::ThermometerFigure::max = 100 |
|
protected |
◆ mercuryFigure
| cPathFigure* inet::ThermometerFigure::mercuryFigure |
|
protected |
◆ min
| double inet::ThermometerFigure::min = 0 |
|
protected |
◆ numberFigures
| std::vector<cTextFigure *> inet::ThermometerFigure::numberFigures |
|
protected |
◆ numTicks
| int inet::ThermometerFigure::numTicks = 0 |
|
protected |
◆ shifting
| double inet::ThermometerFigure::shifting = 0 |
|
protected |
◆ tickFigures
| std::vector<cLineFigure *> inet::ThermometerFigure::tickFigures |
|
protected |
◆ tickSize
| double inet::ThermometerFigure::tickSize = 10 |
|
protected |
◆ value
| double inet::ThermometerFigure::value = NaN |
|
protected |
The documentation for this class was generated from the following files:
value< double, units::s > s
Definition: Units.h:1235
double atod(const char *s)
Converts string to double.
Definition: INETUtils.cc:80
std::vector< K > keys(const std::map< K, V > &m)
Definition: stlutils.h:113
double max(const double a, const double b)
Returns the maximum of a and b.
Definition: SctpAssociation.h:266