mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1148 Use tristate for well cell visibility
This commit is contained in:
parent
b26bd11674
commit
fad0974b3f
@ -1141,9 +1141,6 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC
|
||||
}
|
||||
visibleCells->setAll(false);
|
||||
|
||||
// If all wells are forced off, return
|
||||
if (!this->wellCollection()->showWellCells()) return;
|
||||
|
||||
RigActiveCellInfo* activeCellInfo = this->currentActiveCellInfo();
|
||||
|
||||
CVF_ASSERT(activeCellInfo);
|
||||
@ -1152,7 +1149,7 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC
|
||||
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
|
||||
{
|
||||
RimEclipseWell* well = this->wellCollection()->wells()[wIdx];
|
||||
if (this->wellCollection()->showWellCells() && well->showWell() && well->showWellCells())
|
||||
if (well->showWell() && well->showWellCells())
|
||||
{
|
||||
RigSingleWellResultsData* wres = well->wellResults();
|
||||
if (!wres) continue;
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cvfMath.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimEclipseWell, "Well");
|
||||
@ -51,7 +53,7 @@ RimEclipseWell::RimEclipseWell()
|
||||
CAF_PDM_InitField(&pipeScaleFactor, "WellPipeRadiusScale", 1.0, "Pipe Scale Factor", "", "", "");
|
||||
CAF_PDM_InitField(&wellPipeColor, "WellPipeColor", cvf::Color3f(0.588f, 0.588f, 0.804f), "Pipe color", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&showWellCells, "ShowWellCells", true, "Well Cells", "", "", "");
|
||||
CAF_PDM_InitField(&showWellCells, "ShowWellCells", false, "Well Cells", "", "", "");
|
||||
CAF_PDM_InitField(&showWellCellFence, "ShowWellCellFence", false, "Well Cell Fence", "", "", "");
|
||||
|
||||
m_resultWellIndex = cvf::UNDEFINED_SIZE_T;
|
||||
@ -77,37 +79,47 @@ caf::PdmFieldHandle* RimEclipseWell::userDescriptionField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
RimEclipseView* m_reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(m_reservoirView);
|
||||
if (!m_reservoirView) return;
|
||||
|
||||
RimEclipseView* reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(reservoirView);
|
||||
if (reservoirView)
|
||||
{
|
||||
if (&showWellLabel == changedField ||
|
||||
&showWellHead == changedField ||
|
||||
&showWellPipe == changedField ||
|
||||
&showWellSpheres == changedField ||
|
||||
&wellPipeColor == changedField)
|
||||
{
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else if (&showWell == changedField ||
|
||||
&showWellCells == changedField ||
|
||||
&showWellCellFence == changedField)
|
||||
|
||||
{
|
||||
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
|
||||
reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else if ( &pipeScaleFactor == changedField
|
||||
|| &wellHeadScaleFactor == changedField)
|
||||
{
|
||||
if (m_reservoirView)
|
||||
if (reservoirView)
|
||||
{
|
||||
m_reservoirView->schedulePipeGeometryRegen();
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
reservoirView->schedulePipeGeometryRegen();
|
||||
reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RimEclipseWellCollection* wellColl = nullptr;
|
||||
this->firstAncestorOrThisOfType(wellColl);
|
||||
if (wellColl)
|
||||
{
|
||||
wellColl->updateStateForVisibilityCheckboxes();
|
||||
|
||||
RiuMainWindow::instance()->refreshDrawStyleActions();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -161,7 +161,11 @@ RimEclipseWellCollection::RimEclipseWellCollection()
|
||||
pipeCrossSectionVertexCount.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitField(&wellPipeCoordType, "WellPipeCoordType", WellPipeCoordEnum(WELLPIPE_INTERPOLATED), "Type", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&showWellCells, "ShowWellCells", false, "Show Well Cells", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_showWellCells, "ShowWellCells", "Show Well Cells", "", "", "");
|
||||
m_showWellCells.uiCapability()->setUiEditorTypeName(caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName());
|
||||
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", "", "", "");
|
||||
|
||||
@ -191,6 +195,40 @@ RimEclipseWellCollection::~RimEclipseWellCollection()
|
||||
wells.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseWellCollection::setShowWellCellsState(bool enable)
|
||||
{
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellCells = enable;
|
||||
}
|
||||
|
||||
updateConnectedEditors();
|
||||
|
||||
if (m_reservoirView)
|
||||
{
|
||||
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseWellCollection::showWellCells()
|
||||
{
|
||||
if (m_showWellCells().isFalse())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -212,7 +250,6 @@ RimEclipseWell* RimEclipseWellCollection::findWell(QString name)
|
||||
bool RimEclipseWellCollection::hasVisibleWellCells()
|
||||
{
|
||||
if (!this->isActive()) return false;
|
||||
if (!this->showWellCells()) return false;
|
||||
if (this->wells().size() == 0 ) return false;
|
||||
|
||||
bool hasCells = false;
|
||||
@ -292,12 +329,19 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
}
|
||||
}
|
||||
|
||||
if (&m_showWellCells == changedField)
|
||||
{
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellCells = !(m_showWellCells().isFalse());
|
||||
}
|
||||
}
|
||||
|
||||
if (m_reservoirView)
|
||||
{
|
||||
if ( &isActive == changedField
|
||||
|| &m_showWellLabel == changedField
|
||||
|| &showWellCells == changedField
|
||||
|| &m_showWellCells == changedField
|
||||
|| &showWellCellFence == changedField
|
||||
|| &wellCellFenceType == changedField)
|
||||
{
|
||||
@ -372,7 +416,7 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
m_applySingleColorToWells = false;
|
||||
}
|
||||
|
||||
if (&showWellCells == changedField)
|
||||
if (&m_showWellCells == changedField)
|
||||
{
|
||||
RiuMainWindow::instance()->refreshDrawStyleActions();
|
||||
}
|
||||
@ -425,7 +469,7 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
|
||||
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well Cells");
|
||||
filterGroup->add(&obsoleteField_wellCellsToRangeFilterMode);
|
||||
filterGroup->add(&showWellCells);
|
||||
filterGroup->add(&m_showWellCells);
|
||||
filterGroup->add(&showWellCellFence);
|
||||
filterGroup->add(&wellCellFenceType);
|
||||
|
||||
@ -442,6 +486,7 @@ void RimEclipseWellCollection::updateStateForVisibilityCheckboxes()
|
||||
size_t showWellHeadCount = 0;
|
||||
size_t showPipeCount = 0;
|
||||
size_t showSphereCount = 0;
|
||||
size_t showWellCellsCount = 0;
|
||||
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
@ -449,12 +494,14 @@ void RimEclipseWellCollection::updateStateForVisibilityCheckboxes()
|
||||
if (w->showWellHead()) showWellHeadCount++;
|
||||
if (w->showWellPipe()) showPipeCount++;
|
||||
if (w->showWellSpheres()) showSphereCount++;
|
||||
if (w->showWellCells()) showWellCellsCount++;
|
||||
}
|
||||
|
||||
updateStateFromEnabledChildCount(showLabelCount, &m_showWellLabel);
|
||||
updateStateFromEnabledChildCount(showWellHeadCount, &m_showWellHead);
|
||||
updateStateFromEnabledChildCount(showPipeCount, &m_showWellPipe);
|
||||
updateStateFromEnabledChildCount(showSphereCount, &m_showWellSpheres);
|
||||
updateStateFromEnabledChildCount(showWellCellsCount, &m_showWellCells);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -523,21 +570,18 @@ void RimEclipseWellCollection::initAfterRead()
|
||||
|
||||
if (obsoleteField_wellCellsToRangeFilterMode() == RANGE_ADD_NONE)
|
||||
{
|
||||
showWellCells = false;
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWell = false;
|
||||
}
|
||||
}
|
||||
else if (obsoleteField_wellCellsToRangeFilterMode() == RANGE_ADD_ALL)
|
||||
{
|
||||
showWellCells = true;
|
||||
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellCells = true;
|
||||
}
|
||||
}
|
||||
else if (obsoleteField_wellCellsToRangeFilterMode() == RANGE_ADD_INDIVIDUAL)
|
||||
{
|
||||
showWellCells = true;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -95,7 +95,9 @@ public:
|
||||
caf::PdmField<cvf::Color3f> wellLabelColor;
|
||||
caf::PdmField<bool> showConnectionStatusColors;
|
||||
|
||||
caf::PdmField<bool> showWellCells;
|
||||
void setShowWellCellsState(bool enable);
|
||||
bool showWellCells();
|
||||
|
||||
caf::PdmField<bool> showWellCellFence;
|
||||
caf::PdmField<WellFenceEnum> wellCellFenceType;
|
||||
caf::PdmField<double> wellCellTransparencyLevel;
|
||||
@ -116,6 +118,8 @@ public:
|
||||
|
||||
const std::vector<cvf::ubyte>& resultWellGeometryVisibilities(size_t frameIndex);
|
||||
void scheduleIsWellPipesVisibleRecalculation();
|
||||
void updateStateForVisibilityCheckboxes();
|
||||
|
||||
|
||||
static cvf::Color3f cycledPaletteColor(size_t colorIndex);
|
||||
|
||||
@ -130,7 +134,6 @@ protected:
|
||||
|
||||
private:
|
||||
void calculateWellGeometryVisibility(size_t frameIndex);
|
||||
void updateStateForVisibilityCheckboxes();
|
||||
void updateStateFromEnabledChildCount(size_t showLabelCount, caf::PdmField<caf::Tristate>* fieldToUpdate);
|
||||
|
||||
private:
|
||||
@ -146,6 +149,7 @@ private:
|
||||
caf::PdmField<caf::Tristate> m_showWellHead;
|
||||
caf::PdmField<caf::Tristate> m_showWellPipe;
|
||||
caf::PdmField<caf::Tristate> m_showWellSpheres;
|
||||
caf::PdmField<caf::Tristate> m_showWellCells;
|
||||
|
||||
// Obsolete fields
|
||||
caf::PdmField<WellVisibilityEnum> obsoleteField_wellPipeVisibility;
|
||||
|
@ -1384,6 +1384,7 @@ void RiuMainWindow::refreshDrawStyleActions()
|
||||
m_toggleFaultsLabelAction->blockSignals(false);
|
||||
|
||||
m_showWellCellsAction->blockSignals(true);
|
||||
eclView->wellCollection()->updateStateForVisibilityCheckboxes();
|
||||
m_showWellCellsAction->setChecked(eclView->wellCollection()->showWellCells());
|
||||
m_showWellCellsAction->blockSignals(false);
|
||||
}
|
||||
@ -1577,7 +1578,7 @@ void RiuMainWindow::slotShowWellCellsAction(bool doAdd)
|
||||
RimEclipseView* riv = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
||||
if (riv)
|
||||
{
|
||||
riv->wellCollection()->showWellCells.setValueWithFieldChanged(doAdd);
|
||||
riv->wellCollection()->setShowWellCellsState(doAdd);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user