#1127 Now possible to select well by clicking on well head geometry

This commit is contained in:
Magne Sjaastad 2017-01-17 14:18:03 +01:00
parent a91636ac8b
commit c11daf88fa
2 changed files with 47 additions and 15 deletions

View File

@ -84,7 +84,7 @@ RivWellHeadPartMgr::~RivWellHeadPartMgr()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex) void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
{ {
m_wellHeadParts.clear(); clearAllGeometry();
if (m_rimReservoirView.isNull()) return; if (m_rimReservoirView.isNull()) return;
@ -191,7 +191,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
part->setEffect(eff.p()); part->setEffect(eff.p());
part->setSourceInfo(sourceInfo.p()); part->setSourceInfo(sourceInfo.p());
m_wellHeadParts.push_back(part.p()); m_wellHeadPipeSurfacePart = part;
} }
if (centerLineDrawable.notNull()) if (centerLineDrawable.notNull())
@ -206,7 +206,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
part->setEffect(eff.p()); part->setEffect(eff.p());
part->setSourceInfo(sourceInfo.p()); part->setSourceInfo(sourceInfo.p());
m_wellHeadParts.push_back(part.p()); m_wellHeadPipeCenterPart = part;
} }
} }
@ -289,7 +289,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
part->setEffect(eff.p()); part->setEffect(eff.p());
part->setSourceInfo(sourceInfo.p()); part->setSourceInfo(sourceInfo.p());
m_wellHeadParts.push_back(part.p()); m_wellHeadArrowPart = part;
} }
if (m_rimReservoirView->wellCollection()->showWellLabel() && well->showWellLabel() && !well->name().isEmpty()) if (m_rimReservoirView->wellCollection()->showWellLabel() && well->showWellLabel() && !well->name().isEmpty())
@ -319,26 +319,54 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
part->setPriority(11); part->setPriority(11);
part->setSourceInfo(sourceInfo.p()); part->setSourceInfo(sourceInfo.p());
m_wellHeadParts.push_back(part.p()); m_wellHeadLabelPart = part;
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellHeadPartMgr::clearAllGeometry()
{
m_wellHeadArrowPart = nullptr;
m_wellHeadLabelPart = nullptr;
m_wellHeadPipeCenterPart = nullptr;
m_wellHeadPipeSurfacePart = nullptr;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivWellHeadPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex) void RivWellHeadPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
{ {
if (m_rimWell.isNull()) return;
if (m_rimReservoirView.isNull()) return; if (m_rimReservoirView.isNull()) return;
if (m_rimReservoirView->wellCollection()->showWellHead() == false) return; if (m_rimWell.isNull()) return;
RimEclipseWellCollection* wellCollection = nullptr;
m_rimWell->firstAncestorOrThisOfType(wellCollection);
if (!wellCollection) return;
if (!m_rimWell->isWellPipeVisible(frameIndex)) return; if (!m_rimWell->isWellPipeVisible(frameIndex)) return;
buildWellHeadParts(frameIndex); buildWellHeadParts(frameIndex);
size_t i; // Always add pipe part of well head
for (i = 0; i < m_wellHeadParts.size(); i++) if (m_wellHeadPipeCenterPart.notNull()) model->addPart(m_wellHeadPipeCenterPart.p());
if (m_wellHeadPipeSurfacePart.notNull()) model->addPart(m_wellHeadPipeSurfacePart.p());
if (wellCollection->showWellLabel() &&
m_rimWell->showWellLabel() &&
m_wellHeadLabelPart.notNull())
{ {
model->addPart(m_wellHeadParts.at(i)); model->addPart(m_wellHeadLabelPart.p());
}
if (wellCollection->showWellHead() &&
m_wellHeadArrowPart.notNull())
{
model->addPart(m_wellHeadArrowPart.p());
} }
} }

View File

@ -22,7 +22,6 @@
#include "cvfAssert.h" #include "cvfAssert.h"
#include "cvfObject.h" #include "cvfObject.h"
#include "cafPdmPointer.h" #include "cafPdmPointer.h"
#include "cvfCollection.h"
namespace cvf namespace cvf
{ {
@ -48,12 +47,17 @@ public:
private: private:
void buildWellHeadParts(size_t frameIndex); void buildWellHeadParts(size_t frameIndex);
void clearAllGeometry();
private: private:
caf::PdmPointer<RimEclipseView> m_rimReservoirView; caf::PdmPointer<RimEclipseView> m_rimReservoirView;
caf::PdmPointer<RimEclipseWell> m_rimWell; caf::PdmPointer<RimEclipseWell> m_rimWell;
cvf::ref<cvf::Transform> m_scaleTransform; cvf::ref<cvf::Transform> m_scaleTransform;
cvf::Collection< cvf::Part > m_wellHeadParts;
cvf::ref< cvf::Part > m_wellHeadArrowPart;
cvf::ref< cvf::Part > m_wellHeadLabelPart;
cvf::ref< cvf::Part > m_wellHeadPipeSurfacePart;
cvf::ref< cvf::Part > m_wellHeadPipeCenterPart;
}; };