openmbvcppinterface  3.1.0
OpenMBV C++ Interface
body.h
1 /*
2  OpenMBV - Open Multi Body Viewer.
3  Copyright (C) 2009 Markus Friedrich
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library 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 GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef _OPENMBV_BODY_H_
21 #define _OPENMBV_BODY_H_
22 
23 #include <string>
24 #include <sstream>
25 #include <vector>
26 #include <openmbvcppinterface/object.h>
27 
28 namespace OpenMBV {
29 
31  class Body : public Object {
32  public:
33  enum DrawStyle { filled, lines, points };
34  private:
35  std::string getRelPathTo(const std::shared_ptr<Body> &destBody);
36  protected:
37  std::string outLineStr, shilouetteEdgeStr;
38  DrawStyle drawMethod{filled};
39  double pointSize{0};
40  double lineWidth{0};
41  void createHDF5File() override;
42  void openHDF5File() override;
43  Body();
44  ~Body() override = default;
45  public:
47  void setOutLine(bool ol) { outLineStr=(ol)?"true":"false"; }
48 
49  bool getOutLine() { return outLineStr=="true"?true:false; }
50 
52  void setShilouetteEdge(bool ol) { shilouetteEdgeStr=(ol)?"true":"false"; }
53 
54  bool getShilouetteEdge() { return shilouetteEdgeStr=="true"?true:false; }
55 
57  void setDrawMethod(DrawStyle ds) { drawMethod=ds; }
58 
59  DrawStyle getDrawMethod() { return drawMethod; }
60 
62  void setPointSize(double ps) { pointSize=ps; }
63 
64  double getPointSize() { return pointSize; }
65 
67  void setLineWidth(double lw) { lineWidth=lw; }
68 
69  double getLineWidth() { return lineWidth; }
70 
72  void initializeUsingXML(xercesc::DOMElement *element) override;
73 
74  xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent) override;
75 
80  virtual int getRows()=0;
81 
85  virtual std::vector<double> getRow(int i)=0;
86  };
87 
88 }
89 
90 #endif /* _OPENMBV_BODY_H_ */
91 
virtual std::vector< double > getRow(int i)=0
void setLineWidth(double lw)
Definition: body.h:67
void setShilouetteEdge(bool ol)
Definition: body.h:52
void setPointSize(double ps)
Definition: body.h:62
Definition: object.h:43
virtual int getRows()=0
void setDrawMethod(DrawStyle ds)
Definition: body.h:57
void setOutLine(bool ol)
Definition: body.h:47
void initializeUsingXML(xercesc::DOMElement *element) override
Definition: body.cc:84
Definition: body.h:31