mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #8865 from OPM/8863-summary-issues
This commit is contained in:
@@ -42,14 +42,9 @@ RiaSummaryCurveDefinition::RiaSummaryCurveDefinition( RimSummaryCase*
|
|||||||
bool isEnsembleCurve )
|
bool isEnsembleCurve )
|
||||||
: m_summaryCase( summaryCase )
|
: m_summaryCase( summaryCase )
|
||||||
, m_summaryAddress( summaryAddress )
|
, m_summaryAddress( summaryAddress )
|
||||||
|
, m_ensemble( nullptr )
|
||||||
, m_isEnsembleCurve( isEnsembleCurve )
|
, m_isEnsembleCurve( isEnsembleCurve )
|
||||||
{
|
{
|
||||||
if ( summaryCase )
|
|
||||||
{
|
|
||||||
RimSummaryCaseCollection* ensemble = nullptr;
|
|
||||||
summaryCase->firstAncestorOfType( ensemble );
|
|
||||||
m_ensemble = ensemble;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ RicSummaryPlotEditorUi::RicSummaryPlotEditorUi()
|
|||||||
CAF_PDM_InitFieldNoDefault( &m_groupAppearanceType, "GroupAppearanceType", "Group" );
|
CAF_PDM_InitFieldNoDefault( &m_groupAppearanceType, "GroupAppearanceType", "Group" );
|
||||||
CAF_PDM_InitFieldNoDefault( &m_regionAppearanceType, "RegionAppearanceType", "Region" );
|
CAF_PDM_InitFieldNoDefault( &m_regionAppearanceType, "RegionAppearanceType", "Region" );
|
||||||
|
|
||||||
m_previewPlot.reset( new RimSummaryPlot() );
|
m_previewPlot = std::make_unique<RimSummaryPlot>();
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_useAutoPlotTitleProxy, "UseAutoPlotTitle", "Auto Plot Title" );
|
CAF_PDM_InitFieldNoDefault( &m_useAutoPlotTitleProxy, "UseAutoPlotTitle", "Auto Plot Title" );
|
||||||
m_useAutoPlotTitleProxy.registerGetMethod( this, &RicSummaryPlotEditorUi::proxyPlotAutoTitle );
|
m_useAutoPlotTitleProxy.registerGetMethod( this, &RicSummaryPlotEditorUi::proxyPlotAutoTitle );
|
||||||
@@ -124,7 +124,7 @@ RicSummaryPlotEditorUi::RicSummaryPlotEditorUi()
|
|||||||
m_curveNameConfig.uiCapability()->setUiTreeHidden( true );
|
m_curveNameConfig.uiCapability()->setUiTreeHidden( true );
|
||||||
m_curveNameConfig.uiCapability()->setUiTreeChildrenHidden( true );
|
m_curveNameConfig.uiCapability()->setUiTreeChildrenHidden( true );
|
||||||
|
|
||||||
m_summaryCurveSelectionEditor.reset( new RiuSummaryVectorSelectionWidgetCreator() );
|
m_summaryCurveSelectionEditor = std::make_unique<RiuSummaryVectorSelectionWidgetCreator>();
|
||||||
|
|
||||||
m_summaryCurveSelectionEditor->summaryAddressSelection()->setFieldChangedHandler(
|
m_summaryCurveSelectionEditor->summaryAddressSelection()->setFieldChangedHandler(
|
||||||
[this]() { this->selectionEditorFieldChanged(); } );
|
[this]() { this->selectionEditorFieldChanged(); } );
|
||||||
@@ -338,6 +338,13 @@ void RicSummaryPlotEditorUi::syncPreviewCurvesFromUiSelection()
|
|||||||
{
|
{
|
||||||
std::vector<RiaSummaryCurveDefinition> allCurveDefinitionsVector =
|
std::vector<RiaSummaryCurveDefinition> allCurveDefinitionsVector =
|
||||||
m_summaryCurveSelectionEditor->summaryAddressSelection()->allCurveDefinitionsFromSelection();
|
m_summaryCurveSelectionEditor->summaryAddressSelection()->allCurveDefinitionsFromSelection();
|
||||||
|
|
||||||
|
auto curveSetDefs = m_summaryCurveSelectionEditor->summaryAddressSelection()->allCurveSetDefinitionsFromSelections();
|
||||||
|
for ( const auto& curveSet : curveSetDefs )
|
||||||
|
{
|
||||||
|
allCurveDefinitionsVector.emplace_back( curveSet.ensemble(), curveSet.summaryAddress() );
|
||||||
|
}
|
||||||
|
|
||||||
std::set<RiaSummaryCurveDefinition> allCurveDefinitions =
|
std::set<RiaSummaryCurveDefinition> allCurveDefinitions =
|
||||||
std::set<RiaSummaryCurveDefinition>( allCurveDefinitionsVector.begin(), allCurveDefinitionsVector.end() );
|
std::set<RiaSummaryCurveDefinition>( allCurveDefinitionsVector.begin(), allCurveDefinitionsVector.end() );
|
||||||
|
|
||||||
@@ -461,18 +468,7 @@ void RicSummaryPlotEditorUi::updatePreviewCurvesFromCurveDefinitions(
|
|||||||
std::map<RimSummaryCurve*, std::pair<bool, bool>> stashedErrorBarsAndLegendVisibility;
|
std::map<RimSummaryCurve*, std::pair<bool, bool>> stashedErrorBarsAndLegendVisibility;
|
||||||
for ( const auto& curveDef : curveDefsToAdd )
|
for ( const auto& curveDef : curveDefsToAdd )
|
||||||
{
|
{
|
||||||
RimSummaryCase* currentCase = curveDef.summaryCase();
|
RimSummaryCase* currentCase = curveDef.summaryCase();
|
||||||
RimSummaryCurve* curve = new RimSummaryCurve();
|
|
||||||
if ( speedCheatsRequired )
|
|
||||||
{
|
|
||||||
stashedErrorBarsAndLegendVisibility[curve] = std::make_pair( curve->errorBarsVisible(), curve->showInLegend() );
|
|
||||||
curve->setErrorBarsVisible( false );
|
|
||||||
curve->setShowInLegend( false );
|
|
||||||
}
|
|
||||||
curve->setSummaryCaseY( currentCase );
|
|
||||||
curve->setSummaryAddressYAndApplyInterpolation( curveDef.summaryAddress() );
|
|
||||||
curve->applyCurveAutoNameSettings( *m_curveNameConfig() );
|
|
||||||
if ( currentCase->isObservedData() ) curve->setSymbolSkipDistance( 0 );
|
|
||||||
|
|
||||||
if ( curveDef.isEnsembleCurve() )
|
if ( curveDef.isEnsembleCurve() )
|
||||||
{
|
{
|
||||||
@@ -522,10 +518,22 @@ void RicSummaryPlotEditorUi::updatePreviewCurvesFromCurveDefinitions(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
curveSet->addCurve( curve );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
RimSummaryCurve* curve = new RimSummaryCurve();
|
||||||
|
if ( speedCheatsRequired )
|
||||||
|
{
|
||||||
|
stashedErrorBarsAndLegendVisibility[curve] =
|
||||||
|
std::make_pair( curve->errorBarsVisible(), curve->showInLegend() );
|
||||||
|
curve->setErrorBarsVisible( false );
|
||||||
|
curve->setShowInLegend( false );
|
||||||
|
}
|
||||||
|
curve->setSummaryCaseY( currentCase );
|
||||||
|
curve->setSummaryAddressYAndApplyInterpolation( curveDef.summaryAddress() );
|
||||||
|
curve->applyCurveAutoNameSettings( *m_curveNameConfig() );
|
||||||
|
if ( currentCase && currentCase->isObservedData() ) curve->setSymbolSkipDistance( 0 );
|
||||||
|
|
||||||
m_previewPlot->addCurveNoUpdate( curve );
|
m_previewPlot->addCurveNoUpdate( curve );
|
||||||
curveLookCalc.setupCurveLook( curve );
|
curveLookCalc.setupCurveLook( curve );
|
||||||
}
|
}
|
||||||
@@ -625,10 +633,7 @@ void RicSummaryPlotEditorUi::populateCurveCreator( const RimSummaryPlot& sourceS
|
|||||||
previewCurveSetColl->addCurveSet( newCurveSet );
|
previewCurveSetColl->addCurveSet( newCurveSet );
|
||||||
|
|
||||||
RimSummaryCaseCollection* ensemble = curveSet->summaryCaseCollection();
|
RimSummaryCaseCollection* ensemble = curveSet->summaryCaseCollection();
|
||||||
for ( const auto& curve : curveSet->curves() )
|
curveDefs.emplace_back( ensemble, curveSet->summaryAddress() );
|
||||||
{
|
|
||||||
curveDefs.push_back( curve->curveDefinitionY() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_previewPlot->copyAxisPropertiesFromOther( sourceSummaryPlot );
|
m_previewPlot->copyAxisPropertiesFromOther( sourceSummaryPlot );
|
||||||
|
|||||||
@@ -1132,6 +1132,7 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|||||||
candicateAddress = m_xValuesSummaryAddress->address();
|
candicateAddress = m_xValuesSummaryAddress->address();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dlg.hideEnsembles();
|
||||||
dlg.setCaseAndAddress( candidateCase, candicateAddress );
|
dlg.setCaseAndAddress( candidateCase, candicateAddress );
|
||||||
|
|
||||||
if ( dlg.exec() == QDialog::Accepted )
|
if ( dlg.exec() == QDialog::Accepted )
|
||||||
@@ -1165,6 +1166,7 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|||||||
candicateAddress = m_yValuesSummaryAddress->address();
|
candicateAddress = m_yValuesSummaryAddress->address();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dlg.hideEnsembles();
|
||||||
dlg.setCaseAndAddress( candidateCase, candicateAddress );
|
dlg.setCaseAndAddress( candidateCase, candicateAddress );
|
||||||
|
|
||||||
if ( dlg.exec() == QDialog::Accepted )
|
if ( dlg.exec() == QDialog::Accepted )
|
||||||
|
|||||||
@@ -2453,6 +2453,11 @@ void RimSummaryPlot::updateCurveNames()
|
|||||||
for ( auto curveSet : m_ensembleCurveSetCollection->curveSets() )
|
for ( auto curveSet : m_ensembleCurveSetCollection->curveSets() )
|
||||||
{
|
{
|
||||||
curveSet->updateEnsembleLegendItem();
|
curveSet->updateEnsembleLegendItem();
|
||||||
|
|
||||||
|
if ( curveSet->isCurvesVisible() )
|
||||||
|
{
|
||||||
|
shortCurveNames.append( QString::fromStdString( curveSet->summaryAddress().quantityName() ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_alternatePlotName = shortCurveNames.join( "," );
|
m_alternatePlotName = shortCurveNames.join( "," );
|
||||||
@@ -2504,6 +2509,8 @@ void RimSummaryPlot::onCurveCollectionChanged( const SignalEmitter* emitter )
|
|||||||
{
|
{
|
||||||
updateStackedCurveData();
|
updateStackedCurveData();
|
||||||
if ( plotWidget() ) plotWidget()->scheduleReplot();
|
if ( plotWidget() ) plotWidget()->scheduleReplot();
|
||||||
|
|
||||||
|
updateAllRequiredEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ QSize RiuQwtPlotLegend::sizeHint() const
|
|||||||
void RiuQwtPlotLegend::updateLegend( const QVariant& variant, const QList<QwtLegendData>& legendItems )
|
void RiuQwtPlotLegend::updateLegend( const QVariant& variant, const QList<QwtLegendData>& legendItems )
|
||||||
{
|
{
|
||||||
QwtLegend::updateLegend( variant, legendItems );
|
QwtLegend::updateLegend( variant, legendItems );
|
||||||
|
setVisible( !legendItems.empty() );
|
||||||
emit legendUpdated();
|
emit legendUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -329,28 +329,17 @@ std::vector<RiaSummaryCurveDefinition> RiuSummaryVectorSelectionUi::allCurveDefi
|
|||||||
|
|
||||||
for ( SummarySource* currSource : selectedSummarySources() )
|
for ( SummarySource* currSource : selectedSummarySources() )
|
||||||
{
|
{
|
||||||
RimSummaryCaseCollection* ensemble = dynamic_cast<RimSummaryCaseCollection*>( currSource );
|
RimSummaryCase* sumCase = dynamic_cast<RimSummaryCase*>( currSource );
|
||||||
RimSummaryCase* sumCase = dynamic_cast<RimSummaryCase*>( currSource );
|
if ( sumCase == nullptr ) continue;
|
||||||
|
|
||||||
std::set<RifEclipseSummaryAddress> addressesFromSource;
|
std::set<RifEclipseSummaryAddress> addressesFromSource;
|
||||||
std::vector<RimSummaryCase*> casesFromSource;
|
std::vector<RimSummaryCase*> casesFromSource;
|
||||||
|
|
||||||
// Build case list
|
RifSummaryReaderInterface* reader = sumCase ? sumCase->summaryReader() : nullptr;
|
||||||
if ( ensemble )
|
if ( reader )
|
||||||
{
|
{
|
||||||
auto addresses = ensemble->ensembleSummaryAddresses();
|
addressesFromSource.insert( reader->allResultAddresses().begin(), reader->allResultAddresses().end() );
|
||||||
addressesFromSource.insert( addresses.begin(), addresses.end() );
|
casesFromSource.push_back( sumCase );
|
||||||
auto ensembleCases = ensemble->allSummaryCases();
|
|
||||||
casesFromSource.insert( casesFromSource.end(), ensembleCases.begin(), ensembleCases.end() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RifSummaryReaderInterface* reader = sumCase ? sumCase->summaryReader() : nullptr;
|
|
||||||
if ( reader )
|
|
||||||
{
|
|
||||||
addressesFromSource.insert( reader->allResultAddresses().begin(), reader->allResultAddresses().end() );
|
|
||||||
casesFromSource.push_back( sumCase );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( auto caseFromSource : casesFromSource )
|
for ( auto caseFromSource : casesFromSource )
|
||||||
@@ -359,8 +348,7 @@ std::vector<RiaSummaryCurveDefinition> RiuSummaryVectorSelectionUi::allCurveDefi
|
|||||||
{
|
{
|
||||||
if ( selectedAddressesFromUi.count( addressFromSource ) > 0 )
|
if ( selectedAddressesFromUi.count( addressFromSource ) > 0 )
|
||||||
{
|
{
|
||||||
curveDefinitions.insert(
|
curveDefinitions.insert( RiaSummaryCurveDefinition( caseFromSource, addressFromSource, false ) );
|
||||||
RiaSummaryCurveDefinition( caseFromSource, addressFromSource, ensemble != nullptr ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -593,15 +581,6 @@ QList<caf::PdmOptionItemInfo> RiuSummaryVectorSelectionUi::optionsForSummaryData
|
|||||||
optionItem.setLevel( 1 );
|
optionItem.setLevel( 1 );
|
||||||
options.push_back( optionItem );
|
options.push_back( optionItem );
|
||||||
}
|
}
|
||||||
if ( showIndividualEnsembleCases )
|
|
||||||
{
|
|
||||||
for ( const auto& sumCase : sumCaseColl->allSummaryCases() )
|
|
||||||
{
|
|
||||||
auto optionItem = caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase );
|
|
||||||
optionItem.setLevel( 2 );
|
|
||||||
options.push_back( optionItem );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -610,7 +589,7 @@ QList<caf::PdmOptionItemInfo> RiuSummaryVectorSelectionUi::optionsForSummaryData
|
|||||||
// Grouped cases
|
// Grouped cases
|
||||||
for ( const auto& sumCaseColl : sumCaseMainColl->summaryCaseCollections() )
|
for ( const auto& sumCaseColl : sumCaseMainColl->summaryCaseCollections() )
|
||||||
{
|
{
|
||||||
if ( sumCaseColl->isEnsemble() ) continue;
|
if ( sumCaseColl->isEnsemble() && !showIndividualEnsembleCases ) continue;
|
||||||
|
|
||||||
options.push_back( caf::PdmOptionItemInfo::createHeader( sumCaseColl->name(), true ) );
|
options.push_back( caf::PdmOptionItemInfo::createHeader( sumCaseColl->name(), true ) );
|
||||||
|
|
||||||
@@ -687,7 +666,6 @@ void RiuSummaryVectorSelectionUi::setSelectedCurveDefinitions( const std::vector
|
|||||||
m_selectedSources.end() )
|
m_selectedSources.end() )
|
||||||
{
|
{
|
||||||
m_selectedSources.push_back( curveDef.ensemble() );
|
m_selectedSources.push_back( curveDef.ensemble() );
|
||||||
handleAddedSource( curveDef.ensemble() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -699,7 +677,6 @@ void RiuSummaryVectorSelectionUi::setSelectedCurveDefinitions( const std::vector
|
|||||||
m_selectedSources.end() )
|
m_selectedSources.end() )
|
||||||
{
|
{
|
||||||
m_selectedSources.push_back( curveDef.summaryCase() );
|
m_selectedSources.push_back( curveDef.summaryCase() );
|
||||||
handleAddedSource( curveDef.summaryCase() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -742,8 +719,6 @@ void RiuSummaryVectorSelectionUi::setSelectedCurveDefinitions( const std::vector
|
|||||||
m_currentSummaryCategory.setValue( cat );
|
m_currentSummaryCategory.setValue( cat );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_previouslySelectedSources = m_selectedSources.ptrReferencedObjects();
|
|
||||||
|
|
||||||
m_prevCurveCount = allCurveDefinitionsFromSelection().size();
|
m_prevCurveCount = allCurveDefinitionsFromSelection().size();
|
||||||
m_prevCurveSetCount = allCurveSetDefinitionsFromSelections().size();
|
m_prevCurveSetCount = allCurveSetDefinitionsFromSelections().size();
|
||||||
}
|
}
|
||||||
@@ -776,35 +751,6 @@ void RiuSummaryVectorSelectionUi::fieldChangedByUi( const caf::PdmFieldHandle* c
|
|||||||
const QVariant& oldValue,
|
const QVariant& oldValue,
|
||||||
const QVariant& newValue )
|
const QVariant& newValue )
|
||||||
{
|
{
|
||||||
if ( changedField == &m_selectedSources )
|
|
||||||
{
|
|
||||||
caf::PdmObject* objectAdded = nullptr;
|
|
||||||
for ( caf::PdmObject* selectedObject : m_selectedSources() )
|
|
||||||
{
|
|
||||||
auto it = std::find( m_previouslySelectedSources.begin(), m_previouslySelectedSources.end(), selectedObject );
|
|
||||||
if ( it == m_previouslySelectedSources.end() )
|
|
||||||
{
|
|
||||||
objectAdded = selectedObject;
|
|
||||||
handleAddedSource( objectAdded );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( !objectAdded )
|
|
||||||
{
|
|
||||||
caf::PdmObject* objectRemoved = nullptr;
|
|
||||||
for ( caf::PdmObject* previouslySelectedObject : m_previouslySelectedSources )
|
|
||||||
{
|
|
||||||
auto it = std::find( m_selectedSources.begin(), m_selectedSources.end(), previouslySelectedObject );
|
|
||||||
if ( it == m_selectedSources.end() )
|
|
||||||
{
|
|
||||||
objectRemoved = previouslySelectedObject;
|
|
||||||
handleRemovedSource( objectRemoved );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_previouslySelectedSources = m_selectedSources.ptrReferencedObjects();
|
|
||||||
}
|
|
||||||
if ( changedField != &m_selectedSources && changedField != &m_selectedSummaryCategories &&
|
if ( changedField != &m_selectedSources && changedField != &m_selectedSummaryCategories &&
|
||||||
changedField != &m_currentSummaryCategory )
|
changedField != &m_currentSummaryCategory )
|
||||||
{
|
{
|
||||||
@@ -1391,7 +1337,6 @@ void RiuSummaryVectorSelectionUi::defineEditorAttribute( const caf::PdmFieldHand
|
|||||||
void RiuSummaryVectorSelectionUi::resetAllFields()
|
void RiuSummaryVectorSelectionUi::resetAllFields()
|
||||||
{
|
{
|
||||||
m_selectedSources.clear();
|
m_selectedSources.clear();
|
||||||
m_previouslySelectedSources.clear();
|
|
||||||
m_selectedSummaryCategories = std::vector<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>>();
|
m_selectedSummaryCategories = std::vector<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>>();
|
||||||
|
|
||||||
// clear all state in fields
|
// clear all state in fields
|
||||||
@@ -1627,91 +1572,3 @@ void RiuSummaryVectorSelectionUi::appendOptionItemsForSubCategoriesAndVectors( Q
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RiuSummaryVectorSelectionUi::handleAddedSource( SummarySource* sourceAdded )
|
|
||||||
{
|
|
||||||
CAF_ASSERT( sourceAdded );
|
|
||||||
auto caseCollection = dynamic_cast<RimSummaryCaseCollection*>( sourceAdded );
|
|
||||||
if ( caseCollection && m_showIndividualEnsembleCases )
|
|
||||||
{
|
|
||||||
// Select all children
|
|
||||||
for ( auto summaryCase : caseCollection->allSummaryCases() )
|
|
||||||
{
|
|
||||||
auto it = std::find( m_selectedSources.begin(), m_selectedSources.end(), summaryCase );
|
|
||||||
if ( it == m_selectedSources.end() )
|
|
||||||
{
|
|
||||||
m_selectedSources.push_back( summaryCase );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto summaryCase = dynamic_cast<RimSummaryCase*>( sourceAdded );
|
|
||||||
if ( summaryCase )
|
|
||||||
{
|
|
||||||
auto caseCollection = summaryCase->ensemble();
|
|
||||||
if ( caseCollection )
|
|
||||||
{
|
|
||||||
auto it = std::find( m_selectedSources.begin(), m_selectedSources.end(), caseCollection );
|
|
||||||
if ( it == m_selectedSources.end() )
|
|
||||||
{
|
|
||||||
// Check if all children have been selected.
|
|
||||||
bool allChildrenSelected = true;
|
|
||||||
for ( auto summaryChild : caseCollection->allSummaryCases() )
|
|
||||||
{
|
|
||||||
auto it = std::find( m_selectedSources.begin(), m_selectedSources.end(), summaryChild );
|
|
||||||
if ( it == m_selectedSources.end() )
|
|
||||||
{
|
|
||||||
allChildrenSelected = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( allChildrenSelected ) // Add collection if all children have been selected
|
|
||||||
{
|
|
||||||
m_selectedSources.push_back( caseCollection );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RiuSummaryVectorSelectionUi::handleRemovedSource( SummarySource* sourceRemoved )
|
|
||||||
{
|
|
||||||
CAF_ASSERT( sourceRemoved );
|
|
||||||
auto caseCollection = dynamic_cast<RimSummaryCaseCollection*>( sourceRemoved );
|
|
||||||
if ( caseCollection )
|
|
||||||
{
|
|
||||||
// Select all children
|
|
||||||
for ( auto summaryCase : caseCollection->allSummaryCases() )
|
|
||||||
{
|
|
||||||
auto it = std::find( m_selectedSources.begin(), m_selectedSources.end(), summaryCase );
|
|
||||||
if ( it != m_selectedSources.end() )
|
|
||||||
{
|
|
||||||
m_selectedSources.removePtr( *it );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto summaryCase = dynamic_cast<RimSummaryCase*>( sourceRemoved );
|
|
||||||
if ( summaryCase )
|
|
||||||
{
|
|
||||||
auto caseCollection = summaryCase->ensemble();
|
|
||||||
if ( caseCollection )
|
|
||||||
{
|
|
||||||
auto it = std::find( m_selectedSources.begin(), m_selectedSources.end(), caseCollection );
|
|
||||||
if ( it != m_selectedSources.end() )
|
|
||||||
{
|
|
||||||
m_selectedSources.removePtr( *it );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -118,12 +118,8 @@ private:
|
|||||||
void appendOptionItemsForSubCategoriesAndVectors( QList<caf::PdmOptionItemInfo>& options,
|
void appendOptionItemsForSubCategoriesAndVectors( QList<caf::PdmOptionItemInfo>& options,
|
||||||
SummaryIdentifierAndField* identifierAndField ) const;
|
SummaryIdentifierAndField* identifierAndField ) const;
|
||||||
|
|
||||||
void handleAddedSource( SummarySource* sourceAdded );
|
|
||||||
void handleRemovedSource( SummarySource* sourceRemoved );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmPtrArrayField<SummarySource*> m_selectedSources;
|
caf::PdmPtrArrayField<SummarySource*> m_selectedSources;
|
||||||
std::vector<SummarySource*> m_previouslySelectedSources;
|
|
||||||
|
|
||||||
caf::PdmField<std::vector<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>>> m_selectedSummaryCategories;
|
caf::PdmField<std::vector<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>>> m_selectedSummaryCategories;
|
||||||
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>> m_currentSummaryCategory;
|
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>> m_currentSummaryCategory;
|
||||||
|
|||||||
Reference in New Issue
Block a user