1 // Copyright (C) 2007-2008 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
22 // File: NMTTools_CommonBlock.cxx
23 // Created: Tue Dec 9 12:23:29 2003
24 // Author: Peter KURNEV
27 #include <NMTTools_CommonBlock.ixx>
29 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
30 #include <TColStd_ListIteratorOfListOfInteger.hxx>
32 //=======================================================================
33 // function: NMTTools_CommonBlock::NMTTools_CommonBlock()
35 //=======================================================================
36 NMTTools_CommonBlock::NMTTools_CommonBlock()
39 //=======================================================================
40 // function: AddPaveBlock
42 //=======================================================================
43 void NMTTools_CommonBlock::AddPaveBlock(const BOPTools_PaveBlock& aPB)
45 myPaveBlocks.Append(aPB);
47 //=======================================================================
50 //=======================================================================
51 void NMTTools_CommonBlock::AddFace(const Standard_Integer aF)
55 //=======================================================================
58 //=======================================================================
59 void NMTTools_CommonBlock::AddFaces(const TColStd_ListOfInteger& aLF)
61 TColStd_ListIteratorOfListOfInteger aIt(aLF);
63 for (; aIt.More(); aIt.Next()) {
64 myFaces.Append(aIt.Value());
67 //=======================================================================
68 // function: PaveBlocks
70 //=======================================================================
71 const BOPTools_ListOfPaveBlock& NMTTools_CommonBlock::PaveBlocks()const
75 //=======================================================================
78 //=======================================================================
79 const TColStd_ListOfInteger& NMTTools_CommonBlock::Faces()const
83 //=======================================================================
84 // function: PaveBlock1
86 //=======================================================================
87 const BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlock1()const
89 return myPaveBlocks.First();
91 //=======================================================================
92 // function: PaveBlock1
94 //=======================================================================
95 BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlock1(const Standard_Integer aIx)
97 return PaveBlockOnEdge(aIx);
99 //=======================================================================
100 // function: PaveBlockOnEdge
102 //=======================================================================
103 BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlockOnEdge(const Standard_Integer aIx)
105 static BOPTools_PaveBlock aPBs;
106 Standard_Integer aIOr;
107 BOPTools_ListIteratorOfListOfPaveBlock anIt(myPaveBlocks);
109 for (; anIt.More(); anIt.Next()) {
110 BOPTools_PaveBlock& aPB=anIt.Value();
111 aIOr=aPB.OriginalEdge();
118 //=======================================================================
119 // function: IsPaveBlockOnFace
121 //=======================================================================
122 Standard_Boolean NMTTools_CommonBlock::IsPaveBlockOnFace(const Standard_Integer aIx)const
124 Standard_Boolean bFound=Standard_False;
126 TColStd_ListIteratorOfListOfInteger anIt(myFaces);
128 for (; anIt.More(); anIt.Next()) {
136 //=======================================================================
137 // function: IsPaveBlockOnEdge
139 //=======================================================================
140 Standard_Boolean NMTTools_CommonBlock::IsPaveBlockOnEdge(const Standard_Integer aIx)const
142 Standard_Boolean bFound=Standard_False;
143 Standard_Integer aIOr;
144 BOPTools_ListIteratorOfListOfPaveBlock anIt(myPaveBlocks);
146 for (; anIt.More(); anIt.Next()) {
147 const BOPTools_PaveBlock& aPB=anIt.Value();
148 aIOr=aPB.OriginalEdge();
155 //=======================================================================
158 //=======================================================================
159 Standard_Boolean NMTTools_CommonBlock::IsEqual(const NMTTools_CommonBlock& aOther)const
161 Standard_Boolean bFound=Standard_True;
162 Standard_Integer aNb1, aNb2;
163 BOPTools_ListIteratorOfListOfPaveBlock anIt;
165 aNb1=myPaveBlocks.Extent();
166 aNb2=aOther.myPaveBlocks.Extent();
168 if (!aNb1 && !aNb2) {
178 const BOPTools_PaveBlock& aPB=PaveBlock1();
180 anIt.Initialize(aOther.myPaveBlocks);
181 for (; anIt.More(); anIt.Next()) {
182 const BOPTools_PaveBlock& aPBOther=anIt.Value();
183 if (aPB.IsEqual(aPBOther)){
189 //=======================================================================
190 // function: Contains
192 //=======================================================================
193 Standard_Boolean NMTTools_CommonBlock::Contains(const BOPTools_PaveBlock& aPBx)const
195 Standard_Boolean bFound=Standard_False;
196 Standard_Integer aNb1;
197 BOPTools_ListIteratorOfListOfPaveBlock anIt;
199 aNb1=myPaveBlocks.Extent();
205 anIt.Initialize(myPaveBlocks);
206 for (; anIt.More(); anIt.Next()) {
207 const BOPTools_PaveBlock& aPB=anIt.Value();
208 if (aPB.IsEqual(aPBx)) {
215 //=======================================================================
218 //=======================================================================
219 void NMTTools_CommonBlock::SetEdge(const Standard_Integer anEdge)
221 BOPTools_ListIteratorOfListOfPaveBlock anIt;
223 anIt.Initialize(myPaveBlocks);
224 for (; anIt.More(); anIt.Next()) {
225 BOPTools_PaveBlock& aPB=anIt.Value();
229 //=======================================================================
232 //=======================================================================
233 Standard_Integer NMTTools_CommonBlock::Edge()const
235 Standard_Integer aNb;
237 aNb=myPaveBlocks.Extent();
243 const BOPTools_PaveBlock& aPB=PaveBlock1();