0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / IVtkTools / IVtkTools_DisplayModeFilter.hxx
1 // Created on: 2011-11-15
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_DISPLAYMODEFILTER_H
17 #define IVtkTOOLS_DISPLAYMODEFILTER_H
18
19 #include <IVtkTools.hxx>
20 #include <IVtkTools_SubPolyDataFilter.hxx>
21 #include <NCollection_DataMap.hxx>
22
23 #ifdef _MSC_VER
24 #pragma warning(push)
25 #pragma warning(disable: 4251) // avoid warning C4251: "class needs to have dll-interface..."
26 #endif
27
28 //! @class IVtkTools_DisplayModeFilter 
29 //! @brief Cells filter according to the selected display mode by mesh parts types.
30 //! This filter is used to get parts of a shape according to different 
31 //! display modes.
32 class Standard_EXPORT IVtkTools_DisplayModeFilter : public IVtkTools_SubPolyDataFilter
33 {
34 public:
35   vtkTypeMacro(IVtkTools_DisplayModeFilter,IVtkTools_SubPolyDataFilter)
36
37   static IVtkTools_DisplayModeFilter *New();
38   void PrintSelf (std::ostream& os, vtkIndent indent);
39
40   //! Set display mode to define cells types to be passed through this filter.
41   void SetDisplayMode (const IVtk_DisplayMode aMode);
42
43   //! Display or not shared vertices.
44   void SetDisplaySharedVertices (const bool doDisplay);
45
46   //! Get current display mode.
47   IVtk_DisplayMode GetDisplayMode() const;
48
49   //! Returns list of displaying mesh element types for the given display mode
50   const IVtk_IdTypeMap& MeshTypesForMode(IVtk_DisplayMode theMode) const;
51
52   //! Set a list of displaying mesh element types for the given display mode
53   void SetMeshTypesForMode(IVtk_DisplayMode theMode, const IVtk_IdTypeMap& theMeshTypes);
54
55   //! Draw Boundary of faces for shading mode
56   void SetFaceBoundaryDraw(bool theToDraw);
57
58   //! Returns True if drawing Boundary of faces for shading mode is defined.
59   bool FaceBoundaryDraw() const { return myDrawFaceBoundaries; }
60
61 protected:
62   //! Filter cells according to the given set of ids.
63   virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *);
64
65   IVtkTools_DisplayModeFilter();
66   virtual ~IVtkTools_DisplayModeFilter();
67
68 protected:
69   //! Display mode defining mesh types to pass through this filter.
70   IVtk_DisplayMode      myDisplayMode;
71   IVtk_IdTypeMap        myModesDefinition[2];
72   bool                  myDoDisplaySharedVertices;
73
74   //! Draw Face boundaries flag is applicable only for shading display mode.
75   bool                  myDrawFaceBoundaries;
76 };
77
78 #ifdef _MSC_VER
79 #pragma warning(pop)
80 #endif
81
82 #endif // IVtkTOOLS_DISPLAYMODEFILTER_H
83