| 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_AttributeFilter_HeaderFile |
| 18 | #define _AIS_AttributeFilter_HeaderFile |
| 19 | |
| 20 | #include <Standard.hxx> |
| 21 | #include <Standard_Type.hxx> |
| 22 | |
| 23 | #include <Quantity_NameOfColor.hxx> |
| 24 | #include <Standard_Real.hxx> |
| 25 | #include <Standard_Boolean.hxx> |
| 26 | #include <SelectMgr_Filter.hxx> |
| 27 | class SelectMgr_EntityOwner; |
| 28 | |
| 29 | |
| 30 | class AIS_AttributeFilter; |
| 31 | DEFINE_STANDARD_HANDLE(AIS_AttributeFilter, SelectMgr_Filter) |
| 32 | |
| 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 |
| 44 | { |
| 45 | |
| 46 | public: |
| 47 | |
| 48 | |
| 49 | |
| 50 | //! Constructs an empty attribute filter object. |
| 51 | //! This filter object determines whether selectable |
| 52 | //! interactive objects have a non-null owner. |
| 53 | Standard_EXPORT AIS_AttributeFilter(); |
| 54 | |
| 55 | |
| 56 | //! Constructs an attribute filter object defined by the |
| 57 | //! color attribute aCol. |
| 58 | Standard_EXPORT AIS_AttributeFilter(const Quantity_NameOfColor aCol); |
| 59 | |
| 60 | |
| 61 | //! Constructs an attribute filter object defined by the line |
| 62 | //! width attribute aWidth. |
| 63 | Standard_EXPORT AIS_AttributeFilter(const Standard_Real aWidth); |
| 64 | |
| 65 | |
| 66 | //! Indicates that the Interactive Object has the color |
| 67 | //! setting specified by the argument aCol at construction time. |
| 68 | Standard_Boolean HasColor() const; |
| 69 | |
| 70 | |
| 71 | //! Indicates that the Interactive Object has the width |
| 72 | //! setting specified by the argument aWidth at |
| 73 | //! construction time. |
| 74 | Standard_Boolean HasWidth() const; |
| 75 | |
| 76 | //! Sets the color aCol. |
| 77 | //! This must be chosen from the list of colors in Quantity_NameOfColor. |
| 78 | void SetColor (const Quantity_NameOfColor aCol); |
| 79 | |
| 80 | //! Sets the line width aWidth. |
| 81 | void SetWidth (const Standard_Real aWidth); |
| 82 | |
| 83 | |
| 84 | //! Removes the setting for color from the filter. |
| 85 | void UnsetColor(); |
| 86 | |
| 87 | |
| 88 | //! Removes the setting for width from the filter. |
| 89 | void UnsetWidth(); |
| 90 | |
| 91 | //! Indicates that the selected Interactive Object passes |
| 92 | //! the filter. The owner, anObj, can be either direct or |
| 93 | //! user. A direct owner is the corresponding |
| 94 | //! construction element, whereas a user is the |
| 95 | //! compound shape of which the entity forms a part. |
| 96 | //! If the Interactive Object returns Standard_True |
| 97 | //! when detected by the Local Context selector through |
| 98 | //! the mouse, the object is kept; if not, it is rejected. |
| 99 | Standard_EXPORT virtual Standard_Boolean IsOk (const Handle(SelectMgr_EntityOwner)& anObj) const Standard_OVERRIDE; |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | DEFINE_STANDARD_RTTIEXT(AIS_AttributeFilter,SelectMgr_Filter) |
| 105 | |
| 106 | protected: |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | private: |
| 112 | |
| 113 | |
| 114 | Quantity_NameOfColor myCol; |
| 115 | Standard_Real myWid; |
| 116 | Standard_Boolean hasC; |
| 117 | Standard_Boolean hasW; |
| 118 | |
| 119 | |
| 120 | }; |
| 121 | |
| 122 | |
| 123 | #include <AIS_AttributeFilter.lxx> |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | #endif // _AIS_AttributeFilter_HeaderFile |