All Classes Namespaces Functions Variables Typedefs Enumerations Pages
dynamicnurbssurface.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_DYNAMICNURBSSURFACE_H
21 #define _OPENMBV_DYNAMICNURBSSURFACE_H
22 
23 #include <openmbvcppinterface/dynamiccoloredbody.h>
24 #include <vector>
25 #include <hdf5serie/vectorserie.h>
26 
27 namespace OpenMBV {
28 
31  friend class ObjectFactory;
32  protected:
33  std::vector<std::vector<double> > cp;
34  int numU{0}, numV{0};
35  std::vector<double> uKnot, vKnot;
37  DynamicNurbsSurface() = default;
38  ~DynamicNurbsSurface() override = default;
39  xercesc::DOMElement *writeXMLFile(xercesc::DOMNode *parent) override;
41  void createHDF5File() override;
42  void openHDF5File() override;
43  public:
46  const std::vector<std::vector<double> >& getControlPoints() { return cp; }
47  int getNumberOfUControlPoints() { return numU; }
48  int getNumberOfVControlPoints() { return numV; }
49  const std::vector<double>& getUKnotVector() { return uKnot; }
50  const std::vector<double>& getVKnotVector() { return vKnot; }
51 
54  void setControlPoints(const std::vector<std::vector<double> > &cp_) { cp = cp_; }
55  void setNumberOfUControlPoints(int numU_) { numU = numU_; }
56  void setNumberOfVControlPoints(int numV_) { numV = numV_; }
57  void setUKnotVector(const std::vector<double>& uKnot_) { uKnot = uKnot_; }
58  void setVKnotVector(const std::vector<double>& vKnot_) { vKnot = vKnot_; }
59 
61  template<typename T>
62  void append(const T& row) {
63  if(data==nullptr) throw std::runtime_error("can not append data to an environment object");
64  data->append(row);
65  }
66 
67  int getRows() override { return data?data->getRows():-1; }
68  std::vector<double> getRow(int i) override { return data?data->getRow(i):std::vector<double>(1+4*numU*numV); }
69 
71  void initializeUsingXML(xercesc::DOMElement *element) override;
72  };
73 
74 }
75 
76 #endif
int getRows() override
Definition: dynamicnurbssurface.h:67
void initializeUsingXML(xercesc::DOMElement *element) override
Definition: dynamicnurbssurface.cc:73
Definition: objectfactory.h:36
std::vector< double > getRow(int i) override
Definition: dynamicnurbssurface.h:68
void getRow(int row, size_t size, T data[])
void append(const T &row)
Definition: dynamicnurbssurface.h:62
const std::vector< std::vector< double > > & getControlPoints()
Definition: dynamicnurbssurface.h:46
Definition: dynamiccoloredbody.h:28
void setControlPoints(const std::vector< std::vector< double > > &cp_)
Definition: dynamicnurbssurface.h:54
void append(const T data[], size_t size)
void createHDF5File() override
Definition: dynamicnurbssurface.cc:42
Definition: dynamicnurbssurface.h:30

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Home