#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()
{
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->setValuesAndMD(flowRates, depthValues, RiaDefines::UNIT_NONE, false);
m_tracerName = tracerName;
m_curveAutoName = curveName;
}

View File

@ -38,7 +38,7 @@ public:
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();
virtual QString wellName() const override;
@ -61,7 +61,7 @@ private:
bool isUsingConnectionNumberDepthType() const;
RimWellAllocationPlot* wellAllocationPlot() const;
QString m_tracerName;
QString m_curveAutoName;
int m_groupId;
bool m_doFillCurve;

View File

@ -1059,22 +1059,30 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
std::set<FlowPhase> selectedPhases = m_phaseSelectionMode == FLOW_TYPE_PHASE_SPLIT ?
std::set<FlowPhase>(m_phases().begin(), m_phases().end()) :
std::set<FlowPhase>({ PHASE_TOTAL });
RifWellRftAddress sourceDef = curveDefToAdd.first;
QDateTime timeStep = curveDefToAdd.second;
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 ( curveDefToAdd.first.sourceType() == RifWellRftAddress::RFT )
if ( sourceDef.sourceType() == RifWellRftAddress::RFT )
{
resultPointCalc.reset(new RigRftResultPointCalculator(m_wellName(),
m_branchIndex(),
dynamic_cast<RimEclipseResultCase*>(curveDefToAdd.first.eclCase()),
curveDefToAdd.second));
dynamic_cast<RimEclipseResultCase*>(sourceDef.eclCase()),
timeStep));
}
else if (curveDefToAdd.first.sourceType() == RifWellRftAddress::GRID)
else if (sourceDef.sourceType() == RifWellRftAddress::GRID)
{
resultPointCalc.reset(new RigSimWellResultPointCalculator(m_wellName(),
m_branchIndex(),
dynamic_cast<RimEclipseResultCase*>(curveDefToAdd.first.eclCase()),
curveDefToAdd.second));
dynamic_cast<RimEclipseResultCase*>(sourceDef.eclCase()),
timeStep));
}
@ -1092,14 +1100,30 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
std::vector<QString> tracerNames = wfAccumulator.tracerNames();
for ( const QString& tracerName: tracerNames )
{
const std::vector<double> accFlow = wfAccumulator.accumulatedTracerFlowPrPseudoLength(tracerName, 0);
addStackedCurve(tracerName, depthValues, accFlow, plotTrack, curveGroupId, false);
auto color = tracerName == RIG_FLOW_OIL_NAME ? cvf::Color3f::DARK_GREEN :
tracerName == RIG_FLOW_GAS_NAME ? cvf::Color3f::DARK_RED :
tracerName == RIG_FLOW_WATER_NAME ? cvf::Color3f::BLUE :
cvf::Color3f::DARK_GRAY;
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) )
{
const std::vector<double> accFlow = wfAccumulator.accumulatedTracerFlowPrPseudoLength(tracerName, 0);
addStackedCurve(curveName + ", " + tracerName,
depthValues,
accFlow,
plotTrack,
color,
curveGroupId,
false);
}
}
}
}
else if ( curveDefToAdd.first.sourceType() == RifWellRftAddress::OBSERVED )
else if ( sourceDef.sourceType() == RifWellRftAddress::OBSERVED )
{
RimWellLogFile* const wellLogFile = curveDefToAdd.first.wellLogFile();
RimWellLogFile* const wellLogFile = sourceDef.wellLogFile();
if(wellLogFile!= nullptr)
{
RigWellLogFile* rigWellLogFile = wellLogFile->wellLogFile();
@ -1111,10 +1135,16 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
const auto& channelName = channel->name();
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->values(channelName),
plotTrack,
color,
curveGroupId,
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>& accFlow,
RimWellLogTrack* plotTrack,
cvf::Color3f color,
int curveGroupId,
bool doFillCurve)
{
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->setGroupId(curveGroupId);
curve->setDoFillCurve(doFillCurve);

View File

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

View File

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

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
//--------------------------------------------------------------------------------------------------
RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,