|
mapnode.h00001 /* 00002 Copyright (C) 2001 by Jorrit Tyberghein 00003 Copyright (C) 2000 by Thomas Hieber 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library 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 GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __MAPNODE_H__ 00021 #define __MAPNODE_H__ 00022 00023 #include "csgeom/vector3.h" 00024 #include "csutil/csobject.h" 00025 #include "ivaria/mapnode.h" 00026 00031 class csMapNode : public csObject 00032 { 00033 public: 00035 csMapNode (const char *Name); 00037 virtual ~csMapNode (); 00038 00040 void SetPosition (const csVector3& pos); 00042 const csVector3& GetPosition () const; 00043 00045 void SetSector (iSector *pSector); 00047 iSector *GetSector () const; 00048 00050 static iMapNode *GetNode (iSector *pSector, const char *name, 00051 const char *classname = NULL); 00052 00053 SCF_DECLARE_IBASE_EXT (csObject); 00054 //----------------------- iMapNode -------------------------- 00055 struct MapNode : public iMapNode 00056 { 00057 SCF_DECLARE_EMBEDDED_IBASE (csMapNode); 00058 virtual iObject *QueryObject() 00059 { return scfParent; } 00060 virtual void SetPosition (const csVector3& pos) 00061 { scfParent->SetPosition (pos); } 00062 virtual const csVector3& GetPosition () const 00063 { return scfParent->GetPosition (); } 00064 virtual void SetSector (iSector *sec) 00065 { scfParent->SetSector (sec); } 00066 virtual iSector *GetSector () const 00067 { return scfParent->GetSector (); } 00068 } scfiMapNode; 00069 00070 private: 00071 iSector *m_pSector; 00072 csVector3 m_Position; 00073 }; 00074 00078 class csNodeIterator 00079 { 00080 public: 00092 csNodeIterator (iSector *pSector, const char *classname = NULL); 00093 00095 ~csNodeIterator (); 00096 00098 void Reset (iSector *pSector, const char *classname = NULL); 00100 iMapNode *GetNode (); 00102 void Next (); 00104 bool IsFinished () const; 00105 00106 protected: 00108 void SkipWrongClassname (); 00110 void NextNode (); 00111 00112 iObjectIterator *Iterator; 00113 const char *Classname; 00114 iMapNode *CurrentNode; 00115 }; 00116 00117 #endif // __MAPNODE_H__ Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |