1 // Created on: 2012-04-02
3 // Copyright (c) 2012-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _IVtkDraw_HighlightAndSelectionPipeline_HeaderFile
17 #define _IVtkDraw_HighlightAndSelectionPipeline_HeaderFile
19 #ifndef _Standard_HeaderFile
20 #include <Standard.hxx>
22 #ifndef _Standard_Macro_HeaderFile
23 #include <Standard_Macro.hxx>
25 #ifndef _Handle_MMgt_TShared_HeaderFile
28 #include <NCollection_DataMap.hxx>
29 #include <NCollection_Handle.hxx>
30 #include <Standard_Transient.hxx>
31 #include <TopoDS_Shape.hxx>
34 #include <vtkPolyData.h>
35 #include <vtkPolyDataMapper.h>
36 #include <vtkRenderer.h>
37 #include <vtkSmartPointer.h>
39 #include <IVtk_Types.hxx>
40 #include <IVtkTools_DisplayModeFilter.hxx>
41 #include <IVtkTools_SubPolyDataFilter.hxx>
43 typedef NCollection_DataMap <IVtk_IdType, vtkSmartPointer<IVtkTools_DisplayModeFilter> > DisplayModeFiltersMap;
44 typedef NCollection_DataMap <IVtk_IdType, vtkSmartPointer<IVtkTools_SubPolyDataFilter> > SubShapesFiltersMap;
46 DEFINE_STANDARD_HANDLE(IVtkDraw_HighlightAndSelectionPipeline, Standard_Transient)
48 class IVtkDraw_HighlightAndSelectionPipeline : public Standard_Transient
52 DEFINE_STANDARD_RTTI(IVtkDraw_HighlightAndSelectionPipeline, Standard_Transient)
56 //! Filters comprising the pipeline.
59 Filter_DM_Shape = 1, //!< Display Mode filter for shape.
60 Filter_DM_Hili, //!< Display Mode filter for highlighting.
61 Filter_DM_Sel, //!< Display Mode filter for selection.
62 Filter_SUB_Hili, //!< Sub-shapes filter for highlighting.
63 Filter_SUB_Sel //!< Sub-shapes filter for selection.
68 IVtkDraw_HighlightAndSelectionPipeline (const TopoDS_Shape& theShape,
69 const Standard_Integer theShapeID);
70 ~IVtkDraw_HighlightAndSelectionPipeline() {}
74 void AddToRenderer (vtkRenderer* theRenderer);
75 void RemoveFromRenderer (vtkRenderer* theRenderer);
77 inline vtkActor* Actor() { return myActor; }
78 inline vtkMapper* Mapper() { return myMapper; }
80 void ClearHighlightFilters();
81 void ClearSelectionFilters();
83 IVtkTools_DisplayModeFilter* GetDisplayModeFilter();
84 IVtkTools_SubPolyDataFilter* GetHighlightFilter();
85 IVtkTools_SubPolyDataFilter* GetSelectionFilter();
86 IVtkTools_DisplayModeFilter* GetHighlightDMFilter();
87 IVtkTools_DisplayModeFilter* GetSelectionDMFilter();
89 void SharedVerticesSelectionOn();
90 void SharedVerticesSelectionOff();
94 //! Auxiliary map of internal filters by their correspondent IDs.
95 typedef NCollection_DataMap <FilterId, vtkSmartPointer<vtkAlgorithm> > FilterMap;
100 vtkSmartPointer<vtkActor> myActor;
102 //! Polygonal mapper.
103 vtkSmartPointer<vtkPolyDataMapper> myMapper;
105 //! Actor for highlighting.
106 vtkSmartPointer<vtkActor> myHiliActor;
108 //! Polygonal mapper for highlighting.
109 vtkSmartPointer<vtkPolyDataMapper> myHiliMapper;
111 //! Actor for selection.
112 vtkSmartPointer<vtkActor> mySelActor;
114 //! Polygonal mapper for selection.
115 vtkSmartPointer<vtkPolyDataMapper> mySelMapper;
117 //! Map of involved VTK filters.
118 FilterMap myFilterMap;
122 //! Mapping between OCCT topological shape IDs and their correspondent
123 //! visualization pipelines.
124 typedef NCollection_DataMap<IVtk_IdType, Handle(IVtkDraw_HighlightAndSelectionPipeline)> ShapePipelineMap;