mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5961 Color Legend : Improve default color legend for contour plots
This commit is contained in:
@@ -208,6 +208,13 @@ RimEclipseContourMapView* RicNewContourMapViewFeature::createEclipseContourMapFr
|
||||
contourMap->faultCollection()->showFaultCollection = false;
|
||||
contourMap->wellCollection()->isActive = false;
|
||||
|
||||
// Set default values
|
||||
RimRegularLegendConfig* legendConfig = contourMap->cellResult()->legendConfig();
|
||||
if ( legendConfig && legendConfig->mappingMode() == RimRegularLegendConfig::CATEGORY_INTEGER )
|
||||
{
|
||||
RicNewContourMapViewFeature::assignDefaultResultAndLegend( contourMap );
|
||||
}
|
||||
|
||||
caf::PdmDocument::updateUiIconStateRecursively( contourMap );
|
||||
|
||||
eclipseCase->contourMapCollection()->push_back( contourMap );
|
||||
@@ -235,22 +242,7 @@ RimEclipseContourMapView* RicNewContourMapViewFeature::createEclipseContourMap(
|
||||
RimEclipseContourMapView* contourMap = new RimEclipseContourMapView();
|
||||
contourMap->setEclipseCase( eclipseCase );
|
||||
|
||||
// Set default values
|
||||
{
|
||||
contourMap->cellResult()->setResultType( RiaDefines::ResultCatType::DYNAMIC_NATIVE );
|
||||
|
||||
if ( RiaApplication::instance()->preferences()->loadAndShowSoil )
|
||||
{
|
||||
contourMap->cellResult()->setResultVariable( "SOIL" );
|
||||
}
|
||||
|
||||
RimRegularLegendConfig* legendConfig = contourMap->cellResult()->legendConfig();
|
||||
if ( legendConfig )
|
||||
{
|
||||
RimColorLegend* legend = legendConfig->mapToColorLegend( RimRegularLegendConfig::RAINBOW );
|
||||
legendConfig->setColorLegend( legend );
|
||||
}
|
||||
}
|
||||
assignDefaultResultAndLegend( contourMap );
|
||||
|
||||
caf::PdmDocument::updateUiIconStateRecursively( contourMap );
|
||||
|
||||
@@ -343,3 +335,26 @@ RimGeoMechContourMapView* RicNewContourMapViewFeature::createGeoMechContourMap(
|
||||
|
||||
return contourMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewContourMapViewFeature::assignDefaultResultAndLegend( RimEclipseContourMapView* contourMap )
|
||||
{
|
||||
if ( contourMap->cellResult() )
|
||||
{
|
||||
contourMap->cellResult()->setResultType( RiaDefines::ResultCatType::DYNAMIC_NATIVE );
|
||||
|
||||
if ( RiaApplication::instance()->preferences()->loadAndShowSoil )
|
||||
{
|
||||
contourMap->cellResult()->setResultVariable( "SOIL" );
|
||||
}
|
||||
|
||||
RimRegularLegendConfig* legendConfig = contourMap->cellResult()->legendConfig();
|
||||
if ( legendConfig )
|
||||
{
|
||||
RimColorLegend* legend = legendConfig->mapToColorLegend( RimRegularLegendConfig::RAINBOW );
|
||||
legendConfig->setColorLegend( legend );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,4 +54,6 @@ protected:
|
||||
static RimGeoMechContourMapView* createGeoMechContourMapFrom3dView( RimGeoMechCase* geoMechCase,
|
||||
const RimGeoMechView* sourceView );
|
||||
static RimGeoMechContourMapView* createGeoMechContourMap( RimGeoMechCase* geoMechCase );
|
||||
|
||||
static void assignDefaultResultAndLegend( RimEclipseContourMapView* contourMap );
|
||||
};
|
||||
|
||||
@@ -699,12 +699,12 @@ void RimRegularLegendConfig::updateCategoryItems()
|
||||
cvf::Color3ub ubColor( item->color() );
|
||||
categories.push_back( std::make_tuple( item->itemName(), item->categoryValue(), ubColor ) );
|
||||
}
|
||||
|
||||
// Reverse the categories to make the ordering identical to items in project tree
|
||||
std::reverse( categories.begin(), categories.end() );
|
||||
|
||||
setCategoryItems( categories );
|
||||
}
|
||||
|
||||
// Reverse the categories to make the ordering identical to items in project tree
|
||||
std::reverse( categories.begin(), categories.end() );
|
||||
|
||||
setCategoryItems( categories );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -159,8 +159,6 @@ Color3ub CategoryMapper::mapToColor( double categoryValue ) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void CategoryMapper::majorTickValues( std::vector<double>* domainValues ) const
|
||||
{
|
||||
// Not intended to be supported
|
||||
CVF_ASSERT( false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user