mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2052 Curve calc. Add user defined unit field
This commit is contained in:
parent
71bb26a292
commit
ca4562d853
@ -33,6 +33,7 @@
|
||||
#include "RiuExpressionContextMenuManager.h"
|
||||
|
||||
#include "cafPdmUiTextEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
@ -55,6 +56,9 @@ RimSummaryCalculation::RimSummaryCalculation()
|
||||
CAF_PDM_InitField(&m_expression, "Expression", QString(""), "Expression", "", "", "");
|
||||
m_expression.uiCapability()->setUiEditorTypeName(caf::PdmUiTextEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&m_unit, "Unit", QString(""), "Unit", "", "", "");
|
||||
m_unit.uiCapability()->setUiEditorTypeName(caf::PdmUiLineEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_variables, "Variables", "Variables", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_calculatedValues, "CalculatedValues", "Calculated Values", "", "", "");
|
||||
|
||||
@ -142,6 +146,14 @@ QString RimSummaryCalculation::expression() const
|
||||
return m_expression;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryCalculation::unitName() const
|
||||
{
|
||||
return m_unit;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
|
||||
void setExpression(const QString& expr);
|
||||
QString expression() const;
|
||||
QString unitName() const;
|
||||
|
||||
bool parseExpression();
|
||||
bool calculate();
|
||||
@ -69,6 +70,7 @@ private:
|
||||
private:
|
||||
caf::PdmField<QString> m_description;
|
||||
caf::PdmField<QString> m_expression;
|
||||
caf::PdmField<QString> m_unit;
|
||||
|
||||
caf::PdmChildArrayField<RimSummaryCalculationVariable*> m_variables;
|
||||
|
||||
|
@ -169,6 +169,11 @@ bool RifCalculatedSummaryCurveReader::values(const RifEclipseSummaryAddress& res
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RifCalculatedSummaryCurveReader::unitName(const RifEclipseSummaryAddress& resultAddress) const
|
||||
{
|
||||
RimSummaryCalculation* calculation = findCalculationByName(resultAddress);
|
||||
if (calculation != nullptr && !calculation->unitName().isEmpty())
|
||||
{
|
||||
return calculation->unitName().toStdString();
|
||||
}
|
||||
return "Calculated Curve Unit";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user