1 // Created by: Peter KURNEV
2 // Copyright (c) 2010-2014 OPEN CASCADE SAS
3 // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4 // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
5 // EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 // This file is part of Open CASCADE Technology software library.
9 // This library is free software; you can redistribute it and / or modify it
10 // under the terms of the GNU Lesser General Public version 2.1 as published
11 // by the Free Software Foundation, with special exception defined in the file
12 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
13 // distribution for complete text of the license and disclaimer of any warranty.
15 // Alternatively, this file may be used under the terms of Open CASCADE
16 // commercial license or contractual agreement.
18 #include <BOPAlgo_PaveFiller.ixx>
20 #include <NCollection_IncAllocator.hxx>
22 #include <TopoDS_Vertex.hxx>
23 #include <TopoDS_Face.hxx>
24 #include <BRep_Tool.hxx>
25 #include <BRep_Builder.hxx>
26 #include <BRepBndLib.hxx>
28 #include <BOPCol_MapOfInteger.hxx>
30 #include <BOPInt_Context.hxx>
32 #include <BOPDS_Iterator.hxx>
33 #include <BOPDS_VectorOfInterfVF.hxx>
34 #include <BOPDS_Interf.hxx>
35 #include <BOPDS_SubIterator.hxx>
36 #include <BOPDS_MapOfPaveBlock.hxx>
37 #include <BOPDS_FaceInfo.hxx>
38 #include <BOPCol_MapOfInteger.hxx>
40 //=======================================================================
41 // function: PerformVF
43 //=======================================================================
44 void BOPAlgo_PaveFiller::PerformVF()
46 Standard_Boolean bJustAdd;
47 Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, i;
48 Standard_Real aT1, aT2, aTolF, aTolV;
53 myIterator->Initialize(TopAbs_VERTEX, TopAbs_FACE);
54 iSize=myIterator->ExpectedLength();
57 BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
58 aVFs.SetStartSize(iSize);
59 aVFs.SetIncrement(iSize);
62 for (; myIterator->More(); myIterator->Next()) {
63 myIterator->Value(nV, nF, bJustAdd);
68 if (myDS->IsSubShape(nV, nF)) {
72 if (myDS->HasInterfShapeSubShapes(nV, nF)) {
73 myDS->ChangeFaceInfo(nF);
78 if (myDS->HasShapeSD(nV, nVSD)) {
82 if (myDS->HasInterf(nVx, nF)) {
86 const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
87 const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
89 aTolV = BRep_Tool::Tolerance(aV);
90 aTolF = BRep_Tool::Tolerance(aF);
92 iFlag=myContext->ComputeVF(aV, aF, aT1, aT2);
96 BOPDS_InterfVF& aVF=aVFs(i);
97 aVF.SetIndices(nVx, nF);
100 myDS->AddInterf(nVx, nF);
102 BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
103 BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
107 aBB.UpdateVertex(aV, aTolF);
108 BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVx);
109 Bnd_Box& aBoxV = aSIV.ChangeBox();
110 BRepBndLib::Add(aV, aBoxV);
113 }// for (; myIterator->More(); myIterator->Next()) {
117 BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
118 aVFs.SetStartSize(iSize);
119 aVFs.SetIncrement(iSize);
127 //=======================================================================
128 //function : TreatVerticesEE
130 //=======================================================================
131 void BOPAlgo_PaveFiller::TreatVerticesEE()
133 Standard_Integer i, aNbS, aNbEEs, nF, nV, iFlag;
134 Standard_Real aT1, aT2;
135 BOPCol_ListIteratorOfListOfInteger aItLI;
136 Handle(NCollection_IncAllocator) aAllocator;
138 //-----------------------------------------------------scope_1 f
139 aAllocator=new NCollection_IncAllocator();
140 BOPCol_ListOfInteger aLIV(aAllocator), aLIF(aAllocator);
141 BOPCol_MapOfInteger aMI(100, aAllocator);
142 BOPDS_MapOfPaveBlock aMPBF(100, aAllocator);
147 aNbS=myDS->NbSourceShapes();
149 BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
150 aNbEEs=aEEs.Extent();
151 for (i=0; i<aNbEEs; ++i) {
152 BOPDS_InterfEE& aEE=aEEs(i);
153 if (aEE.HasIndexNew()) {
160 if (!aLIV.Extent()) {
161 aAllocator.Nullify();
165 aNbS=myDS->NbSourceShapes();
166 for (nF=0; nF<aNbS; ++nF) {
167 const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(nF);
168 if (aSI.ShapeType()==TopAbs_FACE) {
172 if (!aLIF.Extent()) {
173 aAllocator.Nullify();
176 //-------------------------------------------------------------
177 BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
179 BOPDS_SubIterator aIt(aAllocator);
182 aIt.SetSubSet1(aLIF);
183 aIt.SetSubSet2(aLIV);
186 for (; aIt.More(); aIt.Next()) {
189 BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
190 const BOPCol_MapOfInteger& aMVOn=aFI.VerticesOn();
192 if (!aMVOn.Contains(nV)) {
193 const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nV)));
194 const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
195 iFlag=myContext->ComputeVF(aV, aF, aT1, aT2);
199 BOPDS_InterfVF& aVF=aVFs(i);
200 aVF.SetIndices(nV, nF);
203 myDS->AddInterf(nV, nF);
205 BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
211 aAllocator.Nullify();
212 //-----------------------------------------------------scope_1 t