0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- manual
[occt.git] / src / AIS / AIS_BadEdgeFilter.cxx
CommitLineData
b311480e 1// Created on: 1998-03-04
2// Created by: Julia Gerasimova
3// Copyright (c) 1998-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.
b311480e 16
7fd59977 17// <g_design>
18
42cf5bc1 19#include <AIS_BadEdgeFilter.hxx>
20#include <SelectMgr_EntityOwner.hxx>
21#include <Standard_Type.hxx>
7fd59977 22#include <StdSelect_BRepOwner.hxx>
42cf5bc1 23#include <TopoDS_Edge.hxx>
7fd59977 24#include <TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape.hxx>
42cf5bc1 25#include <TopTools_ListIteratorOfListOfShape.hxx>
26#include <TopTools_ListOfShape.hxx>
7fd59977 27
28//=======================================================================
29//function : AIS_BadEdgeFilter
30//purpose :
31//=======================================================================
7fd59977 32AIS_BadEdgeFilter::AIS_BadEdgeFilter()
33{
34 myContour=0;
35}
36
37//=======================================================================
38//function : ActsOn
39//purpose :
40//=======================================================================
41
42Standard_Boolean AIS_BadEdgeFilter::ActsOn(const TopAbs_ShapeEnum aType) const
43{
44 return (aType == TopAbs_EDGE);
45}
46
47//=======================================================================
48//function : IsOk
49//purpose :
50//=======================================================================
51
52Standard_Boolean AIS_BadEdgeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& EO) const
53{
5b111128 54 if (myContour==0)
7fd59977 55 return Standard_True;
56
5b111128 57 Handle(StdSelect_BRepOwner) aBO (Handle(StdSelect_BRepOwner)::DownCast(EO));
58 if (aBO.IsNull())
7fd59977 59 return Standard_True;
60
5b111128 61 const TopoDS_Shape& aShape = aBO->Shape();
7fd59977 62
63 if (myBadEdges.IsBound(myContour)) {
64 TopTools_ListIteratorOfListOfShape it(myBadEdges.Find(myContour));
65 for (; it.More(); it.Next()) {
66 if (it.Value().IsSame(aShape))
67 return Standard_False;
68 }
69 }
70 return Standard_True;
71}
72
73//=======================================================================
74//function : AddEdge
75//purpose :
76//=======================================================================
77
78void AIS_BadEdgeFilter::AddEdge(const TopoDS_Edge& anEdge,
79 const Standard_Integer Index)
80{
81 if (myBadEdges.IsBound(Index)) {
82 myBadEdges.ChangeFind(Index).Append(anEdge);
83 }
84 else {
85 TopTools_ListOfShape LS;
86 LS.Append(anEdge);
87 myBadEdges.Bind(Index,LS);
88 }
89}
90
91//=======================================================================
92//function : RemoveEdges
93//purpose :
94//=======================================================================
95
96void AIS_BadEdgeFilter::RemoveEdges(const Standard_Integer Index)
97{
98 myBadEdges.UnBind(Index);
99}
100
101//=======================================================================
102//function : RemoveEdges
103//purpose :
104//=======================================================================
105
106void AIS_BadEdgeFilter::SetContour(const Standard_Integer Index)
107{
108 myContour = Index;
109}