mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 04:53:24 +00:00
Find current gasmix for heatmap
To compute the heatmap value, we need the current gasmix but the current cylinderindex is no longer available. Fixes #562 Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
a525fff112
commit
432110ac8f
3 changed files with 6 additions and 7 deletions
|
@ -11,6 +11,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "qt-models/diveplannermodel.h"
|
#include "qt-models/diveplannermodel.h"
|
||||||
#include "core/helpers.h"
|
#include "core/helpers.h"
|
||||||
|
#include "core/dive.h"
|
||||||
#include "core/subsurface-qt/SettingsObjectWrapper.h"
|
#include "core/subsurface-qt/SettingsObjectWrapper.h"
|
||||||
#include "libdivecomputer/parser.h"
|
#include "libdivecomputer/parser.h"
|
||||||
#include "profile-widget/profilewidget2.h"
|
#include "profile-widget/profilewidget2.h"
|
||||||
|
@ -424,8 +425,11 @@ void DivePercentageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
||||||
for (int i = 1, modelDataCount = dataModel->rowCount(); i < modelDataCount; i++) {
|
for (int i = 1, modelDataCount = dataModel->rowCount(); i < modelDataCount; i++) {
|
||||||
if (i < poly.count()) {
|
if (i < poly.count()) {
|
||||||
double value = dataModel->index(i, vDataColumn).data().toDouble();
|
double value = dataModel->index(i, vDataColumn).data().toDouble();
|
||||||
int cyl = dataModel->index(i, DivePlotDataModel::CYLINDERINDEX).data().toInt();
|
struct gasmix *gasmix = NULL;
|
||||||
int inert = 1000 - get_o2(&displayed_dive.cylinder[cyl].gasmix);
|
struct event *ev = NULL;
|
||||||
|
int sec = dataModel->index(i, DivePlotDataModel::TIME).data().toInt();
|
||||||
|
gasmix = get_gasmix(&displayed_dive, current_dc, sec, &ev, gasmix);
|
||||||
|
int inert = 1000 - get_o2(gasmix);
|
||||||
mypen.setBrush(QBrush(ColorScale(value, inert)));
|
mypen.setBrush(QBrush(ColorScale(value, inert)));
|
||||||
painter->setPen(mypen);
|
painter->setPen(mypen);
|
||||||
painter->drawLine(poly[i - 1], poly[i]);
|
painter->drawLine(poly[i - 1], poly[i]);
|
||||||
|
|
|
@ -39,8 +39,6 @@ QVariant DivePlotDataModel::data(const QModelIndex &index, int role) const
|
||||||
return item.velocity;
|
return item.velocity;
|
||||||
case USERENTERED:
|
case USERENTERED:
|
||||||
return false;
|
return false;
|
||||||
case CYLINDERINDEX:
|
|
||||||
return 0;
|
|
||||||
case SENSOR_PRESSURE:
|
case SENSOR_PRESSURE:
|
||||||
return item.pressure[0][0];
|
return item.pressure[0][0];
|
||||||
case INTERPOLATED_PRESSURE:
|
case INTERPOLATED_PRESSURE:
|
||||||
|
@ -123,8 +121,6 @@ QVariant DivePlotDataModel::headerData(int section, Qt::Orientation orientation,
|
||||||
return tr("Color");
|
return tr("Color");
|
||||||
case USERENTERED:
|
case USERENTERED:
|
||||||
return tr("User entered");
|
return tr("User entered");
|
||||||
case CYLINDERINDEX:
|
|
||||||
return tr("Cylinder index");
|
|
||||||
case SENSOR_PRESSURE:
|
case SENSOR_PRESSURE:
|
||||||
return tr("Pressure S");
|
return tr("Pressure S");
|
||||||
case INTERPOLATED_PRESSURE:
|
case INTERPOLATED_PRESSURE:
|
||||||
|
|
|
@ -20,7 +20,6 @@ public:
|
||||||
TEMPERATURE,
|
TEMPERATURE,
|
||||||
USERENTERED,
|
USERENTERED,
|
||||||
COLOR,
|
COLOR,
|
||||||
CYLINDERINDEX,
|
|
||||||
SENSOR_PRESSURE,
|
SENSOR_PRESSURE,
|
||||||
INTERPOLATED_PRESSURE,
|
INTERPOLATED_PRESSURE,
|
||||||
SAC,
|
SAC,
|
||||||
|
|
Loading…
Add table
Reference in a new issue