#1078 Added showWellsIntersectingVisibleCells

Obsoleted wellPipeVisibility and removed wellSphereVisibility
This commit is contained in:
Magne Sjaastad 2017-01-26 08:12:28 +01:00
parent 6ee54733f4
commit 8304cb0393
5 changed files with 64 additions and 52 deletions

View File

@ -103,8 +103,6 @@ void RivReservoirPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasic
{
if (!m_reservoirView->wellCollection()->isActive()) return;
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) return;
if (m_reservoirView->wellCollection()->wells.size() != m_wellPipesPartMgrs.size())
{
clearGeometryCache();

View File

@ -61,8 +61,6 @@ void RivReservoirWellSpheresPartMgr::clearGeometryCache()
//--------------------------------------------------------------------------------------------------
void RivReservoirWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
{
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())

View File

@ -20,6 +20,7 @@
#include "RimEclipseWell.h"
#include "RigSimulationWellCenterLineCalculator.h"
#include "RigSingleWellResultsData.h"
#include "RimEclipseView.h"
@ -27,7 +28,6 @@
#include "RimIntersectionCollection.h"
#include "cvfMath.h"
#include "RigSimulationWellCenterLineCalculator.h"
CAF_PDM_SOURCE_INIT(RimEclipseWell, "Well");
@ -46,7 +46,7 @@ RimEclipseWell::RimEclipseWell()
CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well label", "", "", "");
CAF_PDM_InitField(&showWellHead, "ShowWellHead", true, "Show well head", "", "", "");
CAF_PDM_InitField(&showWellPipes, "ShowWellPipe", true, "Show well pipe", "", "", "");
CAF_PDM_InitField(&showWellSpheres, "ShowWellSpheres", true, "Show well spheres", "", "", "");
CAF_PDM_InitField(&showWellSpheres, "ShowWellSpheres", false, "Show well spheres", "", "", "");
CAF_PDM_InitField(&pipeScaleFactor, "WellPipeRadiusScale", 1.0, "Well Pipe Scale Factor", "", "", "");
CAF_PDM_InitField(&wellPipeColor, "WellPipeColor", cvf::Color3f(0.588f, 0.588f, 0.804f), "Well pipe color", "", "", "");
@ -241,32 +241,23 @@ bool RimEclipseWell::isWellPipeVisible(size_t frameIndex)
if (!m_reservoirView->wellCollection()->isActive())
return false;
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_ON)
return true;
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF)
return false;
if (this->showWell() == false)
return false;
if (this->showWellPipes() == false)
return false;
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_INDIVIDUALLY)
return true;
if (m_reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this))
return true;
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS)
if (m_reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
{
return visibleCellsInstersectsWell(frameIndex);
}
CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ?
return false;
else
{
return true;
}
}
//--------------------------------------------------------------------------------------------------
@ -294,28 +285,23 @@ bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex)
if (!m_reservoirView->wellCollection()->isActive())
return false;
if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_ON)
return true;
if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF)
return false;
if (this->showWell() == false)
return false;
if (this->showWellSpheres() == false)
return false;
if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_INDIVIDUALLY)
return true;
if (m_reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this))
return true;
if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS)
if (m_reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
{
return visibleCellsInstersectsWell(frameIndex);
}
else
{
return true;
}
CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ?

View File

@ -30,6 +30,7 @@
namespace caf
{
// OBSOLETE enum
template<>
void RimEclipseWellCollection::WellVisibilityEnum::setUp()
{
@ -98,6 +99,8 @@ RimEclipseWellCollection::RimEclipseWellCollection()
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
isActive.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&showWellsIntersectingVisibleCells, "ShowWellsIntersectingVisibleCells", true, "Show Wells Intersecting Visible Cells", "", "", "");
CAF_PDM_InitField(&showWellHead, "ShowWellHead", true, "Show well heads", "", "", "");
CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well labels", "", "", "");
CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScale", 1.0, "Well head scale", "", "", "");
@ -105,7 +108,9 @@ RimEclipseWellCollection::RimEclipseWellCollection()
cvf::Color3f defWellLabelColor = RiaApplication::instance()->preferences()->defaultWellLabelColor();
CAF_PDM_InitField(&wellLabelColor, "WellLabelColor", defWellLabelColor, "Well label color", "", "", "");
CAF_PDM_InitField(&wellPipeVisibility, "GlobalWellPipeVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well pipe visibility", "", "", "");
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);
CAF_PDM_InitField(&pipeScaleFactor, "WellPipeRadiusScale", 0.1, "Pipe radius scale", "", "", "");
CAF_PDM_InitField(&pipeCrossSectionVertexCount, "WellPipeVertexCount", 12, "Pipe vertex count", "", "", "");
@ -120,7 +125,6 @@ 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(&wellSphereVisibility, "wellSphereVisibility", WellVisibilityEnum(PIPES_FORCE_ALL_OFF), "Global well sphere visibility", "", "", "");
CAF_PDM_InitField(&cellCenterSpheresScaleFactor, "CellCenterSphereScale", 0.2, "Cell Center sphere radius", "", "", "");
CAF_PDM_InitFieldNoDefault(&wells, "Wells", "Wells", "", "", "");
@ -193,10 +197,7 @@ bool RimEclipseWellCollection::hasVisibleWellCells()
bool RimEclipseWellCollection::hasVisibleWellPipes()
{
if (!this->isActive()) return false;
if (this->wellPipeVisibility() == PIPES_FORCE_ALL_OFF && this->wellSphereVisibility() == PIPES_FORCE_ALL_OFF ) return false;
if (this->wells().size() == 0 ) return false;
if (this->wellPipeVisibility() == PIPES_FORCE_ALL_ON) return true;
if (this->wellSphereVisibility() == PIPES_FORCE_ALL_ON) return true;
return true;
}
@ -239,8 +240,7 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
else if ( &wellSphereVisibility == changedField
|| &cellCenterSpheresScaleFactor == changedField)
else if (&cellCenterSpheresScaleFactor == changedField)
{
if (m_reservoirView)
{
@ -256,13 +256,6 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
else if (&wellPipeVisibility == changedField)
{
if (m_reservoirView)
{
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
else if ( &pipeCrossSectionVertexCount == changedField
|| &pipeScaleFactor == changedField
|| &wellHeadScaleFactor == changedField
@ -270,6 +263,7 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|| &isAutoDetectingBranches == changedField
|| &wellHeadPosition == changedField
|| &wellLabelColor == changedField
|| &showWellsIntersectingVisibleCells == changedField
|| &wellPipeCoordType == changedField)
{
if (m_reservoirView)
@ -293,6 +287,8 @@ void RimEclipseWellCollection::setReservoirView(RimEclipseView* ownerReservoirVi
//--------------------------------------------------------------------------------------------------
void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&showWellsIntersectingVisibleCells);
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well range filter");
filterGroup->add(&wellCellsToRangeFilterMode);
filterGroup->add(&showWellCellFences);
@ -306,12 +302,10 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi
wellHeadGroup->add(&wellLabelColor);
caf::PdmUiGroup* wellPipe = uiOrdering.addNewGroup("Well pipe");
wellPipe->add(&wellPipeVisibility);
wellPipe->add(&pipeScaleFactor);
wellPipe->add(&wellPipeCoordType);
caf::PdmUiGroup* cellCenterSpheres = uiOrdering.addNewGroup("Well cell center spheres");
cellCenterSpheres->add(&wellSphereVisibility);
cellCenterSpheres->add(&cellCenterSpheresScaleFactor);
caf::PdmUiGroup* advancedGroup = uiOrdering.addNewGroup("Advanced");
@ -328,6 +322,39 @@ caf::PdmFieldHandle* RimEclipseWellCollection::objectToggleField()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseWellCollection::initAfterRead()
{
if (obsoleteField_wellPipeVisibility() == PIPES_OPEN_IN_VISIBLE_CELLS)
{
showWellsIntersectingVisibleCells = true;
}
else if (obsoleteField_wellPipeVisibility() == PIPES_FORCE_ALL_OFF)
{
showWellsIntersectingVisibleCells = false;
for (RimEclipseWell* w : wells)
{
w->showWell = false;
}
}
else if (obsoleteField_wellPipeVisibility() == PIPES_FORCE_ALL_ON)
{
showWellsIntersectingVisibleCells = false;
for (RimEclipseWell* w : wells)
{
w->showWell = true;
}
}
else if (obsoleteField_wellPipeVisibility() == PIPES_INDIVIDUALLY)
{
showWellsIntersectingVisibleCells = false;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -88,6 +88,8 @@ public:
typedef caf::AppEnum<RimEclipseWellCollection::WellPipeCoordType> WellPipeCoordEnum;
caf::PdmField<bool> showWellsIntersectingVisibleCells;
caf::PdmField<bool> showWellLabel;
caf::PdmField<cvf::Color3f> wellLabelColor;
@ -98,7 +100,6 @@ public:
caf::PdmField<WellFenceEnum> wellCellFenceType;
caf::PdmField<double> wellCellTransparencyLevel;
caf::PdmField<WellVisibilityEnum> wellPipeVisibility;
caf::PdmField<double> pipeScaleFactor;
caf::PdmField<int> pipeCrossSectionVertexCount;
caf::PdmField<WellPipeCoordEnum> wellPipeCoordType;
@ -110,7 +111,6 @@ public:
caf::PdmField<bool> isAutoDetectingBranches;
caf::PdmField<WellVisibilityEnum> wellSphereVisibility;
caf::PdmField<double> cellCenterSpheresScaleFactor;
@ -128,11 +128,14 @@ protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual caf::PdmFieldHandle* objectToggleField();
private:
virtual void initAfterRead() override;
private:
void calculateWellGeometryVisibility(size_t frameIndex);
RimEclipseView* m_reservoirView;
std::vector< std::vector< cvf::ubyte > >
m_framesOfResultWellPipeVisibilities;
private:
RimEclipseView* m_reservoirView;
std::vector< std::vector< cvf::ubyte > > m_framesOfResultWellPipeVisibilities;
caf::PdmField<WellVisibilityEnum> obsoleteField_wellPipeVisibility;
};