summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-11-17 17:39:40 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-17 18:02:42 +0000
commitd5d7fdc9af98756cd8b241502f6493c518d6fa0f (patch)
treed5d6695cbeea4ae2a311f57803c19a59c72442fc /qt-ui/profile
parent992e58eaf255973bcaeda1572c9bb86d16ed4adf (diff)
downloadsubsurface-d5d7fdc9af98756cd8b241502f6493c518d6fa0f.tar.gz
For CCR dives, show plot for diluent and O2 cylinder pressures
Also fixes a bug in the diluent pressure interpolation Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/diveprofileitem.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index 1a6eeae5c..038987fe7 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -574,12 +574,18 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
if (!shouldCalculateStuff(topLeft, bottomRight))
return;
int last_index = -1;
- QPolygonF boundingPoly; // This is the "Whole Item", but a pressure can be divided in N Polygons.
+ int o2mbar;
+ QPolygonF boundingPoly, o2Poly; // This is the "Whole Item", but a pressure can be divided in N Polygons.
polygons.clear();
+ if (displayed_dive.dc.dctype == CCR)
+ polygons.append(o2Poly);
for (int i = 0, count = dataModel->rowCount(); i < count; i++) {
+ o2mbar = 0;
plot_data *entry = dataModel->data().entry + i;
int mbar = GET_PRESSURE(entry);
+ if (displayed_dive.dc.dctype == CCR)
+ o2mbar = GET_O2CYLINDER_PRESSURE(entry);
if (entry->cylinderindex != last_index) {
polygons.append(QPolygonF()); // this is the polygon that will be actually drawned on screen.
@@ -588,6 +594,11 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
if (!mbar) {
continue;
}
+ if (o2mbar) {
+ QPointF o2point(hAxis->posAtValue(entry->sec), vAxis->posAtValue(o2mbar));
+ boundingPoly.push_back(o2point);
+ polygons.first().push_back(o2point);
+ }
QPointF point(hAxis->posAtValue(entry->sec), vAxis->posAtValue(mbar));
boundingPoly.push_back(point); // The BoundingRect
@@ -603,9 +614,23 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
struct plot_data *entry;
cyl = -1;
+ o2mbar = 0;
for (int i = 0, count = dataModel->rowCount(); i < count; i++) {
entry = dataModel->data().entry + i;
mbar = GET_PRESSURE(entry);
+ if (displayed_dive.dc.dctype == CCR)
+ o2mbar = GET_O2CYLINDER_PRESSURE(entry);
+
+ if (o2mbar) {
+ if (!seen_cyl[displayed_dive.oxygen_cylinder_index]) {
+ plotPressureValue(o2mbar, entry->sec, Qt::AlignRight | Qt::AlignBottom);
+ plotGasValue(o2mbar, entry->sec, Qt::AlignRight | Qt::AlignBottom, displayed_dive.cylinder[displayed_dive.oxygen_cylinder_index].gasmix);
+ seen_cyl[displayed_dive.oxygen_cylinder_index] = true;
+ }
+ last_pressure[displayed_dive.oxygen_cylinder_index] = o2mbar;
+ last_time[displayed_dive.oxygen_cylinder_index] = entry->sec;
+ }
+
if (!mbar)
continue;