Toggle on off visibility of wells in well collection

p4#: 21419
This commit is contained in:
Magne Sjaastad 2013-04-25 09:07:29 +02:00
parent 9c8c12955b
commit 8fc9d06edb
3 changed files with 26 additions and 11 deletions

View File

@ -91,10 +91,12 @@ void RivReservoirPipesPartMgr::setScaleTransform(cvf::Transform * scaleTransform
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex) void RivReservoirPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
{ {
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimWellCollection::PIPES_FORCE_ALL_OFF) return; if (!m_reservoirView->wellCollection()->showWells() ) return;
if (m_reservoirView->wellCollection()->wells.size() != m_wellPipesPartMgrs.size()) if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimWellCollection::PIPES_FORCE_ALL_OFF) return;
{
if (m_reservoirView->wellCollection()->wells.size() != m_wellPipesPartMgrs.size())
{
clearGeometryCache(); clearGeometryCache();
for (size_t i = 0; i < m_reservoirView->wellCollection()->wells.size(); ++i) for (size_t i = 0; i < m_reservoirView->wellCollection()->wells.size(); ++i)
@ -107,13 +109,13 @@ void RivReservoirPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasic
m_wellHeadPartMgrs.push_back(wellHeadMgr); m_wellHeadPartMgrs.push_back(wellHeadMgr);
wellHeadMgr->setScaleTransform(m_scaleTransform.p()); wellHeadMgr->setScaleTransform(m_scaleTransform.p());
} }
} }
for (size_t wIdx = 0; wIdx != m_wellPipesPartMgrs.size(); ++ wIdx) for (size_t wIdx = 0; wIdx != m_wellPipesPartMgrs.size(); ++ wIdx)
{ {
m_wellPipesPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex); m_wellPipesPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex);
m_wellHeadPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex); m_wellHeadPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex);
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -73,6 +73,9 @@ RimWellCollection::RimWellCollection()
{ {
CAF_PDM_InitObject("Wells", ":/WellCollection.png", "", ""); CAF_PDM_InitObject("Wells", ":/WellCollection.png", "", "");
CAF_PDM_InitField(&showWells, "ShowWells", true, "Show well", "", "", "");
showWells.setUiHidden(true);
CAF_PDM_InitField(&showWellHead, "ShowWellHead", true, "Show well heads", "", "", ""); CAF_PDM_InitField(&showWellHead, "ShowWellHead", true, "Show well heads", "", "", "");
CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well labels", "", "", ""); CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well labels", "", "", "");
CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScale", 1.0, "Well head scale", "", "", ""); CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScale", 1.0, "Well head scale", "", "", "");
@ -158,6 +161,7 @@ bool RimWellCollection::hasVisibleWellCells()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellCollection::hasVisibleWellPipes() bool RimWellCollection::hasVisibleWellPipes()
{ {
if (!this->showWells()) return false;
if (this->wellPipeVisibility() == PIPES_FORCE_ALL_OFF) return false; if (this->wellPipeVisibility() == PIPES_FORCE_ALL_OFF) return false;
if (this->wells().size() == 0 ) return false; if (this->wells().size() == 0 ) return false;
if (this->wellPipeVisibility() == PIPES_FORCE_ALL_ON) return true; if (this->wellPipeVisibility() == PIPES_FORCE_ALL_ON) return true;
@ -171,7 +175,7 @@ bool RimWellCollection::hasVisibleWellPipes()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) void RimWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{ {
if (&showWellLabel == changedField) if (&showWellLabel == changedField || &showWells == changedField)
{ {
if (m_reservoirView) if (m_reservoirView)
{ {
@ -261,3 +265,11 @@ void RimWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
advancedGroup->add(&wellCellTransparencyLevel); advancedGroup->add(&wellCellTransparencyLevel);
advancedGroup->add(&isAutoDetectingBranches); advancedGroup->add(&isAutoDetectingBranches);
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimWellCollection::objectToggleField()
{
return &showWells;
}

View File

@ -68,6 +68,7 @@ public:
typedef caf::AppEnum<RimWellCollection::WellFenceType> WellFenceEnum; typedef caf::AppEnum<RimWellCollection::WellFenceType> WellFenceEnum;
caf::PdmField<bool> showWellLabel; caf::PdmField<bool> showWellLabel;
caf::PdmField<bool> showWells;
caf::PdmField<WellCellsRangeFilterEnum> wellCellsToRangeFilterMode; caf::PdmField<WellCellsRangeFilterEnum> wellCellsToRangeFilterMode;
caf::PdmField<bool> showWellCellFences; caf::PdmField<bool> showWellCellFences;
@ -91,7 +92,7 @@ public:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering); virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual caf::PdmFieldHandle* objectToggleField();
private: private:
RimReservoirView* m_reservoirView; RimReservoirView* m_reservoirView;
}; };