1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File: NMTTools_CommonBlock.cxx
24 // Created: Tue Dec 9 12:23:29 2003
25 // Author: Peter KURNEV
28 #include <NMTTools_CommonBlock.hxx>
30 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
31 #include <TColStd_ListIteratorOfListOfInteger.hxx>
33 //=======================================================================
34 // function: NMTTools_CommonBlock::NMTTools_CommonBlock()
36 //=======================================================================
37 NMTTools_CommonBlock::NMTTools_CommonBlock()
40 //=======================================================================
41 // function: AddPaveBlock
43 //=======================================================================
44 void NMTTools_CommonBlock::AddPaveBlock(const BOPTools_PaveBlock& aPB)
46 myPaveBlocks.Append(aPB);
48 //=======================================================================
51 //=======================================================================
52 void NMTTools_CommonBlock::AddFace(const Standard_Integer aF)
56 //=======================================================================
59 //=======================================================================
60 void NMTTools_CommonBlock::AddFaces(const TColStd_ListOfInteger& aLF)
62 TColStd_ListIteratorOfListOfInteger aIt(aLF);
64 for (; aIt.More(); aIt.Next()) {
65 myFaces.Append(aIt.Value());
68 //=======================================================================
69 // function: PaveBlocks
71 //=======================================================================
72 const BOPTools_ListOfPaveBlock& NMTTools_CommonBlock::PaveBlocks()const
76 //=======================================================================
79 //=======================================================================
80 const TColStd_ListOfInteger& NMTTools_CommonBlock::Faces()const
84 //=======================================================================
85 // function: PaveBlock1
87 //=======================================================================
88 const BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlock1()const
90 return myPaveBlocks.First();
92 //=======================================================================
93 // function: PaveBlock1
95 //=======================================================================
96 BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlock1(const Standard_Integer aIx)
98 return PaveBlockOnEdge(aIx);
100 //=======================================================================
101 // function: PaveBlockOnEdge
103 //=======================================================================
104 BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlockOnEdge(const Standard_Integer aIx)
106 static BOPTools_PaveBlock aPBs;
107 Standard_Integer aIOr;
108 BOPTools_ListIteratorOfListOfPaveBlock anIt(myPaveBlocks);
110 for (; anIt.More(); anIt.Next()) {
111 BOPTools_PaveBlock& aPB=anIt.Value();
112 aIOr=aPB.OriginalEdge();
119 //=======================================================================
120 // function: IsPaveBlockOnFace
122 //=======================================================================
123 Standard_Boolean NMTTools_CommonBlock::IsPaveBlockOnFace(const Standard_Integer aIx)const
125 Standard_Boolean bFound=Standard_False;
127 TColStd_ListIteratorOfListOfInteger anIt(myFaces);
129 for (; anIt.More(); anIt.Next()) {
137 //=======================================================================
138 // function: IsPaveBlockOnEdge
140 //=======================================================================
141 Standard_Boolean NMTTools_CommonBlock::IsPaveBlockOnEdge(const Standard_Integer aIx)const
143 Standard_Boolean bFound=Standard_False;
144 Standard_Integer aIOr;
145 BOPTools_ListIteratorOfListOfPaveBlock anIt(myPaveBlocks);
147 for (; anIt.More(); anIt.Next()) {
148 const BOPTools_PaveBlock& aPB=anIt.Value();
149 aIOr=aPB.OriginalEdge();
156 //=======================================================================
159 //=======================================================================
160 Standard_Boolean NMTTools_CommonBlock::IsEqual(const NMTTools_CommonBlock& aOther)const
162 Standard_Boolean bFound=Standard_True;
163 Standard_Integer aNb1, aNb2;
164 BOPTools_ListIteratorOfListOfPaveBlock anIt;
166 aNb1=myPaveBlocks.Extent();
167 aNb2=aOther.myPaveBlocks.Extent();
169 if (!aNb1 && !aNb2) {
179 const BOPTools_PaveBlock& aPB=PaveBlock1();
181 anIt.Initialize(aOther.myPaveBlocks);
182 for (; anIt.More(); anIt.Next()) {
183 const BOPTools_PaveBlock& aPBOther=anIt.Value();
184 if (aPB.IsEqual(aPBOther)){
190 //=======================================================================
191 // function: Contains
193 //=======================================================================
194 Standard_Boolean NMTTools_CommonBlock::Contains(const BOPTools_PaveBlock& aPBx)const
196 Standard_Boolean bFound=Standard_False;
197 Standard_Integer aNb1;
198 BOPTools_ListIteratorOfListOfPaveBlock anIt;
200 aNb1=myPaveBlocks.Extent();
206 anIt.Initialize(myPaveBlocks);
207 for (; anIt.More(); anIt.Next()) {
208 const BOPTools_PaveBlock& aPB=anIt.Value();
209 if (aPB.IsEqual(aPBx)) {
216 //=======================================================================
219 //=======================================================================
220 void NMTTools_CommonBlock::SetEdge(const Standard_Integer anEdge)
222 BOPTools_ListIteratorOfListOfPaveBlock anIt;
224 anIt.Initialize(myPaveBlocks);
225 for (; anIt.More(); anIt.Next()) {
226 BOPTools_PaveBlock& aPB=anIt.Value();
230 //=======================================================================
233 //=======================================================================
234 Standard_Integer NMTTools_CommonBlock::Edge()const
236 Standard_Integer aNb;
238 aNb=myPaveBlocks.Extent();
244 const BOPTools_PaveBlock& aPB=PaveBlock1();