From 4cb1c9facafa976a2e508d22aa0f046d0f87253e Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 16 Aug 2019 15:41:58 +0200 Subject: [PATCH] #4581 Summary Plot: Add default curve style to preferences for history curves --- .../Application/RiaPreferences.cpp | 22 ++++++++---- ApplicationCode/Application/RiaPreferences.h | 11 +++++- .../Summary/RimSummaryCurve.cpp | 35 ++++++++++++++----- 3 files changed, 53 insertions(+), 15 deletions(-) diff --git a/ApplicationCode/Application/RiaPreferences.cpp b/ApplicationCode/Application/RiaPreferences.cpp index 3c5dfb4a82..7e1b2cd605 100644 --- a/ApplicationCode/Application/RiaPreferences.cpp +++ b/ApplicationCode/Application/RiaPreferences.cpp @@ -44,7 +44,16 @@ namespace caf addItem(RiaPreferences::NOT_IMPORT, "NOT_IMPORT", "Skip"); setDefault(RiaPreferences::IMPORT); } -} + + template<> + void RiaPreferences::SummaryHistoryCurveStyleModeType::setUp() + { + addItem(RiaPreferences::SYMBOLS, "SYMBOLS", "Symbols"); + addItem(RiaPreferences::LINES, "LINES", "Lines"); + addItem(RiaPreferences::SYMBOLS_AND_LINES, "SYMBOLS_AND_LINES", "Symbols and Lines"); + setDefault(RiaPreferences::SYMBOLS); + } + } CAF_PDM_SOURCE_INIT(RiaPreferences, "RiaPreferences"); @@ -141,6 +150,7 @@ RiaPreferences::RiaPreferences(void) CAF_PDM_InitField(&gridImportMode, "gridImportMode", SummaryRestartFilesImportModeType(RiaPreferences::NOT_IMPORT), "Default Grid Import Option", "", "", ""); CAF_PDM_InitField(&summaryEnsembleImportMode, "summaryEnsembleImportMode", SummaryRestartFilesImportModeType(RiaPreferences::IMPORT), "Default Ensemble Summary Import Option", "", "", ""); + CAF_PDM_InitField(&defaultSummaryHistoryCurveStyle, "defaultSummaryHistoryCurveStyle", SummaryHistoryCurveStyleModeType(RiaPreferences::SYMBOLS), "Default Curve Style for History Vectors", "", "", ""); CAF_PDM_InitField(&defaultSummaryCurvesTextFilter, "defaultSummaryCurvesTextFilter", QString("FOPT"), "Default Summary Curves", "", "Semicolon separated list of filters used to create curves in new summary plots", ""); CAF_PDM_InitFieldNoDefault(&m_holoLensExportFolder, "holoLensExportFolder", "HoloLens Export Folder", "", "", ""); @@ -276,11 +286,11 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& caf::PdmUiGroup* group = restartBehaviourGroup->addNewGroup("Origin Ensemble Summary Files"); group->add(&summaryEnsembleImportMode); } - - { - caf::PdmUiGroup* summaryPlotsGroup = uiOrdering.addNewGroup("Summary Plots"); - summaryPlotsGroup->add(&defaultSummaryCurvesTextFilter); - } + } + else if (uiConfigName == RiaPreferences::tabNameEclipseSummary()) + { + uiOrdering.add(&defaultSummaryCurvesTextFilter); + uiOrdering.add(&defaultSummaryHistoryCurveStyle); } else if (uiConfigName == RiaPreferences::tabNameScripting()) { diff --git a/ApplicationCode/Application/RiaPreferences.h b/ApplicationCode/Application/RiaPreferences.h index 254b7d1866..8677be6a10 100644 --- a/ApplicationCode/Application/RiaPreferences.h +++ b/ApplicationCode/Application/RiaPreferences.h @@ -48,6 +48,14 @@ public: typedef caf::AppEnum SummaryRestartFilesImportModeType; typedef RiaFontCache::FontSizeType FontSizeType; + enum SummaryHistoryCurveStyleMode + { + SYMBOLS, + LINES, + SYMBOLS_AND_LINES + }; + typedef caf::AppEnum SummaryHistoryCurveStyleModeType; + RiaPreferences(void); ~RiaPreferences(void) override; @@ -110,7 +118,8 @@ public: // Pdm Fields caf::PdmField gridImportMode; caf::PdmField summaryEnsembleImportMode; - caf::PdmField defaultSummaryCurvesTextFilter; + caf::PdmField defaultSummaryCurvesTextFilter; + caf::PdmField defaultSummaryHistoryCurveStyle; caf::PdmField holoLensDisableCertificateVerification; caf::PdmField csvTextExportFieldSeparator; diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index a2b8bd674a..155b0c7c7d 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -18,13 +18,13 @@ #include "RimSummaryCurve.h" -#include "RiaGuiApplication.h" #include "RiaDefines.h" +#include "RiaGuiApplication.h" +#include "RiaPreferences.h" +#include "RiaTimeHistoryCurveMerger.h" #include "RifReaderEclipseSummary.h" -#include "RiaTimeHistoryCurveMerger.h" - #include "RimEclipseResultCase.h" #include "RimEnsembleCurveSet.h" #include "RimEnsembleCurveSetCollection.h" @@ -806,15 +806,34 @@ void RimSummaryCurve::setCurveAppearanceFromCaseType() if (m_yValuesSummaryCase->isObservedData()) { setLineStyle(RiuQwtPlotCurve::STYLE_NONE); - - if (symbol() == RiuQwtSymbol::SYMBOL_NONE) - { - setSymbol(RiuQwtSymbol::SYMBOL_XCROSS); - } + setSymbol(RiuQwtSymbol::SYMBOL_XCROSS); return; } } + + if (m_yValuesCurveVariable && m_yValuesCurveVariable->address().isHistoryQuantity()) + { + RiaPreferences* prefs = RiaApplication::instance()->preferences(); + + if (prefs->defaultSummaryHistoryCurveStyle() == RiaPreferences::SYMBOLS) + { + setSymbol(RiuQwtSymbol::SYMBOL_XCROSS); + setLineStyle(RiuQwtPlotCurve::STYLE_NONE); + } + else if (prefs->defaultSummaryHistoryCurveStyle() == RiaPreferences::SYMBOLS_AND_LINES) + { + setSymbol(RiuQwtSymbol::SYMBOL_XCROSS); + setLineStyle(RiuQwtPlotCurve::STYLE_SOLID); + } + else if (prefs->defaultSummaryHistoryCurveStyle() == RiaPreferences::LINES) + { + setSymbol(RiuQwtSymbol::SYMBOL_NONE); + setLineStyle(RiuQwtPlotCurve::STYLE_SOLID); + } + + return; + } } //--------------------------------------------------------------------------------------------------