00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSceneSpatialObject.h,v $ 00005 Language: C++ 00006 Date: $Date: 2007/01/28 19:24:56 $ 00007 Version: $Revision: 1.10 $ 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 __itkSceneSpatialObject_h 00019 #define __itkSceneSpatialObject_h 00020 00021 #include "itkSpatialObject.h" 00022 00023 #include <list> 00024 00025 namespace itk 00026 { 00027 00037 template <unsigned int TSpaceDimension = 3> 00038 class SceneSpatialObject 00039 : public Object 00040 { 00041 00042 public: 00043 00044 typedef SceneSpatialObject<TSpaceDimension> 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<TSpaceDimension> ObjectType; 00051 typedef SpatialObject<TSpaceDimension> 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<TSpaceDimension> * pointer ); 00066 00071 void RemoveSpatialObject( SpatialObject<TSpaceDimension> * object ); 00072 00076 ObjectListType * GetObjects( unsigned int depth=MaximumDepth, 00077 char * name=NULL ); 00078 00081 unsigned int GetNumberOfObjects( unsigned int depth=MaximumDepth, 00082 char * name=NULL ); 00083 00085 void SetObjects( ObjectListType & children ); 00086 00089 unsigned long GetMTime( void ) const; 00090 00092 void SetParentId(int parentid) {m_ParentId=parentid;} 00093 int GetParentId(void) {return m_ParentId;} 00095 00097 SpatialObject<TSpaceDimension> * GetObjectById(int Id); 00098 00099 bool FixHierarchy(void); 00100 bool CheckIdValidity(void); 00101 void FixIdValidity(void); 00102 int GetNextAvailableId(); 00103 00105 void Clear(); 00106 00107 protected: 00108 SceneSpatialObject(const Self&); //purposely not implemented 00109 void operator=(const Self&); //purposely not implemented 00110 00113 ObjectListType m_Objects; 00114 00116 SceneSpatialObject(); 00117 00119 virtual ~SceneSpatialObject(); 00120 00122 virtual void PrintSelf( std::ostream& os, Indent indent ) const; 00123 00125 int m_ParentId; 00126 00127 }; 00128 00129 } // end of namespace itk 00130 00131 00132 #ifndef ITK_MANUAL_INSTANTIATION 00133 #include "itkSceneSpatialObject.txx" 00134 #endif 00135 00136 #endif // __SceneSpatialObject_h 00137