#include <cpPlugins/ui_ActorAxesProperties.h>
#include <QColorDialog>
+#include <itkVector.h>
#include <vtkAxesActor.h>
#include <vtkCaptionActor2D.h>
-#include <vtkProperty2D.h>
+#include <vtkMatrix4x4.h>
+#include <vtkTextProperty.h>
// -------------------------------------------------------------------------
cpPlugins::ActorAxesProperties::
std::string ytext( actor->GetYAxisLabelText( ) );
std::string ztext( actor->GetZAxisLabelText( ) );
double scale = actor->GetScale( )[ 0 ];
- auto prop = actor->GetXAxisCaptionActor2D( )->GetProperty( );
+ auto prop = actor->GetXAxisCaptionActor2D( )->GetCaptionTextProperty( );
double rgb[ 3 ];
prop->GetColor( rgb );
rgb[ 0 ] *= double( 255 );
void cpPlugins::ActorAxesProperties::
_Scale( double v )
{
+ itk::Vector< double, 3 > x, y, z;
auto aIt = this->m_Actors.begin( );
for( ; aIt != this->m_Actors.end( ); ++aIt )
{
auto ma = dynamic_cast< vtkAxesActor* >( aIt->GetPointer( ) );
- ma->SetScale( v );
+ auto matrix = ma->GetUserMatrix( );
+ for( unsigned int d = 0; d < 3; ++d )
+ {
+ x[ d ] = matrix->GetElement( d, 0 );
+ y[ d ] = matrix->GetElement( d, 1 );
+ z[ d ] = matrix->GetElement( d, 2 );
+
+ } // rof
+ auto nx = x.GetNorm( );
+ auto ny = y.GetNorm( );
+ auto nz = z.GetNorm( );
+ if( nx > double( 0 ) ) x /= nx;
+ if( ny > double( 0 ) ) y /= ny;
+ if( nz > double( 0 ) ) z /= nz;
+ x *= v;
+ y *= v;
+ z *= v;
+ for( unsigned int d = 0; d < 3; ++d )
+ {
+ matrix->SetElement( d, 0, x[ d ] );
+ matrix->SetElement( d, 1, y[ d ] );
+ matrix->SetElement( d, 2, z[ d ] );
+
+ } // rof
ma->Modified( );
} // rof
rgb[ 0 ] = double( color.red( ) ) / double( 255 );
rgb[ 1 ] = double( color.green( ) ) / double( 255 );
rgb[ 2 ] = double( color.blue( ) ) / double( 255 );
-
auto aIt = this->m_Actors.begin( );
for( ; aIt != this->m_Actors.end( ); ++aIt )
{
auto ma = dynamic_cast< vtkAxesActor* >( aIt->GetPointer( ) );
- ma->GetXAxisCaptionActor2D( )->GetProperty( )->SetColor( rgb );
- ma->GetYAxisCaptionActor2D( )->GetProperty( )->SetColor( rgb );
- ma->GetZAxisCaptionActor2D( )->GetProperty( )->SetColor( rgb );
+ ma->GetXAxisCaptionActor2D( )->GetCaptionTextProperty( )->SetColor( rgb );
+ ma->GetYAxisCaptionActor2D( )->GetCaptionTextProperty( )->SetColor( rgb );
+ ma->GetZAxisCaptionActor2D( )->GetCaptionTextProperty( )->SetColor( rgb );
+ ma->GetXAxisCaptionActor2D( )->Modified( );
+ ma->GetYAxisCaptionActor2D( )->Modified( );
+ ma->GetZAxisCaptionActor2D( )->Modified( );
ma->Modified( );
} // rof
return( i->second );
}
-// -------------------------------------------------------------------------
-cpPlugins::
-DataObject* cpPlugins::ProcessObject::
-GetInput( const std::string& id )
-{
- auto i = this->m_Inputs.find( id );
- if( i != this->m_Inputs.end( ) )
- return( dynamic_cast< DataObject* >( i->second.GetPointer( ) ) );
- else
- return( NULL );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::
-DataObject* cpPlugins::ProcessObject::
-GetInput( const std::string& id ) const
-{
- auto i = this->m_Inputs.find( id );
- if( i != this->m_Inputs.end( ) )
- return( dynamic_cast< const DataObject* >( i->second.GetPointer( ) ) );
- else
- return( NULL );
-}
-
// -------------------------------------------------------------------------
bool cpPlugins::ProcessObject::
SetInputPort( const std::string& id, const OutputPort& port )
OutputPort& GetOutputPort( const std::string& id );
const OutputPort& GetOutputPort( const std::string& id ) const;
- DataObject* GetInput( const std::string& id );
- const DataObject* GetInput( const std::string& id ) const;
+ template< class _TType = DataObject >
+ inline _TType* GetInput( const std::string& id );
+
+ template< class _TType = DataObject >
+ inline const _TType* GetInput( const std::string& id ) const;
template< class _TType = DataObject >
inline _TType* GetOutput( const std::string& id );
#ifndef __CPPLUGINS__PROCESSOBJECT__HXX__
#define __CPPLUGINS__PROCESSOBJECT__HXX__
+// -------------------------------------------------------------------------
+template< class _TType >
+_TType* cpPlugins::ProcessObject::
+GetInput( const std::string& id )
+{
+ auto i = this->m_Inputs.find( id );
+ if( i != this->m_Inputs.end( ) )
+ return( dynamic_cast< _TType* >( i->second.GetPointer( ) ) );
+ else
+ return( NULL );
+}
+
+// -------------------------------------------------------------------------
+template< class _TType >
+const _TType* cpPlugins::ProcessObject::
+GetInput( const std::string& id ) const
+{
+ auto i = this->m_Inputs.find( id );
+ if( i != this->m_Inputs.end( ) )
+ return( dynamic_cast< const _TType* >( i->second.GetPointer( ) ) );
+ else
+ return( NULL );
+}
+
// -------------------------------------------------------------------------
template< class _TType >
_TType* cpPlugins::ProcessObject::