Salome HOME
Issue #273: Add copyright string
[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 * A filter which provides filtering of selection in 3d viewer.
23 * Installing of this filter lets to select objects which belong to 
24 * currently active document or to global document
25 */
26 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter);
27 class ModuleBase_ShapeDocumentFilter: public SelectMgr_Filter
28 {
29 public:
30   Standard_EXPORT ModuleBase_ShapeDocumentFilter(ModuleBase_IWorkshop* theWorkshop): SelectMgr_Filter(),
31     myWorkshop(theWorkshop) {}
32
33   Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
34
35   DEFINE_STANDARD_RTTI(ModuleBase_ShapeDocumentFilter)
36
37 protected:
38   ModuleBase_IWorkshop* myWorkshop;
39 };
40
41 /**
42 * A filter which provides filtering of selection in 3d viewer.
43 * Installing of this filter lets to select of Vertexes and Edges which belongs to the given plane
44 */
45 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter);
46 class ModuleBase_ShapeInPlaneFilter: public SelectMgr_Filter
47 {
48 public:
49   Standard_EXPORT ModuleBase_ShapeInPlaneFilter(): SelectMgr_Filter() {}
50
51   void setPlane(const gp_Pln& thePane) { myPlane = thePane; }
52   gp_Pln plane() const { return myPlane; }
53
54   Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
55
56   DEFINE_STANDARD_RTTI(ModuleBase_ShapeInPlaneFilter)
57 private:
58   gp_Pln myPlane;
59 };
60
61
62 /**
63 * A filter which provides filtering of selection in 3d viewer.
64 * Installing of this filter lets to select only object of requested type
65 */
66 DEFINE_STANDARD_HANDLE(ModuleBase_ObjectTypesFilter, SelectMgr_Filter);
67 class ModuleBase_ObjectTypesFilter: public ModuleBase_ShapeDocumentFilter
68 {
69 public:
70   Standard_EXPORT ModuleBase_ObjectTypesFilter(ModuleBase_IWorkshop* theWorkshop, const QStringList& theTypes): 
71       ModuleBase_ShapeDocumentFilter(theWorkshop), myTypes(theTypes) {}
72
73   Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
74
75   DEFINE_STANDARD_RTTI(ModuleBase_ObjectTypesFilter)
76 private:
77   QStringList myTypes;
78 };
79
80 #endif