OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
gradient_color_op.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_COLOR_OPS_GRADIENT_COLOR_OP_HH
20 #define OST_COLOR_OPS_GRADIENT_COLOR_OP_HH
21 
22 #include <ost/info/info.hh>
23 #include <ost/info/info_fw.hh>
24 
25 #include <ost/gfx/gradient.hh>
26 
28 
29 /*
30  Author: Stefan Scheuber
31 */
32 
33 namespace ost { namespace gfx {
34 
36 public:
38  GradientColorOp(const String& selection, const String& property, const gfx::Gradient& gradient,
39  float minv, float maxv);
40  GradientColorOp(const String& selection, int mask, const String& property, const gfx::Gradient& gradient,
41  float minv, float maxv);
42  GradientColorOp(const String& selection, const String& property, const gfx::Gradient& gradient);
43  GradientColorOp(const String& selection, int mask, const String& property, const gfx::Gradient& gradient);
44  GradientColorOp(const mol::QueryViewWrapper& query_view, const String& property, const gfx::Gradient& gradient,
45  float minv, float maxv);
46  GradientColorOp(const mol::QueryViewWrapper& query_view, int mask, const String& property, const gfx::Gradient& gradient,
47  float minv, float maxv);
48  GradientColorOp(const mol::QueryViewWrapper& query_view, const String& property, const gfx::Gradient& gradient);
49  GradientColorOp(const mol::QueryViewWrapper& query_view, int mask, const String& property, const gfx::Gradient& gradient);
50 
51  virtual void SetProperty(const String& property);
52  virtual String GetProperty() const;
53 
54  virtual void SetGradient(const gfx::Gradient& gradient);
55  virtual gfx::Gradient GetGradient() const;
56 
57  virtual bool GetCalculateMinMax() const;
58  virtual void SetMaxV(float maxv) const;
59  virtual float GetMaxV() const;
60 
61  virtual void SetMinV(float minv) const;
62  virtual float GetMinV() const;
63 
64  virtual void ToInfo(info::InfoGroup& group) const;
65  static gfx::GradientColorOp FromInfo(info::InfoGroup& group);
66 
67  // if true then color with clamped colors outside given range as well
68  void SetClamp(bool f) {clamp_=f;}
69  bool GetClamp() const {return clamp_;}
70 
71 private:
72  void Init();
73  String property_;
74  gfx::Gradient gradient_;
75  bool clamp_;
76  bool calculate_;
77  mutable float minv_;
78  mutable float maxv_;
79 };
80 
81 }}
82 
83 #endif
84 
std::string String
Definition: base.hh:54
#define DLLEXPORT_OST_GFX
color gradient
Definition: gradient.hh:59