1 #include <cpPlugins/Object.h>
6 // -------------------------------------------------------------------------
7 const float& cpPlugins::Object::
10 return( this->m_ViewX );
13 // -------------------------------------------------------------------------
14 const float& cpPlugins::Object::
17 return( this->m_ViewY );
20 // -------------------------------------------------------------------------
21 void cpPlugins::Object::
22 SetViewCoords( float x, float y )
26 // WARNING: do not call "this->Modified( )" -> It could lead to a
27 // re-execution of all pipeline
31 // -------------------------------------------------------------------------
32 void cpPlugins::Object::
33 SetViewCoords( const QPointF& coords )
35 this->SetViewCoords( coords.x( ), coords.y( ) );
38 // -------------------------------------------------------------------------
39 QPointF cpPlugins::Object::
40 GetViewCoords( ) const
42 return( QPointF( this->m_ViewX, this->m_ViewY ) );
44 #endif // cpPlugins_QT4
46 // -------------------------------------------------------------------------
47 void cpPlugins::Object::
50 const itk::Object* i = this->GetITK< itk::Object >( );
51 vtkObject* v = const_cast< vtkObject* >( this->GetVTK< vtkObject >( ) );
52 if( i != NULL ) i->Modified( );
53 if( v != NULL ) v->Modified( );
54 this->Superclass::Modified( );
57 // -------------------------------------------------------------------------
58 itk::ModifiedTimeType cpPlugins::Object::
61 const itk::Object* i = this->GetITK< itk::Object >( );
62 vtkObject* v = const_cast< vtkObject* >( this->GetVTK< vtkObject >( ) );
63 if( i != NULL && v == NULL )
64 return( i->GetMTime( ) );
65 else if( i == NULL && v != NULL )
66 return( v->GetMTime( ) );
67 else if( i != NULL && v != NULL )
69 auto iTime = i->GetMTime( );
70 auto vTime = i->GetMTime( );
71 return( itk::ModifiedTimeType( ( iTime > vTime )? iTime: vTime ) );
74 return( this->Superclass::GetMTime( ) );
77 // -------------------------------------------------------------------------
78 void cpPlugins::Object::
79 SetITK( itk::LightObject* o )
81 if( this->m_ITKObject.GetPointer( ) != o )
83 this->m_ITKObject = o;
89 // -------------------------------------------------------------------------
90 void cpPlugins::Object::
91 SetVTK( vtkObjectBase* o )
93 if( this->m_VTKObject.GetPointer( ) != o )
95 this->m_VTKObject = o;
101 // -------------------------------------------------------------------------
104 : m_ITKObject( NULL ),
106 m_ViewX( float( 0 ) ),
107 m_ViewY( float( 0 ) )
111 // -------------------------------------------------------------------------