#2035 Add color and legend text to the PLT curves

This commit is contained in:
Jacob Støren 2017-11-08 11:22:16 +01:00
parent 9ce06a9084
commit 014dd9497a
6 changed files with 53 additions and 24 deletions

View File

@ -126,7 +126,7 @@ bool RimWellFlowRateCurve::doFillCurve() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimWellFlowRateCurve::createCurveAutoName() QString RimWellFlowRateCurve::createCurveAutoName()
{ {
return m_tracerName; return m_curveAutoName;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -315,12 +315,12 @@ RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::setFlowValuesPrDepthValue(const QString& tracerName, const std::vector<double>& depthValues, const std::vector<double>& flowRates) void RimWellFlowRateCurve::setFlowValuesPrDepthValue(const QString& curveName, const std::vector<double>& depthValues, const std::vector<double>& flowRates)
{ {
m_curveData = new RigWellLogCurveData; m_curveData = new RigWellLogCurveData;
m_curveData->setValuesAndMD(flowRates, depthValues, RiaDefines::UNIT_NONE, false); m_curveData->setValuesAndMD(flowRates, depthValues, RiaDefines::UNIT_NONE, false);
m_tracerName = tracerName; m_curveAutoName = curveName;
} }

View File

@ -38,7 +38,7 @@ public:
RimWellFlowRateCurve(); RimWellFlowRateCurve();
virtual ~RimWellFlowRateCurve(); virtual ~RimWellFlowRateCurve();
void setFlowValuesPrDepthValue(const QString& tracerName , const std::vector<double>& depthValues, const std::vector<double>& flowRates); void setFlowValuesPrDepthValue(const QString& curveName , const std::vector<double>& depthValues, const std::vector<double>& flowRates);
void updateStackedPlotData(); void updateStackedPlotData();
virtual QString wellName() const override; virtual QString wellName() const override;
@ -61,7 +61,7 @@ private:
bool isUsingConnectionNumberDepthType() const; bool isUsingConnectionNumberDepthType() const;
RimWellAllocationPlot* wellAllocationPlot() const; RimWellAllocationPlot* wellAllocationPlot() const;
QString m_tracerName; QString m_curveAutoName;
int m_groupId; int m_groupId;
bool m_doFillCurve; bool m_doFillCurve;

View File

@ -1060,21 +1060,29 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
std::set<FlowPhase>(m_phases().begin(), m_phases().end()) : std::set<FlowPhase>(m_phases().begin(), m_phases().end()) :
std::set<FlowPhase>({ PHASE_TOTAL }); std::set<FlowPhase>({ PHASE_TOTAL });
std::unique_ptr<RigResultPointCalculator> resultPointCalc; RifWellRftAddress sourceDef = curveDefToAdd.first;
QDateTime timeStep = curveDefToAdd.second;
if ( curveDefToAdd.first.sourceType() == RifWellRftAddress::RFT ) std::unique_ptr<RigResultPointCalculator> resultPointCalc;
QString curveName;
curveName += sourceDef.eclCase() ? sourceDef.eclCase()->caseUserDescription() : "";
curveName += sourceDef.wellLogFile() ? sourceDef.wellLogFile()->name() : "";
if (sourceDef.sourceType() == RifWellRftAddress::RFT) curveName += ", RFT";
curveName += ", " + timeStep.toString();
if ( sourceDef.sourceType() == RifWellRftAddress::RFT )
{ {
resultPointCalc.reset(new RigRftResultPointCalculator(m_wellName(), resultPointCalc.reset(new RigRftResultPointCalculator(m_wellName(),
m_branchIndex(), m_branchIndex(),
dynamic_cast<RimEclipseResultCase*>(curveDefToAdd.first.eclCase()), dynamic_cast<RimEclipseResultCase*>(sourceDef.eclCase()),
curveDefToAdd.second)); timeStep));
} }
else if (curveDefToAdd.first.sourceType() == RifWellRftAddress::GRID) else if (sourceDef.sourceType() == RifWellRftAddress::GRID)
{ {
resultPointCalc.reset(new RigSimWellResultPointCalculator(m_wellName(), resultPointCalc.reset(new RigSimWellResultPointCalculator(m_wellName(),
m_branchIndex(), m_branchIndex(),
dynamic_cast<RimEclipseResultCase*>(curveDefToAdd.first.eclCase()), dynamic_cast<RimEclipseResultCase*>(sourceDef.eclCase()),
curveDefToAdd.second)); timeStep));
} }
@ -1092,14 +1100,30 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
std::vector<QString> tracerNames = wfAccumulator.tracerNames(); std::vector<QString> tracerNames = wfAccumulator.tracerNames();
for ( const QString& tracerName: tracerNames ) for ( const QString& tracerName: tracerNames )
{ {
const std::vector<double> accFlow = wfAccumulator.accumulatedTracerFlowPrPseudoLength(tracerName, 0); auto color = tracerName == RIG_FLOW_OIL_NAME ? cvf::Color3f::DARK_GREEN :
addStackedCurve(tracerName, depthValues, accFlow, plotTrack, curveGroupId, false); tracerName == RIG_FLOW_GAS_NAME ? cvf::Color3f::DARK_RED :
} tracerName == RIG_FLOW_WATER_NAME ? cvf::Color3f::BLUE :
} cvf::Color3f::DARK_GRAY;
}
else if ( curveDefToAdd.first.sourceType() == RifWellRftAddress::OBSERVED ) if ( tracerName == RIG_FLOW_OIL_NAME && selectedPhases.count(PHASE_OIL)
|| tracerName == RIG_FLOW_GAS_NAME && selectedPhases.count(PHASE_GAS)
|| tracerName == RIG_FLOW_WATER_NAME && selectedPhases.count(PHASE_WATER) )
{ {
RimWellLogFile* const wellLogFile = curveDefToAdd.first.wellLogFile(); const std::vector<double> accFlow = wfAccumulator.accumulatedTracerFlowPrPseudoLength(tracerName, 0);
addStackedCurve(curveName + ", " + tracerName,
depthValues,
accFlow,
plotTrack,
color,
curveGroupId,
false);
}
}
}
}
else if ( sourceDef.sourceType() == RifWellRftAddress::OBSERVED )
{
RimWellLogFile* const wellLogFile = sourceDef.wellLogFile();
if(wellLogFile!= nullptr) if(wellLogFile!= nullptr)
{ {
RigWellLogFile* rigWellLogFile = wellLogFile->wellLogFile(); RigWellLogFile* rigWellLogFile = wellLogFile->wellLogFile();
@ -1111,10 +1135,16 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
const auto& channelName = channel->name(); const auto& channelName = channel->name();
if (selectedPhases.count(flowPhaseFromChannelName(channelName)) > 0) if (selectedPhases.count(flowPhaseFromChannelName(channelName)) > 0)
{ {
addStackedCurve(channelName, auto color = channelName == OIL_CHANNEL_NAME ? cvf::Color3f::DARK_GREEN :
channelName == GAS_CHANNEL_NAME ? cvf::Color3f::DARK_RED :
channelName == WATER_CHANNEL_NAME ? cvf::Color3f::BLUE :
cvf::Color3f::DARK_GRAY;
addStackedCurve(curveName + ", " + channelName,
rigWellLogFile->depthValues(), rigWellLogFile->depthValues(),
rigWellLogFile->values(channelName), rigWellLogFile->values(channelName),
plotTrack, plotTrack,
color,
curveGroupId, curveGroupId,
true); true);
} }
@ -1129,20 +1159,17 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellPltPlot::addStackedCurve(const QString& channelName, void RimWellPltPlot::addStackedCurve(const QString& curveName,
const std::vector<double>& depthValues, const std::vector<double>& depthValues,
const std::vector<double>& accFlow, const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack, RimWellLogTrack* plotTrack,
cvf::Color3f color,
int curveGroupId, int curveGroupId,
bool doFillCurve) bool doFillCurve)
{ {
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve; RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
curve->setFlowValuesPrDepthValue(channelName, depthValues, accFlow); curve->setFlowValuesPrDepthValue(curveName, depthValues, accFlow);
auto color = channelName == OIL_CHANNEL_NAME ? cvf::Color3f::DARK_GREEN :
channelName == GAS_CHANNEL_NAME ? cvf::Color3f::DARK_RED :
channelName == WATER_CHANNEL_NAME ? cvf::Color3f::BLUE :
cvf::Color3f::DARK_GRAY;
curve->setColor(color); curve->setColor(color);
curve->setGroupId(curveGroupId); curve->setGroupId(curveGroupId);
curve->setDoFillCurve(doFillCurve); curve->setDoFillCurve(doFillCurve);

View File

@ -151,6 +151,7 @@ private:
const std::vector<double>& depthValues, const std::vector<double>& depthValues,
const std::vector<double>& accFlow, const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack, RimWellLogTrack* plotTrack,
cvf::Color3f color,
int curveGroupId, int curveGroupId,
bool doFillCurve); bool doFillCurve);

View File

@ -58,6 +58,7 @@ public:
void setFileName(const QString& fileName); void setFileName(const QString& fileName);
QString fileName() const { return m_fileName; } QString fileName() const { return m_fileName; }
QString name() const { return m_name; }
bool readFile(QString* errorMessage); bool readFile(QString* errorMessage);

View File

@ -50,7 +50,7 @@ size_t RigEclCellIndexCalculator::resultCellIndex(size_t gridIndex, size_t gridC
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
/// The pipeBranchesCellIds are describing the lines between the points, starting with the first line /// The pipeBranchesWellResultPoints are describing the lines between the points, starting with the first line
// and is thus expected to be one less than the number of centerline points // and is thus expected to be one less than the number of centerline points
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords, RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,