#829 Eclipse: Set default legend mapping and color range when selecting a category result

This commit is contained in:
Magne Sjaastad 2016-09-07 11:41:02 +02:00
parent f404299702
commit cf8190cbf1
4 changed files with 36 additions and 3 deletions

View File

@ -191,6 +191,32 @@ void RimEclipseCellColors::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOr
uiTreeOrdering.setForgetRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCellColors::updateLegendCategorySettings()
{
changeLegendConfig(this->resultVariable());
if (this->hasCategoryResult())
{
legendConfig()->setMappingMode(RimLegendConfig::CATEGORY_INTEGER);
legendConfig()->setColorRangeMode(RimLegendConfig::CATEGORY);
}
else
{
if (legendConfig()->mappingMode() == RimLegendConfig::CATEGORY_INTEGER)
{
legendConfig()->setMappingMode(RimLegendConfig::LINEAR_CONTINUOUS);
}
if (legendConfig()->colorRangeMode() == RimLegendConfig::CATEGORY)
{
legendConfig()->setColorRangeMode(RimLegendConfig::NORMAL);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -51,6 +51,8 @@ public:
void updateIconState();
virtual void updateLegendCategorySettings() override;
protected:
// Overridden methods
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);

View File

@ -157,6 +157,8 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
if (dynamic_cast<RimEclipseCellColors*>(this))
{
this->updateLegendCategorySettings();
if (view)
{
RimViewLinker* viewLinker = view->assosiatedViewLinker();
@ -169,6 +171,7 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
if (cellEdgeColors)
{
cellEdgeColors->singleVarEdgeResultColors()->updateLegendCategorySettings();
cellEdgeColors->loadResult();
if (view)

View File

@ -65,6 +65,11 @@ public:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void initAfterRead();
virtual void updateLegendCategorySettings() {};
protected:
void updateFieldVisibility();
protected:
caf::PdmField< caf::AppEnum< RimDefines::ResultCatType > > m_resultType;
@ -82,9 +87,6 @@ protected:
caf::PdmPointer<RimEclipseCase> m_eclipseCase;
protected:
void updateFieldVisibility();
private:
QList<caf::PdmOptionItemInfo> calculateValueOptionsForSpecifiedDerivedListPosition(bool showDerivedResultsFirstInList, const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
QStringList getResultVariableListForCurrentUIFieldSettings();