mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Support different salinity in planner
Depth is often mentioned in a length unit, but what we care about is pressure. When diving in fresh water the pressure is lower than the same depth in salt water. This adds support for using different salinities in planning. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1617d437d4
commit
a06befc007
5 changed files with 86 additions and 29 deletions
|
@ -297,6 +297,7 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
|
|||
connect(ui.dateEdit, SIGNAL(dateChanged(QDate)), plannerModel, SLOT(setStartDate(QDate)));
|
||||
connect(ui.ATMPressure, SIGNAL(valueChanged(int)), this, SLOT(atmPressureChanged(int)));
|
||||
connect(ui.atmHeight, SIGNAL(valueChanged(int)), this, SLOT(heightChanged(int)));
|
||||
connect(ui.salinity, SIGNAL(valueChanged(double)), this, SLOT(salinityChanged(double)));
|
||||
connect(DivePlannerPointsModel::instance(), SIGNAL(startTimeChanged(QDateTime)), this, SLOT(setupStartTime(QDateTime)));
|
||||
|
||||
// Creating (and canceling) the plan
|
||||
|
@ -367,6 +368,12 @@ void DivePlannerWidget::heightChanged(const int height)
|
|||
plannerModel->setSurfacePressure(pressure);
|
||||
}
|
||||
|
||||
void DivePlannerWidget::salinityChanged(const double salinity)
|
||||
{
|
||||
/* Salinity is expressed in weight in grams per 10l */
|
||||
plannerModel->setSalinity(10000 * salinity);
|
||||
}
|
||||
|
||||
void PlannerSettingsWidget::bottomSacChanged(const double bottomSac)
|
||||
{
|
||||
plannerModel->setBottomSac(bottomSac);
|
||||
|
@ -786,6 +793,12 @@ void DivePlannerPointsModel::setSurfacePressure(int pressure)
|
|||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setSalinity(int salinity)
|
||||
{
|
||||
diveplan.salinity = salinity;
|
||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||
}
|
||||
|
||||
int DivePlannerPointsModel::getSurfacePressure()
|
||||
{
|
||||
return diveplan.surface_pressure;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue