897aeb20 |
1 | // Copyright (c) 2020 OPEN CASCADE SAS |
2 | // |
3 | // This file is part of Open CASCADE Technology software library. |
4 | // |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
10 | // |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
13 | |
14 | #ifndef _SelectMgr_AndOrFilter_HeaderFile |
15 | #define _SelectMgr_AndOrFilter_HeaderFile |
16 | |
17 | #include <Standard.hxx> |
18 | #include <Standard_Type.hxx> |
19 | |
20 | #include <Graphic3d_NMapOfTransient.hxx> |
897aeb20 |
21 | #include <SelectMgr_CompositionFilter.hxx> |
22 | #include <SelectMgr_FilterType.hxx> |
23 | |
24 | DEFINE_STANDARD_HANDLE(SelectMgr_AndOrFilter, SelectMgr_CompositionFilter) |
25 | |
26 | //! A framework to define an OR or AND selection filter. |
27 | //! To use an AND selection filter call SetUseOrFilter with False parameter. |
28 | //! By default the OR selection filter is used. |
29 | class SelectMgr_AndOrFilter : public SelectMgr_CompositionFilter |
30 | { |
31 | |
32 | public: |
33 | |
34 | //! Constructs an empty selection filter. |
35 | Standard_EXPORT SelectMgr_AndOrFilter (const SelectMgr_FilterType theFilterType); |
36 | |
37 | //! Indicates that the selected Interactive Object passes the filter. |
38 | Standard_EXPORT virtual Standard_Boolean IsOk (const Handle(SelectMgr_EntityOwner)& theObj) const Standard_OVERRIDE; |
39 | |
40 | //! Disable selection of specified objects. |
41 | Standard_EXPORT void SetDisabledObjects (const Handle(Graphic3d_NMapOfTransient)& theObjects); |
42 | |
43 | //! @return a selection filter type (@sa SelectMgr_FilterType). |
44 | SelectMgr_FilterType FilterType() const { return myFilterType; } |
45 | |
46 | //! Sets a selection filter type. |
47 | //! SelectMgr_FilterType_OR selection filter is used be default. |
48 | //! @param theFilterType the filter type. |
49 | void SetFilterType (const SelectMgr_FilterType theFilterType) { myFilterType = theFilterType; } |
50 | |
51 | DEFINE_STANDARD_RTTIEXT(SelectMgr_AndOrFilter, SelectMgr_CompositionFilter) |
52 | |
53 | private: |
54 | |
55 | Handle(Graphic3d_NMapOfTransient) myDisabledObjects; //!< disabled objects. |
56 | //! Selection isn't applied to these objects. |
57 | SelectMgr_FilterType myFilterType; //!< selection filter type. SelectMgr_TypeFilter_OR by default. |
58 | }; |
59 | |
60 | #endif // _SelectMgr_AndOrFilter_HeaderFile |