#1128 Use well color along pipe in undefined sections

This commit is contained in:
Magne Sjaastad 2017-01-18 09:44:48 +01:00
parent f5000766c4
commit 8786b863dd
2 changed files with 24 additions and 30 deletions

View File

@ -60,26 +60,6 @@ RivSimWellPipesPartMgr::RivSimWellPipesPartMgr(RimEclipseView* reservoirView, Ri
m_rimReservoirView = reservoirView;
m_rimWell = well;
m_needsTransformUpdate = true;
// Setup a scalar mapper
cvf::ref<cvf::ScalarMapperDiscreteLinear> scalarMapper = new cvf::ScalarMapperDiscreteLinear;
cvf::Color3ubArray legendColors;
legendColors.resize(4);
legendColors[0] = cvf::Color3::GRAY;
legendColors[1] = cvf::Color3::GREEN;
legendColors[2] = cvf::Color3::BLUE;
legendColors[3] = cvf::Color3::RED;
scalarMapper->setColors(legendColors);
scalarMapper->setRange(0.0 , 4.0);
scalarMapper->setLevelCount(4, true);
m_scalarMapper = scalarMapper;
caf::ScalarMapperEffectGenerator surfEffGen(scalarMapper.p(), caf::PO_1);
m_scalarMapperSurfaceEffect = surfEffGen.generateCachedEffect();
caf::ScalarMapperMeshEffectGenerator meshEffGen(scalarMapper.p());
m_scalarMapperMeshEffect = meshEffGen.generateCachedEffect();
}
//--------------------------------------------------------------------------------------------------
@ -267,6 +247,26 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
std::vector<double> wellCellStates;
// Setup a scalar mapper
cvf::ref<cvf::ScalarMapperDiscreteLinear> scalarMapper = new cvf::ScalarMapperDiscreteLinear;
{
cvf::Color3ubArray legendColors;
legendColors.resize(4);
legendColors[0] = cvf::Color3ub(m_rimWell->wellPipeColor());
legendColors[1] = cvf::Color3::GREEN;
legendColors[2] = cvf::Color3::BLUE;
legendColors[3] = cvf::Color3::RED;
scalarMapper->setColors(legendColors);
scalarMapper->setRange(0.0, 4.0);
scalarMapper->setLevelCount(4, true);
}
caf::ScalarMapperEffectGenerator surfEffGen(scalarMapper.p(), caf::PO_1);
cvf::ref<cvf::Effect> scalarMapperSurfaceEffect = surfEffGen.generateUnCachedEffect();
caf::ScalarMapperMeshEffectGenerator meshEffGen(scalarMapper.p());
cvf::ref<cvf::Effect> scalarMapperMeshEffect = meshEffGen.generateUnCachedEffect();
for (brIt = m_wellBranches.begin(); brIt != m_wellBranches.end(); ++brIt)
{
// Initialize well states to "closed" state
@ -330,10 +330,10 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
surfTexCoords = new cvf::Vec2fArray;
}
brIt->m_pipeGeomGenerator->pipeSurfaceTextureCoords( surfTexCoords.p(), wellCellStates, m_scalarMapper.p());
brIt->m_pipeGeomGenerator->pipeSurfaceTextureCoords( surfTexCoords.p(), wellCellStates, scalarMapper.p());
brIt->m_surfaceDrawable->setTextureCoordArray( surfTexCoords.p());
brIt->m_surfacePart->setEffect(m_scalarMapperSurfaceEffect.p());
brIt->m_surfacePart->setEffect(scalarMapperSurfaceEffect.p());
}
// Find or create texture coords array for pipe center line
@ -347,7 +347,7 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
}
// Calculate new texture coordinates
brIt->m_pipeGeomGenerator->centerlineTextureCoords( lineTexCoords.p(), wellCellStates, m_scalarMapper.p());
brIt->m_pipeGeomGenerator->centerlineTextureCoords( lineTexCoords.p(), wellCellStates, scalarMapper.p());
// Set the new texture coordinates
@ -355,7 +355,7 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
// Set effects
brIt->m_centerLinePart->setEffect(m_scalarMapperMeshEffect.p());
brIt->m_centerLinePart->setEffect(scalarMapperMeshEffect.p());
}
}
}

View File

@ -33,7 +33,6 @@ namespace cvf
class Transform;
class Effect;
class DrawableGeo;
class ScalarMapper;
}
class RivPipeGeometryGenerator;
@ -69,7 +68,6 @@ private:
struct RivPipeBranchData
{
std::vector <RigWellResultPoint> m_cellIds;
//std::vector< std::vector<WellCellStatus> > m_cellStatusPrFrame;
cvf::ref<RivPipeGeometryGenerator> m_pipeGeomGenerator;
cvf::ref<cvf::Part> m_surfacePart;
@ -83,9 +81,5 @@ private:
std::list<RivPipeBranchData> m_wellBranches;
cvf::ref<cvf::ScalarMapper> m_scalarMapper;
cvf::ref<cvf::Effect> m_scalarMapperSurfaceEffect;
cvf::ref<cvf::Effect> m_scalarMapperMeshEffect;
std::vector< std::vector <cvf::Vec3d> > m_pipeBranchesCLCoords;
};