OGS
DataHolderLib::ColorLookupTable Class Reference

Detailed Description

A colour look-up table stored as a vector containing for each entry id - value for which the colour is stored colour - RGBA value name - a name referencing the colour (such as a stratigraphic layer) Colours from the table can then be accessed using either id or name.

Definition at line 38 of file ColorLookupTable.h.

#include <ColorLookupTable.h>

Public Member Functions

 ColorLookupTable ()
 
void setColor (double id, DataHolderLib::Color const &color)
 
void setColor (std::string const &name, DataHolderLib::Color const &color)
 
DataHolderLib::LUTType getInterpolationType () const
 
void setInterpolationType (LUTType type)
 
std::size_t size () const
 
std::pair< double, double > getTableRange () const
 
void setTableRange (double min, double max)
 
std::tuple< double, Color, std::string > const & operator[] (std::size_t i) const
 

Private Attributes

std::vector< std::tuple< double, Color, std::string > > _lut
 
LUTType _type {DataHolderLib::LUTType::LINEAR}
 
std::pair< double, double > _range
 

Constructor & Destructor Documentation

◆ ColorLookupTable()

DataHolderLib::ColorLookupTable::ColorLookupTable ( )

Definition at line 17 of file ColorLookupTable.cpp.

18 : _range(
19 std::make_pair<double, double>(std::numeric_limits<double>::lowest(),
20 std::numeric_limits<double>::max()))
21
22{
23}
std::pair< double, double > _range

Member Function Documentation

◆ getInterpolationType()

DataHolderLib::LUTType DataHolderLib::ColorLookupTable::getInterpolationType ( ) const
inline

Definition at line 47 of file ColorLookupTable.h.

References _type.

Referenced by VtkColorLookupTable::setLookupTable().

◆ getTableRange()

std::pair< double, double > DataHolderLib::ColorLookupTable::getTableRange ( ) const
inline

Definition at line 53 of file ColorLookupTable.h.

53{ return _range; }

References _range.

Referenced by VtkColorLookupTable::setLookupTable().

◆ operator[]()

std::tuple< double, Color, std::string > const & DataHolderLib::ColorLookupTable::operator[] ( std::size_t i) const
inline

Definition at line 57 of file ColorLookupTable.h.

58 {
59 assert (i < _lut.size());
60 return _lut[i];
61 }
std::vector< std::tuple< double, Color, std::string > > _lut

References _lut.

◆ setColor() [1/2]

void DataHolderLib::ColorLookupTable::setColor ( double id,
DataHolderLib::Color const & color )

Definition at line 33 of file ColorLookupTable.cpp.

34{
35 if ((id > _range.first) && (id < _range.second))
36 {
37 _lut.emplace_back(id, color, "");
38 }
39}

References _lut, and _range.

Referenced by FileIO::XmlLutReader::readFromFile().

◆ setColor() [2/2]

void DataHolderLib::ColorLookupTable::setColor ( std::string const & name,
DataHolderLib::Color const & color )

Definition at line 41 of file ColorLookupTable.cpp.

43{
44 _lut.emplace_back(0, color, name);
45}

References _lut.

◆ setInterpolationType()

void DataHolderLib::ColorLookupTable::setInterpolationType ( LUTType type)
inline

Definition at line 49 of file ColorLookupTable.h.

49{ _type = type; }

References _type.

Referenced by FileIO::XmlLutReader::readFromFile().

◆ setTableRange()

void DataHolderLib::ColorLookupTable::setTableRange ( double min,
double max )

Definition at line 25 of file ColorLookupTable.cpp.

26{
27 if (min < max)
28 {
29 _range = std::make_pair(min, max);
30 }
31}

References _range.

Referenced by FileIO::XmlLutReader::readFromFile().

◆ size()

std::size_t DataHolderLib::ColorLookupTable::size ( ) const
inline

Definition at line 51 of file ColorLookupTable.h.

51{ return _lut.size(); }

References _lut.

Referenced by VtkColorLookupTable::setLookupTable().

Member Data Documentation

◆ _lut

std::vector< std::tuple<double, Color, std::string> > DataHolderLib::ColorLookupTable::_lut
private

Definition at line 64 of file ColorLookupTable.h.

Referenced by operator[](), setColor(), setColor(), and size().

◆ _range

std::pair<double, double> DataHolderLib::ColorLookupTable::_range
private

Definition at line 66 of file ColorLookupTable.h.

Referenced by getTableRange(), setColor(), and setTableRange().

◆ _type

LUTType DataHolderLib::ColorLookupTable::_type {DataHolderLib::LUTType::LINEAR}
private

The documentation for this class was generated from the following files: