1 // Copyright (C) 2007-2011 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
19 // File: NMTDS_InterfPool.cxx
20 // Author: Peter KURNEV
22 #include <NMTDS_InterfPool.ixx>
24 #include <NMTDS_PairBoolean.hxx>
25 #include <NMTDS_ListOfPairBoolean.hxx>
26 #include <NMTDS_MapIteratorOfMapOfPairBoolean.hxx>
27 #include <NMTDS_ListIteratorOfListOfPairBoolean.hxx>
29 #include <Basics_OCCTVersion.hxx>
32 Standard_Integer TypeToInteger(const NMTDS_InterfType aType);
34 //=======================================================================
37 //=======================================================================
38 NMTDS_InterfPool::NMTDS_InterfPool()
42 //=======================================================================
45 //=======================================================================
46 NMTDS_InterfPool::~NMTDS_InterfPool()
49 //=======================================================================
52 //=======================================================================
53 Standard_Boolean NMTDS_InterfPool::Add (const NMTDS_PairBoolean& aPKB,
54 const NMTDS_InterfType aType)
56 Standard_Boolean bRet;
57 Standard_Integer iType;
61 iType=TypeToInteger(aType);
62 if (iType>-1 && iType<myMaxInd) {
63 bRet=myTable[iType].Add(aPKB);
67 //=======================================================================
70 //=======================================================================
71 Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1,
72 const Standard_Integer aInd2,
73 const NMTDS_InterfType aType)
75 NMTDS_PairBoolean aPKB;
77 aPKB.SetIds(aInd1, aInd2);
78 return Add(aPKB, aType);
80 //=======================================================================
83 //=======================================================================
84 Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1,
85 const Standard_Integer aInd2,
86 const Standard_Boolean bFlag,
87 const NMTDS_InterfType aType)
89 NMTDS_PairBoolean aPKB;
91 aPKB.SetIds(aInd1, aInd2);
93 return Add(aPKB, aType);
95 //=======================================================================
98 //=======================================================================
99 Standard_Boolean NMTDS_InterfPool::Contains(const NMTDS_PairBoolean& aPKB)const
101 Standard_Boolean bRet;
104 for (i=0; i<myMaxInd; ++i) {
105 bRet=myTable[i].Contains(aPKB);
112 //=======================================================================
113 //function : Contains
115 //=======================================================================
116 Standard_Boolean NMTDS_InterfPool::Contains(const Standard_Integer aInd1,
117 const Standard_Integer aInd2)const
119 NMTDS_PairBoolean aPKB;
121 aPKB.SetIds(aInd1, aInd2);
122 return Contains(aPKB);
124 //=======================================================================
127 //=======================================================================
128 const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get()const
131 NMTDS_ListOfPairBoolean* pL;
133 pL=(NMTDS_ListOfPairBoolean*)&myList;
136 for (i=0; i<myMaxInd; ++i) {
137 NMTDS_MapIteratorOfMapOfPairBoolean aIt;
139 aIt.Initialize(myTable[i]);
140 for(; aIt.More(); aIt.Next()) {
141 const NMTDS_PairBoolean& aPKB=aIt.Key();
147 //=======================================================================
150 //=======================================================================
151 const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get
152 (const Standard_Integer aInd)const
154 Standard_Integer i, n1, n2;
155 NMTDS_ListOfPairBoolean* pL;
157 pL=(NMTDS_ListOfPairBoolean*)&myList;
160 for (i=0; i<myMaxInd; ++i) {
161 NMTDS_MapIteratorOfMapOfPairBoolean aIt;
163 aIt.Initialize(myTable[i]);
164 for(; aIt.More(); aIt.Next()) {
165 const NMTDS_PairBoolean& aPKB=aIt.Key();
167 if(n1==aInd || n2==aInd) {
174 //=======================================================================
177 //=======================================================================
178 const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get
179 (const NMTDS_InterfType aType)const
181 Standard_Integer iType;
182 NMTDS_ListOfPairBoolean* pL;
184 pL=(NMTDS_ListOfPairBoolean*)&myList;
187 iType=TypeToInteger(aType);
188 if (iType>-1 && iType<myMaxInd) {
189 NMTDS_MapIteratorOfMapOfPairBoolean aIt;
191 aIt.Initialize(myTable[iType]);
192 for(; aIt.More(); aIt.Next()) {
193 const NMTDS_PairBoolean& aPKB=aIt.Key();
199 //=======================================================================
202 //=======================================================================
203 const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get
204 (const Standard_Integer aInd,
205 const NMTDS_InterfType aType)const
207 Standard_Integer n1, n2;
208 NMTDS_ListOfPairBoolean *pL, aLPKB;
209 NMTDS_ListIteratorOfListOfPairBoolean aIt;
213 pL=(NMTDS_ListOfPairBoolean*)&myList;
216 aIt.Initialize (aLPKB);
217 for (; aIt.More(); aIt.Next()) {
218 const NMTDS_PairBoolean& aPKB=aIt.Value();
220 if(n1==aInd || n2==aInd) {
227 //===========================================================================
228 //function : SSInterferences
230 //===========================================================================
231 BOPTools_CArray1OfSSInterference& NMTDS_InterfPool::SSInterferences()
233 return mySSInterferences;
235 //===========================================================================
236 //function : ESInterferences
238 //===========================================================================
239 BOPTools_CArray1OfESInterference& NMTDS_InterfPool::ESInterferences()
241 return myESInterferences;
243 //===========================================================================
244 //function : VSInterferences
246 //===========================================================================
247 BOPTools_CArray1OfVSInterference& NMTDS_InterfPool::VSInterferences()
249 return myVSInterferences;
251 //===========================================================================
252 //function : EEInterferences
254 //===========================================================================
255 BOPTools_CArray1OfEEInterference& NMTDS_InterfPool::EEInterferences()
257 return myEEInterferences;
259 //===========================================================================
260 //function : VEInterferences
262 //===========================================================================
263 BOPTools_CArray1OfVEInterference& NMTDS_InterfPool::VEInterferences()
265 return myVEInterferences;
267 //===========================================================================
268 //function : VVInterferences
270 //===========================================================================
271 BOPTools_CArray1OfVVInterference& NMTDS_InterfPool::VVInterferences()
273 return myVVInterferences;
276 //modified by NIZNHY-PKV Mon Dec 12 09:07:54 2011f
277 //=======================================================================
280 //=======================================================================
281 void NMTDS_InterfPool::Purge()
283 #if OCC_VERSION_LARGE > 0x06050200
284 myVVInterferences.Purge();
285 myVEInterferences.Purge();
286 myEEInterferences.Purge();
287 myVSInterferences.Purge();
288 myESInterferences.Purge();
289 mySSInterferences.Purge();
292 //modified by NIZNHY-PKV Mon Dec 12 09:07:58 2011t
294 //=======================================================================
295 //function : TypeToInteger
297 //=======================================================================
298 Standard_Integer TypeToInteger(const NMTDS_InterfType aType)
300 return (Standard_Integer)aType;