#7647 PERM and other arrays default colour legend type change

Restore default color legend to "Continuous Logarithmic" instead of "Discrete Logarithmic"
This commit is contained in:
Magne Sjaastad 2021-05-04 06:53:43 +02:00
parent 010e964ea8
commit 211a9ff915
3 changed files with 28 additions and 4 deletions

View File

@ -110,6 +110,7 @@ RimGridCrossPlotDataSet::RimGridCrossPlotDataSet()
CAF_PDM_InitFieldNoDefault( &m_groupingProperty, "GroupingProperty", "Data Grouping Property", "", "", "" );
m_groupingProperty = new RimEclipseCellColors;
m_groupingProperty->useDiscreteLogLevels( true );
m_groupingProperty.uiCapability()->setUiHidden( true );
CVF_ASSERT( m_groupingProperty->legendConfig() );
m_groupingProperty->legendConfig()->setMappingMode( RimRegularLegendConfig::MappingType::CATEGORY_INTEGER );

View File

@ -68,6 +68,8 @@ RimEclipseCellColors::RimEclipseCellColors()
// Make sure we have a created legend for the default/undefined result variable
changeLegendConfig( this->resultVariable() );
m_useDiscreteLogLevels = false;
}
//--------------------------------------------------------------------------------------------------
@ -150,7 +152,9 @@ void RimEclipseCellColors::changeLegendConfig( QString resultVarNameOfNewLegend
if ( !found )
{
auto newLegend = createLegendForResult( resultVarNameOfNewLegend, this->hasCategoryResult() );
auto newLegend = createLegendForResult( resultVarNameOfNewLegend,
this->m_useDiscreteLogLevels,
this->hasCategoryResult() );
m_legendConfigData.push_back( newLegend );
@ -176,7 +180,9 @@ void RimEclipseCellColors::onLegendConfigChanged( const caf::SignalEmitter* emit
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimRegularLegendConfig* RimEclipseCellColors::createLegendForResult( const QString& resultName, bool isCategoryResult )
RimRegularLegendConfig* RimEclipseCellColors::createLegendForResult( const QString& resultName,
bool useDiscreteLogLevels,
bool isCategoryResult )
{
bool useLog = false;
{
@ -207,7 +213,11 @@ RimRegularLegendConfig* RimEclipseCellColors::createLegendForResult( const QStri
if ( useLog )
{
newLegend->setMappingMode( RimRegularLegendConfig::MappingType::LOG10_DISCRETE );
if ( useDiscreteLogLevels )
newLegend->setMappingMode( RimRegularLegendConfig::MappingType::LOG10_DISCRETE );
else
newLegend->setMappingMode( RimRegularLegendConfig::MappingType::LOG10_CONTINUOUS );
newLegend->setTickNumberFormat( RimRegularLegendConfig::NumberFormatType::AUTO );
newLegend->setRangeMode( RimLegendConfig::RangeModeType::USER_DEFINED );
newLegend->resetUserDefinedValues();
@ -302,6 +312,14 @@ void RimEclipseCellColors::uiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCellColors::useDiscreteLogLevels( bool enable )
{
m_useDiscreteLogLevels = true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -60,6 +60,8 @@ public:
void updateLegendCategorySettings() override;
void uiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" );
void useDiscreteLogLevels( bool enable );
protected:
// Overridden methods
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
@ -74,7 +76,8 @@ protected:
private:
void changeLegendConfig( QString resultVarNameOfNewLegend );
void onLegendConfigChanged( const caf::SignalEmitter* emitter, RimLegendConfigChangeType changeType );
static RimRegularLegendConfig* createLegendForResult( const QString& resultName, bool isCategoryResult );
static RimRegularLegendConfig*
createLegendForResult( const QString& resultName, bool useDiscreteLevels, bool isCategoryResult );
caf::PdmChildArrayField<RimRegularLegendConfig*> m_legendConfigData;
caf::PdmPtrField<RimRegularLegendConfig*> m_legendConfigPtrField;
@ -82,6 +85,8 @@ private:
caf::PdmPointer<RimEclipseView> m_reservoirView;
bool m_useDiscreteLogLevels;
// Obsolete
caf::PdmChildField<RimRegularLegendConfig*> obsoleteField_legendConfig;
};