0031221: Visualization - selection filter in context
[occt.git] / src / SelectMgr / SelectMgr_AndOrFilter.hxx
CommitLineData
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>
21#include <Standard_Boolean.hxx>
22#include <SelectMgr_CompositionFilter.hxx>
23#include <SelectMgr_FilterType.hxx>
24
25DEFINE_STANDARD_HANDLE(SelectMgr_AndOrFilter, SelectMgr_CompositionFilter)
26
27//! A framework to define an OR or AND selection filter.
28//! To use an AND selection filter call SetUseOrFilter with False parameter.
29//! By default the OR selection filter is used.
30class SelectMgr_AndOrFilter : public SelectMgr_CompositionFilter
31{
32
33public:
34
35 //! Constructs an empty selection filter.
36 Standard_EXPORT SelectMgr_AndOrFilter (const SelectMgr_FilterType theFilterType);
37
38 //! Indicates that the selected Interactive Object passes the filter.
39 Standard_EXPORT virtual Standard_Boolean IsOk (const Handle(SelectMgr_EntityOwner)& theObj) const Standard_OVERRIDE;
40
41 //! Disable selection of specified objects.
42 Standard_EXPORT void SetDisabledObjects (const Handle(Graphic3d_NMapOfTransient)& theObjects);
43
44 //! @return a selection filter type (@sa SelectMgr_FilterType).
45 SelectMgr_FilterType FilterType() const { return myFilterType; }
46
47 //! Sets a selection filter type.
48 //! SelectMgr_FilterType_OR selection filter is used be default.
49 //! @param theFilterType the filter type.
50 void SetFilterType (const SelectMgr_FilterType theFilterType) { myFilterType = theFilterType; }
51
52 DEFINE_STANDARD_RTTIEXT(SelectMgr_AndOrFilter, SelectMgr_CompositionFilter)
53
54private:
55
56 Handle(Graphic3d_NMapOfTransient) myDisabledObjects; //!< disabled objects.
57 //! Selection isn't applied to these objects.
58 SelectMgr_FilterType myFilterType; //!< selection filter type. SelectMgr_TypeFilter_OR by default.
59};
60
61#endif // _SelectMgr_AndOrFilter_HeaderFile