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 <TopOpeBRepDS_Association.hxx>
19 #include <TopOpeBRepDS_Interference.hxx>
21 IMPLEMENT_STANDARD_RTTIEXT(TopOpeBRepDS_Association,Standard_Transient)
23 //=======================================================================
26 //=======================================================================
27 static Standard_Boolean Contains (const TopOpeBRepDS_ListOfInterference& LI,
28 const Handle(TopOpeBRepDS_Interference)& I)
30 for (TopOpeBRepDS_ListIteratorOfListOfInterference it(LI); it.More(); it.Next()) {
31 if (I->HasSameGeometry(it.Value())) return 1;
37 //=======================================================================
38 //function : TopOpeBRepDS_Association
40 //=======================================================================
42 TopOpeBRepDS_Association::TopOpeBRepDS_Association()
47 //=======================================================================
48 //function : Associate
50 //=======================================================================
52 void TopOpeBRepDS_Association::Associate(const Handle(TopOpeBRepDS_Interference)& I,
53 const Handle(TopOpeBRepDS_Interference)& K)
55 if (!myMap.IsBound(I)) {
56 TopOpeBRepDS_ListOfInterference empty;
60 else if (!Contains(myMap(I),K)) {
63 if (!myMap.IsBound(K)) {
64 TopOpeBRepDS_ListOfInterference empty;
68 else if (!Contains(myMap(K),I)) {
74 //=======================================================================
75 //function : Associate
77 //=======================================================================
79 void TopOpeBRepDS_Association::Associate(const Handle(TopOpeBRepDS_Interference)& I,
80 const TopOpeBRepDS_ListOfInterference& LI)
82 for (TopOpeBRepDS_ListIteratorOfListOfInterference it(LI); it.More(); it.Next()) {
83 Associate(I,it.Value());
87 //=======================================================================
88 //function : HasAssociation
90 //=======================================================================
92 Standard_Boolean TopOpeBRepDS_Association::HasAssociation(const Handle(TopOpeBRepDS_Interference)& I) const
94 return myMap.IsBound(I);
98 //=======================================================================
99 //function : Associated
101 //=======================================================================
103 TopOpeBRepDS_ListOfInterference& TopOpeBRepDS_Association::Associated
104 (const Handle(TopOpeBRepDS_Interference)& I)
106 if (myMap.IsBound(I)) {
107 return myMap.ChangeFind(I);
109 static TopOpeBRepDS_ListOfInterference empty;
114 //=======================================================================
115 //function : AreAssociated
117 //=======================================================================
119 Standard_Boolean TopOpeBRepDS_Association::AreAssociated(const Handle(TopOpeBRepDS_Interference)& I,
120 const Handle(TopOpeBRepDS_Interference)& K) const
122 return (myMap.IsBound(I) && Contains(myMap(I),K));