00001 //###################################################################### 00002 // 00003 // GraspIt! 00004 // Copyright (C) 2002-2009 Columbia University in the City of New York. 00005 // All rights reserved. 00006 // 00007 // GraspIt! is free software: you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation, either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // GraspIt! is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with GraspIt!. If not, see <http://www.gnu.org/licenses/>. 00019 // 00020 // Author(s): Andrew T. Miller and Matei T. Ciocarlie 00021 // 00022 // $Id: worldElement.h,v 1.17 2009/06/18 20:41:02 saint Exp $ 00023 // 00024 //###################################################################### 00025 00029 #ifndef WORLD_ELEMENT_H 00030 00031 #include <vector> 00032 00033 #include <Inventor/SoType.h> 00034 #include <QString> 00035 #include <QObject> 00036 #include <QTextStream> 00037 00038 #include "collisionStructures.h" 00039 00040 class transf; 00041 class World; 00042 class SoSeparator; 00043 class Body; 00044 00046 00052 class WorldElement : public QObject{ 00053 Q_OBJECT ; 00054 public: 00056 static const double ONE_STEP; 00057 00058 private: 00060 bool contactsChangedFlag; 00061 00062 protected: 00064 World *myWorld; 00065 00067 SoSeparator *IVRoot; 00068 00070 00074 QString myFilename; 00075 00077 QString myName; 00078 00080 WorldElement(World *w,const char *name); 00081 00083 WorldElement(const WorldElement &e); 00084 00086 virtual bool interpolateTo(transf lastTran, transf newTran, const CollisionReport &colReport); 00087 00089 virtual bool jumpTo(transf newTran, CollisionReport *contactReport); 00090 00092 00101 virtual void getBodyList(std::vector<Body*> *bodies) = 0; 00102 00103 public: 00105 virtual ~WorldElement(); 00106 00108 World *getWorld() const {return myWorld;} 00109 00111 SoSeparator *getIVRoot() const {return IVRoot;} 00112 00114 QString getFilename() const {return myFilename;} 00115 00117 QString getName() const {return myName;} 00118 00120 virtual void setName(QString newName){myName = newName;} 00121 00123 virtual void setFilename(QString newName){myFilename = newName;} 00124 00128 virtual const transf& getTran() const =0; 00129 00133 virtual bool contactsPreventMotion(const transf& motion) const =0; 00134 00136 bool contactsChanged() const {return contactsChangedFlag;} 00137 00141 virtual void setContactsChanged() {contactsChangedFlag=true;} 00142 00144 virtual void resetContactsChanged() {contactsChangedFlag=false;} 00145 00150 virtual int setTran(transf const& newTr)=0; 00151 00153 virtual bool moveTo(transf &tr,double translStepSize,double rotStepSize); 00154 00156 friend class SensorInputDlg; 00157 }; 00158 00159 00160 #define WORLD_ELEMENT_H 00161 #endif