7fd59977 |
1 | // File: AIS_BadEdgeFilter.cxx |
2 | // Created: Wed Mar 4 12:01:13 1998 |
3 | // Author: Julia Gerasimova |
4 | // <g_design> |
5 | |
6 | |
7 | #include <AIS_BadEdgeFilter.ixx> |
8 | |
9 | #include <StdSelect_BRepOwner.hxx> |
10 | #include <TopTools_ListOfShape.hxx> |
11 | #include <TopTools_ListIteratorOfListOfShape.hxx> |
12 | #include <TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape.hxx> |
13 | |
14 | |
15 | |
16 | //======================================================================= |
17 | //function : AIS_BadEdgeFilter |
18 | //purpose : |
19 | //======================================================================= |
20 | |
21 | AIS_BadEdgeFilter::AIS_BadEdgeFilter() |
22 | { |
23 | myContour=0; |
24 | } |
25 | |
26 | //======================================================================= |
27 | //function : ActsOn |
28 | //purpose : |
29 | //======================================================================= |
30 | |
31 | Standard_Boolean AIS_BadEdgeFilter::ActsOn(const TopAbs_ShapeEnum aType) const |
32 | { |
33 | return (aType == TopAbs_EDGE); |
34 | } |
35 | |
36 | //======================================================================= |
37 | //function : IsOk |
38 | //purpose : |
39 | //======================================================================= |
40 | |
41 | Standard_Boolean AIS_BadEdgeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& EO) const |
42 | { |
43 | if (Handle(StdSelect_BRepOwner)::DownCast(EO).IsNull()) |
44 | return Standard_True; |
45 | |
46 | if (myContour==0) |
47 | return Standard_True; |
48 | |
49 | const TopoDS_Shape& aShape = ((Handle(StdSelect_BRepOwner)&)EO)->Shape(); |
50 | |
51 | if (myBadEdges.IsBound(myContour)) { |
52 | TopTools_ListIteratorOfListOfShape it(myBadEdges.Find(myContour)); |
53 | for (; it.More(); it.Next()) { |
54 | if (it.Value().IsSame(aShape)) |
55 | return Standard_False; |
56 | } |
57 | } |
58 | return Standard_True; |
59 | } |
60 | |
61 | //======================================================================= |
62 | //function : AddEdge |
63 | //purpose : |
64 | //======================================================================= |
65 | |
66 | void AIS_BadEdgeFilter::AddEdge(const TopoDS_Edge& anEdge, |
67 | const Standard_Integer Index) |
68 | { |
69 | if (myBadEdges.IsBound(Index)) { |
70 | myBadEdges.ChangeFind(Index).Append(anEdge); |
71 | } |
72 | else { |
73 | TopTools_ListOfShape LS; |
74 | LS.Append(anEdge); |
75 | myBadEdges.Bind(Index,LS); |
76 | } |
77 | } |
78 | |
79 | //======================================================================= |
80 | //function : RemoveEdges |
81 | //purpose : |
82 | //======================================================================= |
83 | |
84 | void AIS_BadEdgeFilter::RemoveEdges(const Standard_Integer Index) |
85 | { |
86 | myBadEdges.UnBind(Index); |
87 | } |
88 | |
89 | //======================================================================= |
90 | //function : RemoveEdges |
91 | //purpose : |
92 | //======================================================================= |
93 | |
94 | void AIS_BadEdgeFilter::SetContour(const Standard_Integer Index) |
95 | { |
96 | myContour = Index; |
97 | } |