#5874 Remove direct accessor to obsoleted RimRegularLegendConfig::colorRange field.

This commit is contained in:
Kristian Bendiksen
2020-05-23 10:57:09 +02:00
committed by Magne Sjaastad
parent f578f1f954
commit 0b9577df71
11 changed files with 48 additions and 34 deletions

View File

@@ -50,10 +50,10 @@ CAF_CMD_SOURCE_INIT( RicNewSummaryEnsembleCurveSetFeature, "RicNewSummaryEnsembl
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimEnsembleCurveSet*> RicNewSummaryEnsembleCurveSetFeature::addDefaultCurveSets( RimSummaryPlot* plot,
RimSummaryCaseCollection* ensemble )
std::vector<RimEnsembleCurveSet*>
RicNewSummaryEnsembleCurveSetFeature::addDefaultCurveSets( RimSummaryPlot* plot, RimSummaryCaseCollection* ensemble )
{
CVF_ASSERT( plot && ensemble );
CVF_ASSERT( plot && ensemble );
RimProject* project = RimProject::current();
CVF_ASSERT( project );
@@ -66,7 +66,7 @@ std::vector<RimEnsembleCurveSet*> RicNewSummaryEnsembleCurveSetFeature::addDefau
std::vector<RimEnsembleCurveSet*> curveSets;
for ( const auto& addr : addrs )
{
for (auto filter : curveFilters)
for ( auto filter : curveFilters )
{
if ( addr.isUiTextMatchingFilterText( filter ) )
{
@@ -75,8 +75,8 @@ std::vector<RimEnsembleCurveSet*> RicNewSummaryEnsembleCurveSetFeature::addDefau
// Use same counting as RicNewSummaryCurveFeature::onActionTriggered
auto colorIndex = plot->singleColorCurveCount();
curveSet->setColor( RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex ) );
curveSet->legendConfig()->setColorRange(
RimEnsembleCurveSetColorManager::cycledEnsembleColorRange( static_cast<int>( colorIndex ) ) );
curveSet->legendConfig()->setColorLegend( RimRegularLegendConfig::mapToColorLegend(
RimEnsembleCurveSetColorManager::cycledEnsembleColorRange( static_cast<int>( colorIndex ) ) ) );
curveSet->setSummaryCaseCollection( ensemble );
curveSet->setSummaryAddress( addr );
@@ -108,7 +108,8 @@ RimSummaryPlot*
RimEnsembleCurveSet* firstCurveSetCreated = nullptr;
for ( RimSummaryCaseCollection* ensemble : ensembles )
{
std::vector<RimEnsembleCurveSet*> curveSets = RicNewSummaryEnsembleCurveSetFeature::addDefaultCurveSets( plot, ensemble );
std::vector<RimEnsembleCurveSet*> curveSets =
RicNewSummaryEnsembleCurveSetFeature::addDefaultCurveSets( plot, ensemble );
if ( !firstCurveSetCreated && !curveSets.empty() ) firstCurveSetCreated = curveSets.front();
}
@@ -157,9 +158,9 @@ void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered( bool isChecked )
auto ensemble = project->summaryGroups().back();
RimEnsembleCurveSet* firstCurveSet = nullptr;
if (!RiaApplication::instance()->preferences()->defaultSummaryCurvesTextFilter().isEmpty())
if ( !RiaApplication::instance()->preferences()->defaultSummaryCurvesTextFilter().isEmpty() )
{
auto curveSets = RicNewSummaryEnsembleCurveSetFeature::addDefaultCurveSets(plot, ensemble);
auto curveSets = RicNewSummaryEnsembleCurveSetFeature::addDefaultCurveSets( plot, ensemble );
if ( !curveSets.empty() ) firstCurveSet = curveSets.front();
}
plot->loadDataAndUpdate();
@@ -167,9 +168,9 @@ void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered( bool isChecked )
RiaGuiApplication* app = RiaGuiApplication::instance();
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
if ( mainPlotWindow && firstCurveSet)
if ( mainPlotWindow && firstCurveSet )
{
mainPlotWindow->selectAsCurrentItem(firstCurveSet);
mainPlotWindow->selectAsCurrentItem( firstCurveSet );
mainPlotWindow->updateSummaryPlotToolBar();
}
}

View File

@@ -56,7 +56,8 @@ RimWellRftEnsembleCurveSet::RimWellRftEnsembleCurveSet()
CAF_PDM_InitFieldNoDefault( &m_ensembleLegendConfig, "LegendConfig", "", "", "", "" );
m_ensembleLegendConfig = new RimRegularLegendConfig();
m_ensembleLegendConfig->setColorRange( RimEnsembleCurveSetColorManager::DEFAULT_ENSEMBLE_COLOR_RANGE );
m_ensembleLegendConfig->setColorLegend(
RimRegularLegendConfig::mapToColorLegend( RimEnsembleCurveSetColorManager::DEFAULT_ENSEMBLE_COLOR_RANGE ) );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -171,7 +171,8 @@ void RimGridCrossPlotDataSet::setCellFilterView( RimGridView* cellFilterView )
if ( eclipseView->eclipseCase() && eclipseView->eclipseCase()->activeFormationNames() )
{
m_grouping = GROUP_BY_FORMATION;
m_groupingProperty->legendConfig()->setColorRange( RimRegularLegendConfig::CATEGORY );
m_groupingProperty->legendConfig()->setColorLegend(
RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::CATEGORY ) );
}
RimGridCrossPlot* parentPlot = nullptr;
@@ -867,17 +868,17 @@ void RimGridCrossPlotDataSet::fieldChangedByUi( const caf::PdmFieldHandle* chang
{
if ( m_grouping == GROUP_BY_TIME )
{
legendConfig()->setColorRange( RimRegularLegendConfig::NORMAL );
legendConfig()->setColorLegend( RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::NORMAL ) );
legendConfig()->setMappingMode( RimRegularLegendConfig::CATEGORY_INTEGER );
}
else if ( groupingByCategoryResult() )
{
legendConfig()->setColorRange( RimRegularLegendConfig::CATEGORY );
legendConfig()->setColorLegend( RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::CATEGORY ) );
legendConfig()->setMappingMode( RimRegularLegendConfig::CATEGORY_INTEGER );
}
else
{
legendConfig()->setColorRange( RimRegularLegendConfig::NORMAL );
legendConfig()->setColorLegend( RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::NORMAL ) );
legendConfig()->setMappingMode( RimRegularLegendConfig::LINEAR_DISCRETE );
}
@@ -1308,7 +1309,8 @@ void RimGridCrossPlotDataSet::setDefaults()
if ( eclipseCase->activeFormationNames() )
{
m_grouping = GROUP_BY_FORMATION;
m_groupingProperty->legendConfig()->setColorRange( RimRegularLegendConfig::CATEGORY );
m_groupingProperty->legendConfig()->setColorLegend(
RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::CATEGORY ) );
}
}
}

View File

@@ -250,7 +250,7 @@ void RimEclipseCellColors::updateLegendCategorySettings()
if ( this->hasCategoryResult() )
{
legendConfig()->setMappingMode( RimRegularLegendConfig::CATEGORY_INTEGER );
legendConfig()->setColorRange( RimRegularLegendConfig::CATEGORY );
legendConfig()->setColorLegend( RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::CATEGORY ) );
}
else
{
@@ -259,9 +259,9 @@ void RimEclipseCellColors::updateLegendCategorySettings()
legendConfig()->setMappingMode( RimRegularLegendConfig::LINEAR_CONTINUOUS );
}
if ( legendConfig()->colorRange() == RimRegularLegendConfig::CATEGORY )
if ( legendConfig()->colorLegend() == RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::CATEGORY ) )
{
legendConfig()->setColorRange( RimRegularLegendConfig::NORMAL );
legendConfig()->setColorLegend( RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::NORMAL ) );
}
}
}

View File

@@ -194,7 +194,8 @@ RimEclipseView::RimEclipseView()
this->cellResult()->setReservoirView( this );
this->cellEdgeResult()->setReservoirView( this );
this->cellEdgeResult()->legendConfig()->setColorRange( RimRegularLegendConfig::PINK_WHITE );
this->cellEdgeResult()->legendConfig()->setColorLegend(
RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::PINK_WHITE ) );
this->faultResultSettings()->setReservoirView( this );

View File

@@ -86,7 +86,7 @@ void RimGeoMechCellColors::updateLegendCategorySettings()
if ( this->hasCategoryResult() )
{
legendConfig->setMappingMode( RimRegularLegendConfig::CATEGORY_INTEGER );
legendConfig->setColorRange( RimRegularLegendConfig::CATEGORY );
legendConfig->setColorLegend( RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::CATEGORY ) );
}
else
{
@@ -95,9 +95,9 @@ void RimGeoMechCellColors::updateLegendCategorySettings()
legendConfig->setMappingMode( RimRegularLegendConfig::LINEAR_CONTINUOUS );
}
if ( legendConfig->colorRange() == RimRegularLegendConfig::CATEGORY )
if ( legendConfig->colorLegend() == RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::CATEGORY ) )
{
legendConfig->setColorRange( RimRegularLegendConfig::NORMAL );
legendConfig->setColorLegend( RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::NORMAL ) );
}
}
}

View File

@@ -240,7 +240,8 @@ void RimIntersectionResultDefinition::updateLegendRangesTextAndVisibility( const
( !this->isEclipseResultDefinition() && m_geomResultDefinition()->hasCategoryResult() ) )
{
regularLegendConfig()->setMappingMode( RimRegularLegendConfig::CATEGORY_INTEGER );
regularLegendConfig()->setColorRange( RimRegularLegendConfig::CATEGORY );
regularLegendConfig()->setColorLegend(
RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::CATEGORY ) );
}
else
{
@@ -249,9 +250,11 @@ void RimIntersectionResultDefinition::updateLegendRangesTextAndVisibility( const
regularLegendConfig()->setMappingMode( RimRegularLegendConfig::LINEAR_CONTINUOUS );
}
if ( regularLegendConfig()->colorRange() == RimRegularLegendConfig::CATEGORY )
if ( regularLegendConfig()->colorLegend() ==
RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::CATEGORY ) )
{
regularLegendConfig()->setColorRange( RimRegularLegendConfig::NORMAL );
regularLegendConfig()->setColorLegend(
RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::NORMAL ) );
}
}

View File

@@ -607,13 +607,20 @@ void RimRegularLegendConfig::updateFieldVisibility()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimRegularLegendConfig::setColorRange( ColorRangesType colorMode )
void RimRegularLegendConfig::setColorLegend( RimColorLegend* colorLegend )
{
m_colorRangeMode_OBSOLETE = colorMode;
m_colorLegend = mapToColorLegend( colorMode );
m_colorLegend = colorLegend;
updateLegend();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimColorLegend* RimRegularLegendConfig::colorLegend() const
{
return m_colorLegend();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -109,8 +109,6 @@ public:
typedef caf::AppEnum<MappingType> MappingEnum;
void recreateLegend();
void setColorRange( ColorRangesType colorMode );
ColorRangesType colorRange() { return m_colorRangeMode_OBSOLETE(); }
void setColorLegend( RimColorLegend* colorLegend );
RimColorLegend* colorLegend() const;
void setMappingMode( MappingType mappingType );

View File

@@ -148,7 +148,7 @@ void RimStimPlanColors::loadDataAndUpdate()
RimRegularLegendConfig* legendConfig = new RimRegularLegendConfig();
legendConfig->resultVariableName = resultNameUnitString;
legendConfig->setMappingMode( RimRegularLegendConfig::LINEAR_DISCRETE );
legendConfig->setColorRange( RimRegularLegendConfig::STIMPLAN );
legendConfig->setColorLegend( RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::STIMPLAN ) );
m_legendConfigurations.push_back( legendConfig );
}

View File

@@ -124,7 +124,8 @@ RimEnsembleCurveSet::RimEnsembleCurveSet()
CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "", "", "", "" );
m_legendConfig = new RimRegularLegendConfig();
m_legendConfig->setColorRange( RimEnsembleCurveSetColorManager::DEFAULT_ENSEMBLE_COLOR_RANGE );
m_legendConfig->setColorLegend(
RimRegularLegendConfig::mapToColorLegend( RimEnsembleCurveSetColorManager::DEFAULT_ENSEMBLE_COLOR_RANGE ) );
CAF_PDM_InitFieldNoDefault( &m_curveFilters, "CurveFilters", "Curve Filters", "", "", "" );
m_curveFilters = new RimEnsembleCurveFilterCollection();