diff options
author | Robert C. Helling <helling@atdotde.de> | 2014-11-17 17:39:40 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-11-17 18:02:42 +0000 |
commit | d5d7fdc9af98756cd8b241502f6493c518d6fa0f (patch) | |
tree | d5d6695cbeea4ae2a311f57803c19a59c72442fc /qt-ui | |
parent | 992e58eaf255973bcaeda1572c9bb86d16ed4adf (diff) | |
download | subsurface-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')
-rw-r--r-- | qt-ui/diveplanner.cpp | 2 | ||||
-rw-r--r-- | qt-ui/profile/diveprofileitem.cpp | 27 |
2 files changed, 27 insertions, 2 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index b8d251c2c..84dec0c9a 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -36,7 +36,7 @@ QString gasToStr(struct gasmix gas) { uint o2 = (get_o2(&gas) + 5) / 10, he = (get_he(&gas) + 5) / 10; - QString result = gasmix_is_air(&gas) ? QObject::tr("AIR") : he == 0 ? QString("EAN%1").arg(o2, 2, 10, QChar('0')) : QString("%1/%2").arg(o2).arg(he); + QString result = gasmix_is_air(&gas) ? QObject::tr("AIR") : he == 0 ? (o2 == 100 ? QObject::tr("OXYGEN") : QString("EAN%1").arg(o2, 2, 10, QChar('0'))) : QString("%1/%2").arg(o2).arg(he); return result; } 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; |