|
|
|
|
@@ -18,6 +18,8 @@
|
|
|
|
|
|
|
|
|
|
#include "RimAnalysisPlot.h"
|
|
|
|
|
|
|
|
|
|
#include "RiaPreferences.h"
|
|
|
|
|
|
|
|
|
|
#include "RiuGroupedBarChartBuilder.h"
|
|
|
|
|
#include "RiuPlotMainWindowTools.h"
|
|
|
|
|
#include "RiuSummaryQwtPlot.h"
|
|
|
|
|
@@ -135,7 +137,9 @@ RimAnalysisPlot::RimAnalysisPlot()
|
|
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_valueSortOperation, "ValueSortOperation", "Sort by Value", "", "", "" );
|
|
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_sortGroupForLegend, "groupForLegend", "Legend Using", "", "", "" );
|
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_sortGroupForColors, "groupForColors", "Coloring Using", "", "", "" );
|
|
|
|
|
m_sortGroupForColors = RimAnalysisPlot::CASE;
|
|
|
|
|
m_showPlotLegends = false;
|
|
|
|
|
|
|
|
|
|
CAF_PDM_InitField( &m_useTopBarsFilter, "UseTopBarsFilter", false, "Show Only Top", "", "", "" );
|
|
|
|
|
m_useTopBarsFilter.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
|
|
|
|
@@ -148,12 +152,14 @@ RimAnalysisPlot::RimAnalysisPlot()
|
|
|
|
|
CAF_PDM_InitField( &m_useBarText, "UseBarText", true, "Activate Bar Labels", "", "", "" );
|
|
|
|
|
m_useBarText.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
|
|
|
|
|
|
|
|
|
CAF_PDM_InitField( &m_useCaseInBarText, "UseCaseInBarText", false, "Case Name", "", "", "" );
|
|
|
|
|
CAF_PDM_InitField( &m_useCaseInBarText, "UseCaseInBarText", true, "Case Name", "", "", "" );
|
|
|
|
|
CAF_PDM_InitField( &m_useEnsembleInBarText, "UseEnsembleInBarText", false, "Ensemble", "", "", "" );
|
|
|
|
|
CAF_PDM_InitField( &m_useSummaryItemInBarText, "UseSummaryItemInBarText", false, "Summary Item", "", "", "" );
|
|
|
|
|
CAF_PDM_InitField( &m_useTimeStepInBarText, "UseTimeStepInBarText", false, "Time Step", "", "", "" );
|
|
|
|
|
CAF_PDM_InitField( &m_useQuantityInBarText, "UseQuantityInBarText", false, "Quantity", "", "", "" );
|
|
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_barTextFontSize, "BarTextFontSize", "Font Size", "", "", "" );
|
|
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_valueAxisProperties, "ValueAxisProperties", "ValueAxisProperties", "", "", "" );
|
|
|
|
|
m_valueAxisProperties.uiCapability()->setUiTreeHidden( true );
|
|
|
|
|
m_valueAxisProperties = new RimPlotAxisProperties;
|
|
|
|
|
@@ -192,6 +198,25 @@ RimPlotDataFilterCollection* RimAnalysisPlot::plotDataFilterCollection() const
|
|
|
|
|
return m_plotDataFilterCollection;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimAnalysisPlot::setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions )
|
|
|
|
|
{
|
|
|
|
|
m_analysisPlotDataSelection.deleteAllChildObjects();
|
|
|
|
|
for ( auto curveDef : curveDefinitions )
|
|
|
|
|
{
|
|
|
|
|
auto dataEntry = new RimAnalysisPlotDataEntry();
|
|
|
|
|
dataEntry->setFromCurveDefinition( curveDef );
|
|
|
|
|
m_analysisPlotDataSelection.push_back( dataEntry );
|
|
|
|
|
}
|
|
|
|
|
auto timeSteps = allAvailableTimeSteps();
|
|
|
|
|
if ( m_selectedTimeSteps().empty() && !timeSteps.empty() )
|
|
|
|
|
{
|
|
|
|
|
m_selectedTimeSteps.v().push_back( RiaQDateTimeTools::fromTime_t( *timeSteps.rbegin() ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
@@ -450,9 +475,9 @@ void RimAnalysisPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
|
|
|
|
selVectorsGrp->add( &m_selectVariablesButtonField, {false} );
|
|
|
|
|
|
|
|
|
|
QString vectorNames;
|
|
|
|
|
if ( m_analyserOfSelectedCurveDefs )
|
|
|
|
|
if ( getOrCreateSelectedCurveDefAnalyser() )
|
|
|
|
|
{
|
|
|
|
|
for ( const std::string& quantityName : m_analyserOfSelectedCurveDefs->m_quantityNames )
|
|
|
|
|
for ( const std::string& quantityName : getOrCreateSelectedCurveDefAnalyser()->m_quantityNames )
|
|
|
|
|
{
|
|
|
|
|
vectorNames += QString::fromStdString( quantityName ) + ", ";
|
|
|
|
|
}
|
|
|
|
|
@@ -478,7 +503,7 @@ void RimAnalysisPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
|
|
|
|
|
|
|
|
|
uiOrdering.add( &m_barOrientation, {true, 3, 2} );
|
|
|
|
|
|
|
|
|
|
caf::PdmUiGroup* sortGrp = uiOrdering.addNewGroup( "Sorting and Grouping" );
|
|
|
|
|
caf::PdmUiGroup* sortGrp = uiOrdering.addNewGroup( "Sorting, Grouping and Coloring" );
|
|
|
|
|
sortGrp->add( &m_majorGroupType );
|
|
|
|
|
sortGrp->add( &m_mediumGroupType );
|
|
|
|
|
sortGrp->add( &m_minorGroupType );
|
|
|
|
|
@@ -486,22 +511,23 @@ void RimAnalysisPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
|
|
|
|
sortGrp->add( &m_useTopBarsFilter );
|
|
|
|
|
sortGrp->add( &m_maxBarCount, {false} );
|
|
|
|
|
m_maxBarCount.uiCapability()->setUiReadOnly( !m_useTopBarsFilter() );
|
|
|
|
|
sortGrp->add( &m_sortGroupForColors );
|
|
|
|
|
|
|
|
|
|
caf::PdmUiGroup* legendGrp = uiOrdering.addNewGroup( "Legend" );
|
|
|
|
|
legendGrp->add( &m_showPlotLegends );
|
|
|
|
|
legendGrp->add( &m_sortGroupForLegend );
|
|
|
|
|
legendGrp->add( &m_legendFontSize );
|
|
|
|
|
m_sortGroupForLegend.uiCapability()->setUiReadOnly( !m_showPlotLegends() );
|
|
|
|
|
m_legendFontSize.uiCapability()->setUiReadOnly( !m_showPlotLegends() );
|
|
|
|
|
|
|
|
|
|
caf::PdmUiGroup* barLabelGrp = uiOrdering.addNewGroup( "Bar Labels" );
|
|
|
|
|
barLabelGrp->add( &m_useBarText );
|
|
|
|
|
barLabelGrp->add( &m_barTextFontSize );
|
|
|
|
|
barLabelGrp->add( &m_useQuantityInBarText );
|
|
|
|
|
barLabelGrp->add( &m_useSummaryItemInBarText, {false} );
|
|
|
|
|
barLabelGrp->add( &m_useSummaryItemInBarText );
|
|
|
|
|
barLabelGrp->add( &m_useCaseInBarText );
|
|
|
|
|
barLabelGrp->add( &m_useEnsembleInBarText, {false} );
|
|
|
|
|
barLabelGrp->add( &m_useTimeStepInBarText, {true, 4, 1} );
|
|
|
|
|
barLabelGrp->add( &m_useEnsembleInBarText );
|
|
|
|
|
barLabelGrp->add( &m_useTimeStepInBarText );
|
|
|
|
|
|
|
|
|
|
m_barTextFontSize.uiCapability()->setUiReadOnly( !m_useBarText );
|
|
|
|
|
m_useQuantityInBarText.uiCapability()->setUiReadOnly( !m_useBarText );
|
|
|
|
|
m_useSummaryItemInBarText.uiCapability()->setUiReadOnly( !m_useBarText );
|
|
|
|
|
m_useCaseInBarText.uiCapability()->setUiReadOnly( !m_useBarText );
|
|
|
|
|
@@ -546,12 +572,6 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
|
|
|
|
|
|
|
|
|
|
if ( !options.isEmpty() ) return options;
|
|
|
|
|
|
|
|
|
|
if ( !m_analyserOfSelectedCurveDefs )
|
|
|
|
|
{
|
|
|
|
|
m_analyserOfSelectedCurveDefs = std::unique_ptr<RiaSummaryCurveDefinitionAnalyser>(
|
|
|
|
|
new RiaSummaryCurveDefinitionAnalyser( this->curveDefinitionsWithoutEnsembleReference() ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( fieldNeedingOptions == &m_addTimestepUiField )
|
|
|
|
|
{
|
|
|
|
|
options.push_back( {"None", QDateTime()} );
|
|
|
|
|
@@ -573,7 +593,7 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
|
|
|
|
|
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( ABS_VALUE ), ABS_VALUE ) );
|
|
|
|
|
}
|
|
|
|
|
else if ( fieldNeedingOptions == &m_majorGroupType || fieldNeedingOptions == &m_mediumGroupType ||
|
|
|
|
|
fieldNeedingOptions == &m_minorGroupType || fieldNeedingOptions == &m_sortGroupForLegend )
|
|
|
|
|
fieldNeedingOptions == &m_minorGroupType || fieldNeedingOptions == &m_sortGroupForColors )
|
|
|
|
|
{
|
|
|
|
|
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( NONE ), NONE ) );
|
|
|
|
|
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SUMMARY_ITEM ), SUMMARY_ITEM ) );
|
|
|
|
|
@@ -600,6 +620,10 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
|
|
|
|
|
options.push_back( {displayName, sumCase} );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( fieldNeedingOptions == &m_barTextFontSize )
|
|
|
|
|
{
|
|
|
|
|
options = caf::FontTools::relativeSizeValueOptions( RiaPreferences::current()->defaultPlotFontSize() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return options;
|
|
|
|
|
}
|
|
|
|
|
@@ -629,7 +653,13 @@ std::set<time_t> RimAnalysisPlot::allAvailableTimeSteps()
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::set<RimSummaryCase*> RimAnalysisPlot::timestepDefiningSourceCases()
|
|
|
|
|
{
|
|
|
|
|
std::set<RimSummaryCase*> timeStepDefiningSumCases = m_analyserOfSelectedCurveDefs->m_singleSummaryCases;
|
|
|
|
|
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = getOrCreateSelectedCurveDefAnalyser();
|
|
|
|
|
std::set<RimSummaryCase*> timeStepDefiningSumCases = analyserOfSelectedCurveDefs->m_singleSummaryCases;
|
|
|
|
|
for ( auto ensemble : analyserOfSelectedCurveDefs->m_ensembles )
|
|
|
|
|
{
|
|
|
|
|
auto allSumCases = ensemble->allSummaryCases();
|
|
|
|
|
timeStepDefiningSumCases.insert( allSumCases.begin(), allSumCases.end() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return timeStepDefiningSumCases;
|
|
|
|
|
}
|
|
|
|
|
@@ -639,7 +669,8 @@ std::set<RimSummaryCase*> RimAnalysisPlot::timestepDefiningSourceCases()
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::set<RimSummaryCase*> RimAnalysisPlot::allSourceCases()
|
|
|
|
|
{
|
|
|
|
|
std::set<RimSummaryCase*> allSumCases = m_analyserOfSelectedCurveDefs->m_singleSummaryCases;
|
|
|
|
|
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = getOrCreateSelectedCurveDefAnalyser();
|
|
|
|
|
std::set<RimSummaryCase*> allSumCases = analyserOfSelectedCurveDefs->m_singleSummaryCases;
|
|
|
|
|
|
|
|
|
|
return allSumCases;
|
|
|
|
|
}
|
|
|
|
|
@@ -667,8 +698,7 @@ void RimAnalysisPlot::onLoadDataAndUpdate()
|
|
|
|
|
{
|
|
|
|
|
updateMdiWindowVisibility();
|
|
|
|
|
|
|
|
|
|
m_analyserOfSelectedCurveDefs = std::unique_ptr<RiaSummaryCurveDefinitionAnalyser>(
|
|
|
|
|
new RiaSummaryCurveDefinitionAnalyser( this->curveDefinitionsWithoutEnsembleReference() ) );
|
|
|
|
|
getOrCreateSelectedCurveDefAnalyser();
|
|
|
|
|
|
|
|
|
|
if ( m_plotWidget )
|
|
|
|
|
{
|
|
|
|
|
@@ -676,7 +706,7 @@ void RimAnalysisPlot::onLoadDataAndUpdate()
|
|
|
|
|
m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotScale );
|
|
|
|
|
|
|
|
|
|
RiuGroupedBarChartBuilder chartBuilder;
|
|
|
|
|
|
|
|
|
|
chartBuilder.setLabelFontSize( barTextFontSize() );
|
|
|
|
|
// buildTestPlot( chartBuilder );
|
|
|
|
|
addDataToChartBuilder( chartBuilder );
|
|
|
|
|
|
|
|
|
|
@@ -1416,7 +1446,7 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui
|
|
|
|
|
QString majorText = assignGroupingText( m_majorGroupType(), curveDef, timestepString );
|
|
|
|
|
QString medText = assignGroupingText( m_mediumGroupType(), curveDef, timestepString );
|
|
|
|
|
QString minText = assignGroupingText( m_minorGroupType(), curveDef, timestepString );
|
|
|
|
|
QString legendText = assignGroupingText( m_sortGroupForLegend(), curveDef, timestepString );
|
|
|
|
|
QString legendText = assignGroupingText( m_sortGroupForColors(), curveDef, timestepString );
|
|
|
|
|
|
|
|
|
|
double value = values[timestepIdx];
|
|
|
|
|
|
|
|
|
|
@@ -1471,29 +1501,30 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimAnalysisPlot::updatePlotTitle()
|
|
|
|
|
{
|
|
|
|
|
if ( m_useAutoPlotTitle && m_analyserOfSelectedCurveDefs )
|
|
|
|
|
if ( m_useAutoPlotTitle )
|
|
|
|
|
{
|
|
|
|
|
QString autoTitle;
|
|
|
|
|
QString separator = ", ";
|
|
|
|
|
|
|
|
|
|
if ( m_analyserOfSelectedCurveDefs->m_ensembles.size() == 1 )
|
|
|
|
|
if ( getOrCreateSelectedCurveDefAnalyser()->m_ensembles.size() == 1 )
|
|
|
|
|
{
|
|
|
|
|
autoTitle += ( *m_analyserOfSelectedCurveDefs->m_ensembles.begin() )->name();
|
|
|
|
|
autoTitle += ( *getOrCreateSelectedCurveDefAnalyser()->m_ensembles.begin() )->name();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_analyserOfSelectedCurveDefs->m_singleSummaryCases.size() == 1 )
|
|
|
|
|
if ( getOrCreateSelectedCurveDefAnalyser()->m_singleSummaryCases.size() == 1 )
|
|
|
|
|
{
|
|
|
|
|
if ( !autoTitle.isEmpty() ) autoTitle += separator;
|
|
|
|
|
autoTitle += ( *m_analyserOfSelectedCurveDefs->m_singleSummaryCases.begin() )->displayCaseName();
|
|
|
|
|
autoTitle += ( *getOrCreateSelectedCurveDefAnalyser()->m_singleSummaryCases.begin() )->displayCaseName();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_analyserOfSelectedCurveDefs->m_summaryItems.size() == 1 )
|
|
|
|
|
if ( getOrCreateSelectedCurveDefAnalyser()->m_summaryItems.size() == 1 )
|
|
|
|
|
{
|
|
|
|
|
if ( !autoTitle.isEmpty() ) autoTitle += separator;
|
|
|
|
|
autoTitle += QString::fromStdString( m_analyserOfSelectedCurveDefs->m_summaryItems.begin()->itemUiText() );
|
|
|
|
|
autoTitle +=
|
|
|
|
|
QString::fromStdString( getOrCreateSelectedCurveDefAnalyser()->m_summaryItems.begin()->itemUiText() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( std::string quantName : m_analyserOfSelectedCurveDefs->m_quantityNames )
|
|
|
|
|
for ( std::string quantName : getOrCreateSelectedCurveDefAnalyser()->m_quantityNames )
|
|
|
|
|
{
|
|
|
|
|
if ( !autoTitle.isEmpty() ) autoTitle += separator;
|
|
|
|
|
autoTitle += QString::fromStdString( quantName );
|
|
|
|
|
@@ -1668,3 +1699,11 @@ void RimAnalysisPlot::buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder )
|
|
|
|
|
chartBuilder.addBarEntry( "", "", "", 1.6, "", "E", 1.6 );
|
|
|
|
|
chartBuilder.addBarEntry( "", "", "", 2.4, "", "F", -2.4 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
int RimAnalysisPlot::barTextFontSize() const
|
|
|
|
|
{
|
|
|
|
|
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), m_barTextFontSize() );
|
|
|
|
|
}
|
|
|
|
|
|