#7380 Correlation Plot : Use complete summary address text when possible

This commit is contained in:
Magne Sjaastad
2021-02-17 08:42:32 +01:00
parent b93be2f73b
commit b5cb011c2f
8 changed files with 49 additions and 21 deletions

View File

@@ -227,7 +227,7 @@ void RiaSummaryCurveDefinitionAnalyser::setCurveDefinitions( const std::vector<R
m_singleSummaryCases.clear(); m_singleSummaryCases.clear();
m_ensembles.clear(); m_ensembles.clear();
m_quantityNames.clear(); m_quantityNames.clear();
m_summaryItems.clear(); m_summaryAdresses.clear();
for ( const auto& curveDef : curveDefs ) for ( const auto& curveDef : curveDefs )
{ {
@@ -247,14 +247,13 @@ void RiaSummaryCurveDefinitionAnalyser::setCurveDefinitions( const std::vector<R
} }
valid = true; valid = true;
} }
if ( valid ) if ( valid )
{ {
RifEclipseSummaryAddress address = curveDef.summaryAddress(); const RifEclipseSummaryAddress& address = curveDef.summaryAddress();
m_quantityNames.insert( address.quantityName() ); m_quantityNames.insert( address.quantityName() );
m_summaryAdresses.insert( address );
address.setQuantityName( "" );
if ( !address.itemUiText().empty() ) m_summaryItems.insert( address );
} }
} }
} }

View File

@@ -74,6 +74,6 @@ public:
std::set<RimSummaryCase*> m_singleSummaryCases; // All summary cases used std::set<RimSummaryCase*> m_singleSummaryCases; // All summary cases used
std::set<RimSummaryCaseCollection*> m_ensembles; // All the ensembles referenced by the summary cases std::set<RimSummaryCaseCollection*> m_ensembles; // All the ensembles referenced by the summary cases
std::set<RifEclipseSummaryAddress> m_summaryItems; // Quantity name set to "", stores only the identifiers std::set<RifEclipseSummaryAddress> m_summaryAdresses;
std::set<std::string> m_quantityNames; // Quantity names from the addresses std::set<std::string> m_quantityNames; // Quantity names from the addresses
}; };

View File

@@ -664,7 +664,7 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
{ {
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( NONE ), NONE ) ); options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( NONE ), NONE ) );
QStringList currentSummaryItems; QStringList currentSummaryItems;
for ( auto summaryAddr : getOrCreateSelectedCurveDefAnalyser()->m_summaryItems ) for ( auto summaryAddr : getOrCreateSelectedCurveDefAnalyser()->m_summaryAdresses )
{ {
currentSummaryItems.push_back( QString::fromStdString( summaryAddr.itemUiText() ) ); currentSummaryItems.push_back( QString::fromStdString( summaryAddr.itemUiText() ) );
} }
@@ -1620,11 +1620,11 @@ void RimAnalysisPlot::updatePlotTitle()
} }
} }
if ( getOrCreateSelectedCurveDefAnalyser()->m_summaryItems.size() == 1 ) if ( getOrCreateSelectedCurveDefAnalyser()->m_summaryAdresses.size() == 1 )
{ {
if ( !autoTitle.isEmpty() ) autoTitle += separator; if ( !autoTitle.isEmpty() ) autoTitle += separator;
autoTitle += autoTitle +=
QString::fromStdString( getOrCreateSelectedCurveDefAnalyser()->m_summaryItems.begin()->itemUiText() ); QString::fromStdString( getOrCreateSelectedCurveDefAnalyser()->m_summaryAdresses.begin()->itemUiText() );
} }
for ( std::string quantName : getOrCreateSelectedCurveDefAnalyser()->m_quantityNames ) for ( std::string quantName : getOrCreateSelectedCurveDefAnalyser()->m_quantityNames )

View File

@@ -555,7 +555,7 @@ time_t RimAbstractCorrelationPlot::timeDiff( time_t lhs, time_t rhs )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimAbstractCorrelationPlot::selectedVarsText() QString RimAbstractCorrelationPlot::selectedQuantitiesText()
{ {
QString vectorNames; QString vectorNames;
for ( const std::string& quantityName : getOrCreateSelectedCurveDefAnalyser()->m_quantityNames ) for ( const std::string& quantityName : getOrCreateSelectedCurveDefAnalyser()->m_quantityNames )
@@ -571,6 +571,25 @@ QString RimAbstractCorrelationPlot::selectedVarsText()
return vectorNames; return vectorNames;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimAbstractCorrelationPlot::completeAddressText()
{
QString vectorName;
if ( getOrCreateSelectedCurveDefAnalyser()->m_summaryAdresses.size() == 1 )
{
auto firstItem = getOrCreateSelectedCurveDefAnalyser()->m_summaryAdresses.begin();
vectorName = QString::fromStdString( firstItem->uiText() );
}
else
{
vectorName = m_selectedVarsUiField;
}
return vectorName;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -77,8 +77,6 @@ protected:
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override; bool* useOptionsOnly ) override;
RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser();
std::set<RifEclipseSummaryAddress> addresses(); std::set<RifEclipseSummaryAddress> addresses();
std::set<EnsembleParameter> ensembleParameters(); std::set<EnsembleParameter> ensembleParameters();
std::set<EnsembleParameter> variationSortedEnsembleParameters(); std::set<EnsembleParameter> variationSortedEnsembleParameters();
@@ -112,7 +110,8 @@ protected:
static time_t timeDiff( time_t lhs, time_t rhs ); static time_t timeDiff( time_t lhs, time_t rhs );
QString selectedVarsText(); QString selectedQuantitiesText();
QString completeAddressText();
void initAfterRead() final; void initAfterRead() final;
@@ -140,4 +139,7 @@ protected:
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_labelFontSize; caf::PdmField<caf::FontTools::RelativeSizeEnum> m_labelFontSize;
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_axisTitleFontSize; caf::PdmField<caf::FontTools::RelativeSizeEnum> m_axisTitleFontSize;
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_axisValueFontSize; caf::PdmField<caf::FontTools::RelativeSizeEnum> m_axisValueFontSize;
private:
RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser();
}; };

View File

@@ -315,7 +315,7 @@ void RimCorrelationMatrixPlot::defineUiOrdering( QString uiConfigName, caf::PdmU
} }
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector" ); caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector" );
m_selectedVarsUiField = selectedVarsText(); m_selectedVarsUiField = selectedQuantitiesText();
curveDataGroup->add( &m_selectedVarsUiField ); curveDataGroup->add( &m_selectedVarsUiField );
curveDataGroup->add( &m_pushButtonSelectSummaryAddress, { false, 1, 0 } ); curveDataGroup->add( &m_pushButtonSelectSummaryAddress, { false, 1, 0 } );
@@ -371,7 +371,7 @@ void RimCorrelationMatrixPlot::onLoadDataAndUpdate()
{ {
updateMdiWindowVisibility(); updateMdiWindowVisibility();
m_selectedVarsUiField = selectedVarsText(); m_selectedVarsUiField = selectedQuantitiesText();
if ( m_plotWidget ) if ( m_plotWidget )
{ {

View File

@@ -181,7 +181,7 @@ void RimCorrelationPlot::onLoadDataAndUpdate()
{ {
updateMdiWindowVisibility(); updateMdiWindowVisibility();
m_selectedVarsUiField = selectedVarsText(); m_selectedVarsUiField = selectedQuantitiesText();
if ( m_plotWidget && m_analyserOfSelectedCurveDefs ) if ( m_plotWidget && m_analyserOfSelectedCurveDefs )
{ {
@@ -267,9 +267,11 @@ void RimCorrelationPlot::updatePlotTitle()
{ {
if ( m_useAutoPlotTitle && !ensembles().empty() ) if ( m_useAutoPlotTitle && !ensembles().empty() )
{ {
QString vectorName = completeAddressText();
auto ensemble = *ensembles().begin(); auto ensemble = *ensembles().begin();
m_description = m_description =
QString( "Correlations for %2, %3 at %4" ).arg( ensemble->name() ).arg( m_selectedVarsUiField ).arg( timeStepString() ); QString( "Correlations for %2, %3 at %4" ).arg( ensemble->name() ).arg( vectorName ).arg( timeStepString() );
} }
m_plotWidget->setPlotTitle( m_description ); m_plotWidget->setPlotTitle( m_description );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() ); m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );

View File

@@ -115,7 +115,7 @@ void RimParameterResultCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* c
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimParameterResultCrossPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) void RimParameterResultCrossPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
m_selectedVarsUiField = selectedVarsText(); m_selectedVarsUiField = selectedQuantitiesText();
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector" ); caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector" );
curveDataGroup->add( &m_selectedVarsUiField ); curveDataGroup->add( &m_selectedVarsUiField );
@@ -165,7 +165,7 @@ void RimParameterResultCrossPlot::onLoadDataAndUpdate()
{ {
updateMdiWindowVisibility(); updateMdiWindowVisibility();
m_selectedVarsUiField = selectedVarsText(); m_selectedVarsUiField = selectedQuantitiesText();
if ( m_plotWidget && m_analyserOfSelectedCurveDefs ) if ( m_plotWidget && m_analyserOfSelectedCurveDefs )
{ {
@@ -191,7 +191,7 @@ void RimParameterResultCrossPlot::updateAxes()
{ {
if ( !m_plotWidget ) return; if ( !m_plotWidget ) return;
m_plotWidget->setAxisTitleText( QwtPlot::yLeft, m_selectedVarsUiField ); m_plotWidget->setAxisTitleText( QwtPlot::yLeft, completeAddressText() );
m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true ); m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true );
m_plotWidget->setAxisFontsAndAlignment( QwtPlot::yLeft, axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter ); m_plotWidget->setAxisFontsAndAlignment( QwtPlot::yLeft, axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter );
@@ -206,6 +206,9 @@ void RimParameterResultCrossPlot::updateAxes()
m_plotWidget->setAxisRange( QwtPlot::xBottom, m_xRange.first - xRangeWidth * 0.1, m_xRange.second + xRangeWidth * 0.1 ); m_plotWidget->setAxisRange( QwtPlot::xBottom, m_xRange.first - xRangeWidth * 0.1, m_xRange.second + xRangeWidth * 0.1 );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList caseNamesOfValidEnsembleCases( const RimSummaryCaseCollection* ensemble ) QStringList caseNamesOfValidEnsembleCases( const RimSummaryCaseCollection* ensemble )
{ {
QStringList caseNames; QStringList caseNames;
@@ -325,10 +328,13 @@ void RimParameterResultCrossPlot::updatePlotTitle()
if ( m_useAutoPlotTitle && !ensembles().empty() ) if ( m_useAutoPlotTitle && !ensembles().empty() )
{ {
auto ensemble = *ensembles().begin(); auto ensemble = *ensembles().begin();
QString vectorName = completeAddressText();
m_description = QString( "Cross Plot %1, %2 x %3 at %4" ) m_description = QString( "Cross Plot %1, %2 x %3 at %4" )
.arg( ensemble->name() ) .arg( ensemble->name() )
.arg( m_ensembleParameter ) .arg( m_ensembleParameter )
.arg( m_selectedVarsUiField ) .arg( vectorName )
.arg( timeStepString() ); .arg( timeStepString() );
} }
m_plotWidget->setPlotTitle( m_description ); m_plotWidget->setPlotTitle( m_description );