All Classes Namespaces Functions Variables Typedefs Enumerations Pages
spineextrusion.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_SPINEEXTRUSION_H_
21 #define _OPENMBV_SPINEEXTRUSION_H_
22 
23 #include <openmbvcppinterface/dynamiccoloredbody.h>
24 #include <openmbvcppinterface/polygonpoint.h>
25 #include <vector>
26 #include <assert.h>
27 #include <hdf5serie/vectorserie.h>
28 #include <stdexcept>
29 
30 namespace OpenMBV {
31 
45  friend class ObjectFactory;
46  public:
48  std::string getClassName() { return "SpineExtrusion"; }
49 
52  void setNumberOfSpinePoints(const int num) {
54  }
55 
59  return numberOfSpinePoints;
60  }
61 
64  void setContour(const boost::shared_ptr<std::vector<boost::shared_ptr<PolygonPoint> > > &contour_) { contour = contour_; }
65 
66  boost::shared_ptr<std::vector<boost::shared_ptr<PolygonPoint> > > getContour() { return contour; }
67 
69  void setScaleFactor(const double scale) {
70  scaleFactor=scale;
71  }
72 
73  double getScaleFactor() { return scaleFactor; }
74 
76  void setInitialRotation(const std::vector<double>& initRot) {
77  if(initRot.size()!=3) throw std::runtime_error("the dimension does not match");
78  initialRotation=initRot;
79  }
80 
82  void setInitialRotation(double a, double b, double g) {
83  std::vector<double> initRot;
84  initRot.push_back(a);
85  initRot.push_back(b);
86  initRot.push_back(g);
87  initialRotation=initRot;
88  }
89 
91  std::vector<double> getInitialRotation() { return initialRotation; }
92 
94  template<typename T>
95  void append(const T& row) {
96  if(data==0) throw std::runtime_error("can not append data to an environment object");
97  data->append(row);
98  }
99 
100  int getRows() { return data?data->getRows():-1; }
101  std::vector<double> getRow(int i) { return data?data->getRow(i):std::vector<double>(1+4*numberOfSpinePoints); }
102 
104  virtual void initializeUsingXML(xercesc::DOMElement *element);
105 
107  xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent);
108  protected:
109  SpineExtrusion();
110  virtual ~SpineExtrusion();
111 
114 
116  boost::shared_ptr<std::vector<boost::shared_ptr<PolygonPoint> > > contour;
117 
120 
122  double scaleFactor;
123 
125  std::vector<double> initialRotation;
126 
128  void createHDF5File();
129  void openHDF5File();
130  };
131 
132 }
133 
134 #endif /* _OPENMBV_SPINEEXTRUSION_H_ */
135 
double scaleFactor
Definition: spineextrusion.h:122
void setScaleFactor(const double scale)
Definition: spineextrusion.h:69
void setContour(const boost::shared_ptr< std::vector< boost::shared_ptr< PolygonPoint > > > &contour_)
Definition: spineextrusion.h:64
Class for all bodies extruded along a curve.
Definition: spineextrusion.h:44
int getRows()
Definition: spineextrusion.h:100
H5::VectorSerie< double > * data
Definition: spineextrusion.h:119
int getNumberOfSpinePoints()
Definition: spineextrusion.h:58
std::vector< double > getRow(int i)
Definition: spineextrusion.h:101
void setNumberOfSpinePoints(const int num)
Definition: spineextrusion.h:52
Definition: objectfactory.h:40
std::vector< double > initialRotation
Definition: spineextrusion.h:125
void setInitialRotation(double a, double b, double g)
Definition: spineextrusion.h:82
boost::shared_ptr< std::vector< boost::shared_ptr< PolygonPoint > > > contour
Definition: spineextrusion.h:116
void append(const T &row)
Definition: spineextrusion.h:95
void createHDF5File()
Definition: spineextrusion.cc:51
Definition: dynamiccoloredbody.h:28
void setInitialRotation(const std::vector< double > &initRot)
Definition: spineextrusion.h:76
virtual void initializeUsingXML(xercesc::DOMElement *element)
Definition: spineextrusion.cc:81
int numberOfSpinePoints
Definition: spineextrusion.h:113
void getRow(const int row, size_t size, T data[])
void append(const T data[], size_t size)
std::vector< double > getInitialRotation()
Definition: spineextrusion.h:91
xercesc::DOMElement * writeXMLFile(xercesc::DOMNode *parent)
Definition: spineextrusion.cc:43
std::string getClassName()
Definition: spineextrusion.h:48

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML