mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
This commit is contained in:
@@ -37,10 +37,13 @@
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
|
||||
#include "cafPdmUiTreeViewEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
|
||||
#include "cvfScalarMapperContinuousLinear.h"
|
||||
|
||||
#include <QTextStream>
|
||||
#include <QKeyEvent>
|
||||
|
||||
@@ -141,6 +144,9 @@ RimEnsambleCurveSet::RimEnsambleCurveSet()
|
||||
CAF_PDM_InitField(&m_color, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_ensambleParameter, "EnsambleParameter", QString(""), "Ensamble Parameter", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_legendConfig, "LegendConfig", "", "", "", "");
|
||||
m_legendConfig = new RimLegendConfig();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -452,7 +458,41 @@ void RimEnsambleCurveSet::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
||||
}
|
||||
else if (changedField == &m_ensambleParameter)
|
||||
{
|
||||
RimSummaryCaseCollection* group = m_yValuesSummaryGroup();
|
||||
QString parameterName = m_ensambleParameter();
|
||||
if (group && !parameterName.isEmpty())
|
||||
{
|
||||
double minValue = HUGE_VAL;
|
||||
double maxValue = -HUGE_VAL;
|
||||
|
||||
for (RimSummaryCase* rimCase : group->allSummaryCases())
|
||||
{
|
||||
if (!rimCase->caseRealizationParameters().isNull())
|
||||
{
|
||||
double value = rimCase->caseRealizationParameters()->parameterValue(parameterName);
|
||||
if (value != HUGE_VAL)
|
||||
{
|
||||
if (value < minValue) minValue = value;
|
||||
if (value > maxValue) maxValue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cvf::ScalarMapperContinuousLinear colorMapper;
|
||||
colorMapper.setRange(minValue, maxValue);
|
||||
|
||||
for (auto& curve : m_curves)
|
||||
{
|
||||
RimSummaryCase* rimCase = curve->summaryCaseY();
|
||||
double value = rimCase->caseRealizationParameters()->parameterValue(parameterName);
|
||||
curve->setColor(cvf::Color3f(colorMapper.mapToColor(value)));
|
||||
curve->updateCurveAppearance();
|
||||
}
|
||||
|
||||
RimSummaryPlot* plot;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
if (plot && plot->qwtPlot()) plot->qwtPlot()->replot();
|
||||
}
|
||||
}
|
||||
else if (changedField == &m_color)
|
||||
{
|
||||
@@ -532,6 +572,15 @@ void RimEnsambleCurveSet::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
|
||||
//}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsambleCurveSet::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
{
|
||||
uiTreeOrdering.add(m_legendConfig());
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -575,7 +624,7 @@ QList<caf::PdmOptionItemInfo> RimEnsambleCurveSet::calculateValueOptions(const c
|
||||
{
|
||||
RimSummaryCaseCollection* group = m_yValuesSummaryGroup;
|
||||
|
||||
options.push_back(caf::PdmOptionItemInfo("None", ""));
|
||||
//options.push_back(caf::PdmOptionItemInfo("None", ""));
|
||||
|
||||
if (group)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RimLegendConfig.h"
|
||||
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
@@ -84,6 +86,7 @@ private:
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue, const QVariant& newValue) override;
|
||||
@@ -113,5 +116,7 @@ private:
|
||||
caf::PdmField<caf::AppEnum<ColorMode>> m_colorMode;
|
||||
caf::PdmField<cvf::Color3f> m_color;
|
||||
caf::PdmField<QString> m_ensambleParameter;
|
||||
|
||||
caf::PdmChildField<RimLegendConfig*> m_legendConfig;
|
||||
};
|
||||
|
||||
|
||||
@@ -280,7 +280,11 @@ void RimSummaryCaseMainCollection::loadAllSummaryCaseData()
|
||||
{
|
||||
for (RimSummaryCase* sumCase : allSummaryCases())
|
||||
{
|
||||
if (sumCase) sumCase->createSummaryReaderInterface();
|
||||
if (sumCase)
|
||||
{
|
||||
sumCase->createSummaryReaderInterface();
|
||||
addCaseRealizationParametersIfFound(*sumCase, sumCase->summaryHeaderFilename());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1144,7 +1144,10 @@ void RimSummaryPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
||||
axisFolder->add(&m_rightYAxisProperties);
|
||||
|
||||
uiTreeOrdering.add(&m_summaryCurveCollection);
|
||||
uiTreeOrdering.add(&m_ensambleCurveSetCollection);
|
||||
if (!m_isCrossPlot)
|
||||
{
|
||||
uiTreeOrdering.add(&m_ensambleCurveSetCollection);
|
||||
}
|
||||
uiTreeOrdering.add(&m_gridTimeHistoryCurves);
|
||||
uiTreeOrdering.add(&m_asciiDataCurves);
|
||||
|
||||
|
||||
@@ -27,6 +27,15 @@ void RigCaseRealizationParameters::addParameter(const QString& name, double valu
|
||||
m_parameters[name] = value;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCaseRealizationParameters::parameterValue(const QString& name)
|
||||
{
|
||||
if (m_parameters.count(name) == 0) return HUGE_VAL;
|
||||
return m_parameters[name];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -34,6 +34,8 @@ class RigCaseRealizationParameters : public cvf::Object
|
||||
{
|
||||
public:
|
||||
void addParameter(const QString& name, double value);
|
||||
double parameterValue(const QString& name);
|
||||
|
||||
std::map<QString, double> parameters() const;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user