ZColorScalePal.hpp
1 #ifndef OPALS_ZCOLOR_SCALE_PAL_HPP_INCLUDED
2 #define OPALS_ZCOLOR_SCALE_PAL_HPP_INCLUDED
3 
4 #pragma once
5 
6 #include <vector>
7 #include "opals/config.hpp"
8 
9 namespace opals {
10 
11  /// Class describing different scaling methods for palette entries
12  class OPALS_API ZColorScalePal
13  {
14  public:
16  virtual ~ZColorScalePal();
17 
18  /// scaling of palette nodes
19  struct TypeScalePal {
20  enum Type {
21  autoScale = 0, ///< automatic scaling of palette nodes
22  scaleByFactor, ///< single scaling factor
23  scaleByRange ///< scaling range
24  };
25  };
26 
27  bool isAutoScale() const { return type == TypeScalePal::autoScale; };
28  bool isScaleByFactor() const { return type == TypeScalePal::scaleByFactor; };
29  bool isScaleByRange() const { return type == TypeScalePal::scaleByRange; };
30 
31  void setAutoScale();
32  void setScaleFactor( const float& scalefac );
33  void setScaleRange( const std::vector<float>& range );
34 
35  float getScaleFactor() const { return isScaleByFactor() ? scale.front() : 0.f; };
36  float getScaleMin() const { return scale.front(); };
37  float getScaleMax() const { return scale.back(); };
38  const std::vector<float>& getScaleRange() const { return scale; }
39 
40  private:
41  TypeScalePal::Type type;
42  std::vector<float> scale;
43  };
44 }
45 
46 #endif //OPALS_ZCOLOR_SCALE_PAL_HPP_INCLUDED