#1078 Added show pipe and show spheres to well collection

This commit is contained in:
Magne Sjaastad 2017-01-26 10:27:23 +01:00
parent 8304cb0393
commit f9a9040ed5
8 changed files with 171 additions and 125 deletions

View File

@ -19,6 +19,7 @@
#include "RicEclipseWellFeatureImpl.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "cafSelectionManager.h"
@ -49,3 +50,22 @@ std::vector<RimEclipseWell*> RicEclipseWellFeatureImpl::selectedWells()
return selection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseWellCollection* RicEclipseWellFeatureImpl::wellCollectionFromSelection()
{
std::vector<RimEclipseWell*> selection = selectedWells();
if (selection.size() > 0)
{
RimEclipseWell* firstWell = selection[0];
RimEclipseWellCollection* wellCollection = nullptr;
firstWell->firstAncestorOrThisOfType(wellCollection);
return wellCollection;
}
return nullptr;
}

View File

@ -21,6 +21,7 @@
#include <vector>
class RimEclipseWell;
class RimEclipseWellCollection;
//==================================================================================================
///
@ -30,4 +31,5 @@ class RicEclipseWellFeatureImpl
public:
static bool isAnyWellSelected();
static std::vector<RimEclipseWell*> selectedWells();
static RimEclipseWellCollection* wellCollectionFromSelection();
};

View File

@ -19,7 +19,9 @@
#include "RicEclipseWellShowFeatures.h"
#include "RicEclipseWellFeatureImpl.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include <QAction>
@ -33,14 +35,9 @@ CAF_CMD_SOURCE_INIT(RicEclipseWellShowLabelFeature, "RicEclipseWellShowLabelFeat
void RicEclipseWellShowLabelFeature::onActionTriggered(bool isChecked)
{
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
if (selection.size() > 0)
for (RimEclipseWell* w : selection)
{
RimEclipseWell* well = selection[0];
for (RimEclipseWell* w : selection)
{
w->showWellLabel.setValueWithFieldChanged(isChecked);
}
w->showWellLabel.setValueWithFieldChanged(isChecked);
}
}
@ -59,6 +56,12 @@ void RicEclipseWellShowLabelFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
bool RicEclipseWellShowLabelFeature::isCommandEnabled()
{
RimEclipseWellCollection* wellColl = RicEclipseWellFeatureImpl::wellCollectionFromSelection();
if (wellColl && !wellColl->showWellLabel())
{
return false;
}
return RicEclipseWellFeatureImpl::isAnyWellSelected();
}
@ -93,14 +96,9 @@ CAF_CMD_SOURCE_INIT(RicEclipseWellShowHeadFeature, "RicEclipseWellShowHeadFeatur
void RicEclipseWellShowHeadFeature::onActionTriggered(bool isChecked)
{
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
if (selection.size() > 0)
for (RimEclipseWell* w : selection)
{
RimEclipseWell* well = selection[0];
for (RimEclipseWell* w : selection)
{
w->showWellHead.setValueWithFieldChanged(isChecked);
}
w->showWellHead.setValueWithFieldChanged(isChecked);
}
}
@ -119,6 +117,12 @@ void RicEclipseWellShowHeadFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
bool RicEclipseWellShowHeadFeature::isCommandEnabled()
{
RimEclipseWellCollection* wellColl = RicEclipseWellFeatureImpl::wellCollectionFromSelection();
if (wellColl && !wellColl->showWellHead())
{
return false;
}
return RicEclipseWellFeatureImpl::isAnyWellSelected();
}
@ -154,14 +158,9 @@ CAF_CMD_SOURCE_INIT(RicEclipseWellShowPipeFeature, "RicEclipseWellShowPipeFeatur
void RicEclipseWellShowPipeFeature::onActionTriggered(bool isChecked)
{
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
if (selection.size() > 0)
for (RimEclipseWell* w : selection)
{
RimEclipseWell* well = selection[0];
for (RimEclipseWell* w : selection)
{
w->showWellPipes.setValueWithFieldChanged(isChecked);
}
w->showWellPipe.setValueWithFieldChanged(isChecked);
}
}
@ -180,6 +179,12 @@ void RicEclipseWellShowPipeFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
bool RicEclipseWellShowPipeFeature::isCommandEnabled()
{
RimEclipseWellCollection* wellColl = RicEclipseWellFeatureImpl::wellCollectionFromSelection();
if (wellColl && !wellColl->showWellPipe())
{
return false;
}
return RicEclipseWellFeatureImpl::isAnyWellSelected();
}
@ -193,7 +198,7 @@ bool RicEclipseWellShowPipeFeature::isCommandChecked()
{
RimEclipseWell* well = selection[0];
return well->showWellPipes();
return well->showWellPipe();
}
return false;
@ -215,14 +220,9 @@ CAF_CMD_SOURCE_INIT(RicEclipseWellShowSpheresFeature, "RicEclipseWellShowSpheres
void RicEclipseWellShowSpheresFeature::onActionTriggered(bool isChecked)
{
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
if (selection.size() > 0)
for (RimEclipseWell* w : selection)
{
RimEclipseWell* well = selection[0];
for (RimEclipseWell* w : selection)
{
w->showWellSpheres.setValueWithFieldChanged(isChecked);
}
w->showWellSpheres.setValueWithFieldChanged(isChecked);
}
}
@ -241,6 +241,12 @@ void RicEclipseWellShowSpheresFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
bool RicEclipseWellShowSpheresFeature::isCommandEnabled()
{
RimEclipseWellCollection* wellColl = RicEclipseWellFeatureImpl::wellCollectionFromSelection();
if (wellColl && !wellColl->showWellSpheres())
{
return false;
}
return RicEclipseWellFeatureImpl::isAnyWellSelected();
}

View File

@ -153,7 +153,7 @@ cvf::ref<cvf::Part> RivWellSpheresPartMgr::createPart(std::vector<std::pair<cvf:
cvf::GeometryBuilderTriangles builder;
double characteristicCellSize = m_rimReservoirView->mainGrid()->characteristicIJCellSize();
double cellRadius = m_rimReservoirView->wellCollection()->cellCenterSpheresScaleFactor() * characteristicCellSize;
double cellRadius = m_rimReservoirView->wellCollection()->spheresScaleFactor() * characteristicCellSize;
cvf::GeometryUtils::createSphere(cellRadius, 15, 15, &builder);
vectorDrawable->setGlyph(builder.trianglesUShort().p(), builder.vertices().p());

View File

@ -45,7 +45,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(&showWellPipe, "ShowWellPipe", true, "Show well pipe", "", "", "");
CAF_PDM_InitField(&showWellSpheres, "ShowWellSpheres", false, "Show well spheres", "", "", "");
CAF_PDM_InitField(&pipeScaleFactor, "WellPipeRadiusScale", 1.0, "Well Pipe Scale Factor", "", "", "");
@ -86,7 +86,7 @@ void RimEclipseWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
if (&showWellLabel == changedField ||
&showWellHead == changedField ||
&showWellPipes == changedField ||
&showWellPipe == changedField ||
&showWellSpheres == changedField ||
&wellPipeColor == changedField)
{
@ -204,7 +204,7 @@ void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
caf::PdmUiGroup* pipeGroup = uiOrdering.addNewGroup("Appearance");
pipeGroup->add(&showWellLabel);
pipeGroup->add(&showWellHead);
pipeGroup->add(&showWellPipes);
pipeGroup->add(&showWellPipe);
pipeGroup->add(&showWellSpheres);
pipeGroup->add(&pipeScaleFactor);
@ -214,6 +214,16 @@ void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Range filter");
filterGroup->add(&showWellCells);
filterGroup->add(&showWellCellFence);
RimEclipseWellCollection* wellColl = nullptr;
this->firstAncestorOrThisOfType(wellColl);
if (wellColl)
{
showWellLabel.uiCapability()->setUiReadOnly(!wellColl->showWellLabel());
showWellHead.uiCapability()->setUiReadOnly(!wellColl->showWellHead());
showWellPipe.uiCapability()->setUiReadOnly(!wellColl->showWellPipe());
showWellSpheres.uiCapability()->setUiReadOnly(!wellColl->showWellSpheres());
}
}
//--------------------------------------------------------------------------------------------------
@ -221,10 +231,10 @@ void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
//--------------------------------------------------------------------------------------------------
bool RimEclipseWell::isWellPipeVisible(size_t frameIndex)
{
RimEclipseView* m_reservoirView = nullptr;
this->firstAncestorOrThisOfType(m_reservoirView);
RimEclipseView* reservoirView = nullptr;
this->firstAncestorOrThisOfType(reservoirView);
if (m_reservoirView == nullptr) return false;
if (reservoirView == nullptr) return false;
if (this->wellResults() == nullptr) return false;
if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size())
@ -238,19 +248,22 @@ bool RimEclipseWell::isWellPipeVisible(size_t frameIndex)
return false;
}
if (!m_reservoirView->wellCollection()->isActive())
if (!reservoirView->wellCollection()->isActive())
return false;
if (this->showWell() == false)
if (!this->showWell())
return false;
if (this->showWellPipes() == false)
if (!this->showWellPipe())
return false;
if (m_reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this))
if (!reservoirView->wellCollection()->showWellPipe())
return false;
if (reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this))
return true;
if (m_reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
if (reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
{
return visibleCellsInstersectsWell(frameIndex);
}
@ -285,10 +298,13 @@ bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex)
if (!m_reservoirView->wellCollection()->isActive())
return false;
if (this->showWell() == false)
if (!this->showWell())
return false;
if (this->showWellSpheres() == false)
if (!m_reservoirView->wellCollection()->showWellSpheres())
return false;
if (!this->showWellSpheres())
return false;
if (m_reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this))

View File

@ -70,7 +70,7 @@ public:
caf::PdmField<bool> showWellLabel;
caf::PdmField<bool> showWellHead;
caf::PdmField<bool> showWellPipes;
caf::PdmField<bool> showWellPipe;
caf::PdmField<bool> showWellSpheres;
caf::PdmField<double> pipeScaleFactor;

View File

@ -101,18 +101,21 @@ RimEclipseWellCollection::RimEclipseWellCollection()
CAF_PDM_InitField(&showWellsIntersectingVisibleCells, "ShowWellsIntersectingVisibleCells", true, "Show Wells Intersecting Visible Cells", "", "", "");
// Appearance
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", "", "", "");
CAF_PDM_InitField(&wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum(WELLHEAD_POS_TOP_COLUMN), "Well head position", "", "", "");
CAF_PDM_InitField(&showWellPipe, "ShowWellPipe", true, "Show well pipe", "", "", "");
CAF_PDM_InitField(&showWellSpheres, "ShowWellSpheres", true, "Show well spheres", "", "", "");
// Scaling
CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScale", 1.0, "Well Head Scale Factor", "", "", "");
CAF_PDM_InitField(&pipeScaleFactor, "WellPipeRadiusScale", 0.1, "Well Pipe Scale Factor", "", "", "");
CAF_PDM_InitField(&spheresScaleFactor, "CellCenterSphereScale", 0.2, "Well Sphere Scale factor", "", "", "");
// Color
cvf::Color3f defWellLabelColor = RiaApplication::instance()->preferences()->defaultWellLabelColor();
CAF_PDM_InitField(&wellLabelColor, "WellLabelColor", defWellLabelColor, "Well label color", "", "", "");
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", "", "", "");
pipeCrossSectionVertexCount.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&wellPipeCoordType, "WellPipeCoordType", WellPipeCoordEnum(WELLPIPE_INTERPOLATED), "Well Pipe Coords", "", "", "");
@ -122,14 +125,16 @@ RimEclipseWellCollection::RimEclipseWellCollection()
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, "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(&cellCenterSpheresScaleFactor, "CellCenterSphereScale", 0.2, "Cell Center sphere radius", "", "", "");
CAF_PDM_InitField(&wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum(WELLHEAD_POS_TOP_COLUMN), "Well head position", "", "", "");
CAF_PDM_InitFieldNoDefault(&wells, "Wells", "Wells", "", "", "");
wells.uiCapability()->setUiHidden(true);
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);
m_reservoirView = NULL;
}
@ -207,70 +212,57 @@ bool RimEclipseWellCollection::hasVisibleWellPipes()
//--------------------------------------------------------------------------------------------------
void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (&showWellLabel == changedField || &isActive == changedField)
if (&isActive == changedField)
{
this->updateUiIconFromToggleField();
if (m_reservoirView)
{
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
if (&wellCellsToRangeFilterMode == changedField)
{
if (m_reservoirView)
{
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
else if (&showWellCellFences == changedField)
{
if (m_reservoirView)
{
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
else if (&wellCellTransparencyLevel == changedField)
{
if (m_reservoirView)
{
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
else if (&cellCenterSpheresScaleFactor == changedField)
{
if (m_reservoirView)
{
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
else if (&wellCellFenceType == changedField)
if (m_reservoirView)
{
if (m_reservoirView)
{
if ( &isActive == changedField
|| &showWellLabel == changedField
|| &wellCellsToRangeFilterMode == changedField
|| &showWellCellFences == changedField
|| &wellCellFenceType == changedField)
{
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
else if ( &pipeCrossSectionVertexCount == changedField
|| &pipeScaleFactor == changedField
|| &wellHeadScaleFactor == changedField
|| &showWellHead == changedField
|| &isAutoDetectingBranches == changedField
|| &wellHeadPosition == changedField
|| &wellLabelColor == changedField
|| &showWellsIntersectingVisibleCells == changedField
|| &wellPipeCoordType == changedField)
{
if (m_reservoirView)
else if (&wellCellTransparencyLevel == changedField)
{
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
else if ( &spheresScaleFactor == changedField
|| &showWellSpheres == changedField)
{
m_reservoirView->schedulePipeGeometryRegen();
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
else if ( &pipeCrossSectionVertexCount == changedField
|| &pipeScaleFactor == changedField
|| &wellHeadScaleFactor == changedField
|| &showWellHead == changedField
|| &isAutoDetectingBranches == changedField
|| &wellHeadPosition == changedField
|| &wellLabelColor == changedField
|| &showWellsIntersectingVisibleCells == changedField
|| &wellPipeCoordType == changedField
|| &showWellPipe == changedField)
{
m_reservoirView->schedulePipeGeometryRegen();
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
if ( &showWellPipe == changedField
|| &showWellSpheres == changedField
|| &showWellHead == changedField
|| &showWellLabel == changedField)
{
for (RimEclipseWell* w : wells)
{
w->updateConnectedEditors();
}
}
}
@ -289,28 +281,34 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi
{
uiOrdering.add(&showWellsIntersectingVisibleCells);
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well range filter");
filterGroup->add(&wellCellsToRangeFilterMode);
filterGroup->add(&showWellCellFences);
filterGroup->add(&wellCellFenceType);
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
appearanceGroup->add(&showWellLabel);
appearanceGroup->add(&showWellHead);
appearanceGroup->add(&showWellPipe);
appearanceGroup->add(&showWellSpheres);
caf::PdmUiGroup* wellHeadGroup = uiOrdering.addNewGroup("Well head");
wellHeadGroup->add(&showWellHead);
wellHeadGroup->add(&wellHeadScaleFactor);
wellHeadGroup->add(&showWellLabel);
wellHeadGroup->add(&wellHeadPosition);
wellHeadGroup->add(&wellLabelColor);
caf::PdmUiGroup* sizeScalingGroup = uiOrdering.addNewGroup("Size Scaling");
sizeScalingGroup->add(&wellHeadScaleFactor);
sizeScalingGroup->add(&pipeScaleFactor);
sizeScalingGroup->add(&spheresScaleFactor);
caf::PdmUiGroup* colorGroup = uiOrdering.addNewGroup("Color");
colorGroup->add(&wellLabelColor);
caf::PdmUiGroup* wellPipe = uiOrdering.addNewGroup("Well pipe");
wellPipe->add(&pipeScaleFactor);
wellPipe->add(&wellPipeCoordType);
caf::PdmUiGroup* cellCenterSpheres = uiOrdering.addNewGroup("Well cell center spheres");
cellCenterSpheres->add(&cellCenterSpheresScaleFactor);
caf::PdmUiGroup* advancedGroup = uiOrdering.addNewGroup("Advanced");
advancedGroup->add(&wellCellTransparencyLevel);
advancedGroup->add(&isAutoDetectingBranches);
caf::PdmUiGroup* wellHeadGroup = uiOrdering.addNewGroup("Well head");
wellHeadGroup->add(&wellHeadPosition);
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well range filter");
filterGroup->add(&wellCellsToRangeFilterMode);
filterGroup->add(&showWellCellFences);
filterGroup->add(&wellCellFenceType);
}
//--------------------------------------------------------------------------------------------------

View File

@ -88,30 +88,34 @@ public:
typedef caf::AppEnum<RimEclipseWellCollection::WellPipeCoordType> WellPipeCoordEnum;
caf::PdmField<bool> isActive;
caf::PdmField<bool> showWellsIntersectingVisibleCells;
caf::PdmField<bool> showWellLabel;
caf::PdmField<bool> showWellHead;
caf::PdmField<bool> showWellPipe;
caf::PdmField<bool> showWellSpheres;
caf::PdmField<double> wellHeadScaleFactor;
caf::PdmField<double> pipeScaleFactor;
caf::PdmField<double> spheresScaleFactor;
caf::PdmField<cvf::Color3f> wellLabelColor;
caf::PdmField<bool> isActive;
caf::PdmField<WellCellsRangeFilterEnum> wellCellsToRangeFilterMode;
caf::PdmField<bool> showWellCellFences;
caf::PdmField<WellFenceEnum> wellCellFenceType;
caf::PdmField<double> wellCellTransparencyLevel;
caf::PdmField<double> pipeScaleFactor;
caf::PdmField<int> pipeCrossSectionVertexCount;
caf::PdmField<WellPipeCoordEnum> wellPipeCoordType;
caf::PdmField<double> wellHeadScaleFactor;
caf::PdmField<bool> showWellHead;
caf::PdmField<WellHeadPositionEnum> wellHeadPosition;
caf::PdmField<bool> isAutoDetectingBranches;
caf::PdmField<double> cellCenterSpheresScaleFactor;
caf::PdmChildArrayField<RimEclipseWell*> wells;