OGS
ColorLookupTable.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <cassert>
7#include <tuple>
8#include <utility>
9#include <vector>
10
12
13namespace DataHolderLib
14{
15
17enum class LUTType {
18 NONE = 0,
19 LINEAR = 1,
21 SIGMOID = 3 // not yet implemented
22};
23
32{
33public:
35
36 void setColor(double id, DataHolderLib::Color const& color);
37
38 void setColor(std::string const& name, DataHolderLib::Color const& color);
39
41
42 void setInterpolationType(LUTType type) { _type = type; }
43
44 std::size_t size() const { return _lut.size(); }
45
46 std::pair<double, double> getTableRange() const { return _range; }
47
48 void setTableRange(double min, double max);
49
50 std::tuple<double, Color, std::string> const& operator[](std::size_t i) const
51 {
52 assert (i < _lut.size());
53 return _lut[i];
54 }
55
56private:
57 std::vector< std::tuple<double, Color, std::string> > _lut;
59 std::pair<double, double> _range;
60};
61
62} // namespace DataHolderLib
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:12