Salome HOME
Merge branch 'SALOME-8.2.0_porting'
[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
16 #include <GeomAPI_Pln.h>
17
18
19 class ModuleBase_IWorkshop;
20
21
22 /**
23 * \class ModuleBase_ShapeDocumentFilter
24 * \ingroup GUI
25 * A filter which provides filtering of selection in 3d viewer.
26 * Installing of this filter lets to select objects which belong to 
27 * currently active document or to global document
28 */
29 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter);
30 class ModuleBase_ShapeDocumentFilter: public SelectMgr_Filter
31 {
32 public:
33   /// Constructor
34   /// \param theWorkshop instance of workshop interface
35   Standard_EXPORT
36     ModuleBase_ShapeDocumentFilter(ModuleBase_IWorkshop* theWorkshop): SelectMgr_Filter(),
37     myWorkshop(theWorkshop) {}
38
39   /// Returns True if the given owner is acceptable for selection
40   /// \param theOwner the selected owner
41   Standard_EXPORT virtual
42     Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
43
44   DEFINE_STANDARD_RTTIEXT(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter)
45
46 protected:
47   /// Reference to workshop
48   ModuleBase_IWorkshop* myWorkshop;
49 };
50
51 /**
52 * \class ModuleBase_ShapeInPlaneFilter
53 * \ingroup GUI
54 * A filter which provides filtering of selection in 3d viewer.
55 * Installing of this filter lets to select of Vertexes and Edges which belongs to the given plane
56 */
57 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter);
58 class ModuleBase_ShapeInPlaneFilter: public SelectMgr_Filter
59 {
60 public:
61   /// Constructor
62   Standard_EXPORT ModuleBase_ShapeInPlaneFilter(): SelectMgr_Filter() {}
63
64   /// Set working plane
65   /// \param thePlane a plane object
66   void setPlane(const std::shared_ptr<GeomAPI_Pln>& thePlane) { myPlane = thePlane; }
67
68   /// Returns current working plane
69   std::shared_ptr<GeomAPI_Pln> plane() const { return myPlane; }
70
71   /// Returns True if the given owner is acceptable for selection
72   /// \param theOwner the selected owner
73   Standard_EXPORT virtual
74     Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
75
76   DEFINE_STANDARD_RTTIEXT(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter)
77 private:
78   /// Working plane
79   std::shared_ptr<GeomAPI_Pln> myPlane;
80 };
81
82 #endif