Salome HOME
Merge branch 'Pre_2.8.0_development'
[modules/shaper.git] / src / ModuleBase / ModuleBase_ViewerFilters.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef ModuleBase_ViewerFilters_H
22 #define ModuleBase_ViewerFilters_H
23
24 #include <QStringList>
25
26 #include <SelectMgr_Filter.hxx>
27 #include <SelectMgr_EntityOwner.hxx>
28
29 #include <GeomAPI_Pln.h>
30
31
32 class ModuleBase_IWorkshop;
33
34
35 /**
36 * \class ModuleBase_ShapeDocumentFilter
37 * \ingroup GUI
38 * A filter which provides filtering of selection in 3d viewer.
39 * Installing of this filter lets to select objects which belong to 
40 * currently active document or to global document
41 */
42 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter);
43 class ModuleBase_ShapeDocumentFilter: public SelectMgr_Filter
44 {
45 public:
46   /// Constructor
47   /// \param theWorkshop instance of workshop interface
48   Standard_EXPORT
49     ModuleBase_ShapeDocumentFilter(ModuleBase_IWorkshop* theWorkshop): SelectMgr_Filter(),
50     myWorkshop(theWorkshop) {}
51
52   /// Returns True if the given owner is acceptable for selection
53   /// \param theOwner the selected owner
54   Standard_EXPORT virtual
55     Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
56
57   DEFINE_STANDARD_RTTIEXT(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter)
58
59 protected:
60   /// Reference to workshop
61   ModuleBase_IWorkshop* myWorkshop;
62 };
63
64 /**
65 * \class ModuleBase_ShapeInPlaneFilter
66 * \ingroup GUI
67 * A filter which provides filtering of selection in 3d viewer.
68 * Installing of this filter lets to select of Vertexes and Edges which belongs to the given plane
69 */
70 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter);
71 class ModuleBase_ShapeInPlaneFilter: public SelectMgr_Filter
72 {
73 public:
74   /// Constructor
75   Standard_EXPORT ModuleBase_ShapeInPlaneFilter(): SelectMgr_Filter() {}
76
77   /// Set working plane
78   /// \param thePlane a plane object
79   void setPlane(const std::shared_ptr<GeomAPI_Pln>& thePlane) { myPlane = thePlane; }
80
81   /// Returns current working plane
82   std::shared_ptr<GeomAPI_Pln> plane() const { return myPlane; }
83
84   /// Returns True if the given owner is acceptable for selection
85   /// \param theOwner the selected owner
86   Standard_EXPORT virtual
87     Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
88
89   DEFINE_STANDARD_RTTIEXT(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter)
90 private:
91   /// Working plane
92   std::shared_ptr<GeomAPI_Pln> myPlane;
93 };
94
95 #endif