0030686: Visualization, SelectMgr_ViewerSelector - sorting issues of transformation...
[occt.git] / src / IVtkTools / IVtkTools.hxx
1 // Created on: 2011-10-14 
2 // Created by: Roman KOZLOV
3 // Copyright (c) 2011-2014 OPEN CASCADE SAS 
4 // 
5 //This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef IVtkTOOLS_H
17 #define IVtkTOOLS_H
18
19 #include <IVtk_Types.hxx>
20 #include <vtkSmartPointer.h>
21
22 class vtkLookupTable;
23 class vtkMapper;
24
25 //! Helper methods to facilitate usage of VIS classes in an application.
26 namespace IVtkTools
27 {
28
29   //! Returns vtkLookupTable instance initialized by standrad OCCT colors used 
30   //! in wireframe mode for different kinds of sub-shapes (free/boundary/shared 
31   //! edges, isolines,...)
32   Standard_EXPORT vtkSmartPointer<vtkLookupTable> InitLookupTable();
33
34   //! Set a color for given type of sub-shapes.
35   //! @param [in,out] theColorTable vtkLookupTable to set the color.
36   //! @param [in]  theColorRole type of sub-shapes to set the color.
37   //! @param [in]  theR red color component. Use [0,1] double values.
38   //! @param [in]  theG green color component. Use [0,1] double values.
39   //! @param [in]  theB blue color component. Use [0,1] double values.
40   //! @param [in]  theA the alpha value (the opacity) as a double between 0 and 1.
41   Standard_EXPORT void SetLookupTableColor (vtkLookupTable* theColorTable, 
42                                             const IVtk_MeshType theColorRole, 
43                                             const double theR, const double theG, const double theB, 
44                                             const double theA = 1);
45
46   //! Get a color for given type of sub-shapes.
47   //! @param [in]  theColorTable vtkLookupTable to set the color.
48   //! @param [in]  theColorRole type of sub-shapes to set the color.
49   //! @param [out] theR red color component as a double between 0 and 1.
50   //! @param [out] theG green color component as a double between 0 and 1.
51   //! @param [out] theB blue color component as a double between 0 and 1.
52   Standard_EXPORT void GetLookupTableColor (vtkLookupTable* theColorTable, 
53                                             const IVtk_MeshType theColorRole, 
54                                             double &theR, double &theG, double &theB);
55
56   //! Get a color for given type of sub-shapes.
57   //! @param [in]  theColorTable vtkLookupTable to set the color.
58   //! @param [in]  theColorRole type of sub-shapes to set the color.
59   //! @param [out] theR red color component as a double between 0 and 1.
60   //! @param [out] theG green color component as a double between 0 and 1.
61   //! @param [out] theB blue color component as a double between 0 and 1.
62   //! @param [out] theA the alpha value (the opacity) as a double between 0 and 1.
63   Standard_EXPORT void GetLookupTableColor (vtkLookupTable* theColorTable, 
64                                             const IVtk_MeshType theColorRole, 
65                                             double &theR, double &theG, double &theB, 
66                                             double &theA);
67
68   //! Set up the initial shape mapper parameters with default OCC colors.
69   Standard_EXPORT void InitShapeMapper (vtkMapper* theMapper);
70
71   //! Set up the initial shape mapper parameters with user colors.
72   //! @param [in,out] theMapper mapper to initialize
73   //! @param [in] theColorTable a table with user's colors definition
74   Standard_EXPORT void InitShapeMapper (vtkMapper* theMapper, 
75                                         vtkLookupTable* theColorTable);
76
77 }
78
79 #endif // IVtkTOOLS_H