0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / StdSelect / StdSelect_EdgeFilter.cxx
CommitLineData
b311480e 1// Created on: 1996-03-13
2// Created by: Robert COUBLANC
3// Copyright (c) 1996-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
42cf5bc1 17
7fd59977 18#include <BRepAdaptor_Curve.hxx>
42cf5bc1 19#include <SelectMgr_EntityOwner.hxx>
20#include <Standard_Type.hxx>
7fd59977 21#include <StdSelect_BRepOwner.hxx>
42cf5bc1 22#include <StdSelect_EdgeFilter.hxx>
23#include <TopAbs.hxx>
24#include <TopoDS.hxx>
25#include <TopoDS_Edge.hxx>
26
92efcf78 27IMPLEMENT_STANDARD_RTTIEXT(StdSelect_EdgeFilter,SelectMgr_Filter)
28
7fd59977 29/*#include <.hxx>
30#include <.hxx>
31#include <.hxx>
32#include <.hxx>
33#include <.hxx>
34*/
7fd59977 35//==================================================
36// Function:
37// Purpose :
38//==================================================
39StdSelect_EdgeFilter
40::StdSelect_EdgeFilter (const StdSelect_TypeOfEdge Edge):
41mytype(Edge){}
42
43//==================================================
44// Function:
45// Purpose :
46//==================================================
47void StdSelect_EdgeFilter
48::SetType(const StdSelect_TypeOfEdge aNewType)
49{
50 mytype=aNewType;
51}
52
53
54
55//==================================================
56// Function:
57// Purpose :
58//==================================================
59StdSelect_TypeOfEdge StdSelect_EdgeFilter::Type() const
60{
61 return mytype;
62}
63
64//==================================================
65// Function:
66// Purpose :
67//==================================================
68Standard_Boolean StdSelect_EdgeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& EO) const
69{
5b111128 70 Handle(StdSelect_BRepOwner) aBO (Handle(StdSelect_BRepOwner)::DownCast(EO));
71 if (aBO.IsNull())
72 return Standard_False;
73
74 const TopoDS_Shape& sh = aBO->Shape();
7fd59977 75 if(sh.ShapeType()!= TopAbs_EDGE) return Standard_False;
76
77 switch(mytype){
78 case StdSelect_AnyEdge:
79 return Standard_True;
80 case StdSelect_Line:
81 {
82 BRepAdaptor_Curve curv(TopoDS::Edge(sh));
83 return (curv.GetType() == GeomAbs_Line);
84 }
85 break;
86 case StdSelect_Circle:
87 BRepAdaptor_Curve curv(TopoDS::Edge(sh));
88 return (curv.GetType() == GeomAbs_Circle);
89 }
90
91 return Standard_False ;
92}
93
94Standard_Boolean StdSelect_EdgeFilter::ActsOn(const TopAbs_ShapeEnum aStandardMode) const
95{return aStandardMode==TopAbs_EDGE;}