2017-10-12 07:32:21 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2017- Statoil ASA
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2017-10-12 07:32:21 +02:00
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2017-10-12 07:32:21 +02:00
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-10-12 07:32:21 +02:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#include "RicSummaryCurveCalculatorDialog.h"
|
2017-11-13 21:40:26 +01:00
|
|
|
|
2022-04-22 12:18:34 +02:00
|
|
|
#include "RicCalculatorWidgetCreator.h"
|
2020-02-18 14:14:50 +01:00
|
|
|
#include "RicSummaryCurveCalculatorUi.h"
|
2017-10-12 07:32:21 +02:00
|
|
|
|
2017-11-14 08:41:44 +01:00
|
|
|
#include "RimSummaryCalculation.h"
|
2019-09-06 10:40:57 +02:00
|
|
|
#include "RimSummaryCalculationCollection.h"
|
2017-11-14 08:41:44 +01:00
|
|
|
|
2017-10-12 07:32:21 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-10-12 07:32:21 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
RicSummaryCurveCalculatorDialog::RicSummaryCurveCalculatorDialog( QWidget* parent )
|
2022-04-22 12:18:34 +02:00
|
|
|
: RicUserDefinedCalculatorDialog( parent, "Summary Curve Calculator" )
|
2017-10-12 07:32:21 +02:00
|
|
|
{
|
|
|
|
|
setUp();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-10-12 07:32:21 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 11:13:38 +01:00
|
|
|
RicSummaryCurveCalculatorDialog::~RicSummaryCurveCalculatorDialog()
|
|
|
|
|
{
|
|
|
|
|
}
|
2017-10-12 07:32:21 +02:00
|
|
|
|
2017-11-08 08:43:14 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-11-08 08:43:14 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-04-22 12:18:34 +02:00
|
|
|
void RicSummaryCurveCalculatorDialog::setCalculationAndUpdateUi( RimUserDefinedCalculation* calculation )
|
2017-11-08 08:43:14 +01:00
|
|
|
{
|
2022-04-22 12:18:34 +02:00
|
|
|
CAF_ASSERT( m_summaryCalcEditor );
|
|
|
|
|
m_summaryCalcEditor->calculator()->setCurrentCalculation( dynamic_cast<RimSummaryCalculation*>( calculation ) );
|
|
|
|
|
updateUi();
|
2017-11-08 08:43:14 +01:00
|
|
|
}
|
|
|
|
|
|
2017-11-14 07:30:49 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-11-14 07:30:49 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-04-22 12:18:34 +02:00
|
|
|
void RicSummaryCurveCalculatorDialog::updateUi()
|
2017-11-14 07:30:49 +01:00
|
|
|
{
|
2022-04-22 12:18:34 +02:00
|
|
|
CAF_ASSERT( m_summaryCalcEditor );
|
|
|
|
|
m_summaryCalcEditor->updateUi();
|
2017-11-14 07:30:49 +01:00
|
|
|
}
|
|
|
|
|
|
2017-10-12 07:32:21 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-10-12 07:32:21 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-04-22 12:18:34 +02:00
|
|
|
RimUserDefinedCalculationCollection* RicSummaryCurveCalculatorDialog::calculationCollection() const
|
2017-10-12 07:32:21 +02:00
|
|
|
{
|
2022-04-22 12:18:34 +02:00
|
|
|
CAF_ASSERT( m_summaryCalcEditor );
|
|
|
|
|
return m_summaryCalcEditor->calculator()->calculationCollection();
|
2017-10-12 07:32:21 +02:00
|
|
|
}
|
|
|
|
|
|
2017-11-14 08:41:44 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-11-14 08:41:44 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-04-22 12:18:34 +02:00
|
|
|
QWidget* RicSummaryCurveCalculatorDialog::getCalculatorWidget()
|
2017-11-14 08:41:44 +01:00
|
|
|
{
|
2022-04-22 12:18:34 +02:00
|
|
|
if ( !m_summaryCalcEditor )
|
2017-11-14 08:41:44 +01:00
|
|
|
{
|
2023-02-26 10:48:40 +01:00
|
|
|
m_summaryCalcEditor =
|
|
|
|
|
std::unique_ptr<RicCalculatorWidgetCreator>( new RicCalculatorWidgetCreator( std::make_unique<RicSummaryCurveCalculatorUi>() ) );
|
2017-11-14 08:41:44 +01:00
|
|
|
}
|
|
|
|
|
|
2022-04-22 12:18:34 +02:00
|
|
|
return m_summaryCalcEditor->getOrCreateWidget( this );
|
2017-11-14 08:41:44 +01:00
|
|
|
}
|