#1113 Made tracer colors consistent, and son to be consistent with default well colors

This commit is contained in:
Jacob Støren
2017-02-02 09:56:39 +01:00
parent 8e4e7f098f
commit b26bd11674
4 changed files with 33 additions and 1 deletions
@@ -26,6 +26,7 @@
#include "RigFlowDiagResults.h" #include "RigFlowDiagResults.h"
#include "RigMainGrid.h" #include "RigMainGrid.h"
#include "RigSingleWellResultsData.h" #include "RigSingleWellResultsData.h"
#include "RimEclipseWellCollection.h"
CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution"); CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution");
@@ -270,6 +271,31 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
return UNDEFINED; return UNDEFINED;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimFlowDiagSolution::tracerColor(QString tracerName)
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
if ( eclCase )
{
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{
if ( wellResults[wIdx]->m_wellName == tracerName )
{
return RimEclipseWellCollection::cycledPaletteColor(wIdx);
}
}
}
return cvf::Color3f::DARK_GRAY;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -25,6 +25,7 @@
#include "cvfBase.h" #include "cvfBase.h"
#include "cvfObject.h" #include "cvfObject.h"
#include "cvfColor3.h"
class RimEclipseWell; class RimEclipseWell;
class RigFlowDiagResults; class RigFlowDiagResults;
@@ -57,6 +58,7 @@ public:
TracerStatusType tracerStatusOverall(QString tracerName); TracerStatusType tracerStatusOverall(QString tracerName);
TracerStatusType tracerStatusInTimeStep(QString tracerName, size_t timeStepIndex); TracerStatusType tracerStatusInTimeStep(QString tracerName, size_t timeStepIndex);
cvf::Color3f tracerColor(QString tracerName);
protected: protected:
@@ -239,8 +239,10 @@ void RimWellAllocationPlot::updateFromWell()
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve; RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
curve->setFlowValues(tracerName, connNumbers, accFlow); curve->setFlowValues(tracerName, connNumbers, accFlow);
curve->setColor( m_flowDiagSolution->tracerColor(tracerName));
plotTrack->addCurve(curve); plotTrack->addCurve(curve);
curve->loadDataAndUpdate(); curve->loadDataAndUpdate();
} }
} }
@@ -256,6 +258,7 @@ void RimWellAllocationPlot::updateFromWell()
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve; RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
curve->setFlowValues("Total", connNumbers, accFlow); curve->setFlowValues("Total", connNumbers, accFlow);
curve->setColor( cvf::Color3f::DARK_GRAY);
plotTrack->addCurve(curve); plotTrack->addCurve(curve);
@@ -116,6 +116,8 @@ public:
const std::vector<cvf::ubyte>& resultWellGeometryVisibilities(size_t frameIndex); const std::vector<cvf::ubyte>& resultWellGeometryVisibilities(size_t frameIndex);
void scheduleIsWellPipesVisibleRecalculation(); void scheduleIsWellPipesVisibleRecalculation();
static cvf::Color3f cycledPaletteColor(size_t colorIndex);
protected: protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
@@ -128,7 +130,6 @@ protected:
private: private:
void calculateWellGeometryVisibility(size_t frameIndex); void calculateWellGeometryVisibility(size_t frameIndex);
static cvf::Color3f cycledPaletteColor(size_t colorIndex);
void updateStateForVisibilityCheckboxes(); void updateStateForVisibilityCheckboxes();
void updateStateFromEnabledChildCount(size_t showLabelCount, caf::PdmField<caf::Tristate>* fieldToUpdate); void updateStateFromEnabledChildCount(size_t showLabelCount, caf::PdmField<caf::Tristate>* fieldToUpdate);