Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-08 09:15:27

0001 // Created on: 1997-11-28
0002 // Created by: Robert COUBLANC
0003 // Copyright (c) 1997-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _AIS_ExclusionFilter_HeaderFile
0018 #define _AIS_ExclusionFilter_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TColStd_DataMapOfIntegerListOfInteger.hxx>
0024 #include <SelectMgr_Filter.hxx>
0025 #include <AIS_KindOfInteractive.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <TColStd_ListOfInteger.hxx>
0028 class SelectMgr_EntityOwner;
0029 
0030 class AIS_ExclusionFilter;
0031 DEFINE_STANDARD_HANDLE(AIS_ExclusionFilter, SelectMgr_Filter)
0032 
0033 //! A framework to reject or to accept only objects of
0034 //! given types and/or signatures.
0035 //! Objects are stored, and the stored objects - along
0036 //! with the flag settings - are used to define the filter.
0037 //! Objects to be filtered are compared with the stored
0038 //! objects added to the filter, and are accepted or
0039 //! rejected according to the exclusion flag setting.
0040 //! -   Exclusion flag on
0041 //! -   the function IsOk answers true for all objects,
0042 //! except those of the types and signatures stored
0043 //! in the filter framework
0044 //! -   Exclusion flag off
0045 //! -   the function IsOk answers true for all objects
0046 //! which have the same type and signature as the stored ones.
0047 class AIS_ExclusionFilter : public SelectMgr_Filter
0048 {
0049 
0050 public:
0051   //! Constructs an empty exclusion filter object defined by
0052   //! the flag setting ExclusionFlagOn.
0053   //! By default, the flag is set to true.
0054   Standard_EXPORT AIS_ExclusionFilter(const Standard_Boolean ExclusionFlagOn = Standard_True);
0055 
0056   //! All the AIS objects of <TypeToExclude>
0057   //! Will be rejected by the IsOk Method.
0058   Standard_EXPORT AIS_ExclusionFilter(const AIS_KindOfInteractive TypeToExclude,
0059                                       const Standard_Boolean      ExclusionFlagOn = Standard_True);
0060 
0061   //! Constructs an exclusion filter object defined by the
0062   //! enumeration value TypeToExclude, the signature
0063   //! SignatureInType, and the flag setting ExclusionFlagOn.
0064   //! By default, the flag is set to true.
0065   Standard_EXPORT AIS_ExclusionFilter(const AIS_KindOfInteractive TypeToExclude,
0066                                       const Standard_Integer      SignatureInType,
0067                                       const Standard_Boolean      ExclusionFlagOn = Standard_True);
0068 
0069   Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& anObj) const
0070     Standard_OVERRIDE;
0071 
0072   //! Adds the type TypeToExclude to the list of types.
0073   Standard_EXPORT Standard_Boolean Add(const AIS_KindOfInteractive TypeToExclude);
0074 
0075   Standard_EXPORT Standard_Boolean Add(const AIS_KindOfInteractive TypeToExclude,
0076                                        const Standard_Integer      SignatureInType);
0077 
0078   Standard_EXPORT Standard_Boolean Remove(const AIS_KindOfInteractive TypeToExclude);
0079 
0080   Standard_EXPORT Standard_Boolean Remove(const AIS_KindOfInteractive TypeToExclude,
0081                                           const Standard_Integer      SignatureInType);
0082 
0083   Standard_EXPORT void Clear();
0084 
0085   Standard_Boolean IsExclusionFlagOn() const { return myIsExclusionFlagOn; }
0086 
0087   void SetExclusionFlag(const Standard_Boolean theStatus) { myIsExclusionFlagOn = theStatus; }
0088 
0089   Standard_EXPORT Standard_Boolean IsStored(const AIS_KindOfInteractive aType) const;
0090 
0091   Standard_EXPORT void ListOfStoredTypes(TColStd_ListOfInteger& TheList) const;
0092 
0093   Standard_EXPORT void ListOfSignature(const AIS_KindOfInteractive aType,
0094                                        TColStd_ListOfInteger&      TheStoredList) const;
0095 
0096   DEFINE_STANDARD_RTTIEXT(AIS_ExclusionFilter, SelectMgr_Filter)
0097 
0098 private:
0099   Standard_EXPORT Standard_Boolean IsSignatureIn(const AIS_KindOfInteractive aType,
0100                                                  const Standard_Integer      aSignature) const;
0101 
0102   Standard_Boolean                      myIsExclusionFlagOn;
0103   TColStd_DataMapOfIntegerListOfInteger myStoredTypes;
0104 };
0105 
0106 #endif // _AIS_ExclusionFilter_HeaderFile