00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _BODY_H_
00021 #define _BODY_H_
00022
00023 #include <mbsim/object.h>
00024 #ifdef HAVE_OPENMBVCPPINTERFACE
00025 namespace OpenMBV {
00026 class Body;
00027 }
00028 #endif
00029
00030 namespace MBSim {
00031
00032 class Frame;
00033 class Contour;
00034
00052 class Body : public Object {
00053 public:
00058 Body(const std::string &name);
00059
00063 virtual ~Body();
00064
00065
00066 void sethSize(int hSize_, int i=0);
00067 void sethInd(int hInd_, int i=0);
00068
00069
00070
00071 virtual void plot(double t, double dt = 1);
00072 virtual void closePlot();
00073 virtual std::string getType() const { return "Body"; }
00074 virtual void setDynamicSystemSolver(DynamicSystemSolver *sys);
00075
00076
00077
00078 virtual void init(InitStage stage);
00079
00080
00081
00082
00088 virtual Contour* getContour(const std::string &name, bool check=true);
00089
00095 virtual Frame* getFrame(const std::string &name, bool check=true);
00096
00100 virtual Frame *getFrameOfReference() { return R; }
00101
00105 virtual const Frame *getFrameOfReference() const { return R; }
00106
00110 virtual void setFrameOfReference(Frame *frame) { R = frame; }
00111
00112
00113
00114 const std::vector<Frame*>& getFrames() const { return frame; }
00115 const std::vector<Contour*>& getContours() const { return contour; }
00116 #ifdef HAVE_OPENMBVCPPINTERFACE
00117 OpenMBV::Group* getOpenMBVGrp() { return openMBVGrp; }
00118 OpenMBV::Body* getOpenMBVBody() { return openMBVBody; }
00119 #endif
00120
00121
00126 int frameIndex(const Frame *frame_) const;
00127
00132 int contourIndex(const Contour *contour_) const;
00133
00134 virtual void initializeUsingXML(MBXMLUtils::TiXmlElement *element);
00135 virtual MBXMLUtils::TiXmlElement* writeXMLFile(MBXMLUtils::TiXmlNode *element);
00136
00137 virtual Element * getByPathSearch(std::string path);
00138
00139 protected:
00143 virtual void addFrame(Frame * frame);
00144
00148 virtual void addContour(Contour* contour);
00149
00153 std::vector<Frame*> frame;
00154 std::vector<Contour*> contour;
00155
00159 Frame *R;
00160
00161 #ifdef HAVE_OPENMBVCPPINTERFACE
00162 OpenMBV::Body* openMBVBody;
00163 OpenMBV::Group* openMBVGrp;
00164 #endif
00165
00166 private:
00167 std::string saved_frameOfReference;
00168 };
00169
00170 }
00171
00172 #endif
00173