OGS
ColorLookupTable.h
Go to the documentation of this file.
1
10#pragma once
11
12#include <cassert>
13#include <tuple>
14#include <utility>
15#include <vector>
16
18
19namespace DataHolderLib
20{
21
23enum class LUTType {
24 NONE = 0,
25 LINEAR = 1,
26 EXPONENTIAL = 2,
27 SIGMOID = 3 // not yet implemented
28};
29
38{
39public:
41
42 void setColor(double id, DataHolderLib::Color const& color);
43
44 void setColor(std::string const& name, DataHolderLib::Color const& color);
45
47
48 void setInterpolationType(LUTType type) { _type = type; }
49
50 std::size_t size() const { return _lut.size(); }
51
52 std::pair<double, double> getTableRange() const { return _range; }
53
54 void setTableRange(double min, double max);
55
56 std::tuple<double, Color, std::string> const& operator[](std::size_t i) const
57 {
58 assert (i < _lut.size());
59 return _lut[i];
60 }
61
62private:
63 std::vector< std::tuple<double, Color, std::string> > _lut;
65 std::pair<double, double> _range;
66};
67
68} // namespace DataHolderLib
Definition of the Color class.
void setColor(double id, DataHolderLib::Color const &color)
DataHolderLib::LUTType getInterpolationType() const
std::pair< double, double > getTableRange() const
void setInterpolationType(LUTType type)
void setTableRange(double min, double max)
std::tuple< double, Color, std::string > const & operator[](std::size_t i) const
std::vector< std::tuple< double, Color, std::string > > _lut
std::pair< double, double > _range
std::array< unsigned char, 4 > Color
Definition: Color.h:24
LUTType
Interpolation methods.