1 // Created on: 1997-11-28
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _AIS_ExclusionFilter_HeaderFile
18 #define _AIS_ExclusionFilter_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Boolean.hxx>
24 #include <TColStd_DataMapOfIntegerListOfInteger.hxx>
25 #include <SelectMgr_Filter.hxx>
26 #include <AIS_KindOfInteractive.hxx>
27 #include <Standard_Integer.hxx>
28 #include <TColStd_ListOfInteger.hxx>
29 class SelectMgr_EntityOwner;
31 class AIS_ExclusionFilter;
32 DEFINE_STANDARD_HANDLE(AIS_ExclusionFilter, SelectMgr_Filter)
34 //! A framework to reject or to accept only objects of
35 //! given types and/or signatures.
36 //! Objects are stored, and the stored objects - along
37 //! with the flag settings - are used to define the filter.
38 //! Objects to be filtered are compared with the stored
39 //! objects added to the filter, and are accepted or
40 //! rejected according to the exclusion flag setting.
41 //! - Exclusion flag on
42 //! - the function IsOk answers true for all objects,
43 //! except those of the types and signatures stored
44 //! in the filter framework
45 //! - Exclusion flag off
46 //! - the funciton IsOk answers true for all objects
47 //! which have the same type and signature as the stored ones.
48 class AIS_ExclusionFilter : public SelectMgr_Filter
54 //! Constructs an empty exclusion filter object defined by
55 //! the flag setting ExclusionFlagOn.
56 //! By default, the flag is set to true.
57 Standard_EXPORT AIS_ExclusionFilter(const Standard_Boolean ExclusionFlagOn = Standard_True);
59 //! All the AIS objects of <TypeToExclude>
60 //! Will be rejected by the IsOk Method.
61 Standard_EXPORT AIS_ExclusionFilter(const AIS_KindOfInteractive TypeToExclude, const Standard_Boolean ExclusionFlagOn = Standard_True);
63 //! Constructs an exclusion filter object defined by the
64 //! enumeration value TypeToExclude, the signature
65 //! SignatureInType, and the flag setting ExclusionFlagOn.
66 //! By default, the flag is set to true.
67 Standard_EXPORT AIS_ExclusionFilter(const AIS_KindOfInteractive TypeToExclude, const Standard_Integer SignatureInType, const Standard_Boolean ExclusionFlagOn = Standard_True);
69 Standard_EXPORT virtual Standard_Boolean IsOk (const Handle(SelectMgr_EntityOwner)& anObj) const Standard_OVERRIDE;
71 //! Adds the type TypeToExclude to the list of types.
72 Standard_EXPORT Standard_Boolean Add (const AIS_KindOfInteractive TypeToExclude);
74 Standard_EXPORT Standard_Boolean Add (const AIS_KindOfInteractive TypeToExclude, const Standard_Integer SignatureInType);
76 Standard_EXPORT Standard_Boolean Remove (const AIS_KindOfInteractive TypeToExclude);
78 Standard_EXPORT Standard_Boolean Remove (const AIS_KindOfInteractive TypeToExclude, const Standard_Integer SignatureInType);
80 Standard_EXPORT void Clear();
82 Standard_Boolean IsExclusionFlagOn() const { return myIsExclusionFlagOn; }
84 void SetExclusionFlag (const Standard_Boolean theStatus) { myIsExclusionFlagOn = theStatus; }
86 Standard_EXPORT Standard_Boolean IsStored (const AIS_KindOfInteractive aType) const;
88 Standard_EXPORT void ListOfStoredTypes (TColStd_ListOfInteger& TheList) const;
90 Standard_EXPORT void ListOfSignature (const AIS_KindOfInteractive aType, TColStd_ListOfInteger& TheStoredList) const;
92 DEFINE_STANDARD_RTTIEXT(AIS_ExclusionFilter,SelectMgr_Filter)
96 Standard_EXPORT Standard_Boolean IsSignatureIn (const AIS_KindOfInteractive aType, const Standard_Integer aSignature) const;
98 Standard_Boolean myIsExclusionFlagOn;
99 TColStd_DataMapOfIntegerListOfInteger myStoredTypes;
103 #endif // _AIS_ExclusionFilter_HeaderFile