0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / AIS / AIS_ExclusionFilter.hxx
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
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _AIS_ExclusionFilter_HeaderFile
18 #define _AIS_ExclusionFilter_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
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;
30
31
32 class AIS_ExclusionFilter;
33 DEFINE_STANDARD_HANDLE(AIS_ExclusionFilter, SelectMgr_Filter)
34
35 //! A framework to reject or to accept only objects of
36 //! given types and/or signatures.
37 //! Objects are stored, and the stored objects - along
38 //! with the flag settings - are used to define the filter.
39 //! Objects to be filtered are compared with the stored
40 //! objects added to the filter, and are accepted or
41 //! rejected according to the exclusion flag setting.
42 //! -   Exclusion flag on
43 //! -   the function IsOk answers true for all objects,
44 //! except those of the types and signatures stored
45 //! in the filter framework
46 //! -   Exclusion flag off
47 //! -   the funciton IsOk answers true for all objects
48 //! which have the same type and signature as the stored ones.
49 class AIS_ExclusionFilter : public SelectMgr_Filter
50 {
51
52 public:
53
54   
55   //! Constructs an empty exclusion filter object defined by
56   //! the flag setting ExclusionFlagOn.
57   //! By default, the flag is set to true.
58   Standard_EXPORT AIS_ExclusionFilter(const Standard_Boolean ExclusionFlagOn = Standard_True);
59   
60   //! All the AIS objects of <TypeToExclude>
61   //! Will be rejected by the IsOk Method.
62   Standard_EXPORT AIS_ExclusionFilter(const AIS_KindOfInteractive TypeToExclude, const Standard_Boolean ExclusionFlagOn = Standard_True);
63   
64   //! Constructs an exclusion filter object defined by the
65   //! enumeration value TypeToExclude, the signature
66   //! SignatureInType, and the flag setting ExclusionFlagOn.
67   //! By default, the flag is set to true.
68   Standard_EXPORT AIS_ExclusionFilter(const AIS_KindOfInteractive TypeToExclude, const Standard_Integer SignatureInType, const Standard_Boolean ExclusionFlagOn = Standard_True);
69   
70   Standard_EXPORT virtual Standard_Boolean IsOk (const Handle(SelectMgr_EntityOwner)& anObj) const Standard_OVERRIDE;
71   
72   //! Adds the type TypeToExclude to the list of types.
73   Standard_EXPORT Standard_Boolean Add (const AIS_KindOfInteractive TypeToExclude);
74   
75   Standard_EXPORT Standard_Boolean Add (const AIS_KindOfInteractive TypeToExclude, const Standard_Integer SignatureInType);
76   
77   Standard_EXPORT Standard_Boolean Remove (const AIS_KindOfInteractive TypeToExclude);
78   
79   Standard_EXPORT Standard_Boolean Remove (const AIS_KindOfInteractive TypeToExclude, const Standard_Integer SignatureInType);
80   
81   Standard_EXPORT void Clear();
82   
83     Standard_Boolean IsExclusionFlagOn() const;
84   
85     void SetExclusionFlag (const Standard_Boolean Status);
86   
87   Standard_EXPORT Standard_Boolean IsStored (const AIS_KindOfInteractive aType) const;
88   
89   Standard_EXPORT void ListOfStoredTypes (TColStd_ListOfInteger& TheList) const;
90   
91   Standard_EXPORT void ListOfSignature (const AIS_KindOfInteractive aType, TColStd_ListOfInteger& TheStoredList) const;
92
93
94
95
96   DEFINE_STANDARD_RTTI(AIS_ExclusionFilter,SelectMgr_Filter)
97
98 protected:
99
100
101
102
103 private:
104
105   
106   Standard_EXPORT Standard_Boolean IsSignatureIn (const AIS_KindOfInteractive aType, const Standard_Integer aSignature) const;
107
108   Standard_Boolean myIsExclusionFlagOn;
109   TColStd_DataMapOfIntegerListOfInteger myStoredTypes;
110
111
112 };
113
114
115 #include <AIS_ExclusionFilter.lxx>
116
117
118
119
120
121 #endif // _AIS_ExclusionFilter_HeaderFile