#1025 Replaced check-box with enum for showing cell center spheres

This commit is contained in:
astridkbjorke 2016-12-12 10:08:11 +01:00
parent 829c775f63
commit 21a8acdb76
7 changed files with 91 additions and 52 deletions

View File

@ -48,9 +48,9 @@ RivReservoirWellSpheresPartMgr::~RivReservoirWellSpheresPartMgr()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------
// /
// --------------------------------------------------------------------------------------------------
void RivReservoirWellSpheresPartMgr::setScaleTransform(cvf::Transform * scaleTransform)
{
m_scaleTransform = scaleTransform;
@ -62,7 +62,7 @@ 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;
@ -78,7 +78,32 @@ 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);
}

View File

@ -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
// --------------------------------------------------------------------------------------------------
// /

View File

@ -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);

View File

@ -190,6 +190,21 @@ bool RimEclipseWell::calculateWellPipeVisibility(size_t frameIndex)
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS)
{
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();
@ -217,7 +232,7 @@ bool RimEclipseWell::calculateWellPipeVisibility(size_t frameIndex)
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)
for (size_t cIdx = 0; cIdx < wsResCells.size(); ++cIdx)
{
if (wsResCells[cIdx].isCell())
{
@ -234,11 +249,6 @@ bool RimEclipseWell::calculateWellPipeVisibility(size_t frameIndex)
}
}
return false;
}
CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ?
return false;
}

View File

@ -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();

View File

@ -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", "", "", "");
@ -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");

View File

@ -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;