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