mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Show ICD events data in infobox
If a gas switch violates our ICD criteria, show this in the info box. Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
c866b82f35
commit
7b508e41cd
3 changed files with 12 additions and 6 deletions
|
@ -49,7 +49,7 @@ struct event *DiveEventItem::getEvent()
|
||||||
return internalEvent;
|
return internalEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveEventItem::setEvent(struct event *ev)
|
void DiveEventItem::setEvent(struct event *ev, struct gasmix *lastgasmix)
|
||||||
{
|
{
|
||||||
if (!ev)
|
if (!ev)
|
||||||
return;
|
return;
|
||||||
|
@ -57,7 +57,7 @@ void DiveEventItem::setEvent(struct event *ev)
|
||||||
free(internalEvent);
|
free(internalEvent);
|
||||||
internalEvent = clone_event(ev);
|
internalEvent = clone_event(ev);
|
||||||
setupPixmap();
|
setupPixmap();
|
||||||
setupToolTipString();
|
setupToolTipString(lastgasmix);
|
||||||
recalculatePos(true);
|
recalculatePos(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ void DiveEventItem::setupPixmap()
|
||||||
#undef EVENT_PIXMAP_BIGGER
|
#undef EVENT_PIXMAP_BIGGER
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveEventItem::setupToolTipString()
|
void DiveEventItem::setupToolTipString(struct gasmix *lastgasmix)
|
||||||
{
|
{
|
||||||
// we display the event on screen - so translate
|
// we display the event on screen - so translate
|
||||||
QString name = gettextFromC::instance()->tr(internalEvent->name);
|
QString name = gettextFromC::instance()->tr(internalEvent->name);
|
||||||
|
@ -158,6 +158,10 @@ void DiveEventItem::setupToolTipString()
|
||||||
/* Do we have an explicit cylinder index? Show it. */
|
/* Do we have an explicit cylinder index? Show it. */
|
||||||
if (internalEvent->gas.index >= 0)
|
if (internalEvent->gas.index >= 0)
|
||||||
name += tr(" (cyl. %1)").arg(internalEvent->gas.index + 1);
|
name += tr(" (cyl. %1)").arg(internalEvent->gas.index + 1);
|
||||||
|
icd_data icd_data;
|
||||||
|
if (isobaric_counterdiffusion(lastgasmix, mix, &icd_data))
|
||||||
|
name += tr("\nICD ΔN2/ΔHe=%1/%2=%3%").arg(icd_data.dN2 / 10).arg(-icd_data.dHe / 10).arg((-100 * icd_data.dN2 / icd_data.dHe));
|
||||||
|
*lastgasmix = *mix;
|
||||||
} else if (value) {
|
} else if (value) {
|
||||||
if (type == SAMPLE_EVENT_PO2 && same_string(internalEvent->name, "SP change")) {
|
if (type == SAMPLE_EVENT_PO2 && same_string(internalEvent->name, "SP change")) {
|
||||||
name += QString(": %1bar").arg((double)value / 1000, 0, 'f', 1);
|
name += QString(": %1bar").arg((double)value / 1000, 0, 'f', 1);
|
||||||
|
|
|
@ -13,7 +13,7 @@ class DiveEventItem : public DivePixmapItem {
|
||||||
public:
|
public:
|
||||||
DiveEventItem(QObject *parent = 0);
|
DiveEventItem(QObject *parent = 0);
|
||||||
virtual ~DiveEventItem();
|
virtual ~DiveEventItem();
|
||||||
void setEvent(struct event *ev);
|
void setEvent(struct event *ev, struct gasmix *lastgasmix);
|
||||||
struct event *getEvent();
|
struct event *getEvent();
|
||||||
void eventVisibilityChanged(const QString &eventName, bool visible);
|
void eventVisibilityChanged(const QString &eventName, bool visible);
|
||||||
void setVerticalAxis(DiveCartesianAxis *axis);
|
void setVerticalAxis(DiveCartesianAxis *axis);
|
||||||
|
@ -25,7 +25,7 @@ slots:
|
||||||
void recalculatePos(bool instant = false);
|
void recalculatePos(bool instant = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupToolTipString();
|
void setupToolTipString(struct gasmix *lastgasmix);
|
||||||
void setupPixmap();
|
void setupPixmap();
|
||||||
DiveCartesianAxis *vAxis;
|
DiveCartesianAxis *vAxis;
|
||||||
DiveCartesianAxis *hAxis;
|
DiveCartesianAxis *hAxis;
|
||||||
|
|
|
@ -715,6 +715,8 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
|
||||||
qDeleteAll(eventItems);
|
qDeleteAll(eventItems);
|
||||||
eventItems.clear();
|
eventItems.clear();
|
||||||
struct event *event = currentdc->events;
|
struct event *event = currentdc->events;
|
||||||
|
struct event *ev;
|
||||||
|
struct gasmix lastgasmix = *get_gasmix(&displayed_dive, current_dc, 1, &ev, NULL);
|
||||||
while (event) {
|
while (event) {
|
||||||
// if print mode is selected only draw headings, SP change, gas events or bookmark event
|
// if print mode is selected only draw headings, SP change, gas events or bookmark event
|
||||||
if (printMode) {
|
if (printMode) {
|
||||||
|
@ -731,7 +733,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
|
||||||
item->setHorizontalAxis(timeAxis);
|
item->setHorizontalAxis(timeAxis);
|
||||||
item->setVerticalAxis(profileYAxis);
|
item->setVerticalAxis(profileYAxis);
|
||||||
item->setModel(dataModel);
|
item->setModel(dataModel);
|
||||||
item->setEvent(event);
|
item->setEvent(event, &lastgasmix);
|
||||||
item->setZValue(2);
|
item->setZValue(2);
|
||||||
scene()->addItem(item);
|
scene()->addItem(item);
|
||||||
eventItems.push_back(item);
|
eventItems.push_back(item);
|
||||||
|
|
Loading…
Add table
Reference in a new issue