1 // Created on: 1998-03-04
2 // Created by: Julia Gerasimova
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
24 #include <AIS_BadEdgeFilter.ixx>
26 #include <StdSelect_BRepOwner.hxx>
27 #include <TopTools_ListOfShape.hxx>
28 #include <TopTools_ListIteratorOfListOfShape.hxx>
29 #include <TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape.hxx>
33 //=======================================================================
34 //function : AIS_BadEdgeFilter
36 //=======================================================================
38 AIS_BadEdgeFilter::AIS_BadEdgeFilter()
43 //=======================================================================
46 //=======================================================================
48 Standard_Boolean AIS_BadEdgeFilter::ActsOn(const TopAbs_ShapeEnum aType) const
50 return (aType == TopAbs_EDGE);
53 //=======================================================================
56 //=======================================================================
58 Standard_Boolean AIS_BadEdgeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& EO) const
60 if (Handle(StdSelect_BRepOwner)::DownCast(EO).IsNull())
66 const TopoDS_Shape& aShape = ((Handle(StdSelect_BRepOwner)&)EO)->Shape();
68 if (myBadEdges.IsBound(myContour)) {
69 TopTools_ListIteratorOfListOfShape it(myBadEdges.Find(myContour));
70 for (; it.More(); it.Next()) {
71 if (it.Value().IsSame(aShape))
72 return Standard_False;
78 //=======================================================================
81 //=======================================================================
83 void AIS_BadEdgeFilter::AddEdge(const TopoDS_Edge& anEdge,
84 const Standard_Integer Index)
86 if (myBadEdges.IsBound(Index)) {
87 myBadEdges.ChangeFind(Index).Append(anEdge);
90 TopTools_ListOfShape LS;
92 myBadEdges.Bind(Index,LS);
96 //=======================================================================
97 //function : RemoveEdges
99 //=======================================================================
101 void AIS_BadEdgeFilter::RemoveEdges(const Standard_Integer Index)
103 myBadEdges.UnBind(Index);
106 //=======================================================================
107 //function : RemoveEdges
109 //=======================================================================
111 void AIS_BadEdgeFilter::SetContour(const Standard_Integer Index)