profile: set textColor in constructor of DiveCartesianAxis

There were virtual functions to calculate the label colors
based on the value of the label. However, these functions
only returned constant values. Therefore, just set these
in the constructors.

Thuse, a few virtual functions and derived classes can be
removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-10-03 22:10:00 +02:00 committed by Dirk Hohndel
parent ea59e5cf7a
commit 3a79f3e78a
4 changed files with 16 additions and 57 deletions

View file

@ -19,11 +19,12 @@ void DiveCartesianAxis::setBounds(double minimum, double maximum)
}
DiveCartesianAxis::DiveCartesianAxis(Position position, int integralDigits, int fractionalDigits, color_index_t gridColor,
bool textVisible, bool linesVisible,
QColor textColor, bool textVisible, bool linesVisible,
double dpr, double labelScale, bool printMode, bool isGrayscale, ProfileScene &scene) :
printMode(printMode),
position(position),
fractionalDigits(fractionalDigits),
textColor(textColor),
scene(scene),
orientation(LeftToRight),
min(0),
@ -85,11 +86,6 @@ void DiveCartesianAxis::setTransform(double a, double b)
changed = true;
}
QColor DiveCartesianAxis::colorForValue(double) const
{
return QColor(Qt::black);
}
template <typename T>
void emptyList(QList<T *> &list, int steps, int speed)
{
@ -218,7 +214,7 @@ void DiveCartesianAxis::updateLabels(int numTicks, double firstPosScreen, double
firstPosScreen + i * stepScreen :
firstPosScreen - i * stepScreen;
labels[i]->set(textForValue(firstValue), colorForValue(firstValue));
labels[i]->set(textForValue(firstValue), textColor);
switch (position) {
default:
case Position::Bottom:
@ -245,7 +241,7 @@ void DiveCartesianAxis::updateLabels(int numTicks, double firstPosScreen, double
position == Position::Left ? Qt::AlignVCenter | Qt::AlignLeft:
Qt::AlignVCenter | Qt::AlignRight;
DiveTextItem *label = new DiveTextItem(dpr, labelScale, alignFlags, this);
label->set(textForValue(firstValue), colorForValue(firstValue));
label->set(textForValue(firstValue), textColor);
label->setZValue(1);
labels.push_back(label);
switch (position) {
@ -411,13 +407,3 @@ std::pair<double, double> DiveCartesianAxis::screenMinMax() const
return position == Position::Bottom ? std::make_pair(rect.left(), rect.right())
: std::make_pair(rect.top(), rect.bottom());
}
QColor DepthAxis::colorForValue(double) const
{
return QColor(Qt::red);
}
QColor TimeAxis::colorForValue(double) const
{
return QColor(Qt::blue);
}