mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
352cdcc863
In planner and edit mode, the cursor position is indicated using crosshairs. They broke when changing to absolute scaling. To fix them, remember the plot-area in the profile scene and draw the crosshairs only inside this area (not on top of axes). However, limit the position of the horizontal line to the actual profile (dont paint inside the partial pressure, etc graphs). The vertical line is painted above those graphs, so that a timestamp can be related to partial pressure, tissue loading, etc. Also, set the z-value of the crosshairs. It was painted inconsistently above some and below other chart features. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
106 lines
3.9 KiB
C++
106 lines
3.9 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
// Displays the dive profile. Used by the interactive profile widget
|
|
// and the printing/exporting code.
|
|
#ifndef PROFILESCENE_H
|
|
#define PROFILESCENE_H
|
|
|
|
#include "core/color.h"
|
|
#include "core/display.h"
|
|
|
|
#include <QGraphicsScene>
|
|
#include <QPainter>
|
|
#include <memory>
|
|
|
|
class AbstractProfilePolygonItem;
|
|
class DiveCalculatedCeiling;
|
|
class DiveCalculatedTissue;
|
|
class DiveCartesianAxis;
|
|
class DiveEventItem;
|
|
class DiveGasPressureItem;
|
|
class DiveHeartrateItem;
|
|
class DiveMeanDepthItem;
|
|
class DivePercentageItem;
|
|
class DivePixmaps;
|
|
class DivePlannerPointsModel;
|
|
class DiveProfileItem;
|
|
class DiveReportedCeiling;
|
|
class DiveTemperatureItem;
|
|
class DiveTextItem;
|
|
class PartialPressureGasItem;
|
|
class ProfileAnimation;
|
|
class TankItem;
|
|
|
|
class ProfileScene : public QGraphicsScene {
|
|
public:
|
|
ProfileScene(double dpr, bool printMode, bool isGrayscale);
|
|
~ProfileScene();
|
|
|
|
void resize(QSizeF size);
|
|
void clear();
|
|
bool pointOnProfile(const QPointF &point) const;
|
|
void anim(double fraction); // Called by the animation with 0.0-1.0 (start to stop).
|
|
// Can be compared with literal 1.0 to determine "end" state.
|
|
|
|
// 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 keepPlotInfo = false, bool calcMax = true, double zoom = 1.0, double zoomedPosition = 0.0);
|
|
|
|
void draw(QPainter *painter, const QRect &pos,
|
|
const struct dive *d, int dc,
|
|
DivePlannerPointsModel *plannerModel = nullptr, bool inPlanner = false);
|
|
|
|
const struct dive *d;
|
|
int dc;
|
|
private:
|
|
using DataAccessor = double (*)(const plot_data &data);
|
|
template<typename T, class... Args> T *createItem(const DiveCartesianAxis &vAxis, DataAccessor accessor, int z, Args&&... args);
|
|
PartialPressureGasItem *createPPGas(DataAccessor accessor, color_index_t color, color_index_t colorAlert,
|
|
const double *thresholdSettingsMin, const double *thresholdSettingsMax);
|
|
template <int ACT, int MAX> void addTissueItems(double dpr);
|
|
void updateVisibility(bool diveHasHeartBeat, bool simplified); // Update visibility of non-interactive chart features according to preferences
|
|
void updateAxes(bool diveHasHeartBeat, bool simplified); // Update axes according to preferences
|
|
|
|
friend class ProfileWidget2; // For now, give the ProfileWidget full access to the objects on the scene
|
|
double dpr; // Device Pixel Ratio. A DPR of one corresponds to a "standard" PC screen.
|
|
bool printMode;
|
|
bool isGrayscale;
|
|
int maxtime;
|
|
int maxdepth;
|
|
|
|
struct plot_info plotInfo;
|
|
QRectF profileRegion; // Region inside the axes, where the crosshair is painted in plan and edit mode.
|
|
DiveCartesianAxis *profileYAxis;
|
|
DiveCartesianAxis *gasYAxis;
|
|
DiveCartesianAxis *temperatureAxis;
|
|
DiveCartesianAxis *timeAxis;
|
|
DiveCartesianAxis *cylinderPressureAxis;
|
|
DiveCartesianAxis *heartBeatAxis;
|
|
DiveCartesianAxis *percentageAxis;
|
|
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;
|
|
std::vector<DiveCalculatedTissue *> allTissues;
|
|
DiveHeartrateItem *heartBeatItem;
|
|
DivePercentageItem *percentageItem;
|
|
TankItem *tankItem;
|
|
std::shared_ptr<const DivePixmaps> pixmaps;
|
|
std::unique_ptr<ProfileAnimation> animation;
|
|
std::vector<DiveCartesianAxis *> animatedAxes;
|
|
};
|
|
|
|
#endif
|