Commit b6ed6ab6 authored by Bianca Tost's avatar Bianca Tost

fixed disappearing of contour lines in HSec and VSec if the user enters a...

fixed disappearing of contour lines in HSec and VSec if the user enters a sequence of iso values starting with an iso value greater than the maximum or ending with an iso value smaller than the minmum of the data field
parent aa18c528
...@@ -2872,7 +2872,8 @@ bool MNWP2DSectionActorVariable::parseContourLevelString( ...@@ -2872,7 +2872,8 @@ bool MNWP2DSectionActorVariable::parseContourLevelString(
if (step > 0) if (step > 0)
for (double d = from; d <= to; d += step) *contourSet << d; for (double d = from; d <= to; d += step) *contourSet << d;
else if (step < 0) else if (step < 0)
for (double d = from; d >= to; d += step) *contourSet << d; // Sort iso values by ascending order (reason see below).
for (double d = to; d <= from; d -= step) *contourSet << d;
contours->stopIndex = contourSet->size(); contours->stopIndex = contourSet->size();
return true; return true;
...@@ -2885,6 +2886,11 @@ bool MNWP2DSectionActorVariable::parseContourLevelString( ...@@ -2885,6 +2886,11 @@ bool MNWP2DSectionActorVariable::parseContourLevelString(
for (int i = 0; i < listValues.size(); i++) for (int i = 0; i < listValues.size(); i++)
*contourSet << listValues.value(i).toDouble(&ok); *contourSet << listValues.value(i).toDouble(&ok);
// Sort contour levels to avoid all levels disappearing if the user
// ends the sequence with a iso value smaller than the minimum value of
// the data field or starts the sequence with a level greater than the
// maximum.
std::sort(contourSet->begin(), contourSet->end());
contours->stopIndex = contourSet->size(); contours->stopIndex = contourSet->size();
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment