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-08-30 19:11:11 +00:00
|
|
|
#include <memory>
|
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;
|
|
|
|
class DiveCalculatedCeiling;
|
|
|
|
class DiveCalculatedTissue;
|
|
|
|
class DiveCartesianAxis;
|
|
|
|
class DiveEventItem;
|
|
|
|
class DiveGasPressureItem;
|
|
|
|
class DiveHeartrateItem;
|
|
|
|
class DiveMeanDepthItem;
|
|
|
|
class DivePercentageItem;
|
2021-08-30 19:11:11 +00:00
|
|
|
class DivePixmaps;
|
2021-08-03 07:51:37 +00:00
|
|
|
class DiveProfileItem;
|
|
|
|
class DiveReportedCeiling;
|
|
|
|
class DiveTemperatureItem;
|
|
|
|
class DiveTextItem;
|
|
|
|
class PartialPressureGasItem;
|
|
|
|
class TankItem;
|
2021-06-28 18:29:46 +00:00
|
|
|
|
2021-06-05 16:42:56 +00:00
|
|
|
class ProfileScene : public QGraphicsScene {
|
|
|
|
public:
|
2021-08-09 14:48:08 +00:00
|
|
|
ProfileScene(double dpr, bool printMode, bool isGrayscale);
|
2021-06-05 16:42:56 +00:00
|
|
|
~ProfileScene();
|
2021-06-28 18:29:46 +00:00
|
|
|
|
2021-08-28 21:36:09 +00:00
|
|
|
void resize(QSizeF size);
|
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-30 20:59:45 +00:00
|
|
|
void draw(QPainter *painter, const QRect &pos,
|
|
|
|
const struct dive *d, int dc,
|
|
|
|
DivePlannerPointsModel *plannerModel = nullptr, bool inPlanner = false);
|
2021-08-04 05:27:41 +00:00
|
|
|
|
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);
|
2021-09-11 19:43:53 +00:00
|
|
|
void updateVisibility(bool diveHasHeartBeat); // Update visibility of non-interactive chart features according to preferences
|
2021-09-28 08:32:41 +00:00
|
|
|
void updateAxes(bool diveHasHeartBeat); // Update axes according to preferences
|
2021-08-03 07:51:37 +00:00
|
|
|
|
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-08-09 14:48:08 +00:00
|
|
|
double dpr; // Device Pixel Ratio. A DPR of one corresponds to a "standard" PC screen.
|
2021-07-29 04:50:59 +00:00
|
|
|
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-10-03 20:10:00 +00:00
|
|
|
DiveCartesianAxis *profileYAxis;
|
2021-09-26 17:30:27 +00:00
|
|
|
DiveCartesianAxis *gasYAxis;
|
2021-10-03 20:10:00 +00:00
|
|
|
DiveCartesianAxis *temperatureAxis;
|
|
|
|
DiveCartesianAxis *timeAxis;
|
2021-06-28 18:29:46 +00:00
|
|
|
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;
|
2021-08-29 20:13:26 +00:00
|
|
|
DivePercentageItem *percentageItem;
|
2021-08-03 07:51:37 +00:00
|
|
|
TankItem *tankItem;
|
2021-08-30 19:11:11 +00:00
|
|
|
std::shared_ptr<const DivePixmaps> pixmaps;
|
2021-06-05 16:42:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|