From b69fc7836193b28748d82c22c933a7d87bccfe6f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 5 Feb 2018 14:47:08 +0100 Subject: [PATCH] #2431 : Remove Rim3dView from function parameters --- .../ModelVisualization/RivWellPathPartMgr.cpp | 6 ++- .../ModelVisualization/RivWellPathPartMgr.h | 3 +- .../RivWellPathsPartMgr.cpp | 44 +++++++++---------- .../ModelVisualization/RivWellPathsPartMgr.h | 41 ++++++++--------- .../ProjectDataModel/RimEclipseView.cpp | 2 +- 5 files changed, 49 insertions(+), 47 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp index 723d005145..6dd075d461 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -83,9 +83,11 @@ RivWellPathPartMgr::~RivWellPathPartMgr() /// //-------------------------------------------------------------------------------------------------- #ifdef USE_PROTOTYPE_FEATURE_FRACTURES -void RivWellPathPartMgr::appendStaticFracturePartsToModel(cvf::ModelBasicList* model, const Rim3dView* rimView) +void RivWellPathPartMgr::appendStaticFracturePartsToModel(cvf::ModelBasicList* model) { - const RimEclipseView* eclView = dynamic_cast(rimView); + if (m_rimView.isNull()) return; + + const RimEclipseView* eclView = dynamic_cast(m_rimView.p()); if (!eclView) return; if (!m_rimWellPath || !m_rimWellPath->showWellPath() || !m_rimWellPath->fractureCollection()->isChecked()) return; diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h index d5cbcaea15..0e96521871 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h @@ -60,8 +60,7 @@ public: const caf::DisplayCoordTransform* displayCoordTransform); #ifdef USE_PROTOTYPE_FEATURE_FRACTURES - void appendStaticFracturePartsToModel(cvf::ModelBasicList* model, - const Rim3dView* eclView); + void appendStaticFracturePartsToModel(cvf::ModelBasicList* model); #endif // USE_PROTOTYPE_FEATURE_FRACTURES void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, diff --git a/ApplicationCode/ModelVisualization/RivWellPathsPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathsPartMgr.cpp index 77fca1e308..ddccacc331 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathsPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathsPartMgr.cpp @@ -44,12 +44,9 @@ void RivWellPathsPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* const cvf::BoundingBox& wellPathClipBoundingBox, const caf::DisplayCoordTransform* displayCoordTransform) { - auto wellPathColl = wellPathCollection(); + if (!isWellPathVisible()) return; - if (!wellPathColl->isActive()) return; - if (wellPathColl->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return; - - buildPartManagers(); + createPartManagersIfRequired(); for (auto& partMgr : m_wellPatshsPartMgrs) { @@ -61,22 +58,15 @@ void RivWellPathsPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* /// //-------------------------------------------------------------------------------------------------- #ifdef USE_PROTOTYPE_FEATURE_FRACTURES -void RivWellPathsPartMgr::appendStaticFracturePartsToModel(cvf::ModelBasicList* model, const Rim3dView* rimView) +void RivWellPathsPartMgr::appendStaticFracturePartsToModel(cvf::ModelBasicList* model) { - // Display of fractures is not supported in geomech view - const RimEclipseView* eclView = dynamic_cast(rimView); - if (!eclView) return; + if (!isWellPathVisible()) return; - auto wellPathColl = wellPathCollection(); - - if (!wellPathColl->isActive()) return; - if (wellPathColl->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return; - - buildPartManagers(); + createPartManagersIfRequired(); for (auto& partMgr : m_wellPatshsPartMgrs) { - partMgr->appendStaticFracturePartsToModel(model, eclView); + partMgr->appendStaticFracturePartsToModel(model); } } #endif // USE_PROTOTYPE_FEATURE_FRACTURES @@ -89,12 +79,9 @@ void RivWellPathsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* const cvf::BoundingBox& wellPathClipBoundingBox, const caf::DisplayCoordTransform* displayCoordTransform) { - auto wellPathColl = wellPathCollection(); + if (!isWellPathVisible()) return; - if (!wellPathColl->isActive()) return; - if (wellPathColl->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return; - - buildPartManagers(); + createPartManagersIfRequired(); for (auto& partMgr : m_wellPatshsPartMgrs) { @@ -131,7 +118,7 @@ void RivWellPathsPartMgr::scheduleGeometryRegen() {} //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivWellPathsPartMgr::buildPartManagers() +void RivWellPathsPartMgr::createPartManagersIfRequired() { RimProject* proj = RiaApplication::instance()->project(); auto wellPaths = proj->allWellPaths(); @@ -158,3 +145,16 @@ RimWellPathCollection* RivWellPathsPartMgr::wellPathCollection() const return proj->activeOilField()->wellPathCollection(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RivWellPathsPartMgr::isWellPathVisible() const +{ + auto wellPathColl = wellPathCollection(); + + if (!wellPathColl->isActive()) return false; + if (wellPathColl->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return false; + + return true; +} diff --git a/ApplicationCode/ModelVisualization/RivWellPathsPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathsPartMgr.h index b2dc6cf6ff..f1bab94ee7 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathsPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathsPartMgr.h @@ -23,10 +23,12 @@ #include "cvfCollection.h" #include "cvfObject.h" -#include -#include #include "cafPdmPointer.h" +#include + +#include + namespace cvf { @@ -54,36 +56,35 @@ public: explicit RivWellPathsPartMgr(Rim3dView* view); ~RivWellPathsPartMgr(); - void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, - double characteristicCellSize, - const cvf::BoundingBox& wellPathClipBoundingBox, - const caf::DisplayCoordTransform* displayCoordTransform); + void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform); #ifdef USE_PROTOTYPE_FEATURE_FRACTURES - void appendStaticFracturePartsToModel(cvf::ModelBasicList* model, - const Rim3dView* rimView); + void appendStaticFracturePartsToModel(cvf::ModelBasicList* model); #endif // USE_PROTOTYPE_FEATURE_FRACTURES - void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, - const QDateTime& timeStamp, - double characteristicCellSize, - const cvf::BoundingBox& wellPathClipBoundingBox, - const caf::DisplayCoordTransform* displayCoordTransform); + void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, + const QDateTime& timeStamp, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform); - size_t segmentIndexFromTriangleIndex(size_t triangleIndex, RimWellPath* wellPath) const; + size_t segmentIndexFromTriangleIndex(size_t triangleIndex, RimWellPath* wellPath) const; private: - void clearGeometryCache(); - void scheduleGeometryRegen(); - void buildPartManagers(); + void clearGeometryCache(); + void scheduleGeometryRegen(); + void createPartManagersIfRequired(); RimWellPathCollection* wellPathCollection() const; + bool isWellPathVisible() const; private: - caf::PdmPointer m_rimView; - - cvf::Collection m_wellPatshsPartMgrs; + caf::PdmPointer m_rimView; + cvf::Collection m_wellPatshsPartMgrs; std::map m_mapFromViewToIndex; }; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 046f07373f..8c5294d94b 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -469,7 +469,7 @@ void RimEclipseView::createDisplayModel() addWellPathsToModel(m_wellPathPipeVizModel.p(), currentActiveCellInfo()->geometryBoundingBox()); #ifdef USE_PROTOTYPE_FEATURE_FRACTURES - m_wellPathsPartManager->appendStaticFracturePartsToModel(m_wellPathPipeVizModel.p(), this); + m_wellPathsPartManager->appendStaticFracturePartsToModel(m_wellPathPipeVizModel.p()); #endif // USE_PROTOTYPE_FEATURE_FRACTURES m_wellPathPipeVizModel->updateBoundingBoxesRecursive(); m_viewer->addStaticModelOnce(m_wellPathPipeVizModel.p());