42cf5bc1 |
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 |
6 | // |
7 | // This file is part of Open CASCADE Technology software library. |
8 | // |
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. |
14 | // |
15 | // Alternatively, this file may be used under the terms of Open CASCADE |
16 | // commercial license or contractual agreement. |
17 | |
18 | #ifndef _BOPAlgo_PaveFiller_HeaderFile |
19 | #define _BOPAlgo_PaveFiller_HeaderFile |
20 | |
21 | #include <Standard.hxx> |
22 | #include <Standard_DefineAlloc.hxx> |
23 | #include <Standard_Handle.hxx> |
24 | |
42cf5bc1 |
25 | #include <BOPAlgo_Algo.hxx> |
1155d05a |
26 | #include <BOPAlgo_GlueEnum.hxx> |
27 | #include <BOPAlgo_SectionAttribute.hxx> |
28 | #include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx> |
29 | #include <BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx> |
42cf5bc1 |
30 | #include <BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx> |
42cf5bc1 |
31 | #include <BOPDS_IndexedMapOfPaveBlock.hxx> |
42cf5bc1 |
32 | #include <BOPDS_ListOfPaveBlock.hxx> |
8ae442a8 |
33 | #include <BOPDS_MapOfPair.hxx> |
1155d05a |
34 | #include <BOPDS_MapOfPaveBlock.hxx> |
35 | #include <BOPDS_PDS.hxx> |
36 | #include <BOPDS_PIterator.hxx> |
0d0481c7 |
37 | #include <BOPDS_VectorOfCurve.hxx> |
1155d05a |
38 | #include <IntSurf_ListOfPntOn2S.hxx> |
33ba8565 |
39 | #include <IntTools_ShrunkRange.hxx> |
1155d05a |
40 | #include <NCollection_BaseAllocator.hxx> |
41 | #include <Standard_Boolean.hxx> |
42 | #include <Standard_Integer.hxx> |
43 | #include <Standard_Real.hxx> |
44 | #include <TColStd_DataMapOfIntegerInteger.hxx> |
45 | #include <TColStd_DataMapOfIntegerListOfInteger.hxx> |
46 | #include <TColStd_DataMapOfIntegerReal.hxx> |
47 | #include <TColStd_ListOfInteger.hxx> |
48 | #include <TColStd_MapOfInteger.hxx> |
49 | #include <TopAbs_ShapeEnum.hxx> |
50 | #include <TopTools_DataMapOfShapeInteger.hxx> |
51 | #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> |
52 | #include <TopTools_IndexedMapOfShape.hxx> |
53 | #include <TopTools_ListOfShape.hxx> |
42cf5bc1 |
54 | class IntTools_Context; |
55 | class BOPDS_DS; |
56 | class BOPAlgo_SectionAttribute; |
57 | class BOPDS_PaveBlock; |
3510db62 |
58 | class BOPDS_CommonBlock; |
42cf5bc1 |
59 | class gp_Pnt; |
60 | class BOPDS_Curve; |
01b5b3df |
61 | class TopoDS_Vertex; |
62 | class TopoDS_Edge; |
42cf5bc1 |
63 | class TopoDS_Face; |
64 | |
33ba8565 |
65 | //! |
66 | //! The class represents the Intersection phase of the |
67 | //! Boolean Operations algorithm.<br> |
68 | //! It performs the pairwise intersection of the sub-shapes of |
69 | //! the arguments in the following order:<br> |
70 | //! 1. Vertex/Vertex;<br> |
71 | //! 2. Vertex/Edge;<br> |
72 | //! 3. Edge/Edge;<br> |
73 | //! 4. Vertex/Face;<br> |
74 | //! 5. Edge/Face;<br> |
75 | //! 6. Face/Face.<br> |
76 | //! |
77 | //! The results of intersection are stored into the Data Structure |
78 | //! of the algorithm.<br> |
79 | //! |
80 | //! Additionally to the options provided by the parent class, |
81 | //! the algorithm has the following options:<br> |
82 | //! - *Section attributes* - allows to customize the intersection of the faces |
83 | //! (avoid approximation or building 2d curves);<br> |
84 | //! - *Safe processing mode* - allows to avoid modification of the input |
85 | //! shapes during the operation (by default it is off);<br> |
86 | //! - *Gluing options* - allows to speed up the calculation on the special |
87 | //! cases, in which some sub-shapes are coincide.<br> |
88 | //! |
ad8b073e |
89 | //! The algorithm returns the following Warning statuses: |
90 | //! - *BOPAlgo_AlertSelfInterferingShape* - in case some of the argument shapes are self-interfering shapes; |
91 | //! - *BOPAlgo_AlertTooSmallEdge* - in case some edges of the input shapes have no valid range; |
33ba8565 |
92 | //! - *BOPAlgo_AlertNotSplittableEdge* - in case some edges of the input shapes has such a small |
ad8b073e |
93 | //! valid range so it cannot be split; |
33ba8565 |
94 | //! - *BOPAlgo_AlertBadPositioning* - in case the positioning of the input shapes leads to creation |
ad8b073e |
95 | //! of small edges; |
96 | //! - *BOPAlgo_AlertIntersectionOfPairOfShapesFailed* - in case intersection of some of the |
97 | //! sub-shapes has failed; |
98 | //! - *BOPAlgo_AlertAcquiredSelfIntersection* - in case some sub-shapes of the argument become connected |
99 | //! through other shapes; |
100 | //! - *BOPAlgo_AlertBuildingPCurveFailed* - in case building 2D curve for some of the edges |
101 | //! on the faces has failed. |
33ba8565 |
102 | //! |
103 | //! The algorithm returns the following Error alerts: |
104 | //! - *BOPAlgo_AlertTooFewArguments* - in case there are no enough arguments to |
105 | //! perform the operation;<br> |
106 | //! - *BOPAlgo_AlertIntersectionFailed* - in case some unexpected error occurred;<br> |
107 | //! - *BOPAlgo_AlertNullInputShapes* - in case some of the arguments are null shapes.<br> |
108 | //! |
42cf5bc1 |
109 | class BOPAlgo_PaveFiller : public BOPAlgo_Algo |
110 | { |
111 | public: |
112 | |
113 | DEFINE_STANDARD_ALLOC |
114 | |
115 | |
116 | Standard_EXPORT BOPAlgo_PaveFiller(); |
3510db62 |
117 | |
118 | Standard_EXPORT virtual ~BOPAlgo_PaveFiller(); |
42cf5bc1 |
119 | |
1155d05a |
120 | Standard_EXPORT BOPAlgo_PaveFiller(const Handle(NCollection_BaseAllocator)& theAllocator); |
42cf5bc1 |
121 | |
122 | Standard_EXPORT const BOPDS_DS& DS(); |
123 | |
124 | Standard_EXPORT BOPDS_PDS PDS(); |
125 | |
126 | Standard_EXPORT const BOPDS_PIterator& Iterator(); |
127 | |
1155d05a |
128 | Standard_EXPORT void SetArguments (const TopTools_ListOfShape& theLS); |
42cf5bc1 |
129 | |
1155d05a |
130 | Standard_EXPORT const TopTools_ListOfShape& Arguments() const; |
42cf5bc1 |
131 | |
51db0179 |
132 | Standard_EXPORT const Handle(IntTools_Context)& Context(); |
42cf5bc1 |
133 | |
134 | Standard_EXPORT void SetSectionAttribute (const BOPAlgo_SectionAttribute& theSecAttr); |
135 | |
3510db62 |
136 | //! Sets the flag that defines the mode of treatment. |
137 | //! In non-destructive mode the argument shapes are not modified. Instead |
138 | //! a copy of a sub-shape is created in the result if it is needed to be updated. |
139 | Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag); |
140 | |
141 | //! Returns the flag that defines the mode of treatment. |
142 | //! In non-destructive mode the argument shapes are not modified. Instead |
143 | //! a copy of a sub-shape is created in the result if it is needed to be updated. |
144 | Standard_EXPORT Standard_Boolean NonDestructive() const; |
145 | |
42cf5bc1 |
146 | Standard_EXPORT virtual void Perform() Standard_OVERRIDE; |
147 | |
42cf5bc1 |
148 | |
42cf5bc1 |
149 | |
483ce1bd |
150 | //! Sets the glue option for the algorithm |
151 | Standard_EXPORT void SetGlue(const BOPAlgo_GlueEnum theGlue); |
152 | |
153 | //! Returns the glue option of the algorithm |
154 | Standard_EXPORT BOPAlgo_GlueEnum Glue() const; |
155 | |
0c5a6d47 |
156 | //! Sets the flag to avoid building of p-curves of edges on faces |
157 | void SetAvoidBuildPCurve(const Standard_Boolean theValue) |
158 | { |
159 | myAvoidBuildPCurve = theValue; |
160 | } |
161 | |
162 | //! Returns the flag to avoid building of p-curves of edges on faces |
163 | Standard_Boolean IsAvoidBuildPCurve() const |
164 | { |
165 | return myAvoidBuildPCurve; |
166 | } |
483ce1bd |
167 | |
42cf5bc1 |
168 | protected: |
169 | |
01b5b3df |
170 | typedef NCollection_DataMap |
171 | <Handle(BOPDS_PaveBlock), |
172 | Bnd_Box, |
173 | TColStd_MapTransientHasher> BOPAlgo_DataMapOfPaveBlockBndBox; |
174 | |
d3578357 |
175 | typedef NCollection_DataMap |
176 | <Handle(BOPDS_PaveBlock), |
177 | TColStd_ListOfInteger, |
178 | TColStd_MapTransientHasher> BOPAlgo_DataMapOfPaveBlockListOfInteger; |
179 | |
180 | typedef NCollection_DataMap |
181 | <Standard_Integer, |
182 | BOPDS_MapOfPaveBlock> BOPAlgo_DataMapOfIntegerMapOfPaveBlock; |
01b5b3df |
183 | |
3510db62 |
184 | //! Sets non-destructive mode automatically if an argument |
185 | //! contains a locked sub-shape (see TopoDS_Shape::Locked()). |
186 | Standard_EXPORT void SetNonDestructive(); |
187 | |
188 | Standard_EXPORT void SetIsPrimary(const Standard_Boolean theFlag); |
189 | |
190 | Standard_EXPORT Standard_Boolean IsPrimary() const; |
191 | |
42cf5bc1 |
192 | Standard_EXPORT virtual void PerformInternal(); |
193 | |
33ba8565 |
194 | Standard_EXPORT virtual void Clear() Standard_OVERRIDE; |
42cf5bc1 |
195 | |
196 | Standard_EXPORT virtual void Init(); |
197 | |
198 | Standard_EXPORT void Prepare(); |
199 | |
200 | Standard_EXPORT virtual void PerformVV(); |
201 | |
202 | Standard_EXPORT virtual void PerformVE(); |
8ae442a8 |
203 | |
204 | //! Performs the intersection of the vertices with edges. |
205 | Standard_EXPORT void IntersectVE(const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theVEPairs, |
206 | const Standard_Boolean bAddInterfs = Standard_True); |
207 | |
208 | //! Splits the Pave Blocks of the given edges with the extra paves.<br> |
209 | //! The method also builds the shrunk data for the new pave blocks and |
210 | //! in case there is no valid range on the pave block, the vertices of |
211 | //! this pave block will be united making SD vertex.<br> |
212 | //! Parameter <theAddInterfs> defines whether this interference will be added |
213 | //! into common table of interferences or not.<br> |
214 | //! If some of the Pave Blocks are forming the Common Blocks, the splits |
215 | //! of the Pave Blocks will also form a Common Block. |
1155d05a |
216 | Standard_EXPORT void SplitPaveBlocks(const TColStd_MapOfInteger& theMEdges, |
8ae442a8 |
217 | const Standard_Boolean theAddInterfs); |
42cf5bc1 |
218 | |
219 | Standard_EXPORT virtual void PerformVF(); |
220 | |
221 | Standard_EXPORT virtual void PerformEE(); |
222 | |
223 | Standard_EXPORT virtual void PerformEF(); |
224 | |
225 | Standard_EXPORT virtual void PerformFF(); |
226 | |
42cf5bc1 |
227 | Standard_EXPORT void TreatVerticesEE(); |
228 | |
1155d05a |
229 | Standard_EXPORT void MakeSDVerticesFF(const TColStd_DataMapOfIntegerListOfInteger& aDMVLV, |
230 | TColStd_DataMapOfIntegerInteger& theDMNewSD); |
0d0481c7 |
231 | |
42cf5bc1 |
232 | Standard_EXPORT void MakeSplitEdges(); |
233 | |
234 | Standard_EXPORT void MakeBlocks(); |
235 | |
236 | Standard_EXPORT void MakePCurves(); |
3510db62 |
237 | |
1155d05a |
238 | Standard_EXPORT Standard_Integer MakeSDVertices(const TColStd_ListOfInteger& theVertIndices, |
0d0481c7 |
239 | const Standard_Boolean theAddInterfs = 1); |
42cf5bc1 |
240 | |
241 | Standard_EXPORT void ProcessDE(); |
242 | |
243 | Standard_EXPORT void FillShrunkData (Handle(BOPDS_PaveBlock)& thePB); |
244 | |
245 | Standard_EXPORT void FillShrunkData (const TopAbs_ShapeEnum theType1, const TopAbs_ShapeEnum theType2); |
8ae442a8 |
246 | |
33ba8565 |
247 | //! Analyzes the results of computation of the valid range for the |
248 | //! pave block and in case of error adds the warning status, otherwise |
249 | //! saves the valid range in the pave block. |
250 | Standard_EXPORT void AnalyzeShrunkData(const Handle(BOPDS_PaveBlock)& thePB, |
251 | const IntTools_ShrunkRange& theSR); |
252 | |
8ae442a8 |
253 | //! Performs intersection of new vertices, obtained in E/E and E/F intersections |
254 | Standard_EXPORT void PerformNewVertices(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, |
1155d05a |
255 | const Handle(NCollection_BaseAllocator)& theAllocator, |
8ae442a8 |
256 | const Standard_Boolean theIsEEIntersection = Standard_True); |
42cf5bc1 |
257 | |
1155d05a |
258 | Standard_EXPORT Standard_Boolean CheckFacePaves (const TopoDS_Vertex& theVnew, const TColStd_MapOfInteger& theMIF); |
42cf5bc1 |
259 | |
1155d05a |
260 | Standard_EXPORT static Standard_Boolean CheckFacePaves (const Standard_Integer theN, const TColStd_MapOfInteger& theMIFOn, const TColStd_MapOfInteger& theMIFIn); |
42cf5bc1 |
261 | |
1155d05a |
262 | Standard_EXPORT Standard_Boolean IsExistingVertex (const gp_Pnt& theP, const Standard_Real theTol, const TColStd_MapOfInteger& theMVOn) const; |
42cf5bc1 |
263 | |
264 | |
6f1ea0f4 |
265 | //! Checks and puts paves from <theMVOnIn> on the curve <theNC>. |
266 | //! At that, common (from theMVCommon) and not common vertices |
267 | //! are processed differently. |
268 | Standard_EXPORT void PutPavesOnCurve(const TColStd_MapOfInteger& theMVOnIn, |
269 | const TColStd_MapOfInteger& theMVCommon, |
270 | BOPDS_Curve& theNC, |
271 | const TColStd_MapOfInteger& theMI, |
272 | const TColStd_MapOfInteger& theMVEF, |
273 | TColStd_DataMapOfIntegerReal& theMVTol, |
274 | TColStd_DataMapOfIntegerListOfInteger& theDMVLV); |
0d0481c7 |
275 | |
d3578357 |
276 | Standard_EXPORT void FilterPavesOnCurves(const BOPDS_VectorOfCurve& theVNC, |
277 | TColStd_DataMapOfIntegerReal& theMVTol); |
42cf5bc1 |
278 | |
279 | //! Depending on the parameter aType it checks whether |
280 | //! the vertex nV was created in EE or EF intersections. |
281 | //! If so, it increases aTolVExt from tolerance value of vertex to |
282 | //! the max distance from vertex nV to the ends of the range of common part. |
283 | //! Possible values of aType: |
284 | //! 1 - checks only EE; |
285 | //! 2 - checks only EF; |
286 | //! other - checks both types of intersections. |
1155d05a |
287 | Standard_EXPORT Standard_Boolean ExtendedTolerance (const Standard_Integer nV, const TColStd_MapOfInteger& aMI, Standard_Real& aTolVExt, const Standard_Integer aType = 0); |
42cf5bc1 |
288 | |
5652dc62 |
289 | Standard_EXPORT void PutBoundPaveOnCurve(const TopoDS_Face& theF1, |
290 | const TopoDS_Face& theF2, |
291 | BOPDS_Curve& theNC, |
1155d05a |
292 | TColStd_ListOfInteger& theLBV); |
d3578357 |
293 | |
294 | //! Checks if the given pave block (created on section curve) |
295 | //! coincides with any of the pave blocks of the faces |
296 | //! created the section curve. |
05cf4d98 |
297 | Standard_EXPORT Standard_Boolean IsExistingPaveBlock |
298 | (const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC, |
299 | const Standard_Real theTolR3D, const BOPDS_IndexedMapOfPaveBlock& theMPB, |
0d0481c7 |
300 | const BOPDS_MapOfPaveBlock& theMPBCommon, |
05cf4d98 |
301 | Handle(BOPDS_PaveBlock)& thePBOut, Standard_Real& theTolNew); |
d3578357 |
302 | |
303 | //! Checks if the given pave block (created on section curve) |
304 | //! coincides with any of the edges shared between the faces |
305 | //! created the section curve. |
306 | Standard_EXPORT Standard_Boolean IsExistingPaveBlock(const Handle(BOPDS_PaveBlock)& thePB, |
307 | const BOPDS_Curve& theNC, |
308 | const TColStd_ListOfInteger& theLSE, |
309 | Standard_Integer& theNEOut, |
310 | Standard_Real& theTolNew); |
42cf5bc1 |
311 | |
312 | //! Treatment of section edges. |
33ba8565 |
313 | Standard_EXPORT void PostTreatFF (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB, |
314 | BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDMExEdges, |
1155d05a |
315 | TColStd_DataMapOfIntegerInteger& theDMNewSD, |
d3578357 |
316 | const BOPDS_IndexedMapOfPaveBlock& theMicroPB, |
1155d05a |
317 | const TopTools_IndexedMapOfShape& theVertsOnRejectedPB, |
318 | const Handle(NCollection_BaseAllocator)& theAllocator); |
42cf5bc1 |
319 | |
320 | Standard_EXPORT void FindPaveBlocks (const Standard_Integer theV, const Standard_Integer theF, BOPDS_ListOfPaveBlock& theLPB); |
321 | |
322 | Standard_EXPORT void FillPaves (const Standard_Integer theV, const Standard_Integer theE, const Standard_Integer theF, const BOPDS_ListOfPaveBlock& theLPB, const Handle(BOPDS_PaveBlock)& thePB); |
323 | |
324 | Standard_EXPORT void MakeSplitEdge (const Standard_Integer theV, const Standard_Integer theF); |
325 | |
326 | Standard_EXPORT void GetEFPnts (const Standard_Integer nF1, const Standard_Integer nF2, IntSurf_ListOfPntOn2S& aListOfPnts); |
327 | |
328 | |
329 | //! Checks and puts paves created in EF intersections on the curve <theNC>. |
0d0481c7 |
330 | Standard_EXPORT void PutEFPavesOnCurve (BOPDS_Curve& theNC, |
1155d05a |
331 | const TColStd_MapOfInteger& theMI, |
332 | const TColStd_MapOfInteger& theMVEF, |
333 | TColStd_DataMapOfIntegerReal& theMVTol, |
334 | TColStd_DataMapOfIntegerListOfInteger& aDMVLV); |
42cf5bc1 |
335 | |
336 | |
337 | //! Puts stick paves on the curve <theNC> |
0d0481c7 |
338 | Standard_EXPORT void PutStickPavesOnCurve (const TopoDS_Face& aF1, |
339 | const TopoDS_Face& aF2, |
1155d05a |
340 | const TColStd_MapOfInteger& theMI, |
0d0481c7 |
341 | BOPDS_Curve& theNC, |
1155d05a |
342 | const TColStd_MapOfInteger& theMVStick, |
343 | TColStd_DataMapOfIntegerReal& theMVTol, |
344 | TColStd_DataMapOfIntegerListOfInteger& aDMVLV); |
42cf5bc1 |
345 | |
346 | |
347 | //! Collects indices of vertices created in all intersections between |
348 | //! two faces (<nF1> and <nF2>) to the map <theMVStick>. |
349 | //! Also, it collects indices of EF vertices to the <theMVEF> map |
350 | //! and indices of all subshapes of these two faces to the <theMI> map. |
1155d05a |
351 | Standard_EXPORT void GetStickVertices (const Standard_Integer nF1, const Standard_Integer nF2, TColStd_MapOfInteger& theMVStick, TColStd_MapOfInteger& theMVEF, TColStd_MapOfInteger& theMI); |
42cf5bc1 |
352 | |
353 | |
354 | //! Collects index nF and indices of all subshapes of the shape with index <nF> |
355 | //! to the map <theMI>. |
1155d05a |
356 | Standard_EXPORT void GetFullShapeMap (const Standard_Integer nF, TColStd_MapOfInteger& theMI); |
42cf5bc1 |
357 | |
358 | |
359 | //! Removes indices of vertices that are already on the |
360 | //! curve <theNC> from the map <theMV>. |
361 | //! It is used in PutEFPavesOnCurve and PutStickPavesOnCurve methods. |
e67e482d |
362 | Standard_EXPORT void RemoveUsedVertices (const BOPDS_Curve& theNC, TColStd_MapOfInteger& theMV); |
42cf5bc1 |
363 | |
364 | |
365 | //! Puts the pave nV on the curve theNC. |
366 | //! Parameter aType defines whether to check the pave with |
367 | //! extended tolerance: |
368 | //! 0 - do not perform the check; |
369 | //! other - perform the check (aType goes to ExtendedTolerance). |
0d0481c7 |
370 | Standard_EXPORT void PutPaveOnCurve (const Standard_Integer nV, |
371 | const Standard_Real theTolR3D, |
372 | const BOPDS_Curve& theNC, |
1155d05a |
373 | const TColStd_MapOfInteger& theMI, |
374 | TColStd_DataMapOfIntegerReal& theMVTol, |
375 | TColStd_DataMapOfIntegerListOfInteger& aDMVLV, |
0d0481c7 |
376 | const Standard_Integer aType = 0); |
42cf5bc1 |
377 | |
378 | |
379 | //! Adds the existing edges from the map <theMPBOnIn> which interfere |
380 | //! with the vertices from <theMVB> map to the post treatment of section edges. |
d3578357 |
381 | Standard_EXPORT void ProcessExistingPaveBlocks (const Standard_Integer theInt, |
382 | const Standard_Integer nF1, |
383 | const Standard_Integer nF2, |
384 | const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn, |
385 | const TColStd_DataMapOfIntegerListOfInteger& theDMBV, |
386 | BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB, |
387 | TopTools_DataMapOfShapeInteger& theMVI, |
388 | BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap, |
389 | BOPDS_MapOfPaveBlock& theMPB); |
42cf5bc1 |
390 | |
391 | |
392 | //! Replaces existing pave block <thePB> with new pave blocks <theLPB>. |
393 | //! The list <theLPB> contains images of <thePB> which were created in |
394 | //! the post treatment of section edges. |
d3578357 |
395 | //! Tries to project the new edges on the faces contained in the <thePBFacesMap>. |
396 | Standard_EXPORT void UpdateExistingPaveBlocks(const Handle(BOPDS_PaveBlock)& thePB, |
397 | BOPDS_ListOfPaveBlock& theLPB, |
398 | const BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap); |
42cf5bc1 |
399 | |
400 | //! Treatment of vertices that were created in EE intersections. |
1155d05a |
401 | Standard_EXPORT void TreatNewVertices(const BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, TopTools_IndexedDataMapOfShapeListOfShape& theImages); |
42cf5bc1 |
402 | |
403 | |
404 | //! Put paves on the curve <aBC> in case when <aBC> |
405 | //! is closed 3D-curve |
406 | Standard_EXPORT void PutClosingPaveOnCurve (BOPDS_Curve& aNC); |
407 | |
408 | |
409 | //! Keeps data for post treatment |
1155d05a |
410 | Standard_EXPORT void PreparePostTreatFF (const Standard_Integer aInt, const Standard_Integer aCur, const Handle(BOPDS_PaveBlock)& aPB, BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB, TopTools_DataMapOfShapeInteger& aMVI, BOPDS_ListOfPaveBlock& aLPB); |
42cf5bc1 |
411 | |
412 | //! Updates the information about faces |
d3578357 |
413 | Standard_EXPORT void UpdateFaceInfo(BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME, |
414 | const TColStd_DataMapOfIntegerInteger& theDMV, |
415 | const BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap); |
42cf5bc1 |
416 | |
417 | //! Updates tolerance of vertex with index <nV> |
b7cd7c2b |
418 | //! to make it interfere with edge. |
419 | //! Returns TRUE if intersection happened. |
420 | Standard_EXPORT Standard_Boolean ForceInterfVE(const Standard_Integer nV, |
421 | Handle(BOPDS_PaveBlock)& aPB, |
1155d05a |
422 | TColStd_MapOfInteger& theMEdges); |
42cf5bc1 |
423 | |
424 | //! Updates tolerance of vertex with index <nV> |
425 | //! to make it interfere with face with index <nF> |
426 | Standard_EXPORT Standard_Boolean ForceInterfVF (const Standard_Integer nV, const Standard_Integer nF); |
427 | |
428 | |
429 | //! Checks if there are any common or intersecting sub shapes |
430 | //! between two planar faces. |
431 | Standard_EXPORT Standard_Boolean CheckPlanes (const Standard_Integer nF1, const Standard_Integer nF2) const; |
432 | |
433 | |
434 | //! Creates new edge from the edge nE with vertices nV1 and nV2 |
435 | //! and returns the index of that new edge in the DS. |
436 | Standard_EXPORT Standard_Integer SplitEdge (const Standard_Integer nE, const Standard_Integer nV1, const Standard_Real aT1, const Standard_Integer nV2, const Standard_Real aT2); |
437 | |
438 | |
439 | //! Updates pave blocks which have the paves with indices contained |
0d0481c7 |
440 | //! in the map <aDMNewSD>. |
1155d05a |
441 | Standard_EXPORT void UpdatePaveBlocks(const TColStd_DataMapOfIntegerInteger& aDMNewSD); |
42cf5bc1 |
442 | |
3510db62 |
443 | //! Updates tolerance vertex nV due to V/E interference. |
444 | //! It always creates new vertex if nV is from arguments. |
445 | //! @return DS index of updated vertex. |
446 | Standard_EXPORT Standard_Integer UpdateVertex(const Standard_Integer nV, |
447 | const Standard_Real aTolNew); |
448 | |
449 | Standard_EXPORT void UpdatePaveBlocksWithSDVertices(); |
450 | |
451 | Standard_EXPORT void UpdateCommonBlocksWithSDVertices(); |
452 | |
453 | Standard_EXPORT void UpdateBlocksWithSharedVertices(); |
24542bc0 |
454 | |
455 | Standard_EXPORT void UpdateInterfsWithSDVertices(); |
456 | |
3510db62 |
457 | Standard_EXPORT Standard_Boolean EstimatePaveOnCurve(const Standard_Integer nV, |
458 | const BOPDS_Curve& theNC, |
459 | const Standard_Real theTolR3D); |
460 | |
461 | Standard_EXPORT void UpdateEdgeTolerance(const Standard_Integer nE, |
462 | const Standard_Real aTolNew); |
463 | |
1155d05a |
464 | Standard_EXPORT void RemovePaveBlocks(const TColStd_MapOfInteger theEdges); |
3510db62 |
465 | |
466 | Standard_EXPORT void CorrectToleranceOfSE(); |
42cf5bc1 |
467 | |
01b5b3df |
468 | //! Reduce the intersection range using the common ranges of |
469 | //! Edge/Edge interferences to avoid creation of close |
470 | //! intersection vertices |
471 | Standard_EXPORT void ReduceIntersectionRange(const Standard_Integer theV1, |
472 | const Standard_Integer theV2, |
473 | const Standard_Integer theE, |
474 | const Standard_Integer theF, |
475 | Standard_Real& theTS1, |
476 | Standard_Real& theTS2); |
477 | |
478 | //! Gets the bounding box for the given Pave Block. |
479 | //! If Pave Block has shrunk data it will be used to get the box, |
480 | //! and the Shrunk Range (<theSFirst>, <theSLast>). |
481 | //! Otherwise the box will be computed using BndLib_Add3dCurve method, |
482 | //! and the Shrunk Range will be equal to the PB's range. |
483 | //! To avoid re-computation of the bounding box for the same Pave Block |
484 | //! it will be saved in the map <thePBBox>. |
485 | //! Returns FALSE in case the PB's range is less than the |
486 | //! Precision::PConfusion(), otherwise returns TRUE. |
487 | Standard_EXPORT Standard_Boolean GetPBBox(const TopoDS_Edge& theE, |
488 | const Handle(BOPDS_PaveBlock)& thePB, |
489 | BOPAlgo_DataMapOfPaveBlockBndBox& thePBBox, |
490 | Standard_Real& theFirst, |
491 | Standard_Real& theLast, |
492 | Standard_Real& theSFirst, |
493 | Standard_Real& theSLast, |
494 | Bnd_Box& theBox); |
495 | |
32e849eb |
496 | //! Treatment of the possible common zones, not detected by the |
497 | //! Face/Face intersection algorithm, by intersection of each section edge |
498 | //! with all faces not participated in creation of that section edge. |
499 | //! If the intersection says that the section edge is lying on the face |
500 | //! it will be added into FaceInfo structure of the face as IN edge |
501 | //! and will be used for splitting. |
502 | Standard_EXPORT void PutSEInOtherFaces(); |
503 | |
33ba8565 |
504 | //! Analyzes the results of interferences of sub-shapes of the shapes |
505 | //! looking for self-interfering entities by the following rules:<br> |
506 | //! 1. The Faces of the same shape considered interfering in case they:<br> |
507 | //! - Interfere with the other shapes in the same place (in the same vertex) or;<br> |
508 | //! - Included in the same common block. |
509 | //! 2. The Faces of the same shape considered interfering in case they |
510 | //! share the IN or SECTION edges.<br> |
511 | //! In case self-interference is found the warning is added. |
512 | Standard_EXPORT void CheckSelfInterference(); |
513 | |
ad8b073e |
514 | //! Adds the warning about failed intersection of pair of sub-shapes |
515 | Standard_EXPORT void AddIntersectionFailedWarning(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2); |
33ba8565 |
516 | |
d3578357 |
517 | //! Repeat intersection of sub-shapes with increased vertices. |
518 | Standard_EXPORT void RepeatIntersection(); |
519 | |
520 | //! Updates vertices of CommonBlocks with real tolerance of CB. |
521 | Standard_EXPORT void UpdateVerticesOfCB(); |
522 | |
b7cd7c2b |
523 | //! The method looks for the additional common blocks among pairs of edges |
d3578357 |
524 | //! with the same bounding vertices. |
b7cd7c2b |
525 | Standard_EXPORT void ForceInterfEE(); |
526 | |
d3578357 |
527 | //! The method looks for the additional edge/face common blocks |
528 | //! among pairs of edge/face having the same vertices. |
529 | Standard_EXPORT void ForceInterfEF(); |
530 | |
531 | //! Performs intersection of given pave blocks |
532 | //! with all faces from arguments. |
533 | Standard_EXPORT void ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB, |
534 | const Standard_Boolean theAddInterf); |
535 | |
bfb65235 |
536 | //! When all section edges are created and no increase of the tolerance |
537 | //! of vertices put on the section edges is expected, make sure that |
538 | //! the created sections have valid range. |
539 | //! If any of the section edges do not have valid range, remove them |
540 | //! from Face/Face intersection info and from the input <theMSCPB> map. |
d3578357 |
541 | //! Put such edges into <MicroPB> map for further unification of their |
bfb65235 |
542 | //! vertices in the PostTreatFF method. |
543 | //! |
544 | //! All these section edges have already been checked to have valid range. |
545 | //! Current check is necessary for the edges whose vertices have also |
546 | //! been put on other section edges with greater tolerance, which has caused |
547 | //! increase of the tolerance value of the vertices. |
548 | Standard_EXPORT void RemoveMicroSectionEdges(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB, |
d3578357 |
549 | BOPDS_IndexedMapOfPaveBlock& theMicroPB); |
bfb65235 |
550 | |
b7cd7c2b |
551 | |
1155d05a |
552 | TopTools_ListOfShape myArguments; |
42cf5bc1 |
553 | BOPDS_PDS myDS; |
554 | BOPDS_PIterator myIterator; |
555 | Handle(IntTools_Context) myContext; |
556 | BOPAlgo_SectionAttribute mySectionAttribute; |
3510db62 |
557 | Standard_Boolean myNonDestructive; |
558 | Standard_Boolean myIsPrimary; |
0c5a6d47 |
559 | Standard_Boolean myAvoidBuildPCurve; |
483ce1bd |
560 | BOPAlgo_GlueEnum myGlue; |
42cf5bc1 |
561 | |
d3578357 |
562 | BOPAlgo_DataMapOfIntegerMapOfPaveBlock myFPBDone; //!< Fence map of intersected faces and pave blocks |
563 | TColStd_MapOfInteger myIncreasedSS; //!< Sub-shapes with increased tolerance during the operation |
564 | TColStd_MapOfInteger myVertsToAvoidExtension; //!< Vertices located close to E/E or E/F intersection points |
565 | //! which has already been extended to cover the real intersection |
566 | //! points, and should not be extended any longer to be put |
567 | //! on a section curve. |
42cf5bc1 |
568 | |
42cf5bc1 |
569 | }; |
570 | |
42cf5bc1 |
571 | #endif // _BOPAlgo_PaveFiller_HeaderFile |