mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5609 Explicit selection of ensemble members for Analysis Plots
This commit is contained in:
@@ -224,8 +224,10 @@ void RimAnalysisPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
// Do select variables
|
||||
RiuSummaryVectorSelectionDialog dlg( nullptr );
|
||||
|
||||
dlg.setCurveSelection( this->curveDefinitions() );
|
||||
dlg.enableMultiSelect( true );
|
||||
dlg.enableIndividualEnsembleCaseSelection( true );
|
||||
|
||||
dlg.setCurveSelection( this->curveDefinitions() );
|
||||
dlg.setCaseAndAddress( nullptr, RifEclipseSummaryAddress() );
|
||||
|
||||
if ( dlg.exec() == QDialog::Accepted )
|
||||
@@ -751,6 +753,9 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui
|
||||
{
|
||||
RiaSummaryCurveDefinition orgBarDataEntry = dataEntry->curveDefinition();
|
||||
|
||||
// Unpack ensemble curves and make one curve definition for each individual curve.
|
||||
// Store both ensemble and summary case in the definition
|
||||
|
||||
std::vector<RiaSummaryCurveDefinition> barDataDefinitions;
|
||||
|
||||
if ( orgBarDataEntry.isEnsembleCurve() )
|
||||
@@ -764,7 +769,16 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui
|
||||
}
|
||||
else
|
||||
{
|
||||
barDataDefinitions.push_back( orgBarDataEntry );
|
||||
if ( orgBarDataEntry.summaryCase() && orgBarDataEntry.summaryCase()->ensemble() )
|
||||
{
|
||||
barDataDefinitions.push_back( RiaSummaryCurveDefinition( orgBarDataEntry.summaryCase(),
|
||||
orgBarDataEntry.summaryAddress(),
|
||||
orgBarDataEntry.summaryCase()->ensemble() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
barDataDefinitions.push_back( orgBarDataEntry );
|
||||
}
|
||||
}
|
||||
|
||||
for ( const RiaSummaryCurveDefinition& curveDef : barDataDefinitions )
|
||||
|
||||
@@ -147,6 +147,14 @@ void RiuSummaryVectorSelectionDialog::enableMultiSelect( bool enable )
|
||||
summaryAddressSelection()->setMultiSelectionMode( enable );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuSummaryVectorSelectionDialog::enableIndividualEnsembleCaseSelection( bool enable )
|
||||
{
|
||||
summaryAddressSelection()->enableIndividualEnsembleCaseSelection( enable );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
void hideEnsembles();
|
||||
void hideSummaryCases();
|
||||
void enableMultiSelect( bool enable );
|
||||
void enableIndividualEnsembleCaseSelection( bool enable );
|
||||
|
||||
private:
|
||||
RiuSummaryVectorSelectionUi* summaryAddressSelection() const;
|
||||
|
||||
@@ -133,6 +133,7 @@ RiuSummaryVectorSelectionUi::RiuSummaryVectorSelectionUi()
|
||||
{RifEclipseSummaryAddress::SUMMARY_IMPORTED,
|
||||
{{new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME )}}},
|
||||
} )
|
||||
, m_showIndividualEnsembleCases( false )
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault( &m_selectedSources, "SummaryCases", "Cases", "", "", "" );
|
||||
m_selectedSources.uiCapability()->setAutoAddingOptionFromValue( false );
|
||||
@@ -488,7 +489,10 @@ std::vector<RiaCurveSetDefinition> RiuSummaryVectorSelectionUi::allCurveSetDefin
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// One CurveDefinition pr ensemble curve set
|
||||
/// One CurveDefinition pr ensemble curve set,
|
||||
/// but if enableIndividualEnsembleCaseSelection has been enabled,
|
||||
/// the ensembles are never available for direct selection, and this method will always return the
|
||||
/// "expanded" set of curvedefinitions
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RiaSummaryCurveDefinition> RiuSummaryVectorSelectionUi::selection() const
|
||||
{
|
||||
@@ -552,6 +556,14 @@ void RiuSummaryVectorSelectionUi::hideSummaryCases( bool hide )
|
||||
m_hideSummaryCases = hide;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuSummaryVectorSelectionUi::enableIndividualEnsembleCaseSelection( bool enable )
|
||||
{
|
||||
m_showIndividualEnsembleCases = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1339,9 +1351,26 @@ void RiuSummaryVectorSelectionUi::appendOptionItemsForSources( QList<caf::PdmOpt
|
||||
ensembleHeaderCreated = true;
|
||||
}
|
||||
|
||||
auto optionItem = caf::PdmOptionItemInfo( sumCaseColl->name(), sumCaseColl );
|
||||
optionItem.setLevel( 1 );
|
||||
options.push_back( optionItem );
|
||||
if ( !m_showIndividualEnsembleCases )
|
||||
{
|
||||
auto optionItem = caf::PdmOptionItemInfo( sumCaseColl->name(), sumCaseColl );
|
||||
optionItem.setLevel( 1 );
|
||||
options.push_back( optionItem );
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::PdmOptionItemInfo ensembleOpt =
|
||||
caf::PdmOptionItemInfo::createHeader( sumCaseColl->name(), true );
|
||||
ensembleOpt.setLevel( 1 );
|
||||
options.push_back( ensembleOpt );
|
||||
|
||||
for ( const auto& sumCase : sumCaseColl->allSummaryCases() )
|
||||
{
|
||||
auto optionItem = caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase );
|
||||
optionItem.setLevel( 2 );
|
||||
options.push_back( optionItem );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,8 @@ public:
|
||||
void setMultiSelectionMode( bool multiSelectionMode );
|
||||
void hideEnsembles( bool hide );
|
||||
void hideSummaryCases( bool hide );
|
||||
void enableIndividualEnsembleCaseSelection( bool enable );
|
||||
|
||||
void setFieldChangedHandler( const std::function<void()>& handlerFunc );
|
||||
|
||||
void setDefaultSelection( const std::vector<SummarySource*>& defaultCases );
|
||||
@@ -121,6 +123,7 @@ private:
|
||||
|
||||
bool m_hideEnsembles;
|
||||
bool m_hideSummaryCases;
|
||||
bool m_showIndividualEnsembleCases;
|
||||
|
||||
std::function<void()> m_toggleChangedHandler;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user