0025769: Replace BOPCol_Array1 with NCollection_Vector
[occt.git] / src / BOPAlgo / BOPAlgo_PaveFiller_10.cxx
CommitLineData
ceaa5e27 1// Created by: Peter KURNEV
955b3e71 2// Copyright (c) 2010-2014 OPEN CASCADE SAS
ceaa5e27 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
6//
d5f74e42 7// This file is part of Open CASCADE Technology software library.
ceaa5e27 8//
d5f74e42 9// This library is free software; you can redistribute it and/or modify it under
10// the terms of the GNU Lesser General Public License 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.
ceaa5e27 14//
d5f74e42 15// Alternatively, this file may be used under the terms of Open CASCADE
16// commercial license or contractual agreement.
17
955b3e71 18#include <BOPAlgo_PaveFiller.ixx>
ceaa5e27 19
ceaa5e27 20#include <gp_Pnt.hxx>
955b3e71 21
ceaa5e27 22#include <TopAbs_State.hxx>
955b3e71 23
24#include <TopoDS_Vertex.hxx>
25#include <TopoDS_Solid.hxx>
ceaa5e27 26#include <BRep_Tool.hxx>
955b3e71 27#include <BRepClass3d_SolidClassifier.hxx>
28
29#include <IntTools_Context.hxx>
ceaa5e27 30
955b3e71 31#include <BOPDS_DS.hxx>
32#include <BOPDS_IteratorSI.hxx>
33#include <BOPDS_Interf.hxx>
ceaa5e27 34
35//=======================================================================
36//function : PerformVZ
37//purpose :
38//=======================================================================
955b3e71 39void BOPAlgo_PaveFiller::PerformVZ()
ceaa5e27 40{
41 Standard_Boolean bJustAdd;
402bfe81 42 Standard_Integer iSize, nV, nZ;
ceaa5e27 43 Standard_Real aTol;
44 gp_Pnt aPV;
45 TopAbs_State aState;
46 //
47 myErrorStatus=0;
48 //
49 myIterator->Initialize(TopAbs_VERTEX, TopAbs_SOLID);
50 iSize=myIterator->ExpectedLength();
51 if (!iSize) {
52 return;
53 }
54 //
55 BOPDS_VectorOfInterfVZ& aVZs=myDS->InterfVZ();
ceaa5e27 56 aVZs.SetIncrement(iSize);
ceaa5e27 57 //
58 for (; myIterator->More(); myIterator->Next()) {
59 myIterator->Value(nV, nZ, bJustAdd);
60 if(bJustAdd) {
61 continue;
62 }
63 //
64 const BOPDS_ShapeInfo& aSIV=myDS->ShapeInfo(nV);
65 const BOPDS_ShapeInfo& aSIZ=myDS->ShapeInfo(nZ);
66 //
67 const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aSIV.Shape());
68 const TopoDS_Solid& aZ=*((TopoDS_Solid*)&aSIZ.Shape());
69 //
70 BRepClass3d_SolidClassifier& aSC=myContext->SolidClassifier(aZ);
71 //
72 aPV=BRep_Tool::Pnt(aV);
73 aTol=BRep_Tool::Tolerance(aV);
74 //
75 aSC.Perform(aPV, aTol);
76 //
77 aState=aSC.State();
78 if (aState==TopAbs_IN) {
402bfe81 79 BOPDS_InterfVZ& aVZ=aVZs.Append1();
ceaa5e27 80 aVZ.SetIndices(nV, nZ);
81 //
82 myDS->AddInterf(nV, nZ);
83 }
84 }
ceaa5e27 85}
86//=======================================================================
87//function : PerformEZ
88//purpose :
89//=======================================================================
955b3e71 90void BOPAlgo_PaveFiller::PerformEZ()
ceaa5e27 91{
402bfe81 92 Standard_Boolean bJustAdd, bHasInterf;
93 Standard_Integer iSize, nE, nZ;
ceaa5e27 94 //
95 myErrorStatus=0;
96 //
97 myIterator->Initialize(TopAbs_EDGE, TopAbs_SOLID);
98 iSize=myIterator->ExpectedLength();
99 if (!iSize) {
100 return;
101 }
102 //
103 BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
ceaa5e27 104 aEZs.SetIncrement(iSize);
ceaa5e27 105 //
106 for (; myIterator->More(); myIterator->Next()) {
107 myIterator->Value(nE, nZ, bJustAdd);
108 if(bJustAdd) {
109 continue;
110 }
111 //
112 bHasInterf=myDS->HasInterfShapeSubShapes(nE, nZ);
113 if (bHasInterf) {
114 continue;
115 }
116 //
117 bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nE);
118 if (!bHasInterf) {
119 continue;
120 }
121 //
402bfe81 122 BOPDS_InterfEZ& aEZ=aEZs.Append1();
ceaa5e27 123 aEZ.SetIndices(nE, nZ);
124 //
125 myDS->AddInterf(nE, nZ);
126 }
127}
128//=======================================================================
129//function : PerformFZ
130//purpose :
131//=======================================================================
955b3e71 132void BOPAlgo_PaveFiller::PerformFZ()
ceaa5e27 133{
134 Standard_Boolean bJustAdd, bHasInterf;
402bfe81 135 Standard_Integer iSize, nF, nZ;
ceaa5e27 136 //
137 myErrorStatus=0;
138 //
139 myIterator->Initialize(TopAbs_FACE, TopAbs_SOLID);
140 iSize=myIterator->ExpectedLength();
141 if (!iSize) {
142 return;
143 }
144 //
145 BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ();
ceaa5e27 146 aFZs.SetIncrement(iSize);
ceaa5e27 147 //
148 for (; myIterator->More(); myIterator->Next()) {
149 myIterator->Value(nF, nZ, bJustAdd);
150 if(bJustAdd) {
151 continue;
152 }
153 //
154 bHasInterf=myDS->HasInterfShapeSubShapes(nF, nZ);
155 if (bHasInterf) {
156 continue;
157 }
158 //
159 bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nF);
160 if (!bHasInterf) {
161 continue;
162 }
163 //
402bfe81 164 BOPDS_InterfFZ& aFZ=aFZs.Append1();
ceaa5e27 165 aFZ.SetIndices(nF, nZ);
166 //
167 myDS->AddInterf(nF, nZ);
168 }
169}
170//=======================================================================
171//function : PerformZZ
172//purpose :
173//=======================================================================
955b3e71 174void BOPAlgo_PaveFiller::PerformZZ()
ceaa5e27 175{
176 Standard_Boolean bJustAdd, bHasInterf, bFlag;
402bfe81 177 Standard_Integer iSize, nZ1, nZ;
ceaa5e27 178 //
179 myErrorStatus=0;
180 //
181 myIterator->Initialize(TopAbs_SOLID, TopAbs_SOLID);
182 iSize=myIterator->ExpectedLength();
183 if (!iSize) {
184 return;
185 }
186 //
187 BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
ceaa5e27 188 aZZs.SetIncrement(iSize);
ceaa5e27 189 //
190 bFlag=Standard_False;
191 //
192 for (; myIterator->More(); myIterator->Next()) {
193 myIterator->Value(nZ1, nZ, bJustAdd);
194 if(bJustAdd) {
195 continue;
196 }
197 //
198 bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nZ1, bFlag);
199 if (!bHasInterf) {
200 bHasInterf=myDS->HasInterfShapeSubShapes(nZ1, nZ, bFlag);
201 }
202 if (!bHasInterf) {
203 continue;
204 }
205 //
402bfe81 206 BOPDS_InterfZZ& aZZ=aZZs.Append1();
ceaa5e27 207 aZZ.SetIndices(nZ1, nZ);
208 //
209 myDS->AddInterf(nZ1, nZ);
210 }
211}