openmbvcppinterface 3.1.0 OpenMBV C++ Interface

dynamiccoloredbody.h
1 /*
2 OpenMBV - Open Multi Body Viewer.
3 Copyright (C) 2009 Markus Friedrich
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library 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 GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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
37 DynamicColoredBody();
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
OpenMBV::DynamicColoredBody::initializeUsingXML
void initializeUsingXML(xercesc::DOMElement *element) override
Definition: dynamiccoloredbody.cc:56
OpenMBV::DynamicColoredBody::setDynamicColor
void setDynamicColor(const double col)
Definition: dynamiccoloredbody.h:63
OpenMBV::ObjectFactory
Definition: objectfactory.h:38
OpenMBV::DynamicColoredBody::setDiffuseColor
void setDiffuseColor(const std::vector< double > &hsv)
Definition: dynamiccoloredbody.h:73
OpenMBV::DynamicColoredBody::setTransparency
void setTransparency(double t)
Definition: dynamiccoloredbody.h:89
OpenMBV::DynamicColoredBody::setMinimalColorValue
void setMinimalColorValue(double min)
Definition: dynamiccoloredbody.h:44
OpenMBV::DynamicColoredBody
Definition: dynamiccoloredbody.h:28
OpenMBV::DynamicColoredBody::setMaximalColorValue
void setMaximalColorValue(double max)
Definition: dynamiccoloredbody.h:53
OpenMBV::Body
Definition: body.h:32