mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-07 14:43:10 -06:00
#1025 Replaced check-box with enum for showing cell center spheres
This commit is contained in:
parent
829c775f63
commit
21a8acdb76
@ -48,9 +48,9 @@ RivReservoirWellSpheresPartMgr::~RivReservoirWellSpheresPartMgr()
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// --------------------------------------------------------------------------------------------------
|
||||
// /
|
||||
// --------------------------------------------------------------------------------------------------
|
||||
void RivReservoirWellSpheresPartMgr::setScaleTransform(cvf::Transform * scaleTransform)
|
||||
{
|
||||
m_scaleTransform = scaleTransform;
|
||||
@ -62,8 +62,8 @@ void RivReservoirWellSpheresPartMgr::setScaleTransform(cvf::Transform * scaleTra
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReservoirWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
|
||||
{
|
||||
if (!m_reservoirView->wellCollection()->showCellCenterSpheres) return;
|
||||
|
||||
if (m_reservoirView->wellCollection()->wellSphereVisibility == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) return;
|
||||
|
||||
if (!m_reservoirView->wellCollection()->isActive()) return;
|
||||
|
||||
if (m_reservoirView->wellCollection()->wells.size() != m_wellSpheresPartMgrs.size())
|
||||
@ -78,8 +78,33 @@ void RivReservoirWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::Mode
|
||||
|
||||
for (size_t i = 0; i < m_wellSpheresPartMgrs.size(); i++)
|
||||
{
|
||||
|
||||
bool showGeo = false;
|
||||
|
||||
|
||||
if (m_reservoirView->wellCollection()->wells[i]->showWell())
|
||||
{
|
||||
|
||||
if (m_reservoirView->wellCollection->wellSphereVisibility == RimEclipseWellCollection::PIPES_FORCE_ALL_ON)
|
||||
{
|
||||
showGeo = true;
|
||||
}
|
||||
|
||||
else if (m_reservoirView->wellCollection->wellSphereVisibility == RimEclipseWellCollection::PIPES_INDIVIDUALLY && m_reservoirView->wellCollection()->wells[i]->showWellSpheres() )
|
||||
{
|
||||
showGeo = true;
|
||||
}
|
||||
|
||||
else if (m_reservoirView->wellCollection->wellSphereVisibility == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS && m_reservoirView->wellCollection->wells[i]->visibleCellsInstersectsWell(frameIndex))
|
||||
{
|
||||
showGeo = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (showGeo)
|
||||
{
|
||||
m_wellSpheresPartMgrs.at(i)->appendDynamicGeometryPartsToModel(model, frameIndex);
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ RivWellSpheresPartMgr::~RivWellSpheresPartMgr()
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -71,7 +72,10 @@ void RivWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLis
|
||||
if (m_rimReservoirView.isNull()) return;
|
||||
if (!m_rimReservoirView->eclipseCase()) return;
|
||||
if (!m_rimReservoirView->eclipseCase()->reservoirData()) return;
|
||||
if (!m_rimWell->showWellSpheres()) return;
|
||||
|
||||
|
||||
// if (!m_rimWell->showWellSpheres() ) return; //TODO: Check that all on is not on...
|
||||
|
||||
|
||||
const RigMainGrid* mainGrid = m_rimReservoirView->eclipseCase()->reservoirData()->mainGrid();
|
||||
CVF_ASSERT(mainGrid);
|
||||
@ -115,7 +119,6 @@ void RivWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLis
|
||||
model->addPart(part.p());
|
||||
}
|
||||
|
||||
//TODO: Transparency må være linka til show cell center spheres og All On/Of for well pipes
|
||||
|
||||
// --------------------------------------------------------------------------------------------------
|
||||
// /
|
||||
|
@ -59,8 +59,8 @@ public:
|
||||
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex);
|
||||
|
||||
private:
|
||||
static cvf::ref<cvf::DrawableGeo> createSphere(double radius, const cvf::Vec3d& pos);
|
||||
cvf::ref<cvf::Part> createPart(cvf::DrawableGeo* geo, const cvf::Color3f& color);
|
||||
// static cvf::ref<cvf::DrawableGeo> createSphere(double radius, const cvf::Vec3d& pos);
|
||||
// cvf::ref<cvf::Part> createPart(cvf::DrawableGeo* geo, const cvf::Color3f& color);
|
||||
|
||||
cvf::Color3f wellCellColor(const RigWellResultFrame& wellResultFrame, const RigWellResultPoint& wellResultPoint);
|
||||
cvf::ref<cvf::Part> createPart(std::vector<std::pair<cvf::Vec3f, cvf::Color3f> >& centerColorPairs);
|
||||
|
@ -190,55 +190,65 @@ bool RimEclipseWell::calculateWellPipeVisibility(size_t frameIndex)
|
||||
|
||||
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS)
|
||||
{
|
||||
const std::vector<RivCellSetEnum>& visGridParts = m_reservoirView->visibleGridParts();
|
||||
cvf::cref<RivReservoirViewPartMgr> rvMan = m_reservoirView->reservoirGridPartManager();
|
||||
|
||||
for (size_t gpIdx = 0; gpIdx < visGridParts.size(); ++gpIdx)
|
||||
return visibleCellsInstersectsWell(frameIndex);
|
||||
}
|
||||
|
||||
CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ?
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseWell::visibleCellsInstersectsWell(size_t frameIndex)
|
||||
{
|
||||
//TODO: lag egen funksjon her:
|
||||
const std::vector<RivCellSetEnum>& visGridParts = m_reservoirView->visibleGridParts();
|
||||
cvf::cref<RivReservoirViewPartMgr> rvMan = m_reservoirView->reservoirGridPartManager();
|
||||
|
||||
for (size_t gpIdx = 0; gpIdx < visGridParts.size(); ++gpIdx)
|
||||
{
|
||||
const RigWellResultFrame& wrsf = this->wellResults()->wellResultFrame(frameIndex);
|
||||
|
||||
// First check the wellhead:
|
||||
|
||||
size_t gridIndex = wrsf.m_wellHead.m_gridIndex;
|
||||
size_t gridCellIndex = wrsf.m_wellHead.m_gridCellIndex;
|
||||
|
||||
if (gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
const RigWellResultFrame& wrsf = this->wellResults()->wellResultFrame(frameIndex);
|
||||
|
||||
// First check the wellhead:
|
||||
|
||||
size_t gridIndex = wrsf.m_wellHead.m_gridIndex;
|
||||
size_t gridCellIndex = wrsf.m_wellHead.m_gridCellIndex;
|
||||
|
||||
if (gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T)
|
||||
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex);
|
||||
if ((*cellVisibility)[gridCellIndex])
|
||||
{
|
||||
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex);
|
||||
if ((*cellVisibility)[gridCellIndex])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Then check the rest of the well, with all the branches
|
||||
// Then check the rest of the well, with all the branches
|
||||
|
||||
const std::vector<RigWellResultBranch>& wellResSegments = wrsf.m_wellResultBranches;
|
||||
for (size_t wsIdx = 0; wsIdx < wellResSegments.size(); ++wsIdx)
|
||||
const std::vector<RigWellResultBranch>& wellResSegments = wrsf.m_wellResultBranches;
|
||||
for (size_t wsIdx = 0; wsIdx < wellResSegments.size(); ++wsIdx)
|
||||
{
|
||||
const std::vector<RigWellResultPoint>& wsResCells = wellResSegments[wsIdx].m_branchResultPoints;
|
||||
for (size_t cIdx = 0; cIdx < wsResCells.size(); ++cIdx)
|
||||
{
|
||||
const std::vector<RigWellResultPoint>& wsResCells = wellResSegments[wsIdx].m_branchResultPoints;
|
||||
for (size_t cIdx = 0; cIdx < wsResCells.size(); ++ cIdx)
|
||||
if (wsResCells[cIdx].isCell())
|
||||
{
|
||||
if (wsResCells[cIdx].isCell())
|
||||
{
|
||||
gridIndex = wsResCells[cIdx].m_gridIndex;
|
||||
gridCellIndex = wsResCells[cIdx].m_gridCellIndex;
|
||||
gridIndex = wsResCells[cIdx].m_gridIndex;
|
||||
gridCellIndex = wsResCells[cIdx].m_gridCellIndex;
|
||||
|
||||
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex);
|
||||
if ((*cellVisibility)[gridCellIndex])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex);
|
||||
if ((*cellVisibility)[gridCellIndex])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ?
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,10 @@ public:
|
||||
|
||||
bool calculateWellPipeVisibility(size_t frameIndex);
|
||||
|
||||
bool visibleCellsInstersectsWell(size_t frameIndex);
|
||||
|
||||
//Trengs det en calculateWellGeometryVisibility??
|
||||
|
||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
|
||||
|
@ -108,8 +108,7 @@ RimEclipseWellCollection::RimEclipseWellCollection()
|
||||
|
||||
CAF_PDM_InitField(&isAutoDetectingBranches, "IsAutoDetectingBranches", true, "Geometry based branch detection", "", "Toggle wether the well pipe visualization will try to detect when a part of the well \nis really a branch, and thus is starting from wellhead", "");
|
||||
|
||||
CAF_PDM_InitField(&showCellCenterSpheres, "showCellCenterSpheres", false, "Show sphere in cell center", "", "", "");
|
||||
// CAF_PDM_InitField(&wellSphereVisibility, "wellSphereVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well sphere visibility", "", "", "");
|
||||
CAF_PDM_InitField(&wellSphereVisibility, "wellSphereVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well sphere visibility", "", "", "");
|
||||
CAF_PDM_InitField(&cellCenterSpheresScaleFactor, "CellCenterSphereScale", 0.2, "Cell Center sphere radius", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&wells, "Wells", "Wells", "", "", "");
|
||||
@ -179,7 +178,7 @@ bool RimEclipseWellCollection::hasVisibleWellCells()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Used to know if we need animation of timesteps due to the wells
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseWellCollection::hasVisibleWellPipes()
|
||||
bool RimEclipseWellCollection::hasVisibleWellPipes()
|
||||
{
|
||||
if (!this->isActive()) return false;
|
||||
if (this->wellPipeVisibility() == PIPES_FORCE_ALL_OFF) return false;
|
||||
@ -189,7 +188,6 @@ bool RimEclipseWellCollection::hasVisibleWellPipes()
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -228,7 +226,7 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
else if ( &showCellCenterSpheres == changedField
|
||||
else if ( &wellSphereVisibility == changedField
|
||||
|| &cellCenterSpheresScaleFactor == changedField)
|
||||
{
|
||||
if (m_reservoirView)
|
||||
@ -298,7 +296,7 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
wellPipe->add(&pipeRadiusScaleFactor);
|
||||
|
||||
caf::PdmUiGroup* cellCenterSpheres = uiOrdering.addNewGroup("Well cell center spheres");
|
||||
cellCenterSpheres->add(&showCellCenterSpheres);
|
||||
cellCenterSpheres->add(&wellSphereVisibility);
|
||||
cellCenterSpheres->add(&cellCenterSpheresScaleFactor);
|
||||
|
||||
caf::PdmUiGroup* advancedGroup = uiOrdering.addNewGroup("Advanced");
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
|
||||
RimEclipseWellCollection();
|
||||
virtual ~RimEclipseWellCollection();
|
||||
|
||||
|
||||
void setReservoirView(RimEclipseView* ownerReservoirView);
|
||||
|
||||
enum WellVisibilityType
|
||||
@ -102,8 +102,7 @@ public:
|
||||
|
||||
caf::PdmField<bool> isAutoDetectingBranches;
|
||||
|
||||
caf::PdmField<bool> showCellCenterSpheres;
|
||||
//caf::PdmField<WellVisibilityEnum> wellSphereVisibility;
|
||||
caf::PdmField<WellVisibilityEnum> wellSphereVisibility;
|
||||
caf::PdmField<double> cellCenterSpheresScaleFactor;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user