mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2062 Prefix the Saturation title on the x-axis with "Water", "Gas" or "Water/Gas" depending on the curves present in the plot.
This commit is contained in:
parent
65fe3ba902
commit
e83b3a8c02
@ -240,20 +240,8 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(const std::vector<RigFlow
|
||||
|
||||
qwtCurve->setStyle(QwtPlotCurve::Lines);
|
||||
|
||||
bool plotCurveOnRightAxis = false;
|
||||
QColor curveClr = Qt::magenta;
|
||||
switch (curve.ident)
|
||||
{
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::KRW: curveClr = Qt::blue; break;
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::KRG: curveClr = Qt::red; break;
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::KROW: curveClr = QColor(0, 130, 175); break;
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::KROG: curveClr = QColor(225, 110, 0); break;
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::PCOW: curveClr = QColor(0, 130, 175); plotCurveOnRightAxis = true; break;
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::PCOG: curveClr = QColor(225, 110, 0); plotCurveOnRightAxis = true; break;
|
||||
}
|
||||
|
||||
QPen curvePen;
|
||||
curvePen.setColor(curveClr);
|
||||
const QColor curveClr = curveColorFromIdent(curve.ident);
|
||||
const QPen curvePen(curveClr);
|
||||
qwtCurve->setPen(curvePen);
|
||||
|
||||
qwtCurve->setLegendAttribute(QwtPlotCurve::LegendShowLine, true);
|
||||
@ -262,6 +250,7 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(const std::vector<RigFlow
|
||||
|
||||
qwtCurve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
|
||||
|
||||
const bool plotCurveOnRightAxis = (curve.ident == RigFlowDiagSolverInterface::RelPermCurve::PCOW) || (curve.ident == RigFlowDiagSolverInterface::RelPermCurve::PCOG);
|
||||
if (plotCurveOnRightAxis)
|
||||
{
|
||||
QwtSymbol* curveSymbol = new QwtSymbol(QwtSymbol::Ellipse);
|
||||
@ -304,7 +293,7 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(const std::vector<RigFlow
|
||||
}
|
||||
plot->setTitle(titleStr);
|
||||
|
||||
plot->setAxisTitle(QwtPlot::xBottom, "Saturation");
|
||||
plot->setAxisTitle(QwtPlot::xBottom, determineXAxisTitleFromCurveCollection(curveArr));
|
||||
plot->setAxisTitle(QwtPlot::yLeft, "Kr");
|
||||
plot->setAxisTitle(QwtPlot::yRight, "Pc");
|
||||
|
||||
@ -316,6 +305,57 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(const std::vector<RigFlow
|
||||
//plot->setAxisScale(QwtPlot::yLeft, 0, 1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuRelativePermeabilityPlotPanel::determineXAxisTitleFromCurveCollection(const std::vector<RigFlowDiagSolverInterface::RelPermCurve>& curveArr)
|
||||
{
|
||||
bool sawWater = false;
|
||||
bool sawGas = false;
|
||||
|
||||
for (RigFlowDiagSolverInterface::RelPermCurve curve : curveArr)
|
||||
{
|
||||
switch (curve.ident)
|
||||
{
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::KRW: sawWater = true; break;
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::KROW: sawWater = true; break;
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::PCOW: sawWater = true; break;
|
||||
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::KRG: sawGas = true; break;
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::KROG: sawGas = true; break;
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::PCOG: sawGas = true; break;
|
||||
}
|
||||
}
|
||||
|
||||
QString title = "";
|
||||
if (sawWater && sawGas) title = "Water/Gas ";
|
||||
else if (sawWater) title = "Water ";
|
||||
else if (sawGas) title = "Gas ";
|
||||
|
||||
title += "Saturation";
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QColor RiuRelativePermeabilityPlotPanel::curveColorFromIdent(RigFlowDiagSolverInterface::RelPermCurve::Ident ident)
|
||||
{
|
||||
QColor clr = Qt::magenta;
|
||||
switch (ident)
|
||||
{
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::KRW: clr = Qt::blue; break;
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::KRG: clr = Qt::red; break;
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::KROW: clr = QColor(0, 130, 175); break;
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::KROG: clr = QColor(225, 110, 0); break;
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::PCOW: clr = QColor(0, 130, 175); break;
|
||||
case RigFlowDiagSolverInterface::RelPermCurve::PCOG: clr = QColor(225, 110, 0); break;
|
||||
}
|
||||
|
||||
return clr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -48,6 +48,8 @@ private:
|
||||
void plotUiSelectedCurves();
|
||||
static void setPlotDefaults(QwtPlot* plot);
|
||||
static void plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterface::RelPermCurve>& curveArr, double swat, double sgas, QString cellReferenceText, QwtPlot* plot);
|
||||
static QColor curveColorFromIdent(RigFlowDiagSolverInterface::RelPermCurve::Ident ident);
|
||||
static QString determineXAxisTitleFromCurveCollection(const std::vector<RigFlowDiagSolverInterface::RelPermCurve>& curveArr);
|
||||
|
||||
private slots:
|
||||
void slotButtonInButtonGroupClicked(int);
|
||||
|
Loading…
Reference in New Issue
Block a user