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