#3842 Summary : Use one curve as basis for source data stepping

This commit is contained in:
Magne Sjaastad 2018-12-17 15:54:23 +01:00
parent aaff5d33e5
commit b1da83ee33
4 changed files with 173 additions and 0 deletions

View File

@ -20,6 +20,7 @@
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RiaStdStringTools.h"
#include "RifReaderEclipseSummary.h"
@ -50,6 +51,13 @@ RimEnsembleCurveSetCollection::RimEnsembleCurveSetCollection()
CAF_PDM_InitField(&m_showCurves, "IsActive", true, "Show Curves", "", "", "");
m_showCurves.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_ySourceStepping, "YSourceStepping", "", "", "", "");
m_ySourceStepping = new RimSummaryPlotSourceStepping;
m_ySourceStepping->setSourceSteppingType(RimSummaryPlotSourceStepping::Y_AXIS);
m_ySourceStepping.uiCapability()->setUiHidden(true);
m_ySourceStepping.uiCapability()->setUiTreeChildrenHidden(true);
m_ySourceStepping.xmlCapability()->disableIO();
}
//--------------------------------------------------------------------------------------------------
@ -193,6 +201,80 @@ size_t RimEnsembleCurveSetCollection::curveSetCount() const
return m_curveSets.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmFieldHandle*> RimEnsembleCurveSetCollection::fieldsToShowInToolbar()
{
if (m_ySourceStepping)
{
return m_ySourceStepping->fieldsToShowInToolbar();
}
return std::vector<caf::PdmFieldHandle*>();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::setCurveSetForSourceStepping(RimEnsembleCurveSet* curveSet)
{
m_curveSetForSourceStepping = curveSet;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEnsembleCurveSet* RimEnsembleCurveSetCollection::curveSetForSourceStepping() const
{
return m_curveSetForSourceStepping;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimEnsembleCurveSet*> RimEnsembleCurveSetCollection::curveSetsForSourceStepping() const
{
std::vector<RimEnsembleCurveSet*> steppingCurveSets;
if (m_curveSetForSourceStepping)
{
steppingCurveSets.push_back(m_curveSetForSourceStepping);
{
// Add corresponding history/summary curve with or without H
const std::string historyIdentifier = "H";
std::string quantity = m_curveSetForSourceStepping->summaryAddress().quantityName();
std::string candidateName;
if (RiaStdStringTools::endsWith(quantity, historyIdentifier))
{
candidateName = quantity.substr(0, quantity.size() - 1);
}
else
{
candidateName = quantity + historyIdentifier;
}
for (const auto& c : curveSets())
{
if (c->summaryAddress().quantityName() == candidateName)
{
steppingCurveSets.push_back(c);
}
}
}
}
else
{
steppingCurveSets = curveSets();
}
return steppingCurveSets;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -228,6 +310,16 @@ void RimEnsembleCurveSetCollection::fieldChangedByUi(const caf::PdmFieldHandle*
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
auto group = uiOrdering.addNewGroup("Data Source");
m_ySourceStepping()->uiOrdering(uiConfigName, *group);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -25,6 +25,8 @@
#include "cafPdmObject.h"
class RimEnsembleCurveSet;
class RimSummaryPlotSourceStepping;
class RimSummaryCurve;
class QwtPlot;
class QwtPlotCurve;
@ -55,9 +57,16 @@ public:
std::vector<RimEnsembleCurveSet*> curveSets() const;
size_t curveSetCount() const;
void deleteAllCurveSets();
void setCurrentSummaryCurveSet(RimEnsembleCurveSet* curveSet);
// Functions related to source stepping
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
void setCurveSetForSourceStepping(RimEnsembleCurveSet* curve);
RimEnsembleCurveSet* curveSetForSourceStepping() const;
std::vector<RimEnsembleCurveSet*> curveSetsForSourceStepping() const;
private:
caf::PdmFieldHandle* objectToggleField() override;
@ -65,10 +74,15 @@ private:
void fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue, const QVariant& newValue) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private:
caf::PdmField<bool> m_showCurves;
caf::PdmChildArrayField<RimEnsembleCurveSet*> m_curveSets;
caf::PdmChildField<RimSummaryPlotSourceStepping*> m_ySourceStepping;
caf::PdmPointer<RimEnsembleCurveSet> m_currentEnsembleCurveSet;
caf::PdmPointer<RimEnsembleCurveSet> m_curveSetForSourceStepping;
};

View File

@ -19,6 +19,7 @@
#include "RimSummaryCurveCollection.h"
#include "RiaApplication.h"
#include "RiaStdStringTools.h"
#include "RifReaderEclipseSummary.h"
@ -192,6 +193,51 @@ std::vector<RimSummaryCurve*> RimSummaryCurveCollection::curves() const
return m_curves.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimSummaryCurve*> RimSummaryCurveCollection::curvesForSourceStepping() const
{
std::vector<RimSummaryCurve*> stepCurves;
if (m_curveForSourceStepping)
{
stepCurves.push_back(m_curveForSourceStepping);
{
// Add corresponding history/summary curve with or without H
const std::string historyIdentifier = "H";
std::string quantity = m_curveForSourceStepping->summaryAddressY().quantityName();
std::string candidateName;
if (RiaStdStringTools::endsWith(quantity, historyIdentifier))
{
candidateName = quantity.substr(0, quantity.size() - 1);
}
else
{
candidateName = quantity + historyIdentifier;
}
for (const auto& c : curves())
{
if (c->summaryAddressY().quantityName() == candidateName)
{
stepCurves.push_back(c);
}
}
}
}
else
{
stepCurves = curves();
}
return stepCurves;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -355,6 +401,22 @@ void RimSummaryCurveCollection::setCurveAsTopZWithinCategory(RimSummaryCurve* cu
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurveCollection::setCurveForSourceStepping(RimSummaryCurve* curve)
{
m_curveForSourceStepping = curve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCurve* RimSummaryCurveCollection::curveForSourceStepping() const
{
return m_curveForSourceStepping;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -56,6 +56,7 @@ public:
void deleteCurve(RimSummaryCurve* curve);
std::vector<RimSummaryCurve*> curves() const;
std::vector<RimSummaryCurve*> curvesForSourceStepping() const;
void deleteCurvesAssosiatedWithCase(RimSummaryCase* summaryCase);
void deleteAllCurves();
@ -68,6 +69,9 @@ public:
void handleKeyPressEvent(QKeyEvent* keyEvent);
void setCurveAsTopZWithinCategory(RimSummaryCurve* curve);
void setCurveForSourceStepping(RimSummaryCurve* curve);
RimSummaryCurve* curveForSourceStepping() const;
private:
caf::PdmFieldHandle* objectToggleField() override;
@ -88,5 +92,6 @@ private:
caf::PdmChildField<RimSummaryPlotSourceStepping*> m_unionSourceStepping;
caf::PdmPointer<RimSummaryCurve> m_currentSummaryCurve;
caf::PdmPointer<RimSummaryCurve> m_curveForSourceStepping;
};