#1078 Improved well cells and well cell fence settings

This commit is contained in:
Magne Sjaastad 2017-01-26 17:41:34 +01:00
parent d0f613520e
commit 8f4fa4592a
6 changed files with 62 additions and 38 deletions

View File

@ -1131,7 +1131,7 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC
visibleCells->setAll(false);
// If all wells are forced off, return
if (this->wellCollection()->wellCellsToRangeFilterMode() == RimEclipseWellCollection::RANGE_ADD_NONE) return;
if (!this->wellCollection()->showWellCells()) return;
RigActiveCellInfo* activeCellInfo = this->currentActiveCellInfo();
@ -1141,7 +1141,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()->wellCellsToRangeFilterMode() == RimEclipseWellCollection::RANGE_ADD_ALL || (well->showWell() && well->showWellCells()) )
if (this->wellCollection()->showWellCells() && well->showWell() && well->showWellCells())
{
RigSingleWellResultsData* wres = well->wellResults();
if (!wres) continue;
@ -1180,7 +1180,7 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC
(*visibleCells)[gridCellIndex] = true;
// Calculate well fence cells
if (well->showWellCellFence() || this->wellCollection()->showWellCellFences())
if (well->showWellCellFence() && this->wellCollection()->showWellCellFence())
{
size_t i, j, k;
grid->ijkFromCellIndex(gridCellIndex, &i, &j, &k);

View File

@ -51,8 +51,8 @@ RimEclipseWell::RimEclipseWell()
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", "", "", "");
CAF_PDM_InitField(&showWellCells, "ShowWellCells", true, "Add cells to range filter", "", "", "");
CAF_PDM_InitField(&showWellCellFence, "ShowWellCellFence", false, "Use well fence", "", "", "");
CAF_PDM_InitField(&showWellCells, "ShowWellCells", true, "Show Well Cells", "", "", "");
CAF_PDM_InitField(&showWellCellFence, "ShowWellCellFence", false, "Show Well Cell Fence", "", "", "");
name.uiCapability()->setUiHidden(true);
name.uiCapability()->setUiReadOnly(true);

View File

@ -28,6 +28,7 @@
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RiuMainWindow.h"
#include "RivReservoirViewPartMgr.h"
#include "cafPdmUiPushButtonEditor.h"
@ -49,6 +50,7 @@ namespace caf
namespace caf
{
// OBSOLETE enum
template<>
void RimEclipseWellCollection::WellCellsRangeFilterEnum::setUp()
{
@ -142,9 +144,9 @@ RimEclipseWellCollection::RimEclipseWellCollection()
pipeCrossSectionVertexCount.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&wellPipeCoordType, "WellPipeCoordType", WellPipeCoordEnum(WELLPIPE_INTERPOLATED), "Well Pipe Geometry", "", "", "");
CAF_PDM_InitField(&wellCellsToRangeFilterMode, "GlobalWellCellVisibility", WellCellsRangeFilterEnum(RANGE_ADD_NONE), "Add cells to range filter", "", "", "");
CAF_PDM_InitField(&showWellCellFences, "ShowWellFences", false, "Use well fence", "", "", "");
CAF_PDM_InitField(&wellCellFenceType, "DefaultWellFenceDirection", WellFenceEnum(K_DIRECTION), "Well Fence direction", "", "", "");
CAF_PDM_InitField(&showWellCells, "ShowWellCells", false, "Show Well Cells", "", "", "");
CAF_PDM_InitField(&showWellCellFence, "ShowWellFences", false, "Show Well Cell Fence", "", "", "");
CAF_PDM_InitField(&wellCellFenceType, "DefaultWellFenceDirection", WellFenceEnum(K_DIRECTION), "Well Fence Direction", "", "", "");
CAF_PDM_InitField(&wellCellTransparencyLevel, "WellCellTransparency", 0.5, "Well Cell Transparency", "", "", "");
CAF_PDM_InitField(&isAutoDetectingBranches, "IsAutoDetectingBranches", true, "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", "");
@ -156,6 +158,10 @@ RimEclipseWellCollection::RimEclipseWellCollection()
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(&obsoleteField_wellCellsToRangeFilterMode, "GlobalWellCellVisibility", WellCellsRangeFilterEnum(RANGE_ADD_NONE), "Add cells to range filter", "", "", "");
obsoleteField_wellCellsToRangeFilterMode.uiCapability()->setUiHidden(true);
obsoleteField_wellCellsToRangeFilterMode.xmlCapability()->setIOWritable(false);
m_reservoirView = NULL;
}
@ -189,14 +195,14 @@ RimEclipseWell* RimEclipseWellCollection::findWell(QString name)
bool RimEclipseWellCollection::hasVisibleWellCells()
{
if (!this->isActive()) return false;
if (this->wellCellsToRangeFilterMode() == RANGE_ADD_NONE) return false;
if (!this->showWellCells()) return false;
if (this->wells().size() == 0 ) return false;
bool hasCells = false;
for (size_t i = 0 ; !hasCells && i < this->wells().size(); ++i)
{
RimEclipseWell* well = this->wells()[i];
if ( well && well->wellResults() && ((well->showWell() && well->showWellCells()) || this->wellCellsToRangeFilterMode() == RANGE_ADD_ALL) )
if ( well && well->wellResults() && ((well->showWell() && well->showWellCells())) )
{
for (size_t tIdx = 0; !hasCells && tIdx < well->wellResults()->m_wellCellsTimeSteps.size(); ++tIdx )
{
@ -211,8 +217,6 @@ bool RimEclipseWellCollection::hasVisibleWellCells()
if (!hasCells) return false;
if (this->wellCellsToRangeFilterMode() == RANGE_ADD_INDIVIDUAL || this->wellCellsToRangeFilterMode() == RANGE_ADD_ALL) return true;
// Todo: Handle range filter intersection
return true;
@ -243,8 +247,8 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
{
if ( &isActive == changedField
|| &showWellLabel == changedField
|| &wellCellsToRangeFilterMode == changedField
|| &showWellCellFences == changedField
|| &showWellCells == changedField
|| &showWellCellFence == changedField
|| &wellCellFenceType == changedField)
{
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
@ -317,6 +321,11 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
m_applySingleColorToWells = false;
}
if (&showWellCells == changedField)
{
RiuMainWindow::instance()->refreshDrawStyleActions();
}
}
//--------------------------------------------------------------------------------------------------
@ -362,9 +371,10 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi
uiOrdering.add(&wellHeadPosition);
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well range filter");
filterGroup->add(&wellCellsToRangeFilterMode);
filterGroup->add(&showWellCellFences);
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well Cells");
filterGroup->add(&obsoleteField_wellCellsToRangeFilterMode);
filterGroup->add(&showWellCells);
filterGroup->add(&showWellCellFence);
filterGroup->add(&wellCellFenceType);
}
@ -408,6 +418,24 @@ void RimEclipseWellCollection::initAfterRead()
{
showWellsIntersectingVisibleCells = false;
}
if (obsoleteField_wellCellsToRangeFilterMode() == RANGE_ADD_NONE)
{
showWellCells = 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;
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -101,9 +101,8 @@ public:
caf::PdmField<cvf::Color3f> wellLabelColor;
caf::PdmField<bool> showConnectionStatusColors;
caf::PdmField<WellCellsRangeFilterEnum> wellCellsToRangeFilterMode;
caf::PdmField<bool> showWellCellFences;
caf::PdmField<bool> showWellCells;
caf::PdmField<bool> showWellCellFence;
caf::PdmField<WellFenceEnum> wellCellFenceType;
caf::PdmField<double> wellCellTransparencyLevel;
@ -145,5 +144,6 @@ private:
caf::PdmField<bool> m_applyIndividualColorsToWells;
// Obsolete fields
caf::PdmField<WellVisibilityEnum> obsoleteField_wellPipeVisibility;
caf::PdmField<WellVisibilityEnum> obsoleteField_wellPipeVisibility;
caf::PdmField<WellCellsRangeFilterEnum> obsoleteField_wellCellsToRangeFilterMode;
};

View File

@ -289,11 +289,10 @@ void RiuMainWindow::createActions()
m_toggleFaultsLabelAction->setCheckable(true);
connect(m_toggleFaultsLabelAction, SIGNAL(toggled(bool)), SLOT(slotToggleFaultLabelsAction(bool)));
m_addWellCellsToRangeFilterAction = new QAction(QIcon(":/draw_style_WellCellsToRangeFilter_24x24.png"), "&Add Well Cells To Range Filter", this);
m_addWellCellsToRangeFilterAction->setCheckable(true);
m_addWellCellsToRangeFilterAction->setToolTip("Add Well Cells To Range Filter based on the individual settings");
connect(m_addWellCellsToRangeFilterAction, SIGNAL(toggled(bool)), SLOT(slotAddWellCellsToRangeFilterAction(bool)));
m_showWellCellsAction = new QAction(QIcon(":/draw_style_WellCellsToRangeFilter_24x24.png"), "&Show Well Cells", this);
m_showWellCellsAction->setCheckable(true);
m_showWellCellsAction->setToolTip("Show Well Cells");
connect(m_showWellCellsAction, SIGNAL(toggled(bool)), SLOT(slotShowWellCellsAction(bool)));
}
//--------------------------------------------------------------------------------------------------
@ -474,7 +473,7 @@ void RiuMainWindow::createToolBars()
dsToolBar->addAction(m_disableLightingAction);
dsToolBar->addAction(m_drawStyleHideGridCellsAction);
dsToolBar->addAction(m_toggleFaultsLabelAction);
dsToolBar->addAction(m_addWellCellsToRangeFilterAction);
dsToolBar->addAction(m_showWellCellsAction);
}
// Create animation toolbar
@ -1376,7 +1375,7 @@ void RiuMainWindow::refreshDrawStyleActions()
enable = enable && eclView;
m_toggleFaultsLabelAction->setEnabled(enable);
m_addWellCellsToRangeFilterAction->setEnabled(enable);
m_showWellCellsAction->setEnabled(enable);
if (enable)
{
@ -1384,9 +1383,9 @@ void RiuMainWindow::refreshDrawStyleActions()
m_toggleFaultsLabelAction->setChecked(eclView->faultCollection()->showFaultLabel());
m_toggleFaultsLabelAction->blockSignals(false);
m_addWellCellsToRangeFilterAction->blockSignals(true);
m_addWellCellsToRangeFilterAction->setChecked(eclView->wellCollection()->wellCellsToRangeFilterMode() != RimEclipseWellCollection::RANGE_ADD_NONE);
m_addWellCellsToRangeFilterAction->blockSignals(false);
m_showWellCellsAction->blockSignals(true);
m_showWellCellsAction->setChecked(eclView->wellCollection()->showWellCells());
m_showWellCellsAction->blockSignals(false);
}
}
@ -1573,15 +1572,12 @@ void RiuMainWindow::setDefaultWindowSize()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotAddWellCellsToRangeFilterAction(bool doAdd)
void RiuMainWindow::slotShowWellCellsAction(bool doAdd)
{
RimEclipseView* riv = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
if (riv)
{
caf::AppEnum<RimEclipseWellCollection::WellCellsRangeFilterType> rangeAddType;
rangeAddType = doAdd ? RimEclipseWellCollection::RANGE_ADD_INDIVIDUAL : RimEclipseWellCollection::RANGE_ADD_NONE;
riv->wellCollection()->wellCellsToRangeFilterMode.setValueWithFieldChanged(rangeAddType);
riv->wellCollection()->showWellCells.setValueWithFieldChanged(doAdd);
}
}

View File

@ -191,7 +191,7 @@ private slots:
void slotToggleFaultLabelsAction(bool);
void slotDisableLightingAction(bool);
void slotAddWellCellsToRangeFilterAction(bool doAdd);
void slotShowWellCellsAction(bool doAdd);
// Debug slots
void slotUseShaders(bool enable);
@ -246,7 +246,7 @@ private:
QAction* m_drawStyleLinesSolidAction;
QAction* m_drawStyleFaultLinesSolidAction;
QAction* m_drawStyleSurfOnlyAction;
QAction* m_addWellCellsToRangeFilterAction;
QAction* m_showWellCellsAction;
std::vector<QPointer<QDockWidget> > additionalProjectViews;