mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
profile: pass position and gridColor on construction of axes
This is less hassle, than passing these around as parameters. Note: The values are stored but not yet used ("position" has not use yet and gridColor is still passed as parameter). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
766546fc19
commit
277b9234ab
3 changed files with 21 additions and 14 deletions
|
@ -50,8 +50,10 @@ void DiveCartesianAxis::setTextColor(const QColor &color)
|
|||
textColor = color;
|
||||
}
|
||||
|
||||
DiveCartesianAxis::DiveCartesianAxis(double dpr, bool printMode, ProfileScene &scene) :
|
||||
DiveCartesianAxis::DiveCartesianAxis(Position position, color_index_t gridColor, double dpr, bool printMode, ProfileScene &scene) :
|
||||
printMode(printMode),
|
||||
position(position),
|
||||
gridColor(gridColor),
|
||||
scene(scene),
|
||||
orientation(LeftToRight),
|
||||
min(0),
|
||||
|
@ -359,7 +361,8 @@ QColor DepthAxis::colorForValue(double) const
|
|||
return QColor(Qt::red);
|
||||
}
|
||||
|
||||
DepthAxis::DepthAxis(double dpr, bool printMode, ProfileScene &scene) : DiveCartesianAxis(dpr, printMode, scene)
|
||||
DepthAxis::DepthAxis(Position position, color_index_t gridColor, double dpr, bool printMode, ProfileScene &scene) :
|
||||
DiveCartesianAxis(position, gridColor, dpr, printMode, scene)
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
|
@ -392,8 +395,9 @@ QString TemperatureAxis::textForValue(double value) const
|
|||
return QString::number(mkelvin_to_C((int)value));
|
||||
}
|
||||
|
||||
PartialGasPressureAxis::PartialGasPressureAxis(const DivePlotDataModel &model, double dpr, bool printMode, ProfileScene &scene) :
|
||||
DiveCartesianAxis(dpr, printMode, scene),
|
||||
PartialGasPressureAxis::PartialGasPressureAxis(const DivePlotDataModel &model, Position position, color_index_t gridColor,
|
||||
double dpr, bool printMode, ProfileScene &scene) :
|
||||
DiveCartesianAxis(position, gridColor, dpr, printMode, scene),
|
||||
model(model)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
enum class Position {
|
||||
Left, Right, Bottom
|
||||
};
|
||||
DiveCartesianAxis(double dpr, bool printMode, ProfileScene &scene);
|
||||
DiveCartesianAxis(Position position, color_index_t gridColor, double dpr, bool printMode, ProfileScene &scene);
|
||||
~DiveCartesianAxis();
|
||||
void setMinimum(double minimum);
|
||||
void setMaximum(double maximum);
|
||||
|
@ -59,6 +59,8 @@ signals:
|
|||
void sizeChanged();
|
||||
|
||||
protected:
|
||||
Position position;
|
||||
color_index_t gridColor;
|
||||
ProfileScene &scene;
|
||||
virtual QString textForValue(double value) const;
|
||||
virtual QColor colorForValue(double value) const;
|
||||
|
@ -82,7 +84,7 @@ protected:
|
|||
class DepthAxis : public DiveCartesianAxis {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DepthAxis(double dpr, bool printMode, ProfileScene &scene);
|
||||
DepthAxis(Position position, color_index_t gridColor, double dpr, bool printMode, ProfileScene &scene);
|
||||
private:
|
||||
QString textForValue(double value) const override;
|
||||
QColor colorForValue(double value) const override;
|
||||
|
@ -109,7 +111,8 @@ private:
|
|||
class PartialGasPressureAxis : public DiveCartesianAxis {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PartialGasPressureAxis(const DivePlotDataModel &model, double dpr, bool printMode, ProfileScene &scene);
|
||||
PartialGasPressureAxis(const DivePlotDataModel &model, Position position, color_index_t gridColor,
|
||||
double dpr, bool printMode, ProfileScene &scene);
|
||||
void update(int animSpeed);
|
||||
double width() const;
|
||||
private:
|
||||
|
|
|
@ -70,13 +70,13 @@ ProfileScene::ProfileScene(double dpr, bool printMode, bool isGrayscale) :
|
|||
maxtime(-1),
|
||||
maxdepth(-1),
|
||||
dataModel(new DivePlotDataModel(this)),
|
||||
profileYAxis(new DepthAxis(dpr, printMode, *this)),
|
||||
gasYAxis(new PartialGasPressureAxis(*dataModel, dpr, printMode, *this)),
|
||||
temperatureAxis(new TemperatureAxis(dpr, printMode, *this)),
|
||||
timeAxis(new TimeAxis(dpr, printMode, *this)),
|
||||
cylinderPressureAxis(new DiveCartesianAxis(dpr, printMode, *this)),
|
||||
heartBeatAxis(new DiveCartesianAxis(dpr, printMode, *this)),
|
||||
percentageAxis(new DiveCartesianAxis(dpr, printMode, *this)),
|
||||
profileYAxis(new DepthAxis(DiveCartesianAxis::Position::Left, TIME_GRID, dpr, printMode, *this)),
|
||||
gasYAxis(new PartialGasPressureAxis(*dataModel, DiveCartesianAxis::Position::Right, TIME_GRID, dpr, printMode, *this)),
|
||||
temperatureAxis(new TemperatureAxis(DiveCartesianAxis::Position::Right, TIME_GRID, dpr, printMode, *this)),
|
||||
timeAxis(new TimeAxis(DiveCartesianAxis::Position::Bottom, TIME_GRID, dpr, printMode, *this)),
|
||||
cylinderPressureAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Right, TIME_GRID, dpr, printMode, *this)),
|
||||
heartBeatAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Left, HR_AXIS, dpr, printMode, *this)),
|
||||
percentageAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Right, TIME_GRID, dpr, printMode, *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)),
|
||||
|
|
Loading…
Reference in a new issue