(#404) Using well path pointer instead of index for source info for picking

This commit is contained in:
Pål Hagen 2015-09-07 16:17:40 +02:00
parent 98efbf863f
commit 6eaef49996
6 changed files with 25 additions and 26 deletions

View File

@ -78,7 +78,7 @@ void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBa
{
RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr();
partMgr->setScaleTransform(scaleTransform);
partMgr->appendStaticGeometryPartsToModel(model, displayModelOffset, characteristicCellSize, wellPathClipBoundingBox, wIdx);
partMgr->appendStaticGeometryPartsToModel(model, displayModelOffset, characteristicCellSize, wellPathClipBoundingBox);
}
}

View File

@ -97,7 +97,7 @@ RivWellPathPartMgr::~RivWellPathPartMgr()
/// The pipe geometry needs to be rebuilt on scale change to keep the pipes round
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize,
cvf::BoundingBox wellPathClipBoundingBox, size_t wellPathIndex)
cvf::BoundingBox wellPathClipBoundingBox)
{
if (m_wellPathCollection.isNull()) return;
@ -160,7 +160,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
pbd.m_surfacePart = new cvf::Part;
pbd.m_surfacePart->setDrawable(pbd.m_surfaceDrawable.p());
RivWellPathSourceInfo* sourceInfo = new RivWellPathSourceInfo(wellPathIndex);
RivWellPathSourceInfo* sourceInfo = new RivWellPathSourceInfo(m_rimWellPath);
pbd.m_surfacePart->setSourceInfo(sourceInfo);
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(m_rimWellPath->wellPathColor()), caf::PO_1);
@ -226,7 +226,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, size_t wellPathIndex)
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox)
{
if (m_wellPathCollection.isNull()) return;
if (m_rimWellPath.isNull()) return;
@ -240,7 +240,7 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
if (m_needsTransformUpdate)
{
// The pipe geometry needs to be rebuilt on scale change to keep the pipes round
buildWellPathParts(displayModelOffset, characteristicCellSize, wellPathClipBoundingBox, wellPathIndex);
buildWellPathParts(displayModelOffset, characteristicCellSize, wellPathClipBoundingBox);
}
std::list<RivPipeBranchData>::iterator it;

View File

@ -50,7 +50,7 @@ public:
void scheduleGeometryRegen() { m_needsTransformUpdate = true; }//printf("R"); }
void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, size_t wellPathIndex);
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
private:
caf::PdmPointer<RimWellPathCollection> m_wellPathCollection;
@ -59,7 +59,7 @@ private:
cvf::ref<cvf::Transform> m_scaleTransform;
bool m_needsTransformUpdate;
void buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, size_t wellPathIndex);
void buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
struct RivPipeBranchData
{

View File

@ -19,18 +19,21 @@
#include "RivWellPathSourceInfo.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellPathSourceInfo::RivWellPathSourceInfo(size_t wellPathIndex)
RivWellPathSourceInfo::RivWellPathSourceInfo(RimWellPath* wellPath)
{
m_wellPathIndex = wellPathIndex;
m_wellPath = wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RivWellPathSourceInfo::wellPathIndex() const
RimWellPath* RivWellPathSourceInfo::wellPath() const
{
return m_wellPathIndex;
return m_wellPath.p();
}

View File

@ -21,6 +21,9 @@
#include "cvfBase.h"
#include "cvfObject.h"
#include "cafPdmPointer.h"
class RimWellPath;
//==================================================================================================
///
@ -29,10 +32,10 @@
class RivWellPathSourceInfo : public cvf::Object
{
public:
RivWellPathSourceInfo(size_t wellPathIndex);
RivWellPathSourceInfo(RimWellPath* wellPath);
size_t wellPathIndex() const;
RimWellPath* wellPath() const;
private:
size_t m_wellPathIndex;
caf::PdmPointer<RimWellPath> m_wellPath;
};

View File

@ -317,7 +317,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
size_t gridIndex = cvf::UNDEFINED_SIZE_T;
size_t cellIndex = cvf::UNDEFINED_SIZE_T;
size_t nncIndex = cvf::UNDEFINED_SIZE_T;
size_t wellPathIndex = cvf::UNDEFINED_SIZE_T;
RimWellPath* wellPath = NULL;
cvf::StructGridInterface::FaceType face = cvf::StructGridInterface::NO_FACE;
cvf::Vec3d localIntersectionPoint(cvf::Vec3d::ZERO);
@ -360,7 +360,8 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
}
else if (wellPathSourceInfo)
{
wellPathIndex = wellPathSourceInfo->wellPathIndex();
//wellPathIndex = wellPathSourceInfo->wellPathIndex();
wellPath = wellPathSourceInfo->wellPath();
}
}
@ -413,17 +414,9 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
}
}
if (wellPathIndex != cvf::UNDEFINED_SIZE_T)
if (wellPath)
{
RimProject* project = RiaApplication::instance()->project();
CVF_ASSERT(project);
RimOilField* oilField = project->activeOilField();
if (oilField)
{
RimWellPath* wellPath = oilField->wellPathCollection()->wellPaths[wellPathIndex];
pickInfo = QString("Well path hit: %1").arg(wellPath->name());
}
pickInfo = QString("Well path hit: %1").arg(wellPath->name());
}
// Display the text