0028452: VIS - MSVC 14 compiler warnings
[occt.git] / src / IVtkDraw / IVtkDraw_HighlightAndSelectionPipeline.hxx
1 // Created on: 2012-04-02 
2
3 // Copyright (c) 2012-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 _IVtkDraw_HighlightAndSelectionPipeline_HeaderFile
17 #define _IVtkDraw_HighlightAndSelectionPipeline_HeaderFile
18
19 #include <NCollection_DataMap.hxx>
20 #include <NCollection_Shared.hxx>
21 #include <Standard_Transient.hxx>
22 #include <TopoDS_Shape.hxx>
23
24 // prevent disabling some MSVC warning messages by VTK headers 
25 #ifdef _MSC_VER
26 #pragma warning(push)
27 #endif
28 #include <vtkActor.h>
29 #include <vtkPolyData.h>
30 #include <vtkPolyDataMapper.h>
31 #include <vtkRenderer.h>
32 #include <vtkSmartPointer.h>
33 #ifdef _MSC_VER
34 #pragma warning(pop)
35 #endif
36
37 #include <IVtk_Types.hxx>
38 #include <IVtkTools_DisplayModeFilter.hxx>
39 #include <IVtkTools_SubPolyDataFilter.hxx>
40
41 typedef NCollection_DataMap <IVtk_IdType, vtkSmartPointer<IVtkTools_DisplayModeFilter> > DisplayModeFiltersMap;
42 typedef NCollection_DataMap <IVtk_IdType, vtkSmartPointer<IVtkTools_SubPolyDataFilter> > SubShapesFiltersMap;
43
44 class IVtkDraw_HighlightAndSelectionPipeline;
45 DEFINE_STANDARD_HANDLE(IVtkDraw_HighlightAndSelectionPipeline, Standard_Transient)
46
47 class IVtkDraw_HighlightAndSelectionPipeline : public Standard_Transient
48 {
49 public:
50
51   DEFINE_STANDARD_RTTIEXT(IVtkDraw_HighlightAndSelectionPipeline,Standard_Transient)
52
53 public:
54
55   //! Filters comprising the pipeline.
56   enum FilterId
57   {
58     Filter_DM_Shape = 1, //!< Display Mode filter for shape.
59     Filter_DM_Hili,      //!< Display Mode filter for highlighting.
60     Filter_DM_Sel,       //!< Display Mode filter for selection.
61     Filter_SUB_Hili,     //!< Sub-shapes filter for highlighting.
62     Filter_SUB_Sel       //!< Sub-shapes filter for selection.
63   };
64
65 public:
66
67   IVtkDraw_HighlightAndSelectionPipeline (const TopoDS_Shape& theShape,
68                                           const Standard_Integer theShapeID);
69   ~IVtkDraw_HighlightAndSelectionPipeline() {}
70
71 public:
72
73   void AddToRenderer (vtkRenderer* theRenderer);
74   void RemoveFromRenderer (vtkRenderer* theRenderer);
75
76   inline vtkActor* Actor() { return myActor; }
77   inline vtkMapper* Mapper() { return myMapper; }
78
79   void ClearHighlightFilters();
80   void ClearSelectionFilters();
81
82   IVtkTools_DisplayModeFilter* GetDisplayModeFilter();
83   IVtkTools_SubPolyDataFilter* GetHighlightFilter();
84   IVtkTools_SubPolyDataFilter* GetSelectionFilter();
85   IVtkTools_DisplayModeFilter* GetHighlightDMFilter();
86   IVtkTools_DisplayModeFilter* GetSelectionDMFilter();
87
88   void SharedVerticesSelectionOn();
89   void SharedVerticesSelectionOff();
90
91 private:
92
93   //! Auxiliary map of internal filters by their correspondent IDs.
94   typedef NCollection_DataMap <FilterId, vtkSmartPointer<vtkAlgorithm> > FilterMap;
95
96 private:
97
98   //! Actor.
99   vtkSmartPointer<vtkActor> myActor;
100
101   //! Polygonal mapper.
102   vtkSmartPointer<vtkPolyDataMapper> myMapper;
103
104   //! Actor for highlighting.
105   vtkSmartPointer<vtkActor> myHiliActor;
106
107   //! Polygonal mapper for highlighting.
108   vtkSmartPointer<vtkPolyDataMapper> myHiliMapper;
109
110   //! Actor for selection.
111   vtkSmartPointer<vtkActor> mySelActor;
112
113   //! Polygonal mapper for selection.
114   vtkSmartPointer<vtkPolyDataMapper> mySelMapper;
115
116   //! Map of involved VTK filters.
117   FilterMap myFilterMap;
118
119 };
120
121 //! Mapping between OCCT topological shape IDs and their correspondent
122 //! visualization pipelines.
123 typedef NCollection_Shared< NCollection_DataMap<IVtk_IdType, Handle(IVtkDraw_HighlightAndSelectionPipeline)> > ShapePipelineMap;
124
125 #endif