OpenStructure
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;
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 
virtual String GetProperty() const
virtual float GetMaxV() const
virtual void SetProperty(const String &property)
GradientColorOp(const mol::QueryViewWrapper &query_view, const String &property, const gfx::Gradient &gradient)
GradientColorOp(const mol::QueryViewWrapper &query_view, int mask, const String &property, const gfx::Gradient &gradient, float minv, float maxv)
virtual void SetGradient(const gfx::Gradient &gradient)
virtual void SetMinV(float minv) const
virtual void ToInfo(info::InfoGroup &group) const
virtual gfx::Gradient GetGradient() const
virtual bool GetCalculateMinMax() const
GradientColorOp(const mol::QueryViewWrapper &query_view, const String &property, const gfx::Gradient &gradient, float minv, float maxv)
GradientColorOp(const mol::QueryViewWrapper &query_view, int mask, const String &property, const gfx::Gradient &gradient)
GradientColorOp(const String &selection, int mask, const String &property, const gfx::Gradient &gradient, float minv, float maxv)
GradientColorOp(const String &selection, const String &property, const gfx::Gradient &gradient)
virtual float GetMinV() const
GradientColorOp(const String &selection, int mask, const String &property, const gfx::Gradient &gradient)
static gfx::GradientColorOp FromInfo(info::InfoGroup &group)
GradientColorOp(const String &selection, const String &property, const gfx::Gradient &gradient, float minv, float maxv)
virtual void SetMaxV(float maxv) const
color gradient
Definition: gradient.hh:59
#define DLLEXPORT_OST_GFX
std::string String
Definition: base.hh:54
Definition: base.dox:1