#13806 Python: Add color legend scripting API

Expose RimColorLegendCollection and RimColorLegend to Python via
CAF_PDM_OBJECT_METHOD entries that let callers create a legend, append
category items with a hex-string color, bind a legend to a (case,
resultName) pair and delete that binding.

Scriptable fields on RimColorLegend and RimColorLegendItem make the
created objects inspectable from Python.

The (case, resultName) binding interface in RimColorLegendCollection,
RimRegularLegendConfig and RimEclipseCellColors now takes a const RimCase*
instead of a case id, matching the caller patterns and avoiding ambiguity
when multiple cases share an id domain.
This commit is contained in:
Magne Sjaastad
2026-04-20 18:55:36 +02:00
parent 75c1cedaec
commit cf62f07224
13 changed files with 323 additions and 39 deletions
@@ -581,12 +581,10 @@ std::pair<bool, std::map<QString, QString>> RifRoffFileTools::createInputPropert
{
RimColorLegendCollection* colorLegendCollection = RimProject::current()->colorLegendCollection;
int caseId = 0;
auto rimCase = eclipseCaseData->ownerCase();
if ( rimCase ) caseId = rimCase->caseId();
// Delete existing color legend, as new legend will be populated by values from file
colorLegendCollection->deleteColorLegend( caseId, newResultName );
colorLegendCollection->deleteColorLegend( rimCase, newResultName );
RimColorLegend* colorLegend = nullptr;
if ( keywordUpperCase == RiaResultNames::facies() )
@@ -598,7 +596,7 @@ std::pair<bool, std::map<QString, QString>> RifRoffFileTools::createInputPropert
colorLegend = colorLegendCollection->createColorLegend( newResultName, codeNames );
}
colorLegendCollection->setDefaultColorLegendForResult( caseId, newResultName, colorLegend );
colorLegendCollection->setDefaultColorLegendForResult( rimCase, newResultName, colorLegend );
colorLegendCollection->updateAllRequiredEditors();
}
@@ -373,10 +373,7 @@ void RimIntersectionResultDefinition::setDefaultEclipseLegendConfig()
auto eclResultDef = eclipseResultDefinition();
eclResultDef->updateRangesForExplicitLegends( regularLegendConfig(), ternaryLegendConfig(), timeStep() );
m_legendConfig->setDefaultConfigForResultName( m_case->caseId(),
m_eclipseResultDefinition->resultVariable(),
useDiscreteLogLevels,
isCategoryResult );
m_legendConfig->setDefaultConfigForResultName( m_case, m_eclipseResultDefinition->resultVariable(), useDiscreteLogLevels, isCategoryResult );
}
//--------------------------------------------------------------------------------------------------
@@ -24,6 +24,7 @@
#include "RimColorLegendItem.h"
#include "cafPdmFieldReorderCapability.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include <algorithm>
@@ -38,9 +39,9 @@ RimColorLegend::RimColorLegend()
{
CAF_PDM_InitScriptableObject( "ColorLegend", ":/Legend.png" );
CAF_PDM_InitField( &m_colorLegendName, "ColorLegendName", QString( "" ), "Color Legend Name" );
CAF_PDM_InitScriptableField( &m_colorLegendName, "ColorLegendName", QString( "" ), "Color Legend Name" );
CAF_PDM_InitFieldNoDefault( &m_colorLegendItems, "ColorLegendItems", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_colorLegendItems, "ColorLegendItems", "" );
setDeletable( true );
}
@@ -24,11 +24,15 @@
#include "RigFormationNames.h"
#include "Formations/RimFormationNames.h"
#include "RimCase.h"
#include "RimColorLegend.h"
#include "RimColorLegendItem.h"
#include "RimProject.h"
#include "RimRegularLegendConfig.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include <QString>
CAF_PDM_SOURCE_INIT( RimColorLegendCollection, "ColorLegendCollection" );
@@ -38,12 +42,12 @@ CAF_PDM_SOURCE_INIT( RimColorLegendCollection, "ColorLegendCollection" );
//--------------------------------------------------------------------------------------------------
RimColorLegendCollection::RimColorLegendCollection()
{
CAF_PDM_InitObject( "Color Legends", ":/Legend.png" );
CAF_PDM_InitScriptableObject( "Color Legends", ":/Legend.png" );
CAF_PDM_InitFieldNoDefault( &m_standardColorLegends, "StandardColorLegends", "Standard Color Legends", ":/Legend.png" );
m_standardColorLegends.xmlCapability()->disableIO();
CAF_PDM_InitFieldNoDefault( &m_customColorLegends, "CustomColorLegends", "Custom Color Legends", ":/Legend.png" );
CAF_PDM_InitScriptableFieldNoDefault( &m_customColorLegends, "CustomColorLegends", "Custom Color Legends", ":/Legend.png" );
}
//--------------------------------------------------------------------------------------------------
@@ -113,11 +117,11 @@ RimColorLegend* RimColorLegendCollection::createColorLegend( const QString& colo
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimColorLegendCollection::deleteColorLegend( int caseId, const QString& resultName )
void RimColorLegendCollection::deleteColorLegend( const RimCase* rimCase, const QString& resultName )
{
m_defaultColorLegendNameForResult.erase( createLookupKey( caseId, resultName ) );
m_defaultColorLegendNameForResult.erase( createLookupKey( rimCase, resultName ) );
auto legend = findDefaultLegendForResult( caseId, resultName );
auto legend = findDefaultLegendForResult( rimCase, resultName );
if ( !legend ) return;
m_customColorLegends.removeChild( legend );
@@ -127,9 +131,9 @@ void RimColorLegendCollection::deleteColorLegend( int caseId, const QString& res
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimColorLegendCollection::setDefaultColorLegendForResult( int caseId, const QString& resultName, RimColorLegend* colorLegend )
void RimColorLegendCollection::setDefaultColorLegendForResult( const RimCase* rimCase, const QString& resultName, RimColorLegend* colorLegend )
{
auto key = createLookupKey( caseId, resultName );
auto key = createLookupKey( rimCase, resultName );
m_defaultColorLegendNameForResult[key] = colorLegend;
}
@@ -266,9 +270,9 @@ RimColorLegend* RimColorLegendCollection::findByName( const QString& name ) cons
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimColorLegend* RimColorLegendCollection::findDefaultLegendForResult( int caseId, const QString& resultName ) const
RimColorLegend* RimColorLegendCollection::findDefaultLegendForResult( const RimCase* rimCase, const QString& resultName ) const
{
auto key = createLookupKey( caseId, resultName );
auto key = createLookupKey( rimCase, resultName );
auto it = m_defaultColorLegendNameForResult.find( key );
if ( it != m_defaultColorLegendNameForResult.end() )
@@ -358,8 +362,9 @@ RimColorLegend* RimColorLegendCollection::createRockTypeColorLegend() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimColorLegendCollection::createLookupKey( int caseId, const QString& resultName )
QString RimColorLegendCollection::createLookupKey( const RimCase* rimCase, const QString& resultName )
{
const int caseId = rimCase ? rimCase->caseId() : -1;
return QString( "%1 (case %2)" ).arg( resultName ).arg( caseId );
}
@@ -22,6 +22,7 @@
#include "cafPdmField.h"
#include "cafPdmObject.h"
class RimCase;
class RimColorLegend;
class RimColorLegendItem;
class RimFormationNames;
@@ -50,13 +51,13 @@ public:
RimColorLegend* createColorLegend( const QString& colorLegendName, const std::map<int, QString>& valuesAndNames );
void createColorLegendFromFormationNames( RimFormationNames* rimFormationNames );
void deleteColorLegend( int caseId, const QString& resultName );
void setDefaultColorLegendForResult( int caseId, const QString& resultName, RimColorLegend* colorLegend );
void deleteColorLegend( const RimCase* rimCase, const QString& resultName );
void setDefaultColorLegendForResult( const RimCase* rimCase, const QString& resultName, RimColorLegend* colorLegend );
std::vector<RimColorLegend*> allColorLegends() const;
RimColorLegend* findByName( const QString& name ) const;
RimColorLegend* findDefaultLegendForResult( int caseId, const QString& resultName ) const;
RimColorLegend* findDefaultLegendForResult( const RimCase* rimCase, const QString& resultName ) const;
protected:
void initAfterRead() override;
@@ -65,7 +66,7 @@ private:
RimColorLegendItem* createColorLegendItem( const QString& name, int r, int g, int b ) const;
RimColorLegend* createRockTypeColorLegend() const;
static QString createLookupKey( int caseId, const QString& resultName );
static QString createLookupKey( const RimCase* rimCase, const QString& resultName );
caf::PdmChildArrayField<RimColorLegend*> m_standardColorLegends; // ResInsight standard (built-in) legends
caf::PdmChildArrayField<RimColorLegend*> m_customColorLegends; // user specified legends
@@ -19,6 +19,9 @@
#include "RimColorLegendItem.h"
#include "RimColorLegend.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmFieldScriptingCapabilityCvfColor3.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiSliderEditor.h"
#include "cvfColor3.h"
@@ -33,15 +36,15 @@ CAF_PDM_SOURCE_INIT( RimColorLegendItem, "ColorLegendItem" );
//--------------------------------------------------------------------------------------------------
RimColorLegendItem::RimColorLegendItem()
{
CAF_PDM_InitObject( "ColorLegendItem" );
CAF_PDM_InitScriptableObject( "ColorLegendItem" );
CAF_PDM_InitFieldNoDefault( &m_color, "Color", "Color" );
CAF_PDM_InitScriptableFieldNoDefault( &m_color, "Color", "Color" );
m_color = cvf::Color3f( cvf::Color3::ColorIdent::BLACK );
CAF_PDM_InitField( &m_categoryValue, "CategoryValue", 0, "Category Number" );
CAF_PDM_InitScriptableField( &m_categoryValue, "CategoryValue", 0, "Category Number" );
m_categoryValue.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_categoryName, "CategoryName", QString( "" ), "Category Name" );
CAF_PDM_InitScriptableField( &m_categoryName, "CategoryName", QString( "" ), "Category Name" );
CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy" );
m_nameProxy.registerGetMethod( this, &RimColorLegendItem::itemName );
@@ -145,13 +145,10 @@ void RimEclipseCellColors::changeLegendConfig( QString resultVarNameOfNewLegend
if ( !found )
{
int caseId = 0;
if ( eclipseCase() ) caseId = eclipseCase()->caseId();
bool useCategoryLegend = hasCategoryResult();
if ( m_resultType() == RiaDefines::ResultCatType::FORMATION_NAMES ) useCategoryLegend = true;
auto newLegend = createLegendForResult( caseId, resultVarNameOfNewLegend, m_useDiscreteLogLevels, useCategoryLegend );
auto newLegend = createLegendForResult( eclipseCase(), resultVarNameOfNewLegend, m_useDiscreteLogLevels, useCategoryLegend );
newLegend->changed.connect( this, &RimEclipseCellColors::onLegendConfigChanged );
@@ -174,13 +171,15 @@ void RimEclipseCellColors::onLegendConfigChanged( const caf::SignalEmitter* emit
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimRegularLegendConfig*
RimEclipseCellColors::createLegendForResult( int caseId, const QString& resultName, bool useDiscreteLogLevels, bool isCategoryResult )
RimRegularLegendConfig* RimEclipseCellColors::createLegendForResult( const RimCase* rimCase,
const QString& resultName,
bool useDiscreteLogLevels,
bool isCategoryResult )
{
auto* newLegend = new RimRegularLegendConfig;
newLegend->resultVariableName = resultName;
newLegend->setDefaultConfigForResultName( caseId, resultName, useDiscreteLogLevels, isCategoryResult );
newLegend->setDefaultConfigForResultName( rimCase, resultName, useDiscreteLogLevels, isCategoryResult );
return newLegend;
}
@@ -27,6 +27,7 @@
#include "cafPdmChildField.h"
#include "cafPdmPtrField.h"
class RimCase;
class RimEclipseCase;
class RimRegularLegendConfig;
class RimTernaryLegendConfig;
@@ -78,7 +79,8 @@ protected:
private:
void changeLegendConfig( QString resultVarNameOfNewLegend );
void onLegendConfigChanged( const caf::SignalEmitter* emitter, RimLegendConfigChangeType changeType );
static RimRegularLegendConfig* createLegendForResult( int caseId, const QString& resultName, bool useDiscreteLevels, bool isCategoryResult );
static RimRegularLegendConfig*
createLegendForResult( const RimCase* rimCase, const QString& resultName, bool useDiscreteLevels, bool isCategoryResult );
void updateUiTreeName();
caf::PdmChildArrayField<RimRegularLegendConfig*> m_legendConfigData;
@@ -1157,7 +1157,10 @@ int RimRegularLegendConfig::significantDigitsInData() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimRegularLegendConfig::setDefaultConfigForResultName( int caseId, const QString& resultName, bool useDiscreteLogLevels, bool isCategoryResult )
void RimRegularLegendConfig::setDefaultConfigForResultName( const RimCase* rimCase,
const QString& resultName,
bool useDiscreteLogLevels,
bool isCategoryResult )
{
bool useLog = RiaResultNames::isLogarithmicResult( resultName );
@@ -1213,7 +1216,7 @@ void RimRegularLegendConfig::setDefaultConfigForResultName( int caseId, const QS
updateTickCountAndUserDefinedRange();
RimProject* project = RimProject::current();
auto defaultLegend = project->colorLegendCollection()->findDefaultLegendForResult( caseId, resultName );
auto defaultLegend = project->colorLegendCollection()->findDefaultLegendForResult( rimCase, resultName );
if ( defaultLegend )
{
setColorLegend( defaultLegend );
@@ -52,6 +52,7 @@ class OverlayScalarMapperLegend;
} // namespace caf
class Rim3dView;
class RimCase;
class RimEnsembleCurveSet;
class RiuAbstractLegendFrame;
class RimColorLegend;
@@ -175,7 +176,7 @@ public:
QString valueToText( double value ) const;
void setDefaultConfigForResultName( int caseId, const QString& resultName, bool useDiscreteLogLevels, bool isCategoryResult );
void setDefaultConfigForResultName( const RimCase* rimCase, const QString& resultName, bool useDiscreteLogLevels, bool isCategoryResult );
void defineUiOrderingColorOnly( caf::PdmUiOrdering* colorGroup );
@@ -38,6 +38,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimcWellPathCompletionSettings.h
${CMAKE_CURRENT_LIST_DIR}/RimcWellPathValve.h
${CMAKE_CURRENT_LIST_DIR}/RimcWellEventTimeline.h
${CMAKE_CURRENT_LIST_DIR}/RimcColorLegend.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -80,6 +81,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimcWellPathCompletionSettings.cpp
${CMAKE_CURRENT_LIST_DIR}/RimcWellPathValve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimcWellEventTimeline.cpp
${CMAKE_CURRENT_LIST_DIR}/RimcColorLegend.cpp
)
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
@@ -0,0 +1,169 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimcColorLegend.h"
#include "RimCase.h"
#include "RimColorLegend.h"
#include "RimColorLegendCollection.h"
#include "RimColorLegendItem.h"
#include "cafPdmAbstractFieldScriptingCapability.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmFieldScriptingCapabilityCvfColor3.h"
#include "cvfColor3.h"
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimColorLegendCollection, RimcColorLegendCollection_createColorLegend, "CreateColorLegend" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimcColorLegendCollection_createColorLegend::RimcColorLegendCollection_createColorLegend( caf::PdmObjectHandle* self )
: caf::PdmObjectCreationMethod( self )
{
CAF_PDM_InitObject( "Create Color Legend", "", "", "Create a new custom color legend" );
CAF_PDM_InitScriptableFieldNoDefault( &m_legendName, "Name", "Name" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::expected<caf::PdmObjectHandle*, QString> RimcColorLegendCollection_createColorLegend::execute()
{
auto collection = self<RimColorLegendCollection>();
if ( !collection ) return std::unexpected( "No color legend collection found" );
auto* legend = new RimColorLegend();
legend->setColorLegendName( m_legendName() );
collection->appendCustomColorLegend( legend );
collection->updateConnectedEditors();
return legend;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimcColorLegendCollection_createColorLegend::classKeywordReturnedType() const
{
return RimColorLegend::classKeywordStatic();
}
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimColorLegend, RimcColorLegend_addColorLegendItem, "AddColorLegendItem" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimcColorLegend_addColorLegendItem::RimcColorLegend_addColorLegendItem( caf::PdmObjectHandle* self )
: caf::PdmObjectCreationMethod( self )
{
CAF_PDM_InitObject( "Add Color Legend Item", "", "", "Append a category item with a name and RGB color" );
CAF_PDM_InitScriptableField( &m_categoryValue, "CategoryValue", 0, "Category Value" );
CAF_PDM_InitScriptableField( &m_categoryName, "CategoryName", QString(), "Category Name" );
CAF_PDM_InitScriptableField( &m_color, "Color", cvf::Color3f( cvf::Color3f::ORANGE ), "Color" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::expected<caf::PdmObjectHandle*, QString> RimcColorLegend_addColorLegendItem::execute()
{
auto legend = self<RimColorLegend>();
if ( !legend ) return std::unexpected( "No color legend found" );
auto* item = new RimColorLegendItem();
item->setValues( m_categoryName(), m_categoryValue(), m_color() );
legend->appendColorLegendItem( item );
return item;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimcColorLegend_addColorLegendItem::classKeywordReturnedType() const
{
return RimColorLegendItem::classKeywordStatic();
}
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimColorLegendCollection,
RimcColorLegendCollection_setDefaultColorLegendForResult,
"SetDefaultColorLegendForResult" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimcColorLegendCollection_setDefaultColorLegendForResult::RimcColorLegendCollection_setDefaultColorLegendForResult( caf::PdmObjectHandle* self )
: caf::PdmVoidObjectMethod( self )
{
CAF_PDM_InitObject( "Set Default Color Legend For Result", "", "", "Bind a color legend to a (case, resultName) pair" );
CAF_PDM_InitScriptableFieldNoDefault( &m_case, "Case", "Case" );
CAF_PDM_InitScriptableField( &m_resultName, "ResultName", QString(), "Result Name" );
CAF_PDM_InitScriptableFieldNoDefault( &m_colorLegend, "ColorLegend", "Color Legend" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::expected<caf::PdmObjectHandle*, QString> RimcColorLegendCollection_setDefaultColorLegendForResult::execute()
{
auto collection = self<RimColorLegendCollection>();
if ( !collection ) return std::unexpected( "No color legend collection found" );
if ( !m_case() ) return std::unexpected( "No case provided" );
if ( !m_colorLegend() ) return std::unexpected( "No color legend provided" );
collection->setDefaultColorLegendForResult( m_case(), m_resultName(), m_colorLegend() );
return nullptr;
}
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimColorLegendCollection, RimcColorLegendCollection_deleteColorLegend, "DeleteColorLegend" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimcColorLegendCollection_deleteColorLegend::RimcColorLegendCollection_deleteColorLegend( caf::PdmObjectHandle* self )
: caf::PdmVoidObjectMethod( self )
{
CAF_PDM_InitObject( "Delete Color Legend", "", "", "Remove the color legend bound to a (case, resultName) pair" );
CAF_PDM_InitScriptableFieldNoDefault( &m_case, "Case", "Case" );
CAF_PDM_InitScriptableField( &m_resultName, "ResultName", QString(), "Result Name" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::expected<caf::PdmObjectHandle*, QString> RimcColorLegendCollection_deleteColorLegend::execute()
{
auto collection = self<RimColorLegendCollection>();
if ( !collection ) return std::unexpected( "No color legend collection found" );
if ( !m_case() ) return std::unexpected( "No case provided" );
collection->deleteColorLegend( m_case(), m_resultName() );
collection->updateConnectedEditors();
return nullptr;
}
@@ -0,0 +1,103 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmField.h"
#include "cafPdmFieldCvfColor.h"
#include "cafPdmObjectHandle.h"
#include "cafPdmObjectMethod.h"
#include "cafPdmPtrField.h"
#include "cvfColor3.h"
#include <QString>
class RimCase;
class RimColorLegend;
//==================================================================================================
///
//==================================================================================================
class RimcColorLegendCollection_createColorLegend : public caf::PdmObjectCreationMethod
{
CAF_PDM_HEADER_INIT;
public:
RimcColorLegendCollection_createColorLegend( caf::PdmObjectHandle* self );
std::expected<caf::PdmObjectHandle*, QString> execute() override;
QString classKeywordReturnedType() const override;
private:
caf::PdmField<QString> m_legendName;
};
//==================================================================================================
///
//==================================================================================================
class RimcColorLegend_addColorLegendItem : public caf::PdmObjectCreationMethod
{
CAF_PDM_HEADER_INIT;
public:
RimcColorLegend_addColorLegendItem( caf::PdmObjectHandle* self );
std::expected<caf::PdmObjectHandle*, QString> execute() override;
QString classKeywordReturnedType() const override;
private:
caf::PdmField<int> m_categoryValue;
caf::PdmField<QString> m_categoryName;
caf::PdmField<cvf::Color3f> m_color;
};
//==================================================================================================
///
//==================================================================================================
class RimcColorLegendCollection_setDefaultColorLegendForResult : public caf::PdmVoidObjectMethod
{
CAF_PDM_HEADER_INIT;
public:
RimcColorLegendCollection_setDefaultColorLegendForResult( caf::PdmObjectHandle* self );
std::expected<caf::PdmObjectHandle*, QString> execute() override;
private:
caf::PdmPtrField<RimCase*> m_case;
caf::PdmField<QString> m_resultName;
caf::PdmPtrField<RimColorLegend*> m_colorLegend;
};
//==================================================================================================
///
//==================================================================================================
class RimcColorLegendCollection_deleteColorLegend : public caf::PdmVoidObjectMethod
{
CAF_PDM_HEADER_INIT;
public:
RimcColorLegendCollection_deleteColorLegend( caf::PdmObjectHandle* self );
std::expected<caf::PdmObjectHandle*, QString> execute() override;
private:
caf::PdmPtrField<RimCase*> m_case;
caf::PdmField<QString> m_resultName;
};