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

@ -34,7 +34,7 @@ public:
};
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);
~DiveCartesianAxis();
void setBounds(double min, double max);
@ -57,9 +57,9 @@ private:
int fractionalDigits;
QRectF rect; // Rectangle to fill with grid lines
QPen gridPen;
QColor textColor;
ProfileScene &scene;
QString textForValue(double value) const;
virtual QColor colorForValue(double value) const;
Orientation orientation;
QList<DiveTextItem *> labels;
QList<DiveLineItem *> lines;
@ -86,26 +86,4 @@ private:
void updateLines(int numTicks, double firstPosScreen, double stepScreen, int animSpeed);
};
class DepthAxis : public DiveCartesianAxis {
Q_OBJECT
public:
using DiveCartesianAxis::DiveCartesianAxis;
private:
QColor colorForValue(double value) const override;
};
class TimeAxis : public DiveCartesianAxis {
Q_OBJECT
public:
using DiveCartesianAxis::DiveCartesianAxis;
private:
QColor colorForValue(double value) const override;
};
class TemperatureAxis : public DiveCartesianAxis {
Q_OBJECT
public:
using DiveCartesianAxis::DiveCartesianAxis;
};
#endif // DIVECARTESIANAXIS_H