OGS
ColorLookupTable.cpp
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#include "ColorLookupTable.h"
5
6#include <limits>
7
8namespace DataHolderLib
9{
11 : _range(
12 std::make_pair<double, double>(std::numeric_limits<double>::lowest(),
13 std::numeric_limits<double>::max()))
14
15{
16}
17
18void ColorLookupTable::setTableRange(double min, double max)
19{
20 if (min < max)
21 {
22 _range = std::make_pair(min, max);
23 }
24}
25
27{
28 if ((id > _range.first) && (id < _range.second))
29 {
30 _lut.emplace_back(id, color, "");
31 }
32}
33
34void ColorLookupTable::setColor(std::string const& name,
35 DataHolderLib::Color const& color)
36{
37 _lut.emplace_back(0, color, name);
38}
39
40} // namespace DataHolderLib
void setColor(double id, DataHolderLib::Color const &color)
void setTableRange(double min, double max)
std::vector< std::tuple< double, Color, std::string > > _lut
std::pair< double, double > _range
std::array< unsigned char, 4 > Color
Definition Color.h:12