0027957: Visualization, AIS_InteractiveContext - protect from displaying the same...
[occt.git] / src / AIS / AIS_SignatureFilter.hxx
1 // Created on: 1997-03-04
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_SignatureFilter_HeaderFile
18 #define _AIS_SignatureFilter_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Integer.hxx>
24 #include <AIS_TypeFilter.hxx>
25 #include <AIS_KindOfInteractive.hxx>
26 #include <Standard_Boolean.hxx>
27 class SelectMgr_EntityOwner;
28
29
30 class AIS_SignatureFilter;
31 DEFINE_STANDARD_HANDLE(AIS_SignatureFilter, AIS_TypeFilter)
32
33 //! Selects Interactive Objects through their signatures
34 //! and types. The signature provides an
35 //! additional   characterization of an object's type, and
36 //! takes the form of an index. The filter questions each
37 //! Interactive Object in local context to determine
38 //! whether it has an non-null owner, and if so, whether
39 //! it has the desired signature. If the object returns true
40 //! in each case, it is kept. If not, it is rejected.
41 //! By default, the   interactive object has a None   type
42 //! and a signature of 0. If you want to give a particular
43 //! type and signature to your Interactive Object, you
44 //! must redefine two virtual methods:   Type and Signature.
45 //! This filter is only used in an open local contexts.
46 //! In the Collector viewer, you can only locate
47 //! Interactive Objects which answer positively to the
48 //! positioned filters when a local context is open.
49 //! Warning
50 //! Some signatures have already been used by standard
51 //! objects delivered in AIS. These include:
52 //! -   signature 0 - Shape
53 //! -   signature 1 - Point
54 //! -   signature 2 - Axis
55 //! -   signature 3 - Trihedron
56 //! -   signature 4 - PlaneTrihedron
57 //! -   signature 5 - Line
58 //! -   signature 6 - Circle
59 //! -   signature 7 - Plane
60 class AIS_SignatureFilter : public AIS_TypeFilter
61 {
62
63 public:
64
65   
66   //! Initializes the signature filter, adding the signature
67   //! specification, aGivenSignature, to that for type,
68   //! aGivenKind, in AIS_TypeFilter.
69   Standard_EXPORT AIS_SignatureFilter(const AIS_KindOfInteractive aGivenKind, const Standard_Integer aGivenSignature);
70   
71   //! Returns False if the transient is not an AIS_InteractiveObject.
72   //! Returns False if the signature of InteractiveObject
73   //! is not the same as the stored one in the filter...
74   Standard_EXPORT Standard_Boolean IsOk (const Handle(SelectMgr_EntityOwner)& anobj) const Standard_OVERRIDE;
75
76
77
78
79   DEFINE_STANDARD_RTTIEXT(AIS_SignatureFilter,AIS_TypeFilter)
80
81 protected:
82
83
84
85
86 private:
87
88
89   Standard_Integer mySig;
90
91
92 };
93
94
95
96
97
98
99
100 #endif // _AIS_SignatureFilter_HeaderFile