00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _OPENMBV_DYNAMICCOLOREDBODY_H_
00021 #define _OPENMBV_DYNAMICCOLOREDBODY_H_
00022
00023 #include <openmbvcppinterface/body.h>
00024 #include <mbxmlutilstinyxml/utils.h>
00025
00026 namespace OpenMBV {
00027
00029 class DynamicColoredBody : public Body {
00030 protected:
00031 ScalarParameter minimalColorValue, maximalColorValue;
00032 ScalarParameter staticColor;
00033 double dynamicColor;
00034 VectorParameter diffuseColor;
00035 ScalarParameter transparency;
00036
00037 ~DynamicColoredBody();
00038 public:
00039 DynamicColoredBody();
00040
00045 void setMinimalColorValue(const ScalarParameter min) {
00046 set(minimalColorValue,min);
00047 }
00048
00049 double getMinimalColorValue() { return get(minimalColorValue); }
00050
00054 void setMaximalColorValue(const ScalarParameter max) {
00055 set(maximalColorValue,max);
00056 }
00057
00058 double getMaximalColorValue() { return get(maximalColorValue); }
00059
00065 void setStaticColor(const ScalarParameter col) {
00066 MBXMLUtils::Deprecated::registerMessage("setStaticColor is deprecated, use setDiffuseColor instead.");
00067 set(staticColor,col);
00068 }
00069
00071 double getStaticColor(bool internalDoNotUse=true) {
00072 if(internalDoNotUse)
00073 MBXMLUtils::Deprecated::registerMessage("getStaticColor is deprecated, use getDiffuseColor instead.");
00074 return get(staticColor);
00075 }
00076
00081 void setDynamicColor(const double col) {
00082 dynamicColor=col;
00083 }
00084
00085 double getDynamicColor() { return dynamicColor; }
00086
00091 void setDiffuseColor(const VectorParameter &hsv) {
00092 if(hsv.getParamStr()=="" && hsv.getValue().size()!=3) throw std::runtime_error("the dimension does not match");
00093 set(diffuseColor,hsv);
00094 }
00095
00096 void setDiffuseColor(const std::vector<double> &hsv) {
00097 if(hsv.size()!=3) throw std::runtime_error("the diemension does not match");
00098 set(diffuseColor,hsv);
00099 }
00100
00101 void setDiffuseColor(double h, double s, double v) {
00102 std::vector<double> hsv;
00103 hsv.push_back(h);
00104 hsv.push_back(s);
00105 hsv.push_back(v);
00106 diffuseColor=hsv;
00107 }
00108
00109 std::vector<double> getDiffuseColor() { return get(diffuseColor); }
00110
00112 void setTransparency(ScalarParameter t) {
00113 set(transparency,t);
00114 }
00115
00116 double getTransparency() { return get(transparency); }
00117
00119 virtual void initializeUsingXML(MBXMLUtils::TiXmlElement *element);
00120
00121 MBXMLUtils::TiXmlElement* writeXMLFile(MBXMLUtils::TiXmlNode *parent);
00122 };
00123
00124 }
00125
00126 #endif