Salome HOME
72a56ec127997bd0468138f6f024c43890dff30f
[modules/geom.git] / src / OBJECT / GEOM_VTKTrihedron.hxx
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  SALOME GEOM : 
24 //  File   : GEOM_VTKTrihedron.h
25 //  Author : Sergey LITONIN
26 //  Module : SALOME
27 //
28 #ifndef GEOM_VTKTrihedron_H
29 #define GEOM_VTKTrihedron_H
30
31 #include "GEOM_OBJECT_defs.hxx"
32
33 #include <Geom_Axis2Placement.hxx>
34 #include "SALOME_Actor.h"
35 #include "VTKViewer_Trihedron.h"
36
37 class vtkRenderer;
38 class vtkPolyDataMapper;
39
40 /*
41   Class       : GEOM_VTKTrihedron
42   Description : Class for displaying trihedron of local CS in VTK viewer.
43                 Placement of trihedron is changed with SetPlacement() method
44 */
45
46 class GEOM_OBJECT_EXPORT GEOM_VTKTrihedron : public SALOME_Actor
47 {
48
49 protected:
50                                     GEOM_VTKTrihedron();
51                                     GEOM_VTKTrihedron( const GEOM_VTKTrihedron& );
52   virtual                           ~GEOM_VTKTrihedron();
53
54 public:
55                                     vtkTypeMacro( GEOM_VTKTrihedron, SALOME_Actor )
56   static GEOM_VTKTrihedron*         New();
57
58   virtual double      GetSize() { return mySize;}
59
60   virtual void                      SetVisibility( int theVisibility );
61   virtual void                      SetVisibility( VTKViewer_Trihedron::TVisibility theVis );
62   virtual void                      VisibilityOff() { SetVisibility( VTKViewer_Trihedron::eOff ); }
63   virtual void                      VisibilityOn() { SetVisibility( VTKViewer_Trihedron::eOn ); }
64
65   virtual void                      AddToRender( vtkRenderer* theRenderer );
66   virtual void                      RemoveFromRender( vtkRenderer* theRenderer );
67
68   virtual int                       GetVisibleActorCount( vtkRenderer* theRenderer );
69
70   void                              SetPlacement( const Handle(Geom_Axis2Placement)& );
71
72   virtual vtkMapper*                GetMapper();
73
74   virtual void                      Render(vtkRenderer *, vtkMapper *);
75   virtual bool                      IsSetCamera() const;
76   virtual bool                      IsResizable() const;
77   virtual void                      SetSize( double );
78   virtual void                      SetCamera( vtkCamera* );
79
80   void                              SetColor( double r, double g, double b );
81   void                              GetColor( double& r, double& g, double& b );
82
83   virtual bool                      hasHighlight() { return true; } 
84
85   virtual void                      Highlight( bool theHighlight );
86   virtual bool                      PreHighlight( vtkInteractorStyle* theInteractorStyle,
87                                                   SVTK_SelectionEvent* theSelectionEvent,
88                                                   bool theIsHighlight );
89
90 protected:
91   virtual void                      ResetAxesColors();
92   virtual void                      SetAxesColors( double theColor[3], bool theIsDiffuse = false );
93
94 protected:
95   VTKViewer_Axis*                   myAxis[3];
96   vtkPolyDataMapper*                myMapper;
97   double              mySize;
98   gp_Pnt                            myLocation;
99   gp_Dir                            myDirX, myDirY, myDirZ;
100   double              myColor[ 3 ];
101   double              myDefaultColor[ 3 ];
102   double              myPreHighlightColor[ 3 ];
103   double              myHighlightColor[ 3 ];
104 };
105
106 #endif