Pvt Plot: Display Rs/Rv values of curve's sample points in tool tip, #2255

This commit is contained in:
sigurdp
2017-12-12 22:40:17 +01:00
parent 607d9fff63
commit f716dacb24
4 changed files with 434 additions and 123 deletions

View File

@@ -715,7 +715,7 @@ std::vector<RigFlowDiagSolverInterface::PvtCurve> RigFlowDiagSolverInterface::ca
{
if (srcGraph.press.size() > 0)
{
retCurveArr.push_back({ PvtCurve::Bo, PvtCurve::OIL, srcGraph.press, srcGraph.value });
retCurveArr.push_back({ PvtCurve::Bo, PvtCurve::OIL, srcGraph.press, srcGraph.value, srcGraph.mixRat });
}
}
}
@@ -727,7 +727,7 @@ std::vector<RigFlowDiagSolverInterface::PvtCurve> RigFlowDiagSolverInterface::ca
{
if (srcGraph.press.size() > 0)
{
retCurveArr.push_back({ PvtCurve::Bg, PvtCurve::GAS, srcGraph.press, srcGraph.value });
retCurveArr.push_back({ PvtCurve::Bg, PvtCurve::GAS, srcGraph.press, srcGraph.value, srcGraph.mixRat });
}
}
}
@@ -742,7 +742,7 @@ std::vector<RigFlowDiagSolverInterface::PvtCurve> RigFlowDiagSolverInterface::ca
{
if (srcGraph.press.size() > 0)
{
retCurveArr.push_back({ PvtCurve::Visc_o, PvtCurve::OIL, srcGraph.press, srcGraph.value });
retCurveArr.push_back({ PvtCurve::Visc_o, PvtCurve::OIL, srcGraph.press, srcGraph.value, srcGraph.mixRat });
}
}
}
@@ -754,7 +754,7 @@ std::vector<RigFlowDiagSolverInterface::PvtCurve> RigFlowDiagSolverInterface::ca
{
if (srcGraph.press.size() > 0)
{
retCurveArr.push_back({ PvtCurve::Visc_g, PvtCurve::GAS, srcGraph.press, srcGraph.value });
retCurveArr.push_back({ PvtCurve::Visc_g, PvtCurve::GAS, srcGraph.press, srcGraph.value, srcGraph.mixRat });
}
}
}

View File

@@ -102,6 +102,7 @@ public:
Phase phase;
std::vector<double> pressureVals;
std::vector<double> yVals;
std::vector<double> mixRatVals;
};
public:

View File

@@ -25,12 +25,17 @@
#include "cvfBase.h"
#include "cvfAssert.h"
//#include "cvfTrace.h"
#include "cvfMath.h"
#include "qwt_plot.h"
#include "qwt_plot_curve.h"
#include "qwt_legend.h"
#include "qwt_symbol.h"
#include "qwt_plot_marker.h"
#include "qwt_plot_grid.h"
#include "qwt_plot_layout.h"
#include "qwt_plot_picker.h"
#include "qwt_picker_machine.h"
#include <QDockWidget>
#include <QHBoxLayout>
@@ -54,6 +59,361 @@ public:
};
//==================================================================================================
//
//
//
//==================================================================================================
class PvtQwtPicker : public QwtPicker
{
public:
PvtQwtPicker(QwtPlot* plot, RiuPvtTrackerTextProvider* trackerTextProvider)
: QwtPicker(QwtPicker::NoRubberBand, QwtPicker::AlwaysOn, plot->canvas()),
m_trackerTextProvider(trackerTextProvider)
{
setStateMachine(new QwtPickerTrackerMachine);
}
virtual QwtText trackerText(const QPoint&) const
{
QwtText text(m_trackerTextProvider->trackerText());
text.setRenderFlags(Qt::AlignLeft);
return text;
}
private:
const RiuPvtTrackerTextProvider* m_trackerTextProvider;
};
//==================================================================================================
///
/// \class RiuPvtPlotWidget
///
///
///
//==================================================================================================
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuPvtPlotWidget::RiuPvtPlotWidget(RiuPvtPlotPanel* parent)
: QWidget(parent),
m_trackerPlotMarker(NULL)
{
m_qwtPlot = new PvtQwtPlot(this);
setPlotDefaults(m_qwtPlot);
QHBoxLayout* layout = new QHBoxLayout();
layout->addWidget(m_qwtPlot);
layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
setLayout(layout);
m_qwtPicker = new PvtQwtPicker(m_qwtPlot, this);
connect(m_qwtPicker, SIGNAL(activated(bool)), this, SLOT(slotPickerActivated(bool)));
connect(m_qwtPicker, SIGNAL(moved(const QPoint&)), this, SLOT(slotPickerPointChanged(const QPoint&)));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPvtPlotWidget::setPlotDefaults(QwtPlot* plot)
{
// Plot background and frame look
QPalette newPalette(plot->palette());
newPalette.setColor(QPalette::Background, Qt::white);
plot->setPalette(newPalette);
plot->setAutoFillBackground(true);
plot->setCanvasBackground(Qt::white);
QFrame* canvasFrame = dynamic_cast<QFrame*>(plot->canvas());
if (canvasFrame)
{
canvasFrame->setFrameShape(QFrame::NoFrame);
}
// Grid
QwtPlotGrid* grid = new QwtPlotGrid;
grid->attach(plot);
QPen gridPen(Qt::SolidLine);
gridPen.setColor(Qt::lightGray);
grid->setPen(gridPen);
// Axis number font
QFont axisFont = plot->axisFont(QwtPlot::xBottom);
axisFont.setPixelSize(11);
plot->setAxisFont(QwtPlot::xBottom, axisFont);
plot->setAxisFont(QwtPlot::yLeft, axisFont);
// Axis title font
QwtText axisTitle = plot->axisTitle(QwtPlot::xBottom);
QFont axisTitleFont = axisTitle.font();
axisTitleFont.setPixelSize(11);
axisTitleFont.setBold(false);
axisTitle.setFont(axisTitleFont);
axisTitle.setRenderFlags(Qt::AlignRight);
plot->setAxisTitle(QwtPlot::xBottom, axisTitle);
plot->setAxisTitle(QwtPlot::yLeft, axisTitle);
plot->setAxisMaxMinor(QwtPlot::xBottom, 2);
plot->setAxisMaxMinor(QwtPlot::yLeft, 3);
plot->plotLayout()->setAlignCanvasToScales(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPvtPlotWidget::plotCurves(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& curveArr, double pressure, double pointMarkerYValue, QString plotTitle, QString yAxisTitle)
{
m_qwtPlot->detachItems(QwtPlotItem::Rtti_PlotCurve);
m_qwtPlot->detachItems(QwtPlotItem::Rtti_PlotMarker);
m_qwtCurveArr.clear();
m_pvtCurveArr.clear();
m_trackerPlotMarker = NULL;
for (size_t i = 0; i < curveArr.size(); i++)
{
const RigFlowDiagSolverInterface::PvtCurve& curve = curveArr[i];
QwtPlotCurve* qwtCurve = new QwtPlotCurve();
CVF_ASSERT(curve.pressureVals.size() == curve.yVals.size());
qwtCurve->setSamples(curve.pressureVals.data(), curve.yVals.data(), static_cast<int>(curve.pressureVals.size()));
qwtCurve->setStyle(QwtPlotCurve::Lines);
QColor curveClr = Qt::magenta;
if (curve.phase == RigFlowDiagSolverInterface::PvtCurve::GAS) curveClr = QColor(Qt::red);
else if (curve.phase == RigFlowDiagSolverInterface::PvtCurve::OIL) curveClr = QColor(Qt::green);
const QPen curvePen(curveClr);
qwtCurve->setPen(curvePen);
qwtCurve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
QwtSymbol* curveSymbol = new QwtSymbol(QwtSymbol::Ellipse);
curveSymbol->setSize(6, 6);
curveSymbol->setPen(curvePen);
curveSymbol->setBrush(Qt::NoBrush);
qwtCurve->setSymbol(curveSymbol);
qwtCurve->attach(m_qwtPlot);
m_qwtCurveArr.push_back(qwtCurve);
}
m_pvtCurveArr = curveArr;
CVF_ASSERT(m_pvtCurveArr.size() == m_qwtCurveArr.size());
// Add vertical marker line to indicate cell pressure
if (pressure != HUGE_VAL)
{
QwtPlotMarker* lineMarker = new QwtPlotMarker;
lineMarker->setXValue(pressure);
lineMarker->setLineStyle(QwtPlotMarker::VLine);
lineMarker->setLinePen(QPen(QColor(128, 0, 255), 1, Qt::DashLine));
lineMarker->setLabel(QString("PRESSURE"));
lineMarker->setLabelAlignment(Qt::AlignTop | Qt::AlignRight);
lineMarker->setLabelOrientation(Qt::Vertical);
lineMarker->attach(m_qwtPlot);
}
// Then point marker
if (pressure != HUGE_VAL && pointMarkerYValue != HUGE_VAL)
{
QwtPlotMarker* pointMarker = new QwtPlotMarker;
pointMarker->setValue(pressure, pointMarkerYValue);
QwtSymbol* symbol = new QwtSymbol(QwtSymbol::Ellipse);
symbol->setSize(13, 13);
symbol->setPen(QPen(QColor(128, 128, 255), 2));
symbol->setBrush(Qt::NoBrush);
pointMarker->setSymbol(symbol);
pointMarker->attach(m_qwtPlot);
}
m_qwtPlot->setTitle(plotTitle);
m_qwtPlot->setAxisTitle(QwtPlot::xBottom, QString("Pressure [%1]").arg(RiaEclipseUnitTools::unitStringPressure(unitSystem)));
m_qwtPlot->setAxisTitle(QwtPlot::yLeft, yAxisTitle);
updateTrackerPlotMarkerAndLabelFromPicker();
m_qwtPlot->replot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPvtPlotWidget::updateTrackerPlotMarkerAndLabelFromPicker()
{
bool hasValidSamplePoint = false;
QPointF samplePoint;
QString mixRatioText = "";
double mixRat = HUGE_VAL;
if (m_qwtPicker && m_qwtPicker->isActive())
{
const QPoint trackerPos = m_qwtPicker->trackerPosition();
int pointSampleIdx = -1;
const QwtPlotCurve* closestQwtCurve = closestCurveSample(trackerPos, *m_qwtPlot, &pointSampleIdx);
if (closestQwtCurve && pointSampleIdx >= 0)
{
samplePoint = closestQwtCurve->sample(pointSampleIdx);
hasValidSamplePoint = true;
size_t curveIdx = indexOfQwtCurve(closestQwtCurve);
if (curveIdx < m_pvtCurveArr.size())
{
const RigFlowDiagSolverInterface::PvtCurve& pvtCurve = m_pvtCurveArr[curveIdx];
if (pointSampleIdx < pvtCurve.mixRatVals.size())
{
mixRat = pvtCurve.mixRatVals[pointSampleIdx];
// The text is Rs or Rv depending on phase
mixRatioText = (pvtCurve.phase == RigFlowDiagSolverInterface::PvtCurve::GAS) ? "Rv" : "Rs";
}
}
}
}
m_trackerLabel = "";
bool needsReplot = false;
if (hasValidSamplePoint)
{
if (!m_trackerPlotMarker)
{
m_trackerPlotMarker = new QwtPlotMarker;
QwtSymbol* symbol = new QwtSymbol(QwtSymbol::Ellipse);
symbol->setSize(13, 13);
symbol->setPen(QPen(QColor(0, 0, 0), 2));
symbol->setBrush(Qt::NoBrush);
m_trackerPlotMarker->setSymbol(symbol);
m_trackerPlotMarker->attach(m_qwtPlot);
needsReplot = true;
}
if (m_trackerPlotMarker->value() != samplePoint)
{
m_trackerPlotMarker->setValue(samplePoint);
needsReplot = true;
}
m_trackerLabel = QString("%1 (%2)").arg(samplePoint.y()).arg(samplePoint.x());
if (mixRat != HUGE_VAL)
{
m_trackerLabel += QString("\n%1 = %2").arg(mixRatioText).arg(mixRat);
}
}
else
{
if (m_trackerPlotMarker)
{
m_trackerPlotMarker->detach();
delete m_trackerPlotMarker;
m_trackerPlotMarker = NULL;
needsReplot = true;
}
}
if (needsReplot)
{
m_qwtPlot->replot();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QwtPlotCurve* RiuPvtPlotWidget::closestCurveSample(const QPoint& cursorPosition, const QwtPlot& plot, int* closestSampleIndex)
{
if (closestSampleIndex) *closestSampleIndex = -1;
const QwtPlotCurve* closestCurve = NULL;
double distMin = DBL_MAX;
int closestPointSampleIndex = -1;
const QwtPlotItemList& itemList = plot.itemList();
for (QwtPlotItemIterator it = itemList.begin(); it != itemList.end(); it++)
{
if ((*it)->rtti() == QwtPlotItem::Rtti_PlotCurve)
{
const QwtPlotCurve* candidateCurve = static_cast<const QwtPlotCurve*>(*it);
double dist = DBL_MAX;
int candidateSampleIndex = candidateCurve->closestPoint(cursorPosition, &dist);
if (dist < distMin)
{
closestCurve = candidateCurve;
closestPointSampleIndex = candidateSampleIndex;
distMin = dist;
}
}
}
if (closestCurve && closestPointSampleIndex >= 0 && distMin < 50)
{
if (closestSampleIndex) *closestSampleIndex = closestPointSampleIndex;
return closestCurve;
}
else
{
return NULL;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RiuPvtPlotWidget::indexOfQwtCurve(const QwtPlotCurve* qwtCurve) const
{
for (size_t i = 0; i < m_qwtCurveArr.size(); i++)
{
if (m_qwtCurveArr[i] == qwtCurve)
{
return i;
}
}
return cvf::UNDEFINED_SIZE_T;
}
//--------------------------------------------------------------------------------------------------
/// Implements the RiuPvtTrackerTextProvider interface
//--------------------------------------------------------------------------------------------------
QString RiuPvtPlotWidget::trackerText() const
{
return m_trackerLabel;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPvtPlotWidget::slotPickerPointChanged(const QPoint& pt)
{
updateTrackerPlotMarkerAndLabelFromPicker();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPvtPlotWidget::slotPickerActivated(bool on)
{
updateTrackerPlotMarkerAndLabelFromPicker();
}
//==================================================================================================
///
@@ -83,10 +443,8 @@ RiuPvtPlotPanel::RiuPvtPlotPanel(QDockWidget* parent)
comboLayout->addStretch(1);
comboLayout->setContentsMargins(5, 5, 0, 0);
m_fvfPlot = new PvtQwtPlot(this);
m_viscosityPlot = new PvtQwtPlot(this);
setPlotDefaults(m_fvfPlot);
setPlotDefaults(m_viscosityPlot);
m_fvfPlot = new RiuPvtPlotWidget(this);
m_viscosityPlot = new RiuPvtPlotWidget(this);
QHBoxLayout* plotLayout = new QHBoxLayout();
plotLayout->addWidget(m_fvfPlot);
@@ -111,23 +469,6 @@ RiuPvtPlotPanel::RiuPvtPlotPanel(QDockWidget* parent)
//--------------------------------------------------------------------------------------------------
RiuPvtPlotPanel::~RiuPvtPlotPanel()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPvtPlotPanel::setPlotDefaults(QwtPlot* plot)
{
RiuSummaryQwtPlot::setCommonPlotBehaviour(plot);
plot->enableAxis(QwtPlot::xBottom, true);
plot->enableAxis(QwtPlot::yLeft, true);
plot->enableAxis(QwtPlot::xTop, false);
plot->enableAxis(QwtPlot::yRight, false);
plot->setAxisMaxMinor(QwtPlot::xBottom, 2);
plot->setAxisMaxMinor(QwtPlot::yLeft, 3);
}
//--------------------------------------------------------------------------------------------------
@@ -182,7 +523,6 @@ RiuPvtPlotUpdater* RiuPvtPlotPanel::plotUpdater()
//--------------------------------------------------------------------------------------------------
void RiuPvtPlotPanel::plotUiSelectedCurves()
{
// Determine which curves (phase) to actually plot based on selection in GUI
const int currComboIdx = m_phaseComboBox->currentIndex();
const RigFlowDiagSolverInterface::PvtCurve::Phase phaseToPlot = static_cast<const RigFlowDiagSolverInterface::PvtCurve::Phase>(m_phaseComboBox->itemData(currComboIdx).toInt());
@@ -223,8 +563,8 @@ void RiuPvtPlotPanel::plotUiSelectedCurves()
}
const QString plotTitle = QString("%1 Formation Volume Factor").arg(phaseString);
const QString yAxisTitle = QString("%1 Formation Volume Factor [%2]").arg(phaseString).arg(unitStringFromCurveIdent(m_unitSystem, curveIdentToPlot));
plotCurvesInQwt(m_unitSystem, selectedFvfCurves, m_pressure, fvfPointMarkerYValue, plotTitle, yAxisTitle, m_fvfPlot, &m_fvfPlotMarkers);
const QString yAxisTitle = QString("%1 Formation Volume Factor [%2]").arg(phaseString).arg(unitLabelFromCurveIdent(m_unitSystem, curveIdentToPlot));
m_fvfPlot->plotCurves(m_unitSystem, selectedFvfCurves, m_pressure, fvfPointMarkerYValue, plotTitle, yAxisTitle);
}
// Viscosity plot
@@ -253,96 +593,15 @@ void RiuPvtPlotPanel::plotUiSelectedCurves()
}
const QString plotTitle = QString("%1 Viscosity").arg(phaseString);
const QString yAxisTitle = QString("%1 Viscosity [%2]").arg(phaseString).arg(unitStringFromCurveIdent(m_unitSystem, curveIdentToPlot));
plotCurvesInQwt(m_unitSystem, selectedViscosityCurves, m_pressure, viscosityPointMarkerYValue, plotTitle, yAxisTitle, m_viscosityPlot, &m_viscosityPlotMarkers);
const QString yAxisTitle = QString("%1 Viscosity [%2]").arg(phaseString).arg(unitLabelFromCurveIdent(m_unitSystem, curveIdentToPlot));
m_viscosityPlot->plotCurves(m_unitSystem, selectedViscosityCurves, m_pressure, viscosityPointMarkerYValue, plotTitle, yAxisTitle);
}
}
//--------------------------------------------------------------------------------------------------
///
/// Static helper to get unit labels
//--------------------------------------------------------------------------------------------------
void RiuPvtPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& curveArr, double pressure, double pointMarkerYValue, QString plotTitle, QString yAxisTitle, QwtPlot* plot, std::vector<QwtPlotMarker*>* myPlotMarkers)
{
plot->detachItems(QwtPlotItem::Rtti_PlotCurve);
// Workaround for detaching only plot markers that we have added
// Needed as long as the curve point tracker is also using plot markers for its marking
//plot->detachItems(QwtPlotItem::Rtti_PlotMarker);
for (QwtPlotMarker* marker : *myPlotMarkers)
{
marker->detach();
delete marker;
}
myPlotMarkers->clear();
for (size_t i = 0; i < curveArr.size(); i++)
{
const RigFlowDiagSolverInterface::PvtCurve& curve = curveArr[i];
QwtPlotCurve* qwtCurve = new QwtPlotCurve();
CVF_ASSERT(curve.pressureVals.size() == curve.yVals.size());
qwtCurve->setSamples(curve.pressureVals.data(), curve.yVals.data(), static_cast<int>(curve.pressureVals.size()));
qwtCurve->setStyle(QwtPlotCurve::Lines);
QColor curveClr = Qt::magenta;
if (curve.phase == RigFlowDiagSolverInterface::PvtCurve::GAS) curveClr = QColor(Qt::red);
else if (curve.phase == RigFlowDiagSolverInterface::PvtCurve::OIL) curveClr = QColor(Qt::green);
const QPen curvePen(curveClr);
qwtCurve->setPen(curvePen);
qwtCurve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
QwtSymbol* curveSymbol = new QwtSymbol(QwtSymbol::Ellipse);
curveSymbol->setSize(6, 6);
curveSymbol->setPen(curvePen);
curveSymbol->setBrush(Qt::NoBrush);
qwtCurve->setSymbol(curveSymbol);
qwtCurve->attach(plot);
}
// Add vertical marker lines to indicate cell pressure
if (pressure != HUGE_VAL)
{
QwtPlotMarker* lineMarker = new QwtPlotMarker;
lineMarker->setXValue(pressure);
lineMarker->setLineStyle(QwtPlotMarker::VLine);
lineMarker->setLinePen(QPen(QColor(128,0,255), 1, Qt::DashLine));
lineMarker->setLabel(QString("PRESSURE"));
lineMarker->setLabelAlignment(Qt::AlignTop | Qt::AlignRight);
lineMarker->setLabelOrientation(Qt::Vertical);
lineMarker->attach(plot);
myPlotMarkers->push_back(lineMarker);
}
if (pressure != HUGE_VAL && pointMarkerYValue != HUGE_VAL)
{
QwtPlotMarker* pointMarker = new QwtPlotMarker;
pointMarker->setValue(pressure, pointMarkerYValue);
QwtSymbol* symbol = new QwtSymbol(QwtSymbol::Ellipse);
symbol->setSize(13, 13);
symbol->setPen(QPen(QColor(128, 128, 255), 2));
symbol->setBrush(Qt::NoBrush);
pointMarker->setSymbol(symbol);
pointMarker->attach(plot);
myPlotMarkers->push_back(pointMarker);
}
plot->setTitle(plotTitle);
plot->setAxisTitle(QwtPlot::xBottom, QString("Pressure [%1]").arg(RiaEclipseUnitTools::unitStringPressure(unitSystem)));
plot->setAxisTitle(QwtPlot::yLeft, yAxisTitle);
plot->replot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuPvtPlotPanel::unitStringFromCurveIdent(RiaEclipseUnitTools::UnitSystem unitSystem, RigFlowDiagSolverInterface::PvtCurve::Ident curveIdent)
QString RiuPvtPlotPanel::unitLabelFromCurveIdent(RiaEclipseUnitTools::UnitSystem unitSystem, RigFlowDiagSolverInterface::PvtCurve::Ident curveIdent)
{
if (curveIdent == RigFlowDiagSolverInterface::PvtCurve::Bo)
{

View File

@@ -22,6 +22,7 @@
#include "RiaEclipseUnitTools.h"
#include <QWidget>
#include <QPointer>
#include <cmath>
#include <memory>
@@ -31,6 +32,58 @@ class QDockWidget;
class QwtPlot;
class QComboBox;
class QwtPlotMarker;
class QwtPlotCurve;
class PvtQwtPicker;
class RiuPvtPlotPanel;
// Interface for providing our custom picker with a tracker text
class RiuPvtTrackerTextProvider
{
public:
virtual QString trackerText() const = 0;
};
//==================================================================================================
//
//
//
//==================================================================================================
class RiuPvtPlotWidget : public QWidget, public RiuPvtTrackerTextProvider
{
Q_OBJECT
public:
RiuPvtPlotWidget(RiuPvtPlotPanel* parent);
void plotCurves(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& curveArr, double pressure, double pointMarkerYValue, QString plotTitle, QString yAxisTitle);
private:
static void setPlotDefaults(QwtPlot* plot);
static const QwtPlotCurve* closestCurveSample(const QPoint& cursorPosition, const QwtPlot& plot, int* closestSampleIndex);
size_t indexOfQwtCurve(const QwtPlotCurve* qwtCurve) const;
void updateTrackerPlotMarkerAndLabelFromPicker();
virtual QString trackerText() const override;
private slots:
void slotPickerActivated(bool);
void slotPickerPointChanged(const QPoint& pt);
private:
QPointer<QwtPlot> m_qwtPlot;
std::vector<RigFlowDiagSolverInterface::PvtCurve> m_pvtCurveArr;
std::vector<const QwtPlotCurve*> m_qwtCurveArr;
QPointer<PvtQwtPicker> m_qwtPicker;
QString m_trackerLabel;
QwtPlotMarker* m_trackerPlotMarker;
};
//==================================================================================================
@@ -64,14 +117,12 @@ public:
RiuPvtPlotUpdater* plotUpdater();
private:
void plotUiSelectedCurves();
static void setPlotDefaults(QwtPlot* plot);
static void plotCurvesInQwt(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& curveArr, double pressure, double pointMarkerYValue, QString plotTitle, QString yAxisTitle, QwtPlot* plot, std::vector<QwtPlotMarker*>* myPlotMarkers);
static QString unitStringFromCurveIdent(RiaEclipseUnitTools::UnitSystem unitSystem, RigFlowDiagSolverInterface::PvtCurve::Ident curveIdent);
void plotUiSelectedCurves();
static QString unitLabelFromCurveIdent(RiaEclipseUnitTools::UnitSystem unitSystem, RigFlowDiagSolverInterface::PvtCurve::Ident curveIdent);
private slots:
void slotPhaseComboCurrentIndexChanged(int);
void slotPhaseComboCurrentIndexChanged(int);
private:
RiaEclipseUnitTools::UnitSystem m_unitSystem;
std::vector<RigFlowDiagSolverInterface::PvtCurve> m_allFvfCurvesArr;
@@ -82,11 +133,11 @@ private:
QComboBox* m_phaseComboBox;
QwtPlot* m_fvfPlot;
QwtPlot* m_viscosityPlot;
std::vector<QwtPlotMarker*> m_fvfPlotMarkers;
std::vector<QwtPlotMarker*> m_viscosityPlotMarkers;
RiuPvtPlotWidget* m_fvfPlot;
RiuPvtPlotWidget* m_viscosityPlot;
std::unique_ptr<RiuPvtPlotUpdater> m_plotUpdater;
};