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
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_AttributeFilter_HeaderFile
18 #define _AIS_AttributeFilter_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Quantity_NameOfColor.hxx>
24 #include <Standard_Real.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <SelectMgr_Filter.hxx>
27 class SelectMgr_EntityOwner;
30 class AIS_AttributeFilter;
31 DEFINE_STANDARD_HANDLE(AIS_AttributeFilter, SelectMgr_Filter)
33 //! Selects Interactive Objects, which have the desired width or color.
34 //! The filter questions each Interactive Object in local
35 //! context to determine whether it has an non-null
36 //! owner, and if so, whether it has the required color
37 //! and width attributes. If the object returns true in each
38 //! case, it is kept. If not, it is rejected.
39 //! This filter is used only in an open local context.
40 //! In the Collector viewer, you can only locate
41 //! Interactive Objects, which answer positively to the
42 //! filters, which are in position when a local context is open.
43 class AIS_AttributeFilter : public SelectMgr_Filter
47 //! Constructs an empty attribute filter object.
48 //! This filter object determines whether selectable
49 //! interactive objects have a non-null owner.
50 Standard_EXPORT AIS_AttributeFilter();
53 //! Constructs an attribute filter object defined by the
54 //! color attribute aCol.
55 Standard_EXPORT AIS_AttributeFilter(const Quantity_NameOfColor aCol);
58 //! Constructs an attribute filter object defined by the line
59 //! width attribute aWidth.
60 Standard_EXPORT AIS_AttributeFilter(const Standard_Real aWidth);
63 //! Indicates that the Interactive Object has the color
64 //! setting specified by the argument aCol at construction time.
65 Standard_Boolean HasColor() const { return hasC; }
67 //! Indicates that the Interactive Object has the width
68 //! setting specified by the argument aWidth at
69 //! construction time.
70 Standard_Boolean HasWidth() const { return hasW; }
73 void SetColor (const Quantity_NameOfColor theCol)
79 //! Sets the line width.
80 void SetWidth (const Standard_Real theWidth)
86 //! Removes the setting for color from the filter.
87 void UnsetColor() { hasC = Standard_False; }
89 //! Removes the setting for width from the filter.
90 void UnsetWidth() { hasW = Standard_False; }
92 //! Indicates that the selected Interactive Object passes
93 //! the filter. The owner, anObj, can be either direct or
94 //! user. A direct owner is the corresponding
95 //! construction element, whereas a user is the
96 //! compound shape of which the entity forms a part.
97 //! If the Interactive Object returns Standard_True
98 //! when detected by the Local Context selector through
99 //! the mouse, the object is kept; if not, it is rejected.
100 Standard_EXPORT virtual Standard_Boolean IsOk (const Handle(SelectMgr_EntityOwner)& anObj) const Standard_OVERRIDE;
102 DEFINE_STANDARD_RTTIEXT(AIS_AttributeFilter,SelectMgr_Filter)
106 Quantity_NameOfColor myCol;
108 Standard_Boolean hasC;
109 Standard_Boolean hasW;
113 #endif // _AIS_AttributeFilter_HeaderFile