00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSceneSpatialObject.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/01/21 17:59:18 $ 00007 Version: $Revision: 1.7 $ 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); 00062 00064 void AddSpatialObject( SpatialObject<SpaceDimension> * pointer ); 00065 00070 void RemoveSpatialObject( SpatialObject<SpaceDimension> * object ); 00071 00073 ObjectListType * GetObjects( unsigned int depth=MaximumDepth, 00074 char * name=NULL ); 00075 00077 unsigned int GetNumberOfObjects( unsigned int depth=MaximumDepth, 00078 char * name=NULL ); 00079 00081 void SetObjects( ObjectListType & children ); 00082 00085 unsigned long GetMTime( void ) const; 00086 00088 void SetParentId(int parentid) {m_ParentId=parentid;} 00089 int GetParentId(void) {return m_ParentId;} 00090 00092 SpatialObject<SpaceDimension> * GetObjectById(int Id); 00093 00094 bool FixHierarchy(void); 00095 bool CheckIdValidity(void); 00096 void FixIdValidity(void); 00097 int GetNextAvailableId(); 00098 00100 void Clear(); 00101 00102 protected: 00103 00105 ObjectListType m_Objects; 00106 00108 SceneSpatialObject(); 00109 00111 virtual ~SceneSpatialObject(); 00112 00114 virtual void PrintSelf( std::ostream& os, Indent indent ) const; 00115 00117 int m_ParentId; 00118 00119 }; 00120 00121 } // end of namespace itk 00122 00123 00124 #ifndef ITK_MANUAL_INSTANTIATION 00125 #include "itkSceneSpatialObject.txx" 00126 #endif 00127 00128 #endif // __SceneSpatialObject_h