profile: set DiveCartesianAxis::fontLabelScale in constructor

This never changes, no need for the complexities of a setter
function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-09-11 22:14:45 +02:00 committed by Dirk Hohndel
parent 4b9177c098
commit f19ab2e4fd
3 changed files with 13 additions and 23 deletions

View file

@ -11,12 +11,6 @@
static const double labelSpaceHorizontal = 2.0; // space between label and ticks
static const double labelSpaceVertical = 2.0; // space between label and ticks
void DiveCartesianAxis::setFontLabelScale(qreal scale)
{
labelScale = scale;
changed = true;
}
void DiveCartesianAxis::setBounds(double minimum, double maximum)
{
changed = !IS_FP_SAME(max, maximum) || !IS_FP_SAME(min, minimum);
@ -25,7 +19,7 @@ void DiveCartesianAxis::setBounds(double minimum, double maximum)
}
DiveCartesianAxis::DiveCartesianAxis(Position position, color_index_t gridColor, double dpr,
bool printMode, bool isGrayscale, ProfileScene &scene) :
double labelScale, bool printMode, bool isGrayscale, ProfileScene &scene) :
printMode(printMode),
position(position),
gridColor(gridColor),
@ -36,7 +30,7 @@ DiveCartesianAxis::DiveCartesianAxis(Position position, color_index_t gridColor,
interval(1),
textVisibility(true),
lineVisibility(true),
labelScale(1.0),
labelScale(labelScale),
changed(true),
dpr(dpr)
{
@ -390,8 +384,8 @@ QString TemperatureAxis::textForValue(double value) const
}
PartialGasPressureAxis::PartialGasPressureAxis(const DivePlotDataModel &model, Position position, color_index_t gridColor,
double dpr, bool printMode, bool isGrayscale, ProfileScene &scene) :
DiveCartesianAxis(position, gridColor, dpr, printMode, isGrayscale, scene),
double dpr, double labelScale, bool printMode, bool isGrayscale, ProfileScene &scene) :
DiveCartesianAxis(position, gridColor, dpr, labelScale, printMode, isGrayscale, scene),
model(model)
{
}

View file

@ -33,12 +33,11 @@ public:
Left, Right, Bottom
};
DiveCartesianAxis(Position position, color_index_t gridColor, double dpr,
bool printMode, bool isGrayscale, ProfileScene &scene);
double labelScale, bool printMode, bool isGrayscale, ProfileScene &scene);
~DiveCartesianAxis();
void setBounds(double min, double max);
void setTickInterval(double interval);
void setOrientation(Orientation orientation);
void setFontLabelScale(qreal scale);
double minimum() const;
double maximum() const;
std::pair<double, double> screenMinMax() const;
@ -108,7 +107,7 @@ class PartialGasPressureAxis : public DiveCartesianAxis {
Q_OBJECT
public:
PartialGasPressureAxis(const DivePlotDataModel &model, Position position, color_index_t gridColor,
double dpr, bool printMode, bool isGrayscale, ProfileScene &scene);
double dpr, double labelScale, bool printMode, bool isGrayscale, ProfileScene &scene);
void update(int animSpeed);
double width() const;
private:

View file

@ -47,13 +47,13 @@ ProfileScene::ProfileScene(double dpr, bool printMode, bool isGrayscale) :
maxtime(-1),
maxdepth(-1),
dataModel(new DivePlotDataModel(this)),
profileYAxis(new DepthAxis(DiveCartesianAxis::Position::Left, TIME_GRID, dpr, printMode, isGrayscale, *this)),
gasYAxis(new PartialGasPressureAxis(*dataModel, DiveCartesianAxis::Position::Right, TIME_GRID, dpr, printMode, isGrayscale, *this)),
temperatureAxis(new TemperatureAxis(DiveCartesianAxis::Position::Right, TIME_GRID, dpr, printMode, isGrayscale, *this)),
timeAxis(new TimeAxis(DiveCartesianAxis::Position::Bottom, TIME_GRID, dpr, printMode, isGrayscale, *this)),
cylinderPressureAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Right, TIME_GRID, dpr, printMode, isGrayscale, *this)),
heartBeatAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Left, HR_AXIS, dpr, printMode, isGrayscale, *this)),
percentageAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Right, TIME_GRID, dpr, printMode, isGrayscale, *this)),
profileYAxis(new DepthAxis(DiveCartesianAxis::Position::Left, TIME_GRID, dpr, 1.0, printMode, isGrayscale, *this)),
gasYAxis(new PartialGasPressureAxis(*dataModel, DiveCartesianAxis::Position::Right, TIME_GRID, dpr, 0.7, printMode, isGrayscale, *this)),
temperatureAxis(new TemperatureAxis(DiveCartesianAxis::Position::Right, TIME_GRID, dpr, 1.0, printMode, isGrayscale, *this)),
timeAxis(new TimeAxis(DiveCartesianAxis::Position::Bottom, TIME_GRID, dpr, 1.0, printMode, isGrayscale, *this)),
cylinderPressureAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Right, TIME_GRID, dpr, 1.0, printMode, isGrayscale, *this)),
heartBeatAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Left, HR_AXIS, dpr, 0.7, printMode, isGrayscale, *this)),
percentageAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Right, TIME_GRID, dpr, 0.7, printMode, isGrayscale, *this)),
diveProfileItem(createItem<DiveProfileItem>(*profileYAxis, DivePlotDataModel::DEPTH, 0, dpr)),
temperatureItem(createItem<DiveTemperatureItem>(*temperatureAxis, DivePlotDataModel::TEMPERATURE, 1, dpr)),
meanDepthItem(createItem<DiveMeanDepthItem>(*profileYAxis, DivePlotDataModel::INSTANT_MEANDEPTH, 1, dpr)),
@ -86,16 +86,13 @@ ProfileScene::ProfileScene(double dpr, bool printMode, bool isGrayscale) :
gasYAxis->setOrientation(DiveCartesianAxis::BottomToTop);
gasYAxis->setTickInterval(1);
gasYAxis->setFontLabelScale(0.7);
#ifndef SUBSURFACE_MOBILE
heartBeatAxis->setOrientation(DiveCartesianAxis::BottomToTop);
heartBeatAxis->setTickInterval(10);
heartBeatAxis->setFontLabelScale(0.7);
percentageAxis->setOrientation(DiveCartesianAxis::BottomToTop);
percentageAxis->setTickInterval(10);
percentageAxis->setFontLabelScale(0.7);
#endif
temperatureAxis->setOrientation(DiveCartesianAxis::BottomToTop);