From: ouv Date: Thu, 12 Nov 2009 09:08:19 +0000 (+0000) Subject: Bug IPAL21440 - Labels of trihedron in VTK view are dissappared X-Git-Tag: V5_1_3rc3~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0f6aed6c55551dfced3dcbf862a1a2043105c357;p=modules%2Fgeom.git Bug IPAL21440 - Labels of trihedron in VTK view are dissappared --- diff --git a/src/OBJECT/GEOM_VTKTrihedron.cxx b/src/OBJECT/GEOM_VTKTrihedron.cxx index 113d7a931..bc05f288e 100644 --- a/src/OBJECT/GEOM_VTKTrihedron.cxx +++ b/src/OBJECT/GEOM_VTKTrihedron.cxx @@ -44,6 +44,9 @@ #include #include #include +#include +#include +#include /* 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 ] ); }