Bug IPAL18657 - VTK 3D Viewer: Bad representation of Local Coordinate systems.

This commit is contained in:
ouv 2009-11-13 09:15:26 +00:00
parent e39164dd0e
commit b32f549272
3 changed files with 70 additions and 15 deletions

View File

@ -822,7 +822,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
if ( myType == GEOM_MARKER && myShape.ShapeType() == TopAbs_FACE )
{
myToActivate = false;
//myToActivate = false; // ouv: commented to make the trihedron pickable (see IPAL18657)
GEOM_VTKTrihedron* aTrh = GEOM_VTKTrihedron::New();
if ( HasColor() )

View File

@ -200,9 +200,18 @@ GEOM_VTKTrihedron::GEOM_VTKTrihedron()
myMapper = vtkPolyDataMapper::New();
myAxis[ 0 ] = myAxis[ 1 ] = myAxis[ 2 ] = 0;
mySize = 100;
SetInfinitive( true );
myColor[ 0 ] = myColor[ 1 ] = myColor[ 1 ] = -1;
SetInfinitive( true );
myColor[ 0 ] = myColor[ 1 ] = myColor[ 2 ] = -1;
myDefaultColor[ 0 ] = myDefaultColor[ 1 ] = myDefaultColor[ 2 ] = 1;
myPreHighlightColor[ 0 ] = 0;
myPreHighlightColor[ 1 ] = myPreHighlightColor[ 2 ] = 1;
myHighlightColor[ 0 ] = myHighlightColor[ 1 ] = myHighlightColor[ 2 ] = 1;
//SetInfinitive( true );
SetPickable( true );
}
GEOM_VTKTrihedron::~GEOM_VTKTrihedron()
@ -254,6 +263,12 @@ void GEOM_VTKTrihedron::SetSize( vtkFloatingPointType theSize )
aRes->Delete();
}
void GEOM_VTKTrihedron::SetVisibility( int theVisibility )
{
Superclass::SetVisibility( theVisibility );
SetVisibility( theVisibility == 1 ? VTKViewer_Trihedron::eOn : VTKViewer_Trihedron::eOff );
}
void GEOM_VTKTrihedron::SetVisibility( VTKViewer_Trihedron::TVisibility theVis )
{
for ( int i = 0; i < 3; i++ )
@ -368,21 +383,48 @@ bool GEOM_VTKTrihedron::IsSetCamera() const
bool GEOM_VTKTrihedron::IsResizable() const
{
return true;
return false;
}
void GEOM_VTKTrihedron::Highlight( bool theIsHighlight )
{
if( theIsHighlight )
SetAxesColors( myHighlightColor );
else
ResetAxesColors();
Superclass::Highlight( theIsHighlight );
}
bool GEOM_VTKTrihedron::PreHighlight( vtkInteractorStyle *theInteractorStyle,
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight )
{
if ( !GetPickable() )
return false;
if ( !isHighlighted() )
{
if( theIsHighlight )
SetAxesColors( myPreHighlightColor );
else
ResetAxesColors();
}
return Superclass::PreHighlight( theInteractorStyle, theSelectionEvent, theIsHighlight );
}
void GEOM_VTKTrihedron::ResetAxesColors()
{
if( myColor[0] != -1 )
SetAxesColors( myColor );
else
SetAxesColors( myDefaultColor, true );
}
void GEOM_VTKTrihedron::SetAxesColors( vtkFloatingPointType theColor[3], bool theIsDiffuse )
{
myAxis[ 0 ]->SetColor( theColor[0], theIsDiffuse ? 0.0 : theColor[1], theIsDiffuse ? 0.0 : theColor[2] );
myAxis[ 1 ]->SetColor( theIsDiffuse ? 0.0 : theColor[0], theColor[1], theIsDiffuse ? 0.0 : theColor[2] );
myAxis[ 2 ]->SetColor( theIsDiffuse ? 0.0 : theColor[0], theIsDiffuse ? 0.0 : theColor[1], theColor[2] );
}

View File

@ -57,6 +57,7 @@ public:
virtual vtkFloatingPointType GetSize() { return mySize;}
virtual void SetVisibility( int theVisibility );
virtual void SetVisibility( VTKViewer_Trihedron::TVisibility theVis );
virtual void VisibilityOff() { SetVisibility( VTKViewer_Trihedron::eOff ); }
virtual void VisibilityOn() { SetVisibility( VTKViewer_Trihedron::eOn ); }
@ -79,7 +80,16 @@ public:
void SetColor( vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b );
void GetColor( vtkFloatingPointType& r, vtkFloatingPointType& g, vtkFloatingPointType& b );
virtual bool hasHighlight() { return false; }
virtual bool hasHighlight() { return true; }
virtual void Highlight( bool theHighlight );
virtual bool PreHighlight( vtkInteractorStyle* theInteractorStyle,
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight );
protected:
virtual void ResetAxesColors();
virtual void SetAxesColors( vtkFloatingPointType theColor[3], bool theIsDiffuse = false );
protected:
VTKViewer_Axis* myAxis[3];
@ -88,6 +98,9 @@ protected:
gp_Pnt myLocation;
gp_Dir myDirX, myDirY, myDirZ;
vtkFloatingPointType myColor[ 3 ];
vtkFloatingPointType myDefaultColor[ 3 ];
vtkFloatingPointType myPreHighlightColor[ 3 ];
vtkFloatingPointType myHighlightColor[ 3 ];
};
#endif