Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:54

0001 // Created on: 1997-03-04
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_AttributeFilter_HeaderFile
0018 #define _AIS_AttributeFilter_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Quantity_NameOfColor.hxx>
0024 #include <Standard_Real.hxx>
0025 #include <SelectMgr_Filter.hxx>
0026 class SelectMgr_EntityOwner;
0027 
0028 
0029 class AIS_AttributeFilter;
0030 DEFINE_STANDARD_HANDLE(AIS_AttributeFilter, SelectMgr_Filter)
0031 
0032 //! Selects Interactive Objects, which have the desired width or color.
0033 //! The filter questions each Interactive Object in local
0034 //! context to determine whether it has an non-null
0035 //! owner, and if so, whether it has the required color
0036 //! and width attributes. If the object returns true in each
0037 //! case, it is kept. If not, it is rejected.
0038 //! This filter is used only in an open local context.
0039 //! In the Collector viewer, you can only locate
0040 //! Interactive Objects, which answer positively to the
0041 //! filters, which are in position when a local context is open.
0042 class AIS_AttributeFilter : public SelectMgr_Filter
0043 {
0044 public:
0045 
0046   //! Constructs an empty attribute filter object.
0047   //! This filter object determines whether selectable
0048   //! interactive objects have a non-null owner.
0049   Standard_EXPORT AIS_AttributeFilter();
0050   
0051 
0052   //! Constructs an attribute filter object defined by the
0053   //! color attribute aCol.
0054   Standard_EXPORT AIS_AttributeFilter(const Quantity_NameOfColor aCol);
0055   
0056 
0057   //! Constructs an attribute filter object defined by the line
0058   //! width attribute aWidth.
0059   Standard_EXPORT AIS_AttributeFilter(const Standard_Real aWidth);
0060   
0061 
0062   //! Indicates that the Interactive Object has the color
0063   //! setting specified by the argument aCol at construction time.
0064   Standard_Boolean HasColor() const { return hasC; }
0065 
0066   //! Indicates that the Interactive Object has the width
0067   //! setting specified by the argument aWidth at
0068   //! construction time.
0069   Standard_Boolean HasWidth() const { return hasW; }
0070 
0071   //! Sets the color.
0072   void SetColor (const Quantity_NameOfColor theCol)
0073   {
0074     myCol = theCol;
0075     hasC = Standard_True;
0076   }
0077 
0078   //! Sets the line width.
0079   void SetWidth (const Standard_Real theWidth)
0080   {
0081     myWid = theWidth;
0082     hasW = Standard_True;
0083   }
0084 
0085   //! Removes the setting for color from the filter.
0086   void UnsetColor() { hasC = Standard_False; }
0087 
0088   //! Removes the setting for width from the filter.
0089   void UnsetWidth() { hasW = Standard_False; }
0090 
0091   //! Indicates that the selected Interactive Object passes
0092   //! the filter. The owner, anObj, can be either direct or
0093   //! user. A direct owner is the corresponding
0094   //! construction element, whereas a user is the
0095   //! compound shape of which the entity forms a part.
0096   //! If the Interactive Object returns Standard_True
0097   //! when detected by the Local Context selector through
0098   //! the mouse, the object is kept; if not, it is rejected.
0099   Standard_EXPORT virtual Standard_Boolean IsOk (const Handle(SelectMgr_EntityOwner)& anObj) const Standard_OVERRIDE;
0100 
0101   DEFINE_STANDARD_RTTIEXT(AIS_AttributeFilter,SelectMgr_Filter)
0102 
0103 private:
0104 
0105   Quantity_NameOfColor myCol;
0106   Standard_Real myWid;
0107   Standard_Boolean hasC;
0108   Standard_Boolean hasW;
0109 
0110 };
0111 
0112 #endif // _AIS_AttributeFilter_HeaderFile