![]() |
Public API Reference |
00001 /* 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 __CS_MAPNODE_H__ 00021 #define __CS_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 = 0); 00052 00053 SCF_DECLARE_IBASE_EXT (csObject); 00054 //----------------------- iMapNode -------------------------- 00056 struct MapNode : public iMapNode 00057 { 00058 SCF_DECLARE_EMBEDDED_IBASE (csMapNode); 00059 virtual iObject *QueryObject() 00060 { return scfParent; } 00061 virtual void SetPosition (const csVector3& pos) 00062 { scfParent->SetPosition (pos); } 00063 virtual const csVector3& GetPosition () const 00064 { return scfParent->GetPosition (); } 00065 virtual void SetSector (iSector *sec) 00066 { scfParent->SetSector (sec); } 00067 virtual iSector *GetSector () const 00068 { return scfParent->GetSector (); } 00069 } scfiMapNode; 00070 00071 private: 00072 iSector *m_pSector; 00073 csVector3 m_Position; 00074 }; 00075 00079 class csNodeIterator 00080 { 00081 public: 00093 csNodeIterator (iSector *pSector, const char *classname = 0); 00094 00096 ~csNodeIterator (); 00097 00099 void Reset (iSector *pSector, const char *classname = 0); 00101 iMapNode* Next (); 00103 bool HasNext () const; 00104 00105 protected: 00107 void SkipWrongClassname (); 00109 void NextNode (); 00110 00111 csRef<iObjectIterator> Iterator; 00112 const char *Classname; 00113 csRef<iMapNode> CurrentNode; 00114 }; 00115 00116 #endif // __CS_MAPNODE_H__