#6649 Use color legend icon in drop down list.

Move the generation of the options list to RimTools to avoid duplication.
This introduces color legend icons in RimWellLogTrack.
This commit is contained in:
Kristian Bendiksen 2020-09-30 09:21:16 +02:00 committed by Magne Sjaastad
parent b529c11181
commit 63b889bbaa
5 changed files with 27 additions and 31 deletions

View File

@ -19,11 +19,11 @@
#include "RimFaciesProperties.h"
#include "RimColorLegend.h"
#include "RimColorLegendCollection.h"
#include "RimEclipseResultDefinition.h"
#include "RimFractureModelTemplate.h"
#include "RimProject.h"
#include "RimRegularLegendConfig.h"
#include "RimTools.h"
#include "RicFaciesPropertiesImportTools.h"
@ -105,17 +105,7 @@ QList<caf::PdmOptionItemInfo> RimFaciesProperties::calculateValueOptions( const
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_colorLegend )
{
RimProject* project = RimProject::current();
RimColorLegendCollection* colorLegendCollection = project->colorLegendCollection();
std::vector<RimColorLegend*> colorLegends = colorLegendCollection->allColorLegends();
for ( RimColorLegend* colorLegend : colorLegends )
{
options.push_back( caf::PdmOptionItemInfo( colorLegend->colorLegendName(),
colorLegend,
false,
colorLegend->paletteIconProvider() ) );
}
RimTools::colorLegendOptionItems( &options );
}
return options;

View File

@ -38,6 +38,7 @@
#include "RimIntersectionCollection.h"
#include "RimProject.h"
#include "RimStimPlanColors.h"
#include "RimTools.h"
#include "RimViewLinker.h"
#include "RimWellMeasurementInView.h"
#include "RimWellRftEnsembleCurveSet.h"
@ -1153,17 +1154,7 @@ QList<caf::PdmOptionItemInfo>
}
else if ( fieldNeedingOptions == &m_colorLegend )
{
RimProject* project = RimProject::current();
RimColorLegendCollection* colorLegendCollection = project->colorLegendCollection();
std::vector<RimColorLegend*> colorLegends = colorLegendCollection->allColorLegends();
for ( RimColorLegend* colorLegend : colorLegends )
{
options.push_back( caf::PdmOptionItemInfo( colorLegend->colorLegendName(),
colorLegend,
false,
colorLegend->paletteIconProvider() ) );
}
RimTools::colorLegendOptionItems( &options );
}
else if ( fieldNeedingOptions == &m_rangeMode )
{

View File

@ -21,6 +21,8 @@
#include "RimTools.h"
#include "RimCase.h"
#include "RimColorLegend.h"
#include "RimColorLegendCollection.h"
#include "RimEclipseCase.h"
#include "RimGeoMechCase.h"
#include "RimOilField.h"
@ -359,6 +361,25 @@ void RimTools::geoMechCaseOptionItems( QList<caf::PdmOptionItemInfo>* options )
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTools::colorLegendOptionItems( QList<caf::PdmOptionItemInfo>* options )
{
CVF_ASSERT( options );
if ( !options ) return;
RimProject* project = RimProject::current();
RimColorLegendCollection* colorLegendCollection = project->colorLegendCollection();
std::vector<RimColorLegend*> colorLegends = colorLegendCollection->allColorLegends();
for ( RimColorLegend* colorLegend : colorLegends )
{
options->push_back(
caf::PdmOptionItemInfo( colorLegend->colorLegendName(), colorLegend, false, colorLegend->paletteIconProvider() ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -57,6 +57,7 @@ public:
static void caseOptionItems( QList<caf::PdmOptionItemInfo>* options );
static void eclipseCaseOptionItems( QList<caf::PdmOptionItemInfo>* options );
static void geoMechCaseOptionItems( QList<caf::PdmOptionItemInfo>* options );
static void colorLegendOptionItems( QList<caf::PdmOptionItemInfo>* options );
static RimWellPathCollection* wellPathCollection();
static void timeStepsForCase( RimCase* gridCase, QList<caf::PdmOptionItemInfo>* options );

View File

@ -1040,14 +1040,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogTrack::calculateValueOptions( const caf:
}
else if ( fieldNeedingOptions == &m_colorShadingLegend )
{
RimProject* project = RimProject::current();
RimColorLegendCollection* colorLegendCollection = project->colorLegendCollection();
std::vector<RimColorLegend*> colorLegends = colorLegendCollection->allColorLegends();
for ( RimColorLegend* colorLegend : colorLegends )
{
options.push_back( caf::PdmOptionItemInfo( colorLegend->colorLegendName(), colorLegend ) );
}
RimTools::colorLegendOptionItems( &options );
}
return options;