From c4d9c1d780b38e49a100967cc8053e9e4c83c394 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 2 Feb 2017 09:56:49 +0100 Subject: [PATCH] #1148 Made tristate of well cell fence --- .../ProjectDataModel/RimEclipseView.cpp | 2 +- .../RimEclipseWellCollection.cpp | 54 +++++++++++-------- .../RimEclipseWellCollection.h | 4 +- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index da02b4e166..ce8f155e1f 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -1188,7 +1188,7 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC (*visibleCells)[gridCellIndex] = true; // Calculate well fence cells - if (well->showWellCellFence() && this->wellCollection()->showWellCellFence()) + if (well->showWellCellFence()) { size_t i, j, k; grid->ijkFromCellIndex(gridCellIndex, &i, &j, &k); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp index 28bbd6a50e..52dcc93967 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp @@ -166,7 +166,6 @@ RimEclipseWellCollection::RimEclipseWellCollection() m_showWellCells.xmlCapability()->setIOReadable(false); m_showWellCells.xmlCapability()->setIOWritable(false); - CAF_PDM_InitField(&showWellCellFence, "ShowWellFences", false, "Show Well Cell Fence", "", "", ""); CAF_PDM_InitField(&wellCellFenceType, "DefaultWellFenceDirection", WellFenceEnum(K_DIRECTION), "Well Fence Direction", "", "", ""); CAF_PDM_InitField(&wellCellTransparencyLevel, "WellCellTransparency", 0.5, "Well Cell Transparency", "", "", ""); @@ -176,6 +175,11 @@ RimEclipseWellCollection::RimEclipseWellCollection() CAF_PDM_InitFieldNoDefault(&wells, "Wells", "Wells", "", "", ""); wells.uiCapability()->setUiHidden(true); + CAF_PDM_InitFieldNoDefault(&m_showWellCellFence, "ShowWellCellFenceTristate", "Show Well Cell Fence", "", "", ""); + m_showWellCellFence.uiCapability()->setUiEditorTypeName(caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName()); + m_showWellCellFence.xmlCapability()->setIOReadable(false); + m_showWellCellFence.xmlCapability()->setIOWritable(false); + CAF_PDM_InitField(&obsoleteField_wellPipeVisibility, "GlobalWellPipeVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well pipe visibility", "", "", ""); obsoleteField_wellPipeVisibility.uiCapability()->setUiHidden(true); obsoleteField_wellPipeVisibility.xmlCapability()->setIOWritable(false); @@ -184,17 +188,17 @@ RimEclipseWellCollection::RimEclipseWellCollection() obsoleteField_wellCellsToRangeFilterMode.uiCapability()->setUiHidden(true); obsoleteField_wellCellsToRangeFilterMode.xmlCapability()->setIOWritable(false); - CAF_PDM_InitFieldNoDefault(&obsoleteField_showWellHead, "ShowWellHead", "Show Well Head", "", "", ""); - CAF_PDM_InitFieldNoDefault(&obsoleteField_showWellLabel, "ShowWellLabel", "Show Well Label", "", "", ""); - CAF_PDM_InitFieldNoDefault(&obsoleteField_showWellCells, "ShowWellCells", "Show Well Cells", "", "", ""); + CAF_PDM_InitField(&obsoleteField_showWellHead, "ShowWellHead", true, "Show Well Head", "", "", ""); + CAF_PDM_InitField(&obsoleteField_showWellLabel, "ShowWellLabel", true, "Show Well Label", "", "", ""); + CAF_PDM_InitField(&obsoleteField_showWellCellFence, "ShowWellFences", false, "Show Well Cell Fence", "", "", ""); obsoleteField_showWellHead.uiCapability()->setUiHidden(true); obsoleteField_showWellLabel.uiCapability()->setUiHidden(true); - obsoleteField_showWellCells.uiCapability()->setUiHidden(true); + obsoleteField_showWellCellFence.uiCapability()->setUiHidden(true); obsoleteField_showWellHead.xmlCapability()->setIOWritable(false); obsoleteField_showWellLabel.xmlCapability()->setIOWritable(false); - obsoleteField_showWellCells.xmlCapability()->setIOWritable(false); + obsoleteField_showWellCellFence.xmlCapability()->setIOWritable(false); m_reservoirView = NULL; } @@ -314,6 +318,7 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang for (RimEclipseWell* w : wells) { w->showWellLabel = !(m_showWellLabel().isFalse()); + w->updateConnectedEditors(); } } @@ -322,6 +327,7 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang for (RimEclipseWell* w : wells) { w->showWellHead = !(m_showWellHead().isFalse()); + w->updateConnectedEditors(); } } @@ -330,6 +336,7 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang for (RimEclipseWell* w : wells) { w->showWellPipe = !(m_showWellPipe().isFalse()); + w->updateConnectedEditors(); } } @@ -338,6 +345,7 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang for (RimEclipseWell* w : wells) { w->showWellSpheres = !(m_showWellSpheres().isFalse()); + w->updateConnectedEditors(); } } @@ -346,6 +354,16 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang for (RimEclipseWell* w : wells) { w->showWellCells = !(m_showWellCells().isFalse()); + w->updateConnectedEditors(); + } + } + + if (&m_showWellCellFence == changedField) + { + for (RimEclipseWell* w : wells) + { + w->showWellCellFence = !(m_showWellCellFence().isFalse()); + w->updateConnectedEditors(); } } @@ -354,7 +372,7 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang if ( &isActive == changedField || &m_showWellLabel == changedField || &m_showWellCells == changedField - || &showWellCellFence == changedField + || &m_showWellCellFence == changedField || &wellCellFenceType == changedField) { m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS); @@ -387,17 +405,6 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang } } - if ( &m_showWellPipe == changedField - || &m_showWellSpheres == changedField - || &m_showWellHead == changedField - || &m_showWellLabel == changedField) - { - for (RimEclipseWell* w : wells) - { - w->updateConnectedEditors(); - } - } - if (&m_applyIndividualColorsToWells == changedField) { for (size_t i = 0; i < wells.size(); i++) @@ -482,10 +489,10 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well Cells"); filterGroup->add(&obsoleteField_wellCellsToRangeFilterMode); filterGroup->add(&m_showWellCells); - filterGroup->add(&showWellCellFence); + filterGroup->add(&m_showWellCellFence); filterGroup->add(&wellCellFenceType); - showWellCellFence.uiCapability()->setUiReadOnly(!showWellCells()); + m_showWellCellFence.uiCapability()->setUiReadOnly(!showWellCells()); wellCellFenceType.uiCapability()->setUiReadOnly(!showWellCells()); } @@ -499,6 +506,7 @@ void RimEclipseWellCollection::updateStateForVisibilityCheckboxes() size_t showPipeCount = 0; size_t showSphereCount = 0; size_t showWellCellsCount = 0; + size_t showWellCellFenceCount = 0; for (RimEclipseWell* w : wells) { @@ -507,6 +515,7 @@ void RimEclipseWellCollection::updateStateForVisibilityCheckboxes() if (w->showWellPipe()) showPipeCount++; if (w->showWellSpheres()) showSphereCount++; if (w->showWellCells()) showWellCellsCount++; + if (w->showWellCellFence()) showWellCellFenceCount++; } updateStateFromEnabledChildCount(showLabelCount, &m_showWellLabel); @@ -514,6 +523,7 @@ void RimEclipseWellCollection::updateStateForVisibilityCheckboxes() updateStateFromEnabledChildCount(showPipeCount, &m_showWellPipe); updateStateFromEnabledChildCount(showSphereCount, &m_showWellSpheres); updateStateFromEnabledChildCount(showWellCellsCount, &m_showWellCells); + updateStateFromEnabledChildCount(showWellCellFenceCount, &m_showWellCellFence); } //-------------------------------------------------------------------------------------------------- @@ -611,11 +621,11 @@ void RimEclipseWellCollection::initAfterRead() } } - if (!obsoleteField_showWellCells()) + if (obsoleteField_showWellCellFence()) { for (RimEclipseWell* w : wells) { - w->showWellCells = false; + w->showWellCellFence = true; } } } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h index 35efb5bd85..ef90310eb1 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h @@ -98,7 +98,6 @@ public: void setShowWellCellsState(bool enable); bool showWellCells(); - caf::PdmField showWellCellFence; caf::PdmField wellCellFenceType; caf::PdmField wellCellTransparencyLevel; @@ -150,6 +149,7 @@ private: caf::PdmField m_showWellPipe; caf::PdmField m_showWellSpheres; caf::PdmField m_showWellCells; + caf::PdmField m_showWellCellFence; // Obsolete fields caf::PdmField obsoleteField_wellPipeVisibility; @@ -157,5 +157,5 @@ private: caf::PdmField obsoleteField_showWellLabel; caf::PdmField obsoleteField_showWellHead; - caf::PdmField obsoleteField_showWellCells; + caf::PdmField obsoleteField_showWellCellFence; };