mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Janitor: Make sure the default legend is configured for intersection results
This commit is contained in:
@@ -32,7 +32,6 @@
|
|||||||
#include "RimGeoMechCase.h"
|
#include "RimGeoMechCase.h"
|
||||||
#include "RimGeoMechCellColors.h"
|
#include "RimGeoMechCellColors.h"
|
||||||
#include "RimGeoMechView.h"
|
#include "RimGeoMechView.h"
|
||||||
#include "RimIntersectionResultDefinition.h"
|
|
||||||
|
|
||||||
#include "RivBoxIntersectionSourceInfo.h"
|
#include "RivBoxIntersectionSourceInfo.h"
|
||||||
#include "RivExtrudedCurveIntersectionPartMgr.h"
|
#include "RivExtrudedCurveIntersectionPartMgr.h"
|
||||||
|
@@ -29,8 +29,6 @@
|
|||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimExtrudedCurveIntersection.h"
|
#include "RimExtrudedCurveIntersection.h"
|
||||||
#include "RimGridView.h"
|
#include "RimGridView.h"
|
||||||
#include "RimIntersectionResultDefinition.h"
|
|
||||||
#include "RimIntersectionResultsDefinitionCollection.h"
|
|
||||||
#include "RimSimWellInView.h"
|
#include "RimSimWellInView.h"
|
||||||
|
|
||||||
#include "Riu3DMainWindowTools.h"
|
#include "Riu3DMainWindowTools.h"
|
||||||
|
@@ -387,6 +387,24 @@ void RimIntersectionResultDefinition::update2dIntersectionViews()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimIntersectionResultDefinition::setDefaultEclipseLegendConfig()
|
||||||
|
{
|
||||||
|
bool useDiscreteLogLevels = false;
|
||||||
|
bool isCategoryResult = m_eclipseResultDefinition->hasCategoryResult();
|
||||||
|
|
||||||
|
auto eclResultDef = this->eclipseResultDefinition();
|
||||||
|
eclResultDef->updateRangesForExplicitLegends( this->regularLegendConfig(),
|
||||||
|
this->ternaryLegendConfig(),
|
||||||
|
this->timeStep() );
|
||||||
|
|
||||||
|
m_legendConfig->setDefaultConfigForResultName( m_eclipseResultDefinition->resultVariable(),
|
||||||
|
useDiscreteLogLevels,
|
||||||
|
isCategoryResult );
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@@ -59,18 +59,17 @@ public:
|
|||||||
bool isUsingOverrideViewer );
|
bool isUsingOverrideViewer );
|
||||||
|
|
||||||
void update2dIntersectionViews();
|
void update2dIntersectionViews();
|
||||||
|
void setDefaultEclipseLegendConfig();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
caf::PdmFieldHandle* userDescriptionField() override;
|
caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
caf::PdmFieldHandle* objectToggleField() override;
|
caf::PdmFieldHandle* objectToggleField() override;
|
||||||
|
|
||||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||||
const QVariant& oldValue,
|
|
||||||
const QVariant& newValue ) override;
|
|
||||||
|
|
||||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||||
bool* useOptionsOnly ) override;
|
bool* useOptionsOnly ) override;
|
||||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||||
void initAfterRead() override;
|
void initAfterRead() override;
|
||||||
|
|
||||||
|
@@ -181,49 +181,10 @@ RimRegularLegendConfig* RimEclipseCellColors::createLegendForResult( const QStri
|
|||||||
bool useDiscreteLogLevels,
|
bool useDiscreteLogLevels,
|
||||||
bool isCategoryResult )
|
bool isCategoryResult )
|
||||||
{
|
{
|
||||||
bool useLog = RiaResultNames::isLogarithmicResult( resultName );
|
auto* newLegend = new RimRegularLegendConfig;
|
||||||
|
newLegend->resultVariableName = resultName;
|
||||||
|
|
||||||
RimRegularLegendConfig::ColorRangesType colorRangeType = RimRegularLegendConfig::ColorRangesType::UNDEFINED;
|
newLegend->setDefaultConfigForResultName( resultName, useDiscreteLogLevels, isCategoryResult );
|
||||||
if ( isCategoryResult )
|
|
||||||
{
|
|
||||||
colorRangeType = RimRegularLegendConfig::ColorRangesType::CATEGORY;
|
|
||||||
}
|
|
||||||
else if ( resultName == RiaResultNames::swat() )
|
|
||||||
{
|
|
||||||
colorRangeType = RimRegularLegendConfig::ColorRangesType::OPPOSITE_NORMAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
RimRegularLegendConfig* newLegend = new RimRegularLegendConfig;
|
|
||||||
newLegend->resultVariableName = resultName;
|
|
||||||
|
|
||||||
if ( useLog )
|
|
||||||
{
|
|
||||||
if ( useDiscreteLogLevels )
|
|
||||||
newLegend->setMappingMode( RimRegularLegendConfig::MappingType::LOG10_DISCRETE );
|
|
||||||
else
|
|
||||||
newLegend->setMappingMode( RimRegularLegendConfig::MappingType::LOG10_CONTINUOUS );
|
|
||||||
|
|
||||||
newLegend->setTickNumberFormat( RiaNumberFormat::NumberFormatType::AUTO );
|
|
||||||
newLegend->setRangeMode( RimLegendConfig::RangeModeType::USER_DEFINED );
|
|
||||||
newLegend->resetUserDefinedValues();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( RiaResultNames::isFlowResultWithBothPosAndNegValues( resultName ) )
|
|
||||||
{
|
|
||||||
colorRangeType = RimRegularLegendConfig::ColorRangesType::BLUE_WHITE_RED;
|
|
||||||
newLegend->setCenterLegendAroundZero( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( colorRangeType != RimRegularLegendConfig::ColorRangesType::UNDEFINED )
|
|
||||||
{
|
|
||||||
RimColorLegend* colorLegend = RimRegularLegendConfig::mapToColorLegend( colorRangeType );
|
|
||||||
if ( isCategoryResult )
|
|
||||||
{
|
|
||||||
newLegend->setMappingMode( RimRegularLegendConfig::MappingType::CATEGORY_INTEGER );
|
|
||||||
}
|
|
||||||
|
|
||||||
newLegend->setColorLegend( colorLegend );
|
|
||||||
}
|
|
||||||
|
|
||||||
return newLegend;
|
return newLegend;
|
||||||
}
|
}
|
||||||
|
@@ -478,6 +478,7 @@ void RimEclipseResultDefinition::updateAnyFieldHasChanged()
|
|||||||
this->firstAncestorOrThisOfType( intersectResDef );
|
this->firstAncestorOrThisOfType( intersectResDef );
|
||||||
if ( intersectResDef )
|
if ( intersectResDef )
|
||||||
{
|
{
|
||||||
|
intersectResDef->setDefaultEclipseLegendConfig();
|
||||||
intersectResDef->updateConnectedEditors();
|
intersectResDef->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -404,25 +404,7 @@ void RimRegularLegendConfig::updateLegend()
|
|||||||
|
|
||||||
if ( m_resetUserDefinedValues && m_globalAutoMax != cvf::UNDEFINED_DOUBLE )
|
if ( m_resetUserDefinedValues && m_globalAutoMax != cvf::UNDEFINED_DOUBLE )
|
||||||
{
|
{
|
||||||
if ( m_mappingMode() == MappingType::LOG10_CONTINUOUS || m_mappingMode() == MappingType::LOG10_DISCRETE )
|
updateTickCountAndUserDefinedRange();
|
||||||
{
|
|
||||||
double exponentMax = computeTenExponentCeil( m_globalAutoMax );
|
|
||||||
double exponentMin = computeTenExponentFloor( m_globalAutoPosClosestToZero );
|
|
||||||
|
|
||||||
m_userDefinedMaxValue = pow( 10, exponentMax );
|
|
||||||
m_userDefinedMinValue = pow( 10, exponentMin );
|
|
||||||
|
|
||||||
int numLevels = exponentMax - exponentMin;
|
|
||||||
if ( numLevels > 0 )
|
|
||||||
{
|
|
||||||
m_numLevels = numLevels;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( m_mappingMode() == MappingType::LINEAR_CONTINUOUS || m_mappingMode() == MappingType::LINEAR_DISCRETE )
|
|
||||||
{
|
|
||||||
m_userDefinedMaxValue = m_globalAutoMax;
|
|
||||||
m_userDefinedMinValue = m_globalAutoMin;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_resetUserDefinedValues = false;
|
m_resetUserDefinedValues = false;
|
||||||
}
|
}
|
||||||
@@ -881,6 +863,36 @@ void RimRegularLegendConfig::configureCategoryMapper()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimRegularLegendConfig::updateTickCountAndUserDefinedRange()
|
||||||
|
{
|
||||||
|
if ( m_globalAutoMax != cvf::UNDEFINED_DOUBLE )
|
||||||
|
{
|
||||||
|
if ( m_mappingMode() == MappingType::LOG10_CONTINUOUS || m_mappingMode() == MappingType::LOG10_DISCRETE )
|
||||||
|
{
|
||||||
|
double exponentMax = computeTenExponentCeil( m_globalAutoMax );
|
||||||
|
double exponentMin = computeTenExponentFloor( m_globalAutoPosClosestToZero );
|
||||||
|
|
||||||
|
m_userDefinedMaxValue = pow( 10, exponentMax );
|
||||||
|
m_userDefinedMinValue = pow( 10, exponentMin );
|
||||||
|
|
||||||
|
int numLevels = exponentMax - exponentMin;
|
||||||
|
if ( numLevels > 0 )
|
||||||
|
{
|
||||||
|
m_numLevels = numLevels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( m_mappingMode() == MappingType::LINEAR_CONTINUOUS || m_mappingMode() == MappingType::LINEAR_DISCRETE )
|
||||||
|
{
|
||||||
|
m_userDefinedMaxValue = m_globalAutoMax;
|
||||||
|
m_userDefinedMinValue = m_globalAutoMin;
|
||||||
|
m_numLevels = 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1206,6 +1218,67 @@ QString RimRegularLegendConfig::valueToText( double value ) const
|
|||||||
return RiaNumberFormat::valueToText( value, m_tickNumberFormat(), m_significantDigitsInData );
|
return RiaNumberFormat::valueToText( value, m_tickNumberFormat(), m_significantDigitsInData );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimRegularLegendConfig::setDefaultConfigForResultName( const QString& resultName,
|
||||||
|
bool useDiscreteLogLevels,
|
||||||
|
bool isCategoryResult )
|
||||||
|
{
|
||||||
|
bool useLog = RiaResultNames::isLogarithmicResult( resultName );
|
||||||
|
|
||||||
|
RimRegularLegendConfig::MappingType mappingType = MappingType::LINEAR_CONTINUOUS;
|
||||||
|
RimLegendConfig::RangeModeType rangeType = RimLegendConfig::RangeModeType::AUTOMATIC_ALLTIMESTEPS;
|
||||||
|
RiaNumberFormat::NumberFormatType numberFormat = RiaNumberFormat::NumberFormatType::FIXED;
|
||||||
|
|
||||||
|
if ( useLog )
|
||||||
|
{
|
||||||
|
if ( useDiscreteLogLevels )
|
||||||
|
mappingType = RimRegularLegendConfig::MappingType::LOG10_DISCRETE;
|
||||||
|
else
|
||||||
|
mappingType = RimRegularLegendConfig::MappingType::LOG10_CONTINUOUS;
|
||||||
|
|
||||||
|
numberFormat = RiaNumberFormat::NumberFormatType::AUTO;
|
||||||
|
rangeType = RimLegendConfig::RangeModeType::USER_DEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool centerLegendAroundZero = false;
|
||||||
|
RimRegularLegendConfig::ColorRangesType colorRangeType = RimRegularLegendConfig::ColorRangesType::UNDEFINED;
|
||||||
|
|
||||||
|
if ( isCategoryResult )
|
||||||
|
{
|
||||||
|
colorRangeType = RimRegularLegendConfig::ColorRangesType::CATEGORY;
|
||||||
|
mappingType = RimRegularLegendConfig::MappingType::CATEGORY_INTEGER;
|
||||||
|
}
|
||||||
|
else if ( resultName == RiaResultNames::swat() )
|
||||||
|
{
|
||||||
|
colorRangeType = RimRegularLegendConfig::ColorRangesType::OPPOSITE_NORMAL;
|
||||||
|
}
|
||||||
|
else if ( RiaResultNames::isFlowResultWithBothPosAndNegValues( resultName ) )
|
||||||
|
{
|
||||||
|
colorRangeType = RimRegularLegendConfig::ColorRangesType::BLUE_WHITE_RED;
|
||||||
|
centerLegendAroundZero = true;
|
||||||
|
}
|
||||||
|
else if ( resultName != RiaResultNames::undefinedResultName() )
|
||||||
|
{
|
||||||
|
colorRangeType = RimRegularLegendConfig::ColorRangesType::NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
resetUserDefinedValues();
|
||||||
|
setRangeMode( rangeType );
|
||||||
|
setMappingMode( mappingType );
|
||||||
|
setCenterLegendAroundZero( centerLegendAroundZero );
|
||||||
|
setTickNumberFormat( numberFormat );
|
||||||
|
updateTickCountAndUserDefinedRange();
|
||||||
|
|
||||||
|
if ( colorRangeType != RimRegularLegendConfig::ColorRangesType::UNDEFINED )
|
||||||
|
{
|
||||||
|
RimColorLegend* colorLegend = RimRegularLegendConfig::mapToColorLegend( colorRangeType );
|
||||||
|
|
||||||
|
setColorLegend( colorLegend );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@@ -170,6 +170,8 @@ public:
|
|||||||
|
|
||||||
QString valueToText( double value ) const;
|
QString valueToText( double value ) const;
|
||||||
|
|
||||||
|
void setDefaultConfigForResultName( const QString& resultName, bool useDiscreteLogLevels, bool isCategoryResult );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||||
void sendChangedSignal( const caf::PdmFieldHandle* changedField );
|
void sendChangedSignal( const caf::PdmFieldHandle* changedField );
|
||||||
@@ -189,6 +191,7 @@ private:
|
|||||||
|
|
||||||
void updateCategoryItems();
|
void updateCategoryItems();
|
||||||
void configureCategoryMapper();
|
void configureCategoryMapper();
|
||||||
|
void updateTickCountAndUserDefinedRange();
|
||||||
|
|
||||||
friend class RimViewLinker;
|
friend class RimViewLinker;
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "RiuResultTextBuilder.h"
|
#include "RiuResultTextBuilder.h"
|
||||||
|
|
||||||
|
#include "RigAllanDiagramData.h"
|
||||||
#include "RigCaseCellResultsData.h"
|
#include "RigCaseCellResultsData.h"
|
||||||
#include "RigEclipseCaseData.h"
|
#include "RigEclipseCaseData.h"
|
||||||
#include "RigFormationNames.h"
|
#include "RigFormationNames.h"
|
||||||
@@ -37,13 +38,12 @@
|
|||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimExtrudedCurveIntersection.h"
|
#include "RimExtrudedCurveIntersection.h"
|
||||||
#include "RimFormationNames.h"
|
#include "RimFormationNames.h"
|
||||||
|
#include "RimIntersectionResultDefinition.h"
|
||||||
#include "RimRegularLegendConfig.h"
|
#include "RimRegularLegendConfig.h"
|
||||||
#include "RimReservoirCellResultsStorage.h"
|
#include "RimReservoirCellResultsStorage.h"
|
||||||
|
|
||||||
#include "RivExtrudedCurveIntersectionPartMgr.h"
|
#include "RivExtrudedCurveIntersectionPartMgr.h"
|
||||||
|
|
||||||
#include "RigAllanDiagramData.h"
|
|
||||||
#include "RimIntersectionResultDefinition.h"
|
|
||||||
#include "cafDisplayCoordTransform.h"
|
#include "cafDisplayCoordTransform.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user