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 31 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 10 of file ColorLookupTable.cpp.

11 : _range(
12 std::make_pair<double, double>(std::numeric_limits<double>::lowest(),
13 std::numeric_limits<double>::max()))
14
15{
16}
std::pair< double, double > _range

References _range.

Member Function Documentation

◆ getInterpolationType()

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

Definition at line 40 of file ColorLookupTable.h.

References _type.

Referenced by VtkColorLookupTable::setLookupTable().

◆ getTableRange()

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

Definition at line 46 of file ColorLookupTable.h.

46{ 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 50 of file ColorLookupTable.h.

51 {
52 assert (i < _lut.size());
53 return _lut[i];
54 }
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 26 of file ColorLookupTable.cpp.

27{
28 if ((id > _range.first) && (id < _range.second))
29 {
30 _lut.emplace_back(id, color, "");
31 }
32}

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 34 of file ColorLookupTable.cpp.

36{
37 _lut.emplace_back(0, color, name);
38}

References _lut.

◆ setInterpolationType()

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

Definition at line 42 of file ColorLookupTable.h.

42{ _type = type; }

References _type.

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

◆ setTableRange()

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

Definition at line 18 of file ColorLookupTable.cpp.

19{
20 if (min < max)
21 {
22 _range = std::make_pair(min, max);
23 }
24}

References _range.

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

◆ size()

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

Definition at line 44 of file ColorLookupTable.h.

44{ 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 57 of file ColorLookupTable.h.

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

◆ _range

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

Definition at line 59 of file ColorLookupTable.h.

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

◆ _type

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

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