All Classes Namespaces Functions Variables Typedefs Enumerations Pages
dynamiccoloredbody.h
1 /*
2  OpenMBV - Open Multi Body Viewer.
3  Copyright (C) 2009 Markus Friedrich
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 #ifndef _OPENMBV_DYNAMICCOLOREDBODY_H_
21 #define _OPENMBV_DYNAMICCOLOREDBODY_H_
22 
23 #include <openmbvcppinterface/body.h>
24 
25 namespace OpenMBV {
26 
28  class DynamicColoredBody : public Body {
29  friend class ObjectFactory;
30  protected:
31  double minimalColorValue{0};
32  double maximalColorValue{1};
33  double dynamicColor;
34  std::vector<double> diffuseColor;
35  double transparency{0};
36 
38  ~DynamicColoredBody() override;
39  public:
44  void setMinimalColorValue(double min) {
45  minimalColorValue=min;
46  }
47 
48  double getMinimalColorValue() { return minimalColorValue; }
49 
53  void setMaximalColorValue(double max) {
54  maximalColorValue=max;
55  }
56 
57  double getMaximalColorValue() { return maximalColorValue; }
58 
63  void setDynamicColor(const double col) {
64  dynamicColor=col;
65  }
66 
67  double getDynamicColor() { return dynamicColor; }
68 
73  void setDiffuseColor(const std::vector<double> &hsv) {
74  if(hsv.size()!=3) throw std::runtime_error("the dimension does not match");
75  diffuseColor=hsv;
76  }
77 
78  void setDiffuseColor(double h, double s, double v) {
79  std::vector<double> hsv;
80  hsv.push_back(h);
81  hsv.push_back(s);
82  hsv.push_back(v);
83  diffuseColor=hsv;
84  }
85 
86  std::vector<double> getDiffuseColor() { return diffuseColor; }
87 
89  void setTransparency(double t) {
90  transparency=t;
91  }
92 
93  double getTransparency() { return transparency; }
94 
96  void initializeUsingXML(xercesc::DOMElement *element) override;
97 
98  xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent) override;
99  };
100 
101 }
102 
103 #endif
void initializeUsingXML(xercesc::DOMElement *element) override
Definition: dynamiccoloredbody.cc:56
void setDynamicColor(const double col)
Definition: dynamiccoloredbody.h:63
Definition: objectfactory.h:36
void setDiffuseColor(const std::vector< double > &hsv)
Definition: dynamiccoloredbody.h:73
void setTransparency(double t)
Definition: dynamiccoloredbody.h:89
void setMinimalColorValue(double min)
Definition: dynamiccoloredbody.h:44
Definition: dynamiccoloredbody.h:28
void setMaximalColorValue(double max)
Definition: dynamiccoloredbody.h:53
Definition: body.h:31

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Home