#1078 Added possibility to show/hide connection status colors

This commit is contained in:
Magne Sjaastad 2017-01-26 14:25:34 +01:00
parent 329bed71a4
commit d0f613520e
5 changed files with 130 additions and 94 deletions

View File

@ -240,49 +240,57 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
wellCellStates.clear();
wellCellStates.resize(brIt->m_cellIds.size(), closed);
const std::vector <RigWellResultPoint>& cellIds = brIt->m_cellIds;
for (size_t wcIdx = 0; wcIdx < cellIds.size(); ++wcIdx)
RimEclipseWellCollection* wellColl = nullptr;
if (m_rimWell)
{
// we need a faster lookup, I guess
const RigWellResultPoint* wResCell = NULL;
m_rimWell->firstAncestorOrThisOfType(wellColl);
}
if (wellColl && wellColl->showConnectionStatusColors())
{
const std::vector <RigWellResultPoint>& cellIds = brIt->m_cellIds;
for (size_t wcIdx = 0; wcIdx < cellIds.size(); ++wcIdx)
{
// we need a faster lookup, I guess
const RigWellResultPoint* wResCell = NULL;
if (cellIds[wcIdx].isCell())
{
wResCell = wResFrame.findResultCell(cellIds[wcIdx].m_gridIndex, cellIds[wcIdx].m_gridCellIndex);
}
if (wResCell == NULL)
{
// We cant find any state. This well cell is closed.
}
else
{
double cellState = closed;
if (wResCell->m_isOpen)
if (cellIds[wcIdx].isCell())
{
switch (wResFrame.m_productionType)
{
case RigWellResultFrame::PRODUCER:
cellState = producing;
break;
case RigWellResultFrame::OIL_INJECTOR:
cellState = hcInjection;
break;
case RigWellResultFrame::GAS_INJECTOR:
cellState = hcInjection;
break;
case RigWellResultFrame::WATER_INJECTOR:
cellState = water;
break;
case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE:
cellState = closed;
break;
}
wResCell = wResFrame.findResultCell(cellIds[wcIdx].m_gridIndex, cellIds[wcIdx].m_gridCellIndex);
}
wellCellStates[wcIdx] = cellState;
if (wResCell == NULL)
{
// We cant find any state. This well cell is closed.
}
else
{
double cellState = closed;
if (wResCell->m_isOpen)
{
switch (wResFrame.m_productionType)
{
case RigWellResultFrame::PRODUCER:
cellState = producing;
break;
case RigWellResultFrame::OIL_INJECTOR:
cellState = hcInjection;
break;
case RigWellResultFrame::GAS_INJECTOR:
cellState = hcInjection;
break;
case RigWellResultFrame::WATER_INJECTOR:
cellState = water;
break;
case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE:
cellState = closed;
break;
}
}
wellCellStates[wcIdx] = cellState;
}
}
}

View File

@ -250,25 +250,39 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
part->setDrawable(geo1.p());
cvf::Color4f headColor(cvf::Color3::GRAY);
if (wellResultFrame.m_isOpen)
RimEclipseWellCollection* wellColl = nullptr;
if (m_rimWell)
{
if (wellResultFrame.m_productionType == RigWellResultFrame::PRODUCER)
m_rimWell->firstAncestorOrThisOfType(wellColl);
}
if (wellColl && wellColl->showConnectionStatusColors())
{
if (wellResultFrame.m_isOpen)
{
headColor = cvf::Color4f(cvf::Color3::GREEN);
}
else if (wellResultFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR)
{
headColor = cvf::Color4f(cvf::Color3::ORANGE);
}
else if (wellResultFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR)
{
headColor = cvf::Color4f(cvf::Color3::RED);
}
else if (wellResultFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR)
{
headColor = cvf::Color4f(cvf::Color3::BLUE);
if (wellResultFrame.m_productionType == RigWellResultFrame::PRODUCER)
{
headColor = cvf::Color4f(cvf::Color3::GREEN);
}
else if (wellResultFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR)
{
headColor = cvf::Color4f(cvf::Color3::ORANGE);
}
else if (wellResultFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR)
{
headColor = cvf::Color4f(cvf::Color3::RED);
}
else if (wellResultFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR)
{
headColor = cvf::Color4f(cvf::Color3::BLUE);
}
}
}
else
{
headColor = cvf::Color4f(m_rimWell->wellPipeColor());
}
caf::SurfaceEffectGenerator surfaceGen(headColor, caf::PO_1);
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();

View File

@ -186,29 +186,42 @@ cvf::Color3f RivWellSpheresPartMgr::wellCellColor(const RigWellResultFrame& well
{
// Colours should be synchronized with RivWellPipesPartMgr::updatePipeResultColor
cvf::Color3f cellColor(cvf::Color3f::GRAY);
if (wellResultPoint.m_isOpen)
cvf::Color3f cellColor(m_rimWell->wellPipeColor());
RimEclipseWellCollection* wellColl = nullptr;
if (m_rimWell)
{
switch (wellResultFrame.m_productionType)
m_rimWell->firstAncestorOrThisOfType(wellColl);
}
if (wellColl && wellColl->showConnectionStatusColors())
{
if (wellResultPoint.m_isOpen)
{
case RigWellResultFrame::PRODUCER:
cellColor = cvf::Color3f::GREEN;
break;
case RigWellResultFrame::OIL_INJECTOR:
cellColor = cvf::Color3f::RED;
break;
case RigWellResultFrame::GAS_INJECTOR:
cellColor = cvf::Color3f::RED;
break;
case RigWellResultFrame::WATER_INJECTOR:
cellColor = cvf::Color3f::BLUE;
break;
case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE:
cellColor = cvf::Color3f::GRAY;
break;
switch (wellResultFrame.m_productionType)
{
case RigWellResultFrame::PRODUCER:
cellColor = cvf::Color3f::GREEN;
break;
case RigWellResultFrame::OIL_INJECTOR:
cellColor = cvf::Color3f::RED;
break;
case RigWellResultFrame::GAS_INJECTOR:
cellColor = cvf::Color3f::RED;
break;
case RigWellResultFrame::WATER_INJECTOR:
cellColor = cvf::Color3f::BLUE;
break;
case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE:
cellColor = cvf::Color3f::GRAY;
break;
}
}
}
else
{
cellColor = m_rimWell->wellPipeColor();
}
return cellColor;
}

View File

@ -75,8 +75,8 @@ namespace caf
template<>
void RimEclipseWellCollection::WellHeadPositionEnum::setUp()
{
addItem(RimEclipseWellCollection::WELLHEAD_POS_ACTIVE_CELLS_BB, "WELLHEAD_POS_ACTIVE_CELLS_BB", "Top of active cells BB");
addItem(RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN, "WELLHEAD_POS_TOP_COLUMN", "Top of active cells IJ-column");
addItem(RimEclipseWellCollection::WELLHEAD_POS_ACTIVE_CELLS_BB, "WELLHEAD_POS_ACTIVE_CELLS_BB", "All Active Cells");
addItem(RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN, "WELLHEAD_POS_TOP_COLUMN", "Active Cell Column");
setDefault(RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN);
}
}
@ -121,16 +121,18 @@ RimEclipseWellCollection::RimEclipseWellCollection()
cvf::Color3f defWellLabelColor = RiaApplication::instance()->preferences()->defaultWellLabelColor();
CAF_PDM_InitField(&wellLabelColor, "WellLabelColor", defWellLabelColor, "Well label color", "", "", "");
cvf::Color3f defaultApplyColor = cvf::Color3f::YELLOW;
CAF_PDM_InitField(&m_wellColorForApply, "WellColorForApply", defaultApplyColor, "Color", "", "", "");
CAF_PDM_InitField(&showConnectionStatusColors, "ShowConnectionStatusColors", true, "Show Connection Status Colors Along Well", "", "", "");
CAF_PDM_InitField(&m_applySingleColorToWells, "ApplySingleColorToWells", false, "Apply Single Color", "", "", "");
cvf::Color3f defaultApplyColor = cvf::Color3f::YELLOW;
CAF_PDM_InitField(&m_wellColorForApply, "WellColorForApply", defaultApplyColor, "Single Well Color", "", "", "");
CAF_PDM_InitField(&m_applySingleColorToWells, "ApplySingleColorToWells", false, "", "", "", "");
m_applySingleColorToWells.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName());
m_applySingleColorToWells.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
m_applySingleColorToWells.xmlCapability()->setIOReadable(false);
m_applySingleColorToWells.xmlCapability()->setIOWritable(false);
CAF_PDM_InitField(&m_applyIndividualColorsToWells, "ApplyIndividualColorsToWells", false, "Apply Individual Colors", "", "", "");
CAF_PDM_InitField(&m_applyIndividualColorsToWells, "ApplyIndividualColorsToWells", false, "", "", "", "");
m_applyIndividualColorsToWells.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName());
m_applyIndividualColorsToWells.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
m_applyIndividualColorsToWells.xmlCapability()->setIOReadable(false);
@ -138,15 +140,15 @@ RimEclipseWellCollection::RimEclipseWellCollection()
CAF_PDM_InitField(&pipeCrossSectionVertexCount, "WellPipeVertexCount", 12, "Pipe vertex count", "", "", "");
pipeCrossSectionVertexCount.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&wellPipeCoordType, "WellPipeCoordType", WellPipeCoordEnum(WELLPIPE_INTERPOLATED), "Well Pipe Coords", "", "", "");
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(&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(&wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum(WELLHEAD_POS_TOP_COLUMN), "Well head position", "", "", "");
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", "");
CAF_PDM_InitField(&wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum(WELLHEAD_POS_TOP_COLUMN), "Well Head Position On Top Of", "", "", "");
CAF_PDM_InitFieldNoDefault(&wells, "Wells", "Wells", "", "", "");
wells.uiCapability()->setUiHidden(true);
@ -253,7 +255,8 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
else if ( &spheresScaleFactor == changedField
|| &showWellSpheres == changedField)
|| &showWellSpheres == changedField
|| &showConnectionStatusColors == changedField)
{
m_reservoirView->schedulePipeGeometryRegen();
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
@ -346,19 +349,18 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi
colorGroup->add(&wellLabelColor);
colorGroup->add(&m_applyIndividualColorsToWells);
caf::PdmUiGroup* singleColorGroup = colorGroup->addNewGroup("Single Well Color");
singleColorGroup->add(&m_wellColorForApply);
singleColorGroup->add(&m_applySingleColorToWells);
colorGroup->add(&m_wellColorForApply);
colorGroup->add(&m_applySingleColorToWells);
caf::PdmUiGroup* wellPipe = uiOrdering.addNewGroup("Well pipe");
wellPipe->add(&wellPipeCoordType);
colorGroup->add(&showConnectionStatusColors);
uiOrdering.add(&wellPipeCoordType);
caf::PdmUiGroup* advancedGroup = uiOrdering.addNewGroup("Advanced");
advancedGroup->add(&wellCellTransparencyLevel);
advancedGroup->add(&isAutoDetectingBranches);
advancedGroup->add(&wellCellTransparencyLevel);
caf::PdmUiGroup* wellHeadGroup = uiOrdering.addNewGroup("Well head");
wellHeadGroup->add(&wellHeadPosition);
uiOrdering.add(&wellHeadPosition);
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well range filter");
filterGroup->add(&wellCellsToRangeFilterMode);

View File

@ -99,6 +99,8 @@ public:
caf::PdmField<double> spheresScaleFactor;
caf::PdmField<cvf::Color3f> wellLabelColor;
caf::PdmField<bool> showConnectionStatusColors;
caf::PdmField<WellCellsRangeFilterEnum> wellCellsToRangeFilterMode;
caf::PdmField<bool> showWellCellFences;
@ -110,10 +112,7 @@ public:
caf::PdmField<WellHeadPositionEnum> wellHeadPosition;
caf::PdmField<bool> isAutoDetectingBranches;
caf::PdmChildArrayField<RimEclipseWell*> wells;