SHAPER  9.13.0
ModuleBase_ViewerFilters.h
1 // Copyright (C) 2014-2024 CEA, EDF
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 
32 
33 
41 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter);
43 {
44 public:
47  Standard_EXPORT
49  myWorkshop(theWorkshop) {}
50 
53  Standard_EXPORT virtual
54  Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
55 
58  Standard_EXPORT void addNonSelectableType(const QString& theType)
59  {
60  if (!myNonSelectableTypes.contains(theType))
61  myNonSelectableTypes.append(theType);
62  }
63 
66  Standard_EXPORT void removeNonSelectableType(const QString& theType)
67  {
68  if (myNonSelectableTypes.contains(theType))
69  myNonSelectableTypes.removeAll(theType);
70  }
71 
73  Standard_EXPORT QStringList nonSelectableTypes() const
74  {
75  return myNonSelectableTypes;
76  }
77 
78  DEFINE_STANDARD_RTTIEXT(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter)
79 
80 protected:
82  ModuleBase_IWorkshop* myWorkshop;
83 
84  QStringList myNonSelectableTypes;
85 };
86 
93 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter);
95 {
96 public:
99 
102  void setPlane(const std::shared_ptr<GeomAPI_Pln>& thePlane) { myPlane = thePlane; }
103 
105  std::shared_ptr<GeomAPI_Pln> plane() const { return myPlane; }
106 
109  Standard_EXPORT virtual
110  Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
111 
112  DEFINE_STANDARD_RTTIEXT(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter)
113 private:
115  std::shared_ptr<GeomAPI_Pln> myPlane;
116 };
117 
118 #endif
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
A filter which provides filtering of selection in 3d viewer.
Definition: ModuleBase_ViewerFilters.h:43
virtual Standard_Boolean IsOk(const Handle &&theOwner) const
Returns True if the given owner is acceptable for selection.
Definition: ModuleBase_ViewerFilters.cpp:60
void addNonSelectableType(const QString &theType)
Add an object type name to list of non selectable objects.
Definition: ModuleBase_ViewerFilters.h:58
QStringList nonSelectableTypes() const
Returns list of non-selectable an object type names.
Definition: ModuleBase_ViewerFilters.h:73
void removeNonSelectableType(const QString &theType)
Removes an object type name from list of non selectable objects.
Definition: ModuleBase_ViewerFilters.h:66
ModuleBase_ShapeDocumentFilter(ModuleBase_IWorkshop *theWorkshop)
Constructor.
Definition: ModuleBase_ViewerFilters.h:48
A filter which provides filtering of selection in 3d viewer.
Definition: ModuleBase_ViewerFilters.h:95
void setPlane(const std::shared_ptr< GeomAPI_Pln > &thePlane)
Set working plane.
Definition: ModuleBase_ViewerFilters.h:102
ModuleBase_ShapeInPlaneFilter()
Constructor.
Definition: ModuleBase_ViewerFilters.h:98
std::shared_ptr< GeomAPI_Pln > plane() const
Returns current working plane.
Definition: ModuleBase_ViewerFilters.h:105
virtual Standard_Boolean IsOk(const Handle &&theOwner) const
Returns True if the given owner is acceptable for selection.
Definition: ModuleBase_ViewerFilters.cpp:104