1 // File: NMTTools_CommonBlock.cxx
2 // Created: Tue Dec 9 12:23:29 2003
3 // Author: Peter KURNEV
7 #include <NMTTools_CommonBlock.ixx>
9 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
10 #include <TColStd_ListIteratorOfListOfInteger.hxx>
12 //=======================================================================
13 // function: NMTTools_CommonBlock::NMTTools_CommonBlock()
15 //=======================================================================
16 NMTTools_CommonBlock::NMTTools_CommonBlock()
19 //=======================================================================
20 // function: AddPaveBlock
22 //=======================================================================
23 void NMTTools_CommonBlock::AddPaveBlock(const BOPTools_PaveBlock& aPB)
25 myPaveBlocks.Append(aPB);
27 //=======================================================================
30 //=======================================================================
31 void NMTTools_CommonBlock::AddFace(const Standard_Integer aF)
35 //=======================================================================
38 //=======================================================================
39 void NMTTools_CommonBlock::AddFaces(const TColStd_ListOfInteger& aLF)
41 TColStd_ListIteratorOfListOfInteger aIt(aLF);
43 for (; aIt.More(); aIt.Next()) {
44 myFaces.Append(aIt.Value());
47 //=======================================================================
48 // function: PaveBlocks
50 //=======================================================================
51 const BOPTools_ListOfPaveBlock& NMTTools_CommonBlock::PaveBlocks()const
55 //=======================================================================
58 //=======================================================================
59 const TColStd_ListOfInteger& NMTTools_CommonBlock::Faces()const
63 //=======================================================================
64 // function: PaveBlock1
66 //=======================================================================
67 const BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlock1()const
69 return myPaveBlocks.First();
71 //=======================================================================
72 // function: PaveBlock1
74 //=======================================================================
75 BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlock1(const Standard_Integer aIx)
77 return PaveBlockOnEdge(aIx);
79 //=======================================================================
80 // function: PaveBlockOnEdge
82 //=======================================================================
83 BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlockOnEdge(const Standard_Integer aIx)
85 static BOPTools_PaveBlock aPBs;
86 Standard_Integer aIOr;
87 BOPTools_ListIteratorOfListOfPaveBlock anIt(myPaveBlocks);
89 for (; anIt.More(); anIt.Next()) {
90 BOPTools_PaveBlock& aPB=anIt.Value();
91 aIOr=aPB.OriginalEdge();
98 //=======================================================================
99 // function: IsPaveBlockOnFace
101 //=======================================================================
102 Standard_Boolean NMTTools_CommonBlock::IsPaveBlockOnFace(const Standard_Integer aIx)const
104 Standard_Boolean bFound=Standard_False;
106 TColStd_ListIteratorOfListOfInteger anIt(myFaces);
108 for (; anIt.More(); anIt.Next()) {
116 //=======================================================================
117 // function: IsPaveBlockOnEdge
119 //=======================================================================
120 Standard_Boolean NMTTools_CommonBlock::IsPaveBlockOnEdge(const Standard_Integer aIx)const
122 Standard_Boolean bFound=Standard_False;
123 Standard_Integer aIOr;
124 BOPTools_ListIteratorOfListOfPaveBlock anIt(myPaveBlocks);
126 for (; anIt.More(); anIt.Next()) {
127 const BOPTools_PaveBlock& aPB=anIt.Value();
128 aIOr=aPB.OriginalEdge();
135 //=======================================================================
138 //=======================================================================
139 Standard_Boolean NMTTools_CommonBlock::IsEqual(const NMTTools_CommonBlock& aOther)const
141 Standard_Boolean bFound=Standard_True;
142 Standard_Integer aNb1, aNb2;
143 BOPTools_ListIteratorOfListOfPaveBlock anIt;
145 aNb1=myPaveBlocks.Extent();
146 aNb2=aOther.myPaveBlocks.Extent();
148 if (!aNb1 && !aNb2) {
158 const BOPTools_PaveBlock& aPB=PaveBlock1();
160 anIt.Initialize(aOther.myPaveBlocks);
161 for (; anIt.More(); anIt.Next()) {
162 const BOPTools_PaveBlock& aPBOther=anIt.Value();
163 if (aPB.IsEqual(aPBOther)){
169 //=======================================================================
170 // function: Contains
172 //=======================================================================
173 Standard_Boolean NMTTools_CommonBlock::Contains(const BOPTools_PaveBlock& aPBx)const
175 Standard_Boolean bFound=Standard_False;
176 Standard_Integer aNb1;
177 BOPTools_ListIteratorOfListOfPaveBlock anIt;
179 aNb1=myPaveBlocks.Extent();
185 anIt.Initialize(myPaveBlocks);
186 for (; anIt.More(); anIt.Next()) {
187 const BOPTools_PaveBlock& aPB=anIt.Value();
188 if (aPB.IsEqual(aPBx)) {
195 //=======================================================================
198 //=======================================================================
199 void NMTTools_CommonBlock::SetEdge(const Standard_Integer anEdge)
201 BOPTools_ListIteratorOfListOfPaveBlock anIt;
203 anIt.Initialize(myPaveBlocks);
204 for (; anIt.More(); anIt.Next()) {
205 BOPTools_PaveBlock& aPB=anIt.Value();
209 //=======================================================================
212 //=======================================================================
213 Standard_Integer NMTTools_CommonBlock::Edge()const
215 Standard_Integer aNb;
217 aNb=myPaveBlocks.Extent();
223 const BOPTools_PaveBlock& aPB=PaveBlock1();