2021-08-03 13:39:25 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
// Displays the dive profile. Used by the interactive profile widget
|
|
|
|
// and the printing/exporting code.
|
2021-06-05 16:42:56 +00:00
|
|
|
#ifndef PROFILESCENE_H
|
|
|
|
#define PROFILESCENE_H
|
|
|
|
|
2021-08-03 07:51:37 +00:00
|
|
|
#include "core/color.h"
|
|
|
|
#include "core/display.h"
|
|
|
|
|
2021-06-05 16:42:56 +00:00
|
|
|
#include <QGraphicsScene>
|
2021-08-04 05:27:41 +00:00
|
|
|
#include <QPainter>
|
2021-06-05 16:42:56 +00:00
|
|
|
|
2021-08-03 07:51:37 +00:00
|
|
|
class DivePlannerPointsModel;
|
2021-06-28 18:29:46 +00:00
|
|
|
class DivePlotDataModel;
|
|
|
|
|
2021-08-03 07:51:37 +00:00
|
|
|
class AbstractProfilePolygonItem;
|
2021-06-28 18:29:46 +00:00
|
|
|
class DepthAxis;
|
|
|
|
class DiveCartesianAxis;
|
2021-08-03 07:51:37 +00:00
|
|
|
class DiveCalculatedCeiling;
|
|
|
|
class DiveCalculatedTissue;
|
|
|
|
class DiveCartesianAxis;
|
|
|
|
class DiveEventItem;
|
|
|
|
class DiveGasPressureItem;
|
|
|
|
class DiveHeartrateItem;
|
|
|
|
class DiveMeanDepthItem;
|
|
|
|
class DivePercentageItem;
|
|
|
|
class DiveProfileItem;
|
|
|
|
class DiveReportedCeiling;
|
|
|
|
class DiveTemperatureItem;
|
|
|
|
class DiveTextItem;
|
2021-06-28 18:29:46 +00:00
|
|
|
class PartialGasPressureAxis;
|
2021-08-03 07:51:37 +00:00
|
|
|
class PartialPressureGasItem;
|
|
|
|
class TankItem;
|
2021-06-28 18:29:46 +00:00
|
|
|
class TemperatureAxis;
|
|
|
|
class TimeAxis;
|
|
|
|
|
2021-06-05 16:42:56 +00:00
|
|
|
class ProfileScene : public QGraphicsScene {
|
|
|
|
public:
|
2021-08-03 13:39:25 +00:00
|
|
|
ProfileScene(double fontPrintScale, bool printMode, bool isGrayscale);
|
2021-06-05 16:42:56 +00:00
|
|
|
~ProfileScene();
|
2021-06-28 18:29:46 +00:00
|
|
|
|
2021-08-03 08:32:08 +00:00
|
|
|
void updateAxes(bool instant); // Update axes according to preferences
|
2021-08-03 07:51:37 +00:00
|
|
|
void clear();
|
2021-06-28 18:29:46 +00:00
|
|
|
bool isPointOutOfBoundaries(const QPointF &point) const;
|
|
|
|
|
2021-08-03 07:51:37 +00:00
|
|
|
// If a plannerModel is passed, the deco-information is taken from there.
|
|
|
|
void plotDive(const struct dive *d, int dc, DivePlannerPointsModel *plannerModel = nullptr, bool inPlanner = false,
|
|
|
|
bool instant = false, bool calcMax = true);
|
|
|
|
|
2021-08-04 05:27:41 +00:00
|
|
|
void draw(QPainter *painter, const QRect &pos);
|
|
|
|
QImage toImage(QSize size);
|
|
|
|
|
2021-08-03 07:51:37 +00:00
|
|
|
const struct dive *d;
|
|
|
|
int dc;
|
2021-06-28 18:29:46 +00:00
|
|
|
private:
|
2021-08-03 07:51:37 +00:00
|
|
|
template<typename T, class... Args> T *createItem(const DiveCartesianAxis &vAxis, int vColumn, int z, Args&&... args);
|
|
|
|
PartialPressureGasItem *createPPGas(int column, color_index_t color, color_index_t colorAlert,
|
|
|
|
const double *thresholdSettingsMin, const double *thresholdSettingsMax);
|
|
|
|
void updateVisibility(); // Update visibility of non-interactive chart features according to preferences
|
|
|
|
|
2021-06-28 18:29:46 +00:00
|
|
|
friend class ProfileWidget2; // For now, give the ProfileWidget full access to the objects on the scene
|
2021-07-29 04:50:59 +00:00
|
|
|
double fontPrintScale;
|
|
|
|
bool printMode;
|
|
|
|
bool isGrayscale;
|
2021-08-03 07:51:37 +00:00
|
|
|
int maxtime;
|
|
|
|
int maxdepth;
|
2021-07-29 04:50:59 +00:00
|
|
|
|
2021-06-28 18:29:46 +00:00
|
|
|
DivePlotDataModel *dataModel;
|
2021-08-03 07:51:37 +00:00
|
|
|
struct plot_info plotInfo;
|
2021-06-28 18:29:46 +00:00
|
|
|
DepthAxis *profileYAxis;
|
|
|
|
PartialGasPressureAxis *gasYAxis;
|
|
|
|
TemperatureAxis *temperatureAxis;
|
|
|
|
TimeAxis *timeAxis;
|
|
|
|
DiveCartesianAxis *cylinderPressureAxis;
|
|
|
|
DiveCartesianAxis *heartBeatAxis;
|
|
|
|
DiveCartesianAxis *percentageAxis;
|
2021-08-03 07:51:37 +00:00
|
|
|
std::vector<AbstractProfilePolygonItem *> profileItems;
|
|
|
|
DiveProfileItem *diveProfileItem;
|
|
|
|
DiveTemperatureItem *temperatureItem;
|
|
|
|
DiveMeanDepthItem *meanDepthItem;
|
|
|
|
DiveGasPressureItem *gasPressureItem;
|
|
|
|
QList<DiveEventItem *> eventItems;
|
|
|
|
DiveTextItem *diveComputerText;
|
|
|
|
DiveReportedCeiling *reportedCeiling;
|
|
|
|
PartialPressureGasItem *pn2GasItem;
|
|
|
|
PartialPressureGasItem *pheGasItem;
|
|
|
|
PartialPressureGasItem *po2GasItem;
|
|
|
|
PartialPressureGasItem *o2SetpointGasItem;
|
|
|
|
PartialPressureGasItem *ccrsensor1GasItem;
|
|
|
|
PartialPressureGasItem *ccrsensor2GasItem;
|
|
|
|
PartialPressureGasItem *ccrsensor3GasItem;
|
|
|
|
PartialPressureGasItem *ocpo2GasItem;
|
|
|
|
DiveCalculatedCeiling *diveCeiling;
|
|
|
|
DiveTextItem *decoModelParameters;
|
|
|
|
QList<DiveCalculatedTissue *> allTissues;
|
|
|
|
DiveHeartrateItem *heartBeatItem;
|
|
|
|
QList<DivePercentageItem *> allPercentages;
|
|
|
|
TankItem *tankItem;
|
2021-06-05 16:42:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|