00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _OPENMBV_PATH_H_
00021 #define _OPENMBV_PATH_H_
00022
00023 #include <openmbvcppinterface/body.h>
00024 #include <hdf5serie/vectorserie.h>
00025 #include <vector>
00026 #include <stdexcept>
00027
00028 namespace OpenMBV {
00029
00036 class Path : public Body {
00037 protected:
00038 void createHDF5File();
00039 void openHDF5File();
00040 H5::VectorSerie<double>* data;
00041 std::vector<double> color;
00042
00044 virtual ~Path();
00045 public:
00047 Path();
00048
00050 std::string getClassName() { return "Path"; }
00051
00053 void append(const std::vector<double>& row) {
00054 if(data==0) throw std::runtime_error("can not append data to an environment object");
00055 if(row.size()!=4) throw std::runtime_error("the dimension does not match");
00056 data->append(row);
00057 }
00058
00059 int getRows() { return data?data->getRows():-1; }
00060 std::vector<double> getRow(int i) { return data?data->getRow(i):std::vector<double>(4); }
00061
00063 void setColor(const std::vector<double>& hsv) {
00064 if(hsv.size()!=3) throw std::runtime_error("the dimension does not match");
00065 color=hsv;
00066 }
00067
00068 std::vector<double> getColor() { return color; }
00069
00071 void setColor(double h, double s, double v) {
00072 std::vector<double> hsv;
00073 hsv.push_back(h);
00074 hsv.push_back(s);
00075 hsv.push_back(v);
00076 color=hsv;
00077 }
00078
00080 virtual void initializeUsingXML(xercesc::DOMElement *element);
00081
00082 xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent);
00083 };
00084
00085 }
00086
00087 #endif