#2634 Fix wrong MD when context menu creating completions in 2D intersectino View

This commit is contained in:
Jacob Støren 2018-03-21 13:57:21 +01:00
parent 25ff51c82b
commit dd29a3c727
10 changed files with 36 additions and 57 deletions

View File

@ -106,24 +106,19 @@ bool RicWellPathViewerEventHandler::handleEvent(const RicViewerEventObject& even
if (!rimView) return false;
cvf::ref<caf::DisplayCoordTransform> transForm = rimView->displayCoordTransform();
cvf::Vec3d domainCoord = transForm->transformToDomainCoord(eventObject.m_globalIntersectionPoint);
cvf::Vec3d pickedPositionInUTM = transForm->transformToDomainCoord(eventObject.m_globalIntersectionPoint);
auto intersectionView = dynamic_cast<Rim2dIntersectionView*>(rimView);
if (intersectionView)
if (auto intersectionView = dynamic_cast<Rim2dIntersectionView*>(rimView))
{
cvf::Mat4d unflatXf = intersectionView->flatIntersectionPartMgr()->unflattenTransformMatrix(domainCoord);
if (!unflatXf.isZero())
{
domainCoord = domainCoord.getTransformedPoint(unflatXf);
}
pickedPositionInUTM = intersectionView->transformToUtm(pickedPositionInUTM);
}
double measuredDepth = wellPathSourceInfo->measuredDepth(wellPathTriangleIndex, domainCoord);
double measuredDepth = wellPathSourceInfo->measuredDepth(wellPathTriangleIndex, pickedPositionInUTM);
// NOTE: This computation was used to find the location for a fracture when clicking on a well path
// It turned out that the computation was a bit inaccurate
// Consider to use code in RigSimulationWellCoordsAndMD instead
cvf::Vec3d trueVerticalDepth = wellPathSourceInfo->trueVerticalDepth(wellPathTriangleIndex, domainCoord);
cvf::Vec3d trueVerticalDepth = wellPathSourceInfo->closestPointOnCenterLine(wellPathTriangleIndex, pickedPositionInUTM);
QString wellPathText;
wellPathText += QString("Well path name : %1\n").arg(wellPathSourceInfo->wellPath()->name());

View File

@ -587,14 +587,6 @@ void RivWellPathPartMgr::clearAllBranchData()
m_wellLabelPart = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RivWellPathPartMgr::segmentIndexFromTriangleIndex(size_t triangleIndex)
{
return m_pipeGeomGenerator->segmentIndexFromTriangleIndex(triangleIndex);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -83,8 +83,6 @@ public:
void appendStaticFracturePartsToModel(cvf::ModelBasicList* model);
size_t segmentIndexFromTriangleIndex(size_t triangleIndex);
private:
void appendFishboneSubsPartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,

View File

@ -24,6 +24,8 @@
#include "RimCase.h"
#include "RimWellPath.h"
#include "Rim3dView.h"
#include "RivPipeGeometryGenerator.h"
#include "RimWellPathCollection.h"
#include "RivWellPathPartMgr.h"
@ -33,10 +35,19 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellPathSourceInfo::RivWellPathSourceInfo(RimWellPath* wellPath, Rim3dView* view)
RivWellPathSourceInfo::RivWellPathSourceInfo(RimWellPath* wellPath, RivPipeGeometryGenerator* pipeGeomGenerator)
: m_wellPath(wellPath)
, m_pipeGeomGenerator(pipeGeomGenerator)
{
m_wellPath = wellPath;
m_view = view;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellPathSourceInfo::~RivWellPathSourceInfo()
{
}
//--------------------------------------------------------------------------------------------------
@ -66,7 +77,7 @@ double RivWellPathSourceInfo::measuredDepth(size_t triangleIndex, const cvf::Vec
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RivWellPathSourceInfo::trueVerticalDepth(size_t triangleIndex, const cvf::Vec3d& globalIntersection) const
cvf::Vec3d RivWellPathSourceInfo::closestPointOnCenterLine(size_t triangleIndex, const cvf::Vec3d& globalIntersection) const
{
size_t firstSegmentIndex = cvf::UNDEFINED_SIZE_T;
double norm = 0.0;
@ -105,6 +116,6 @@ void RivWellPathSourceInfo::normalizedIntersection(size_t triangleIndex, const c
//--------------------------------------------------------------------------------------------------
size_t RivWellPathSourceInfo::segmentIndex(size_t triangleIndex) const
{
return m_view->wellPathSegmentIndexFromTriangleIndex(triangleIndex, m_wellPath);
return m_pipeGeomGenerator->segmentIndexFromTriangleIndex( triangleIndex);
}

View File

@ -26,7 +26,7 @@
#include "cvfVector3.h"
class RimWellPath;
class Rim3dView;
class RivPipeGeometryGenerator;
//==================================================================================================
///
@ -34,19 +34,22 @@ class Rim3dView;
class RivWellPathSourceInfo : public cvf::Object
{
public:
explicit RivWellPathSourceInfo(RimWellPath* wellPath, Rim3dView* view);
explicit RivWellPathSourceInfo(RimWellPath* wellPath, RivPipeGeometryGenerator* pipeGeomGenerator);
~RivWellPathSourceInfo();
RimWellPath* wellPath() const;
size_t segmentIndex(size_t triangleIndex) const;
double measuredDepth(size_t triangleIndex, const cvf::Vec3d& globalIntersection) const;
cvf::Vec3d trueVerticalDepth(size_t triangleIndex, const cvf::Vec3d& globalIntersection) const;
cvf::Vec3d closestPointOnCenterLine(size_t triangleIndex, const cvf::Vec3d& globalIntersection) const;
private:
void normalizedIntersection(size_t triangleIndex, const cvf::Vec3d& globalIntersection,
size_t* firstSegmentIndex, double* normalizedSegmentIntersection) const;
void normalizedIntersection(size_t triangleIndex,
const cvf::Vec3d& globalIntersection,
size_t* firstSegmentIndex,
double* normalizedSegmentIntersection) const;
private:
caf::PdmPointer<RimWellPath> m_wellPath;
caf::PdmPointer<Rim3dView> m_view;
cvf::ref<RivPipeGeometryGenerator> m_pipeGeomGenerator;
};

View File

@ -93,17 +93,6 @@ void RivWellPathsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList*
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RivWellPathsPartMgr::segmentIndexFromTriangleIndex(size_t triangleIndex, RimWellPath* wellPath) const
{
auto it = m_mapFromViewToIndex.find(wellPath);
if (it == m_mapFromViewToIndex.end()) return -1;
return it->second->segmentIndexFromTriangleIndex(triangleIndex);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -68,8 +68,6 @@ public:
void appendStaticFracturePartsToModel(cvf::ModelBasicList* model);
size_t segmentIndexFromTriangleIndex(size_t triangleIndex, RimWellPath* wellPath) const;
private:
void clearGeometryCache();
void scheduleGeometryRegen();

View File

@ -862,14 +862,6 @@ cvf::ref<caf::DisplayCoordTransform> Rim3dView::displayCoordTransform() const
return coordTrans;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t Rim3dView::wellPathSegmentIndexFromTriangleIndex(size_t triangleIndex, RimWellPath* wellPath) const
{
return m_wellPathsPartManager->segmentIndexFromTriangleIndex(triangleIndex, wellPath);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -146,8 +146,6 @@ public:
cvf::ref<caf::DisplayCoordTransform> displayCoordTransform() const override;
size_t wellPathSegmentIndexFromTriangleIndex(size_t triangleIndex, RimWellPath* wellPath) const;
virtual RimCase* ownerCase() const = 0;
protected:

View File

@ -343,9 +343,12 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
{
if (firstPartTriangleIndex != cvf::UNDEFINED_UINT)
{
double measuredDepth = wellPathSourceInfo->measuredDepth(firstPartTriangleIndex, m_currentPickPositionInDomainCoords);
cvf::Vec3d trueVerticalDepth = wellPathSourceInfo->trueVerticalDepth(firstPartTriangleIndex, globalIntersectionPoint);
RiuSelectionItem* selItem = new RiuWellPathSelectionItem(wellPathSourceInfo, trueVerticalDepth, measuredDepth);
cvf::Vec3d pickedPositionInUTM = m_currentPickPositionInDomainCoords;
if (int2dView) pickedPositionInUTM = int2dView->transformToUtm(pickedPositionInUTM);
double measuredDepth = wellPathSourceInfo->measuredDepth(firstPartTriangleIndex, pickedPositionInUTM);
cvf::Vec3d closestPointOnCenterLine = wellPathSourceInfo->closestPointOnCenterLine(firstPartTriangleIndex, pickedPositionInUTM);
RiuSelectionItem* selItem = new RiuWellPathSelectionItem(wellPathSourceInfo, closestPointOnCenterLine, measuredDepth);
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
}