1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef ModuleBase_ViewerFilters_H
21 #define ModuleBase_ViewerFilters_H
23 #include <QStringList>
25 #include <SelectMgr_Filter.hxx>
26 #include <SelectMgr_EntityOwner.hxx>
28 #include <GeomAPI_Pln.h>
31 class ModuleBase_IWorkshop;
35 * \class ModuleBase_ShapeDocumentFilter
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
41 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter);
42 class ModuleBase_ShapeDocumentFilter: public SelectMgr_Filter
46 /// \param theWorkshop instance of workshop interface
48 ModuleBase_ShapeDocumentFilter(ModuleBase_IWorkshop* theWorkshop): SelectMgr_Filter(),
49 myWorkshop(theWorkshop) {}
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;
56 /// Add an object type name to list of non selectable objects
57 /// \param theType - a name of an object type
58 Standard_EXPORT void addNonSelectableType(const QString& theType)
60 if (!myNonSelectableTypes.contains(theType))
61 myNonSelectableTypes.append(theType);
64 /// Removes an object type name from list of non selectable objects
65 /// \param theType - a name of an object type
66 Standard_EXPORT void removeNonSelectableType(const QString& theType)
68 if (myNonSelectableTypes.contains(theType))
69 myNonSelectableTypes.removeAll(theType);
72 /// Returns list of non-selectable an object type names
73 Standard_EXPORT QStringList nonSelectableTypes() const
75 return myNonSelectableTypes;
78 DEFINE_STANDARD_RTTIEXT(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter)
81 /// Reference to workshop
82 ModuleBase_IWorkshop* myWorkshop;
84 QStringList myNonSelectableTypes;
88 * \class ModuleBase_ShapeInPlaneFilter
90 * A filter which provides filtering of selection in 3d viewer.
91 * Installing of this filter lets to select of Vertexes and Edges which belongs to the given plane
93 DEFINE_STANDARD_HANDLE(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter);
94 class ModuleBase_ShapeInPlaneFilter: public SelectMgr_Filter
98 Standard_EXPORT ModuleBase_ShapeInPlaneFilter(): SelectMgr_Filter() {}
100 /// Set working plane
101 /// \param thePlane a plane object
102 void setPlane(const std::shared_ptr<GeomAPI_Pln>& thePlane) { myPlane = thePlane; }
104 /// Returns current working plane
105 std::shared_ptr<GeomAPI_Pln> plane() const { return myPlane; }
107 /// Returns True if the given owner is acceptable for selection
108 /// \param theOwner the selected owner
109 Standard_EXPORT virtual
110 Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
112 DEFINE_STANDARD_RTTIEXT(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter)
115 std::shared_ptr<GeomAPI_Pln> myPlane;