Skip to content

Commit

Permalink
update soil editor
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed Nov 16, 2023
1 parent 18f3164 commit c72de37
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
16 changes: 8 additions & 8 deletions agrolib/soilWidget/tabHydraulicConductivityCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void TabHydraulicConductivityCurve::insertElements(soil::Crit3DSoil *soil)
fillElement = true;
mySoil = soil;
double x;
double maxThetaSat = 0;
double maxValue = 0;

for (unsigned int i = 0; i < mySoil->nrHorizons; i++)
{
Expand All @@ -95,14 +95,14 @@ void TabHydraulicConductivityCurve::insertElements(soil::Crit3DSoil *soil)
QLineSeries* curve = new QLineSeries();
curve->setColor(color);
double factor = 1.1;
x = dxMin;
while (x < dxMax*factor)
x = xMin;
while (x <= xMax)
{
double y = soil::waterConductivityFromSignPsi(-x, mySoil->horizon[i]);
if (y != NODATA)
{
curve->append(x,y);
maxThetaSat = MAXVALUE(maxThetaSat, y);
maxValue = std::max(maxValue, y);
}
x *= factor;
}
Expand All @@ -114,11 +114,11 @@ void TabHydraulicConductivityCurve::insertElements(soil::Crit3DSoil *soil)
connect(curve, &QLineSeries::hovered, this, &TabHydraulicConductivityCurve::tooltipLineSeries);
}

// round maxThetaSat to first decimal
maxThetaSat = ceil(maxThetaSat * 10) * 0.1;
// round maxValue to first decimal
maxValue = ceil(maxValue * 10) * 0.1;

// rescale to maxThetaSat
axisY->setMax(std::max(yMax, maxThetaSat));
// rescale to maxValue
axisY->setMax(std::max(yMax, maxValue));

for (int i=0; i < barHorizons.barList.size(); i++)
{
Expand Down
7 changes: 2 additions & 5 deletions agrolib/soilWidget/tabHydraulicConductivityCurve.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@
bool fillElement;
int indexSelected;

double dxMin = 0.001;
double dxMax = 10000000;

double xMin = (dxMin * 100);
double xMax = (dxMax / 100);
double xMin = 0.1;
double xMax = 100000;
double yMin = pow(10, -12);
double yMax = 1000;

Expand Down
4 changes: 2 additions & 2 deletions agrolib/soilWidget/tabWaterRetentionCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ void TabWaterRetentionCurve::insertElements(soil::Crit3DSoil *soil)
QLineSeries* curve = new QLineSeries();
curve->setColor(color);
double factor = 1.2;
x = dxMin;
while (x < dxMax*factor)
x = xMin;
while (x <= xMax)
{
double y = soil::thetaFromSignPsi(-x, mySoil->horizon[i]);
if (y != NODATA)
Expand Down
9 changes: 2 additions & 7 deletions agrolib/soilWidget/tabWaterRetentionCurve.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,8 @@
bool fillElement;
int indexSelected;

double dxMin = 0.001;
double dxMax = 10000000;
double dyMin = 0.0;
double dyMax = 1.0;

double xMin = (dxMin * 100);
double xMax = (dxMax / 100);
double xMin = 0.1;
double xMax = 100000;
double yMin = 0.0;
double yMax = 0.6;

Expand Down

0 comments on commit c72de37

Please sign in to comment.