#272 Use combo box to switch between predefined and custom cell edge result

This commit is contained in:
Magne Sjaastad 2016-09-09 11:46:49 +02:00
parent 2f5acc38ac
commit 077351cd04
2 changed files with 24 additions and 4 deletions

View File

@ -32,6 +32,17 @@
#include "cvfMath.h"
namespace caf
{
template<>
void AppEnum< RimCellEdgeColors::ResultType >::setUp()
{
addItem(RimCellEdgeColors::PREDEFINED_RESULT, "PREDEFINED_RESULT", "Predefined");
addItem(RimCellEdgeColors::CUSTOM_RESULT, "CUSTOM_RESULT", "Custom");
setDefault(RimCellEdgeColors::PREDEFINED_RESULT);
}
}
CAF_PDM_SOURCE_INIT(RimCellEdgeColors, "CellEdgeResultSlot");
@ -44,6 +55,8 @@ RimCellEdgeColors::RimCellEdgeColors()
CAF_PDM_InitField(&enableCellEdgeColors, "EnableCellEdgeColors", true, "Enable cell edge results", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_resultType, "resultType", "Result mapping", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_resultVariable, "CellEdgeVariable", "Result property", "", "", "");
CAF_PDM_InitField(&useXVariable, "UseXVariable", true, "Use X values", "", "", "");
CAF_PDM_InitField(&useYVariable, "UseYVariable", true, "Use Y values", "", "", "");
@ -235,8 +248,6 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions(const caf
optionList.push_front(caf::PdmOptionItemInfo(RimDefines::undefinedResultName(), ""));
optionList.push_back(caf::PdmOptionItemInfo(RimCellEdgeColors::singleVarEdgeResultUiText(), RimCellEdgeColors::singleVarEdgeResultUiText()));
if (useOptionsOnly) *useOptionsOnly = true;
return optionList;
@ -251,7 +262,7 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions(const caf
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_resultVariable);
uiOrdering.add(&m_resultType);
if (isUsingSingleVariable())
{
@ -262,6 +273,8 @@ void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
}
else
{
uiOrdering.add(&m_resultVariable);
uiOrdering.add(&useXVariable);
uiOrdering.add(&useYVariable);
uiOrdering.add(&useZVariable);
@ -340,7 +353,7 @@ void RimCellEdgeColors::gridScalarResultNames(std::vector<QString>* resultNames)
//--------------------------------------------------------------------------------------------------
bool RimCellEdgeColors::isUsingSingleVariable() const
{
return (m_resultVariable == singleVarEdgeResultUiText());
return (m_resultType == CUSTOM_RESULT);
}
//--------------------------------------------------------------------------------------------------

View File

@ -60,6 +60,12 @@ public:
Z, NEG_Z
};
enum ResultType
{
PREDEFINED_RESULT,
CUSTOM_RESULT
};
typedef caf::AppEnum<RimCellEdgeColors::EdgeFaceType> EdgeFaceEnum;
void setReservoirView(RimEclipseView* ownerReservoirView);
@ -114,6 +120,7 @@ private:
bool isUsingSingleVariable() const;
static QString singleVarEdgeResultUiText() { return "Custom Edge Result"; }
caf::PdmField<caf::AppEnum< ResultType > > m_resultType;
caf::PdmChildField<RimLegendConfig*> m_legendConfig;
caf::PdmChildField<RimEclipseCellColors*> m_singleVarEdgeResultColors;