#2621 Improve interface of part managers to prepare for use in 2D intersection views

This commit is contained in:
Magne Sjaastad 2018-03-16 11:21:57 +01:00
parent 08a978d0d7
commit 471d625051
6 changed files with 101 additions and 90 deletions

View File

@ -54,6 +54,7 @@ public:
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
size_t frameIndex, size_t frameIndex,
const caf::DisplayCoordTransform* displayXf); const caf::DisplayCoordTransform* displayXf);
void appendFlattenedDynamicGeometryPartsToModel(cvf::ModelBasicList* model, void appendFlattenedDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
size_t frameIndex, size_t frameIndex,
const caf::DisplayCoordTransform* displayXf, const caf::DisplayCoordTransform* displayXf,

View File

@ -160,6 +160,7 @@ void RivWellPathPartMgr::appendImportedFishbonesToModel(cvf::ModelBasicList* mod
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendPerforationsToModel(cvf::ModelBasicList* model, void RivWellPathPartMgr::appendPerforationsToModel(cvf::ModelBasicList* model,
size_t timeStepIndex,
const caf::DisplayCoordTransform* displayCoordTransform, const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize) double characteristicCellSize)
{ {
@ -172,15 +173,19 @@ void RivWellPathPartMgr::appendPerforationsToModel(cvf::ModelBasicList* model,
if (!wellPathGeometry) return; if (!wellPathGeometry) return;
QDateTime currentTimeStamp; QDateTime currentTimeStamp;
RimEclipseCase* eclipseCase = nullptr; if (m_rimView)
m_rimView->firstAncestorOrThisOfTypeAsserted(eclipseCase);
size_t timeStepIndex = m_rimView->currentTimeStep();
std::vector<QDateTime> timeStamps = eclipseCase->timeStepDates();
if (timeStepIndex < timeStamps.size())
{ {
currentTimeStamp = timeStamps[timeStepIndex]; RimCase* rimCase = nullptr;
m_rimView->firstAncestorOrThisOfType(rimCase);
if (rimCase)
{
std::vector<QDateTime> timeStamps = rimCase->timeStepDates();
if (timeStepIndex < timeStamps.size())
{
currentTimeStamp = timeStamps[timeStepIndex];
}
}
} }
// Since we're using the index of measured depths to find the index of a point, ensure they're equal // Since we're using the index of measured depths to find the index of a point, ensure they're equal
@ -197,7 +202,7 @@ void RivWellPathPartMgr::appendPerforationsToModel(cvf::ModelBasicList* model,
if (!perforation->isChecked()) continue; if (!perforation->isChecked()) continue;
if (perforation->startMD() > perforation->endMD()) continue; if (perforation->startMD() > perforation->endMD()) continue;
if (currentTimeStamp.isValid() && !perforation->isActiveOnDate(currentTimeStamp)) continue; if (!perforation->isActiveOnDate(currentTimeStamp)) continue;
using namespace std; using namespace std;
pair<vector<cvf::Vec3d>, vector<double> > displayCoordsAndMD = wellPathGeometry->clippedPointSubset(perforation->startMD(), pair<vector<cvf::Vec3d>, vector<double> > displayCoordsAndMD = wellPathGeometry->clippedPointSubset(perforation->startMD(),
@ -223,6 +228,7 @@ void RivWellPathPartMgr::appendPerforationsToModel(cvf::ModelBasicList* model,
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendVirtualTransmissibilitiesToModel(cvf::ModelBasicList* model, void RivWellPathPartMgr::appendVirtualTransmissibilitiesToModel(cvf::ModelBasicList* model,
size_t timeStepIndex,
const caf::DisplayCoordTransform* displayCoordTransform, const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize) double characteristicCellSize)
{ {
@ -240,8 +246,6 @@ void RivWellPathPartMgr::appendVirtualTransmissibilitiesToModel(cvf::ModelBasicL
{ {
m_wellConnectionFactorPartMgr = new RivWellConnectionFactorPartMgr(m_rimWellPath, eclView->virtualPerforationResult()); m_wellConnectionFactorPartMgr = new RivWellConnectionFactorPartMgr(m_rimWellPath, eclView->virtualPerforationResult());
size_t timeStepIndex = m_rimView->currentTimeStep();
m_wellConnectionFactorPartMgr->appendDynamicGeometryPartsToModel(model, timeStepIndex); m_wellConnectionFactorPartMgr->appendDynamicGeometryPartsToModel(model, timeStepIndex);
} }
} }
@ -401,10 +405,10 @@ void RivWellPathPartMgr::buildWellPathParts(const caf::DisplayCoordTransform* di
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize, const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox, double characteristicCellSize,
const caf::DisplayCoordTransform* displayCoordTransform) const cvf::BoundingBox& wellPathClipBoundingBox)
{ {
RimWellPathCollection* wellPathCollection = this->wellPathCollection(); RimWellPathCollection* wellPathCollection = this->wellPathCollection();
if (!wellPathCollection) return; if (!wellPathCollection) return;
@ -440,10 +444,11 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize, size_t timeStepIndex,
const cvf::BoundingBox& wellPathClipBoundingBox, const caf::DisplayCoordTransform* displayCoordTransform,
const caf::DisplayCoordTransform* displayCoordTransform) double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox)
{ {
CVF_ASSERT(model); CVF_ASSERT(model);
@ -458,8 +463,8 @@ void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList*
if (wellPathCollection->wellPathVisibility() != RimWellPathCollection::FORCE_ALL_ON && m_rimWellPath->showWellPath() == false) if (wellPathCollection->wellPathVisibility() != RimWellPathCollection::FORCE_ALL_ON && m_rimWellPath->showWellPath() == false)
return; return;
appendPerforationsToModel(model, displayCoordTransform, characteristicCellSize); appendPerforationsToModel(model, timeStepIndex, displayCoordTransform, characteristicCellSize);
appendVirtualTransmissibilitiesToModel(model, displayCoordTransform, characteristicCellSize); appendVirtualTransmissibilitiesToModel(model, timeStepIndex, displayCoordTransform, characteristicCellSize);
m_3dWellLogCurvePartMgr = new Riv3dWellLogPlanePartMgr(m_rimWellPath->wellPathGeometry()); m_3dWellLogCurvePartMgr = new Riv3dWellLogPlanePartMgr(m_rimWellPath->wellPathGeometry());
m_3dWellLogCurvePartMgr->append3dWellLogCurvesToModel(model, displayCoordTransform, m_rimWellPath->vectorOf3dWellLogCurves()); m_3dWellLogCurvePartMgr->append3dWellLogCurvesToModel(model, displayCoordTransform, m_rimWellPath->vectorOf3dWellLogCurves());

View File

@ -59,41 +59,45 @@ public:
explicit RivWellPathPartMgr(RimWellPath* wellPath, Rim3dView* view); explicit RivWellPathPartMgr(RimWellPath* wellPath, Rim3dView* view);
~RivWellPathPartMgr(); ~RivWellPathPartMgr();
void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize, const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox, double characteristicCellSize,
const caf::DisplayCoordTransform* displayCoordTransform); const cvf::BoundingBox& wellPathClipBoundingBox);
void appendStaticFracturePartsToModel(cvf::ModelBasicList* model);
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize, size_t timeStepIndex,
const cvf::BoundingBox& wellPathClipBoundingBox, const caf::DisplayCoordTransform* displayCoordTransform,
const caf::DisplayCoordTransform* displayCoordTransform); double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox);
void appendStaticFracturePartsToModel(cvf::ModelBasicList* model);
size_t segmentIndexFromTriangleIndex(size_t triangleIndex); size_t segmentIndexFromTriangleIndex(size_t triangleIndex);
private: private:
void appendFishboneSubsPartsToModel(cvf::ModelBasicList* model, void appendFishboneSubsPartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform, const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize); double characteristicCellSize);
void appendImportedFishbonesToModel(cvf::ModelBasicList* model, void appendImportedFishbonesToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform, const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize); double characteristicCellSize);
void appendPerforationsToModel(cvf::ModelBasicList* model, void appendPerforationsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform, size_t timeStepIndex,
double characteristicCellSize); const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize);
void appendVirtualTransmissibilitiesToModel(cvf::ModelBasicList* model, void appendVirtualTransmissibilitiesToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform, size_t timeStepIndex,
double characteristicCellSize); const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize);
void buildWellPathParts(const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox);
void buildWellPathParts(const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox);
void clearAllBranchData(); void clearAllBranchData();
inline RimWellPathCollection* wellPathCollection(); inline RimWellPathCollection* wellPathCollection();

View File

@ -30,7 +30,10 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RivWellPathsPartMgr::RivWellPathsPartMgr(Rim3dView* view) : m_rimView(view) {} RivWellPathsPartMgr::RivWellPathsPartMgr(Rim3dView* view)
: m_rimView(view)
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -40,10 +43,10 @@ RivWellPathsPartMgr::~RivWellPathsPartMgr() {}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivWellPathsPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, void RivWellPathsPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize, const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox, double characteristicCellSize,
const caf::DisplayCoordTransform* displayCoordTransform) const cvf::BoundingBox& wellPathClipBoundingBox)
{ {
if (!isWellPathVisible()) return; if (!isWellPathVisible()) return;
@ -51,7 +54,7 @@ void RivWellPathsPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList*
for (auto& partMgr : m_wellPatshsPartMgrs) for (auto& partMgr : m_wellPatshsPartMgrs)
{ {
partMgr->appendStaticGeometryPartsToModel(model, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform); partMgr->appendStaticGeometryPartsToModel(model, displayCoordTransform, characteristicCellSize, wellPathClipBoundingBox);
} }
} }
@ -73,10 +76,11 @@ void RivWellPathsPartMgr::appendStaticFracturePartsToModel(cvf::ModelBasicList*
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivWellPathsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, void RivWellPathsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
size_t timeStepIndex,
const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize, double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox, const cvf::BoundingBox& wellPathClipBoundingBox)
const caf::DisplayCoordTransform* displayCoordTransform)
{ {
if (!isWellPathVisible()) return; if (!isWellPathVisible()) return;
@ -84,10 +88,8 @@ void RivWellPathsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList*
for (auto& partMgr : m_wellPatshsPartMgrs) for (auto& partMgr : m_wellPatshsPartMgrs)
{ {
partMgr->appendDynamicGeometryPartsToModel(model, partMgr->appendDynamicGeometryPartsToModel(
characteristicCellSize, model, timeStepIndex, displayCoordTransform, characteristicCellSize, wellPathClipBoundingBox);
wellPathClipBoundingBox,
displayCoordTransform);
} }
} }
@ -148,7 +150,7 @@ RimWellPathCollection* RivWellPathsPartMgr::wellPathCollection() const
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RivWellPathsPartMgr::isWellPathVisible() const bool RivWellPathsPartMgr::isWellPathVisible() const
{ {

View File

@ -1,24 +1,23 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2018 Statoil ASA // Copyright (C) 2018 Statoil ASA
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or // WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. // FITNESS FOR A PARTICULAR PURPOSE.
// //
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> // See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#pragma once #pragma once
#include "cvfBase.h" #include "cvfBase.h"
#include "cvfCollection.h" #include "cvfCollection.h"
#include "cvfObject.h" #include "cvfObject.h"
@ -29,17 +28,16 @@
#include <map> #include <map>
namespace cvf namespace cvf
{ {
class BoundingBox; class BoundingBox;
class Transform; class Transform;
class ModelBasicList; class ModelBasicList;
} } // namespace cvf
namespace caf namespace caf
{ {
class DisplayCoordTransform; class DisplayCoordTransform;
} }
class Rim3dView; class Rim3dView;
@ -48,7 +46,7 @@ class RimWellPathCollection;
class RimWellPath; class RimWellPath;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
class RivWellPathsPartMgr : public cvf::Object class RivWellPathsPartMgr : public cvf::Object
{ {
@ -56,29 +54,28 @@ public:
explicit RivWellPathsPartMgr(Rim3dView* view); explicit RivWellPathsPartMgr(Rim3dView* view);
~RivWellPathsPartMgr(); ~RivWellPathsPartMgr();
void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize, const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox, double characteristicCellSize,
const caf::DisplayCoordTransform* displayCoordTransform); const cvf::BoundingBox& wellPathClipBoundingBox);
void appendStaticFracturePartsToModel(cvf::ModelBasicList* model);
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
const caf::DisplayCoordTransform* displayCoordTransform);
size_t segmentIndexFromTriangleIndex(size_t triangleIndex, RimWellPath* wellPath) const;
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
size_t timeStepIndex,
const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox);
void appendStaticFracturePartsToModel(cvf::ModelBasicList* model);
size_t segmentIndexFromTriangleIndex(size_t triangleIndex, RimWellPath* wellPath) const;
private: private:
void clearGeometryCache(); void clearGeometryCache();
void scheduleGeometryRegen(); void scheduleGeometryRegen();
void createPartManagersIfRequired(); void createPartManagersIfRequired();
RimWellPathCollection* wellPathCollection() const; RimWellPathCollection* wellPathCollection() const;
bool isWellPathVisible() const; bool isWellPathVisible() const;
private: private:
caf::PdmPointer<Rim3dView> m_rimView; caf::PdmPointer<Rim3dView> m_rimView;

View File

@ -665,9 +665,9 @@ void Rim3dView::addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList,
cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform(); cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform();
m_wellPathsPartManager->appendStaticGeometryPartsToModel(wellPathModelBasicList, m_wellPathsPartManager->appendStaticGeometryPartsToModel(wellPathModelBasicList,
transForm.p(),
this->ownerCase()->characteristicCellSize(), this->ownerCase()->characteristicCellSize(),
wellPathClipBoundingBox, wellPathClipBoundingBox);
transForm.p());
wellPathModelBasicList->updateBoundingBoxesRecursive(); wellPathModelBasicList->updateBoundingBoxesRecursive();
} }
@ -681,10 +681,12 @@ void Rim3dView::addDynamicWellPathsToModel(cvf::ModelBasicList* wellPathModelBas
cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform(); cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform();
size_t timeStepIndex = currentTimeStep();
m_wellPathsPartManager->appendDynamicGeometryPartsToModel(wellPathModelBasicList, m_wellPathsPartManager->appendDynamicGeometryPartsToModel(wellPathModelBasicList,
timeStepIndex,
transForm.p(),
this->ownerCase()->characteristicCellSize(), this->ownerCase()->characteristicCellSize(),
wellPathClipBoundingBox, wellPathClipBoundingBox);
transForm.p());
wellPathModelBasicList->updateBoundingBoxesRecursive(); wellPathModelBasicList->updateBoundingBoxesRecursive();
} }