1 // Created on: 1998-09-03
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Standard_Type.hxx>
19 #include <TopOpeBRepDS_Association.hxx>
20 #include <TopOpeBRepDS_Interference.hxx>
21 #include <TopOpeBRepDS_ListIteratorOfListOfInterference.hxx>
23 IMPLEMENT_STANDARD_RTTIEXT(TopOpeBRepDS_Association,MMgt_TShared)
25 //=======================================================================
28 //=======================================================================
29 static Standard_Boolean Contains (const TopOpeBRepDS_ListOfInterference& LI,
30 const Handle(TopOpeBRepDS_Interference)& I)
32 for (TopOpeBRepDS_ListIteratorOfListOfInterference it(LI); it.More(); it.Next()) {
33 if (I->HasSameGeometry(it.Value())) return 1;
39 //=======================================================================
40 //function : TopOpeBRepDS_Association
42 //=======================================================================
44 TopOpeBRepDS_Association::TopOpeBRepDS_Association()
49 //=======================================================================
50 //function : Associate
52 //=======================================================================
54 void TopOpeBRepDS_Association::Associate(const Handle(TopOpeBRepDS_Interference)& I,
55 const Handle(TopOpeBRepDS_Interference)& K)
57 if (!myMap.IsBound(I)) {
58 TopOpeBRepDS_ListOfInterference empty;
62 else if (!Contains(myMap(I),K)) {
65 if (!myMap.IsBound(K)) {
66 TopOpeBRepDS_ListOfInterference empty;
70 else if (!Contains(myMap(K),I)) {
76 //=======================================================================
77 //function : Associate
79 //=======================================================================
81 void TopOpeBRepDS_Association::Associate(const Handle(TopOpeBRepDS_Interference)& I,
82 const TopOpeBRepDS_ListOfInterference& LI)
84 for (TopOpeBRepDS_ListIteratorOfListOfInterference it(LI); it.More(); it.Next()) {
85 Associate(I,it.Value());
89 //=======================================================================
90 //function : HasAssociation
92 //=======================================================================
94 Standard_Boolean TopOpeBRepDS_Association::HasAssociation(const Handle(TopOpeBRepDS_Interference)& I) const
96 return myMap.IsBound(I);
100 //=======================================================================
101 //function : Associated
103 //=======================================================================
105 TopOpeBRepDS_ListOfInterference& TopOpeBRepDS_Association::Associated
106 (const Handle(TopOpeBRepDS_Interference)& I)
108 if (myMap.IsBound(I)) {
109 return myMap.ChangeFind(I);
111 static TopOpeBRepDS_ListOfInterference empty;
116 //=======================================================================
117 //function : AreAssociated
119 //=======================================================================
121 Standard_Boolean TopOpeBRepDS_Association::AreAssociated(const Handle(TopOpeBRepDS_Interference)& I,
122 const Handle(TopOpeBRepDS_Interference)& K) const
124 return (myMap.IsBound(I) && Contains(myMap(I),K));