diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 4cba269f42..99c3e4786d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -93,6 +93,13 @@ void AppEnum::setUp() addItem( RimEnsembleCurveSet::ParameterSorting::ALPHABETICALLY, "ALPHABETICALLY", "Alphabetically" ); setDefault( RimEnsembleCurveSet::ParameterSorting::ABSOLUTE_VALUE ); } +template <> +void AppEnum::setUp() +{ + addItem( RimEnsembleCurveSet::AppearanceMode::DEFAULT, "DEFAULT", "Default" ); + addItem( RimEnsembleCurveSet::AppearanceMode::CUSTOM, "CUSTOM", "Custom" ); + setDefault( RimEnsembleCurveSet::AppearanceMode::DEFAULT ); +} } // namespace caf //-------------------------------------------------------------------------------------------------- @@ -164,6 +171,20 @@ RimEnsembleCurveSet::RimEnsembleCurveSet() CAF_PDM_InitFieldNoDefault( &m_ensembleParameterSorting, "EnsembleParameterSorting", "Parameter Sorting" ); + auto defaultLineStyle = LineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); + auto defaultPointSymbol = PointSymbol( RiuPlotCurveSymbol::PointSymbolEnum::SYMBOL_CROSS ); + + CAF_PDM_InitFieldNoDefault( &m_useCustomAppearance, "UseCustomAppearance", "Appearance" ); + CAF_PDM_InitField( &m_lineStyle, "LineStyle", defaultLineStyle, "Line Style" ); + CAF_PDM_InitField( &m_pointSymbol, "PointSymbol", defaultPointSymbol, "Symbol" ); + CAF_PDM_InitField( &m_symbolSize, "SymbolSize", 6, "Symbol Size" ); + + auto defaultStatisticsPointSymbol = PointSymbol( RiuPlotCurveSymbol::PointSymbolEnum::SYMBOL_ELLIPSE ); + CAF_PDM_InitFieldNoDefault( &m_statisticsUseCustomAppearance, "StatisticsUseCustomAppearance", "Appearance" ); + CAF_PDM_InitField( &m_statisticsLineStyle, "StatisticsLineStyle", defaultLineStyle, "Line Style" ); + CAF_PDM_InitField( &m_statisticsPointSymbol, "StatisticsPointSymbol", defaultStatisticsPointSymbol, "Symbol" ); + CAF_PDM_InitField( &m_statisticsSymbolSize, "StatisticsSymbolSize", 6, "Symbol Size" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddressesUiField, "SelectedObjectiveSummaryVar", "Vector" ); m_objectiveValuesSummaryAddressesUiField.xmlCapability()->disableIO(); m_objectiveValuesSummaryAddressesUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); @@ -766,7 +787,10 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi plot->updatePlotTitle(); updateAllCurves(); } - else if ( changedField == &m_resampling ) + else if ( changedField == &m_resampling || changedField == &m_useCustomAppearance || changedField == &m_lineStyle || + changedField == &m_pointSymbol || changedField == &m_symbolSize || changedField == &m_statisticsLineStyle || + changedField == &m_statisticsPointSymbol || changedField == &m_statisticsSymbolSize || + changedField == &m_statisticsUseCustomAppearance ) { updateAllCurves(); } @@ -1073,6 +1097,15 @@ void RimEnsembleCurveSet::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde m_statistics->defineUiOrdering( uiConfigName, *statGroup ); + caf::PdmUiGroup* statAppearance = statGroup->addNewGroupWithKeyword( "Appearance", "StatisticsAppearance" ); + statAppearance->add( &m_statisticsUseCustomAppearance ); + if ( m_statisticsUseCustomAppearance() == AppearanceMode::CUSTOM ) + { + statAppearance->add( &m_statisticsLineStyle ); + statAppearance->add( &m_statisticsPointSymbol ); + statAppearance->add( &m_statisticsSymbolSize ); + } + uiOrdering.skipRemainingFields( true ); } @@ -1191,7 +1224,7 @@ void RimEnsembleCurveSet::onObjectiveFunctionChanged( const caf::SignalEmitter* //-------------------------------------------------------------------------------------------------- void RimEnsembleCurveSet::appendColorGroup( caf::PdmUiOrdering& uiOrdering ) { - caf::PdmUiGroup* colorsGroup = uiOrdering.addNewGroup( "Colors" ); + caf::PdmUiGroup* colorsGroup = uiOrdering.addNewGroup( "Appearance" ); m_colorMode.uiCapability()->setUiReadOnly( !m_yValuesSummaryCaseCollection() ); colorsGroup->add( &m_colorMode ); @@ -1252,6 +1285,14 @@ void RimEnsembleCurveSet::appendColorGroup( caf::PdmUiOrdering& uiOrdering ) } } + colorsGroup->add( &m_useCustomAppearance ); + if ( m_useCustomAppearance() == AppearanceMode::CUSTOM ) + { + colorsGroup->add( &m_lineStyle ); + colorsGroup->add( &m_pointSymbol ); + colorsGroup->add( &m_symbolSize ); + } + uiOrdering.skipRemainingFields(); } @@ -1939,6 +1980,13 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vectorsetLineThickness( lineThickness ); + if ( m_useCustomAppearance() == AppearanceMode::CUSTOM ) + { + curve->setLineStyle( m_lineStyle() ); + curve->setSymbol( m_pointSymbol() ); + curve->setSymbolSize( m_symbolSize() ); + } + addCurve( curve ); curve->setLeftOrRightAxisY( axisY() ); @@ -2096,15 +2144,26 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vectorsetColor( m_statistics->color() ); curve->setResampling( m_resampling() ); - auto symbol = statisticsCurveSymbolFromAddress( address.summaryAddressY() ); - curve->setSymbol( symbol ); - curve->setSymbolSize( statisticsCurveSymbolSize( symbol ) ); - curve->setSymbolSkipDistance( 150 ); - if ( m_statistics->showCurveLabels() ) + if ( m_statisticsUseCustomAppearance() == AppearanceMode::DEFAULT ) { - curve->setSymbolLabel( QString::fromStdString( address.summaryAddressY().ensembleStatisticsVectorName() ) ); + auto symbol = statisticsCurveSymbolFromAddress( address.summaryAddressY() ); + curve->setSymbol( symbol ); + curve->setSymbolSize( statisticsCurveSymbolSize( symbol ) ); + curve->setSymbolSkipDistance( 150 ); + + if ( m_statistics->showCurveLabels() ) + { + curve->setSymbolLabel( QString::fromStdString( address.summaryAddressY().ensembleStatisticsVectorName() ) ); + } + curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID ); } - curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID ); + else + { + curve->setLineStyle( m_statisticsLineStyle() ); + curve->setSymbol( m_statisticsPointSymbol() ); + curve->setSymbolSize( m_statisticsSymbolSize() ); + } + curve->setSummaryCaseY( summaryCase ); curve->setSummaryAddressYAndApplyInterpolation( address.summaryAddressY() ); curve->setLeftOrRightAxisY( axisY() ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index f8793601ef..c3c230409c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -35,6 +35,8 @@ #include "RigEnsembleParameter.h" #include "RiuPlotAxis.h" +#include "RiuPlotCurveSymbol.h" +#include "RiuQwtPlotCurveDefines.h" #include "cafAppEnum.h" #include "cafPdmChildArrayField.h" @@ -84,6 +86,8 @@ public: using ColorMode = RimEnsembleCurveSetColorManager::ColorMode; using ColorModeEnum = RimEnsembleCurveSetColorManager::ColorModeEnum; using TimeStepFilterEnum = caf::AppEnum; + using LineStyle = caf::AppEnum; + using PointSymbol = caf::AppEnum; enum class ParameterSorting { @@ -91,6 +95,12 @@ public: ALPHABETICALLY }; + enum class AppearanceMode + { + DEFAULT, + CUSTOM + }; + public: RimEnsembleCurveSet(); ~RimEnsembleCurveSet() override; @@ -251,6 +261,16 @@ private: caf::PdmField m_ensembleParameter; caf::PdmField> m_ensembleParameterSorting; + caf::PdmField> m_useCustomAppearance; + caf::PdmField m_lineStyle; + caf::PdmField m_pointSymbol; + caf::PdmField m_symbolSize; + + caf::PdmField> m_statisticsUseCustomAppearance; + caf::PdmField m_statisticsLineStyle; + caf::PdmField m_statisticsPointSymbol; + caf::PdmField m_statisticsSymbolSize; + caf::PdmChildArrayField m_objectiveValuesSummaryAddresses; caf::PdmField m_objectiveValuesSummaryAddressesUiField; caf::PdmField m_objectiveValuesSelectSummaryAddressPushButton;