File: igstkGroupObject.h

package info (click to toggle)
igstk 4.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 38,980 kB
  • sloc: cpp: 86,267; xml: 96; makefile: 75; python: 38
file content (112 lines) | stat: -rw-r--r-- 3,272 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*=========================================================================

  Program:   Image Guided Surgery Software Toolkit
  Module:    $RCSfile: igstkGroupObject.h,v $
  Language:  C++
  Date:      $Date: 2008-02-11 01:41:50 $
  Version:   $Revision: 1.7 $

  Copyright (c) ISC  Insight Software Consortium.  All rights reserved.
  See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#ifndef __igstkGroupObject_h
#define __igstkGroupObject_h

#include "igstkMacros.h"
#include "igstkSpatialObject.h"
#include "itkGroupSpatialObject.h"

namespace igstk
{

/** \class GroupObject
 * \brief Implements the 3-dimensional Group structure.
 *
 * \par Overview
 * GroupObject implements the 3-dimensional Group structure. This spatial
 * object keeps reference to its children, so it is possible to navigate the
 * scene graph downwards.
 *
 * \ingroup Object
 */

class GroupObject 
: public SpatialObject
{

public:

  /** Macro with standard traits declarations. */
  igstkStandardClassTraitsMacro( GroupObject, SpatialObject )

public:

  /** Type of the internal GroupSpatialObject. */
  typedef itk::GroupSpatialObject<3>          GroupSpatialObjectType;

  /** Return the number of objects in the group */
  unsigned long GetNumberOfChildren() const;
  
  /** Request Adding a SpatialObject to the list of children.  Note that this
   * method invoke the reciprocal RequestSetTransformAndParent(transform,parent)
   * method on the child. */
  void RequestAddChild( const Transform & transform, SpatialObject * child );

  /** Request to get the child identified with a given childId number */
  void RequestGetChild( unsigned long childId );

protected:

  /** Constructor */
  GroupObject( void );

  /** Destructor */
  ~GroupObject( void );

  /** Print object information */
  virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; 

private:

  /** Internal itkGroupSpatialObject */
  GroupSpatialObjectType::Pointer   m_GroupSpatialObject;

  typedef std::vector< SpatialObject::Pointer >  ChildrenContainerType;

  ChildrenContainerType             m_ChildrenArray;

  /** Inputs to the State Machine */
  igstkDeclareInputMacro( AddChildValid );
  igstkDeclareInputMacro( AddChildInvalid );
  igstkDeclareInputMacro( GetChildValid );
  igstkDeclareInputMacro( GetChildInvalid );

  /** States for the State Machine */
  igstkDeclareStateMacro( EmptyGroup );
  igstkDeclareStateMacro( NonEmptyGroup );

  /** Action methods to be invoked only by the state machine */
  void AddChildProcessing();
  void GetChildProcessing();
  void ReportNoChildAvailableProcessing();
  
  /** Null operation for a State Machine transition */
  void NoProcessing();

  /** Report when a request has been made at an incorrect time. */
  void ReportInvalidRequestProcessing();

  SpatialObject  *   m_ChildToAdd;
  Transform          m_TransformToAdd;
  unsigned long      m_ChildIdToGet;
};

} // end namespace igstk

#endif // __igstkGroupObject_h