/usr/include/IGSTK/igstkSceneGraphObserver.h is in libigstk4-dev 4.4.0-2build2.
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 | /*=========================================================================
Program: Image Guided Surgery Software Toolkit
Module: $RCSfile: igstkSceneGraphObserver.h,v $
Language: C++
Date: $Date: 2010-11-16 17:59:47 $
Version: $Revision: 1.2 $
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 __igstkSceneGraphObserver_h
#define __igstkSceneGraphObserver_h
#if defined(_MSC_VER)
// Warning about: identifier was truncated to '255' characters
// in the debug information (MVC6.0 Debug)
#pragma warning( disable : 4786 )
#endif
#include "igstkTransform.h"
#include "igstkCoordinateSystemSetTransformResult.h"
#include "igstkSceneGraph.h"
#include "igstkCoordinateSystemTransformToResult.h"
namespace igstk
{
/**
* \class SceneGraphObserver
*
* \brief This class is used to observer the details required by the
* scene graph.
*
* This class is added as an observer to the CoordinateSystemObserver.
* \ingroup CoordinateSystem
*
*/
class SceneGraphObserver : public ::itk::Command
{
public:
igstkStandardClassBasicTraitsMacro( SceneGraphObserver, ::itk::Command );
igstkNewMacro( Self );
protected:
SceneGraphObserver()
{
m_GotTransform = false;
m_GotTransformNotAvailableMessage = false;
m_SceneGraph = SceneGraph::getInstance();
}
~SceneGraphObserver() {}
public:
typedef CoordinateSystemSetTransformEvent PositiveEventType;
typedef TransformNotAvailableEvent NegativeEventType;
/** Payload contained in an event that returns a valid transform. This
* payload includes the following items: Transform, Source coordinate system,
* Destination coordinate system. */
typedef CoordinateSystemSetTransformResult PayloadType;
SceneGraph* m_SceneGraph;
void ObserveTransformEventsFrom( Object * objectToObserve )
{
if( objectToObserve )
{
objectToObserve->AddObserver( PositiveEventType(), this );
objectToObserve->AddObserver( NegativeEventType(), this );
objectToObserve->AddObserver( CoordinateSystemTransformToEvent(), this);
}
}
void Execute(itk::Object *caller, const itk::EventObject & event)
{
const itk::Object * constCaller = caller;
this->Execute( constCaller, event );
}
void Execute(const itk::Object *caller, const itk::EventObject & event)
{
if( CoordinateSystemSetTransformEvent().CheckEvent( &event ) )
{
const CoordinateSystemSetTransformEvent *transformEvent =
dynamic_cast< const CoordinateSystemSetTransformEvent *>( &event );
if(transformEvent->Get().IsAttach())
{
m_SceneGraph->AddCoordinateSystem(transformEvent);
}
else
{
m_SceneGraph->DetachCoordinateSystem(transformEvent);
}
}
if( CoordinateSystemTransformToEvent().CheckEvent( &event) )
{
const CoordinateSystemTransformToEvent *transformEvent =
dynamic_cast< const CoordinateSystemTransformToEvent *>( &event );
if(transformEvent->Get().GetCommonAncestor() != NULL)
{
m_SceneGraph->ShowTheTransformPath(transformEvent);
}
}
if( NegativeEventType().CheckEvent( &event ) )
{
const NegativeEventType * negativeEvent =
dynamic_cast< const NegativeEventType *>( &event );
if( negativeEvent )
{
m_GotTransform = false;
m_GotTransformNotAvailableMessage = true;
}
}
(void) caller; //Get rid of unused parameter warning
}
bool GotTransform() const
{
return m_GotTransform;
}
bool GotTransformNotAvailableMessage() const
{
return m_GotTransformNotAvailableMessage;
}
const Transform & GetTransform() const
{
return this->m_Transform;
}
const PayloadType & GetTransformBetweenCoordinateSystems() const
{
return m_TransformBetweenCoordinateSystems;
}
void Clear()
{
this->m_GotTransform = false;
this->m_GotTransformNotAvailableMessage = false;
}
private:
PayloadType m_TransformBetweenCoordinateSystems;
Transform m_Transform;
bool m_GotTransform;
bool m_GotTransformNotAvailableMessage;
};
} // end namespace igstk
#endif
|