MEPP2 Project
GradientColorMap.h
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as
6 // published by the Free Software Foundation; either version 3 of
7 // the License, or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 #pragma once
12 
13 #include <iostream>
14 #include "Base/Color.hpp"
15 
16 namespace FEVV {
17 
58 template< typename PValue >
60 {
61 
62 public:
63  using Value = PValue;
64 
68  GradientColorMap() = delete;
69 
79  GradientColorMap(const Value &_min,
80  const Value &_max,
81  const Color &_firstColor,
82  const Color &_lastColor);
83 
89  GradientColorMap(const GradientColorMap &_other);
90 
94  ~GradientColorMap() = default;
95 
96 
104  Color operator()(const Value &_value) const;
105 
113 
119  void addColor(const Color &_color);
120 
125  void clear();
126 
132  const Value &minValue() const;
133 
139  const Value &maxValue() const;
140 
153  static Color getColor(const std::vector< Color > &_colors,
154  const Value &_min,
155  const Value &_max,
156  const Value &_value);
157 
158 protected:
161  std::vector< Color > myColors;
162 };
163 } // namespace FEVV
164 
165 
166 #include "Base/GradientColorMap.inl"
FEVV::GradientColorMap::maxValue
const Value & maxValue() const
Definition: GradientColorMap.inl:86
FEVV::GradientColorMap::operator=
GradientColorMap & operator=(const GradientColorMap &_other)
Definition: GradientColorMap.inl:43
FEVV::GradientColorMap::addColor
void addColor(const Color &_color)
Definition: GradientColorMap.inl:65
FEVV::GradientColorMap::myColors
std::vector< Color > myColors
Definition: GradientColorMap.h:161
FEVV::GradientColorMap::Value
PValue Value
Definition: GradientColorMap.h:63
GradientColorMap.inl
FEVV::GradientColorMap::getColor
static Color getColor(const std::vector< Color > &_colors, const Value &_min, const Value &_max, const Value &_value)
Definition: GradientColorMap.inl:93
FEVV::GradientColorMap::~GradientColorMap
~GradientColorMap()=default
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
FEVV::GradientColorMap::clear
void clear()
Definition: GradientColorMap.inl:72
FEVV::Color
Definition: Color.hpp:18
FEVV::GradientColorMap
This templated class may be used to (linearly) convert scalar values in a given range into a color in...
Definition: GradientColorMap.h:60
FEVV::GradientColorMap::myMax
Value myMax
Definition: GradientColorMap.h:160
Color.hpp
FEVV::GradientColorMap::minValue
const Value & minValue() const
Definition: GradientColorMap.inl:79
FEVV::GradientColorMap::operator()
Color operator()(const Value &_value) const
Definition: GradientColorMap.inl:58
FEVV::GradientColorMap::GradientColorMap
GradientColorMap()=delete
FEVV::GradientColorMap::myMin
Value myMin
Definition: GradientColorMap.h:159