#2481, #2605, #2486 Use a flattened version of the normal wellpath visualization in 2D intersection view

This commit is contained in:
Jacob Støren
2018-03-20 13:12:20 +01:00
parent 0de43ac938
commit a9daea0938
10 changed files with 360 additions and 200 deletions

View File

@@ -17,19 +17,9 @@
/////////////////////////////////////////////////////////////////////////////////
#include "Rim2dIntersectionView.h"
#include "Rim2dIntersectionViewCollection.h"
#include "RimIntersection.h"
#include "RimCase.h"
#include "RiuViewer.h"
#include "RimIntersection.h"
#include "RimGridView.h"
#include "RivIntersectionPartMgr.h"
#include "RivTernarySaturationOverlayItem.h"
#include "cvfPart.h"
#include "cvfModelBasicList.h"
#include "cvfTransform.h"
#include "cvfScene.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimEclipseView.h"
#include "RimEclipseCellColors.h"
@@ -40,10 +30,22 @@
#include "RimSimWellInView.h"
#include "RimWellPath.h"
#include <QDateTime>
#include "cafDisplayCoordTransform.h"
#include "RiuViewer.h"
#include "RivIntersectionPartMgr.h"
#include "RivTernarySaturationOverlayItem.h"
#include "RivSimWellPipesPartMgr.h"
#include "RivWellHeadPartMgr.h"
#include "RivWellPathPartMgr.h"
#include "cafDisplayCoordTransform.h"
#include "cvfModelBasicList.h"
#include "cvfTransform.h"
#include "cvfScene.h"
#include "cvfPart.h"
#include <QDateTime>
CAF_PDM_SOURCE_INIT(Rim2dIntersectionView, "Intersection2dView");
@@ -292,6 +294,14 @@ void Rim2dIntersectionView::update3dInfo()
m_viewer->update();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<RivIntersectionPartMgr> Rim2dIntersectionView::flatIntersectionPartMgr() const
{
return m_flatIntersectionPartMgr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -395,6 +405,7 @@ void Rim2dIntersectionView::createDisplayModel()
m_flatIntersectionPartMgr = new RivIntersectionPartMgr(m_intersection(), true);
m_intersectionVizModel->removeAllParts();
m_flatIntersectionPartMgr->appendNativeCrossSectionFacesToModel(m_intersectionVizModel.p(), scaleTransform());
@@ -420,6 +431,22 @@ void Rim2dIntersectionView::createDisplayModel()
}
}
m_flatWellpathPartMgr = nullptr;
if ( m_intersection->type() == RimIntersection::CS_WELL_PATH
&& m_intersection->wellPath() )
{
Rim3dView* settingsView = nullptr;
m_intersection->firstAncestorOrThisOfType(settingsView);
if ( settingsView )
{
m_flatWellpathPartMgr = new RivWellPathPartMgr(m_intersection->wellPath(), settingsView);
m_flatWellpathPartMgr->appendFlattenedStaticGeometryPartsToModel(m_intersectionVizModel.p(),
this->displayCoordTransform().p(),
this->ownerCase()->characteristicCellSize(),
this->ownerCase()->activeCellsBoundingBox());
}
}
m_viewer->addStaticModelOnce(m_intersectionVizModel.p());
m_intersectionVizModel->updateBoundingBoxesRecursive();
@@ -436,26 +463,6 @@ void Rim2dIntersectionView::createDisplayModel()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim2dIntersectionView::createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim2dIntersectionView::onTimeStepChanged()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim2dIntersectionView::clampCurrentTimestep()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -579,6 +586,26 @@ void Rim2dIntersectionView::resetLegendsInViewer()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim2dIntersectionView::createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim2dIntersectionView::onTimeStepChanged()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim2dIntersectionView::clampCurrentTimestep()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -19,7 +19,6 @@
#pragma once
#include "Rim3dView.h"
#include "RivIntersectionPartMgr.h"
#include "cafPdmPtrField.h"
class RimIntersection;
@@ -27,6 +26,8 @@ class RimLegendConfig;
class RimTernaryLegendConfig;
class RivSimWellPipesPartMgr;
class RivWellHeadPartMgr;
class RivWellPathPartMgr;
class RivIntersectionPartMgr;
namespace cvf
{
@@ -60,7 +61,7 @@ public:
void update3dInfo();
cvf::ref<RivIntersectionPartMgr> flatIntersectionPartMgr() const { return m_flatIntersectionPartMgr; }
cvf::ref<RivIntersectionPartMgr> flatIntersectionPartMgr() const;
virtual cvf::ref<caf::DisplayCoordTransform> displayCoordTransform() const override;
@@ -99,6 +100,7 @@ protected:
cvf::ref<RivIntersectionPartMgr> m_flatIntersectionPartMgr;
cvf::ref<RivSimWellPipesPartMgr> m_flatSimWellPipePartMgr;
cvf::ref<RivWellHeadPartMgr> m_flatWellHeadPartMgr;
cvf::ref<RivWellPathPartMgr> m_flatWellpathPartMgr;
cvf::ref<cvf::ModelBasicList> m_intersectionVizModel;
cvf::ref<cvf::Transform> m_scaleTransform;

View File

@@ -403,7 +403,14 @@ std::vector< std::vector <cvf::Vec3d> > RimIntersection::polyLines(cvf::Vec3d *
if (wellPath() && wellPath->wellPathGeometry() )
{
lines.push_back(wellPath->wellPathGeometry()->m_wellPathPoints);
clipToReservoir(lines[0], &horizontalProjectedLengthAlongWellPathToClipPoint);
RimCase* ownerCase = nullptr;
this->firstAncestorOrThisOfType(ownerCase);
if (ownerCase)
{
lines[0] = RigWellPath::clipPolylineStartAboveZ(lines[0],
ownerCase->activeCellsBoundingBox().max().z(),
&horizontalProjectedLengthAlongWellPathToClipPoint);
}
}
}
else if (type == CS_SIMULATION_WELL)
@@ -605,65 +612,6 @@ void RimIntersection::updateName()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersection::clipToReservoir(std::vector<cvf::Vec3d> &polyLine, double * horizontalLengthAlongWellToClipPoint) const
{
CVF_ASSERT(horizontalLengthAlongWellToClipPoint != nullptr);
*horizontalLengthAlongWellToClipPoint = 0.0;
RimCase* ownerCase = nullptr;
firstAncestorOrThisOfType(ownerCase);
std::vector<cvf::Vec3d> clippedPolyLine;
if (ownerCase)
{
cvf::BoundingBox caseBB = ownerCase->activeCellsBoundingBox();
bool hasEnteredReservoirBB = false;
for (size_t vxIdx = 0 ; vxIdx < polyLine.size(); ++vxIdx)
{
if (!caseBB.contains(polyLine[vxIdx]))
{
if (vxIdx > 0)
{
cvf::Vec3d segment = polyLine[vxIdx] - polyLine[vxIdx-1];
segment[2] = 0.0;
*horizontalLengthAlongWellToClipPoint += segment.length();
}
continue;
}
if (!hasEnteredReservoirBB)
{
if (vxIdx > 0)
{
// clip line, and add vx to start
cvf::Plane topPlane;
topPlane.setFromPointAndNormal(caseBB.max(), cvf::Vec3d::Z_AXIS);
cvf::Vec3d intersection;
if (topPlane.intersect(polyLine[vxIdx-1], polyLine[vxIdx], &intersection))
{
cvf::Vec3d segment = intersection - polyLine[vxIdx-1];
segment[2] = 0.0;
*horizontalLengthAlongWellToClipPoint += segment.length();
clippedPolyLine.push_back(intersection);
}
}
hasEnteredReservoirBB = true;
}
clippedPolyLine.push_back(polyLine[vxIdx]);
}
}
polyLine.swap(clippedPolyLine);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -139,7 +139,6 @@ private:
void updateSimulationWellCenterline() const;
void updateWellExtentDefaultValue();
void addExtents(std::vector<cvf::Vec3d> &polyLine) const;
void clipToReservoir(std::vector<cvf::Vec3d> &polyLinee, double * horizontalLengthAlongWellToClipPoint) const;
void updateName();
void rebuildGeometryAndScheduleCreateDisplayModel();
static double azimuthInRadians(cvf::Vec3d vec);