mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Introduce heat map
This replaces the tissue percentage graph that probably nobody ever understood with a heat map like the one used in the discussion of bubble model deco. The information shown is the same but the saturation is now in the color while the tissue determines the y position. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6f43c16ea9
commit
893bea700c
3 changed files with 24 additions and 16 deletions
|
@ -359,13 +359,7 @@ void DiveHeartrateItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
|||
|
||||
DivePercentageItem::DivePercentageItem(int i)
|
||||
{
|
||||
QPen pen;
|
||||
QColor color;
|
||||
color.setHsl(100 + 10 * i, 200, 100);
|
||||
pen.setBrush(QBrush(color));
|
||||
pen.setCosmetic(true);
|
||||
pen.setWidth(1);
|
||||
setPen(pen);
|
||||
tissueIndex = i;
|
||||
settingsChanged();
|
||||
}
|
||||
|
||||
|
@ -380,11 +374,8 @@ void DivePercentageItem::modelDataChanged(const QModelIndex &topLeft, const QMod
|
|||
// Ignore empty values. a heartrate of 0 would be a bad sign.
|
||||
QPolygonF poly;
|
||||
for (int i = 0, modelDataCount = dataModel->rowCount(); i < modelDataCount; i++) {
|
||||
int hr = dataModel->index(i, vDataColumn).data().toInt();
|
||||
if (!hr)
|
||||
continue;
|
||||
sec = dataModel->index(i, hDataColumn).data().toInt();
|
||||
QPointF point(hAxis->posAtValue(sec), vAxis->posAtValue(hr));
|
||||
QPointF point(hAxis->posAtValue(sec), vAxis->posAtValue(64 - 4 * tissueIndex));
|
||||
poly.append(point);
|
||||
}
|
||||
setPolygon(poly);
|
||||
|
@ -401,8 +392,27 @@ void DivePercentageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
|||
if (polygon().isEmpty())
|
||||
return;
|
||||
painter->save();
|
||||
painter->setPen(pen());
|
||||
painter->drawPolyline(polygon());
|
||||
QColor color;
|
||||
QPen mypen;
|
||||
mypen.setCosmetic(true);
|
||||
mypen.setWidth(5);
|
||||
QPolygonF poly = polygon();
|
||||
for (int i = 0, modelDataCount = dataModel->rowCount(); i < modelDataCount; i++) {
|
||||
if (i < poly.count()) {
|
||||
double value = dataModel->index(i, vDataColumn).data().toDouble();
|
||||
if (value < 50.0) {
|
||||
value *= 255.0 / 50.0;
|
||||
color.setRgb(rint(value), 255 - rint(value),0);
|
||||
} else {
|
||||
value = (value - 50.0) * 255.0 / 50.0;
|
||||
color.setRgb(255 - rint(value), 0 , rint(value));
|
||||
}
|
||||
|
||||
mypen.setBrush(QBrush(color));
|
||||
painter->setPen(mypen);
|
||||
painter->drawPoint(poly[i]);
|
||||
}
|
||||
}
|
||||
painter->restore();
|
||||
connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::percentageGraphChanged, this, &DivePercentageItem::setVisible);
|
||||
}
|
||||
|
|
|
@ -132,6 +132,7 @@ public:
|
|||
|
||||
private:
|
||||
QString visibilityKey;
|
||||
int tissueIndex;
|
||||
};
|
||||
|
||||
class DiveAmbPressureItem : public AbstractProfilePolygonItem {
|
||||
|
|
|
@ -1159,9 +1159,6 @@ void ProfileWidget2::setProfileState()
|
|||
Q_FOREACH (DivePercentageItem *percentage, allPercentages) {
|
||||
percentage->setVisible(true);
|
||||
}
|
||||
|
||||
ambPressureItem->setVisible(true);
|
||||
gflineItem->setVisible(true);
|
||||
}
|
||||
|
||||
rulerItem->setVisible(prefs.rulergraph);
|
||||
|
|
Loading…
Reference in a new issue