1 // File: TopOpeBRepDS_Association.cxx
2 // Created: Thu Sep 3 09:35:36 1998
3 // Author: Yves FRICAUD
4 // <yfr@claquox.paris1.matra-dtv.fr>
7 #include <TopOpeBRepDS_Association.ixx>
8 #include <TopOpeBRepDS_ListIteratorOfListOfInterference.hxx>
11 //=======================================================================
14 //=======================================================================
16 static Standard_Boolean Contains (const TopOpeBRepDS_ListOfInterference& LI,
17 const Handle(TopOpeBRepDS_Interference)& I)
19 for (TopOpeBRepDS_ListIteratorOfListOfInterference it(LI); it.More(); it.Next()) {
20 if (I->HasSameGeometry(it.Value())) return 1;
26 //=======================================================================
27 //function : TopOpeBRepDS_Association
29 //=======================================================================
31 TopOpeBRepDS_Association::TopOpeBRepDS_Association()
36 //=======================================================================
37 //function : Associate
39 //=======================================================================
41 void TopOpeBRepDS_Association::Associate(const Handle(TopOpeBRepDS_Interference)& I,
42 const Handle(TopOpeBRepDS_Interference)& K)
44 if (!myMap.IsBound(I)) {
45 TopOpeBRepDS_ListOfInterference empty;
49 else if (!Contains(myMap(I),K)) {
52 if (!myMap.IsBound(K)) {
53 TopOpeBRepDS_ListOfInterference empty;
57 else if (!Contains(myMap(K),I)) {
63 //=======================================================================
64 //function : Associate
66 //=======================================================================
68 void TopOpeBRepDS_Association::Associate(const Handle(TopOpeBRepDS_Interference)& I,
69 const TopOpeBRepDS_ListOfInterference& LI)
71 for (TopOpeBRepDS_ListIteratorOfListOfInterference it(LI); it.More(); it.Next()) {
72 Associate(I,it.Value());
76 //=======================================================================
77 //function : HasAssociation
79 //=======================================================================
81 Standard_Boolean TopOpeBRepDS_Association::HasAssociation(const Handle(TopOpeBRepDS_Interference)& I) const
83 return myMap.IsBound(I);
87 //=======================================================================
88 //function : Associated
90 //=======================================================================
92 TopOpeBRepDS_ListOfInterference& TopOpeBRepDS_Association::Associated
93 (const Handle(TopOpeBRepDS_Interference)& I)
95 if (myMap.IsBound(I)) {
96 return myMap.ChangeFind(I);
98 static TopOpeBRepDS_ListOfInterference empty;
103 //=======================================================================
104 //function : AreAssociated
106 //=======================================================================
108 Standard_Boolean TopOpeBRepDS_Association::AreAssociated(const Handle(TopOpeBRepDS_Interference)& I,
109 const Handle(TopOpeBRepDS_Interference)& K) const
111 return (myMap.IsBound(I) && Contains(myMap(I),K));