#1178 Use well colors for Max Fraction Tracer

This commit is contained in:
Magne Sjaastad
2017-02-10 18:53:14 +01:00
parent 9fa772a7bc
commit b3e845ed5e
4 changed files with 58 additions and 8 deletions

View File

@@ -18,6 +18,7 @@
#include "RimFlowDiagSolution.h"
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RigActiveCellInfo.h"
@@ -28,6 +29,7 @@
#include "RigSingleWellResultsData.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution");
@@ -283,15 +285,29 @@ cvf::Color3f RimFlowDiagSolution::tracerColor(QString tracerName)
if ( eclCase )
{
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
const caf::ColorTable& colorTable = RiaColorTables::wellsPaletteColors();
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
if (activeView)
{
if ( wellResults[wIdx]->m_wellName == tracerName )
RimEclipseWell* well = activeView->wellCollection->findWell(tracerName);
if (well)
{
return colorTable.cycledColor3f(wIdx);
return well->wellPipeColor();
}
}
else
{
// If we do not find a well color, use index in well result data to be able to get variation of tracer colors
// This can be the case if we do not have any views at all
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{
if ( wellResults[wIdx]->m_wellName == tracerName )
{
return RiaColorTables::wellsPaletteColors().cycledColor3f(wIdx);
}
}
}
}