Salome HOME
Update copyrights
[modules/shaper.git] / src / ModuleBase / ModuleBase_ViewerFilters.h
1 // Copyright (C) 2014-2019  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 email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef ModuleBase_ViewerFilters_H
21 #define ModuleBase_ViewerFilters_H
22
23 #include <QStringList>
24
25 #include <SelectMgr_Filter.hxx>
26 #include <SelectMgr_EntityOwner.hxx>
27
28 #include <GeomAPI_Pln.h>
29
30
31 class ModuleBase_IWorkshop;
32
33
34 /**
35 * \class ModuleBase_ShapeDocumentFilter
36 * \ingroup GUI
37 * A filter which provides filtering of selection in 3d viewer.
38 * Installing of this filter lets to select objects which belong to 
39 * currently active document or to global document
40 */
41 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter);
42 class ModuleBase_ShapeDocumentFilter: public SelectMgr_Filter
43 {
44 public:
45   /// Constructor
46   /// \param theWorkshop instance of workshop interface
47   Standard_EXPORT
48     ModuleBase_ShapeDocumentFilter(ModuleBase_IWorkshop* theWorkshop): SelectMgr_Filter(),
49     myWorkshop(theWorkshop) {}
50
51   /// Returns True if the given owner is acceptable for selection
52   /// \param theOwner the selected owner
53   Standard_EXPORT virtual
54     Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
55
56   DEFINE_STANDARD_RTTIEXT(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter)
57
58 protected:
59   /// Reference to workshop
60   ModuleBase_IWorkshop* myWorkshop;
61 };
62
63 /**
64 * \class ModuleBase_ShapeInPlaneFilter
65 * \ingroup GUI
66 * A filter which provides filtering of selection in 3d viewer.
67 * Installing of this filter lets to select of Vertexes and Edges which belongs to the given plane
68 */
69 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter);
70 class ModuleBase_ShapeInPlaneFilter: public SelectMgr_Filter
71 {
72 public:
73   /// Constructor
74   Standard_EXPORT ModuleBase_ShapeInPlaneFilter(): SelectMgr_Filter() {}
75
76   /// Set working plane
77   /// \param thePlane a plane object
78   void setPlane(const std::shared_ptr<GeomAPI_Pln>& thePlane) { myPlane = thePlane; }
79
80   /// Returns current working plane
81   std::shared_ptr<GeomAPI_Pln> plane() const { return myPlane; }
82
83   /// Returns True if the given owner is acceptable for selection
84   /// \param theOwner the selected owner
85   Standard_EXPORT virtual
86     Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
87
88   DEFINE_STANDARD_RTTIEXT(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter)
89 private:
90   /// Working plane
91   std::shared_ptr<GeomAPI_Pln> myPlane;
92 };
93
94 #endif