mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2552 Embed pipe visualization of Simulation Wells in intersection views
This commit is contained in:
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -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<std::vector<cvf::Vec3d> > m_polyLines;
|
||||
cvf::Vec3d m_extrusionDirection;
|
||||
bool m_isFlattened;
|
||||
double m_horizontalLengthAlongWellToPolylineStart;
|
||||
cvf::Vec3d m_flattenedPolylineStartPoint;
|
||||
|
||||
// Output arrays
|
||||
cvf::ref<cvf::Vec3fArray> m_triangleVxes;
|
||||
|
||||
@@ -83,9 +83,9 @@ RivIntersectionPartMgr::RivIntersectionPartMgr(RimIntersection* rimCrossSection,
|
||||
|
||||
m_crossSectionFacesTextureCoords = new cvf::Vec2fArray;
|
||||
|
||||
double horizontalLengthAlongWellToPolylineStart;
|
||||
cvf::Vec3d flattenedPolylineStartPoint;
|
||||
|
||||
std::vector< std::vector <cvf::Vec3d> > polyLines = m_rimCrossSection->polyLines(&horizontalLengthAlongWellToPolylineStart);
|
||||
std::vector< std::vector <cvf::Vec3d> > 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<std::vector<cvf::Vec3d> > polyLines = m_crossSectionGenerator->flattenedOrOffsettedPolyLines();
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<caf::DisplayCoordTransform> 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<cvf::Vec3dArray> cvfCoords = new cvf::Vec3dArray;
|
||||
cvfCoords->assign(m_pipeBranchesCLCoords[brIdx]);
|
||||
|
||||
if (m_isFlattened)
|
||||
if (m_intersectionView)
|
||||
{
|
||||
std::vector<cvf::Mat4d> 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<RivPipeBranchData>::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);
|
||||
}
|
||||
|
||||
@@ -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<RimEclipseView> m_rimReservoirView;
|
||||
caf::PdmPointer<RimSimWellInView> m_rimWell;
|
||||
|
||||
cvf::ref<cvf::Transform> m_scaleTransform;
|
||||
bool m_needsTransformUpdate;
|
||||
bool m_isFlattened;
|
||||
Rim3dView* viewWithSettings();
|
||||
void buildWellPipeParts();
|
||||
|
||||
void buildWellPipeParts();
|
||||
caf::PdmPointer<RimSimWellInView> m_rimWell;
|
||||
caf::PdmPointer<Rim2dIntersectionView> m_intersectionView;
|
||||
bool m_isFlattened;
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> m_displayCoordTransform;
|
||||
bool m_needsToRebuildGeometry;
|
||||
|
||||
struct RivPipeBranchData
|
||||
{
|
||||
std::vector <RigWellResultPoint> m_cellIds;
|
||||
std::vector <RigWellResultPoint> m_cellIds;
|
||||
cvf::ref<RivPipeGeometryGenerator> m_pipeGeomGenerator;
|
||||
|
||||
cvf::ref<cvf::Part> m_surfacePart;
|
||||
@@ -77,9 +84,7 @@ private:
|
||||
|
||||
};
|
||||
|
||||
RivPipeBranchData* pipeBranchData(size_t branchIndex);
|
||||
|
||||
std::list<RivPipeBranchData> m_wellBranches;
|
||||
std::list<RivPipeBranchData> m_wellBranches;
|
||||
|
||||
std::vector< std::vector <cvf::Vec3d> > m_pipeBranchesCLCoords;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user