#2552 Add well head visualization. Not yet working for multiple branches

This commit is contained in:
Jacob Støren 2018-03-14 14:43:02 +01:00
parent 1861255281
commit bb28cf3f09
3 changed files with 62 additions and 12 deletions

View File

@ -50,6 +50,7 @@
#include "cvfTransform.h" #include "cvfTransform.h"
#include "cvfqtUtils.h" #include "cvfqtUtils.h"
#include "cafDisplayCoordTransform.h" #include "cafDisplayCoordTransform.h"
#include "RivSectionFlattner.h"
@ -73,7 +74,8 @@ RivWellHeadPartMgr::~RivWellHeadPartMgr()
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex, void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex,
const caf::DisplayCoordTransform * displayXf) const caf::DisplayCoordTransform * displayXf,
bool doFlatten)
{ {
clearAllGeometry(); clearAllGeometry();
@ -88,9 +90,22 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex,
{ {
well->wellHeadTopBottomPosition(static_cast<int>(frameIndex), &whEndPos, &whStartPos); well->wellHeadTopBottomPosition(static_cast<int>(frameIndex), &whEndPos, &whStartPos);
whEndPos = displayXf->transformToDisplayCoord(whEndPos); if (doFlatten)
whStartPos = displayXf->transformToDisplayCoord(whStartPos); {
whEndPos.z() += characteristicCellSize; whEndPos.x() = 0.0;
whEndPos.y() = 0.0;
whStartPos.x() = 0.0;
whStartPos.y() = 0.0;
whEndPos = displayXf->scaleToDisplaySize(whEndPos);
whStartPos = displayXf->scaleToDisplaySize(whStartPos);
whEndPos.z() += characteristicCellSize;
}
else
{
whEndPos = displayXf->transformToDisplayCoord(whEndPos);
whStartPos = displayXf->transformToDisplayCoord(whStartPos);
whEndPos.z() += characteristicCellSize;
}
} }
if (!well->simWellData()->hasWellResult(frameIndex)) return; if (!well->simWellData()->hasWellResult(frameIndex)) return;
@ -162,6 +177,8 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex,
part->setSourceInfo(sourceInfo.p()); part->setSourceInfo(sourceInfo.p());
m_wellHeadPipeCenterPart = part; m_wellHeadPipeCenterPart = part;
part->updateBoundingBox();
CVF_ASSERT(part->boundingBox().isValid());
} }
} }
@ -330,7 +347,38 @@ void RivWellHeadPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList*
if (!m_rimWell->isWellPipeVisible(frameIndex)) return; if (!m_rimWell->isWellPipeVisible(frameIndex)) return;
buildWellHeadParts(frameIndex, displayXf); buildWellHeadParts(frameIndex, displayXf, false);
// Always add pipe part of well head
if (m_wellHeadPipeCenterPart.notNull()) model->addPart(m_wellHeadPipeCenterPart.p());
if (m_wellHeadPipeSurfacePart.notNull()) model->addPart(m_wellHeadPipeSurfacePart.p());
if (m_rimWell->showWellLabel() &&
m_wellHeadLabelPart.notNull())
{
model->addPart(m_wellHeadLabelPart.p());
}
if (m_rimWell->showWellHead() &&
m_wellHeadArrowPart.notNull())
{
model->addPart(m_wellHeadArrowPart.p());
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellHeadPartMgr::appendFlattenedDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
size_t frameIndex,
const caf::DisplayCoordTransform * displayXf)
{
if (m_rimWell.isNull()) return;
if (!viewWithSettings()) return;
if (!m_rimWell->isWellPipeVisible(frameIndex)) return;
buildWellHeadParts(frameIndex, displayXf, true);
// Always add pipe part of well head // Always add pipe part of well head
if (m_wellHeadPipeCenterPart.notNull()) model->addPart(m_wellHeadPipeCenterPart.p()); if (m_wellHeadPipeCenterPart.notNull()) model->addPart(m_wellHeadPipeCenterPart.p());

View File

@ -48,11 +48,16 @@ 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,
size_t frameIndex,
const caf::DisplayCoordTransform * displayXf);
private: private:
void buildWellHeadParts(size_t frameIndex, void buildWellHeadParts(size_t frameIndex,
const caf::DisplayCoordTransform * displayXf); const caf::DisplayCoordTransform * displayXf,
bool doFlatten);
void clearAllGeometry(); void clearAllGeometry();
Rim3dView* viewWithSettings(); Rim3dView* viewWithSettings();
RimSimWellInViewCollection* simWellInViewCollection(); RimSimWellInViewCollection* simWellInViewCollection();

View File

@ -482,15 +482,12 @@ void Rim2dIntersectionView::updateCurrentTimeStep()
m_intersection->extentLength(), m_intersection->extentLength(),
m_intersection->branchIndex()); m_intersection->branchIndex());
m_flatWellHeadPartMgr->appendFlattenedDynamicGeometryPartsToModel(simWellModelBasicList.p(),
m_currentTimeStep,
this->displayCoordTransform().p());
simWellModelBasicList->updateBoundingBoxesRecursive(); simWellModelBasicList->updateBoundingBoxesRecursive();
frameScene->addModel(simWellModelBasicList.p()); frameScene->addModel(simWellModelBasicList.p());
m_flatSimWellPipePartMgr->updatePipeResultColor(m_currentTimeStep); m_flatSimWellPipePartMgr->updatePipeResultColor(m_currentTimeStep);
//m_flatWellHeadPartMgr->appendDynamicGeometryPartsToModel(simWellModelBasicList.p(),
// m_currentTimeStep,
// this->displayCoordTransform().p());
//
} }
} }
} }