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 <cassert>
27 #include <hdf5serie/vectorserie.h>
28 #include <stdexcept>
29 
30 namespace OpenMBV {
31 
45  friend class ObjectFactory;
46  public:
49  void setNumberOfSpinePoints(const int num) {
51  }
52 
56  return numberOfSpinePoints;
57  }
58 
61  void setContour(const std::shared_ptr<std::vector<std::shared_ptr<PolygonPoint> > > &contour_) { contour = contour_; }
62 
63  std::shared_ptr<std::vector<std::shared_ptr<PolygonPoint> > > getContour() { return contour; }
64 
66  void setScaleFactor(const double scale) {
67  scaleFactor=scale;
68  }
69 
70  double getScaleFactor() { return scaleFactor; }
71 
73  void setInitialRotation(const std::vector<double>& initRot) {
74  if(initRot.size()!=3) throw std::runtime_error("the dimension does not match");
75  initialRotation=initRot;
76  }
77 
79  void setInitialRotation(double a, double b, double g) {
80  std::vector<double> initRot;
81  initRot.push_back(a);
82  initRot.push_back(b);
83  initRot.push_back(g);
84  initialRotation=initRot;
85  }
86 
88  std::vector<double> getInitialRotation() { return initialRotation; }
89 
91  template<typename T>
92  void append(const T& row) {
93  if(data==nullptr) throw std::runtime_error("can not append data to an environment object");
94  data->append(row);
95  }
96 
97  int getRows() override { return data?data->getRows():-1; }
98  std::vector<double> getRow(int i) override { return data?data->getRow(i):std::vector<double>(1+4*numberOfSpinePoints); }
99 
101  void initializeUsingXML(xercesc::DOMElement *element) override;
102 
104  xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent) override;
105  protected:
106  SpineExtrusion();
107  ~SpineExtrusion() override;
108 
111 
113  std::shared_ptr<std::vector<std::shared_ptr<PolygonPoint> > > contour;
114 
117 
119  double scaleFactor{1};
120 
122  std::vector<double> initialRotation;
123 
125  void createHDF5File() override;
126  void openHDF5File() override;
127  };
128 
129 }
130 
131 #endif /* _OPENMBV_SPINEEXTRUSION_H_ */
132 
double scaleFactor
Definition: spineextrusion.h:119
void setScaleFactor(const double scale)
Definition: spineextrusion.h:66
std::vector< double > getRow(int i) override
Definition: spineextrusion.h:98
Class for all bodies extruded along a curve.
Definition: spineextrusion.h:44
void createHDF5File() override
Definition: spineextrusion.cc:48
H5::VectorSerie< double > * data
Definition: spineextrusion.h:116
int getNumberOfSpinePoints()
Definition: spineextrusion.h:55
void setNumberOfSpinePoints(const int num)
Definition: spineextrusion.h:49
Definition: objectfactory.h:36
void getRow(int row, size_t size, T data[])
std::vector< double > initialRotation
Definition: spineextrusion.h:122
void setInitialRotation(double a, double b, double g)
Definition: spineextrusion.h:79
void append(const T &row)
Definition: spineextrusion.h:92
xercesc::DOMElement * writeXMLFile(xercesc::DOMNode *parent) override
Definition: spineextrusion.cc:40
Definition: dynamiccoloredbody.h:28
void setInitialRotation(const std::vector< double > &initRot)
Definition: spineextrusion.h:73
int numberOfSpinePoints
Definition: spineextrusion.h:110
void append(const T data[], size_t size)
std::vector< double > getInitialRotation()
Definition: spineextrusion.h:88
std::shared_ptr< std::vector< std::shared_ptr< PolygonPoint > > > contour
Definition: spineextrusion.h:113
void initializeUsingXML(xercesc::DOMElement *element) override
Definition: spineextrusion.cc:78
int getRows() override
Definition: spineextrusion.h:97
void setContour(const std::shared_ptr< std::vector< std::shared_ptr< PolygonPoint > > > &contour_)
Definition: spineextrusion.h:61

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Home