Salome HOME
Merge branch 'Dev_0.7.1' of newgeom:newgeom into Dev_0.7.1
[modules/shaper.git] / src / ModuleBase / ModuleBase_ViewerFilters.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModuleBase_ViewerFilters.h
4 // Created:     07 Okt 2014
5 // Author:      Vitaly SMETANNIKOV
6
7
8 #ifndef ModuleBase_ViewerFilters_H
9 #define ModuleBase_ViewerFilters_H
10
11 #include <QStringList>
12
13 #include <SelectMgr_Filter.hxx>
14 #include <SelectMgr_EntityOwner.hxx>
15 #include <gp_Pln.hxx>
16
17
18 class ModuleBase_IWorkshop;
19
20
21 /**
22 * \class ModuleBase_ShapeDocumentFilter
23 * A filter which provides filtering of selection in 3d viewer.
24 * Installing of this filter lets to select objects which belong to 
25 * currently active document or to global document
26 */
27 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter);
28 class ModuleBase_ShapeDocumentFilter: public SelectMgr_Filter
29 {
30 public:
31   /// Constructor
32   /// \param theWorkshop instance of workshop interface
33   Standard_EXPORT ModuleBase_ShapeDocumentFilter(ModuleBase_IWorkshop* theWorkshop): SelectMgr_Filter(),
34     myWorkshop(theWorkshop) {}
35
36   /// Returns True if the given owner is acceptable for selection
37   /// \param theOwner the selected owner
38   Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
39
40   DEFINE_STANDARD_RTTI(ModuleBase_ShapeDocumentFilter)
41
42 protected:
43   /// Reference to workshop
44   ModuleBase_IWorkshop* myWorkshop;
45 };
46
47 /**
48 * \class ModuleBase_ShapeInPlaneFilter
49 * A filter which provides filtering of selection in 3d viewer.
50 * Installing of this filter lets to select of Vertexes and Edges which belongs to the given plane
51 */
52 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter);
53 class ModuleBase_ShapeInPlaneFilter: public SelectMgr_Filter
54 {
55 public:
56   /// Constructor
57   Standard_EXPORT ModuleBase_ShapeInPlaneFilter(): SelectMgr_Filter() {}
58
59   /// Set working plane
60   /// \param thePane plane object
61   void setPlane(const gp_Pln& thePane) { myPlane = thePane; }
62
63   /// Returns current working plane
64   gp_Pln plane() const { return myPlane; }
65
66   /// Returns True if the given owner is acceptable for selection
67   /// \param theOwner the selected owner
68   Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
69
70   DEFINE_STANDARD_RTTI(ModuleBase_ShapeInPlaneFilter)
71 private:
72   /// Working plane
73   gp_Pln myPlane;
74 };
75
76
77 /**
78 * \class ModuleBase_ObjectTypesFilter
79 * A filter which provides filtering of selection in 3d viewer.
80 * Installing of this filter lets to select only object of requested type
81 * Accepts following objects types:
82 * - "construction" - to select ModelAPI_ResultConstruction objects
83 */
84 DEFINE_STANDARD_HANDLE(ModuleBase_ObjectTypesFilter, SelectMgr_Filter);
85 class ModuleBase_ObjectTypesFilter: public ModuleBase_ShapeDocumentFilter
86 {
87 public:
88   /// Constructor
89   /// \param theWorkshop instance of workshop interface
90   /// \param theTypes list of object types
91   Standard_EXPORT ModuleBase_ObjectTypesFilter(ModuleBase_IWorkshop* theWorkshop, const QStringList& theTypes): 
92       ModuleBase_ShapeDocumentFilter(theWorkshop), myTypes(theTypes) {}
93
94   /// Returns True if the given owner is acceptable for selection
95   /// \param theOwner the selected owner
96   Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
97
98   DEFINE_STANDARD_RTTI(ModuleBase_ObjectTypesFilter)
99 private:
100   /// List of object types
101   QStringList myTypes;
102 };
103
104 #endif