#4729 Ensemble RFT: Keep matching sources when switching well

This commit is contained in:
Gaute Lindkvist 2019-09-26 10:02:29 +02:00
parent 4709bb1402
commit e242304b4d
2 changed files with 40 additions and 3 deletions

View File

@ -287,6 +287,42 @@ void RimWellRftPlot::applyInitialSelections()
syncCurvesFromUiSelection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::updateEditorsFromPreviousSelection()
{
std::set<RifDataSourceForRftPlt> previousSources( m_selectedSources().begin(), m_selectedSources().end() );
std::set<QDateTime> previousTimeSteps( m_selectedTimeSteps().begin(), m_selectedTimeSteps().end() );
m_selectedSources.v().clear();
m_selectedTimeSteps.v().clear();
bool dummy = false;
auto dataSourceOptions = calculateValueOptions( &m_selectedSources, &dummy );
for ( auto dataSourceOption : dataSourceOptions )
{
if ( dataSourceOption.level() == 1 )
{
RifDataSourceForRftPlt dataSource = dataSourceOption.value().value<RifDataSourceForRftPlt>();
if ( previousSources.count( dataSource ) )
{
m_selectedSources.v().push_back( dataSource );
}
}
}
auto timeStepOptions = calculateValueOptions( &m_selectedTimeSteps, &dummy );
for ( auto timeStepOption : timeStepOptions )
{
QDateTime timeStep = timeStepOption.value().toDateTime();
if ( previousTimeSteps.count( timeStep ) )
{
m_selectedTimeSteps.v().push_back( timeStep );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -785,8 +821,9 @@ void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
plotTrack->deleteAllCurves();
}
updateEditorsFromCurves();
updateEditorsFromPreviousSelection();
updateFormationsOnPlot();
syncCurvesFromUiSelection();
}
else if ( changedField == &m_branchIndex || changedField == &m_branchDetection )
{

View File

@ -102,6 +102,7 @@ protected:
private:
std::map<QString, QStringList> findWellSources();
void updateEditorsFromPreviousSelection();
void updateEditorsFromCurves();
void syncCurvesFromUiSelection();
void assignWellPathToExtractionCurves();
@ -140,8 +141,7 @@ private:
caf::PdmField<bool> m_showErrorInObservedData;
caf::PdmField<std::vector<RifDataSourceForRftPlt>> m_selectedSources;
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
caf::PdmPtrField<RimWellPathCollection*> m_wellPathCollection;