mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Display gas density instead of SAC in planner
In the planner, the SAC is prescribed, so there is little use in plotting it (as the color of the cylinder pressure line). Rather use the color to show the density of breathing gas. Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
bb6ceba4ac
commit
98a65b7157
3 changed files with 20 additions and 4 deletions
|
@ -87,3 +87,14 @@ QColor getSacColor(int sac, int avg_sac)
|
|||
sac_index = SAC_COLORS - 1;
|
||||
return getColor((color_indice_t)(SAC_COLORS_START_IDX + sac_index), false);
|
||||
}
|
||||
|
||||
QColor getPressureColor(double density)
|
||||
{
|
||||
QColor color;
|
||||
|
||||
int h = ((int) (180.0 - 180.0 * density / 8.0));
|
||||
while (h < 0)
|
||||
h += 360;
|
||||
color.setHsv(h , 255, 255);
|
||||
return color;
|
||||
}
|
||||
|
|
|
@ -142,6 +142,7 @@ extern QMap<color_indice_t, QVector<QColor> > profile_color;
|
|||
void fill_profile_color();
|
||||
QColor getColor(const color_indice_t i, bool isGrayscale = false);
|
||||
QColor getSacColor(int sac, int diveSac);
|
||||
QColor getPressureColor(double density);
|
||||
struct text_render_options {
|
||||
double size;
|
||||
color_indice_t color;
|
||||
|
|
|
@ -831,10 +831,14 @@ void DiveGasPressureItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
|
|||
Q_FOREACH (const QPolygonF &poly, polygons) {
|
||||
entry = dataModel->data().entry;
|
||||
for (int i = 1, count = poly.count(); i < count; i++, entry++) {
|
||||
if (entry->sac)
|
||||
pen.setBrush(getSacColor(entry->sac, displayed_dive.sac));
|
||||
else
|
||||
pen.setBrush(MED_GRAY_HIGH_TRANS);
|
||||
if (!in_planner()) {
|
||||
if (entry->sac)
|
||||
pen.setBrush(getSacColor(entry->sac, displayed_dive.sac));
|
||||
else
|
||||
pen.setBrush(MED_GRAY_HIGH_TRANS);
|
||||
} else {
|
||||
pen.setBrush(getPressureColor(entry->density));
|
||||
}
|
||||
painter->setPen(pen);
|
||||
painter->drawLine(poly[i - 1], poly[i]);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue