From cdbfed9f3669ddacfd6dfbdcfe662696c4c3cc19 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 19 Apr 2018 08:01:37 +0200 Subject: [PATCH] Legends : Changed to private functions, added override, other cleanup --- .../ProjectDataModel/RimRegularLegendConfig.h | 14 +++-- .../RimTernaryLegendConfig.cpp | 4 +- .../ProjectDataModel/RimTernaryLegendConfig.h | 51 ++++++++++--------- 3 files changed, 33 insertions(+), 36 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.h b/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.h index ef659695f2..67864eb2f8 100644 --- a/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.h +++ b/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.h @@ -125,17 +125,15 @@ public: const caf::TitledOverlayFrame* titledOverlayFrame() const override; caf::TitledOverlayFrame* titledOverlayFrame() override; -protected: - virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); - virtual void initAfterRead(); - virtual caf::PdmFieldHandle* objectToggleField(); +private: + void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; + void initAfterRead() override; + caf::PdmFieldHandle* objectToggleField() override; friend class RimStimPlanLegendConfig; - virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ); + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; - virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly); - -private: void updateLegend(); void updateFieldVisibility(); double roundToNumSignificantDigits(double value, double precision); diff --git a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp index 6b5a73c1b2..d58583441e 100644 --- a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp @@ -21,6 +21,7 @@ #include "RiaApplication.h" #include "RiaColorTables.h" +#include "RiaPreferences.h" #include "RimEclipseView.h" #include "RimIntersectionCollection.h" @@ -35,7 +36,6 @@ #include "cvfqtUtils.h" #include -#include "RiaPreferences.h" CAF_PDM_SOURCE_INIT(RimTernaryLegendConfig, "RimTernaryLegendConfig"); @@ -78,7 +78,6 @@ RimTernaryLegendConfig::RimTernaryLegendConfig() ternaryRangeSummary.uiCapability()->setUiEditorTypeName(caf::PdmUiTextEditor::uiEditorTypeName()); ternaryRangeSummary.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); - CAF_PDM_InitField(&userDefinedMaxValueSoil, "UserDefinedMaxSoil", 1.0, "Max", "", "Min value of the legend", ""); CAF_PDM_InitField(&userDefinedMinValueSoil, "UserDefinedMinSoil", 0.0, "Min", "", "Max value of the legend", ""); @@ -104,7 +103,6 @@ RimTernaryLegendConfig::RimTernaryLegendConfig() //-------------------------------------------------------------------------------------------------- RimTernaryLegendConfig::~RimTernaryLegendConfig() { - } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h index b1eea5d12d..cfd124fea2 100644 --- a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h +++ b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h @@ -35,8 +35,6 @@ namespace cvf class OverlayItem; } - - //================================================================================================== /// /// @@ -65,32 +63,35 @@ public: RimTernaryLegendConfig(); virtual ~RimTernaryLegendConfig(); - void setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig); - void setAutomaticRanges(TernaryArrayIndex ternaryIndex, double globalMin, double globalMax, double localMin, double localMax); - void ternaryRanges(double& soilLower, double& soilUpper, double& sgasLower, double& sgasUpper, double& swatLower, double& swatUpper) const; + void setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig); + void setAutomaticRanges(TernaryArrayIndex ternaryIndex, double globalMin, double globalMax, double localMin, double localMax); - void recreateLegend(); - - bool showLegend() const; - - void setTitle(const QString& title); - - const RivTernaryScalarMapper* scalarMapper() const; - - const caf::TitledOverlayFrame* titledOverlayFrame() const override; - caf::TitledOverlayFrame* titledOverlayFrame() override; - -protected: - virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); - virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering ); - virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute); - virtual caf::PdmFieldHandle* objectToggleField(); + void recreateLegend(); + bool showLegend() const; + void setTitle(const QString& title); + const RivTernaryScalarMapper* scalarMapper() const; + const caf::TitledOverlayFrame* titledOverlayFrame() const override; + caf::TitledOverlayFrame* titledOverlayFrame() override; private: - void updateLegend(); - void updateLabelText(); - double roundToNumSignificantDigits(double value, double precision); - + void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; + void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + void defineEditorAttribute(const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute) override; + caf::PdmFieldHandle* objectToggleField() override; + + void updateLegend(); + void updateLabelText(); + double roundToNumSignificantDigits(double value, double precision); + + void ternaryRanges(double& soilLower, + double& soilUpper, + double& sgasLower, + double& sgasUpper, + double& swatLower, + double& swatUpper) const; + private: caf::PdmField precision; caf::PdmField rangeMode;