From b755ddc11d889782a4cb226795459313abb41b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Tue, 13 Mar 2018 16:16:41 +0100 Subject: [PATCH] #2552 Embed pipe visualization of Simulation Wells in intersection views --- .../RivIntersectionGeometryGenerator.cpp | 6 +- .../RivIntersectionGeometryGenerator.h | 4 +- .../Intersections/RivIntersectionPartMgr.cpp | 13 +-- .../RivReservoirSimWellsPartMgr.cpp | 7 +- .../RivSimWellPipesPartMgr.cpp | 87 +++++++++---------- .../RivSimWellPipesPartMgr.h | 43 +++++---- .../Rim2dIntersectionView.cpp | 36 ++++++++ .../ProjectDataModel/Rim2dIntersectionView.h | 2 + .../ProjectDataModel/Rim3dView.cpp | 21 +++++ ApplicationCode/ProjectDataModel/Rim3dView.h | 2 + .../ProjectDataModel/RimGridView.cpp | 20 ----- .../ProjectDataModel/RimGridView.h | 1 - .../ProjectDataModel/RimIntersection.cpp | 25 ++++-- .../ProjectDataModel/RimIntersection.h | 4 +- 14 files changed, 165 insertions(+), 106 deletions(-) diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp index d5f166e4c7..c2c09f6ebf 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp @@ -61,13 +61,13 @@ RivIntersectionGeometryGenerator::RivIntersectionGeometryGenerator( RimIntersect const cvf::Vec3d& extrusionDirection, const RivIntersectionHexGridInterface* grid, bool isFlattened, - double horizontalLengthAlongWellToPolylineStart) + const cvf::Vec3d& flattenedPolylineStartPoint) : m_crossSection(crossSection), m_polyLines(polylines), m_extrusionDirection(extrusionDirection), m_hexGrid(grid), m_isFlattened(isFlattened), - m_horizontalLengthAlongWellToPolylineStart(horizontalLengthAlongWellToPolylineStart) + m_flattenedPolylineStartPoint(flattenedPolylineStartPoint) { m_triangleVxes = new cvf::Vec3fArray; m_cellBorderLineVxes = new cvf::Vec3fArray; @@ -91,7 +91,7 @@ void RivIntersectionGeometryGenerator::calculateSegementTransformPrLinePoint() { if ( !(m_polyLines.size() && m_polyLines.back().size()) ) return; - cvf::Vec3d startOffset ={ m_horizontalLengthAlongWellToPolylineStart, 0.0, m_polyLines[0][0].z() }; + cvf::Vec3d startOffset = m_flattenedPolylineStartPoint; for ( size_t pLineIdx = 0; pLineIdx < m_polyLines.size(); ++pLineIdx ) { diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.h b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.h index 5886659644..75e2fbcaec 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.h +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.h @@ -51,7 +51,7 @@ public: const cvf::Vec3d& extrusionDirection, const RivIntersectionHexGridInterface* grid, bool isFlattened, - double horizontalLengthAlongWellToPolylineStart); + const cvf::Vec3d& flattenedPolylineStartPoint); ~RivIntersectionGeometryGenerator(); @@ -93,7 +93,7 @@ private: const std::vector > m_polyLines; cvf::Vec3d m_extrusionDirection; bool m_isFlattened; - double m_horizontalLengthAlongWellToPolylineStart; + cvf::Vec3d m_flattenedPolylineStartPoint; // Output arrays cvf::ref m_triangleVxes; diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp index 9aeb67be8f..dc5a2430b6 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp @@ -83,9 +83,9 @@ RivIntersectionPartMgr::RivIntersectionPartMgr(RimIntersection* rimCrossSection, m_crossSectionFacesTextureCoords = new cvf::Vec2fArray; - double horizontalLengthAlongWellToPolylineStart; + cvf::Vec3d flattenedPolylineStartPoint; - std::vector< std::vector > polyLines = m_rimCrossSection->polyLines(&horizontalLengthAlongWellToPolylineStart); + std::vector< std::vector > polyLines = m_rimCrossSection->polyLines(&flattenedPolylineStartPoint); if (polyLines.size() > 0) { cvf::Vec3d direction = m_rimCrossSection->extrusionDirection(); @@ -95,7 +95,7 @@ RivIntersectionPartMgr::RivIntersectionPartMgr(RimIntersection* rimCrossSection, direction, hexGrid.p(), m_isFlattened, - horizontalLengthAlongWellToPolylineStart); + flattenedPolylineStartPoint); } } @@ -778,7 +778,7 @@ void RivIntersectionPartMgr::appendWellPipePartsToModel(cvf::ModelBasicList* mod cvf::Color3f wellPipeColor = cvf::Color3f::GRAY; double characteristicCellSize = 0; - if ( m_rimCrossSection->type() == RimIntersection::CS_SIMULATION_WELL ) + if ( false)//m_rimCrossSection->type() == RimIntersection::CS_SIMULATION_WELL ) { RimSimWellInView * simWellInView = m_rimCrossSection->simulationWell(); @@ -818,8 +818,9 @@ void RivIntersectionPartMgr::appendWellPipePartsToModel(cvf::ModelBasicList* mod // Create pipe geometry - if ( m_rimCrossSection->type() == RimIntersection::CS_SIMULATION_WELL - || m_rimCrossSection->type() == RimIntersection::CS_WELL_PATH ) + if ( //m_rimCrossSection->type() == RimIntersection::CS_SIMULATION_WELL + //|| + m_rimCrossSection->type() == RimIntersection::CS_WELL_PATH ) { std::vector > polyLines = m_crossSectionGenerator->flattenedOrOffsettedPolyLines(); diff --git a/ApplicationCode/ModelVisualization/RivReservoirSimWellsPartMgr.cpp b/ApplicationCode/ModelVisualization/RivReservoirSimWellsPartMgr.cpp index 71c694a1b3..846bdf2805 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirSimWellsPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivReservoirSimWellsPartMgr.cpp @@ -36,6 +36,7 @@ #include "cafPdmFieldCvfColor.h" #include "cafPdmFieldCvfMat4d.h" +#include "cafDisplayCoordTransform.h" #include "cvfTransform.h" @@ -95,7 +96,7 @@ void RivReservoirSimWellsPartMgr::setScaleTransform(cvf::Transform * scaleTransf for (size_t wIdx = 0; wIdx != m_wellPipesPartMgrs.size(); ++ wIdx) { - m_wellPipesPartMgrs[wIdx]->setScaleTransform(scaleTransform); + m_wellPipesPartMgrs[wIdx]->setDisplayCoordTransform(m_reservoirView->displayCoordTransform().p()); } for (size_t wIdx = 0; wIdx != m_wellHeadPartMgrs.size(); ++ wIdx) @@ -117,9 +118,9 @@ void RivReservoirSimWellsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBa for (size_t i = 0; i < m_reservoirView->wellCollection()->wells.size(); ++i) { - RivSimWellPipesPartMgr * wppmgr = new RivSimWellPipesPartMgr(m_reservoirView, m_reservoirView->wellCollection()->wells[i]); + RivSimWellPipesPartMgr * wppmgr = new RivSimWellPipesPartMgr( m_reservoirView->wellCollection()->wells[i], false); m_wellPipesPartMgrs.push_back(wppmgr); - wppmgr->setScaleTransform(m_scaleTransform.p()); + wppmgr->setDisplayCoordTransform(m_reservoirView->displayCoordTransform().p()); RivWellHeadPartMgr* wellHeadMgr = new RivWellHeadPartMgr(m_reservoirView, m_reservoirView->wellCollection()->wells[i]); m_wellHeadPartMgrs.push_back(wellHeadMgr); diff --git a/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.cpp b/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.cpp index 9e2086bfee..988e330edb 100644 --- a/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.cpp @@ -31,7 +31,7 @@ #include "RimEclipseCase.h" #include "RimEclipseCellColors.h" #include "RimEclipsePropertyFilterCollection.h" -#include "RimEclipseView.h" +#include "Rim3dView.h" #include "RimReservoirCellResultsStorage.h" #include "RimSimWellInView.h" #include "RimSimWellInViewCollection.h" @@ -52,15 +52,16 @@ #include "cvfTransform.h" #include "cafDisplayCoordTransform.h" #include "RivSectionFlattner.h" - +#include "Rim2dIntersectionView.h" +#include "RimIntersection.h" //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RivSimWellPipesPartMgr::RivSimWellPipesPartMgr(RimEclipseView* reservoirView, RimSimWellInView* well, bool isFlattened) - : m_rimReservoirView(reservoirView) - , m_needsTransformUpdate(true) - , m_isFlattened(isFlattened) +RivSimWellPipesPartMgr::RivSimWellPipesPartMgr(RimSimWellInView* well, Rim2dIntersectionView * intersectionView) + : m_rimWell(well) + , m_needsToRebuildGeometry(true) + , m_intersectionView(intersectionView) { } @@ -75,10 +76,10 @@ RivSimWellPipesPartMgr::~RivSimWellPipesPartMgr() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivSimWellPipesPartMgr::setScaleTransform(cvf::Transform * scaleTransform) +void RivSimWellPipesPartMgr::setDisplayCoordTransform(caf::DisplayCoordTransform* displayXf) { - m_scaleTransform = scaleTransform; - + m_displayCoordTransform = displayXf; + scheduleGeometryRegen(); } @@ -87,7 +88,18 @@ void RivSimWellPipesPartMgr::setScaleTransform(cvf::Transform * scaleTransform) //-------------------------------------------------------------------------------------------------- void RivSimWellPipesPartMgr::scheduleGeometryRegen() { - m_needsTransformUpdate = true; + m_needsToRebuildGeometry = true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +Rim3dView* RivSimWellPipesPartMgr::viewWithSettings() +{ + Rim3dView* view = nullptr; + if (m_rimWell) m_rimWell->firstAncestorOrThisOfType(view); + + return view; } //-------------------------------------------------------------------------------------------------- @@ -95,7 +107,7 @@ void RivSimWellPipesPartMgr::scheduleGeometryRegen() //-------------------------------------------------------------------------------------------------- void RivSimWellPipesPartMgr::buildWellPipeParts() { - if (m_rimReservoirView.isNull()) return; + if (!this->viewWithSettings()) return; m_wellBranches.clear(); @@ -106,9 +118,12 @@ void RivSimWellPipesPartMgr::buildWellPipeParts() double pipeRadius = m_rimWell->pipeRadius(); int crossSectionVertexCount = m_rimWell->pipeCrossSectionVertexCount(); - cvf::ref displayCoordXf = m_rimReservoirView->displayCoordTransform(); - cvf::Vec3d flattenedStartOffset = cvf::Vec3d::ZERO; + cvf::Vec3d flattenedStartOffset = cvf::Vec3d::ZERO; + if ( m_pipeBranchesCLCoords.size() && m_pipeBranchesCLCoords[0].size() ) + { + flattenedStartOffset = { 0.0, 0.0, m_pipeBranchesCLCoords[0][0].z() }; + } for (size_t brIdx = 0; brIdx < pipeBranchesCellIds.size(); ++brIdx) { @@ -127,15 +142,16 @@ void RivSimWellPipesPartMgr::buildWellPipeParts() cvf::ref cvfCoords = new cvf::Vec3dArray; cvfCoords->assign(m_pipeBranchesCLCoords[brIdx]); - if (m_isFlattened) + if (m_intersectionView) { std::vector flatningCSs = RivSectionFlattner::calculateFlatteningCSsForPolyline(m_pipeBranchesCLCoords[brIdx], - cvf::Vec3d(0, 0, 1), + cvf::Vec3d::Z_AXIS, flattenedStartOffset, &flattenedStartOffset); for (size_t cIdx = 0; cIdx < cvfCoords->size(); ++cIdx) { (*cvfCoords)[cIdx] = ((*cvfCoords)[cIdx]).getTransformedPoint(flatningCSs[cIdx]); + (*cvfCoords)[cIdx] = m_displayCoordTransform->scaleToDisplaySize((*cvfCoords)[cIdx]); } } else @@ -144,16 +160,17 @@ void RivSimWellPipesPartMgr::buildWellPipeParts() for ( size_t cIdx = 0; cIdx < cvfCoords->size(); ++cIdx ) { - (*cvfCoords)[cIdx] = displayCoordXf->transformToDisplayCoord((*cvfCoords)[cIdx]); + (*cvfCoords)[cIdx] = m_displayCoordTransform->transformToDisplayCoord((*cvfCoords)[cIdx]); } } + pbd.m_pipeGeomGenerator->setPipeCenterCoords(cvfCoords.p()); pbd.m_surfaceDrawable = pbd.m_pipeGeomGenerator->createPipeSurface(); pbd.m_centerLineDrawable = pbd.m_pipeGeomGenerator->createCenterLine(); if (pbd.m_surfaceDrawable.notNull()) { - pbd.m_surfacePart = new cvf::Part; + pbd.m_surfacePart = new cvf::Part(0,"SimWellPipeSurface"); pbd.m_surfacePart->setDrawable(pbd.m_surfaceDrawable.p()); caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(m_rimWell->wellPipeColor()), caf::PO_1); @@ -166,7 +183,7 @@ void RivSimWellPipesPartMgr::buildWellPipeParts() if (pbd.m_centerLineDrawable.notNull()) { - pbd.m_centerLinePart = new cvf::Part; + pbd.m_centerLinePart = new cvf::Part(0,"SimWellPipeCenterLine"); pbd.m_centerLinePart->setDrawable(pbd.m_centerLineDrawable.p()); caf::MeshEffectGenerator gen(m_rimWell->wellPipeColor()); @@ -181,31 +198,11 @@ void RivSimWellPipesPartMgr::buildWellPipeParts() pbd.m_pipeGeomGenerator->setRadius(pipeRadius * 1.1); pbd.m_largeSurfaceDrawable = pbd.m_pipeGeomGenerator->createPipeSurface(); } + + if (m_intersectionView) flattenedStartOffset += { 2*m_intersectionView->intersection()->extentLength(), 0.0, 0.0}; } - m_needsTransformUpdate = false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RivSimWellPipesPartMgr::RivPipeBranchData* RivSimWellPipesPartMgr::pipeBranchData(size_t branchIndex) -{ - if (branchIndex < m_wellBranches.size()) - { - size_t i = 0; - - auto brIt = m_wellBranches.begin(); - while (i < branchIndex) - { - brIt++; - i++; - } - - return &(*brIt); - } - - return nullptr; + m_needsToRebuildGeometry = false; } //-------------------------------------------------------------------------------------------------- @@ -213,11 +210,11 @@ RivSimWellPipesPartMgr::RivPipeBranchData* RivSimWellPipesPartMgr::pipeBranchDat //-------------------------------------------------------------------------------------------------- void RivSimWellPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex) { - if (m_rimReservoirView.isNull()) return; - if (m_rimWell.isNull()) return; + if (!viewWithSettings()) return; + if (!m_rimWell->isWellPipeVisible(frameIndex)) return; - if (m_needsTransformUpdate) buildWellPipeParts(); + if (m_needsToRebuildGeometry) buildWellPipeParts(); std::list::iterator it; for (it = m_wellBranches.begin(); it != m_wellBranches.end(); ++it) @@ -269,7 +266,7 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex) caf::ScalarMapperEffectGenerator surfEffGen(scalarMapper.p(), caf::PO_1); - if (m_rimReservoirView && m_rimReservoirView->isLightingDisabled()) + if (viewWithSettings() && viewWithSettings()->isLightingDisabled()) { surfEffGen.disableLighting(true); } diff --git a/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.h b/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.h index f42afaa28b..1e6f74ea08 100644 --- a/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.h @@ -37,36 +37,43 @@ namespace cvf class DrawableGeo; } +namespace caf +{ + class DisplayCoordTransform; +} + class RivPipeGeometryGenerator; -class RimEclipseView; +class Rim3dView; class RimSimWellInView; +class Rim2dIntersectionView; class RivSimWellPipesPartMgr : public cvf::Object { public: - RivSimWellPipesPartMgr(RimEclipseView* reservoirView, RimSimWellInView* well, bool isFlattened = false); + RivSimWellPipesPartMgr(RimSimWellInView* well, Rim2dIntersectionView * intersectionView = nullptr); + ~RivSimWellPipesPartMgr(); - void setScaleTransform(cvf::Transform * scaleTransform); - - void scheduleGeometryRegen(); - - void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex); - void updatePipeResultColor(size_t frameIndex); + void setDisplayCoordTransform(caf::DisplayCoordTransform* displayXf); + void scheduleGeometryRegen(); + + void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex); + void updatePipeResultColor(size_t frameIndex); private: - caf::PdmPointer m_rimReservoirView; - caf::PdmPointer m_rimWell; - - cvf::ref m_scaleTransform; - bool m_needsTransformUpdate; - bool m_isFlattened; + Rim3dView* viewWithSettings(); + void buildWellPipeParts(); - void buildWellPipeParts(); + caf::PdmPointer m_rimWell; + caf::PdmPointer m_intersectionView; + bool m_isFlattened; + + cvf::ref m_displayCoordTransform; + bool m_needsToRebuildGeometry; struct RivPipeBranchData { - std::vector m_cellIds; + std::vector m_cellIds; cvf::ref m_pipeGeomGenerator; cvf::ref m_surfacePart; @@ -77,9 +84,7 @@ private: }; - RivPipeBranchData* pipeBranchData(size_t branchIndex); - - std::list m_wellBranches; + std::list m_wellBranches; std::vector< std::vector > m_pipeBranchesCLCoords; }; diff --git a/ApplicationCode/ProjectDataModel/Rim2dIntersectionView.cpp b/ApplicationCode/ProjectDataModel/Rim2dIntersectionView.cpp index 90e15d6b7f..311f363289 100644 --- a/ApplicationCode/ProjectDataModel/Rim2dIntersectionView.cpp +++ b/ApplicationCode/ProjectDataModel/Rim2dIntersectionView.cpp @@ -42,6 +42,7 @@ #include #include "cafDisplayCoordTransform.h" +#include "RivSimWellPipesPartMgr.h" CAF_PDM_SOURCE_INIT(Rim2dIntersectionView, "Intersection2dView"); @@ -402,6 +403,20 @@ void Rim2dIntersectionView::createDisplayModel() m_flatIntersectionPartMgr->applySingleColorEffect(); + m_flatSimWellPipePartMgr = nullptr; + + if ( m_intersection->type() == RimIntersection::CS_SIMULATION_WELL + && m_intersection->simulationWell() ) + { + RimEclipseView* eclipseView = nullptr; + m_intersection->firstAncestorOrThisOfType(eclipseView); + + if ( eclipseView ) + { + m_flatSimWellPipePartMgr = new RivSimWellPipesPartMgr(m_intersection->simulationWell(), this); + } + } + m_viewer->addStaticModelOnce(m_intersectionVizModel.p()); m_intersectionVizModel->updateBoundingBoxesRecursive(); @@ -446,6 +461,27 @@ void Rim2dIntersectionView::updateCurrentTimeStep() update3dInfo(); updateLegends(); + if ( m_flatSimWellPipePartMgr.notNull() ) + { + cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep); + if (frameScene) + { + cvf::String name = "SimWellPipeMod"; + Rim3dView::removeModelByName(frameScene, name); + + cvf::ref simWellModelBasicList = new cvf::ModelBasicList; + simWellModelBasicList->setName(name); + + m_flatSimWellPipePartMgr->setDisplayCoordTransform(this->displayCoordTransform().p()); + m_flatSimWellPipePartMgr->appendDynamicGeometryPartsToModel(simWellModelBasicList.p(), m_currentTimeStep); + + simWellModelBasicList->updateBoundingBoxesRecursive(); + frameScene->addModel(simWellModelBasicList.p()); + + m_flatSimWellPipePartMgr->updatePipeResultColor(m_currentTimeStep); + } + } + if ((this->hasUserRequestedAnimation() && this->hasResults())) { m_flatIntersectionPartMgr->updateCellResultColor(m_currentTimeStep, diff --git a/ApplicationCode/ProjectDataModel/Rim2dIntersectionView.h b/ApplicationCode/ProjectDataModel/Rim2dIntersectionView.h index 1449317049..2767179509 100644 --- a/ApplicationCode/ProjectDataModel/Rim2dIntersectionView.h +++ b/ApplicationCode/ProjectDataModel/Rim2dIntersectionView.h @@ -25,6 +25,7 @@ class RimIntersection; class RimLegendConfig; class RimTernaryLegendConfig; +class RivSimWellPipesPartMgr; namespace cvf { @@ -95,6 +96,7 @@ protected: caf::PdmPtrField m_intersection; cvf::ref m_flatIntersectionPartMgr; + cvf::ref m_flatSimWellPipePartMgr; cvf::ref m_intersectionVizModel; cvf::ref m_scaleTransform; diff --git a/ApplicationCode/ProjectDataModel/Rim3dView.cpp b/ApplicationCode/ProjectDataModel/Rim3dView.cpp index 8cd8b199cb..926b2f635f 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dView.cpp @@ -49,6 +49,7 @@ #include #include +#include "cvfScene.h" namespace caf { @@ -362,6 +363,26 @@ void Rim3dView::createDisplayModelAndRedraw() RiuMainWindow::instance()->refreshAnimationActions(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dView::removeModelByName(cvf::Scene* scene, const cvf::String& modelName) +{ + std::vector modelsToBeRemoved; + for (cvf::uint i = 0; i < scene->modelCount(); i++) + { + if (scene->model(i)->name() == modelName) + { + modelsToBeRemoved.push_back(scene->model(i)); + } + } + + for (size_t i = 0; i < modelsToBeRemoved.size(); i++) + { + scene->removeModel(modelsToBeRemoved[i]); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Rim3dView.h b/ApplicationCode/ProjectDataModel/Rim3dView.h index 3b12a240e4..d632662cc8 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dView.h +++ b/ApplicationCode/ProjectDataModel/Rim3dView.h @@ -151,6 +151,8 @@ public: virtual RimCase* ownerCase() const = 0; protected: + static void removeModelByName(cvf::Scene* scene, const cvf::String& modelName); + virtual void setDefaultView(); void disableGridBoxField(); void disablePerspectiveProjectionField(); diff --git a/ApplicationCode/ProjectDataModel/RimGridView.cpp b/ApplicationCode/ProjectDataModel/RimGridView.cpp index 1ffa00080c..50bffb09bc 100644 --- a/ApplicationCode/ProjectDataModel/RimGridView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGridView.cpp @@ -264,26 +264,6 @@ Rim3dOverlayInfoConfig* RimGridView::overlayInfoConfig() const return m_overlayInfoConfig; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimGridView::removeModelByName(cvf::Scene* scene, const cvf::String& modelName) -{ - std::vector modelsToBeRemoved; - for (cvf::uint i = 0; i < scene->modelCount(); i++) - { - if (scene->model(i)->name() == modelName) - { - modelsToBeRemoved.push_back(scene->model(i)); - } - } - - for (size_t i = 0; i < modelsToBeRemoved.size(); i++) - { - scene->removeModel(modelsToBeRemoved[i]); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimGridView.h b/ApplicationCode/ProjectDataModel/RimGridView.h index f4fc95f086..75c084dcc5 100644 --- a/ApplicationCode/ProjectDataModel/RimGridView.h +++ b/ApplicationCode/ProjectDataModel/RimGridView.h @@ -47,7 +47,6 @@ public: RimViewLinker* assosiatedViewLinker() const override; protected: - static void removeModelByName(cvf::Scene* scene, const cvf::String& modelName); virtual void onTimeStepChanged() override; virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility, int timeStep) = 0; diff --git a/ApplicationCode/ProjectDataModel/RimIntersection.cpp b/ApplicationCode/ProjectDataModel/RimIntersection.cpp index 7a16add90a..32963d4369 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersection.cpp +++ b/ApplicationCode/ProjectDataModel/RimIntersection.cpp @@ -390,9 +390,9 @@ void RimIntersection::updateAzimuthLine() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector< std::vector > RimIntersection::polyLines(double * horizontalLengthAlongWellToPolylineStart) const +std::vector< std::vector > RimIntersection::polyLines(cvf::Vec3d * flattenedPolylineStartPoint) const { - if (horizontalLengthAlongWellToPolylineStart) *horizontalLengthAlongWellToPolylineStart = 0.0; + if (flattenedPolylineStartPoint) *flattenedPolylineStartPoint = cvf::Vec3d::ZERO; std::vector< std::vector > lines; @@ -455,12 +455,19 @@ std::vector< std::vector > RimIntersection::polyLines(double * hori addExtents(polyLine); } - if (horizontalLengthAlongWellToPolylineStart) + if (flattenedPolylineStartPoint && lines.size() && lines[0].size() > 1) { - *horizontalLengthAlongWellToPolylineStart = horizontalProjectedLengthAlongWellPathToClipPoint - m_extentLength; + (*flattenedPolylineStartPoint)[0] = horizontalProjectedLengthAlongWellPathToClipPoint - m_extentLength; + (*flattenedPolylineStartPoint)[2] = lines[0][1].z(); // Depth of first point in first polyline + } + } + else + { + if ( flattenedPolylineStartPoint && lines.size() && lines[0].size() ) + { + (*flattenedPolylineStartPoint)[2] = lines[0][0].z(); // Depth of first point in first polyline } } - return lines; } @@ -891,6 +898,14 @@ void RimIntersection::setLengthDown(double lengthDown) m_lengthDown = lengthDown; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimIntersection::extentLength() +{ + return m_extentLength(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimIntersection.h b/ApplicationCode/ProjectDataModel/RimIntersection.h index 9459910f44..4da76dfc17 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersection.h +++ b/ApplicationCode/ProjectDataModel/RimIntersection.h @@ -84,7 +84,7 @@ public: caf::PdmField< bool > inputExtrusionPointsFromViewerEnabled; caf::PdmField< bool > inputTwoAzimuthPointsFromViewerEnabled; - std::vector< std::vector > polyLines(double * horizontalLengthAlongWellToPolylineStart = nullptr) const; + std::vector< std::vector > polyLines(cvf::Vec3d * flattenedPolylineStartPoint = nullptr) const; void appendPointToPolyLine(const cvf::Vec3d& point); Rim2dIntersectionView* correspondingIntersectionView(); @@ -100,7 +100,7 @@ public: double lengthDown() const; void setLengthUp(double heightUp); void setLengthDown(double heightDown); - + double extentLength(); void recomputeSimulationWellBranchData(); bool hasDefiningPoints() const;