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
0b5188e4b7
commit
ea793c15f3
@ -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(
|
std::set<QDateTime> timeSteps = summaryCase->rftReader()->availableTimeSteps(
|
||||||
wellPathNameOrSimWellName );
|
wellPathNameOrSimWellName );
|
||||||
for ( const QDateTime& time : timeSteps )
|
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 );
|
std::set<QDateTime> statTimeSteps = addr.ensemble()->rftTimeStepsForWell( wellPathNameOrSimWellName );
|
||||||
for ( const QDateTime& time : statTimeSteps )
|
for ( const QDateTime& time : statTimeSteps )
|
||||||
{
|
{
|
||||||
|
@ -370,6 +370,11 @@ void RimWellRftPlot::updateEditorsFromCurves()
|
|||||||
{
|
{
|
||||||
if ( curveDef.address().sourceType() == RifDataSourceForRftPlt::OBSERVED )
|
if ( curveDef.address().sourceType() == RifDataSourceForRftPlt::OBSERVED )
|
||||||
selectedSources.insert( RifDataSourceForRftPlt( 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
|
else
|
||||||
selectedSources.insert( curveDef.address() );
|
selectedSources.insert( curveDef.address() );
|
||||||
|
|
||||||
@ -1236,6 +1241,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;
|
std::vector<cvf::Color3f> colorTable;
|
||||||
RiaColorTables::summaryCurveDefaultPaletteColors().color3fArray().toStdVector( &colorTable );
|
RiaColorTables::summaryCurveDefaultPaletteColors().color3fArray().toStdVector( &colorTable );
|
||||||
|
|
||||||
@ -1252,34 +1284,17 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveD
|
|||||||
auto colorTableIndex = m_dataSourceColors.size();
|
auto colorTableIndex = m_dataSourceColors.size();
|
||||||
auto symbolTableIndex = m_timeStepSymbols.size();
|
auto symbolTableIndex = m_timeStepSymbols.size();
|
||||||
|
|
||||||
RifDataSourceForRftPlt address = curveDefToAdd.address();
|
RifDataSourceForRftPlt address = curveDefToAdd.address();
|
||||||
|
RifDataSourceForRftPlt colorAddress = address;
|
||||||
if ( address.sourceType() != RifDataSourceForRftPlt::SUMMARY_RFT )
|
if ( address.sourceType() == RifDataSourceForRftPlt::SUMMARY_RFT )
|
||||||
{
|
{
|
||||||
if ( !m_dataSourceColors.count( curveDefToAdd.address() ) )
|
colorAddress = RifDataSourceForRftPlt( RifDataSourceForRftPlt::ENSEMBLE_RFT, address.ensemble() );
|
||||||
{
|
|
||||||
colorTableIndex = colorTableIndex % colorTable.size();
|
|
||||||
m_dataSourceColors[curveDefToAdd.address()] = colorTable[colorTableIndex];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( address.sourceType() == RifDataSourceForRftPlt::ENSEMBLE_RFT && address.ensemble() )
|
if ( !m_dataSourceColors.count( colorAddress ) )
|
||||||
{
|
{
|
||||||
RimWellRftEnsembleCurveSet* curveSet = findEnsembleCurveSet( address.ensemble() );
|
colorTableIndex = colorTableIndex % colorTable.size();
|
||||||
CAF_ASSERT( curveSet );
|
m_dataSourceColors[colorAddress] = colorTable[colorTableIndex];
|
||||||
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] );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( address.sourceType() != RifDataSourceForRftPlt::ENSEMBLE_RFT )
|
if ( address.sourceType() != RifDataSourceForRftPlt::ENSEMBLE_RFT )
|
||||||
@ -1301,7 +1316,7 @@ std::vector<RimSummaryCaseCollection*> RimWellRftPlot::selectedEnsembles() const
|
|||||||
std::vector<RimSummaryCaseCollection*> ensembleSets;
|
std::vector<RimSummaryCaseCollection*> ensembleSets;
|
||||||
for ( const RifDataSourceForRftPlt& dataSource : m_selectedSources() )
|
for ( const RifDataSourceForRftPlt& dataSource : m_selectedSources() )
|
||||||
{
|
{
|
||||||
if ( dataSource.sourceType() == RifDataSourceForRftPlt::ENSEMBLE_RFT )
|
if ( dataSource.ensemble() != nullptr )
|
||||||
{
|
{
|
||||||
ensembleSets.push_back( dataSource.ensemble() );
|
ensembleSets.push_back( dataSource.ensemble() );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user