Salome HOME
Merge remote-tracking branch 'origin/Dev_0.6'
[modules/shaper.git] / src / ModuleBase / ModuleBase_ViewerFilters.h
1 // File:        ModuleBase_ViewerFilters.h
2 // Created:     07 Okt 2014
3 // Author:      Vitaly SMETANNIKOV
4
5
6 #ifndef ModuleBase_ViewerFilters_H
7 #define ModuleBase_ViewerFilters_H
8
9 #include <QStringList>
10
11 #include <SelectMgr_Filter.hxx>
12 #include <SelectMgr_EntityOwner.hxx>
13 #include <gp_Pln.hxx>
14
15
16 class ModuleBase_IWorkshop;
17
18
19 /**
20 * A filter which provides filtering of selection in 3d viewer.
21 * Installing of this filter lets to select objects which belong to 
22 * currently active document or to global document
23 */
24 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter);
25 class ModuleBase_ShapeDocumentFilter: public SelectMgr_Filter
26 {
27 public:
28   Standard_EXPORT ModuleBase_ShapeDocumentFilter(ModuleBase_IWorkshop* theWorkshop): SelectMgr_Filter(),
29     myWorkshop(theWorkshop) {}
30
31   Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
32
33   DEFINE_STANDARD_RTTI(ModuleBase_ShapeDocumentFilter)
34
35 protected:
36   ModuleBase_IWorkshop* myWorkshop;
37 };
38
39 /**
40 * A filter which provides filtering of selection in 3d viewer.
41 * Installing of this filter lets to select of Vertexes and Edges which belongs to the given plane
42 */
43 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter);
44 class ModuleBase_ShapeInPlaneFilter: public SelectMgr_Filter
45 {
46 public:
47   Standard_EXPORT ModuleBase_ShapeInPlaneFilter(): SelectMgr_Filter() {}
48
49   void setPlane(const gp_Pln& thePane) { myPlane = thePane; }
50   gp_Pln plane() const { return myPlane; }
51
52   Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
53
54   DEFINE_STANDARD_RTTI(ModuleBase_ShapeInPlaneFilter)
55 private:
56   gp_Pln myPlane;
57 };
58
59
60 /**
61 * A filter which provides filtering of selection in 3d viewer.
62 * Installing of this filter lets to select only object of requested type
63 */
64 DEFINE_STANDARD_HANDLE(ModuleBase_ObjectTypesFilter, SelectMgr_Filter);
65 class ModuleBase_ObjectTypesFilter: public ModuleBase_ShapeDocumentFilter
66 {
67 public:
68   Standard_EXPORT ModuleBase_ObjectTypesFilter(ModuleBase_IWorkshop* theWorkshop, const QStringList& theTypes): 
69       ModuleBase_ShapeDocumentFilter(theWorkshop), myTypes(theTypes) {}
70
71   Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
72
73   DEFINE_STANDARD_RTTI(ModuleBase_ObjectTypesFilter)
74 private:
75   QStringList myTypes;
76 };
77
78 #endif