mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Assign calculation ID to existing addresses (#5304)
#5278 Assign calculation ID to existing addresses
This commit is contained in:
@@ -18,6 +18,12 @@
|
||||
|
||||
#include "RimSummaryAddress.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCalculation.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
@@ -126,3 +132,24 @@ RifEclipseSummaryAddress RimSummaryAddress::address()
|
||||
m_isErrorResult,
|
||||
m_calculationId );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryAddress::ensureIdIsAssigned()
|
||||
{
|
||||
if ( m_category == RifEclipseSummaryAddress::SUMMARY_CALCULATED && m_calculationId == -1 )
|
||||
{
|
||||
RimSummaryCalculationCollection* calcColl = RiaApplication::instance()->project()->calculationCollection();
|
||||
|
||||
for ( const RimSummaryCalculation* c : calcColl->calculations() )
|
||||
{
|
||||
QString description = c->description();
|
||||
|
||||
if ( description == m_quantityName )
|
||||
{
|
||||
m_calculationId = c->id();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,12 +42,13 @@ class RimSummaryAddress : public caf::PdmObject
|
||||
|
||||
public:
|
||||
RimSummaryAddress();
|
||||
;
|
||||
~RimSummaryAddress() override;
|
||||
|
||||
void setAddress( const RifEclipseSummaryAddress& addr );
|
||||
RifEclipseSummaryAddress address();
|
||||
|
||||
void ensureIdIsAssigned();
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>> m_category;
|
||||
caf::PdmField<QString> m_quantityName;
|
||||
|
||||
Reference in New Issue
Block a user