mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2026 Curve Calculator : Update calculated curves and plots
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicSummaryCurveCalculator, "RicSummaryCurveCalculator");
|
||||
@@ -77,14 +78,26 @@ RimCalculation* RicSummaryCurveCalculator::currentCalculation() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCalculator::parseExpression()
|
||||
bool RicSummaryCurveCalculator::parseExpression() const
|
||||
{
|
||||
if (m_currentCalculation())
|
||||
{
|
||||
m_currentCalculation()->parseExpression();
|
||||
QString previousCurveName = m_currentCalculation->description();
|
||||
if (!m_currentCalculation()->parseExpression())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
QString currentCurveName = m_currentCalculation->description();
|
||||
if (previousCurveName != currentCurveName)
|
||||
{
|
||||
RiaSummaryTools::notifyCalculatedCurveNameHasChanged(previousCurveName, currentCurveName);
|
||||
}
|
||||
|
||||
m_currentCalculation()->updateDependentCurvesAndPlots();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -202,12 +215,31 @@ void RicSummaryCurveCalculator::assignPushButtonEditorText(caf::PdmUiEditorAttri
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCalculator::calculate() const
|
||||
bool RicSummaryCurveCalculator::calculate() const
|
||||
{
|
||||
if (m_currentCalculation())
|
||||
{
|
||||
m_currentCalculation()->calculate();
|
||||
QString previousCurveName = m_currentCalculation->description();
|
||||
if (!m_currentCalculation()->parseExpression())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QString currentCurveName = m_currentCalculation->description();
|
||||
if (previousCurveName != currentCurveName)
|
||||
{
|
||||
RiaSummaryTools::notifyCalculatedCurveNameHasChanged(previousCurveName, currentCurveName);
|
||||
}
|
||||
|
||||
if (!m_currentCalculation()->calculate())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_currentCalculation()->updateDependentCurvesAndPlots();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -41,8 +41,8 @@ public:
|
||||
|
||||
RimCalculation* currentCalculation() const;
|
||||
|
||||
void parseExpression();
|
||||
void calculate() const;
|
||||
bool parseExpression() const;
|
||||
bool calculate() const;
|
||||
|
||||
private:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
@@ -186,6 +186,8 @@ QMinimizePanel* RicSummaryCurveCalculatorEditor::updateGroupBoxWithContent(caf::
|
||||
void RicSummaryCurveCalculatorEditor::slotCalculate()
|
||||
{
|
||||
m_calculator->calculate();
|
||||
|
||||
m_calculator->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -194,5 +196,7 @@ void RicSummaryCurveCalculatorEditor::slotCalculate()
|
||||
void RicSummaryCurveCalculatorEditor::slotParseExpression()
|
||||
{
|
||||
m_calculator->parseExpression();
|
||||
|
||||
m_calculator->updateConnectedEditors();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user