Bug IPAL21440 - Labels of trihedron in VTK view are dissappared

This commit is contained in:
ouv 2009-11-12 09:08:19 +00:00
parent 388bc0705e
commit 0f6aed6c55

View File

@ -44,6 +44,9 @@
#include <vtkMatrix4x4.h>
#include <vtkTransform.h>
#include <vtkVectorText.h>
#include <vtkCoordinate.h>
#include <vtkTextActor.h>
#include <vtkTextMapper.h>
/*
Class : GEOM_VTKTrihedron
@ -80,10 +83,7 @@ vtkStandardNewMacro( GEOM_VTKTrihedronAxis );
GEOM_VTKTrihedronAxis::GEOM_VTKTrihedronAxis()
{
vtkProperty* aProperty = vtkProperty::New();
aProperty->SetColor( 0.0, 0.0, 1.0 );
SetProperty( aProperty );
aProperty->Delete();
VTKViewer_Axis::SetColor( 0.0, 0.0, 1.0 );
myMatrix = vtkMatrix4x4::New();
myTrsf = vtkTransform::New();
}
@ -122,15 +122,22 @@ void GEOM_VTKTrihedronAxis::SetSize( vtkFloatingPointType theSize )
myArrowActor->SetUserMatrix( myMatrix );
myArrowActor->SetPosition( aPosition );
#ifdef IPAL21440
if( vtkCoordinate* aCoord = myLabelActor->GetPositionCoordinate()->GetReferenceCoordinate() )
aCoord->SetValue( aPosition );
#else
myLabelActor->SetPosition( 0, 0, 0 );
myLabelActor->AddPosition( aPosition );
#endif
}
void GEOM_VTKTrihedronAxis::Render(vtkRenderer* theRenderer)
{
myLineActor->Render( theRenderer );
myArrowActor->Render( theRenderer );
#ifndef IPAL21440
myLabelActor->Render( theRenderer );
#endif
vtkCamera* aCamera = theRenderer->GetActiveCamera();
SetCamera( aCamera );
@ -158,25 +165,25 @@ void GEOM_VTKTrihedronAxis::SetAxis( const gp_Ax1& theAxis,
vtkFloatingPointType aColor[ 3 ] = { 0, 0, 0 };
aColor[ theRot ] = 1;
vtkProperty* aProperty = vtkProperty::New();
if ( theColor[ 0 ] == -1 )
aProperty->SetColor( aColor[ 0 ], aColor[ 1 ], aColor[ 2 ] );
VTKViewer_Axis::SetColor( aColor[ 0 ], aColor[ 1 ], aColor[ 2 ] );
else
aProperty->SetColor( theColor[ 0 ], theColor[ 1 ], theColor[ 2 ] );
SetProperty( aProperty );
aProperty->Delete();
VTKViewer_Axis::SetColor( theColor[ 0 ], theColor[ 1 ], theColor[ 2 ] );
#ifdef IPAL21440
if ( theRot == 0 ) myTextMapper->SetInput( "X" );
else if ( theRot == 1 ) myTextMapper->SetInput( "Y" );
else if ( theRot == 2 ) myTextMapper->SetInput( "Z" );
#else
if ( theRot == 0 ) myVectorText->SetText( "X" );
else if ( theRot == 1 ) myVectorText->SetText( "Y" );
else if ( theRot == 2 ) myVectorText->SetText( "Z" );
#endif
}
void GEOM_VTKTrihedronAxis::SetColor( const vtkFloatingPointType theColor[ 3 ] )
{
vtkProperty* aProperty = vtkProperty::New();
aProperty->SetColor( theColor[ 0 ], theColor[ 1 ], theColor[ 2 ] );
SetProperty( aProperty );
aProperty->Delete();
VTKViewer_Axis::SetColor( theColor[ 0 ], theColor[ 1 ], theColor[ 2 ] );
}