mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Range/Property/Well Toggle fixes
* Well cells are now toggled along with pipe geometry by the Well toggle in the tree view. * TP# 4156 Range filter collection toggle does not work This last one was really a huge error on several places in the overall logig of what is shown when. p4#: 22337
This commit is contained in:
parent
6c7c11ab6b
commit
b0b24edeb9
@ -399,7 +399,8 @@ void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t
|
||||
std::vector<RigGridBase*> grids;
|
||||
res->allGrids(&grids);
|
||||
|
||||
bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveIncludeFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells();
|
||||
bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveFilters();
|
||||
bool hasVisibleWellCells = m_reservoirView->wellCollection()->hasVisibleWellCells();
|
||||
|
||||
for (size_t gIdx = 0; gIdx < grids.size(); ++gIdx)
|
||||
{
|
||||
@ -408,11 +409,35 @@ void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t
|
||||
cvf::ref<cvf::UByteArray> fenceVisibility;
|
||||
cvf::cref<cvf::UByteArray> isWellCell = res->wellCellsInGrid(gIdx);
|
||||
|
||||
if (m_geometriesNeedsRegen[RANGE_FILTERED]) createGeometry(RANGE_FILTERED);
|
||||
if (m_geometriesNeedsRegen[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER]) createGeometry(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
|
||||
if (hasActiveRangeFilters && hasVisibleWellCells)
|
||||
{
|
||||
if (m_geometriesNeedsRegen[RANGE_FILTERED]) createGeometry(RANGE_FILTERED);
|
||||
if (m_geometriesNeedsRegen[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER]) createGeometry(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
|
||||
|
||||
rangeVisibility = m_geometries[RANGE_FILTERED].cellVisibility(gIdx);
|
||||
fenceVisibility = m_geometries[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility(gIdx);
|
||||
rangeVisibility = m_geometries[RANGE_FILTERED].cellVisibility(gIdx);
|
||||
fenceVisibility = m_geometries[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility(gIdx);
|
||||
}
|
||||
else if (hasActiveRangeFilters && !hasVisibleWellCells)
|
||||
{
|
||||
if (m_geometriesNeedsRegen[RANGE_FILTERED]) createGeometry(RANGE_FILTERED);
|
||||
|
||||
rangeVisibility = m_geometries[RANGE_FILTERED].cellVisibility(gIdx);
|
||||
fenceVisibility = m_geometries[RANGE_FILTERED].cellVisibility(gIdx);
|
||||
}
|
||||
else if (!hasActiveRangeFilters && hasVisibleWellCells)
|
||||
{
|
||||
if (m_geometriesNeedsRegen[VISIBLE_WELL_FENCE_CELLS]) createGeometry(VISIBLE_WELL_FENCE_CELLS);
|
||||
|
||||
rangeVisibility = m_geometries[VISIBLE_WELL_FENCE_CELLS].cellVisibility(gIdx);
|
||||
fenceVisibility = m_geometries[VISIBLE_WELL_FENCE_CELLS].cellVisibility(gIdx);
|
||||
}
|
||||
else if (!hasActiveRangeFilters && !hasVisibleWellCells)
|
||||
{
|
||||
if (m_geometriesNeedsRegen[ACTIVE]) createGeometry(ACTIVE);
|
||||
|
||||
rangeVisibility = m_geometries[ACTIVE].cellVisibility(gIdx);
|
||||
fenceVisibility = m_geometries[ACTIVE].cellVisibility(gIdx);
|
||||
}
|
||||
|
||||
cellVisibility->resize(rangeVisibility->size());
|
||||
|
||||
@ -421,6 +446,7 @@ void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t
|
||||
{
|
||||
(*cellVisibility)[cellIdx] = (*rangeVisibility)[cellIdx] || (*fenceVisibility)[cellIdx];
|
||||
}
|
||||
|
||||
computePropertyVisibility(cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->propertyFilterCollection());
|
||||
|
||||
m_propFilteredGeometryFrames[frameIndex]->setCellVisibility(gIdx, cellVisibility.p());
|
||||
@ -450,29 +476,63 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameInd
|
||||
std::vector<RigGridBase*> grids;
|
||||
res->allGrids(&grids);
|
||||
|
||||
bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells();
|
||||
bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveFilters();
|
||||
bool hasVisibleWellCells = m_reservoirView->wellCollection()->hasVisibleWellCells();
|
||||
|
||||
for (size_t gIdx = 0; gIdx < grids.size(); ++gIdx)
|
||||
{
|
||||
cvf::ref<cvf::UByteArray> cellVisibility = m_propFilteredWellGeometryFrames[frameIndex]->cellVisibility(gIdx);
|
||||
cvf::ref<cvf::UByteArray> rangeVisibility;
|
||||
cvf::ref<cvf::UByteArray> wellCellsOutsideVisibility;
|
||||
cvf::cref<cvf::UByteArray> cellIsWellCellStatuses = res->wellCellsInGrid(gIdx);
|
||||
cvf::ref<cvf::UByteArray> wellCellsOutsideRange;
|
||||
cvf::ref<cvf::UByteArray> wellFenceCells;
|
||||
|
||||
if (hasActiveRangeFilters && hasVisibleWellCells)
|
||||
{
|
||||
if (m_geometriesNeedsRegen[RANGE_FILTERED_WELL_CELLS]) createGeometry(RANGE_FILTERED_WELL_CELLS);
|
||||
rangeVisibility = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility(gIdx);
|
||||
|
||||
if (m_geometriesNeedsRegen[RANGE_FILTERED_WELL_CELLS]) createGeometry(RANGE_FILTERED_WELL_CELLS);
|
||||
rangeVisibility = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility(gIdx);
|
||||
if (m_geometriesNeedsRegen[VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER]) createGeometry(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
|
||||
wellCellsOutsideRange = m_geometries[VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility(gIdx);
|
||||
|
||||
if (m_geometriesNeedsRegen[VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER]) createGeometry(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
|
||||
wellCellsOutsideVisibility = m_geometries[VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility(gIdx);
|
||||
if (m_geometriesNeedsRegen[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER]) createGeometry(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
|
||||
wellFenceCells = m_geometries[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility(gIdx);
|
||||
|
||||
}
|
||||
else if (hasActiveRangeFilters && !hasVisibleWellCells)
|
||||
{
|
||||
if (m_geometriesNeedsRegen[RANGE_FILTERED_WELL_CELLS]) createGeometry(RANGE_FILTERED_WELL_CELLS);
|
||||
rangeVisibility = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility(gIdx);
|
||||
wellCellsOutsideRange = rangeVisibility;
|
||||
wellFenceCells = rangeVisibility;
|
||||
}
|
||||
else if (!hasActiveRangeFilters && hasVisibleWellCells)
|
||||
{
|
||||
if (m_geometriesNeedsRegen[VISIBLE_WELL_CELLS]) createGeometry(VISIBLE_WELL_CELLS);
|
||||
wellCellsOutsideRange = m_geometries[VISIBLE_WELL_CELLS].cellVisibility(gIdx);
|
||||
|
||||
if (m_geometriesNeedsRegen[VISIBLE_WELL_FENCE_CELLS]) createGeometry(VISIBLE_WELL_FENCE_CELLS);
|
||||
wellFenceCells = m_geometries[VISIBLE_WELL_FENCE_CELLS].cellVisibility(gIdx);
|
||||
|
||||
rangeVisibility = wellCellsOutsideRange;
|
||||
}
|
||||
else if (!hasActiveRangeFilters && !hasVisibleWellCells)
|
||||
{
|
||||
if (m_geometriesNeedsRegen[ALL_WELL_CELLS]) createGeometry(ALL_WELL_CELLS);
|
||||
wellFenceCells = m_geometries[ALL_WELL_CELLS].cellVisibility(gIdx);
|
||||
wellCellsOutsideRange = wellFenceCells;
|
||||
rangeVisibility = wellFenceCells;
|
||||
}
|
||||
|
||||
cellVisibility->resize(rangeVisibility->size());
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int cellIdx = 0; cellIdx < static_cast<int>(cellVisibility->size()); ++cellIdx)
|
||||
{
|
||||
(*cellVisibility)[cellIdx] = (!hasActiveRangeFilters && (*cellIsWellCellStatuses)[cellIdx]) || (*rangeVisibility)[cellIdx] || (*wellCellsOutsideVisibility)[cellIdx];
|
||||
(*cellVisibility)[cellIdx] = (*wellFenceCells)[cellIdx] || (*rangeVisibility)[cellIdx] || (*wellCellsOutsideRange)[cellIdx];
|
||||
}
|
||||
|
||||
computePropertyVisibility(cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->propertyFilterCollection());
|
||||
|
||||
m_propFilteredWellGeometryFrames[frameIndex]->setCellVisibility(gIdx, cellVisibility.p());
|
||||
}
|
||||
|
||||
|
@ -560,8 +560,8 @@ void RimReservoirView::createDisplayModel()
|
||||
if (! this->propertyFilterCollection()->hasActiveFilters())
|
||||
{
|
||||
std::vector<RivReservoirViewPartMgr::ReservoirGeometryCacheType> geometryTypesToAdd;
|
||||
|
||||
if (this->rangeFilterCollection()->hasActiveFilters() || this->wellCollection()->hasVisibleWellCells())
|
||||
|
||||
if (this->rangeFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells())
|
||||
{
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED);
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED_WELL_CELLS);
|
||||
@ -572,6 +572,20 @@ void RimReservoirView::createDisplayModel()
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
||||
}
|
||||
}
|
||||
else if (!this->rangeFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells())
|
||||
{
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_CELLS);
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_FENCE_CELLS);
|
||||
}
|
||||
else if (this->rangeFilterCollection()->hasActiveFilters() && !this->wellCollection()->hasVisibleWellCells())
|
||||
{
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED);
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED_WELL_CELLS);
|
||||
if (this->showInactiveCells())
|
||||
{
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::ALL_WELL_CELLS); // Should be all well cells
|
||||
@ -657,7 +671,6 @@ void RimReservoirView::createDisplayModel()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirView::updateCurrentTimeStep()
|
||||
{
|
||||
//printf("########## updateCurrentTimeStep for frame %i ##########\n", m_currentTimeStep.v());
|
||||
std::vector<RivReservoirViewPartMgr::ReservoirGeometryCacheType> geometriesToRecolor;
|
||||
|
||||
if (this->propertyFilterCollection()->hasActiveFilters())
|
||||
@ -667,7 +680,6 @@ void RimReservoirView::updateCurrentTimeStep()
|
||||
std::vector<size_t> gridIndices;
|
||||
this->indicesToVisibleGrids(&gridIndices);
|
||||
|
||||
|
||||
geometriesToRecolor.push_back( RivReservoirViewPartMgr::PROPERTY_FILTERED);
|
||||
m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::PROPERTY_FILTERED, m_currentTimeStep, gridIndices);
|
||||
|
||||
@ -683,8 +695,8 @@ void RimReservoirView::updateCurrentTimeStep()
|
||||
{
|
||||
std::vector<size_t> gridIndices;
|
||||
this->indicesToVisibleGrids(&gridIndices);
|
||||
|
||||
if (this->rangeFilterCollection()->hasActiveFilters() || this->wellCollection()->hasVisibleWellCells())
|
||||
|
||||
if (this->rangeFilterCollection()->hasActiveFilters() ) // Wells not considered, because we do not have a INACTIVE_WELL_CELLS group yet.
|
||||
{
|
||||
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE, gridIndices);
|
||||
}
|
||||
@ -707,19 +719,28 @@ void RimReservoirView::updateCurrentTimeStep()
|
||||
|
||||
m_visibleGridParts = geometriesToRecolor;
|
||||
}
|
||||
else if (rangeFilterCollection->hasActiveFilters() || this->wellCollection()->hasVisibleWellCells())
|
||||
else if (this->rangeFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells())
|
||||
{
|
||||
geometriesToRecolor.push_back(RivReservoirViewPartMgr::RANGE_FILTERED);
|
||||
geometriesToRecolor.push_back(RivReservoirViewPartMgr::RANGE_FILTERED_WELL_CELLS);
|
||||
geometriesToRecolor.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
|
||||
geometriesToRecolor.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
|
||||
}
|
||||
else if (!this->rangeFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells())
|
||||
{
|
||||
geometriesToRecolor.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_CELLS);
|
||||
geometriesToRecolor.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_FENCE_CELLS);
|
||||
}
|
||||
else if (this->rangeFilterCollection()->hasActiveFilters() && !this->wellCollection()->hasVisibleWellCells())
|
||||
{
|
||||
geometriesToRecolor.push_back(RivReservoirViewPartMgr::RANGE_FILTERED);
|
||||
geometriesToRecolor.push_back(RivReservoirViewPartMgr::RANGE_FILTERED_WELL_CELLS);
|
||||
}
|
||||
else
|
||||
{
|
||||
geometriesToRecolor.push_back(RivReservoirViewPartMgr::ACTIVE);
|
||||
geometriesToRecolor.push_back(RivReservoirViewPartMgr::ALL_WELL_CELLS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (size_t i = 0; i < geometriesToRecolor.size(); ++i)
|
||||
@ -1392,7 +1413,7 @@ void RimReservoirView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibl
|
||||
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
|
||||
{
|
||||
RimWell* well = this->wellCollection()->wells()[wIdx];
|
||||
if (this->wellCollection()->wellCellsToRangeFilterMode() == RimWellCollection::RANGE_ADD_ALL || well->showWellCells())
|
||||
if (this->wellCollection()->wellCellsToRangeFilterMode() == RimWellCollection::RANGE_ADD_ALL || (well->showWell() && well->showWellCells()) )
|
||||
{
|
||||
RigSingleWellResultsData* wres = well->wellResults();
|
||||
if (!wres) continue;
|
||||
|
@ -43,6 +43,8 @@ RimWell::RimWell()
|
||||
CAF_PDM_InitObject("Well", ":/Well.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&name, "WellName", "Name", "", "", "");
|
||||
CAF_PDM_InitField(&showWell, "ShowWell", true, "Show well ", "", "", "");
|
||||
showWell.setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well label", "", "", "");
|
||||
|
||||
@ -96,6 +98,14 @@ void RimWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
|
||||
m_reservoirView->createDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
else if (&showWell == changedField)
|
||||
{
|
||||
if (m_reservoirView)
|
||||
{
|
||||
m_reservoirView->scheduleGeometryRegen(RivReservoirViewPartMgr::VISIBLE_WELL_CELLS);
|
||||
m_reservoirView->createDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
else if (&showWellCells == changedField)
|
||||
{
|
||||
if (m_reservoirView)
|
||||
@ -137,7 +147,7 @@ void RimWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimWell::objectToggleField()
|
||||
{
|
||||
return &showWellPipes;
|
||||
return &showWell;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -168,6 +178,9 @@ bool RimWell::calculateWellPipeVisibility(size_t frameIndex)
|
||||
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimWellCollection::PIPES_FORCE_ALL_OFF)
|
||||
return false;
|
||||
|
||||
if ( this->showWell() == false )
|
||||
return false;
|
||||
|
||||
if ( this->showWellPipes() == false )
|
||||
return false;
|
||||
|
||||
|
@ -55,6 +55,8 @@ public:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||
|
||||
caf::PdmField<bool> showWell;
|
||||
|
||||
caf::PdmField<QString> name;
|
||||
caf::PdmField<bool> showWellLabel;
|
||||
|
||||
|
@ -149,7 +149,7 @@ bool RimWellCollection::hasVisibleWellCells()
|
||||
for (size_t i = 0 ; !hasCells && i < this->wells().size(); ++i)
|
||||
{
|
||||
RimWell* well = this->wells()[i];
|
||||
if ( well && well->wellResults() && (well->showWellCells() || this->wellCellsToRangeFilterMode() == RANGE_ADD_ALL) )
|
||||
if ( well && well->wellResults() && ((well->showWell() && well->showWellCells()) || this->wellCellsToRangeFilterMode() == RANGE_ADD_ALL) )
|
||||
{
|
||||
for (size_t tIdx = 0; !hasCells && tIdx < well->wellResults()->m_wellCellsTimeSteps.size(); ++tIdx )
|
||||
{
|
||||
@ -275,6 +275,7 @@ void RimWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
|
||||
wellHeadGroup->add(&showWellHead);
|
||||
wellHeadGroup->add(&wellHeadScaleFactor);
|
||||
wellHeadGroup->add(&showWellLabel);
|
||||
wellHeadGroup->add(&wellHeadPosition);
|
||||
|
||||
caf::PdmUiGroup* wellPipe = uiOrdering.addNewGroup("Well pipe");
|
||||
wellPipe->add(&wellPipeVisibility);
|
||||
|
Loading…
Reference in New Issue
Block a user