Integration of OCCT 6.5.0 from SVN
[occt.git] / src / AIS / AIS_AttributeFilter.cxx
CommitLineData
7fd59977 1// File: AIS_AttributeFilter.cxx
2// Created: Tue Mar 4 18:13:59 1997
3// Author: Robert COUBLANC
4// <rob@robox.paris1.matra-dtv.fr>
5
6
7#include <AIS_AttributeFilter.ixx>
8
9#include <AIS_InteractiveObject.hxx>
10
11
12AIS_AttributeFilter::AIS_AttributeFilter():
13hasC(Standard_False),
14hasW(Standard_False){}
15
16
17AIS_AttributeFilter::AIS_AttributeFilter(const Quantity_NameOfColor aCol):
18myCol(aCol),
19hasC(Standard_True),
20hasW(Standard_False){}
21
22
23AIS_AttributeFilter::AIS_AttributeFilter(const Standard_Real aWid):
24myWid(aWid),
25hasC(Standard_False),
26hasW(Standard_True){}
27
28
29Standard_Boolean AIS_AttributeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& anObj) const
30{
31 if (Handle(AIS_InteractiveObject)::DownCast(anObj->Selectable()).IsNull()) return Standard_False;
32 Standard_Boolean okstat = Standard_True;
33
34//#ifndef DEB
35 Handle_SelectMgr_SelectableObject aSelectable = anObj->Selectable() ;
36 if( hasC && ((Handle(AIS_InteractiveObject)&) aSelectable)->HasColor() )
37//#else
38// if(hasC && ((Handle(AIS_InteractiveObject)&) anObj->Selectable())->HasColor())
39//#endif
40 okstat = (myCol == ((Handle(AIS_InteractiveObject)&) anObj)->Color());
41
42//#ifndef DEB
43 aSelectable = anObj->Selectable() ;
44 if( hasW && ((Handle(AIS_InteractiveObject)&) aSelectable)->HasWidth() )
45//#else
46// if(hasW && ((Handle(AIS_InteractiveObject)&) anObj->Selectable())->HasWidth())
47//#endif
48 okstat = (myWid == ((Handle(AIS_InteractiveObject)&) anObj)->Width()) && okstat;
49
50 return okstat;
51
52}