| Hosted by: |
OpenMBV C++ Interface |
BerliOS Project Page |
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_SPINEEXTRUSION_H_ 00021 #define _OPENMBV_SPINEEXTRUSION_H_ 00022 00023 #include <openmbvcppinterface/dynamiccoloredbody.h> 00024 #include <openmbvcppinterface/polygonpoint.h> 00025 #include <vector> 00026 #include <assert.h> 00027 #include <hdf5serie/vectorserie.h> 00028 #include <stdexcept> 00029 00030 namespace OpenMBV { 00031 00044 class SpineExtrusion : public DynamicColoredBody { 00045 friend class ObjectFactory; 00046 public: 00048 std::string getClassName() { return "SpineExtrusion"; } 00049 00052 void setNumberOfSpinePoints(const int num) { 00053 numberOfSpinePoints=num; 00054 } 00055 00058 int getNumberOfSpinePoints() { 00059 return numberOfSpinePoints; 00060 } 00061 00064 void setContour(const boost::shared_ptr<std::vector<boost::shared_ptr<PolygonPoint> > > &contour_) { contour = contour_; } 00065 00066 boost::shared_ptr<std::vector<boost::shared_ptr<PolygonPoint> > > getContour() { return contour; } 00067 00069 void setScaleFactor(const double scale) { 00070 scaleFactor=scale; 00071 } 00072 00073 double getScaleFactor() { return scaleFactor; } 00074 00076 void setInitialRotation(const std::vector<double>& initRot) { 00077 if(initRot.size()!=3) throw std::runtime_error("the dimension does not match"); 00078 initialRotation=initRot; 00079 } 00080 00082 void setInitialRotation(double a, double b, double g) { 00083 std::vector<double> initRot; 00084 initRot.push_back(a); 00085 initRot.push_back(b); 00086 initRot.push_back(g); 00087 initialRotation=initRot; 00088 } 00089 00091 std::vector<double> getInitialRotation() { return initialRotation; } 00092 00094 void append(const std::vector<double>& row) { 00095 if(data==0) throw std::runtime_error("can not append data to an environment object"); 00096 data->append(row); 00097 } 00098 00099 int getRows() { return data?data->getRows():-1; } 00100 std::vector<double> getRow(int i) { return data?data->getRow(i):std::vector<double>(1+4*numberOfSpinePoints); } 00101 00103 virtual void initializeUsingXML(xercesc::DOMElement *element); 00104 00106 xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent); 00107 protected: 00108 SpineExtrusion(); 00109 virtual ~SpineExtrusion(); 00110 00112 int numberOfSpinePoints; 00113 00115 boost::shared_ptr<std::vector<boost::shared_ptr<PolygonPoint> > > contour; 00116 00118 H5::VectorSerie<double>* data; 00119 00121 double scaleFactor; 00122 00124 std::vector<double> initialRotation; 00125 00127 void createHDF5File(); 00128 void openHDF5File(); 00129 }; 00130 00131 } 00132 00133 #endif /* _OPENMBV_SPINEEXTRUSION_H_ */ 00134
1.8.0