Blue Brain BioExplorer
TransferFunction.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2024, EPFL/Blue Brain Project
3  *
4  * The Blue Brain BioExplorer is a tool for scientists to extract and analyse
5  * scientific data from visualization
6  *
7  * This file is part of Blue Brain BioExplorer <https://github.com/BlueBrain/BioExplorer>
8  *
9  * This library is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU Lesser General Public License version 3.0 as published
11  * by the Free Software Foundation.
12  *
13  * This library is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 #pragma once
24 
26 
27 SERIALIZATION_ACCESS(TransferFunction)
28 
29 namespace core
30 {
31 struct ColorMap
32 {
33  std::string name;
35 
36  bool operator==(const ColorMap& rhs) const;
37 
38  void clear();
39 };
40 
42 {
43 public:
45 
47  void clear();
48 
49  const Vector2ds& getControlPoints() const { return _controlPoints; }
50  void setControlPoints(const Vector2ds& controlPoints) { _updateValue(_controlPoints, controlPoints); }
51 
52  const ColorMap& getColorMap() const { return _colorMap; }
53  void setColorMap(const ColorMap& colorMap) { _updateValue(_colorMap, colorMap); }
54 
55  const auto& getColors() const { return _colorMap.colors; }
56  const Vector2d& getValuesRange() const { return _valuesRange; }
57  void setValuesRange(const Vector2d& valuesRange) { _updateValue(_valuesRange, valuesRange); }
58 
60 
61 private:
62  ColorMap _colorMap;
63  Vector2ds _controlPoints;
64  Vector2d _valuesRange;
65 
67 };
68 } // namespace core
#define SERIALIZATION_FRIEND(type)
Definition: Macros.h:32
#define SERIALIZATION_ACCESS(type)
Definition: Macros.h:25
void _updateValue(T &member, const T &newValue, const bool triggerCallback=true)
Definition: BaseObject.h:87
const ColorMap & getColorMap() const
void setColorMap(const ColorMap &colorMap)
const Vector2d & getValuesRange() const
floats calculateInterpolatedOpacities() const
const auto & getColors() const
const Vector2ds & getControlPoints() const
void setValuesRange(const Vector2d &valuesRange)
void setControlPoints(const Vector2ds &controlPoints)
std::vector< Vector2d > Vector2ds
Definition: MathTypes.h:145
glm::vec< 2, double > Vector2d
Definition: MathTypes.h:142
std::vector< Vector3f > Vector3fs
Definition: MathTypes.h:139
std::vector< float > floats
Definition: Types.h:45
bool operator==(const ColorMap &rhs) const
std::string name