X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FActorAxesProperties.cxx;fp=lib%2FcpPlugins%2FActorAxesProperties.cxx;h=373f2e265873d20deaad5b063d0cefc820e76975;hb=107144983fb7d178ad07ccfd1b7c703671eb09aa;hp=9de508191cbdef36843f776fb9961edaf8547bcd;hpb=486e2fd13401f33b2349e023be1dfc01221b0ef3;p=cpPlugins.git diff --git a/lib/cpPlugins/ActorAxesProperties.cxx b/lib/cpPlugins/ActorAxesProperties.cxx index 9de5081..373f2e2 100644 --- a/lib/cpPlugins/ActorAxesProperties.cxx +++ b/lib/cpPlugins/ActorAxesProperties.cxx @@ -5,9 +5,11 @@ #include #include +#include #include #include -#include +#include +#include // ------------------------------------------------------------------------- cpPlugins::ActorAxesProperties:: @@ -55,7 +57,7 @@ _updateWidgets( ) 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 ); @@ -102,11 +104,35 @@ _updateWidgets( ) 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 @@ -160,14 +186,16 @@ _TextColor( ) 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