Hosted by: BerliOS Developer Logo

OpenMBV C++ Interface

BerliOS Project Page
/home/user/MBSimWindows/openmbv/openmbvcppinterface/openmbvcppinterface/body.h
00001 /*
00002    OpenMBV - Open Multi Body Viewer.
00003    Copyright (C) 2009 Markus Friedrich
00004 
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2 of the License, or
00008    (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software
00017    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018    */
00019 
00020 #ifndef _OPENMBV_BODY_H_
00021 #define _OPENMBV_BODY_H_
00022 
00023 #include <string>
00024 #include <sstream>
00025 #include <vector>
00026 #include <openmbvcppinterface/object.h>
00027 
00028 namespace OpenMBV {
00029 
00031   class Body : public Object {
00032     public:
00033       enum DrawStyle { filled, lines, points };
00034     private:
00035       std::string getRelPathTo(const boost::shared_ptr<Body> &destBody);
00036     protected:
00037       std::string outLineStr, shilouetteEdgeStr;
00038       DrawStyle drawMethod;
00039       boost::shared_ptr<Body> hdf5LinkBody;
00040       std::string hdf5LinkStr;
00041       void createHDF5File();
00042       void openHDF5File();
00043       void terminate();
00044       Body();
00045       ~Body() {}
00046     public:
00047 
00049       std::string getClassName() { return "Body"; }
00050 
00052       void setHDF5LinkTarget(const boost::shared_ptr<Body> &dest) { hdf5LinkBody=dest; }
00053       
00054       boost::shared_ptr<Body>& getHDF5LinkTarget() { return hdf5LinkBody; }
00055 
00057       bool isHDF5Link() { return (hdf5LinkBody || hdf5LinkStr!=""); }
00058 
00060       void setOutLine(bool ol) { outLineStr=(ol==true)?"true":"false"; }
00061 
00062       bool getOutLine() { return outLineStr=="true"?true:false; }
00063 
00065       void setShilouetteEdge(bool ol) { shilouetteEdgeStr=(ol==true)?"true":"false"; }
00066 
00067       bool getShilouetteEdge() { return shilouetteEdgeStr=="true"?true:false; }
00068 
00070       void setDrawMethod(DrawStyle ds) { drawMethod=ds; }
00071 
00072       DrawStyle getDrawMethod() { return drawMethod; }
00073 
00075       virtual void initializeUsingXML(xercesc::DOMElement *element);
00076 
00077       xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent);
00078 
00084       virtual void append(const std::vector<double>& row)=0;
00085 
00090       virtual int getRows()=0;
00091 
00095       virtual std::vector<double> getRow(int i)=0;
00096   };
00097 
00098 }
00099 
00100 #endif /* _OPENMBV_BODY_H_ */
00101