mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix ensemble selection if statistics curves are not shown
This commit is contained in:
parent
270bc9f369
commit
a703ac6bfd
@ -765,30 +765,29 @@ std::set<RiaRftPltCurveDefinition> RimWellPlotTools::curveDefsFromTimesteps(
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( addr.sourceType() == RifDataSourceForRftPlt::ENSEMBLE_RFT )
|
||||
else if ( addr.ensemble() )
|
||||
{
|
||||
if ( addr.ensemble() )
|
||||
// Add individual summary curves
|
||||
for ( RimSummaryCase* summaryCase : addr.ensemble()->allSummaryCases() )
|
||||
{
|
||||
for ( RimSummaryCase* summaryCase : addr.ensemble()->allSummaryCases() )
|
||||
if ( summaryCase && summaryCase->rftReader() )
|
||||
{
|
||||
if ( summaryCase && summaryCase->rftReader() )
|
||||
{
|
||||
RifDataSourceForRftPlt summaryAddr( RifDataSourceForRftPlt::SUMMARY_RFT,
|
||||
summaryCase,
|
||||
addr.ensemble() );
|
||||
RifDataSourceForRftPlt summaryAddr( RifDataSourceForRftPlt::SUMMARY_RFT, summaryCase, addr.ensemble() );
|
||||
|
||||
std::set<QDateTime> timeSteps = summaryCase->rftReader()->availableTimeSteps(
|
||||
wellPathNameOrSimWellName );
|
||||
for ( const QDateTime& time : timeSteps )
|
||||
std::set<QDateTime> timeSteps = summaryCase->rftReader()->availableTimeSteps(
|
||||
wellPathNameOrSimWellName );
|
||||
for ( const QDateTime& time : timeSteps )
|
||||
{
|
||||
if ( selectedTimeStepSet.count( time ) )
|
||||
{
|
||||
if ( selectedTimeStepSet.count( time ) )
|
||||
{
|
||||
curveDefs.insert(
|
||||
RiaRftPltCurveDefinition( summaryAddr, wellPathNameOrSimWellName, time ) );
|
||||
}
|
||||
curveDefs.insert( RiaRftPltCurveDefinition( summaryAddr, wellPathNameOrSimWellName, time ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add statistics curves
|
||||
if ( addr.sourceType() == RifDataSourceForRftPlt::ENSEMBLE_RFT )
|
||||
{
|
||||
std::set<QDateTime> statTimeSteps = addr.ensemble()->rftTimeStepsForWell( wellPathNameOrSimWellName );
|
||||
for ( const QDateTime& time : statTimeSteps )
|
||||
{
|
||||
|
@ -370,6 +370,11 @@ void RimWellRftPlot::updateEditorsFromCurves()
|
||||
{
|
||||
if ( curveDef.address().sourceType() == RifDataSourceForRftPlt::OBSERVED )
|
||||
selectedSources.insert( RifDataSourceForRftPlt( RifDataSourceForRftPlt::OBSERVED ) );
|
||||
else if ( curveDef.address().sourceType() == RifDataSourceForRftPlt::SUMMARY_RFT )
|
||||
{
|
||||
selectedSources.insert(
|
||||
RifDataSourceForRftPlt( RifDataSourceForRftPlt::ENSEMBLE_RFT, curveDef.address().ensemble() ) );
|
||||
}
|
||||
else
|
||||
selectedSources.insert( curveDef.address() );
|
||||
|
||||
@ -1235,6 +1240,33 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveD
|
||||
}
|
||||
}
|
||||
|
||||
auto ensembles = selectedEnsembles();
|
||||
for ( RimWellRftEnsembleCurveSet* curveSet : m_ensembleCurveSets() )
|
||||
{
|
||||
CAF_ASSERT( curveSet );
|
||||
auto ensemble_it = std::find_if( ensembles.begin(),
|
||||
ensembles.end(),
|
||||
[&curveSet]( const RimSummaryCaseCollection* ensemble ) {
|
||||
return curveSet->ensemble() == ensemble;
|
||||
} );
|
||||
if ( ensemble_it != ensembles.end() )
|
||||
{
|
||||
curveSet->initializeLegend();
|
||||
|
||||
if ( curveSet->legendConfig()->showLegend() && curveSet->colorMode() == ColorMode::BY_ENSEMBLE_PARAM &&
|
||||
!curveSet->currentEnsembleParameter().isEmpty() )
|
||||
{
|
||||
if ( !m_ensembleLegendFrames[curveSet] )
|
||||
{
|
||||
m_ensembleLegendFrames[curveSet] = new RiuCvfOverlayItemWidget( track->viewer(),
|
||||
track->viewer()->canvas() );
|
||||
}
|
||||
m_ensembleLegendFrames[curveSet]->updateFromOverlayItem( curveSet->legendConfig()->titledOverlayFrame() );
|
||||
track->viewer()->addOverlayFrame( m_ensembleLegendFrames[curveSet] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<cvf::Color3f> colorTable;
|
||||
RiaColorTables::summaryCurveDefaultPaletteColors().color3fArray().toStdVector( &colorTable );
|
||||
|
||||
@ -1251,34 +1283,17 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveD
|
||||
auto colorTableIndex = m_dataSourceColors.size();
|
||||
auto symbolTableIndex = m_timeStepSymbols.size();
|
||||
|
||||
RifDataSourceForRftPlt address = curveDefToAdd.address();
|
||||
|
||||
if ( address.sourceType() != RifDataSourceForRftPlt::SUMMARY_RFT )
|
||||
RifDataSourceForRftPlt address = curveDefToAdd.address();
|
||||
RifDataSourceForRftPlt colorAddress = address;
|
||||
if ( address.sourceType() == RifDataSourceForRftPlt::SUMMARY_RFT )
|
||||
{
|
||||
if ( !m_dataSourceColors.count( curveDefToAdd.address() ) )
|
||||
{
|
||||
colorTableIndex = colorTableIndex % colorTable.size();
|
||||
m_dataSourceColors[curveDefToAdd.address()] = colorTable[colorTableIndex];
|
||||
}
|
||||
colorAddress = RifDataSourceForRftPlt( RifDataSourceForRftPlt::ENSEMBLE_RFT, address.ensemble() );
|
||||
}
|
||||
|
||||
if ( address.sourceType() == RifDataSourceForRftPlt::ENSEMBLE_RFT && address.ensemble() )
|
||||
if ( !m_dataSourceColors.count( colorAddress ) )
|
||||
{
|
||||
RimWellRftEnsembleCurveSet* curveSet = findEnsembleCurveSet( address.ensemble() );
|
||||
CAF_ASSERT( curveSet );
|
||||
curveSet->initializeLegend();
|
||||
|
||||
if ( curveSet->legendConfig()->showLegend() && curveSet->colorMode() == ColorMode::BY_ENSEMBLE_PARAM &&
|
||||
!curveSet->currentEnsembleParameter().isEmpty() )
|
||||
{
|
||||
if ( !m_ensembleLegendFrames[curveSet] )
|
||||
{
|
||||
m_ensembleLegendFrames[curveSet] = new RiuCvfOverlayItemWidget( track->viewer(),
|
||||
track->viewer()->canvas() );
|
||||
}
|
||||
m_ensembleLegendFrames[curveSet]->updateFromOverlayItem( curveSet->legendConfig()->titledOverlayFrame() );
|
||||
track->viewer()->addOverlayFrame( m_ensembleLegendFrames[curveSet] );
|
||||
}
|
||||
colorTableIndex = colorTableIndex % colorTable.size();
|
||||
m_dataSourceColors[colorAddress] = colorTable[colorTableIndex];
|
||||
}
|
||||
|
||||
if ( address.sourceType() != RifDataSourceForRftPlt::ENSEMBLE_RFT )
|
||||
@ -1300,7 +1315,7 @@ std::vector<RimSummaryCaseCollection*> RimWellRftPlot::selectedEnsembles() const
|
||||
std::vector<RimSummaryCaseCollection*> ensembleSets;
|
||||
for ( const RifDataSourceForRftPlt& dataSource : m_selectedSources() )
|
||||
{
|
||||
if ( dataSource.sourceType() == RifDataSourceForRftPlt::ENSEMBLE_RFT )
|
||||
if ( dataSource.ensemble() != nullptr )
|
||||
{
|
||||
ensembleSets.push_back( dataSource.ensemble() );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user