mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2334 Add visualization of well paths and simulation wells to Intersection Views.
This commit is contained in:
parent
598d2c9b96
commit
bd14c65678
@ -65,6 +65,7 @@ public:
|
||||
cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d> >& polyLines);
|
||||
cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable(const std::vector<std::vector<cvf::Vec3d> >& polyLines);
|
||||
|
||||
const std::vector<std::vector<cvf::Vec3d> >& flattenedOrOffsettedPolyLines() { return m_flattenedOrOffsettedPolyLines; }
|
||||
|
||||
// Mapping between cells and geometry
|
||||
const std::vector<size_t>& triangleToCellIndex() const;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "RigResultAccessor.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
|
||||
#include "Rim2dIntersectionView.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
@ -34,16 +35,23 @@
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
#include "RimTernaryLegendConfig.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "RivHexGridIntersectionTools.h"
|
||||
#include "RivIntersectionGeometryGenerator.h"
|
||||
#include "RivIntersectionSourceInfo.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivPipeGeometryGenerator.h"
|
||||
#include "RivResultToTextureMapper.h"
|
||||
#include "RivScalarMapperUtils.h"
|
||||
#include "RivSimWellPipeSourceInfo.h"
|
||||
#include "RivTernaryScalarMapper.h"
|
||||
#include "RivTernaryTextureCoordsCreator.h"
|
||||
#include "RivWellPathSourceInfo.h"
|
||||
|
||||
#include "RiuGeoMechXfTensorResultAccessor.h"
|
||||
|
||||
@ -58,6 +66,9 @@
|
||||
#include "cvfRenderStateDepth.h"
|
||||
#include "cvfRenderStatePoint.h"
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
#include "cvfTransform.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -65,14 +76,19 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivIntersectionPartMgr::RivIntersectionPartMgr(RimIntersection* rimCrossSection, bool isFlattened)
|
||||
: m_rimCrossSection(rimCrossSection),
|
||||
m_defaultColor(cvf::Color3::WHITE),
|
||||
m_isFlattened(isFlattened)
|
||||
{
|
||||
CVF_ASSERT(m_rimCrossSection);
|
||||
|
||||
m_crossSectionFacesTextureCoords = new cvf::Vec2fArray;
|
||||
|
||||
computeData();
|
||||
std::vector< std::vector <cvf::Vec3d> > polyLines = m_rimCrossSection->polyLines();
|
||||
if (polyLines.size() > 0)
|
||||
{
|
||||
cvf::Vec3d direction = m_rimCrossSection->extrusionDirection();
|
||||
cvf::ref<RivIntersectionHexGridInterface> hexGrid = createHexGridInterface();
|
||||
m_crossSectionGenerator = new RivIntersectionGeometryGenerator(m_rimCrossSection, polyLines, direction, hexGrid.p(), m_isFlattened);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -82,8 +98,26 @@ void RivIntersectionPartMgr::applySingleColorEffect()
|
||||
{
|
||||
if (m_crossSectionGenerator.isNull()) return;
|
||||
|
||||
m_defaultColor = cvf::Color3f::OLIVE;//m_rimCrossSection->CrossSectionColor();
|
||||
this->updatePartEffect();
|
||||
caf::SurfaceEffectGenerator geometryEffgen(cvf::Color3f::OLIVE, caf::PO_1);
|
||||
|
||||
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateCachedEffect();
|
||||
|
||||
if (m_crossSectionFaces.notNull())
|
||||
{
|
||||
m_crossSectionFaces->setEffect(geometryOnlyEffect.p());
|
||||
}
|
||||
|
||||
// Update mesh colors as well, in case of change
|
||||
//RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
||||
|
||||
cvf::ref<cvf::Effect> eff;
|
||||
caf::MeshEffectGenerator CrossSectionEffGen(cvf::Color3::WHITE);//prefs->defaultCrossSectionGridLineColors());
|
||||
eff = CrossSectionEffGen.generateCachedEffect();
|
||||
|
||||
if (m_crossSectionGridLines.notNull())
|
||||
{
|
||||
m_crossSectionGridLines->setEffect(eff.p());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -508,7 +542,7 @@ void RivIntersectionPartMgr::generatePartGeometry()
|
||||
|
||||
createExtrusionDirParts(useBufferObjects);
|
||||
|
||||
updatePartEffect();
|
||||
applySingleColorEffect();
|
||||
}
|
||||
|
||||
|
||||
@ -677,32 +711,158 @@ void RivIntersectionPartMgr::createExtrusionDirParts(bool useBufferObjects)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionPartMgr::updatePartEffect()
|
||||
cvf::ref<cvf::Part> createStdSurfacePart(cvf::DrawableGeo* geometry,
|
||||
const cvf::Color3f& color,
|
||||
cvf::String name,
|
||||
cvf::Object* sourceInfo)
|
||||
{
|
||||
if (m_crossSectionGenerator.isNull()) return;
|
||||
if (!geometry) return nullptr;
|
||||
|
||||
// Set deCrossSection effect
|
||||
caf::SurfaceEffectGenerator geometryEffgen(m_defaultColor, caf::PO_1);
|
||||
|
||||
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateCachedEffect();
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName(name);
|
||||
part->setDrawable(geometry);
|
||||
|
||||
if (m_crossSectionFaces.notNull())
|
||||
caf::SurfaceEffectGenerator surfaceGen(color, caf::PO_1);
|
||||
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
||||
part->setEffect(eff.p());
|
||||
|
||||
part->setSourceInfo(sourceInfo);
|
||||
part->updateBoundingBox();
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Part> createStdLinePart(cvf::DrawableGeo* geometry,
|
||||
const cvf::Color3f& color,
|
||||
cvf::String name)
|
||||
{
|
||||
if ( !geometry ) return nullptr;
|
||||
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName(name);
|
||||
part->setDrawable(geometry);
|
||||
|
||||
caf::MeshEffectGenerator gen(color);
|
||||
cvf::ref<cvf::Effect> eff = gen.generateCachedEffect();
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->updateBoundingBox();
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionPartMgr::appendWellPipePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
{
|
||||
if (m_rimCrossSection.isNull()) return;
|
||||
|
||||
// Get information on how to draw the pipe
|
||||
|
||||
std::function< cvf::ref< cvf::Object > ( size_t ) > createSourceInfoFunc;
|
||||
double pipeRadius = 1;
|
||||
int pipeCrossSectionVxCount = 6;
|
||||
cvf::Color3f wellPipeColor = cvf::Color3f::GRAY;
|
||||
|
||||
if ( m_rimCrossSection->type() == RimIntersection::CS_SIMULATION_WELL )
|
||||
{
|
||||
m_crossSectionFaces->setEffect(geometryOnlyEffect.p());
|
||||
RimSimWellInView * simWellInView = m_rimCrossSection->simulationWell();
|
||||
|
||||
if (!simWellInView) return;
|
||||
|
||||
RimEclipseView* eclView = nullptr;
|
||||
simWellInView->firstAncestorOrThisOfTypeAsserted(eclView);
|
||||
|
||||
pipeRadius = simWellInView->pipeRadius();
|
||||
pipeCrossSectionVxCount = eclView->wellCollection()->pipeCrossSectionVertexCount();
|
||||
wellPipeColor = simWellInView->wellPipeColor();
|
||||
|
||||
createSourceInfoFunc = [&](size_t brIdx) { return new RivSimWellPipeSourceInfo(simWellInView, brIdx); };
|
||||
|
||||
}
|
||||
else if (m_rimCrossSection->type() == RimIntersection::CS_WELL_PATH)
|
||||
{
|
||||
RimWellPath* wellPath = m_rimCrossSection->wellPath();
|
||||
|
||||
if (!wellPath) return;
|
||||
|
||||
RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
|
||||
|
||||
RimGridView* gridView = nullptr;
|
||||
m_rimCrossSection->firstAncestorOrThisOfTypeAsserted(gridView);
|
||||
double cellSize = gridView->ownerCase()->characteristicCellSize();
|
||||
|
||||
RimWellPathCollection* wellPathColl = nullptr;
|
||||
wellPath->firstAncestorOrThisOfTypeAsserted(wellPathColl);
|
||||
|
||||
pipeRadius = wellPath->wellPathRadius(cellSize);
|
||||
pipeCrossSectionVxCount = wellPathColl->wellPathCrossSectionVertexCount();
|
||||
wellPipeColor = wellPath->wellPathColor();
|
||||
|
||||
createSourceInfoFunc = [&](size_t brIdx) { return new RivWellPathSourceInfo(wellPath, m_rimCrossSection->correspondingIntersectionView()); };
|
||||
}
|
||||
|
||||
// Update mesh colors as well, in case of change
|
||||
//RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
||||
// Create pipe geometry
|
||||
|
||||
cvf::ref<cvf::Effect> eff;
|
||||
caf::MeshEffectGenerator CrossSectionEffGen(cvf::Color3::WHITE);//prefs->defaultCrossSectionGridLineColors());
|
||||
eff = CrossSectionEffGen.generateCachedEffect();
|
||||
|
||||
if (m_crossSectionGridLines.notNull())
|
||||
if ( m_rimCrossSection->type() == RimIntersection::CS_SIMULATION_WELL
|
||||
|| m_rimCrossSection->type() == RimIntersection::CS_WELL_PATH )
|
||||
{
|
||||
m_crossSectionGridLines->setEffect(eff.p());
|
||||
}
|
||||
std::vector<std::vector<cvf::Vec3d> > polyLines = m_crossSectionGenerator->flattenedOrOffsettedPolyLines();
|
||||
|
||||
// Remove intersectino extents from the polyline
|
||||
for (auto & polyLine: polyLines)
|
||||
{
|
||||
if ( polyLine.size() > 2 )
|
||||
{
|
||||
polyLine.pop_back();
|
||||
polyLine.erase(polyLine.begin());
|
||||
}
|
||||
}
|
||||
|
||||
m_wellBranches.clear();
|
||||
|
||||
for ( size_t brIdx = 0; brIdx < polyLines.size(); ++brIdx )
|
||||
{
|
||||
cvf::ref<cvf::Object> sourceInfo = createSourceInfoFunc(brIdx);
|
||||
|
||||
m_wellBranches.emplace_back();
|
||||
RivPipeBranchData& pbd = m_wellBranches.back();
|
||||
|
||||
pbd.m_pipeGeomGenerator = new RivPipeGeometryGenerator;
|
||||
pbd.m_pipeGeomGenerator->setRadius(pipeRadius);
|
||||
pbd.m_pipeGeomGenerator->setCrossSectionVertexCount(pipeCrossSectionVxCount);
|
||||
|
||||
cvf::ref<cvf::Vec3dArray> cvfCoords = new cvf::Vec3dArray;
|
||||
cvfCoords->assign(polyLines[brIdx]);
|
||||
|
||||
// Scale the centerline coordinates using the Z-scale transform of the grid.
|
||||
|
||||
for ( size_t cIdx = 0; cIdx < cvfCoords->size(); ++cIdx )
|
||||
{
|
||||
(*cvfCoords)[cIdx].transformPoint(scaleTransform->worldTransform());
|
||||
}
|
||||
|
||||
pbd.m_pipeGeomGenerator->setPipeCenterCoords(cvfCoords.p());
|
||||
auto surfaceDrawable = pbd.m_pipeGeomGenerator->createPipeSurface();
|
||||
auto centerLineDrawable = pbd.m_pipeGeomGenerator->createCenterLine();
|
||||
|
||||
pbd.m_surfacePart = createStdSurfacePart(surfaceDrawable.p(),
|
||||
wellPipeColor,
|
||||
"FlattenedSimWellPipe",
|
||||
sourceInfo.p());
|
||||
|
||||
pbd.m_centerLinePart = createStdLinePart(centerLineDrawable.p(),
|
||||
wellPipeColor,
|
||||
"FlattenedSimWellPipeCenterLine");
|
||||
model->addPart(pbd.m_surfacePart.p());
|
||||
model->addPart(pbd.m_centerLinePart.p());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -800,20 +960,6 @@ const RimIntersection* RivIntersectionPartMgr::intersection() const
|
||||
return m_rimCrossSection.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionPartMgr::computeData()
|
||||
{
|
||||
std::vector< std::vector <cvf::Vec3d> > polyLines = m_rimCrossSection->polyLines();
|
||||
if (polyLines.size() > 0)
|
||||
{
|
||||
cvf::Vec3d direction = m_rimCrossSection->extrusionDirection();
|
||||
cvf::ref<RivIntersectionHexGridInterface> hexGrid = createHexGridInterface();
|
||||
m_crossSectionGenerator = new RivIntersectionGeometryGenerator(m_rimCrossSection, polyLines, direction, hexGrid.p(), m_isFlattened);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "cvfArray.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@ -33,6 +34,7 @@ namespace cvf
|
||||
class Transform;
|
||||
class Part;
|
||||
class ScalarMapper;
|
||||
class DrawableGeo;
|
||||
}
|
||||
|
||||
class RigFemPart;
|
||||
@ -47,7 +49,7 @@ class RivTernaryScalarMapper;
|
||||
class RivIntersectionGeometryGenerator;
|
||||
class RivIntersectionHexGridInterface;
|
||||
class RivIntersectionVertexWeights;
|
||||
|
||||
class RivPipeGeometryGenerator;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -68,17 +70,10 @@ public:
|
||||
void appendNativeCrossSectionFacesToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
|
||||
void appendMeshLinePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
|
||||
void appendPolylinePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
|
||||
|
||||
void appendWellPipePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
|
||||
|
||||
const RimIntersection* intersection() const;
|
||||
|
||||
private:
|
||||
void updatePartEffect();
|
||||
void generatePartGeometry();
|
||||
|
||||
void createPolyLineParts(bool useBufferObjects);
|
||||
void createExtrusionDirParts(bool useBufferObjects);
|
||||
|
||||
void computeData();
|
||||
|
||||
public:
|
||||
static void calculateEclipseTextureCoordinates(cvf::Vec2fArray* textureCoords,
|
||||
@ -110,14 +105,16 @@ public:
|
||||
const cvf::Vec3fArray* triangelVertices,
|
||||
const RigFemResultAddress& resVarAddress,
|
||||
const cvf::ScalarMapper* mapper);
|
||||
|
||||
private:
|
||||
void generatePartGeometry();
|
||||
void createPolyLineParts(bool useBufferObjects);
|
||||
void createExtrusionDirParts(bool useBufferObjects);
|
||||
|
||||
cvf::ref<RivIntersectionHexGridInterface> createHexGridInterface();
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimIntersection> m_rimCrossSection;
|
||||
|
||||
cvf::Color3f m_defaultColor;
|
||||
|
||||
cvf::ref<RivIntersectionGeometryGenerator> m_crossSectionGenerator;
|
||||
cvf::ref<cvf::Part> m_crossSectionFaces;
|
||||
cvf::ref<cvf::Part> m_crossSectionGridLines;
|
||||
@ -129,6 +126,14 @@ private:
|
||||
cvf::ref<cvf::Part> m_highlightLineAlongExtrusionDir;
|
||||
cvf::ref<cvf::Part> m_highlightPointsForExtrusionDir;
|
||||
|
||||
struct RivPipeBranchData
|
||||
{
|
||||
cvf::ref<RivPipeGeometryGenerator> m_pipeGeomGenerator;
|
||||
cvf::ref<cvf::Part> m_surfacePart;
|
||||
cvf::ref<cvf::Part> m_centerLinePart;
|
||||
};
|
||||
std::list<RivPipeBranchData> m_wellBranches;
|
||||
|
||||
bool m_isFlattened;
|
||||
};
|
||||
|
||||
|
@ -265,6 +265,7 @@ void Rim2dIntersectionView::createDisplayModel()
|
||||
m_flatIntersectionPartMgr->appendNativeCrossSectionFacesToModel(m_intersectionVizModel.p(), scaleTransform());
|
||||
m_flatIntersectionPartMgr->appendMeshLinePartsToModel(m_intersectionVizModel.p(), scaleTransform());
|
||||
m_flatIntersectionPartMgr->appendPolylinePartsToModel(m_intersectionVizModel.p(), scaleTransform());
|
||||
m_flatIntersectionPartMgr->appendWellPipePartsToModel(m_intersectionVizModel.p(), scaleTransform());
|
||||
|
||||
m_flatIntersectionPartMgr->applySingleColorEffect();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user