/usr/include/IGSTK/igstkCoordinateSystemDelegator.h is in libigstk4-dev 4.4.0-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | /*=========================================================================
Program: Image Guided Surgery Software Toolkit
Module: $RCSfile: igstkCoordinateSystemDelegator.h,v $
Language: C++
Date: $Date: 2009-02-02 21:00:06 $
Version: $Revision: 1.5 $
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 __igstkCoordinateSystemDelegator_h
#define __igstkCoordinateSystemDelegator_h
#include "igstkCoordinateSystem.h"
#include "igstkCoordinateSystemTransformToResult.h"
#include "igstkCoordinateSystemTransformToErrorResult.h"
#include "igstkCoordinateSystemSetTransformResult.h"
namespace igstk
{
/** \class CoordinateSystemDelegator
*
* \brief Encapsulates common logic for handling coordinate reference system
* calls on objects with CoordinateSystems.
*
* Most of the functionality is delegated to CoordinateSystem. This
* class is intended to be used inside classes like SpatialObject and View.
* This class delegates much of the core coordinate system connectivity and
* transformation work to the CoordinateSystem class.
*
* The following diagram illustrates the state machine of
* the CoordinateSystemDelegator class
*
* \image html igstkCoordinateSystemDelegator.png
* "CoordinateSystemDelegator State Machine Diagram"
*
* \image latex igstkCoordinateSystemDelegator.eps
* "CoordinateSystemDelegator State Machine Diagram"
*/
class CoordinateSystemDelegator : public Object
{
public:
/** Macro with standard traits declarations. */
igstkStandardClassTraitsMacro( CoordinateSystemDelegator, Object )
/** This method implements the construction of a coordinate system graph by
* defining the parent of this object and the Transforms defining their
* relative position and orientation */
template < class TParentPointer >
void RequestSetTransformAndParent( const Transform & transformToParent,
TParentPointer parent )
{
if( !(parent) ) // This expression must be suitable for both
// Smart and Raw pointers.
{
igstkPushInputMacro( NullParent );
m_StateMachine.ProcessInputs();
return;
}
else
{
const CoordinateSystem* parentReferenceSystem =
igstk::Friends::CoordinateSystemHelper
::GetCoordinateSystem( parent );
/** Use event observer to handle the return event */
this->m_CoordinateSystem->RequestSetTransformAndParent(
transformToParent,
parentReferenceSystem);
return;
}
}
// This method updates the transform between this object and its parent
void RequestUpdateTransformToParent( const Transform & transformToParent )
{
this->m_CoordinateSystem->RequestUpdateTransformToParent(
transformToParent);
}
/** Returns the transform to the parent if available. */
void RequestGetTransformToParent();
/** Detach from its parents */
void RequestDetachFromParent()
{
this->m_CoordinateSystem->RequestDetachFromParent();
}
/**
* Tries to compute the transformation from this coordinate system
* to another coordinate system. This method is templated on the
* input and should allow computation of a transform to another
* object that internally has a CoordinateSystem.
*
* Three types of events may be generated by this call:
* CoordinateSystemTransformToEvent
* CoordinateSystemTransformToNullTargetEvent
* CoordinateSystemTransformToDisconnectedEvent
*/
template <class TTarget>
void RequestComputeTransformTo(const TTarget & target)
{
if( !(target) )
{
igstkPushInputMacro( NullTarget );
m_StateMachine.ProcessInputs();
return;
}
/** First get the coordinate system from the target object. */
const CoordinateSystem* targetCoordSys =
igstk::Friends::CoordinateSystemHelper::
GetCoordinateSystem( target );
/** Handle the response with event observers */
this->m_CoordinateSystem->RequestComputeTransformTo(
targetCoordSys);
}
/** Typedef for coordinate system*/
typedef igstk::CoordinateSystem CoordinateSystemType;
/** Allows another object to verify which coordinate system
* an object owns. This does not check that the coordinate
* systems are equivalent, but whether the instances of
* the coordinate systems are identical.
*/
bool IsCoordinateSystem( const CoordinateSystemType* ) const;
/** Print out object information. */
void PrintSelf( std::ostream& os, itk::Indent indent ) const;
/** Set/Get the name of the coordinate system. */
void SetName( const char* name );
void SetName( const std::string& name );
const char* GetName() const;
/** Set/Get the type of the coordinate system. */
void SetType( const char* type );
void SetType( const std::string& type );
const char* GetType() const;
protected:
CoordinateSystemDelegator();
~CoordinateSystemDelegator();
private:
/** Purposely not implemented. */
CoordinateSystemDelegator(const CoordinateSystemDelegator& );
/** Purposely not implemented. */
CoordinateSystemDelegator& operator=(const CoordinateSystemDelegator&);
/** One state */
igstkDeclareStateMacro( Idle );
/** A few inputs. */
igstkDeclareInputMacro( NullParent );
igstkDeclareInputMacro( NullTarget );
/** Declaring frienship with helper that will facilitate enforcing the
* privacy of the CoordinateSystem.
*/
igstkFriendClassMacro( igstk::Friends::CoordinateSystemHelper );
/** Private method for getting the CoordinateSystem. This method
* is mainly intended to be called from the
* CoordinateSystemHelper as a secure way of passing the
* CoordinateSystem without breaking its encapsulation.
*/
const CoordinateSystem * GetCoordinateSystem() const;
/** Pointer to a CoordinateSystem object for managing
* coordinate system operations...
*/
CoordinateSystem::Pointer m_CoordinateSystem;
/** Called when RequestSetTransformAndParent is passed a null parent. */
void NullParentProcessing();
/** Called when RequestComputeTransformTo is passed a null target. */
void NullTargetProcessing();
/** Typedef, Receptor observer, & callback for watching
* CoordinateSystem events.
*/
typedef ::itk::ReceptorMemberCommand< Self > CoordinateSystemObserverType;
/** Make an observer to watch events on the CoordinateSystem. */
CoordinateSystemObserverType::Pointer m_CoordinateSystemObserver;
/** Call back used by the coordinate system observer which
* catches events and re-invokes them.
*/
void ObserverCallback(const ::itk::EventObject & eventvar);
}; // class CoordinateSystemDelegator
}
#endif
|