#2823 Switching curve plane does not work

* The previous drawable and geometry was kept if switching to a result type without
  valid points.
* The drawable is then stuck in position until switching back to a result
  type that has valid points.
* This commit fixes this by clearing the geometry every time you draw.
* TODO: cache values when it is possible to do so.
This commit is contained in:
Gaute Lindkvist 2018-04-30 08:11:06 +02:00
parent 04f793c19d
commit 7307b97466
2 changed files with 19 additions and 1 deletions

View File

@ -57,6 +57,10 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::Display
{
m_planeWidth = planeWidth;
// Make sure all drawables are cleared in case we return early to avoid a
// previous drawable being "stuck" when changing result type.
clearCurvePointsAndGeometry();
if (!wellPathGeometry()) return;
if (wellPathGeometry()->m_wellPathPoints.empty()) return;
if (!wellPathClipBoundingBox.isValid()) return;
@ -172,6 +176,17 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::Display
m_curveDrawable->setVertexArray(vertexArray.p());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Riv3dWellLogCurveGeometryGenerator::clearCurvePointsAndGeometry()
{
m_curveDrawable = nullptr;
m_curveVertices.clear();
m_curveMeasuredDepths.clear();
m_curveValues.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -55,6 +55,8 @@ public:
double planeWidth,
double minResultValue,
double maxResultValue);
void clearCurvePointsAndGeometry();
const RigWellPath* wellPathGeometry() const;
@ -67,9 +69,10 @@ public:
private:
caf::PdmPointer<RimWellPath> m_wellPath;
double m_planeWidth;
cvf::ref<cvf::DrawableGeo> m_curveDrawable;
std::vector<cvf::Vec3f> m_curveVertices;
std::vector<double> m_curveMeasuredDepths;
std::vector<double> m_curveValues;
double m_planeWidth;
};