Add getters for RimColorLegend++.

This commit is contained in:
Kristian Bendiksen
2020-05-06 22:30:51 +02:00
committed by Magne Sjaastad
parent 0bf3ed91f0
commit db384ea754
6 changed files with 48 additions and 2 deletions

View File

@@ -65,6 +65,14 @@ void RimColorLegend::appendColorLegendItem( RimColorLegendItem* colorLegendItem
m_colorLegendItems.push_back( colorLegendItem ); m_colorLegendItems.push_back( colorLegendItem );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimColorLegendItem*> RimColorLegend::colorLegendItems() const
{
return m_colorLegendItems.childObjects();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -45,6 +45,8 @@ public:
void setColorLegendName( const QString& colorLegendName ); void setColorLegendName( const QString& colorLegendName );
void appendColorLegendItem( RimColorLegendItem* colorLegendItem ); void appendColorLegendItem( RimColorLegendItem* colorLegendItem );
std::vector<RimColorLegendItem*> colorLegendItems() const;
public: public:
caf::PdmFieldHandle* userDescriptionField() override; caf::PdmFieldHandle* userDescriptionField() override;

View File

@@ -47,6 +47,14 @@ void RimColorLegendCollection::appendColorLegend( RimColorLegend* colorLegend )
m_colorLegends.push_back( colorLegend ); m_colorLegends.push_back( colorLegend );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimColorLegend*> RimColorLegendCollection::colorLegends() const
{
return m_colorLegends.childObjects();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -41,9 +41,10 @@ public:
RimColorLegendCollection(); RimColorLegendCollection();
~RimColorLegendCollection() override; ~RimColorLegendCollection() override;
public:
void appendColorLegend( RimColorLegend* colorLegend ); void appendColorLegend( RimColorLegend* colorLegend );
std::vector<RimColorLegend*> colorLegends() const;
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;
private: private:

View File

@@ -60,6 +60,30 @@ void RimColorLegendItem::setValues( const QString& categoryName, int categoryVal
m_color = color; m_color = color;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const cvf::Color3f& RimColorLegendItem::color() const
{
return m_color();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString& RimColorLegendItem::categoryName() const
{
return m_categoryName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimColorLegendItem::categoryValue() const
{
return m_categoryValue();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -42,6 +42,9 @@ public:
~RimColorLegendItem() override; ~RimColorLegendItem() override;
void setValues( const QString& categoryName, int categoryValue, const cvf::Color3f& color ); void setValues( const QString& categoryName, int categoryValue, const cvf::Color3f& color );
const cvf::Color3f& color() const;
const QString& categoryName() const;
int categoryValue() const;
public: public:
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;