00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 #ifndef Node_hpp 00114 #define Node_hpp 00115 00116 #include "ObstacleAvoidance/Primitive.hpp" 00117 #include <list> 00118 00120 namespace OSCAR { 00121 00122 class Node; // forward declaration 00123 typedef std::list<Node*> NodeList; 00124 typedef std::list<Primitive*> PrimitiveList; 00125 00126 00138 class Node : public ModelingObject { 00139 public: 00150 Node(const Xform& local = Xform(), const String& name= String(), OSCARError& err=DUMMY_ERROR(noError)); 00151 00160 Node(const Node& rhs); 00161 00169 Node& operator=(const Node& rhs); 00170 00174 virtual ~Node(); 00175 00180 Node* GetParent() const; 00181 00186 const NodeList& GetChildren() const; 00187 00193 NodeList& GetChildren(); 00194 00199 const PrimitiveList& GetPrimitives() const; 00200 00206 PrimitiveList& GetPrimitives(); 00207 00217 bool Add(Node* node); 00218 00224 bool Remove(Node* node); 00225 00232 bool Add(const Primitive* primitive); 00233 00239 bool Remove(Primitive* primitive); 00240 00249 bool Move(Node* from, Node* node); 00250 00258 bool Move(Node& from, Primitive* primitive); 00259 00265 const Xform& GetLocalXform() const; 00266 00272 Xform GetLocalXform(); 00273 00279 const Xform& GetGlobalXform() const; 00280 00286 Xform GetGlobalXform(); 00287 00292 bool IsRoot() const; 00293 00299 unsigned int NumChildren(bool thisNodeOnly = false) const; 00300 00306 unsigned int NumPrimitives(bool thisNodeOnly = false) const; 00307 00313 bool Update(const Xform& transform); 00314 protected: 00315 Xform toParent, toGlobal; 00316 Node* parent; 00317 NodeList children; 00318 PrimitiveList primitives; 00319 00320 bool deallocate(); 00321 00325 bool update(); 00326 }; 00327 00328 #include "Node.ipp" 00329 00330 } 00331 00332 #endif //Node_hpp
| RRG Homepage | OSCAR Overview | OSCAR Tutorials | Simulations |