1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
// Created by: Peter KURNEV
// Copyright (c) 2010-2014 OPEN CASCADE SAS
// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPAlgo_PaveFiller.ixx>
#include <NCollection_IncAllocator.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepBndLib.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPInt_Context.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPDS_VectorOfInterfVF.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_SubIterator.hxx>
#include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_FaceInfo.hxx>
#include <BOPCol_MapOfInteger.hxx>
//=======================================================================
// function: PerformVF
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::PerformVF()
{
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, i;
Standard_Real aT1, aT2, aTolF, aTolV;
BRep_Builder aBB;
//
myErrorStatus=0;
//
myIterator->Initialize(TopAbs_VERTEX, TopAbs_FACE);
iSize=myIterator->ExpectedLength();
if (iSize) {
//
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
aVFs.SetStartSize(iSize);
aVFs.SetIncrement(iSize);
aVFs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nF, bJustAdd);
if(bJustAdd) {
continue;
}
//
if (myDS->IsSubShape(nV, nF)) {
continue;
}
//
if (myDS->HasInterfShapeSubShapes(nV, nF)) {
myDS->ChangeFaceInfo(nF);
continue;
}
//
nVx=nV;
if (myDS->HasShapeSD(nV, nVSD)) {
nVx=nVSD;
}
//
if (myDS->HasInterf(nVx, nF)) {
continue;
}
//
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
//
aTolV = BRep_Tool::Tolerance(aV);
aTolF = BRep_Tool::Tolerance(aF);
//
iFlag=myContext->ComputeVF(aV, aF, aT1, aT2);
if (!iFlag) {
// 1
i=aVFs.Append()-1;
BOPDS_InterfVF& aVF=aVFs(i);
aVF.SetIndices(nVx, nF);
aVF.SetUV(aT1, aT2);
// 2
myDS->AddInterf(nVx, nF);
//
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
aMVIn.Add(nVx);
//
if (aTolV < aTolF) {
aBB.UpdateVertex(aV, aTolF);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVx);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::Add(aV, aBoxV);
}
}
}// for (; myIterator->More(); myIterator->Next()) {
}// if (iSize) {
else {
iSize=10;
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
aVFs.SetStartSize(iSize);
aVFs.SetIncrement(iSize);
aVFs.Init();
}
//
TreatVerticesEE();
}
//=======================================================================
//function : TreatVerticesEE
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::TreatVerticesEE()
{
Standard_Integer i, aNbS, aNbEEs, nF, nV, iFlag;
Standard_Real aT1, aT2;
BOPCol_ListIteratorOfListOfInteger aItLI;
Handle(NCollection_IncAllocator) aAllocator;
//
//-----------------------------------------------------scope_1 f
aAllocator=new NCollection_IncAllocator();
BOPCol_ListOfInteger aLIV(aAllocator), aLIF(aAllocator);
BOPCol_MapOfInteger aMI(100, aAllocator);
BOPDS_MapOfPaveBlock aMPBF(100, aAllocator);
//
myErrorStatus=0;
//
aNbS=myDS->NbSourceShapes();
//
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
aNbEEs=aEEs.Extent();
for (i=0; i<aNbEEs; ++i) {
BOPDS_InterfEE& aEE=aEEs(i);
if (aEE.HasIndexNew()) {
nV=aEE.IndexNew();
if (aMI.Add(nV)) {
aLIV.Append(nV);
}
}
}
if (!aLIV.Extent()) {
aAllocator.Nullify();
return;
}
//
aNbS=myDS->NbSourceShapes();
for (nF=0; nF<aNbS; ++nF) {
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(nF);
if (aSI.ShapeType()==TopAbs_FACE) {
aLIF.Append(nF);
}
}
if (!aLIF.Extent()) {
aAllocator.Nullify();
return;
}
//-------------------------------------------------------------
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
//
BOPDS_SubIterator aIt(aAllocator);
//
aIt.SetDS(myDS);
aIt.SetSubSet1(aLIF);
aIt.SetSubSet2(aLIV);
aIt.Prepare();
aIt.Initialize();
for (; aIt.More(); aIt.Next()) {
aIt.Value(nV, nF);
//
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
const BOPCol_MapOfInteger& aMVOn=aFI.VerticesOn();
//
if (!aMVOn.Contains(nV)) {
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nV)));
const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
iFlag=myContext->ComputeVF(aV, aF, aT1, aT2);
if (!iFlag) {
// 1
i=aVFs.Append()-1;
BOPDS_InterfVF& aVF=aVFs(i);
aVF.SetIndices(nV, nF);
aVF.SetUV(aT1, aT2);
// 2
myDS->AddInterf(nV, nF);
//
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
aMVIn.Add(nV);
}
}
}
//
aAllocator.Nullify();
//-----------------------------------------------------scope_1 t
}