All Classes Namespaces Functions Variables Typedefs Enumerations Pages
path.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_PATH_H_
21 #define _OPENMBV_PATH_H_
22 
23 #include <openmbvcppinterface/body.h>
24 #include <hdf5serie/vectorserie.h>
25 #include <vector>
26 #include <stdexcept>
27 
28 namespace OpenMBV {
29 
36  class Path : public Body {
37  friend class ObjectFactory;
38  protected:
39  void createHDF5File();
40  void openHDF5File();
42  std::vector<double> color;
43 
44  Path();
45  virtual ~Path();
46  public:
48  std::string getClassName() { return "Path"; }
49 
51  template<typename T>
52  void append(const T& row) {
53  if(data==0) throw std::runtime_error("can not append data to an environment object");
54  if(row.size()!=4) throw std::runtime_error("the dimension does not match");
55  data->append(row);
56  }
57 
58  int getRows() { return data?data->getRows():-1; }
59  std::vector<double> getRow(int i) { return data?data->getRow(i):std::vector<double>(4); }
60 
62  void setColor(const std::vector<double>& hsv) {
63  if(hsv.size()!=3) throw std::runtime_error("the dimension does not match");
64  color=hsv;
65  }
66 
67  std::vector<double> getColor() { return color; }
68 
70  void setColor(double h, double s, double v) {
71  std::vector<double> hsv;
72  hsv.push_back(h);
73  hsv.push_back(s);
74  hsv.push_back(v);
75  color=hsv;
76  }
77 
79  virtual void initializeUsingXML(xercesc::DOMElement *element);
80 
81  xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent);
82  };
83 
84 }
85 
86 #endif
int getRows()
Definition: path.h:58
Definition: objectfactory.h:40
void setColor(const std::vector< double > &hsv)
Definition: path.h:62
Definition: path.h:36
virtual void initializeUsingXML(xercesc::DOMElement *element)
Definition: path.cc:71
void getRow(const int row, size_t size, T data[])
void append(const T data[], size_t size)
std::string getClassName()
Definition: path.h:48
void setColor(double h, double s, double v)
Definition: path.h:70
void append(const T &row)
Definition: path.h:52
std::vector< double > getRow(int i)
Definition: path.h:59
Definition: body.h:31

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML