#2630 Fix wrong picked MD on clipped well paths

This commit is contained in:
Jacob Støren 2018-03-21 13:56:24 +01:00
parent 375bda8b68
commit 25ff51c82b
4 changed files with 26 additions and 10 deletions

View File

@ -312,7 +312,6 @@ void RivWellPathPartMgr::buildWellPathParts(const caf::DisplayCoordTransform* di
m_pipeGeomGenerator->setRadius(wellPathRadius);
m_pipeGeomGenerator->setCrossSectionVertexCount(wellPathCollection->wellPathCrossSectionVertexCount());
double horizontalLengthAlongWellToClipPoint = 0.0;
std::vector<cvf::Vec3d> clippedWellPathCenterLine;
@ -338,12 +337,15 @@ void RivWellPathPartMgr::buildWellPathParts(const caf::DisplayCoordTransform* di
}
}
double horizontalLengthAlongWellToClipPoint = 0.0;
size_t idxToFirstVisibleSegment = 0;
if ( wellPathCollection->wellPathClip )
{
double maxZClipHeight = wellPathClipBoundingBox.max().z() + wellPathCollection->wellPathClipZDistance;
clippedWellPathCenterLine = RigWellPath::clipPolylineStartAboveZ(wellpathCenterLine,
maxZClipHeight,
&horizontalLengthAlongWellToClipPoint);
&horizontalLengthAlongWellToClipPoint,
&idxToFirstVisibleSegment);
}
else
{
@ -379,6 +381,7 @@ void RivWellPathPartMgr::buildWellPathParts(const caf::DisplayCoordTransform* di
}
}
m_pipeGeomGenerator->setFirstVisibleSegmentIndex(idxToFirstVisibleSegment);
m_pipeGeomGenerator->setPipeCenterCoords(cvfCoords.p());
m_surfaceDrawable = m_pipeGeomGenerator->createPipeSurface();
m_centerLineDrawable = m_pipeGeomGenerator->createCenterLine();
@ -388,7 +391,7 @@ void RivWellPathPartMgr::buildWellPathParts(const caf::DisplayCoordTransform* di
m_surfacePart = new cvf::Part;
m_surfacePart->setDrawable(m_surfaceDrawable.p());
RivWellPathSourceInfo* sourceInfo = new RivWellPathSourceInfo(m_rimWellPath, m_rimView);
RivWellPathSourceInfo* sourceInfo = new RivWellPathSourceInfo(m_rimWellPath, m_pipeGeomGenerator.p());
m_surfacePart->setSourceInfo(sourceInfo);
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(m_rimWellPath->wellPathColor()), caf::PO_1);

View File

@ -407,9 +407,11 @@ std::vector< std::vector <cvf::Vec3d> > RimIntersection::polyLines(cvf::Vec3d *
this->firstAncestorOrThisOfType(ownerCase);
if (ownerCase)
{
lines[0] = RigWellPath::clipPolylineStartAboveZ(lines[0],
ownerCase->activeCellsBoundingBox().max().z(),
&horizontalProjectedLengthAlongWellPathToClipPoint);
size_t dummy;
lines[0] = RigWellPath::clipPolylineStartAboveZ(lines[0],
ownerCase->activeCellsBoundingBox().max().z(),
&horizontalProjectedLengthAlongWellPathToClipPoint,
&dummy);
}
}
}

View File

@ -292,13 +292,17 @@ bool RigWellPath::isPolylineTouchingBBox(const std::vector<cvf::Vec3d> &polyLine
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3d> RigWellPath::clipPolylineStartAboveZ(const std::vector<cvf::Vec3d>& polyLine,
double maxZ,
double * horizontalLengthAlongWellToClipPoint)
double * horizontalLengthAlongWellToClipPoint,
size_t * indexToFirstVisibleSegment)
{
CVF_ASSERT(horizontalLengthAlongWellToClipPoint != nullptr);
CVF_ASSERT(horizontalLengthAlongWellToClipPoint);
CVF_ASSERT(indexToFirstVisibleSegment);
// Find first visible point, and accumulate distance along wellpath
*horizontalLengthAlongWellToClipPoint = 0.0;
*indexToFirstVisibleSegment = cvf::UNDEFINED_SIZE_T;
size_t firstVisiblePointIndex = cvf::UNDEFINED_SIZE_T;
for ( size_t vxIdx = 0 ; vxIdx < polyLine.size(); ++vxIdx )
@ -345,8 +349,14 @@ std::vector<cvf::Vec3d> RigWellPath::clipPolylineStartAboveZ(const std::vector<c
clippedPolyLine.push_back(intersection);
}
}
*indexToFirstVisibleSegment = firstVisiblePointIndex - 1;
}
else
{
*indexToFirstVisibleSegment = 0;
}
// Add the rest of the polyline
for ( size_t vxIdx = firstVisiblePointIndex; vxIdx < polyLine.size(); ++vxIdx )

View File

@ -61,7 +61,8 @@ public:
const cvf::BoundingBox& caseBB);
static std::vector<cvf::Vec3d> clipPolylineStartAboveZ(const std::vector<cvf::Vec3d> &polyLine,
double maxZ,
double * horizontalLengthAlongWellToClipPoint);
double * horizontalLengthAlongWellToClipPoint,
size_t * indexToFirstVisibleSegment);
private:
bool m_hasDatumElevation;