#2431 : Refactor of well part manager

This commit is contained in:
Magne Sjaastad
2018-02-05 13:23:14 +01:00
parent 0679ec4ba5
commit 5919cb20fb
6 changed files with 44 additions and 12 deletions

View File

@@ -57,15 +57,18 @@
#include "cvfFont.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include "cvfScalarMapperDiscreteLinear.h"
#include "cvfTransform.h"
#include "cvfqtUtils.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellPathPartMgr::RivWellPathPartMgr(RimWellPath* wellPath)
RivWellPathPartMgr::RivWellPathPartMgr(RimWellPath* wellPath, Rim3dView* view)
{
m_rimWellPath = wellPath;
m_rimView = view;
}
//--------------------------------------------------------------------------------------------------
@@ -80,15 +83,18 @@ RivWellPathPartMgr::~RivWellPathPartMgr()
///
//--------------------------------------------------------------------------------------------------
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
void RivWellPathPartMgr::appendStaticFracturePartsToModel(cvf::ModelBasicList* model, const RimEclipseView& eclView)
void RivWellPathPartMgr::appendStaticFracturePartsToModel(cvf::ModelBasicList* model, const Rim3dView* rimView)
{
const RimEclipseView* eclView = dynamic_cast<const RimEclipseView*>(rimView);
if (!eclView) return;
if (!m_rimWellPath || !m_rimWellPath->showWellPath() || !m_rimWellPath->fractureCollection()->isChecked()) return;
for (RimWellPathFracture* f : m_rimWellPath->fractureCollection()->fractures())
{
CVF_ASSERT(f);
f->fracturePartManager()->appendGeometryPartsToModel(model, eclView);
f->fracturePartManager()->appendGeometryPartsToModel(model, *eclView);
}
}
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
@@ -156,13 +162,16 @@ void RivWellPathPartMgr::appendPerforationsToModel(const QDateTime& currentViewD
{
if (!m_rimWellPath || !m_rimWellPath->perforationIntervalCollection()->isChecked()) return;
RimWellPathCollection* wellPathCollection = this->wellPathCollection();
if (!wellPathCollection) return;
RigWellPath* wellPathGeometry = m_rimWellPath->wellPathGeometry();
if (!wellPathGeometry) return;
// Since we're using the index of measured depths to find the index of a point, ensure they're equal
CVF_ASSERT(wellPathGeometry->m_measuredDepths.size() == wellPathGeometry->m_wellPathPoints.size());
double wellPathRadius = m_rimWellPath->wellPathRadius(characteristicCellSize);
double wellPathRadius = this->wellPathRadius(characteristicCellSize, wellPathCollection);
double perforationRadius = wellPathRadius * 1.1;
RivPipeGeometryGenerator geoGenerator;
@@ -211,7 +220,7 @@ void RivWellPathPartMgr::buildWellPathParts(const caf::DisplayCoordTransform* di
if (wellPathGeometry->m_wellPathPoints.size() < 2) return;
clearAllBranchData();
double wellPathRadius = m_rimWellPath->wellPathRadius(characteristicCellSize);
double wellPathRadius = this->wellPathRadius(characteristicCellSize, wellPathCollection);
cvf::Vec3d textPosition;
@@ -293,7 +302,7 @@ void RivWellPathPartMgr::buildWellPathParts(const caf::DisplayCoordTransform* di
pbd.m_surfacePart = new cvf::Part;
pbd.m_surfacePart->setDrawable(pbd.m_surfaceDrawable.p());
RivWellPathSourceInfo* sourceInfo = new RivWellPathSourceInfo(m_rimWellPath);
RivWellPathSourceInfo* sourceInfo = new RivWellPathSourceInfo(m_rimWellPath, m_rimView);
pbd.m_surfacePart->setSourceInfo(sourceInfo);
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(m_rimWellPath->wellPathColor()), caf::PO_1);
@@ -448,3 +457,10 @@ RimWellPathCollection* RivWellPathPartMgr::wellPathCollection()
return wellPathCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RivWellPathPartMgr::wellPathRadius(double characteristicCellSize, RimWellPathCollection* wellPathCollection)
{
return wellPathCollection->wellPathRadiusScaleFactor() * m_rimWellPath->wellPathRadiusScaleFactor() * characteristicCellSize;
}

View File

@@ -28,7 +28,10 @@ namespace cvf
{
class Part;
class ModelBasicList;
class Transform;
class Effect;
class DrawableGeo;
class ScalarMapper;
}
namespace caf
@@ -41,14 +44,14 @@ class RimProject;
class RimWellPath;
class RivFishbonesSubsPartMgr;
class RimWellPathCollection;
class RimEclipseView;
class Rim3dView;
class QDateTime;
class RivWellPathPartMgr : public cvf::Object
{
public:
explicit RivWellPathPartMgr(RimWellPath* wellPath);
explicit RivWellPathPartMgr(RimWellPath* wellPath, Rim3dView* view);
~RivWellPathPartMgr();
void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
@@ -58,7 +61,7 @@ public:
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
void appendStaticFracturePartsToModel(cvf::ModelBasicList* model,
const RimEclipseView& eclView);
const Rim3dView* eclView);
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
@@ -90,9 +93,11 @@ private:
void clearAllBranchData();
inline RimWellPathCollection* wellPathCollection();
inline double wellPathRadius(double characteristicCellSize, RimWellPathCollection* wellPathCollection);
private:
caf::PdmPointer<RimWellPath> m_rimWellPath;
caf::PdmPointer<Rim3dView> m_rimView;
struct RivPipeBranchData
{

View File

@@ -23,6 +23,7 @@
#include "RimCase.h"
#include "RimWellPath.h"
#include "Rim3dView.h"
#include "RimWellPathCollection.h"
#include "RivWellPathPartMgr.h"
@@ -32,9 +33,10 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellPathSourceInfo::RivWellPathSourceInfo(RimWellPath* wellPath)
RivWellPathSourceInfo::RivWellPathSourceInfo(RimWellPath* wellPath, Rim3dView* view)
{
m_wellPath = wellPath;
m_view = view;
}
//--------------------------------------------------------------------------------------------------
@@ -103,6 +105,8 @@ void RivWellPathSourceInfo::normalizedIntersection(size_t triangleIndex, const c
//--------------------------------------------------------------------------------------------------
size_t RivWellPathSourceInfo::segmentIndex(size_t triangleIndex) const
{
return m_wellPath->partMgr()->segmentIndexFromTriangleIndex(triangleIndex);
return -1;
//return m_view->wellPathSegmentIndexFromTriangleIndex(triangleIndex, m_wellPath);
}

View File

@@ -26,6 +26,7 @@
#include "cvfVector3.h"
class RimWellPath;
class Rim3dView;
//==================================================================================================
///
@@ -33,7 +34,7 @@ class RimWellPath;
class RivWellPathSourceInfo : public cvf::Object
{
public:
explicit RivWellPathSourceInfo(RimWellPath* wellPath);
explicit RivWellPathSourceInfo(RimWellPath* wellPath, Rim3dView* view);
RimWellPath* wellPath() const;
@@ -47,4 +48,5 @@ private:
private:
caf::PdmPointer<RimWellPath> m_wellPath;
caf::PdmPointer<Rim3dView> m_view;
};

View File

@@ -305,6 +305,7 @@ const RigWellPath* RimWellPath::wellPathGeometry() const
//--------------------------------------------------------------------------------------------------
RivWellPathPartMgr* RimWellPath::partMgr()
{
/*
if (m_wellPathPartMgr.isNull())
{
RimWellPathCollection* wpColl;
@@ -313,6 +314,8 @@ RivWellPathPartMgr* RimWellPath::partMgr()
}
return m_wellPathPartMgr.p();
*/
return nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -437,6 +437,7 @@ void RimWellPathCollection::appendStaticGeometryPartsToModel(cvf::ModelBasicList
void RimWellPathCollection::appendStaticFracturePartsToModel(cvf::ModelBasicList* model,
const RimEclipseView& eclView)
{
/*
if (!this->isActive()) return;
if (this->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return;
@@ -445,6 +446,7 @@ void RimWellPathCollection::appendStaticFracturePartsToModel(cvf::ModelBasicList
RivWellPathPartMgr* partMgr = this->wellPaths[wIdx]->partMgr();
partMgr->appendStaticFracturePartsToModel(model, eclView);
}
*/
}
#endif // USE_PROTOTYPE_FEATURE_FRACTURES