1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
16 #include <BOPDS_CommonBlock.hxx>
17 #include <BOPDS_PaveBlock.hxx>
18 #include <Standard_Type.hxx>
20 //=======================================================================
23 //=======================================================================
24 BOPDS_CommonBlock::BOPDS_CommonBlock()
27 //=======================================================================
30 //=======================================================================
31 BOPDS_CommonBlock::BOPDS_CommonBlock(const Handle(NCollection_BaseAllocator)& theAllocator)
33 myPaveBlocks(theAllocator),
37 //=======================================================================
38 // function: AddPaveBlock
40 //=======================================================================
41 void BOPDS_CommonBlock::AddPaveBlock(const Handle(BOPDS_PaveBlock)& aPB)
43 myPaveBlocks.Append(aPB);
45 //=======================================================================
46 // function: AddPaveBlocks
48 //=======================================================================
49 void BOPDS_CommonBlock::AddPaveBlocks(const BOPDS_ListOfPaveBlock& aLPB)
53 //=======================================================================
54 // function: PaveBlocks
56 //=======================================================================
57 const BOPDS_ListOfPaveBlock& BOPDS_CommonBlock::PaveBlocks()const
61 //=======================================================================
64 //=======================================================================
65 void BOPDS_CommonBlock::AddFace(const Standard_Integer aF)
69 //=======================================================================
72 //=======================================================================
73 void BOPDS_CommonBlock::AddFaces(const BOPCol_ListOfInteger& aLF)
77 //=======================================================================
80 //=======================================================================
81 const BOPCol_ListOfInteger& BOPDS_CommonBlock::Faces()const
85 //=======================================================================
86 // function: PaveBlock1
88 //=======================================================================
89 const Handle(BOPDS_PaveBlock)& BOPDS_CommonBlock::PaveBlock1()const
91 return myPaveBlocks.First();
93 //=======================================================================
94 // function: PaveBlockOnEdge
96 //=======================================================================
97 Handle(BOPDS_PaveBlock)& BOPDS_CommonBlock::PaveBlockOnEdge(const Standard_Integer aIx)
99 static Handle(BOPDS_PaveBlock) aPBs;
101 Standard_Integer aIOr;
102 BOPDS_ListIteratorOfListOfPaveBlock anIt;
104 anIt.Initialize(myPaveBlocks);
105 for (; anIt.More(); anIt.Next()) {
106 Handle(BOPDS_PaveBlock)& aPB=anIt.ChangeValue();
107 aIOr=aPB->OriginalEdge();
114 //=======================================================================
115 // function: IsPaveBlockOnFace
117 //=======================================================================
118 Standard_Boolean BOPDS_CommonBlock::IsPaveBlockOnFace(const Standard_Integer aIx)const
120 Standard_Boolean bFound;
122 BOPCol_ListIteratorOfListOfInteger anIt;
124 bFound=Standard_False;
125 anIt.Initialize(myFaces);
126 for (; anIt.More(); anIt.Next()) {
134 //=======================================================================
135 // function: IsPaveBlockOnEdge
137 //=======================================================================
138 Standard_Boolean BOPDS_CommonBlock::IsPaveBlockOnEdge(const Standard_Integer aIx)const
140 Standard_Boolean bFound;
141 Standard_Integer aIOr;
142 BOPDS_ListIteratorOfListOfPaveBlock anIt;
144 bFound=Standard_False;
145 anIt.Initialize(myPaveBlocks);
146 for (; anIt.More(); anIt.Next()) {
147 const Handle(BOPDS_PaveBlock)& aPB=anIt.Value();
148 aIOr=aPB->OriginalEdge();
155 //=======================================================================
158 //=======================================================================
159 void BOPDS_CommonBlock::SetEdge(const Standard_Integer theEdge)
161 BOPDS_ListIteratorOfListOfPaveBlock anIt;
163 anIt.Initialize(myPaveBlocks);
164 for (; anIt.More(); anIt.Next()) {
165 Handle(BOPDS_PaveBlock)& aPB=anIt.ChangeValue();
166 aPB->SetEdge(theEdge);
169 //=======================================================================
172 //=======================================================================
173 Standard_Integer BOPDS_CommonBlock::Edge()const
175 const Handle(BOPDS_PaveBlock)& aPB1=myPaveBlocks.First();
181 //=======================================================================
182 // function: Contains
184 //=======================================================================
185 Standard_Boolean BOPDS_CommonBlock::Contains(const Handle(BOPDS_PaveBlock)& aPBx)const
187 Standard_Boolean bFound;
188 Standard_Integer aNb1;
189 BOPDS_ListIteratorOfListOfPaveBlock anIt;
191 bFound=Standard_False;
192 aNb1=myPaveBlocks.Extent();
198 anIt.Initialize(myPaveBlocks);
199 for (; anIt.More(); anIt.Next()) {
200 const Handle(BOPDS_PaveBlock)& aPB=anIt.Value();
207 //=======================================================================
208 // function: Contains
210 //=======================================================================
211 Standard_Boolean BOPDS_CommonBlock::Contains(const Standard_Integer theF)const
213 Standard_Boolean bFound;
214 BOPCol_ListIteratorOfListOfInteger aIt;
216 bFound=Standard_False;
217 aIt.Initialize(myFaces);
218 for (; aIt.More(); aIt.Next()) {
219 if (aIt.Value()==theF) {
225 //=======================================================================
228 //=======================================================================
229 void BOPDS_CommonBlock::Dump()const
232 BOPCol_ListIteratorOfListOfInteger aIt;
233 BOPDS_ListIteratorOfListOfPaveBlock aItPB;
236 aItPB.Initialize(myPaveBlocks);
237 for (; aItPB.More(); aItPB.Next()) {
238 const Handle(BOPDS_PaveBlock)& aPB=aItPB.Value();
243 if (myFaces.Extent()) {
245 aIt.Initialize(myFaces);
246 for (; aIt.More(); aIt.Next()) {