#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;
}