mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5133 Reassign summary curves to the file summary case copy when closing a grid case
This commit is contained in:
parent
01767803c3
commit
c5f21b75fa
@ -29,6 +29,7 @@
|
|||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimSummaryCase.h"
|
#include "RimSummaryCase.h"
|
||||||
#include "RimSummaryCaseCollection.h"
|
#include "RimSummaryCaseCollection.h"
|
||||||
|
#include "RimSummaryCurve.h"
|
||||||
|
|
||||||
#include "cafProgressInfo.h"
|
#include "cafProgressInfo.h"
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@ -166,9 +167,6 @@ void RimSummaryCaseMainCollection::convertGridSummaryCasesToFileSummaryCases( Ri
|
|||||||
RimSummaryCaseCollection* collection;
|
RimSummaryCaseCollection* collection;
|
||||||
gridSummaryCase->firstAncestorOrThisOfType( collection );
|
gridSummaryCase->firstAncestorOrThisOfType( collection );
|
||||||
|
|
||||||
removeCase( gridSummaryCase );
|
|
||||||
delete gridSummaryCase;
|
|
||||||
|
|
||||||
if ( collection )
|
if ( collection )
|
||||||
{
|
{
|
||||||
collection->addCase( fileSummaryCase );
|
collection->addCase( fileSummaryCase );
|
||||||
@ -179,7 +177,12 @@ void RimSummaryCaseMainCollection::convertGridSummaryCasesToFileSummaryCases( Ri
|
|||||||
this->addCase( fileSummaryCase );
|
this->addCase( fileSummaryCase );
|
||||||
this->updateConnectedEditors();
|
this->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSummaryCaseData( {fileSummaryCase} );
|
loadSummaryCaseData( {fileSummaryCase} );
|
||||||
|
reassignSummaryCurves( gridSummaryCase, fileSummaryCase );
|
||||||
|
|
||||||
|
removeCase( gridSummaryCase );
|
||||||
|
delete gridSummaryCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -426,6 +429,39 @@ void RimSummaryCaseMainCollection::loadFileSummaryCaseData( std::vector<RimFileS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCaseMainCollection::reassignSummaryCurves( const RimGridSummaryCase* gridSummaryCase,
|
||||||
|
RimFileSummaryCase* fileSummaryCase )
|
||||||
|
{
|
||||||
|
std::vector<caf::PdmFieldHandle*> referringFields;
|
||||||
|
gridSummaryCase->referringPtrFields( referringFields );
|
||||||
|
for ( caf::PdmFieldHandle* field : referringFields )
|
||||||
|
{
|
||||||
|
RimSummaryCurve* summaryCurve = dynamic_cast<RimSummaryCurve*>( field->ownerObject() );
|
||||||
|
if ( summaryCurve )
|
||||||
|
{
|
||||||
|
bool updated = false;
|
||||||
|
if ( summaryCurve->summaryCaseX() == gridSummaryCase )
|
||||||
|
{
|
||||||
|
summaryCurve->setSummaryCaseX( fileSummaryCase );
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
if ( summaryCurve->summaryCaseY() == gridSummaryCase )
|
||||||
|
{
|
||||||
|
summaryCurve->setSummaryCaseY( fileSummaryCase );
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
if ( updated )
|
||||||
|
{
|
||||||
|
summaryCurve->loadDataAndUpdate( false );
|
||||||
|
summaryCurve->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -73,8 +73,9 @@ public:
|
|||||||
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath );
|
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void loadSummaryCaseData( std::vector<RimSummaryCase*> summaryCases );
|
static void loadSummaryCaseData( std::vector<RimSummaryCase*> summaryCases );
|
||||||
static void loadFileSummaryCaseData( std::vector<RimFileSummaryCase*> fileSummaryCases );
|
static void loadFileSummaryCaseData( std::vector<RimFileSummaryCase*> fileSummaryCases );
|
||||||
|
static void reassignSummaryCurves( const RimGridSummaryCase* fromGridCase, RimFileSummaryCase* toFileCase );
|
||||||
static RimSummaryCaseCollection* defaultAllocator();
|
static RimSummaryCaseCollection* defaultAllocator();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user