diff --git a/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp index 8a53df3136..124f3b8e52 100644 --- a/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp @@ -112,7 +112,7 @@ RimLegendConfig::RimLegendConfig() CAF_PDM_InitField(&m_colorRangeMode, "ColorRangeMode", ColorRangeEnum(NORMAL) , "Colors", "", "", ""); CAF_PDM_InitField(&m_mappingMode, "MappingMode", MappingEnum(LINEAR_CONTINUOUS) , "Mapping", "", "", ""); - CAF_PDM_InitField(&m_rangeMode, "RangeType", caf::AppEnum(AUTOMATIC_ALLTIMESTEPS), "Range type", "", "Switches between automatic and user defined range on the legend", ""); + CAF_PDM_InitField(&m_rangeMode, "RangeType", RangeModeEnum(AUTOMATIC_ALLTIMESTEPS), "Range type", "", "Switches between automatic and user defined range on the legend", ""); CAF_PDM_InitField(&m_userDefinedMaxValue, "UserDefinedMax", 1.0, "Max", "", "Min value of the legend", ""); CAF_PDM_InitField(&m_userDefinedMinValue, "UserDefinedMin", 0.0, "Min", "", "Max value of the legend", ""); CAF_PDM_InitField(&resultVariableName, "ResultVariableUsage", QString(""), "", "", "", ""); @@ -653,6 +653,8 @@ void RimLegendConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& // caf::PdmUiOrdering * formatGr = uiOrdering.addNewGroup("Ternary format"); // formatGr->add(&m_mappingMode); // formatGr->add(&m_numLevels); + caf::PdmUiOrdering * mappingGr = uiOrdering.addNewGroup("Mapping"); + mappingGr->add(&m_rangeMode); uiOrdering.setForgetRemainingFields(true); } @@ -700,8 +702,25 @@ QList RimLegendConfig::calculateValueOptions(const caf:: return optionList; } + + if (fieldNeedingOptions == &m_rangeMode) + { + QList optionList; + optionList.push_back(caf::PdmOptionItemInfo(RangeModeEnum(AUTOMATIC_ALLTIMESTEPS).uiText(), AUTOMATIC_ALLTIMESTEPS)); + optionList.push_back(caf::PdmOptionItemInfo(RangeModeEnum(AUTOMATIC_CURRENT_TIMESTEP).uiText(), AUTOMATIC_CURRENT_TIMESTEP)); + + return optionList; + } } return QList(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimLegendConfig::RangeModeType RimLegendConfig::rangeMode() const +{ + return m_rangeMode(); +} + diff --git a/ApplicationCode/ProjectDataModel/RimLegendConfig.h b/ApplicationCode/ProjectDataModel/RimLegendConfig.h index 117eefcc7c..183acca583 100644 --- a/ApplicationCode/ProjectDataModel/RimLegendConfig.h +++ b/ApplicationCode/ProjectDataModel/RimLegendConfig.h @@ -54,12 +54,14 @@ public: caf::PdmField resultVariableName; // Used internally to describe the variable this legend setup is used for - enum RangeModeType + enum RangeModeType { AUTOMATIC_ALLTIMESTEPS, AUTOMATIC_CURRENT_TIMESTEP, USER_DEFINED }; + + typedef caf::AppEnum RangeModeEnum; enum ColorRangesType { @@ -95,6 +97,8 @@ public: cvf::OverlayScalarMapperLegend* legend() { return m_legend.p(); } int linearDiscreteLevelCount() const; + RangeModeType rangeMode() const; + protected: virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); @@ -106,7 +110,7 @@ private: cvf::ref interpolateColorArray(const cvf::Color3ubArray& colorArray, cvf::uint targetColorCount); double roundToNumSignificantDigits(double value, double precision); - virtual QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly ); + virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly); private: @@ -136,7 +140,7 @@ private: caf::PdmField m_numLevels; caf::PdmField m_precision; caf::PdmField > m_tickNumberFormat; - caf::PdmField > m_rangeMode; + caf::PdmField m_rangeMode; caf::PdmField m_userDefinedMaxValue; caf::PdmField m_userDefinedMinValue; caf::PdmField > m_colorRangeMode;