00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSceneSpatialObject.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/12/06 19:42:43 $ 00007 Version: $Revision: 1.8 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef __SceneSpatialObject_h 00019 #define __SceneSpatialObject_h 00020 00021 #include "itkSpatialObject.h" 00022 00023 #include <list> 00024 00025 namespace itk 00026 { 00027 00037 template <unsigned int SpaceDimension = 3> 00038 class SceneSpatialObject 00039 : public Object 00040 { 00041 00042 public: 00043 00044 typedef SceneSpatialObject<SpaceDimension> Self; 00045 typedef Object Superclass; 00046 typedef Superclass::Pointer SuperclassPointer; 00047 typedef SmartPointer< Self > Pointer; 00048 typedef SmartPointer< const Self > ConstPointer; 00049 00050 typedef SpatialObject<SpaceDimension> ObjectType; 00051 typedef SpatialObject<SpaceDimension> SpatialObjectType; 00052 typedef typename SpatialObjectType::Pointer SpatialObjectPointer; 00053 00054 typedef std::list< SpatialObjectPointer > 00055 ObjectListType; 00056 00057 itkStaticConstMacro(MaximumDepth, unsigned int, 9999999); 00058 00060 itkNewMacro(Self); 00061 itkTypeMacro(SceneSpatialObject, Object); 00063 00065 void AddSpatialObject( SpatialObject<SpaceDimension> * pointer ); 00066 00071 void RemoveSpatialObject( SpatialObject<SpaceDimension> * object ); 00072 00076 ObjectListType * GetObjects( unsigned int depth=MaximumDepth, 00077 char * name=NULL ); 00078 00080 unsigned int GetNumberOfObjects( unsigned int depth=MaximumDepth, 00081 char * name=NULL ); 00082 00084 void SetObjects( ObjectListType & children ); 00085 00088 unsigned long GetMTime( void ) const; 00089 00091 void SetParentId(int parentid) {m_ParentId=parentid;} 00092 int GetParentId(void) {return m_ParentId;} 00094 00096 SpatialObject<SpaceDimension> * GetObjectById(int Id); 00097 00098 bool FixHierarchy(void); 00099 bool CheckIdValidity(void); 00100 void FixIdValidity(void); 00101 int GetNextAvailableId(); 00102 00104 void Clear(); 00105 00106 protected: 00107 00109 ObjectListType m_Objects; 00110 00112 SceneSpatialObject(); 00113 00115 virtual ~SceneSpatialObject(); 00116 00118 virtual void PrintSelf( std::ostream& os, Indent indent ) const; 00119 00121 int m_ParentId; 00122 00123 }; 00124 00125 } // end of namespace itk 00126 00127 00128 #ifndef ITK_MANUAL_INSTANTIATION 00129 #include "itkSceneSpatialObject.txx" 00130 #endif 00131 00132 #endif // __SceneSpatialObject_h 00133