diff options
author | Robert C. Helling <helling@atdotde.de> | 2014-09-15 14:09:00 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-09-19 21:46:30 -0700 |
commit | 3fc9c1e0053a0ca1d4af7c1e5fb8e118afe0badf (patch) | |
tree | 7b9f8d5124e7beb267d099bf85c0495042781700 /qt-ui/profile/profilewidget2.cpp | |
parent | 7cdf55ffcc8d0525657dd0780f7436284e9b72aa (diff) | |
download | subsurface-3fc9c1e0053a0ca1d4af7c1e5fb8e118afe0badf.tar.gz |
Tissue saturation plot a la Sherwater Pretel
This adds a toolbox icon to turn on a tissue plot inspired by the bar
graph of the Sherwater Petrel,
It shows the inert gas partial pressures for individual compartments. If
they are below the ambient pressure (grey line) they are shown in units of
the ambient pressure, if they are above, the excess is shown as a
percentage of the allowed overpressure for plain Buehlmann. So it has the
same units as a gradient factor. Thus also the a gradient factor line (for
the current depth) is shown.
The different tissues get different colors, greener for the faster ones and bluer
for the slower ones.
Positioning and on/off icon action still need some tender loving care.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/profilewidget2.cpp')
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index fcad3197f..16339c1de 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -57,6 +57,7 @@ static struct _ItemPos { _Axis depth; _Axis partialPressure; _Axis partialPressureWithTankBar; + _Axis percentage; _Axis time; _Axis cylinder; _Axis temperature; @@ -89,6 +90,9 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent), po2GasItem(new PartialPressureGasItem()), heartBeatAxis(new DiveCartesianAxis()), heartBeatItem(new DiveHeartrateItem()), + percentageAxis(new DiveCartesianAxis()), + ambPressureItem(new DiveAmbPressureItem()), + gflineItem(new DiveGFLineItem()), mouseFollowerVertical(new DiveLineItem()), mouseFollowerHorizontal(new DiveLineItem()), rulerItem(new RulerItem2()), @@ -159,6 +163,7 @@ void ProfileWidget2::addItemsToScene() scene()->addItem(pn2GasItem); scene()->addItem(pheGasItem); scene()->addItem(po2GasItem); + scene()->addItem(percentageAxis); scene()->addItem(heartBeatAxis); scene()->addItem(heartBeatItem); scene()->addItem(rulerItem); @@ -174,6 +179,11 @@ void ProfileWidget2::addItemsToScene() Q_FOREACH (DiveCalculatedTissue *tissue, allTissues) { scene()->addItem(tissue); } + Q_FOREACH (DivePercentageItem *percentage, allPercentages) { + scene()->addItem(percentage); + } + scene()->addItem(ambPressureItem); + scene()->addItem(gflineItem); } void ProfileWidget2::setupItemOnScene() @@ -207,6 +217,12 @@ void ProfileWidget2::setupItemOnScene() heartBeatAxis->setFontLabelScale(0.7); heartBeatAxis->setLineSize(96); + percentageAxis->setOrientation(DiveCartesianAxis::BottomToTop); + percentageAxis->setTickSize(0.2); + percentageAxis->setTickInterval(10); + percentageAxis->setFontLabelScale(0.7); + percentageAxis->setLineSize(96); + temperatureAxis->setOrientation(DiveCartesianAxis::BottomToTop); temperatureAxis->setTickSize(2); temperatureAxis->setTickInterval(300); @@ -233,10 +249,15 @@ void ProfileWidget2::setupItemOnScene() DiveCalculatedTissue *tissueItem = new DiveCalculatedTissue(); setupItem(tissueItem, timeAxis, profileYAxis, dataModel, DivePlotDataModel::TISSUE_1 + i, DivePlotDataModel::TIME, 1 + i); allTissues.append(tissueItem); + DivePercentageItem *percentageItem = new DivePercentageItem(i); + setupItem(percentageItem, timeAxis, percentageAxis, dataModel, DivePlotDataModel::PERCENTAGE_1 + i, DivePlotDataModel::TIME, 1 + i); + allPercentages.append(percentageItem); } setupItem(gasPressureItem, timeAxis, cylinderPressureAxis, dataModel, DivePlotDataModel::TEMPERATURE, DivePlotDataModel::TIME, 1); setupItem(temperatureItem, timeAxis, temperatureAxis, dataModel, DivePlotDataModel::TEMPERATURE, DivePlotDataModel::TIME, 1); setupItem(heartBeatItem, timeAxis, heartBeatAxis, dataModel, DivePlotDataModel::HEARTBEAT, DivePlotDataModel::TIME, 1); + setupItem(ambPressureItem, timeAxis, percentageAxis, dataModel, DivePlotDataModel::AMBPRESSURE, DivePlotDataModel::TIME, 1); + setupItem(gflineItem, timeAxis, percentageAxis, dataModel, DivePlotDataModel::GFLINE, DivePlotDataModel::TIME, 1); setupItem(diveProfileItem, timeAxis, profileYAxis, dataModel, DivePlotDataModel::DEPTH, DivePlotDataModel::TIME, 0); #define CREATE_PP_GAS(ITEM, VERTICAL_COLUMN, COLOR, COLOR_ALERT, THRESHOULD_SETTINGS, VISIBILITY_SETTINGS) \ @@ -261,6 +282,8 @@ void ProfileWidget2::setupItemOnScene() gasYAxis->setZValue(timeAxis->zValue() + 1); heartBeatAxis->setTextVisible(true); heartBeatAxis->setLinesVisible(true); + percentageAxis->setTextVisible(true); + percentageAxis->setLinesVisible(true); } void ProfileWidget2::replot() @@ -307,7 +330,7 @@ void ProfileWidget2::setupItemSizes() itemPos.partialPressure.pos.off.setX(110); itemPos.partialPressure.pos.off.setY(63); itemPos.partialPressure.expanded.setP1(QPointF(0, 0)); - itemPos.partialPressure.expanded.setP2(QPointF(0, 30)); + itemPos.partialPressure.expanded.setP2(QPointF(0, 20)); itemPos.partialPressureWithTankBar = itemPos.partialPressure; itemPos.partialPressureWithTankBar.expanded.setP2(QPointF(0, 27)); @@ -334,7 +357,12 @@ void ProfileWidget2::setupItemSizes() itemPos.heartBeat.pos.on.setX(3); itemPos.heartBeat.pos.on.setY(60); itemPos.heartBeat.expanded.setP1(QPointF(0, 0)); - itemPos.heartBeat.expanded.setP2(QPointF(0, 20)); + itemPos.heartBeat.expanded.setP2(QPointF(0, 15)); + + itemPos.percentage.pos.on.setX(3); + itemPos.percentage.pos.on.setY(85); // was 80 + itemPos.percentage.expanded.setP1(QPointF(0, 0)); + itemPos.percentage.expanded.setP2(QPointF(0, 15)); // was 20 itemPos.dcLabel.on.setX(3); itemPos.dcLabel.on.setY(100); @@ -485,6 +513,11 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) } heartBeatAxis->setVisible(prefs.hrgraph && pInfo.maxhr); + percentageAxis->setMinimum(0); + percentageAxis->setMaximum(100); + percentageAxis->setVisible(false); + percentageAxis->updateTicks(HR_AXIS); + timeAxis->setMaximum(maxtime); int i, incr; static int increments[8] = { 10, 20, 30, 60, 5 * 60, 10 * 60, 15 * 60, 30 * 60 }; @@ -760,12 +793,15 @@ void ProfileWidget2::setEmptyState() pn2GasItem->setVisible(false); po2GasItem->setVisible(false); pheGasItem->setVisible(false); + ambPressureItem->setVisible(false); + gflineItem->setVisible(false); mouseFollowerHorizontal->setVisible(false); mouseFollowerVertical->setVisible(false); #define HIDE_ALL(TYPE, CONTAINER) \ Q_FOREACH (TYPE *item, CONTAINER) item->setVisible(false); HIDE_ALL(DiveCalculatedTissue, allTissues); + HIDE_ALL(DivePercentageItem, allPercentages); HIDE_ALL(DiveEventItem, eventItems); HIDE_ALL(DiveHandler, handles); HIDE_ALL(QGraphicsSimpleTextItem, gases); @@ -842,6 +878,16 @@ void ProfileWidget2::setProfileState() tissue->setVisible(true); } } + percentageAxis->setPos(itemPos.percentage.pos.on); + percentageAxis->setLine(itemPos.percentage.expanded); + if (prefs.percentagegraph) { + Q_FOREACH (DivePercentageItem *percentage, allPercentages) { + percentage->setVisible(true); + } + + ambPressureItem->setVisible(true); + } gflineItem->setVisible(true); + rulerItem->setVisible(prefs.rulergraph); tankItem->setVisible(prefs.tankbar); tankItem->setPos(itemPos.tankBar.on); |