#1835 Tof Acc Sat Plot: Add a max TOF range field

This commit is contained in:
Bjørnar Grip Fjær
2017-08-29 15:32:11 +02:00
parent d50e40854a
commit fa943226bc
4 changed files with 19 additions and 6 deletions

View File

@@ -53,6 +53,8 @@ RimTofAccumulatedPhaseFractionsPlot::RimTofAccumulatedPhaseFractionsPlot()
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
m_showPlotTitle.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_maxTof, "MaxTof", 50, "Max Time of Flight [year]", "", "", "");
m_showWindow = false;
}
@@ -148,6 +150,10 @@ void RimTofAccumulatedPhaseFractionsPlot::fieldChangedByUi(const caf::PdmFieldHa
{
updateMdiWindowTitle();
}
else if (changedField == &m_maxTof)
{
loadDataAndUpdate();
}
}
@@ -197,7 +203,7 @@ void RimTofAccumulatedPhaseFractionsPlot::loadDataAndUpdate()
const std::vector<double>& oilValues = calc.accumulatedPhaseFractionsSoil();
const std::vector<double>& gasValues = calc.accumulatedPhaseFractionsSgas();
m_tofAccumulatedPhaseFractionsPlotWidget->setSamples(xValues, watValues, oilValues, gasValues);
m_tofAccumulatedPhaseFractionsPlotWidget->setSamples(xValues, watValues, oilValues, gasValues, m_maxTof());
}
}

View File

@@ -85,6 +85,7 @@ protected:
private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;
caf::PdmField<int> m_maxTof;
QPointer<RiuTofAccumulatedPhaseFractionsPlot> m_tofAccumulatedPhaseFractionsPlotWidget;
};

View File

@@ -154,7 +154,8 @@ RimViewWindow* RiuTofAccumulatedPhaseFractionsPlot::ownerViewWindow() const
void RiuTofAccumulatedPhaseFractionsPlot::setSamples(std::vector<double> xSamples,
std::vector<double> watValues,
std::vector<double> oilValues,
std::vector<double> gasValues)
std::vector<double> gasValues,
int maxTofYears)
{
m_xValues.clear();
m_watValues.clear();
@@ -164,10 +165,14 @@ void RiuTofAccumulatedPhaseFractionsPlot::setSamples(std::vector<double> xSample
m_watValues.swap(watValues);
for (size_t i = 0; i < xSamples.size(); ++i)
{
m_xValues.push_back(xSamples[i] / 365.2425);
double tofYears = xSamples[i] / 365.2425;
if (tofYears <= maxTofYears)
{
m_xValues.push_back(tofYears);
m_oilValues.push_back(oilValues[i] + m_watValues[i]);
m_gasValues.push_back(gasValues[i] + m_oilValues[i]);
}
}
m_watCurve->setSamples(m_xValues.data(), m_watValues.data(), static_cast<int>(m_xValues.size()));
m_oilCurve->setSamples(m_xValues.data(), m_oilValues.data(), static_cast<int>(m_xValues.size()));
m_gasCurve->setSamples(m_xValues.data(), m_gasValues.data(), static_cast<int>(m_xValues.size()));

View File

@@ -52,7 +52,8 @@ public:
void setSamples(std::vector<double> xSamples,
std::vector<double> watValues,
std::vector<double> oilValues,
std::vector<double> gasValues);
std::vector<double> gasValues,
int maxTofYears);
protected:
virtual QSize sizeHint() const override;