1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: NMTDS_InterfPool.cxx
21 // Author: Peter KURNEV
23 #include <NMTDS_InterfPool.hxx>
25 #include <NMTDS_PairBoolean.hxx>
26 #include <NMTDS_ListOfPairBoolean.hxx>
27 #include <NMTDS_MapIteratorOfMapOfPairBoolean.hxx>
28 #include <NMTDS_ListIteratorOfListOfPairBoolean.hxx>
30 #include <Basics_OCCTVersion.hxx>
33 Standard_Integer TypeToInteger(const NMTDS_InterfType aType);
35 //=======================================================================
38 //=======================================================================
39 NMTDS_InterfPool::NMTDS_InterfPool()
43 //=======================================================================
46 //=======================================================================
47 NMTDS_InterfPool::~NMTDS_InterfPool()
50 //=======================================================================
53 //=======================================================================
54 Standard_Boolean NMTDS_InterfPool::Add (const NMTDS_PairBoolean& aPKB,
55 const NMTDS_InterfType aType)
57 Standard_Boolean bRet;
58 Standard_Integer iType;
62 iType=TypeToInteger(aType);
63 if (iType>-1 && iType<myMaxInd) {
64 bRet=myTable[iType].Add(aPKB);
68 //=======================================================================
71 //=======================================================================
72 Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1,
73 const Standard_Integer aInd2,
74 const NMTDS_InterfType aType)
76 NMTDS_PairBoolean aPKB;
78 aPKB.SetIds(aInd1, aInd2);
79 return Add(aPKB, aType);
81 //=======================================================================
84 //=======================================================================
85 Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1,
86 const Standard_Integer aInd2,
87 const Standard_Boolean bFlag,
88 const NMTDS_InterfType aType)
90 NMTDS_PairBoolean aPKB;
92 aPKB.SetIds(aInd1, aInd2);
94 return Add(aPKB, aType);
96 //=======================================================================
99 //=======================================================================
100 Standard_Boolean NMTDS_InterfPool::Contains(const NMTDS_PairBoolean& aPKB)const
102 Standard_Boolean bRet;
105 for (i=0; i<myMaxInd; ++i) {
106 bRet=myTable[i].Contains(aPKB);
113 //=======================================================================
114 //function : Contains
116 //=======================================================================
117 Standard_Boolean NMTDS_InterfPool::Contains(const Standard_Integer aInd1,
118 const Standard_Integer aInd2)const
120 NMTDS_PairBoolean aPKB;
122 aPKB.SetIds(aInd1, aInd2);
123 return Contains(aPKB);
125 //=======================================================================
128 //=======================================================================
129 const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get()const
132 NMTDS_ListOfPairBoolean* pL;
134 pL=(NMTDS_ListOfPairBoolean*)&myList;
137 for (i=0; i<myMaxInd; ++i) {
138 NMTDS_MapIteratorOfMapOfPairBoolean aIt;
140 aIt.Initialize(myTable[i]);
141 for(; aIt.More(); aIt.Next()) {
142 const NMTDS_PairBoolean& aPKB=aIt.Key();
148 //=======================================================================
151 //=======================================================================
152 const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get
153 (const Standard_Integer aInd)const
155 Standard_Integer i, n1, n2;
156 NMTDS_ListOfPairBoolean* pL;
158 pL=(NMTDS_ListOfPairBoolean*)&myList;
161 for (i=0; i<myMaxInd; ++i) {
162 NMTDS_MapIteratorOfMapOfPairBoolean aIt;
164 aIt.Initialize(myTable[i]);
165 for(; aIt.More(); aIt.Next()) {
166 const NMTDS_PairBoolean& aPKB=aIt.Key();
168 if(n1==aInd || n2==aInd) {
175 //=======================================================================
178 //=======================================================================
179 const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get
180 (const NMTDS_InterfType aType)const
182 Standard_Integer iType;
183 NMTDS_ListOfPairBoolean* pL;
185 pL=(NMTDS_ListOfPairBoolean*)&myList;
188 iType=TypeToInteger(aType);
189 if (iType>-1 && iType<myMaxInd) {
190 NMTDS_MapIteratorOfMapOfPairBoolean aIt;
192 aIt.Initialize(myTable[iType]);
193 for(; aIt.More(); aIt.Next()) {
194 const NMTDS_PairBoolean& aPKB=aIt.Key();
200 //=======================================================================
203 //=======================================================================
204 const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get
205 (const Standard_Integer aInd,
206 const NMTDS_InterfType aType)const
208 Standard_Integer n1, n2;
209 NMTDS_ListOfPairBoolean *pL, aLPKB;
210 NMTDS_ListIteratorOfListOfPairBoolean aIt;
214 pL=(NMTDS_ListOfPairBoolean*)&myList;
217 aIt.Initialize (aLPKB);
218 for (; aIt.More(); aIt.Next()) {
219 const NMTDS_PairBoolean& aPKB=aIt.Value();
221 if(n1==aInd || n2==aInd) {
228 //===========================================================================
229 //function : SSInterferences
231 //===========================================================================
232 BOPTools_CArray1OfSSInterference& NMTDS_InterfPool::SSInterferences()
234 return mySSInterferences;
236 //===========================================================================
237 //function : ESInterferences
239 //===========================================================================
240 BOPTools_CArray1OfESInterference& NMTDS_InterfPool::ESInterferences()
242 return myESInterferences;
244 //===========================================================================
245 //function : VSInterferences
247 //===========================================================================
248 BOPTools_CArray1OfVSInterference& NMTDS_InterfPool::VSInterferences()
250 return myVSInterferences;
252 //===========================================================================
253 //function : EEInterferences
255 //===========================================================================
256 BOPTools_CArray1OfEEInterference& NMTDS_InterfPool::EEInterferences()
258 return myEEInterferences;
260 //===========================================================================
261 //function : VEInterferences
263 //===========================================================================
264 BOPTools_CArray1OfVEInterference& NMTDS_InterfPool::VEInterferences()
266 return myVEInterferences;
268 //===========================================================================
269 //function : VVInterferences
271 //===========================================================================
272 BOPTools_CArray1OfVVInterference& NMTDS_InterfPool::VVInterferences()
274 return myVVInterferences;
277 //modified by NIZNHY-PKV Mon Dec 12 09:07:54 2011f
278 //=======================================================================
281 //=======================================================================
282 void NMTDS_InterfPool::Purge()
284 #if OCC_VERSION_LARGE > 0x06050200
285 myVVInterferences.Purge();
286 myVEInterferences.Purge();
287 myEEInterferences.Purge();
288 myVSInterferences.Purge();
289 myESInterferences.Purge();
290 mySSInterferences.Purge();
293 //modified by NIZNHY-PKV Mon Dec 12 09:07:58 2011t
295 //=======================================================================
296 //function : TypeToInteger
298 //=======================================================================
299 Standard_Integer TypeToInteger(const NMTDS_InterfType aType)
301 return (Standard_Integer)aType;