1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00

Compare commits

...

23 Commits

Author SHA1 Message Date
vsv
a4b60cc6a2 0029595: Visualization - Wrong validation of Anchor point for Radius Dimension 2018-03-21 14:47:47 +03:00
emv
2c277b838e 0029580: Regression: invalid result of BOP Fuse
Boolean Operation - avoid creation of INTERNAL solid from unclassified faces in Solid Builder algorithm.
Instead warn the user that some of the faces have been unclassified and not used for solids creation.

Adjustment of the test cases.
Test cases for the issue.
2018-03-21 14:41:19 +03:00
emv
90850b69d3 0029363: No history for shapes which were produced as a result of intersection
1. Implementation of the *Generated* method for the algorithms in Boolean Component.
In terms of these algorithms the shape from the arguments can have Generated shapes only if these new shapes have been obtained as a result of pure intersection (not overlapping) of this shape with any other shapes from arguments.
Thus, the Generated shapes are always:
* VERTICES created from the intersection points and may be Generated from edges and faces only;
* EDGES created from the intersection edges and may be Generated from faces only.

So, only EDGES and FACES could have information about Generated shapes. For all other types of shapes the list of Generated shapes will be empty.

2. Optimization and simplification of the Modified and IsDeleted methods based on the correct filling of the BOPAlgo_BuilderShape::myImagesResult map.

3. Provide history of unification of the solids in the CellsBuilder algorithm.

4. Update of the documentation of Boolean Operations User guide with new chapter "History Information" describing rules for filling history for operations in Boolean Component.

5. Test cases for the issue. New grid "history" has been added into "boolean" category.
2018-03-06 18:53:13 +03:00
emv
a5e75cb9c5 0029333: Boolean Operations - Prevent modification of the input shapes in case their sub-shapes have not been modified
Prevent modification of the input shapes in destructive mode in case their sub-shapes have not been modified:
1. Prevent edge splitting for the pave blocks with old vertices if it is possible to use the existing edge (*BOPAlgo_PaveFiller::MakeSplitEdges*);
2. Prevent creation of the new containers (WIRES/SHELLS/COMPSOLIDS) if non of its parts have been modified (*BOPAlgo_Builder::FillImagesContainer*);
3. Prevent creation of the new face if non of its wires have been modified (*BOPAlgo_Builder::FillImagesFaces*);
4. If possible, use the original face to be the representative for the group of SD faces (*BOPAlgo_Builder::FillSameDomainFaces*).

Cosmetic changes:
1. Documentation of the *BOPAlgo_Builder* class.
2. Making simple methods of the *BOPAlgo_Builder* class inline.
3. Getting rid of the *BOPAlgo_Builder::mySplits* field as it is excessive. *BOPAlgo_Builder::myImages* can be used instead.
3. Moving the Check Inverted option from *BOPAlgo_Options* to *BOPAlgo_Builder*.

Test cases for the issue.
Adjustment of the test case to their current behavior.
Test case *blend/complex/H2* has been deleted as duplicate of the test case *blend/simple/Z1*.
2018-03-06 18:43:01 +03:00
nbv
6f12acc54c 0029179: Result of Boolean common depends on an order of arguments
Usage of Bnd_Box-filtering is eliminated while putting a (definitely) common vertex between two faces on the intersection curve.

Algorithm of putting not-common (ON/IN) vertices has not been changed.
2018-03-06 18:38:41 +03:00
emv
f6ef317cd3 0025609: Clean up the duplicate classes in TKBO project
1. The package BOPCol has been fully removed:
- *BOPCol_BaseAllocator* is replaced with *Handle(NCollection_BaseAllocator)*;
- *BOPCol_BoxBndTree* is replaced with *BOPTools_BoxBndTree*;
- *BOPCol_Box2DBndTree* is removed as unused;
- *BOPCol_DataMapOfIntegerInteger* is replaced with *TColStd_DataMapOfIntegerInteger*;
- *BOPCol_DataMapOfIntegerListOfInteger* is replaced with *TColStd_DataMapOfIntegerListOfInteger*;
- *BOPCol_DataMapOfIntegerListOfShape* is replaced with *TopTools_DataMapOfIntegerListOfShape*;
- *BOPCol_DataMapOfIntegerMapOfInteger.hxx* is removed as unused;
- *BOPCol_DataMapOfIntegerReal* is replaced with *TColStd_DataMapOfIntegerReal*;
- *BOPCol_DataMapOfIntegerShape* is replaced with *TopTools_DataMapOfIntegerShape*;
- *BOPCol_DataMapOfShapeBox* is replaced with *TopTools_DataMapOfShapeBox*;
- *BOPCol_DataMapOfShapeInteger* is replaced with *TopTools_DataMapOfShapeInteger*;
- *BOPCol_DataMapOfShapeListOfShape* is replaced with *TopTools_DataMapOfShapeListOfShape*;
- *BOPCol_DataMapOfShapeReal* is replaced with *TopTools_DataMapOfShapeReal*;
- *BOPCol_DataMapOfShapeShape* is replaced with *TopTools_DataMapOfShapeShape*;
- *BOPCol_DataMapOfTransientAddress* is removed as unused;
- *BOPCol_IndexedDataMapOfIntegerListOfInteger* is removed as unused;
- *BOPCol_IndexedDataMapOfShapeBox* is removed as unused;
- *BOPCol_IndexedDataMapOfShapeInteger* is removed as unused;
- *BOPCol_IndexedDataMapOfShapeListOfShape* is replaced with *TopTools_IndexedDataMapOfShapeListOfShape*;
- *BOPCol_IndexedDataMapOfShapeReal* is removed as unused;
- *BOPCol_IndexedDataMapOfShapeShape* is replaced with *TopTools_IndexedDataMapOfShapeShape*;
- *BOPCol_IndexedMapOfInteger* is replaced with *TColStd_IndexedMapOfInteger*;
- *BOPCol_IndexedMapOfOrientedShape* is replaced with *TopTools_IndexedMapOfOrientedShape*;
- *BOPCol_IndexedMapOfShape* is replaced with *TopTools_IndexedMapOfShape*;
- *BOPCol_ListOfInteger* is replaced with *TColStd_ListOfInteger*;
- *BOPCol_ListOfListOfShape* is replaced with *TopTools_ListOfListOfShape*;
- *BOPCol_ListOfShape* is replaced with *TopTools_ListOfShape*;
- *BOPCol_MapOfInteger* is replaced with *TColStd_MapOfInteger*;
- *BOPCol_MapOfOrientedShape* is replaced with *TopTools_MapOfOrientedShape*;
- *BOPCol_MapOfShape* is replaced with *TopTools_MapOfShape*;
- *BOPCol_PListOfInteger* is removed as unused;
- *BOPCol_PInteger* is removed as unused
- *BOPCol_SequenceOfPnt2d* is replaced with *TColgp_SequenceOfPnt2d*;
- *BOPCol_SequenceOfReal* is replaced with *TColStd_SequenceOfReal*;
- *BOPCol_SequenceOfShape* is replaced with *TopTools_SequenceOfShape*;
- *BOPCol_Parallel* is replaced with *BOPTools_Parallel*;
- *BOPCol_NCVector* is replaced with *NCollection_Vector*;

2. The class *BOPDS_PassKey* and containers for it have been removed as unused;

3. The unused containers from *IntTools* package have been removed:
- *IntTools_DataMapOfShapeAddress* is removed as unused;
- *IntTools_IndexedDataMapOfTransientAddress* is removed as unused;

4. The container *BiTgte_DataMapOfShapeBox* is replaced with *TopTools_DataMapOfShapeBox*;

5. The class *BOPTools* has been removed as duplicate of the class *TopExp*;
2018-03-06 18:38:22 +03:00
emv
81a6815522 0029188: Null shape is produced by 3D offset algorithm (mode="Complete", Join Type="Intersection")
The following improvements have been made in the 3D offset algorithm for mode "Complete" and Join type "Intersection":
- RemoveInsideFaces() - Removal of the invalid parts outside of the solids built from the splits of offset faces is now performed. It helps to avoid their rebuilding and speed-up the computation.
- FindVerticesToAvoid() - Strengthening the criteria for the vertices to be avoided in the new splits.

Test cases for the issue.
Adjustment of the test cases to current behavior.
2018-03-06 18:37:47 +03:00
emv
50495023da 0029135: 3D Offset algorithm produces a NULL shape
UpdateValidEdges in BRepOffset_MakeOffset_1 - Perform the filtering of splits of the edges in two stages:
1. Separate filtering of the connected blocks using localized bounding edges taken only from the splits of offset faces from the block;
2. Combined treatment of the remaining splits using bounding edges from the splits of all offset faces.
2018-03-06 18:35:35 +03:00
emv
11a118653d 0029321: Improve performance of the 3D offset algorithm for the planar cases
Disable additional intersection of the splits of offset faces implemented in method BRepOffset_MakeOffset::Intersection3D() for the mode "Complete" and join type "Intersection".
This method is insufficient, as it does not allow to detect the tangential faces, necessary for this mode.
Intersection is performed in the method BuildShellsCompleteInter() developed for this mode.
2018-03-06 18:33:55 +03:00
imn
13d4df0b8a 0028245: Result of Cells Builder algorithm becomes invalid after removal of internal boundaries on faces
When removing internal boundaries between faces of the same material do it once for the whole shape, and at this keep boundaries between areas with different material.
2018-03-06 18:31:20 +03:00
emv
527d9c8853 0029293: Boolean Operations algorithm does not preserve the orientations of the faces
While building splits of faces (BOPAlgo_Builder::FillImagesFaces()) make sure that the orientation of the input face will be passed to its splits.

Extend draw command "normals" with new key "[-print]" which allows printing values of the normal vector.
2018-03-06 18:28:41 +03:00
emv
996224de92 0029322: Unify faces classification procedures in Boolean Operations
1. Unify the faces classification procedure of the methods BOPAlgo_BuilderSolid::PerformInternalShapes() and BOPAlgo_Builder::FillIn3DParts() using the latter as a base.
The new method BOPAlgo_Tools::ClassifyFaces() has been created for that. Both methods mentioned above have been updated to use the new one.

2. Forced intersection of the edges after enlarge of the tolerance values of their vertices during the operation has been added into BOP's intersection algorithm (BOPAlgo_PaveFiller).
BOPAlgo_Tools::PerformCommonBlocks() method has been updated to avoid loosing faces of the already created Common blocks.

As a result the case "boolean gdml_private ZF6" became more stable, because the intermediate result is no longer invalid.
Additional test cases have been added to verify this improvement (bugs modalg_7 bug29322_*)

3. When building PCurves for edges on faces, check the existing PCurves on its validity for periodic surfaces and adjust PCurves if necessary.
The improvement helps to produce the valid result in the test case "bugs moddata_1 bug152".

4. Avoid creation of empty Edge-Edge interference if the intersection point is lying close to a shared vertex.
The improvement helps obtain the valid result of the "bopcheck" operation in the test case "bugs modalg_7 bug27683".

Adjustment of the test case to current behavior:
- Avoid usage of the self-intersecting torus in the test case "boolean gdml_public A9".
- Fix the input shape in the test case "boolean bopfuse_complex H1" to provide valid result.
- Test cases "bugs moddata_1 bug152_1 bug152_2" have been unified into single test case "bugs moddata_1 bug152". Now, the case rebuilds invalid input data and performs all types of Boolean operations.
- Change the test case "bugs modalg_7 bug22750" to produce valid intermediate results used in subsequent operations as arguments.
- The following test cases are improvements:
- "boolean volumemaker D8"
- "boolean volumemaker G1"
- "bugs modalg_7 bug27683"
2018-03-06 18:23:59 +03:00
mnt
6084945610 0029133: Unstable test cases
Adding new and early removed for some reasons test cases

Removing TODO ?

Adding necessary TODO ? on corresponding platforms for OK and BAD cases
2018-03-06 18:23:36 +03:00
msv
bac9b72b8f 0029182: BOPAlgo_PaveFiller sometimes raises exception in parallel mode
Data races have been prevented in the code of BOPAlgo_PaveFiller that makes pcurves of edges on faces. For that:
- Put into treatment only unique edge-face pairs.
- If the same edge is treated with different faces in different threads simultaneously this also causes data races. To avoid this make the edge's copy in each thread and update the copy. The original edge is updated only after finishing parallel processing.

The new method BOPTools_AlgoTools::CopyEdge has been added to make a copy of an edge with vertices.

Big screenshot in the test script tests/bugs/modalg_7/bug28200 has been replaced with a small one.
2018-03-06 18:21:40 +03:00
emv
813cfec909 0029301: Improve performance of Boolean Operations
Improve performance of Boolean operations algorithm by:
- Improving the check of Same Domain faces (BOPAlgo_Builder::FillSameDomainFaces());
- Faster rejection of outer faces for solids using Bounding Box classification first (BOPAlgo_Builder::FillIn3DParts());
- Using IncAllocator for local containers.

Quality improvement has been made in BOPAlgo_PaveFiller class:
1. Method IsExistingPaveBlock() has been corrected to provide the correct edge tolerance and to obtain valid intermediate results in the test case "boolean gdml_private ZH3".
   New test case have been added to verify this improvement (bugs modalg_7 bug29301).
2. Method PutClosingPaveOnCurve() has been corrected to use the tolerance of the pave put on the bound for checking curve on closeness.
   Additional check for the curve to have valid range after addition of the pave on the other end has been added to prevent considering the small curves (covered by vertex tolerance) as closed ones.
   As a result of this modification the test case boolean gdml_public B2 has been fixed (TODO removed).

Adjustment of the test cases to current behavior:
- boolean bopcommon_complex J1 - the produced result was incorrect as it was self-interfered. There should be no common in this case.
- offset shape_type_i_c ZZ1 - the incorrect result is now produced instead of null shape.
2018-03-06 18:19:43 +03:00
msv
b1e5dc83e0 0028467: Improve UnifySameDomain performance
This patch turns off some not needed modes of fix in the called ShapeFix_Face algorithm.

It stores pcurves on planes in the edges to avoid repeated computation of the same pcurves many times (it is done only when SafeInputMode is false).

It avoids unnecessary replace/apply actions in the modification context.

It removes the code that makes decomposition of surface of the face on several faces.

The new command buildpcurvesonplane has been added, which builds and stores pcurves of edges on planar faces. This is useful for investigations how presence of pcurves on planes influence performance of algorithms.

Make drawing of dimension line in snowflake test independent on the order of vertices in the result.
2018-03-06 18:16:07 +03:00
oan
e7817cac57 0029186: Move AddTool(), SetTools(), Tools() and other common methods of BOP tools to separate interface class
Methods AddTool(), SetTools(), Tools() have been moved to BOPAlgo_ToolsProvider class;
BOPAlgo_BOP and BOPAlgo_Splitter are now successors of BOPAlgo_ToolsProvider
2018-03-06 18:12:41 +03:00
emv
6da574b523 0029237: Improve performance of Boolean Operations
In order to improve performance of Boolean Operations on the relatively fast cases the following improvements have been made:
1. Initialization of the FaceInfo information for the faces participating in Face/Face interference, even when the gluing is ON, to take into account intersection of their sub-shapes.
2. Code simplification & duplication removal - the methods BOPAlgo_ShellSplitter::MakeConnexityBlocks and BOPAlgo_WireSplitter::MakeConnexityBlocks have been unified into BOPTools_AlgoTools::MakeConnexityBlocks.
3. Avoid unnecessary bounding box computation for solids during DS initialization. The bounding boxes for solids will be computed during the building stage to find faces located inside solids.
   For the shape self-interference check (performed by the BOPAlgo_CheckerSI), the bounding box is still computed, as it is necessary to resolve Shape/Solid intersections.
4. Use only three sample points to check coincidence of line and plane.
5. Perform necessity of planes intersection only when the gluing is off.
6. Avoid repeated initialization of 2D classifier while building splits of the faces.
7. Post treat stage:
7.1. Method CorrectWires: Save edge's data (PCurve, parameter of the vertex, range) to avoid its recalculation.
7.2. Method CheckEdge: While checking vertices on edges avoid unnecessary calculation of their location.
8. Provide possibility to disable the classification of the input solids on the inverted status (to be the holes in the space).
9. Avoid building of bounding boxes for faces/solids during splitting of the input arguments for their classification relatively hole faces/shells if there are no holes created.
10. Avoid rebuilding of the faces/solids from arguments which does not acquire any inside parts from other arguments during the operation by using their draft versions as their splits.

Test cases for the issue.
Correction of the test cases boolean gdml_public A9 and bugs modalg_7 bug28485 as they are improvements.
Additional test case for the issue #28485 as it is fixed by the current changes.
2018-03-06 18:10:47 +03:00
apv
16e03d4617 Update of tests database
Test for 0028167: Fillet has strange form at its end
Test for 0028168: Exception is raised during Boolean operation
Test for 0028194: BRepMesh - Standard_OutOfRange exception on valid shape
Test for 0028200: Invalid topology of the general fuse result
Test for 0028216: Intersection of a face and a solid is broken up leading to empty result of Boolean common operation
Test for 0028245: Result of Cells Builder algorithm becomes invalid after removal of internal boundaries on faces
Test for 0028247: Effect of minSize parameter of BRepMesh_IncrementalMesh seems to be too strong
Test for 0028274: BOPAlgo_MakerVolume fails to create solid
Test for 0028279: Greater oscillations and higher degree of resulting B-Spline in cylinder-cylinder intersections in 7.1.0
Test for 0028354: Filleting destroys shape if the filleted edge touches a seam edge
Test for 0028366: BOP Common fails with solid and planar face
Test for 0028379: BRepMesh produces mangled mesh for a cone
Test for 0028388: Boolean common of simple face and solid results in empty compound
Test for 0028393: Boolean cut produce wrong result.
Test for 0028402: Modeling - calculation of properties of complex compounds is slow
Test for 0028406: High tolerances after boolean operation on OCCT 6.9.1
Test for 0028694: IGES reader produces too small edge covered by its vertices
Test for 0028719: Mesh - Display issue for special model
Test for 0028108: Sweep fails in "Right Corner" mode
Test for 0028696: Offset 2D algorithm produces micro edges
Test for 0028700: BRepBuilderAPI_Sewing produces too small edge covered by its vertices
Test for 0028722: Conversion of a spherical face to a spline produces an invalid shape
Test for 0028739: Draft on face fails
Test for 0028662: Data Exchange - Exception during reading large STEP file.
Test for 0028768: ShapeFix slighly corrupts the source face
Test for 0028485: Fuse of two shapes using gluing and non-destructive options gives invalid result
Test for 0028500: Artifact in shaded view of the shape
Test for 0028523: Fixshape reverses the orientation of the face
Test for 0028544: Big tolerance value is returned by Implicit-parametric algorithm
Test for 0028571: BRepOffsetAPI_MakeOffset build invalid wire
Test for 0028572: Wrong result of the mkface command
Test for 0028595: Shifting 2d curves for non-periodic surfaces leads to incorrect result.
Test for 0028596: Erroneous fillet
Test for 0028640: BRepBuilderAPI_Transform build invalid shape
Test for 0028656: 3d offset modifies the input shape
Test for 0000077: BUC60866. The BRepFill_Pipe fails.
Test for 0000078: BUC60875. Pipe is created incorrectly on two wires.
Test for 0000082: BUC60908. Incomplete section of shell by plane.
Test for 0000083: BUC60912. Section of simple BSpline surfaces is performed too slow.
Test for 0000862: GeomAPI_ExtremaCurveCurve fails on given curves
Test for 0002442: Error in BRepClass3d_SolidClassifier
Test for 0003936: Face on a surface of extrusion is extended after import to IGES
Test for 0005081: BRepOffset_MakeOffsetShape algorithm does not return valid result.
Test for 0005145: Wrong result of projection of a circle on a sphere.
Test for 0014846: ShapeFix_Wireframe::FixWireGaps() works wrong on a shape with seam edge
Test for 0016424: Exception in reading of attached IGES file
Test for 0010377: Incorrect fuse result when objects tangent by planar face
Test for 0013565: Incorrect result of Common operation
Test for 0013566: Incorrect result of Extrema between a large circle and a line
Test for 0024632: Artifacts during Boolean cut operation on neighboring parts
Test for 0005582: Impossible to make offset on the shape with degenerated edge
2018-03-06 18:10:18 +03:00
msv
503aa68780 0029234: BRepOffsetAPI_NormalProjection produces INTERNAL edges and vertices
Make the algorithm BRepOffsetAPI_NormalProjection use section operation instead of common to get the edge-result of projection to be in face restrictions.

Correct Boolean operation algorithm to produce correctly oriented result in the case of common between face and edge.

The algorithm ShapeUpgrade_UnifySameDomain has been patched to correctly gather same domain faces in a compound.

The TCL script snowflake.tcl has been corrected to get rid of dependence on the order of edges in the result of Boolean operation.
2018-03-06 12:36:59 +03:00
emv
88af392026 0029073: Regression: General Cut produces invalid shape
Boolean Operations:
1. Face/Face intersection post treatment - Unify vertices put on the section curves, which were rejected as existing ones, with the vertices of edges by which these section curves have been rejected.

2. Extend Warnings Reporting system of Boolean operations with the new warnings:
- BOPAlgo_AlertIntersectionOfPairOfShapesFailed - to be added when the intersection of pair of sub-shapes of the arguments has failed;
- BOPAlgo_AlertBuildingPCurveFailed - to be added when the building of the 2D curve of the edge on face has failed;
- BOPAlgo_AlertAcquiredSelfIntersection - to be added when the positioning and tolerances of the arguments leads to creation of self-interfered shapes.

These new warnings allow completing the operation even if intersection of some of the sub-shapes or building of some of the PCurves has failed. Moreover, they allow getting the pairs of sub-shapes on which the intersection/projection has failed, providing the user ability to analyze the intersection results.

Note that if some of these warnings appear, the result of the operation should be carefully analyzed for validity.

3. Print messages for the Warnings/Errors met during checking of the shape on self-intersection ("bopcheck" command).
2017-10-04 15:26:07 +03:00
nbv
7f1c7beb34 0029103: No intersection curve between faces if starting points are given
Sometimes the algorithm of Walking-line creation finds points out of the domain. Some such places have been detected and fixed in frame of this issue.
2017-10-04 15:26:00 +03:00
emv
61f67d7ef3 0029099: Extra shapes in result of General Cut (box by ellipsoid)
Boolean Operations - when looking for the splitting parameters on the degenerated edges try not only the intersection of the 2D curve of degenerated edge with 2D curves of other edges bounded by the vertex of degenerated edge, but also the projection of the end points of the edges corresponding to the vertex on the 2d curve of degenerated edge.
2017-10-04 15:25:53 +03:00
516 changed files with 12155 additions and 9135 deletions

View File

@@ -68,6 +68,7 @@ FILE_TO_LIST ("adm/RESOURCES" RESOURCES)
foreach (CurrentResource ${RESOURCES})
get_filename_component (CurrentResource_FileName "${CurrentResource}" NAME)
if ("${CurrentResource_FileName}" STREQUAL TObj.msg OR
"${CurrentResource_FileName}" STREQUAL BOPAlgo.msg OR
"${CurrentResource_FileName}" STREQUAL Units.dat OR
"${CurrentResource}" STREQUAL XSMessage OR
"${CurrentResource}" STREQUAL SHMessage OR

View File

@@ -1437,3 +1437,67 @@ The Error/Warning reporting system of the algorithms in Boolean Component (in al
The methods returning the status of errors and warnings of the algorithms (ErrorStatus() and WarningStatus()) have been removed.
Instead use methods HasErrors() and HasWarnings() to check for presence of errors and warnings, respectively.
The full list of errors and warnings, with associated data such as problematic sub-shapes, can be obtained by method GetReport().
@section upgrade_occt721 Upgrade to OCCT 7.2.1
@subsection upgrade_721_Changes_In_USD Changes in ShapeUpgrade_UnifySameDomain
The following public methods in the class ShapeUpgrade_UnifySameDomain became protected:
* *UnifyFaces*
* *UnifyEdges*
The following public method has been removed:
* *UnifyFacesAndEdges*
@subsection upgrade_721_Move_BuildPCurveForEdgeOnPlane Moving BuildPCurveForEdgeOnPlane from BOPTools_AlgoTools2D to BRepLib
The methods BuildPCurveForEdgeOnPlane and BuildPCurveForEdgesOnPlane have been moved from the class BOPTools_AlgoTools2D
to the more lower level class BRepLib.
@subsection upgrade_721_removed Removed features
The following obsolete features have been removed:
* The package BOPCol has been fully removed:
- *BOPCol_BaseAllocator* is replaced with *Handle(NCollection_BaseAllocator)*;
- *BOPCol_BoxBndTree* is replaced with *BOPTools_BoxBndTree*;
- *BOPCol_Box2DBndTree* is removed as unused;
- *BOPCol_DataMapOfIntegerInteger* is replaced with *TColStd_DataMapOfIntegerInteger*;
- *BOPCol_DataMapOfIntegerListOfInteger* is replaced with *TColStd_DataMapOfIntegerListOfInteger*;
- *BOPCol_DataMapOfIntegerListOfShape* is replaced with *TopTools_DataMapOfIntegerListOfShape*;
- *BOPCol_DataMapOfIntegerMapOfInteger.hxx* is removed as unused;
- *BOPCol_DataMapOfIntegerReal* is replaced with *TColStd_DataMapOfIntegerReal*;
- *BOPCol_DataMapOfIntegerShape* is replaced with *TopTools_DataMapOfIntegerShape*;
- *BOPCol_DataMapOfShapeBox* is replaced with *TopTools_DataMapOfShapeBox*;
- *BOPCol_DataMapOfShapeInteger* is replaced with *TopTools_DataMapOfShapeInteger*;
- *BOPCol_DataMapOfShapeListOfShape* is replaced with *TopTools_DataMapOfShapeListOfShape*;
- *BOPCol_DataMapOfShapeReal* is replaced with *TopTools_DataMapOfShapeReal*;
- *BOPCol_DataMapOfShapeShape* is replaced with *TopTools_DataMapOfShapeShape*;
- *BOPCol_DataMapOfTransientAddress* is removed as unused;
- *BOPCol_IndexedDataMapOfIntegerListOfInteger* is removed as unused;
- *BOPCol_IndexedDataMapOfShapeBox* is removed as unused;
- *BOPCol_IndexedDataMapOfShapeInteger* is removed as unused;
- *BOPCol_IndexedDataMapOfShapeListOfShape* is replaced with *TopTools_IndexedDataMapOfShapeListOfShape*;
- *BOPCol_IndexedDataMapOfShapeReal* is removed as unused;
- *BOPCol_IndexedDataMapOfShapeShape* is replaced with *TopTools_IndexedDataMapOfShapeShape*;
- *BOPCol_IndexedMapOfInteger* is replaced with *TColStd_IndexedMapOfInteger*;
- *BOPCol_IndexedMapOfOrientedShape* is replaced with *TopTools_IndexedMapOfOrientedShape*;
- *BOPCol_IndexedMapOfShape* is replaced with *TopTools_IndexedMapOfShape*;
- *BOPCol_ListOfInteger* is replaced with *TColStd_ListOfInteger*;
- *BOPCol_ListOfListOfShape* is replaced with *TopTools_ListOfListOfShape*;
- *BOPCol_ListOfShape* is replaced with *TopTools_ListOfShape*;
- *BOPCol_MapOfInteger* is replaced with *TColStd_MapOfInteger*;
- *BOPCol_MapOfOrientedShape* is replaced with *TopTools_MapOfOrientedShape*;
- *BOPCol_MapOfShape* is replaced with *TopTools_MapOfShape*;
- *BOPCol_PListOfInteger* is removed as unused;
- *BOPCol_PInteger* is removed as unused
- *BOPCol_SequenceOfPnt2d* is replaced with *TColgp_SequenceOfPnt2d*;
- *BOPCol_SequenceOfReal* is replaced with *TColStd_SequenceOfReal*;
- *BOPCol_SequenceOfShape* is replaced with *TopTools_SequenceOfShape*;
- *BOPCol_Parallel* is replaced with *BOPTools_Parallel*;
- *BOPCol_NCVector* is replaced with *NCollection_Vector*;
* The class *BOPDS_PassKey* and containers for it have been removed as unused.
* The unused containers from *IntTools* package have been removed:
- *IntTools_DataMapOfShapeAddress* is removed as unused;
- *IntTools_IndexedDataMapOfTransientAddress* is removed as unused;
* The container *BiTgte_DataMapOfShapeBox* is replaced with *TopTools_DataMapOfShapeBox*;
* The class *BOPTools* has been removed as duplicate of the class *TopExp*;

View File

@@ -1082,8 +1082,8 @@ It is based on the General Fuse algorithm, thus all options of the General Fuse
On the low level the Splitter algorithm is implemented in class *BOPAlgo_Splitter*. The usage of this algorithm looks as follows:
~~~~~
BOPAlgo_Splitter aSplitter;
BOPCol_ListOfShape aLSObjects = …; // Objects
BOPCol_ListOfShape aLSTools = …; // Tools
TopTools_ListOfShape aLSObjects = …; // Objects
TopTools_ListOfShape aLSTools = …; // Tools
Standard_Boolean bRunParallel = Standard_False; /* parallel or single mode (the default value is FALSE)*/
Standard_Real aTol = 0.0; /* fuzzy option (default value is 0)*/
Standard_Boolean bSafeMode = Standard_False; /* protect or not the arguments from modification*/
@@ -2054,7 +2054,7 @@ This option is useful e.g. for building a solid from the faces of one shell or f
The usage of the algorithm on the API level:
~~~~
BOPAlgo_MakerVolume aMV;
BOPCol_ListOfShape aLS = …; // arguments
TopTools_ListOfShape aLS = …; // arguments
Standard_Boolean bRunParallel = Standard_False; /* parallel or single mode (the default value is FALSE)*/
Standard_Boolean bIntersect = Standard_True; /* intersect or not the arguments (the default value is TRUE)*/
Standard_Real aTol = 0.0; /* fuzzy option (default value is 0)*/
@@ -2148,7 +2148,7 @@ It is possible to create typed Containers from the parts added into result by us
Here is the example of the algorithm use on the API level:
~~~~
BOPAlgo_CellsBuilder aCBuilder;
BOPCol_ListOfShape aLS = …; // arguments
TopTools_ListOfShape aLS = …; // arguments
Standard_Boolean bRunParallel = Standard_False; /* parallel or single mode (the default value is FALSE)*/
Standard_Real aTol = 0.0; /* fuzzy option (the default value is 0)*/
Standard_Boolean bSafeMode = Standard_False; /* protect or not the arguments from modification*/
@@ -2169,8 +2169,8 @@ if (aCBuilder.HasErrors()) { // check error status
const TopoDS_Shape& anEmptyRes = aCBuilder.Shape(); // empty result, as nothing has been added yet
const TopoDS_Shape& anAllCells = aCBuilder.GetAllParts(); //all split parts
//
BOPCol_ListOfShape aLSToTake = ...; // parts of these arguments will be taken into result
BOPCol_ListOfShape aLSToAvoid = ...; // parts of these arguments will not be taken into result
TopTools_ListOfShape aLSToTake = ...; // parts of these arguments will be taken into result
TopTools_ListOfShape aLSToAvoid = ...; // parts of these arguments will not be taken into result
//
Standard_Integer iMaterial = 1; // defines the material for the cells
Standard_Boolean bUpdate = Standard_False; // defines whether to update the result right now or not
@@ -2718,6 +2718,38 @@ To enable the safe processing mode for the operation in DRAW, it is necessary to
bnondestructive 1
~~~~
@subsection occt_algorithms_11a_4 Disabling check of the input solids for inverted status
By default, all input solids are checked for inverted status, i.e. the solids are classified to understand if they are holes in the space (negative volumes) or normal solids (positive volumes). The possibility to disable the check of the input solids for inverted status is the advanced option in Boolean Operation component. This option can be applied to all Basic operations such as General Fuse, Splitting, Boolean, Section, Maker Volume, Cells building.
This option allows avoiding time-consuming classification of the input solids and operate with them as with positive volumes, saving up to 10 percent of time on the cases with big number of input solids.
The classification should be disabled only if the user is sure that there are no negative volumes among the input solids, otherwise the result may be invalid.
@subsubsection occt_algorithms_11a_4_1 Usage
#### API level
To enable/disable the classification of the input solids it is necessary to call *SetCheckInverted()* method with the appropriate value:
~~~~
BOPAlgo_Builder aGF;
//
....
// disabling the classification of the input solid
aGF.SetCheckInverted(Standard_False);
//
....
~~~~
#### TCL level
To enable/disable the classification of the solids in DRAW, it is necessary to call the *bcheckinverted* command with appropriate value:
* 0 - disabling the classification;
* 1 - default value, enabling the classification.
~~~~
bcheckinverted 0
~~~~
@section occt_algorithms_ers Errors and warnings reporting system
The chapter describes the Error/Warning reporting system of the algorithms in the Boolean Component.
@@ -2771,6 +2803,159 @@ Warning: The positioning of the shapes leads to creation of small edges without
~~~~
@section occt_algorithms_history History Information
The chapter describes the rules for filling the History Information (or just History) for the arguments of the operations in Boolean Component.
The History is available only for the VERTICES, EDGES, FACES and SOLIDS from the input arguments.
The History allows tracking the modification of the input shapes during the operation. It consists of the following information:
* Information about Deleted shapes;
* Information about Modified shapes;
* Information about Generated shapes;
All History information is filled basing on the result of current operation. History cannot return any shapes not contained in the result.
Thus if the result of the operation is empty shape, all input shapes will be considered as Deleted and none will have Modified and Generated shapes.
@subsection occt_algorithms_history_del Deleted shapes
The shape is considered as Deleted if the result shape do not contain the shape itself and none of its splits.
For example, the result of CUT operation of two overlapping planar faces (see the example below) does not contain any parts from the tool face. Thus, the tool faces is considered as Deleted.
If the faces are not fully coinciding, the result must contain some parts of the object face. In this case object face will be considered as not deleted.
But if the faces are fully coinciding, the result must be empty, and both faces will be considered as Deleted.
To get the information about Deleted shapes it is necessary to use the method *Standard_Boolean IsDeleted(const TopoDS_Shape& theS)*.
To get the information about Deleted shapes in DRAW it is necessary to use the command *bisdeleted shape*.
Example of the overlapping faces:
~~~~
plane p 0 0 0 0 0 1
mkface f1 p -10 10 -10 10
mkface f2 p 0 20 -10 10
bclearobjects
bcleartools
baddobjects f1
baddtools f2
bfillds
bbop r 2
bisdeleted f1
# Not deleted
bisdeleted f2
# Deleted
~~~~
@subsection occt_algorithms_history_modif Modified shapes
The shape is considered as Modified if the result shape contains any of the splits of the shape, not the shape itself. The shape can be modified only into the shapes with same dimension.
The splits of the shape contained in the result shape are Modified from the shape.
For example, in the FUSE operation of two edges intersecting in one point (see the example below), both edges will be split by the intersection point. All these splits will be contained in the result.
Thus, each of the input edges will be Modified into its two splits.
But in the CUT operation on the same edges, the tool edge will be Deleted from the result and, thus, will not have any Modified shapes.
To get the information about Modified shapes it is necessary to use the method *const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS)*.
The list of Modified elements will contain only those which are contained in the result of the operation. If the list is empty the shape has not been modified and it is necessary to check if it has been Deleted.
To get the information about Modified shapes in DRAW it is necessary to use the command *bmodified modif shape*.
Example of the intersecting edges:
~~~~
line l1 0 0 0 1 0 0
mkedge e1 l1 -10 10
line l2 0 0 0 0 1 0
mkedge e2 l2 -10 10
bclearobjects
bcleartools
baddobjects e1
baddtools e2
bfillds
# fuse operation
bbop r 1
bmodified m1 e1
nbshapes m1
# EDGES: 2
bmodified m2 e2
nbshapes m2
# EDGES: 2
# cut operation
bbop r 2
bmodified m1 e1
nbshapes m1
# EDGES: 2
bmodified m2 e2
# The shape has not been modified
~~~~
@subsection occt_algorithms_history_gen Generated shapes
In terms of the algorithms in Boolean Component the shape from the arguments can have Generated shapes only if these new shapes have been obtained as a result of pure intersection (not overlapping)
of this shape with any other shapes from arguments. Thus, the Generated shapes are always:
* VERTICES created from the intersection points and may be Generated from edges and faces only;
* EDGES created from the intersection edges and may be Generated from faces only.
So, only EDGES and FACES could have information about Generated shapes. For all other types of shapes the list of Generated shapes will be empty.
For example, the two intersecting edges will both have the intersection vertices Generated from them.
To get the information about Generated shapes it is necessary to use the method *const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS)*.
The list of Generated elements will contain only those which are contained in the result of the operation. If the list is empty no new shapes have been Generated from the shape.
To get the information about Generated shapes in DRAW it is necessary to use the command *bgenerated gen shape*.
Example of interfering faces
~~~~
plane p1 0 0 0 0 0 1
mkface f1 p1 -10 10 -10 10
plane p2 0 0 0 1 0 0
mkface f2 p2 -10 10 -10 10
bclearobjects
bcleartools
baddobjects f1
baddtools f2
bfillds
# fuse operation
bbop r 1
bgenerated gf1 f1
nbshapes gf1
# EDGES: 1
bgenerated gf2 f2
nbshapes gf2
# EDGES: 1
# common operation - result is empty
bbop r 0
bgenerated gf1 f1
# No shapes were generated from the shape
bgenerated gf2 f2
# No shapes were generated from the shape
~~~~
@section occt_algorithms_11b Usage
The chapter contains some examples of the OCCT Boolean Component usage. The usage is possible on two levels: C++ and Tcl.

View File

@@ -59,12 +59,10 @@ prism f4 l2 0 -1 0
compound f1 f2 f3 bc
bfuse r bc f4
bcut r r f5
explode r e
wire w r_4 r_1 r_20 r_21 r_22 r_23 r_24 r_25 r_26 r_7 r_30 r_31 r_32 r_33 r_27 r_28 r_29 r_11 r_38 r_34 r_35 r_36 r_37 r_16 r_17
tcopy w w1
tmirror w1 -6 0 0 0 1 0
wire w w w1
mkface w p w
tcopy r r1
tmirror r1 -6 0 0 0 1 0
bfuse w r r1
unifysamedom w w
donly w
# construct complete snowflake
@@ -135,9 +133,32 @@ vsetcolorbg 255 255 255
vtop
vfit
# add dimension
explode snowflake v
vdimension length -length -shapes snowflake_89 snowflake_15 -plane xoy -value 0.001 -dispunits mm -showunits -flyout 70 -label above -color black -text 5 3d sh
# add dimension:
# detect vertices extremal in X direction
boundingstr snowflake x1 y1 z1 x2 y2 z2
plane f1 x1 0 0 1 0 0
plane f2 x2 0 0 1 0 0
mkface f1 f1
mkface f2 f2
bsection s1 snowflake f1
bsection s2 snowflake f2
# select only upper vertices (nearer to the upper bound)
explode s1 v
explode s2 v
plane fup 0 y2 0 0 1 0
mkface fup fup
for {set i 1} {$i <= 2} {incr i} {
set dmin 1e10
for {set j 1} {$j <= 2} {incr j} {
distmini d s${i}_$j fup
set dist [dval d_val]
if {$dmin > $dist} {
set dmin $dist
eval set v$i s${i}_$j
}
}
}
vdimension length -length -shapes $v1 $v2 -plane xoy -value 0.001 -dispunits mm -showunits -flyout 70 -label above -color black -text 5 3d sh
if { [regexp HAVE_GL2PS [dversion]] } {
puts "You can use command vexport to generate PDF: vexport your_file_path.pdf"

View File

@@ -238,9 +238,8 @@ Standard_Boolean AIS_RadiusDimension::IsValidAnchor (const gp_Circ& theCircle,
{
gp_Pln aCirclePlane (theCircle.Location(), theCircle.Axis().Direction());
Standard_Real anAnchorDist = theAnchor.Distance (theCircle.Location());
Standard_Real aRadius = myCircle.Radius();
return Abs (anAnchorDist - aRadius) <= Precision::Confusion()
return anAnchorDist > Precision::Confusion()
&& aCirclePlane.Contains (theAnchor, Precision::Confusion());
}

View File

@@ -67,3 +67,27 @@ Warning: Removal of internal boundaries among Faces has failed
.BOPAlgo_AlertRemovalOfIBForEdgesFailed
Warning: Removal of internal boundaries among Edges has failed
.BOPAlgo_AlertIntersectionOfPairOfShapesFailed
Warning: Intersection of pair of shapes has failed
.BOPAlgo_AlertBuildingPCurveFailed
Warning: Building 2D curve of edge on face has failed
.BOPAlgo_AlertAcquiredSelfIntersection
Warning: Some sub-shapes of some of the argument become connected through other shapes and the argument became self-interfered
.BOPAlgo_AlertUnsupportedType
Warning: Unsupported type of input shape
.BOPAlgo_AlertUnableToRemoveTheFeature
Warning: Unable to remove the feature
.BOPAlgo_AlertNoFacesToRemove
Error: No faces have been found for removal
.BOPAlgo_AlertRemoveFeaturesFailed
Error: The Feature Removal algorithm has failed
.BOPAlgo_AlertSolidBuilderUnusedFaces
Warning: Some of the faces passed to the Solid Builder algorithm have not been classified and not used for solids creation

View File

@@ -78,4 +78,30 @@ DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertShellSplitterFailed)
//! Some edges are too small and have no valid range
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertTooSmallEdge)
//! Intersection of pair of shapes has failed
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertIntersectionOfPairOfShapesFailed)
//! Building 2D curve of edge on face has failed
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertBuildingPCurveFailed)
//! Some sub-shapes of some of the argument become connected through
//! other shapes and the argument became self-interfered
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertAcquiredSelfIntersection)
//! Unsupported type of input shape
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertUnsupportedType)
//! No faces have been found for removal
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertNoFacesToRemove)
//! Unable to remove the feature
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertUnableToRemoveTheFeature)
//! The Feature Removal algorithm has failed
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertRemoveFeaturesFailed)
//! Some of the faces passed to the Solid Builder algorithm have not been classified
//! and not used for solids creation
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertSolidBuilderUnusedFaces)
#endif // _BOPAlgo_Alerts_HeaderFile

View File

@@ -24,8 +24,6 @@
#include <BOPAlgo_Options.hxx>
#include <BOPCol_DataMapOfIntegerListOfShape.hxx>
//! The class provides the root interface for the algorithms in Boolean Component.<br>
class BOPAlgo_Algo : public BOPAlgo_Options
{
@@ -41,7 +39,7 @@ protected:
Standard_EXPORT BOPAlgo_Algo();
Standard_EXPORT virtual ~BOPAlgo_Algo();
Standard_EXPORT BOPAlgo_Algo(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT BOPAlgo_Algo(const Handle(NCollection_BaseAllocator)& theAllocator);
//! Checks input data
Standard_EXPORT virtual void CheckData();

View File

@@ -16,13 +16,8 @@
#include <BOPAlgo_BuilderFace.hxx>
#include <BOPAlgo_CheckerSI.hxx>
#include <BOPAlgo_Operation.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_SequenceOfShape.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_MapOfPair.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools3D.hxx>
#include <BRep_Builder.hxx>
@@ -50,6 +45,11 @@
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
// ================================================================================
// function: Constructor
// purpose:
@@ -353,7 +353,7 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
//
Standard_Integer n1, n2;
BOPDS_MapIteratorOfMapOfPair aItMPK;
BOPCol_ListOfShape anArgs;
TopTools_ListOfShape anArgs;
BOPAlgo_CheckerSI aChecker;
//
anArgs.Append(aS);
@@ -535,7 +535,7 @@ void BOPAlgo_ArgumentAnalyzer::TestRebuildFace()
continue;
TopExp_Explorer anExp(aS, TopAbs_FACE);
BOPCol_ListOfShape aLS;
TopTools_ListOfShape aLS;
for(; anExp.More(); anExp.Next()) {
const TopoDS_Face& aFace = *(TopoDS_Face*)&(anExp.Current());
@@ -566,7 +566,7 @@ void BOPAlgo_ArgumentAnalyzer::TestRebuildFace()
aBF.SetFace(aFace);
aBF.SetShapes(aLS);
aBF.Perform();
const BOPCol_ListOfShape& aLF = aBF.Areas();
const TopTools_ListOfShape& aLF = aBF.Areas();
Standard_Boolean bBadFace = Standard_False;
if(aLF.Extent() != 1) {
@@ -647,8 +647,8 @@ void BOPAlgo_ArgumentAnalyzer::TestTangent()
}
TopExp_Explorer anExp1(myShape1, theType);
TopExp_Explorer anExp2(myShape2, theType);
BOPCol_SequenceOfShape aSeq1, aSeq2;
BOPCol_MapOfShape aMap1, aMap2;
TopTools_SequenceOfShape aSeq1, aSeq2;
TopTools_MapOfShape aMap1, aMap2;
for(; anExp1.More(); anExp1.Next()) {
const TopoDS_Shape& aS1 = anExp1.Current();
@@ -675,7 +675,7 @@ void BOPAlgo_ArgumentAnalyzer::TestTangent()
for(i = 1; i <= aSeq1.Length(); i++) {
const TopoDS_Shape& aS1 = aSeq1.Value(i);
BOPCol_ListOfShape aListOfS2;
TopTools_ListOfShape aListOfS2;
Standard_Integer nbs = 0;
for(j = 1; j <= aSeq2.Length(); j++) {
@@ -731,7 +731,7 @@ void BOPAlgo_ArgumentAnalyzer::TestTangent()
aResult.SetShape1(myShape1);
aResult.SetShape2(myShape2);
aResult.AddFaultyShape1(aS1);
BOPCol_ListIteratorOfListOfShape anIt(aListOfS2);
TopTools_ListIteratorOfListOfShape anIt(aListOfS2);
for(; anIt.More(); anIt.Next()) {
aResult.AddFaultyShape2(anIt.Value());
@@ -748,7 +748,7 @@ void BOPAlgo_ArgumentAnalyzer::TestTangent()
for(i = 1; i <= aSeq2.Length(); i++) {
const TopoDS_Shape& aS2 = aSeq2.Value(i);
BOPCol_ListOfShape aListOfS1;
TopTools_ListOfShape aListOfS1;
Standard_Integer nbs = 0;
for(j = 1; j <= aSeq1.Length(); j++) {
@@ -765,7 +765,7 @@ void BOPAlgo_ArgumentAnalyzer::TestTangent()
aResult.SetShape1(myShape1);
aResult.SetShape2(myShape2);
BOPCol_ListIteratorOfListOfShape anIt(aListOfS1);
TopTools_ListIteratorOfListOfShape anIt(aListOfS1);
for(; anIt.More(); anIt.Next()) {
aResult.AddFaultyShape1(anIt.Value());
@@ -816,7 +816,7 @@ void BOPAlgo_ArgumentAnalyzer::TestContinuity()
continue;
}
//
BOPCol_IndexedMapOfShape aMS;
TopTools_IndexedMapOfShape aMS;
//Edges
aExp.Init(aS, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {

View File

@@ -22,11 +22,10 @@
#include <TopoDS_Shape.hxx>
#include <Standard_Boolean.hxx>
#include <BOPAlgo_Algo.hxx>
#include <BOPAlgo_Operation.hxx>
#include <BOPAlgo_ListOfCheckResult.hxx>
#include <Standard_Real.hxx>
#include <BOPCol_DataMapOfShapeReal.hxx>
#include <BOPAlgo_Algo.hxx>
#include <TopAbs_ShapeEnum.hxx>
class TopoDS_Shape;

View File

@@ -16,65 +16,58 @@
#include <BOPAlgo_BOP.hxx>
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPDS_DS.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools3D.hxx>
#include <BOPTools_IndexedDataMapOfSetShape.hxx>
#include <BOPTools_Set.hxx>
#include <BOPTools_SetMapHasher.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <NCollection_DataMap.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
typedef NCollection_IndexedDataMap
<BOPTools_Set,
TopoDS_Shape,
BOPTools_SetMapHasher> BOPTools_IndexedDataMapOfSetShape;
//
static
TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim);
//
static
void CollectContainers(const TopoDS_Shape& theS,
BOPCol_ListOfShape& theLSC);
TopTools_ListOfShape& theLSC);
//
static
void RemoveDuplicates(BOPCol_ListOfShape& theContainers);
void RemoveDuplicates(TopTools_ListOfShape& theContainers);
//
static
void RemoveDuplicates(BOPCol_ListOfShape& theContainers,
void RemoveDuplicates(TopTools_ListOfShape& theContainers,
const TopAbs_ShapeEnum theType);
//
static
Standard_Integer NbCommonItemsInMap(const BOPCol_MapOfShape& theM1,
const BOPCol_MapOfShape& theM2);
Standard_Integer NbCommonItemsInMap(const TopTools_MapOfShape& theM1,
const TopTools_MapOfShape& theM2);
//
static
void MapFacesToBuildSolids(const TopoDS_Shape& theSol,
BOPCol_IndexedDataMapOfShapeListOfShape& theMFS,
BOPCol_IndexedMapOfShape& theMFI);
TopTools_IndexedDataMapOfShapeListOfShape& theMFS,
TopTools_IndexedMapOfShape& theMFI);
//=======================================================================
//function :
//purpose :
//=======================================================================
BOPAlgo_BOP::BOPAlgo_BOP()
:
BOPAlgo_Builder(),
myTools(myAllocator),
myMapTools(100, myAllocator)
: BOPAlgo_ToolsProvider()
{
Clear();
}
@@ -82,12 +75,8 @@ BOPAlgo_BOP::BOPAlgo_BOP()
//function :
//purpose :
//=======================================================================
BOPAlgo_BOP::BOPAlgo_BOP
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Builder(theAllocator),
myTools(myAllocator),
myMapTools(100, myAllocator)
BOPAlgo_BOP::BOPAlgo_BOP(const Handle(NCollection_BaseAllocator)& theAllocator)
: BOPAlgo_ToolsProvider(theAllocator)
{
Clear();
}
@@ -105,12 +94,10 @@ BOPAlgo_BOP::~BOPAlgo_BOP()
void BOPAlgo_BOP::Clear()
{
myOperation=BOPAlgo_UNKNOWN;
myTools.Clear();
myMapTools.Clear();
myDims[0]=-1;
myDims[1]=-1;
//
BOPAlgo_Builder::Clear();
BOPAlgo_ToolsProvider::Clear();
}
//=======================================================================
//function : SetOperation
@@ -129,31 +116,6 @@ BOPAlgo_Operation BOPAlgo_BOP::Operation()const
return myOperation;
}
//=======================================================================
//function : AddTool
//purpose :
//=======================================================================
void BOPAlgo_BOP::AddTool(const TopoDS_Shape& theShape)
{
if (myMapTools.Add(theShape)) {
myTools.Append(theShape);
}
}
//=======================================================================
//function : SetTools
//purpose :
//=======================================================================
void BOPAlgo_BOP::SetTools(const BOPCol_ListOfShape& theShapes)
{
BOPCol_ListIteratorOfListOfShape aIt;
//
myTools.Clear();
aIt.Initialize(theShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
AddTool(aS);
}
}
//=======================================================================
//function : CheckData
//purpose :
//=======================================================================
@@ -161,7 +123,7 @@ void BOPAlgo_BOP::CheckData()
{
Standard_Integer i, j, iDim, aNbArgs, aNbTools;
Standard_Boolean bFuse;
BOPCol_ListIteratorOfListOfShape aItLS;
TopTools_ListIteratorOfListOfShape aItLS;
//
if (!(myOperation==BOPAlgo_COMMON ||
myOperation==BOPAlgo_FUSE ||
@@ -205,7 +167,7 @@ void BOPAlgo_BOP::CheckData()
Standard_Boolean bHasValid[2] = {Standard_False, Standard_False};
//
for (i=0; i<2; ++i) {
const BOPCol_ListOfShape& aLS=(!i)? myArguments : myTools;
const TopTools_ListOfShape& aLS=(!i)? myArguments : myTools;
aItLS.Initialize(aLS);
for (j=0; aItLS.More(); aItLS.Next(), ++j) {
const TopoDS_Shape& aS=aItLS.Value();
@@ -270,8 +232,8 @@ Standard_Boolean BOPAlgo_BOP::TreatEmptyShape()
}
//
// Find non-empty objects
BOPCol_ListOfShape aLValidObjs;
BOPCol_ListIteratorOfListOfShape aItLS(myArguments);
TopTools_ListOfShape aLValidObjs;
TopTools_ListIteratorOfListOfShape aItLS(myArguments);
for (; aItLS.More(); aItLS.Next()) {
if (!BOPTools_AlgoTools3D::IsEmptyShape(aItLS.Value())) {
aLValidObjs.Append(aItLS.Value());
@@ -279,7 +241,7 @@ Standard_Boolean BOPAlgo_BOP::TreatEmptyShape()
}
//
// Find non-empty tools
BOPCol_ListOfShape aLValidTools;
TopTools_ListOfShape aLValidTools;
aItLS.Initialize(myTools);
for (; aItLS.More() ; aItLS.Next()) {
if (!BOPTools_AlgoTools3D::IsEmptyShape(aItLS.Value())) {
@@ -304,7 +266,7 @@ Standard_Boolean BOPAlgo_BOP::TreatEmptyShape()
// so we can build the result of operation right away just by
// choosing the list of shapes to add to result, depending on
// the type of the operation
BOPCol_ListOfShape *pLResult = NULL;
TopTools_ListOfShape *pLResult = NULL;
//
switch (myOperation) {
case BOPAlgo_FUSE:
@@ -342,17 +304,17 @@ void BOPAlgo_BOP::BuildResult(const TopAbs_ShapeEnum theType)
{
TopAbs_ShapeEnum aType;
BRep_Builder aBB;
BOPCol_MapOfShape aM;
BOPCol_ListIteratorOfListOfShape aIt, aItIm;
TopTools_MapOfShape aM;
TopTools_ListIteratorOfListOfShape aIt, aItIm;
//
const BOPCol_ListOfShape& aLA=myDS->Arguments();
const TopTools_ListOfShape& aLA=myDS->Arguments();
aIt.Initialize(aLA);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
aType=aS.ShapeType();
if (aType==theType) {
if (myImages.IsBound(aS)){
const BOPCol_ListOfShape& aLSIm=myImages.Find(aS);
const TopTools_ListOfShape& aLSIm=myImages.Find(aS);
aItIm.Initialize(aLSIm);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aSIm=aItIm.Value();
@@ -377,7 +339,7 @@ void BOPAlgo_BOP::Perform()
{
Handle(NCollection_BaseAllocator) aAllocator;
BOPAlgo_PaveFiller* pPF;
BOPCol_ListIteratorOfListOfShape aItLS;
TopTools_ListIteratorOfListOfShape aItLS;
//
GetReport()->Clear();
//
@@ -390,7 +352,7 @@ void BOPAlgo_BOP::Perform()
//
aAllocator=
NCollection_BaseAllocator::CommonBaseAllocator();
BOPCol_ListOfShape aLS(aAllocator);
TopTools_ListOfShape aLS(aAllocator);
//
aItLS.Initialize(myArguments);
for (; aItLS.More(); aItLS.Next()) {
@@ -563,7 +525,7 @@ void BOPAlgo_BOP::BuildRC()
//
// A. Fuse
if (myOperation == BOPAlgo_FUSE) {
BOPCol_MapOfShape aMFence;
TopTools_MapOfShape aMFence;
aType = TypeToExplore(myDims[0]);
TopExp_Explorer aExp(myShape, aType);
for (; aExp.More(); aExp.Next()) {
@@ -580,13 +542,13 @@ void BOPAlgo_BOP::BuildRC()
//
Standard_Integer i, j, aNb, iDim;
Standard_Boolean bCheckEdges, bContains, bCut21, bCommon;
BOPCol_ListIteratorOfListOfShape aItLS;
TopTools_ListIteratorOfListOfShape aItLS;
//
// prepare the building elements of arguments to get its splits
BOPCol_IndexedMapOfShape aMArgs, aMTools;
TopTools_IndexedMapOfShape aMArgs, aMTools;
for (i = 0; i < 2; ++i) {
const BOPCol_ListOfShape& aLS = !i ? myArguments : myTools;
BOPCol_IndexedMapOfShape& aMS = !i ? aMArgs : aMTools;
const TopTools_ListOfShape& aLS = !i ? myArguments : myTools;
TopTools_IndexedMapOfShape& aMS = !i ? aMArgs : aMTools;
aItLS.Initialize(aLS);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS = aItLS.Value();
@@ -595,19 +557,19 @@ void BOPAlgo_BOP::BuildRC()
continue;
}
aType = TypeToExplore(iDim);
BOPTools::MapShapes(aS, aType, aMS);
TopExp::MapShapes(aS, aType, aMS);
}
}
//
bCheckEdges = Standard_False;
//
// get splits of building elements
BOPCol_IndexedMapOfShape aMArgsIm, aMToolsIm;
TopTools_IndexedMapOfShape aMArgsIm, aMToolsIm;
BOPTools_IndexedDataMapOfSetShape aMSetArgs, aMSetTools;
for (i = 0; i < 2; ++i) {
const BOPCol_IndexedMapOfShape& aMS = !i ? aMArgs : aMTools;
BOPCol_IndexedMapOfShape& aMSIm = !i ? aMArgsIm : aMToolsIm;
const TopTools_IndexedMapOfShape& aMS = !i ? aMArgs : aMTools;
TopTools_IndexedMapOfShape& aMSIm = !i ? aMArgsIm : aMToolsIm;
BOPTools_IndexedDataMapOfSetShape& aMSet = !i ? aMSetArgs : aMSetTools;
//
aNb = aMS.Extent();
@@ -623,7 +585,7 @@ void BOPAlgo_BOP::BuildRC()
}
//
if (myImages.IsBound(aS)) {
const BOPCol_ListOfShape& aLSIm = myImages.Find(aS);
const TopTools_ListOfShape& aLSIm = myImages.Find(aS);
aItLS.Initialize(aLSIm);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSIm = aItLS.Value();
@@ -651,11 +613,11 @@ void BOPAlgo_BOP::BuildRC()
bCommon = (myOperation == BOPAlgo_COMMON);
bCut21 = (myOperation == BOPAlgo_CUT21);
//
const BOPCol_IndexedMapOfShape& aMIt = bCut21 ? aMToolsIm : aMArgsIm;
const BOPCol_IndexedMapOfShape& aMCheck = bCut21 ? aMArgsIm : aMToolsIm;
const TopTools_IndexedMapOfShape& aMIt = bCut21 ? aMToolsIm : aMArgsIm;
const TopTools_IndexedMapOfShape& aMCheck = bCut21 ? aMArgsIm : aMToolsIm;
const BOPTools_IndexedDataMapOfSetShape& aMSetCheck = bCut21 ? aMSetArgs : aMSetTools;
//
BOPCol_IndexedMapOfShape aMCheckExp, aMItExp;
TopTools_IndexedMapOfShape aMCheckExp, aMItExp;
//
if (bCommon) {
aNb = aMIt.Extent();
@@ -664,7 +626,7 @@ void BOPAlgo_BOP::BuildRC()
iDimMax = BOPTools_AlgoTools::Dimension(aS);
for (iDim = iDimMin; iDim < iDimMax; ++iDim) {
aType = TypeToExplore(iDim);
BOPTools::MapShapes(aS, aType, aMItExp);
TopExp::MapShapes(aS, aType, aMItExp);
}
aMItExp.Add(aS);
}
@@ -679,7 +641,7 @@ void BOPAlgo_BOP::BuildRC()
iDimMax = BOPTools_AlgoTools::Dimension(aS);
for (iDim = iDimMin; iDim < iDimMax; ++iDim) {
aType = TypeToExplore(iDim);
BOPTools::MapShapes(aS, aType, aMCheckExp);
TopExp::MapShapes(aS, aType, aMCheckExp);
}
aMCheckExp.Add(aS);
}
@@ -709,7 +671,7 @@ void BOPAlgo_BOP::BuildRC()
//
// filter result for COMMON operation
if (bCommon) {
BOPCol_MapOfShape aMFence;
TopTools_MapOfShape aMFence;
TopExp_Explorer aExp;
TopoDS_Compound aCx;
aBB.MakeCompound(aCx);
@@ -721,7 +683,7 @@ void BOPAlgo_BOP::BuildRC()
const TopoDS_Shape& aS = aExp.Current();
if (aMFence.Add(aS)) {
aBB.Add(aCx, aS);
BOPTools::MapShapes(aS, aMFence);
TopExp::MapShapes(aS, aMFence);
}
}
}
@@ -735,10 +697,10 @@ void BOPAlgo_BOP::BuildRC()
//
// The squats around degenerated edges
Standard_Integer nVD;
BOPCol_IndexedMapOfShape aMVC;
TopTools_IndexedMapOfShape aMVC;
//
// 1. Vertices of aC
BOPTools::MapShapes(aC, TopAbs_VERTEX, aMVC);
TopExp::MapShapes(aC, TopAbs_VERTEX, aMVC);
//
// 2. DE candidates
aNb = myDS->NbSourceShapes();
@@ -789,18 +751,18 @@ void BOPAlgo_BOP::BuildShape()
//
Standard_Integer i;
TopAbs_ShapeEnum aType, aT1, aT2;
BOPCol_ListOfShape aLSC, aLCB;
BOPCol_ListIteratorOfListOfShape aItLS, aItLSIm, aItLCB;
TopTools_ListOfShape aLSC, aLCB;
TopTools_ListIteratorOfListOfShape aItLS, aItLSIm, aItLCB;
TopoDS_Iterator aIt;
BRep_Builder aBB;
TopoDS_Shape aRC, aRCB;
//
BOPCol_MapOfShape aMSRC;
BOPTools::MapShapes(myRC, aMSRC);
TopTools_MapOfShape aMSRC;
TopExp::MapShapes(myRC, aMSRC);
//
// collect images of containers
for (i = 0; i < 2; ++i) {
const BOPCol_ListOfShape& aLS = !i ? myArguments : myTools;
const TopTools_ListOfShape& aLS = !i ? myArguments : myTools;
//
aItLS.Initialize(aLS);
for (; aItLS.More(); aItLS.Next()) {
@@ -810,10 +772,12 @@ void BOPAlgo_BOP::BuildShape()
}
}
// make containers
BOPCol_ListOfShape aLCRes;
TopTools_ListOfShape aLCRes;
TopTools_MapOfShape aMInpFence;
aItLS.Initialize(aLSC);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSC = aItLS.Value();
aMInpFence.Add(aSC);
//
BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
//
@@ -821,7 +785,7 @@ void BOPAlgo_BOP::BuildShape()
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
if (myImages.IsBound(aS)) {
const BOPCol_ListOfShape& aLSIm = myImages.Find(aS);
const TopTools_ListOfShape& aLSIm = myImages.Find(aS);
//
aItLSIm.Initialize(aLSIm);
for (; aItLSIm.More(); aItLSIm.Next()) {
@@ -895,19 +859,44 @@ void BOPAlgo_BOP::BuildShape()
for (; aItLS.More(); aItLS.Next()) {
aBB.Add(aResult, aItLS.Value());
}
//
// add the rest of the shapes into result
BOPCol_MapOfShape aMSResult;
BOPTools::MapShapes(aResult, aMSResult);
//
aIt.Initialize(myRC);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
if (aMSResult.Add(aS)) {
aBB.Add(aResult, aS);
// create map of containers
TopTools_MapOfShape aMSResult;
TopExp::MapShapes(aResult, aMSResult);
// get input non-container shapes
TopTools_ListOfShape aLSNonCont;
for (i = 0; i < 2; ++i)
{
const TopTools_ListOfShape& aLS = !i ? myArguments : myTools;
aItLS.Initialize(aLS);
for (; aItLS.More(); aItLS.Next())
{
const TopoDS_Shape& aS = aItLS.Value();
BOPAlgo_Tools::TreatCompound(aS, aMInpFence, aLSNonCont);
}
}
//
// put non-container shapes in the result
aItLS.Initialize(aLSNonCont);
for (; aItLS.More(); aItLS.Next())
{
const TopoDS_Shape& aS = aItLS.Value();
if (myImages.IsBound(aS))
{
const TopTools_ListOfShape& aLSIm = myImages.Find(aS);
aItLSIm.Initialize(aLSIm);
for (; aItLSIm.More(); aItLSIm.Next())
{
const TopoDS_Shape& aSIm = aItLSIm.Value();
if (aMSRC.Contains(aSIm) && aMSResult.Add(aSIm))
aBB.Add(aResult, aSIm);
}
}
else if (aMSRC.Contains(aS) && aMSResult.Add(aS))
aBB.Add(aResult, aS);
}
myShape = aResult;
}
//=======================================================================
@@ -917,18 +906,18 @@ void BOPAlgo_BOP::BuildShape()
void BOPAlgo_BOP::BuildSolid()
{
// Containers
BOPCol_ListOfShape aLSC;
TopTools_ListOfShape aLSC;
//
BOPCol_ListIteratorOfListOfShape aItLS;
TopTools_ListIteratorOfListOfShape aItLS;
TopExp_Explorer aExp;
BRep_Builder aBB;
//
// Get solids from input arguments
BOPCol_MapOfShape aMSA;
TopTools_MapOfShape aMSA;
// Map the arguments to find shared faces
BOPCol_IndexedDataMapOfShapeListOfShape aMFS;
TopTools_IndexedDataMapOfShapeListOfShape aMFS;
for (Standard_Integer i = 0; i < 2; ++i) {
const BOPCol_ListOfShape& aLSA = (i) ? myArguments : myTools;
const TopTools_ListOfShape& aLSA = (i) ? myArguments : myTools;
aItLS.Initialize(aLSA);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSA = aItLS.Value();
@@ -936,7 +925,7 @@ void BOPAlgo_BOP::BuildSolid()
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aSol = aExp.Current();
aMSA.Add(aSol);
BOPTools::MapShapesAndAncestors(aSol, TopAbs_FACE, TopAbs_SOLID, aMFS);
TopExp::MapShapesAndAncestors(aSol, TopAbs_FACE, TopAbs_SOLID, aMFS);
}
//
// get Compsolids from input arguments
@@ -945,10 +934,10 @@ void BOPAlgo_BOP::BuildSolid()
}
//
// Find solids in input arguments sharing faces with other solids
BOPCol_MapOfShape aMTSols;
TopTools_MapOfShape aMTSols;
Standard_Integer i, aNb = aMFS.Extent();
for (i = 1; i < aNb; ++i) {
const BOPCol_ListOfShape& aLSols = aMFS(i);
const TopTools_ListOfShape& aLSols = aMFS(i);
if (aLSols.Extent() > 1) {
aItLS.Initialize(aLSols);
for(; aItLS.More(); aItLS.Next()) {
@@ -958,11 +947,11 @@ void BOPAlgo_BOP::BuildSolid()
}
//
// Possibly untouched solids - to be added to results as is
BOPCol_IndexedMapOfShape aMUSols;
TopTools_IndexedMapOfShape aMUSols;
// Use map to chose the most outer faces to build result solids
aMFS.Clear();
// Internal faces
BOPCol_IndexedMapOfShape aMFI;
TopTools_IndexedMapOfShape aMFI;
//
TopoDS_Iterator aIt(myRC);
for (; aIt.More(); aIt.Next()) {
@@ -1005,39 +994,18 @@ void BOPAlgo_BOP::BuildSolid()
}
}
//
BOPCol_IndexedDataMapOfShapeListOfShape aMEF;
// Split faces will be added in the end
// to avoid errors in BuilderSolid algorithm
BOPCol_ListOfShape aLF, aLFx;
TopTools_IndexedDataMapOfShapeListOfShape aMEF;
// Fill the list of faces to build the result solids
TopTools_ListOfShape aSFS;
aNb = aMFS.Extent();
for (i = 1; i <= aNb; ++i) {
const BOPCol_ListOfShape& aLSx = aMFS(i);
const TopTools_ListOfShape& aLSx = aMFS(i);
if (aLSx.Extent() == 1) {
const TopoDS_Shape& aFx = aMFS.FindKey(i);
BOPTools::MapShapesAndAncestors(aFx, TopAbs_EDGE, TopAbs_FACE, aMEF);
if (IsBoundSplits(aFx, aMEF)){
aLFx.Append(aFx);
continue;
}
aLF.Append(aFx);
TopExp::MapShapesAndAncestors(aFx, TopAbs_EDGE, TopAbs_FACE, aMEF);
aSFS.Append(aFx);
}
}
//
// Faces to build result solids
BOPCol_ListOfShape aSFS;
aItLS.Initialize(aLF);
for(; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aFx = aItLS.Value();
aSFS.Append(aFx);
}
//
// Split faces
aItLS.Initialize(aLFx);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aFx = aItLS.Value();
aSFS.Append(aFx);
}
//
// Internal faces
aNb = aMFI.Extent();
for (i = 1; i <= aNb; ++i) {
@@ -1050,16 +1018,19 @@ void BOPAlgo_BOP::BuildSolid()
BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
if (aSFS.Extent()) {
// Build solids from set of faces
BOPAlgo_BuilderSolid aSB;
aSB.SetContext(myContext);
aSB.SetShapes(aSFS);
aSB.Perform();
if (aSB.HasErrors()) {
BOPAlgo_BuilderSolid aBS;
aBS.SetContext(myContext);
aBS.SetShapes(aSFS);
aBS.Perform();
if (aBS.HasErrors()) {
AddError (new BOPAlgo_AlertSolidBuilderFailed); // SolidBuilder failed
return;
}
myReport->Merge(aBS.GetReport());
// new solids
const BOPCol_ListOfShape& aLSR = aSB.Areas();
const TopTools_ListOfShape& aLSR = aBS.Areas();
//
// add new solids to result
aItLS.Initialize(aLSR);
@@ -1110,19 +1081,19 @@ void BOPAlgo_BOP::BuildSolid()
}
//
// get splits of faces of the Compsolid arguments
BOPCol_MapOfShape aMFCs;
TopTools_MapOfShape aMFCs;
aItLS.Initialize(aLSC);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aCs = aItLS.Value();
aExp.Init(aCs, TopAbs_FACE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aF = aExp.Current();
const BOPCol_ListOfShape* pLFIm = myImages.Seek(aF);
const TopTools_ListOfShape* pLFIm = myImages.Seek(aF);
if (!pLFIm) {
aMFCs.Add(aF);
}
else {
BOPCol_ListIteratorOfListOfShape aItLFIm(*pLFIm);
TopTools_ListIteratorOfListOfShape aItLFIm(*pLFIm);
for (; aItLFIm.More(); aItLFIm.Next()) {
aMFCs.Add(aItLFIm.Value());
}
@@ -1131,7 +1102,7 @@ void BOPAlgo_BOP::BuildSolid()
}
//
// build connexity blocks from new solids
BOPCol_ListOfShape aLCBS;
TopTools_ListOfShape aLCBS;
BOPTools_AlgoTools::MakeConnexityBlocks(aRC, TopAbs_FACE, TopAbs_SOLID, aLCBS);
//
aItLS.Initialize(aLCBS);
@@ -1169,54 +1140,6 @@ void BOPAlgo_BOP::BuildSolid()
myShape = aResult;
}
//=======================================================================
//function : IsBoundSplits
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_BOP::IsBoundSplits
(const TopoDS_Shape& aS,
BOPCol_IndexedDataMapOfShapeListOfShape& aMEF)
{
Standard_Boolean bRet = Standard_False;
if (mySplits.IsBound(aS) || myOrigins.IsBound(aS)) {
return !bRet;
}
BOPCol_ListIteratorOfListOfShape aIt;
Standard_Integer aNbLS;
TopAbs_Orientation anOr;
//
//check face aF may be connected to face from mySplits
TopExp_Explorer aExp(aS, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE = (*(TopoDS_Edge*)(&aExp.Current()));
//
anOr = aE.Orientation();
if (anOr==TopAbs_INTERNAL) {
continue;
}
//
if (BRep_Tool::Degenerated(aE)) {
continue;
}
//
const BOPCol_ListOfShape& aLS=aMEF.FindFromKey(aE);
aNbLS = aLS.Extent();
if (!aNbLS) {
continue;
}
//
aIt.Initialize(aLS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx = aIt.Value();
if (mySplits.IsBound(aSx) || myOrigins.IsBound(aS)) {
return !bRet;
}
}
}
//
return bRet;
}
//=======================================================================
//function : TypeToExplore
//purpose :
//=======================================================================
@@ -1248,7 +1171,7 @@ TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim)
//purpose :
//=======================================================================
void CollectContainers(const TopoDS_Shape& theS,
BOPCol_ListOfShape& theLSC)
TopTools_ListOfShape& theLSC)
{
TopAbs_ShapeEnum aType = theS.ShapeType();
if (aType == TopAbs_WIRE ||
@@ -1273,7 +1196,7 @@ void CollectContainers(const TopoDS_Shape& theS,
//function : RemoveDuplicates
//purpose : Filters the containers with identical contents
//=======================================================================
void RemoveDuplicates(BOPCol_ListOfShape& theContainers)
void RemoveDuplicates(TopTools_ListOfShape& theContainers)
{
RemoveDuplicates(theContainers, TopAbs_WIRE);
RemoveDuplicates(theContainers, TopAbs_SHELL);
@@ -1284,12 +1207,12 @@ void RemoveDuplicates(BOPCol_ListOfShape& theContainers)
//function : RemoveDuplicates
//purpose : Filters the containers of given type with identical contents
//=======================================================================
void RemoveDuplicates(BOPCol_ListOfShape& theContainers,
void RemoveDuplicates(TopTools_ListOfShape& theContainers,
const TopAbs_ShapeEnum theType)
{
// get containers of given type
BOPCol_ListOfShape aLC;
BOPCol_ListIteratorOfListOfShape aItLC(theContainers);
TopTools_ListOfShape aLC;
TopTools_ListIteratorOfListOfShape aItLC(theContainers);
for (; aItLC.More(); aItLC.Next()) {
const TopoDS_Shape& aC = aItLC.Value();
if (aC.ShapeType() == theType) {
@@ -1302,13 +1225,13 @@ void RemoveDuplicates(BOPCol_ListOfShape& theContainers,
}
//
// map containers to compare its contents
NCollection_IndexedDataMap<TopoDS_Shape, BOPCol_MapOfShape> aContents;
NCollection_IndexedDataMap<TopoDS_Shape, TopTools_MapOfShape> aContents;
//
aItLC.Initialize(aLC);
for (; aItLC.More(); aItLC.Next()) {
const TopoDS_Shape& aC = aItLC.Value();
//
BOPCol_MapOfShape& aMC = aContents(aContents.Add(aC, BOPCol_MapOfShape()));
TopTools_MapOfShape& aMC = aContents(aContents.Add(aC, TopTools_MapOfShape()));
//
TopoDS_Iterator aIt(aC);
for (; aIt.More(); aIt.Next()) {
@@ -1317,7 +1240,7 @@ void RemoveDuplicates(BOPCol_ListOfShape& theContainers,
}
//
// compare the contents of the containers and find duplicates
BOPCol_MapOfShape aDuplicates;
TopTools_MapOfShape aDuplicates;
//
Standard_Integer i, j, aNb = aContents.Extent();
for (i = 1; i <= aNb; ++i) {
@@ -1325,7 +1248,7 @@ void RemoveDuplicates(BOPCol_ListOfShape& theContainers,
if (aDuplicates.Contains(aCi)) {
continue;
}
const BOPCol_MapOfShape& aMi = aContents(i);
const TopTools_MapOfShape& aMi = aContents(i);
Standard_Integer aNbi = aMi.Extent();
//
for (j = i + 1; j <= aNb; ++j) {
@@ -1333,7 +1256,7 @@ void RemoveDuplicates(BOPCol_ListOfShape& theContainers,
if (aDuplicates.Contains(aCj)) {
continue;
}
const BOPCol_MapOfShape& aMj = aContents(j);
const TopTools_MapOfShape& aMj = aContents(j);
Standard_Integer aNbj = aMj.Extent();
//
Standard_Integer aNbCommon = NbCommonItemsInMap(aMi, aMj);
@@ -1370,11 +1293,11 @@ void RemoveDuplicates(BOPCol_ListOfShape& theContainers,
//function : NbCommonItemsInMap
//purpose : Counts the items contained in both maps
//=======================================================================
Standard_Integer NbCommonItemsInMap(const BOPCol_MapOfShape& theM1,
const BOPCol_MapOfShape& theM2)
Standard_Integer NbCommonItemsInMap(const TopTools_MapOfShape& theM1,
const TopTools_MapOfShape& theM2)
{
const BOPCol_MapOfShape* aMap1 = &theM1;
const BOPCol_MapOfShape* aMap2 = &theM2;
const TopTools_MapOfShape* aMap1 = &theM1;
const TopTools_MapOfShape* aMap2 = &theM2;
//
if (theM2.Extent() < theM1.Extent()) {
aMap1 = &theM2;
@@ -1382,7 +1305,7 @@ Standard_Integer NbCommonItemsInMap(const BOPCol_MapOfShape& theM1,
}
//
Standard_Integer iCommon = 0;
for (BOPCol_MapIteratorOfMapOfShape aIt(*aMap1); aIt.More(); aIt.Next()) {
for (TopTools_MapIteratorOfMapOfShape aIt(*aMap1); aIt.More(); aIt.Next()) {
if (aMap2->Contains(aIt.Value())) {
++iCommon;
}
@@ -1396,8 +1319,8 @@ Standard_Integer NbCommonItemsInMap(const BOPCol_MapOfShape& theM1,
// <theMFI> - internal faces.
//=======================================================================
void MapFacesToBuildSolids(const TopoDS_Shape& theSol,
BOPCol_IndexedDataMapOfShapeListOfShape& theMFS,
BOPCol_IndexedMapOfShape& theMFI)
TopTools_IndexedDataMapOfShapeListOfShape& theMFS,
TopTools_IndexedMapOfShape& theMFI)
{
TopExp_Explorer aExp(theSol, TopAbs_FACE);
for (; aExp.More(); aExp.Next()) {
@@ -1408,9 +1331,9 @@ void MapFacesToBuildSolids(const TopoDS_Shape& theSol,
continue;
}
//
BOPCol_ListOfShape* pLSol = theMFS.ChangeSeek(aF);
TopTools_ListOfShape* pLSol = theMFS.ChangeSeek(aF);
if (!pLSol) {
pLSol = &theMFS(theMFS.Add(aF, BOPCol_ListOfShape()));
pLSol = &theMFS(theMFS.Add(aF, TopTools_ListOfShape()));
pLSol->Append(theSol);
}
else {

View File

@@ -22,13 +22,11 @@
#include <BOPAlgo_Operation.hxx>
#include <Standard_Integer.hxx>
#include <TopoDS_Shape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <BOPAlgo_ToolsProvider.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <Standard_Boolean.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
class TopoDS_Shape;
class BOPAlgo_PaveFiller;
@@ -66,7 +64,7 @@ class BOPAlgo_PaveFiller;
//! - *BOPAlgo_AlertSolidBuilderFailed* - in case the BuilderSolid algorithm failed to
//! produce the Fused solid.
//!
class BOPAlgo_BOP : public BOPAlgo_Builder
class BOPAlgo_BOP : public BOPAlgo_ToolsProvider
{
public:
@@ -75,18 +73,13 @@ public:
//! Empty constructor
Standard_EXPORT BOPAlgo_BOP();
Standard_EXPORT virtual ~BOPAlgo_BOP();
Standard_EXPORT virtual ~BOPAlgo_BOP();
Standard_EXPORT BOPAlgo_BOP(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT BOPAlgo_BOP(const Handle(NCollection_BaseAllocator)& theAllocator);
//! Clears internal fields and arguments
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
//! Adds Tool argument of the operation
Standard_EXPORT virtual void AddTool (const TopoDS_Shape& theShape);
Standard_EXPORT virtual void SetTools (const BOPCol_ListOfShape& theShapes);
Standard_EXPORT void SetOperation (const BOPAlgo_Operation theOperation);
Standard_EXPORT BOPAlgo_Operation Operation() const;
@@ -109,23 +102,16 @@ protected:
Standard_EXPORT void BuildSolid();
Standard_EXPORT Standard_Boolean IsBoundSplits (const TopoDS_Shape& theS, BOPCol_IndexedDataMapOfShapeListOfShape& theMEF);
//! Treatment of the cases with empty shapes.<br>
//! It returns TRUE if there is nothing to do, i.e.
//! all shapes in one of the groups are empty shapes.
Standard_EXPORT Standard_Boolean TreatEmptyShape();
protected:
BOPAlgo_Operation myOperation;
Standard_Integer myDims[2];
TopoDS_Shape myRC;
BOPCol_ListOfShape myTools;
BOPCol_MapOfShape myMapTools;
private:
Standard_Integer myDims[2];
TopoDS_Shape myRC;
};
#endif // _BOPAlgo_BOP_HeaderFile

View File

@@ -69,4 +69,28 @@ static const char BOPAlgo_BOPAlgo_msg[] =
"Warning: Removal of internal boundaries among Faces has failed\n"
"\n"
".BOPAlgo_AlertRemovalOfIBForEdgesFailed\n"
"Warning: Removal of internal boundaries among Edges has failed\n";
"Warning: Removal of internal boundaries among Edges has failed\n"
"\n"
".BOPAlgo_AlertIntersectionOfPairOfShapesFailed\n"
"Warning: Intersection of pair of shapes has failed\n"
"\n"
".BOPAlgo_AlertBuildingPCurveFailed\n"
"Warning: Building 2D curve of edge on face has failed\n"
"\n"
".BOPAlgo_AlertAcquiredSelfIntersection\n"
"Warning: Some sub-shapes of some of the argument become connected through other shapes and the argument became self-interfered\n"
"\n"
".BOPAlgo_AlertUnsupportedType\n"
"Warning: Unsupported type of input shape\n"
"\n"
".BOPAlgo_AlertUnableToRemoveTheFeature\n"
"Warning: Unable to remove the feature\n"
"\n"
".BOPAlgo_AlertNoFacesToRemove\n"
"Error: No faces have been found for removal\n"
"\n"
".BOPAlgo_AlertRemoveFeaturesFailed\n"
"Error: The Feature Removal algorithm has failed\n"
"\n"
".BOPAlgo_AlertSolidBuilderUnusedFaces\n"
"Warning: Some of the faces passed to the Solid Builder algorithm have not been classified and not used for solids creation\n";

View File

@@ -27,12 +27,11 @@
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPDS_ShapeInfo.hxx>
#include <BOPDS_DS.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
@@ -50,10 +49,10 @@ BOPAlgo_Builder::BOPAlgo_Builder()
myEntryPoint(0),
myImages(100, myAllocator),
myShapesSD(100, myAllocator),
mySplits(100, myAllocator),
myOrigins(100, myAllocator),
myNonDestructive(Standard_False),
myGlue(BOPAlgo_GlueOff)
myGlue(BOPAlgo_GlueOff),
myCheckInverted(Standard_True)
{
}
//=======================================================================
@@ -71,10 +70,10 @@ BOPAlgo_Builder::BOPAlgo_Builder
myEntryPoint(0),
myImages(100, myAllocator),
myShapesSD(100, myAllocator),
mySplits(100, myAllocator),
myOrigins(100, myAllocator),
myNonDestructive(Standard_False),
myGlue(BOPAlgo_GlueOff)
myGlue(BOPAlgo_GlueOff),
myCheckInverted(Standard_True)
{
}
//=======================================================================
@@ -101,7 +100,6 @@ void BOPAlgo_Builder::Clear()
myMapFence.Clear();
myImages.Clear();
myShapesSD.Clear();
mySplits.Clear();
myOrigins.Clear();
}
//=======================================================================
@@ -118,9 +116,9 @@ void BOPAlgo_Builder::AddArgument(const TopoDS_Shape& theShape)
//function : SetArguments
//purpose :
//=======================================================================
void BOPAlgo_Builder::SetArguments(const BOPCol_ListOfShape& theShapes)
void BOPAlgo_Builder::SetArguments(const TopTools_ListOfShape& theShapes)
{
BOPCol_ListIteratorOfListOfShape aIt;
TopTools_ListIteratorOfListOfShape aIt;
//
myArguments.Clear();
//
@@ -131,95 +129,6 @@ void BOPAlgo_Builder::SetArguments(const BOPCol_ListOfShape& theShapes)
}
}
//=======================================================================
//function : Arguments
//purpose :
//=======================================================================
const BOPCol_ListOfShape& BOPAlgo_Builder::Arguments()const
{
return myArguments;
}
//=======================================================================
//function : Images
//purpose :
//=======================================================================
const BOPCol_DataMapOfShapeListOfShape& BOPAlgo_Builder::Images()const
{
return myImages;
}
//=======================================================================
//function : Origins
//purpose :
//=======================================================================
const BOPCol_DataMapOfShapeListOfShape& BOPAlgo_Builder::Origins()const
{
return myOrigins;
}
//=======================================================================
//function : ShapesSd
//purpose :
//=======================================================================
const BOPCol_DataMapOfShapeShape& BOPAlgo_Builder::ShapesSD()const
{
return myShapesSD;
}
//=======================================================================
//function : Splits
//purpose :
//=======================================================================
const BOPCol_DataMapOfShapeListOfShape& BOPAlgo_Builder::Splits()const
{
return mySplits;
}
//=======================================================================
//function : PPaveFiller
//purpose :
//=======================================================================
BOPAlgo_PPaveFiller BOPAlgo_Builder::PPaveFiller()
{
return myPaveFiller;
}
//=======================================================================
//function : PDS
//purpose :
//=======================================================================
BOPDS_PDS BOPAlgo_Builder::PDS()
{
return myDS;
}
//=======================================================================
//function : SetNonDestructive
//purpose :
//=======================================================================
void BOPAlgo_Builder::SetNonDestructive(const Standard_Boolean theFlag)
{
myNonDestructive = theFlag;
}
//=======================================================================
//function : NonDestructive
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_Builder::NonDestructive() const
{
return myNonDestructive;
}
//=======================================================================
//function : SetGlue
//purpose :
//=======================================================================
void BOPAlgo_Builder::SetGlue(const BOPAlgo_GlueEnum theGlue)
{
myGlue=theGlue;
}
//=======================================================================
//function : Glue
//purpose :
//=======================================================================
BOPAlgo_GlueEnum BOPAlgo_Builder::Glue() const
{
return myGlue;
}
//=======================================================================
// function: CheckData
// purpose:
//=======================================================================
@@ -447,7 +356,7 @@ void BOPAlgo_Builder::PostTreat()
{
Standard_Integer i, aNbS;
TopAbs_ShapeEnum aType;
BOPCol_IndexedMapOfShape aMA;
TopTools_IndexedMapOfShape aMA;
if (myPaveFiller->NonDestructive()) {
// MapToAvoid
aNbS=myDS->NbSourceShapes();

View File

@@ -22,18 +22,17 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPAlgo_PPaveFiller.hxx>
#include <BOPAlgo_BuilderShape.hxx>
#include <BOPAlgo_GlueEnum.hxx>
#include <BOPDS_PDS.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <Standard_Integer.hxx>
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <Standard_Real.hxx>
#include <BOPAlgo_BuilderShape.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <Standard_Boolean.hxx>
#include <TopAbs_ShapeEnum.hxx>
class IntTools_Context;
@@ -54,6 +53,10 @@ class BOPAlgo_PaveFiller;
//! shapes during the operation (by default it is off);<br>
//! - *Gluing options* - allows to speed up the calculation of the intersections
//! on the special cases, in which some sub-shapes are coinciding.<br>
//! - *Disabling the check for inverted solids* - Disables/Enables the check of the input solids
//! for inverted status (holes in the space). The default value is TRUE,
//! i.e. the check is performed. Setting this flag to FALSE for inverted solids,
//! most likely will lead to incorrect results.
//!
//! The algorithm returns the following Error statuses:
//! - *BOPAlgo_AlertTooFewArguments* - in case there are no enough arguments to perform the operation;
@@ -67,139 +70,301 @@ public:
DEFINE_STANDARD_ALLOC
//! Empty constructor.
Standard_EXPORT BOPAlgo_Builder();
Standard_EXPORT virtual ~BOPAlgo_Builder();
Standard_EXPORT BOPAlgo_Builder(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
Standard_EXPORT BOPAlgo_PPaveFiller PPaveFiller();
Standard_EXPORT BOPDS_PDS PDS();
Standard_EXPORT virtual void AddArgument (const TopoDS_Shape& theShape);
Standard_EXPORT virtual void SetArguments (const BOPCol_ListOfShape& theLS);
Standard_EXPORT const BOPCol_ListOfShape& Arguments() const;
Standard_EXPORT virtual ~BOPAlgo_Builder();
Standard_EXPORT BOPAlgo_Builder(const Handle(NCollection_BaseAllocator)& theAllocator);
//! Clears the content of the algorithm.
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
//! Returns the PaveFiller, algorithm for sub-shapes intersection.
BOPAlgo_PPaveFiller PPaveFiller()
{
return myPaveFiller;
}
//! Returns the Data Structure, holder of intersection information.
BOPDS_PDS PDS()
{
return myDS;
}
//! Returns the Context, tool for cashing heavy algorithms.
Handle(IntTools_Context) Context() const
{
return myContext;
}
public: //! @name Arguments
//! Adds the argument to the operation.
Standard_EXPORT virtual void AddArgument (const TopoDS_Shape& theShape);
//! Sets the list of arguments for the operation.
Standard_EXPORT virtual void SetArguments (const TopTools_ListOfShape& theLS);
//! Returns the list of arguments.
const TopTools_ListOfShape& Arguments() const
{
return myArguments;
}
public: //! @name Options
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
Standard_EXPORT virtual void PerformWithFiller (const BOPAlgo_PaveFiller& theFiller);
//! Returns the list of shapes generated from the
//! shape theS.
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& theS) Standard_OVERRIDE;
//! Returns the list of shapes modified from the shape
//! theS.
Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& theS) Standard_OVERRIDE;
//! Returns true if the shape theS has been deleted.
Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& theS) Standard_OVERRIDE;
Standard_EXPORT const BOPCol_DataMapOfShapeListOfShape& Images() const;
Standard_EXPORT Standard_Boolean IsInterferred (const TopoDS_Shape& theS) const;
//! Returns myOrigins.
Standard_EXPORT const BOPCol_DataMapOfShapeListOfShape& Origins() const;
//! Returns myShapesSD.
Standard_EXPORT const BOPCol_DataMapOfShapeShape& ShapesSD() const;
//! Returns mySplits.
Standard_EXPORT const BOPCol_DataMapOfShapeListOfShape& Splits() const;
//! Sets the flag that defines the mode of treatment.
//! In non-destructive mode the argument shapes are not modified. Instead
//! a copy of a sub-shape is created in the result if it is needed to be updated.
//! This flag is taken into account if internal PaveFiller is used only.
//! In the case of calling PerformWithFiller the corresponding flag of that PaveFiller
//! is in force.
Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag);
void SetNonDestructive(const Standard_Boolean theFlag)
{
myNonDestructive = theFlag;
}
//! Returns the flag that defines the mode of treatment.
//! In non-destructive mode the argument shapes are not modified. Instead
//! a copy of a sub-shape is created in the result if it is needed to be updated.
Standard_EXPORT Standard_Boolean NonDestructive() const;
Standard_Boolean NonDestructive() const
{
return myNonDestructive;
}
//! Sets the glue option for the algorithm
Standard_EXPORT void SetGlue(const BOPAlgo_GlueEnum theGlue);
void SetGlue(const BOPAlgo_GlueEnum theGlue)
{
myGlue = theGlue;
}
//! Returns the glue option of the algorithm
Standard_EXPORT BOPAlgo_GlueEnum Glue() const;
BOPAlgo_GlueEnum Glue() const
{
return myGlue;
}
protected:
//! Enables/Disables the check of the input solids for inverted status
void SetCheckInverted(const Standard_Boolean theCheck)
{
myCheckInverted = theCheck;
}
//! Prepare information for history support
//! Returns the flag defining whether the check for input solids on inverted status
//! should be performed or not.
Standard_Boolean CheckInverted() const
{
return myCheckInverted;
}
public: //! @name Performing the operation
//! Performs the operation.
//! The intersection will be performed also.
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
//! Performs the operation with the prepared filler.
//! The intersection will not be performed in this case.
Standard_EXPORT virtual void PerformWithFiller (const BOPAlgo_PaveFiller& theFiller);
public: //! @name History methods
//! Returns the list of shapes generated from the shape theS.
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& theS) Standard_OVERRIDE;
//! Returns the list of shapes modified from the shape theS.
Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& theS) Standard_OVERRIDE;
//! Returns true if the shape theS has been deleted.
Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& theS) Standard_OVERRIDE;
protected: //! @name History methods
//! Prepare information for history support.
Standard_EXPORT virtual void PrepareHistory() Standard_OVERRIDE;
//! Prepare history information for the input shapes taking into account possible
//! operation-specific modifications.
//! For instance, in the CellsBuilder operation, additionally to splitting input shapes
//! the splits of the shapes (or the shapes themselves) may be unified during removal of internal
//! boundaries. In this case each split should be linked to the unified shape.
//!
//! To have correct history information, the method should be redefined in each operation
//! where such additional modification is possible. The input shape <theS> should be the one from arguments,
//! and the returning list should contain all final elements to which the input shape has evolved,
//! including those not contained in the result shape.
//!
//! The method returns pointer to the list of modified elements.
//! NULL pointer means that the shape has not been modified at all.
//!
//! The General Fuse operation does not perform any other modification than splitting the input
//! shapes basing on their intersection information. This information is contained in myImages map.
//! Thus, here the method returns only splits (if any) contained in this map.
Standard_EXPORT virtual const TopTools_ListOfShape* LocModified(const TopoDS_Shape& theS);
public: //! @name Images/Origins
//! Returns the map of images.
const TopTools_DataMapOfShapeListOfShape& Images() const
{
return myImages;
}
//! Returns the map of origins.
const TopTools_DataMapOfShapeListOfShape& Origins() const
{
return myOrigins;
}
//! Returns the map of Same Domain (SD) shapes - coinciding shapes
//! from different arguments.
const TopTools_DataMapOfShapeShape& ShapesSD() const
{
return myShapesSD;
}
protected: //! @name Methods for building the result
//! Performs the building of the result.
//! The method calls the PerfromInternal1() method surrounded by a try-catch block.
Standard_EXPORT virtual void PerformInternal (const BOPAlgo_PaveFiller& thePF);
//! Performs the building of the result.
//! To build the result of any other operation
//! it will be necessary to override this method.
Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF);
//! Builds the result of operation.
//! The method is called for each of the arguments type and
//! adds into the result the splits of the arguments of that type.
Standard_EXPORT virtual void BuildResult (const TopAbs_ShapeEnum theType);
protected: //! @name Checking input arguments
//! Checks the input data.
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
//! Checks if the intersection algorithm has Errors/Warnings
//! Checks if the intersection algorithm has Errors/Warnings.
Standard_EXPORT void CheckFiller();
//! Prepares the result shape by making it empty compound.
Standard_EXPORT virtual void Prepare();
protected: //! @name Fill Images of VERTICES
//! Fills the images of vertices.
Standard_EXPORT void FillImagesVertices();
protected: //! @name Fill Images of EDGES
//! Fills the images of edges.
Standard_EXPORT void FillImagesEdges();
Standard_EXPORT virtual void BuildResult (const TopAbs_ShapeEnum theType);
protected: //! @name Fill Images of CONTAINERS
//! Fills the images of containers (WIRES/SHELLS/COMPSOLID).
Standard_EXPORT void FillImagesContainers (const TopAbs_ShapeEnum theType);
Standard_EXPORT void FillImagesCompounds();
//! Builds the image of the given container using the splits
//! of its sub-shapes.
Standard_EXPORT void FillImagesContainer (const TopoDS_Shape& theS, const TopAbs_ShapeEnum theType);
Standard_EXPORT void FillImagesCompound (const TopoDS_Shape& theS, BOPCol_MapOfShape& theMF);
protected: //! @name Fill Images of FACES
//! Fills the images of faces.
//! The method consists of three steps:
//! 1. Build the splits of faces;
//! 2. Find SD faces;
//! 3. Add internal vertices (if any) to faces.
Standard_EXPORT void FillImagesFaces();
//! Builds the splits of faces using the information from the
//! intersection stage stored in Data Structure.
Standard_EXPORT virtual void BuildSplitFaces();
//! Looks for the same domain faces among the splits of the faces.
//! Updates the map of images with SD faces.
Standard_EXPORT void FillSameDomainFaces();
Standard_EXPORT void FillImagesFaces1();
//! Classifies the alone vertices on faces relatively its splits
//! and adds them as INTERNAL into the splits.
Standard_EXPORT void FillInternalVertices();
protected: //! @name Fill Images of SOLIDS
//! Fills the images of solids.
//! The method consists of four steps:
//! 1. Build the draft solid - just rebuild the solid using the splits of faces;
//! 2. Find faces from other arguments located inside the solids;
//! 3. Build splits of solid using the inside faces;
//! 4. Fill internal shapes for the splits (Wires and vertices).
Standard_EXPORT void FillImagesSolids();
Standard_EXPORT void BuildDraftSolid (const TopoDS_Shape& theSolid, TopoDS_Shape& theDraftSolid, BOPCol_ListOfShape& theLIF);
Standard_EXPORT virtual void FillIn3DParts (BOPCol_DataMapOfShapeListOfShape& theInParts, BOPCol_DataMapOfShapeShape& theDraftSolids, const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT void BuildSplitSolids (BOPCol_DataMapOfShapeListOfShape& theInParts, BOPCol_DataMapOfShapeShape& theDraftSolids, const BOPCol_BaseAllocator& theAllocator);
//! Builds the draft solid by rebuilding the shells of the solid
//! with the splits of faces.
Standard_EXPORT void BuildDraftSolid (const TopoDS_Shape& theSolid,
TopoDS_Shape& theDraftSolid,
TopTools_ListOfShape& theLIF);
//! Finds faces located inside each solid.
Standard_EXPORT virtual void FillIn3DParts (TopTools_DataMapOfShapeListOfShape& theInParts,
TopTools_DataMapOfShapeShape& theDraftSolids,
const Handle(NCollection_BaseAllocator)& theAllocator);
//! Builds the splits of the solids using their draft versions
//! and faces located inside.
Standard_EXPORT void BuildSplitSolids (TopTools_DataMapOfShapeListOfShape& theInParts,
TopTools_DataMapOfShapeShape& theDraftSolids,
const Handle(NCollection_BaseAllocator)& theAllocator);
//! Classifies the vertices and edges from the arguments relatively
//! splits of solids and makes them INTERNAL for solids.
Standard_EXPORT void FillInternalShapes();
protected: //! @name Fill Images of COMPOUNDS
//! Fills the images of compounds.
Standard_EXPORT void FillImagesCompounds();
//! Builds the image of the given compound.
Standard_EXPORT void FillImagesCompound (const TopoDS_Shape& theS,
TopTools_MapOfShape& theMF);
protected: //! @name Post treatment
//! Post treatment of the result of the operation.
//! The method checks validity of the sub-shapes of the result
//! and updates the tolerances to make them valid.
Standard_EXPORT virtual void PostTreat();
BOPCol_ListOfShape myArguments;
BOPCol_MapOfShape myMapFence;
BOPAlgo_PPaveFiller myPaveFiller;
BOPDS_PDS myDS;
Handle(IntTools_Context) myContext;
Standard_Integer myEntryPoint;
BOPCol_DataMapOfShapeListOfShape myImages;
BOPCol_DataMapOfShapeShape myShapesSD;
BOPCol_DataMapOfShapeListOfShape mySplits;
BOPCol_DataMapOfShapeListOfShape myOrigins;
Standard_Boolean myNonDestructive;
BOPAlgo_GlueEnum myGlue;
protected: //! @name Fields
private:
TopTools_ListOfShape myArguments; //!< Arguments of the operation
TopTools_MapOfShape myMapFence; //!< Fence map providing the uniqueness of the shapes in the list of arguments
BOPAlgo_PPaveFiller myPaveFiller; //!< Pave Filler - algorithm for sub-shapes intersection
BOPDS_PDS myDS; //!< Data Structure - holder of intersection information
Handle(IntTools_Context) myContext; //!< Context - tool for cashing heavy algorithms such as Projectors and Classifiers
Standard_Integer myEntryPoint; //!< EntryPoint - controls the deletion of the PaveFiller, which could live longer than the Builder
TopTools_DataMapOfShapeListOfShape myImages; //!< Images - map of Images of the sub-shapes of arguments
TopTools_DataMapOfShapeShape myShapesSD; //!< ShapesSD - map of SD Shapes
TopTools_DataMapOfShapeListOfShape myOrigins; //!< Origins - map of Origins, back map of Images
Standard_Boolean myNonDestructive; //!< Safe processing option allows avoiding modification of the input shapes
BOPAlgo_GlueEnum myGlue; //!< Gluing option allows speeding up the intersection of the input shapes
Standard_Boolean myCheckInverted; //!< Check inverted option allows disabling the check of input solids on inverted status
};
#endif // _BOPAlgo_Builder_HeaderFile

View File

@@ -22,10 +22,10 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_IndexedMapOfOrientedShape.hxx>
#include <BOPAlgo_Algo.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_IndexedMapOfOrientedShape.hxx>
class IntTools_Context;
@@ -43,22 +43,22 @@ public:
}
//! Returns the input shapes
Standard_EXPORT const BOPCol_ListOfShape& Shapes() const {
Standard_EXPORT const TopTools_ListOfShape& Shapes() const {
return myShapes;
}
//! Sets the shapes for building areas
Standard_EXPORT void SetShapes(const BOPCol_ListOfShape& theLS) {
Standard_EXPORT void SetShapes(const TopTools_ListOfShape& theLS) {
myShapes = theLS;
}
//! Returns the found loops
Standard_EXPORT const BOPCol_ListOfShape& Loops() const {
Standard_EXPORT const TopTools_ListOfShape& Loops() const {
return myLoops;
}
//! Returns the found areas
Standard_EXPORT const BOPCol_ListOfShape& Areas() const {
Standard_EXPORT const TopTools_ListOfShape& Areas() const {
return myAreas;
}
@@ -78,7 +78,7 @@ protected:
Standard_EXPORT BOPAlgo_BuilderArea();
Standard_EXPORT virtual ~BOPAlgo_BuilderArea();
Standard_EXPORT BOPAlgo_BuilderArea(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT BOPAlgo_BuilderArea(const Handle(NCollection_BaseAllocator)& theAllocator);
Standard_EXPORT virtual void PerformShapesToAvoid() = 0;
@@ -90,11 +90,11 @@ protected:
Handle(IntTools_Context) myContext;
BOPCol_ListOfShape myShapes;
BOPCol_ListOfShape myLoops;
BOPCol_ListOfShape myLoopsInternal;
BOPCol_ListOfShape myAreas;
BOPCol_IndexedMapOfOrientedShape myShapesToAvoid;
TopTools_ListOfShape myShapes;
TopTools_ListOfShape myLoops;
TopTools_ListOfShape myLoopsInternal;
TopTools_ListOfShape myAreas;
TopTools_IndexedMapOfOrientedShape myShapesToAvoid;
Standard_Boolean myAvoidInternalShapes;
private:

View File

@@ -17,20 +17,14 @@
// commercial license or contractual agreement.
#include <Bnd_Box.hxx>
#include <Bnd_Box2d.hxx>
#include <BOPAlgo_BuilderFace.hxx>
#include <BOPAlgo_WireEdgeSet.hxx>
#include <BOPAlgo_WireSplitter.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_Box2DBndTree.hxx>
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_MapOfOrientedShape.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
#include <BOPTools_BoxSelector.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepBndLib.hxx>
@@ -50,84 +44,31 @@
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_MapOfOrientedShape.hxx>
//
static
Standard_Boolean IsGrowthWire(const TopoDS_Shape& ,
const BOPCol_IndexedMapOfShape& );
const TopTools_IndexedMapOfShape& );
static
Standard_Boolean IsInside(const TopoDS_Shape& ,
const TopoDS_Shape& ,
Handle(IntTools_Context)& );
static
void MakeInternalWires(const BOPCol_IndexedMapOfShape& ,
BOPCol_ListOfShape& );
static
void GetWire(const TopoDS_Shape& ,
TopoDS_Shape& );
//
void MakeInternalWires(const TopTools_IndexedMapOfShape& ,
TopTools_ListOfShape& );
//
//=======================================================================
//class : BOPAlgo_ShapeBox2D
//purpose : Auxiliary class
//=======================================================================
class BOPAlgo_ShapeBox2D {
public:
BOPAlgo_ShapeBox2D() {
myIsHole=Standard_False;
};
//
~BOPAlgo_ShapeBox2D() {
};
//
void SetShape(const TopoDS_Shape& aS) {
myShape=aS;
};
//
const TopoDS_Shape& Shape()const {
return myShape;
};
//
void SetBox2D(const Bnd_Box2d& aBox2D) {
myBox2D=aBox2D;
};
//
const Bnd_Box2d& Box2D()const {
return myBox2D;
};
//
void SetIsHole(const Standard_Boolean bFlag) {
myIsHole=bFlag;
};
//
Standard_Boolean IsHole()const {
return myIsHole;
};
//
protected:
Standard_Boolean myIsHole;
TopoDS_Shape myShape;
Bnd_Box2d myBox2D;
};
//
typedef NCollection_IndexedDataMap
<Standard_Integer,
BOPAlgo_ShapeBox2D,
TColStd_MapIntegerHasher> BOPAlgo_IndexedDataMapOfIntegerShapeBox2D;
typedef NCollection_IndexedDataMap
<TopoDS_Shape,
TopoDS_Shape,
TopTools_ShapeMapHasher> BOPCol_IndexedDataMapOfShapeShape;
//
//=======================================================================
//function :
//purpose :
@@ -245,8 +186,8 @@ void BOPAlgo_BuilderFace::PerformShapesToAvoid()
{
Standard_Boolean bFound;
Standard_Integer i, iCnt, aNbV, aNbE;
BOPCol_IndexedDataMapOfShapeListOfShape aMVE;
BOPCol_ListIteratorOfListOfShape aIt;
TopTools_IndexedDataMapOfShapeListOfShape aMVE;
TopTools_ListIteratorOfListOfShape aIt;
//
myShapesToAvoid.Clear();
//
@@ -261,7 +202,7 @@ void BOPAlgo_BuilderFace::PerformShapesToAvoid()
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aE=aIt.Value();
if (!myShapesToAvoid.Contains(aE)) {
BOPTools::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
TopExp::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
}
}
aNbV=aMVE.Extent();
@@ -270,7 +211,7 @@ void BOPAlgo_BuilderFace::PerformShapesToAvoid()
for (i=1; i<=aNbV; ++i) {
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&aMVE.FindKey(i)));
//
BOPCol_ListOfShape& aLE=aMVE.ChangeFromKey(aV);
TopTools_ListOfShape& aLE=aMVE.ChangeFromKey(aV);
aNbE=aLE.Extent();
if (!aNbE) {
continue;
@@ -318,9 +259,9 @@ void BOPAlgo_BuilderFace::PerformLoops()
{
Standard_Boolean bFlag;
Standard_Integer i, aNbEA;
BOPCol_ListIteratorOfListOfShape aIt;
BOPCol_IndexedDataMapOfShapeListOfShape aVEMap;
BOPCol_MapOfOrientedShape aMAdded;
TopTools_ListIteratorOfListOfShape aIt;
TopTools_IndexedDataMapOfShapeListOfShape aVEMap;
TopTools_MapOfOrientedShape aMAdded;
TopoDS_Iterator aItW;
BRep_Builder aBB;
BOPAlgo_WireEdgeSet aWES(myAllocator);
@@ -346,14 +287,14 @@ void BOPAlgo_BuilderFace::PerformLoops()
return;
}
//
const BOPCol_ListOfShape& aLW=aWES.Shapes();
const TopTools_ListOfShape& aLW=aWES.Shapes();
aIt.Initialize (aLW);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aW=aIt.Value();
myLoops.Append(aW);
}
// Post Treatment
BOPCol_MapOfOrientedShape aMEP;
TopTools_MapOfOrientedShape aMEP;
//
// a. collect all edges that are in loops
aIt.Initialize (myLoops);
@@ -388,7 +329,7 @@ void BOPAlgo_BuilderFace::PerformLoops()
aNbEA = myShapesToAvoid.Extent();
for (i = 1; i <= aNbEA; ++i) {
const TopoDS_Shape& aEE = myShapesToAvoid(i);
BOPTools::MapShapesAndAncestors(aEE,
TopExp::MapShapesAndAncestors(aEE,
TopAbs_VERTEX,
TopAbs_EDGE,
aVEMap);
@@ -413,7 +354,7 @@ void BOPAlgo_BuilderFace::PerformLoops()
TopoDS_Iterator aItE(aE);
for (; aItE.More()&&bFlag; aItE.Next()) {
const TopoDS_Vertex& aV = (*(TopoDS_Vertex *)(&aItE.Value()));
const BOPCol_ListOfShape& aLE=aVEMap.FindFromKey(aV);
const TopTools_ListOfShape& aLE=aVEMap.FindFromKey(aV);
aIt.Initialize(aLE);
for (; aIt.More()&&bFlag; aIt.Next()) {
const TopoDS_Shape& aEx=aIt.Value();
@@ -436,239 +377,201 @@ void BOPAlgo_BuilderFace::PerformLoops()
//=======================================================================
void BOPAlgo_BuilderFace::PerformAreas()
{
Standard_Boolean bIsGrowth, bIsHole;
Standard_Integer k, aNbS, aNbHoles, aNbDMISB, m, aNbMSH, aNbInOutMap;
Standard_Real aTol;
TopLoc_Location aLoc;
Handle(Geom_Surface) aS;
BRep_Builder aBB;
TopoDS_Face aFace;
BOPCol_ListIteratorOfListOfInteger aItLI;
BOPCol_IndexedMapOfShape aMHE;
BOPCol_ListIteratorOfListOfShape aIt1;
BOPCol_IndexedDataMapOfShapeListOfShape aMSH;
BOPCol_IndexedDataMapOfShapeShape aInOutMap;
BOPAlgo_IndexedDataMapOfIntegerShapeBox2D aDMISB(100);
//
BOPCol_Box2DBndTreeSelector aSelector;
BOPCol_Box2DBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFiller(aBBTree);
//
aNbHoles=0;
//
aTol=BRep_Tool::Tolerance(myFace);
aS=BRep_Tool::Surface(myFace, aLoc);
//
myAreas.Clear();
//
if (myLoops.IsEmpty()) {
if (myContext->IsInfiniteFace(myFace)) {
BRep_Builder aBB;
// Location of the myFace
TopLoc_Location aLoc;
// Get surface from myFace
const Handle(Geom_Surface)& aS = BRep_Tool::Surface(myFace, aLoc);
// Get tolerance of myFace
Standard_Real aTol = BRep_Tool::Tolerance(myFace);
// Check if there are no loops at all
if (myLoops.IsEmpty())
{
if (myContext->IsInfiniteFace(myFace))
{
TopoDS_Face aFace;
aBB.MakeFace(aFace, aS, aLoc, aTol);
if (BRep_Tool::NaturalRestriction(myFace)) {
if (BRep_Tool::NaturalRestriction(myFace))
aBB.NaturalRestriction(aFace, Standard_True);
}
myAreas.Append(aFace);
myAreas.Append(aFace);
}
return;
}
//
// 1. Growthes and Holes -> aDMISB: [Index/ShapeBox2D]
aIt1.Initialize(myLoops);
for (k=0 ; aIt1.More(); aIt1.Next(), ++k) {
Bnd_Box2d aBox2D;
//
const TopoDS_Shape& aWire=aIt1.Value();
//
// The new faces
TopTools_ListOfShape aNewFaces;
// The hole faces which has to be classified relatively new faces
TopTools_IndexedMapOfShape aHoleFaces;
// Map of the edges of the hole faces for quick check of the growths.
// If the analyzed wire contains any of the edges from the hole faces
// it is considered as growth.
TopTools_IndexedMapOfShape aMHE;
// Analyze the new wires - classify them to be the holes and growths
TopTools_ListIteratorOfListOfShape aItLL(myLoops);
for (; aItLL.More(); aItLL.Next())
{
const TopoDS_Shape& aWire = aItLL.Value();
TopoDS_Face aFace;
aBB.MakeFace(aFace, aS, aLoc, aTol);
aBB.Add (aFace, aWire);
BRepTools::AddUVBounds(aFace, aBox2D);
//
bIsGrowth=IsGrowthWire(aWire, aMHE);
if (bIsGrowth) {
bIsHole=Standard_False;
aBB.Add(aFace, aWire);
Standard_Boolean bIsGrowth = IsGrowthWire(aWire, aMHE);
if (!bIsGrowth)
{
// Fast check did not give the result, run classification
IntTools_FClass2d& aClsf = myContext->FClass2d(aFace);
bIsGrowth = !aClsf.IsHole();
}
else{
// check if a wire is a hole
IntTools_FClass2d& aClsf=myContext->FClass2d(aFace);
aClsf.Init(aFace, aTol);
//
bIsHole=aClsf.IsHole();
if (bIsHole) {
BOPTools::MapShapes(aWire, TopAbs_EDGE, aMHE);
//
bIsHole=Standard_True;
}
else {
bIsHole=Standard_False;
}
// Save the face
if (bIsGrowth)
{
aNewFaces.Append(aFace);
}
//
BOPAlgo_ShapeBox2D aSB2D;
//
aSB2D.SetShape(aFace);
aSB2D.SetBox2D(aBox2D);
aSB2D.SetIsHole(bIsHole);
//
aDMISB.Add(k, aSB2D);
}// for (k=0 ; aIt1.More(); aIt1.Next(), ++k) {
//
// 2. Prepare TreeFiller
aNbDMISB=aDMISB.Extent();
for (m=1; m<=aNbDMISB; ++m) {
k=aDMISB.FindKey(m);
const BOPAlgo_ShapeBox2D& aSB2D=aDMISB.FindFromIndex(m);
//
bIsHole=aSB2D.IsHole();
if (bIsHole) {
const Bnd_Box2d& aBox2D=aSB2D.Box2D();
aTreeFiller.Add(k, aBox2D);
++aNbHoles;
else
{
aHoleFaces.Add(aFace);
TopExp::MapShapes(aWire, TopAbs_EDGE, aMHE);
}
}
//
// 3. Shake TreeFiller
if (aHoleFaces.IsEmpty())
{
// No holes, stop the analysis
myAreas.Append(aNewFaces);
}
// Classify holes relatively faces
// Prepare tree filler with the boxes of the hole faces
NCollection_UBTree<Standard_Integer, Bnd_Box2d> aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFiller(aBBTree);
Standard_Integer i, aNbH = aHoleFaces.Extent();
for (i = 1; i <= aNbH; ++i)
{
const TopoDS_Face& aHFace = TopoDS::Face(aHoleFaces(i));
//
Bnd_Box2d aBox;
BRepTools::AddUVBounds(aHFace, aBox);
aTreeFiller.Add(i, aBox);
}
// Shake TreeFiller
aTreeFiller.Fill();
//
// 4. Find outer growth shell that is most close
// to each hole shell
for (m=1; m<=aNbDMISB; ++m) {
const BOPAlgo_ShapeBox2D& aSB2D=aDMISB.FindFromIndex(m);
bIsHole=aSB2D.IsHole();
if (bIsHole) {
continue;
}
//
const Bnd_Box2d& aBox2DF=aSB2D.Box2D();
const TopoDS_Shape aF=aSB2D.Shape();
//
// Find outer growth face that is most close to each hole face
TopTools_IndexedDataMapOfShapeShape aHoleFaceMap;
// Selector
BOPTools_BoxSelector<Bnd_Box2d> aSelector;
TopTools_ListIteratorOfListOfShape aItLS(aNewFaces);
for (; aItLS.More(); aItLS.Next())
{
const TopoDS_Face& aFace = TopoDS::Face(aItLS.Value());
// Build box
Bnd_Box2d aBox;
BRepTools::AddUVBounds(aFace, aBox);
aSelector.Clear();
aSelector.SetBox(aBox2DF);
//
aNbS = aBBTree.Select(aSelector);
if (!aNbS) {
continue;
}
//
const BOPCol_ListOfInteger& aLI=aSelector.Indices();
//
aItLI.Initialize(aLI);
for (; aItLI.More(); aItLI.Next()) {
k=aItLI.Value();
const BOPAlgo_ShapeBox2D& aSB2Dk=aDMISB.FindFromKey(k);
const TopoDS_Shape& aHole=aSB2Dk.Shape();
//
if (!IsInside(aHole, aF, myContext)){
aSelector.SetBox(aBox);
aBBTree.Select(aSelector);
const TColStd_ListOfInteger& aLI = aSelector.Indices();
TColStd_ListIteratorOfListOfInteger aItLI(aLI);
for (; aItLI.More(); aItLI.Next())
{
Standard_Integer k = aItLI.Value();
const TopoDS_Shape& aHole = aHoleFaces(k);
// Check if it is inside
if (!IsInside(aHole, aFace, myContext))
continue;
}
//
if (aInOutMap.Contains(aHole)){
TopoDS_Shape& aF2=aInOutMap.ChangeFromKey(aHole);
if (IsInside(aF, aF2, myContext)) {
aF2=aF;
// Save the relation
TopoDS_Shape* pFaceWas = aHoleFaceMap.ChangeSeek(aHole);
if (pFaceWas)
{
if (IsInside(aFace, *pFaceWas, myContext))
{
*pFaceWas = aFace;
}
}
else{
aInOutMap.Add(aHole, aF);
else
{
aHoleFaceMap.Add(aHole, aFace);
}
}
}// for (m=1; m<=aNbDMISB; ++m)
//
// 5.1 Map [Face/Holes] -> aMSH
aNbInOutMap=aInOutMap.Extent();
for (m=1; m<=aNbInOutMap; ++m) {
const TopoDS_Shape& aHole=aInOutMap.FindKey(m);
const TopoDS_Shape& aF=aInOutMap.FindFromIndex(m);
//
if (aMSH.Contains(aF)) {
BOPCol_ListOfShape& aLH=aMSH.ChangeFromKey(aF);
aLH.Append(aHole);
}
else {
BOPCol_ListOfShape aLH;
aLH.Append(aHole);
aMSH.Add(aF, aLH);
}
}
//
// 5.2. Add unused holes to the original face
if (aNbHoles != aNbInOutMap) {
// Make the back map from faces to holes
TopTools_IndexedDataMapOfShapeListOfShape aFaceHolesMap;
aNbH = aHoleFaceMap.Extent();
for (i = 1; i <= aNbH; ++i)
{
const TopoDS_Shape& aHole = aHoleFaceMap.FindKey(i);
const TopoDS_Shape& aFace = aHoleFaceMap(i);
//
TopTools_ListOfShape* pLHoles = aFaceHolesMap.ChangeSeek(aFace);
if (!pLHoles)
pLHoles = &aFaceHolesMap(aFaceHolesMap.Add(aFace, TopTools_ListOfShape()));
pLHoles->Append(aHole);
}
// Add unused holes to the original face
if (aHoleFaces.Extent() != aHoleFaceMap.Extent())
{
Bnd_Box aBoxF;
BRepBndLib::Add(myFace, aBoxF);
if (aBoxF.IsOpenXmin() || aBoxF.IsOpenXmax() ||
aBoxF.IsOpenYmin() || aBoxF.IsOpenYmax() ||
aBoxF.IsOpenZmin() || aBoxF.IsOpenZmax()) {
//
BOPCol_ListOfShape anUnUsedHoles;
for (m = 1; m <= aNbDMISB; ++m) {
const BOPAlgo_ShapeBox2D& aSB2D=aDMISB.FindFromIndex(m);
if (aSB2D.IsHole()) {
const TopoDS_Shape& aHole = aSB2D.Shape();
if (!aInOutMap.Contains(aHole)) {
anUnUsedHoles.Append(aHole);
}
}
aBoxF.IsOpenZmin() || aBoxF.IsOpenZmax())
{
TopoDS_Face aFace;
aBB.MakeFace(aFace, aS, aLoc, aTol);
TopTools_ListOfShape& anUnUsedHoles = aFaceHolesMap(aFaceHolesMap.Add(aFace, TopTools_ListOfShape()));
aNbH = aHoleFaces.Extent();
for (i = 1; i <= aNbH; ++i)
{
const TopoDS_Shape& aHole = aHoleFaces(i);
if (!aHoleFaceMap.Contains(aHole))
anUnUsedHoles.Append(aHole);
}
//
if (anUnUsedHoles.Extent()) {
aBB.MakeFace(aFace, aS, aLoc, aTol);
aMSH.Add(aFace, anUnUsedHoles);
//
BOPAlgo_ShapeBox2D aSB2D;
//
aSB2D.SetShape(aFace);
aSB2D.SetIsHole(Standard_False);
//
aDMISB.Add(aNbDMISB, aSB2D);
++aNbDMISB;
// Save it
aNewFaces.Append(aFace);
}
}
// Add Holes to Faces and add them to myAreas
aItLS.Initialize(aNewFaces);
for ( ; aItLS.More(); aItLS.Next())
{
TopoDS_Face& aFace = *(TopoDS_Face*)&aItLS.Value();
const TopTools_ListOfShape* pLHoles = aFaceHolesMap.Seek(aFace);
if (pLHoles)
{
// update faces with the holes
TopTools_ListIteratorOfListOfShape aItLH(*pLHoles);
for (; aItLH.More(); aItLH.Next())
{
const TopoDS_Shape& aFHole = aItLH.Value();
// The hole face contains only one wire
TopoDS_Iterator aItW(aFHole);
aBB.Add(aFace, aItW.Value());
}
// update classifier
myContext->FClass2d(aFace).Init(aFace, aTol);
}
}
//
// 6. Add aHoles to Faces
aNbMSH=aMSH.Extent();
for (m=1; m<=aNbMSH; ++m) {
TopoDS_Face aF=(*(TopoDS_Face *)(&aMSH.FindKey(m)));
const BOPCol_ListOfShape& aLH=aMSH.FindFromIndex(m);
//
aIt1.Initialize(aLH);
for (; aIt1.More(); aIt1.Next()) {
TopoDS_Shape aWHole;
//
const TopoDS_Shape& aFHole=aIt1.Value();
GetWire(aFHole, aWHole);
aBB.Add (aF, aWHole);
}
//
// update classifier
aTol=BRep_Tool::Tolerance(aF);
IntTools_FClass2d& aClsf=myContext->FClass2d(aF);
aClsf.Init(aF, aTol);
}
//
// 7. Fill myAreas
// NB:These aNewFaces are draft faces that
// do not contain any internal shapes
for (m=1; m<=aNbDMISB; ++m) {
const BOPAlgo_ShapeBox2D& aSB2D=aDMISB.FindFromIndex(m);
bIsHole=aSB2D.IsHole();
if (!bIsHole) {
const TopoDS_Shape aF=aSB2D.Shape();
myAreas.Append(aF);
}
}
}
//=======================================================================
//function : GetWire
//purpose :
//=======================================================================
void GetWire(const TopoDS_Shape& aF, TopoDS_Shape& aW)
{
TopoDS_Shape aWx;
TopoDS_Iterator aIt;
//
aIt.Initialize(aF);
for (; aIt.More(); aIt.Next()) {
aW=aIt.Value();
// The face is just a draft that does not contain any internal shapes
myAreas.Append(aFace);
}
}
//=======================================================================
@@ -689,11 +592,11 @@ void BOPAlgo_BuilderFace::PerformInternalShapes()
//Standard_Real aTol;
Standard_Integer i;
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfShape aIt1, aIt2;
TopTools_ListIteratorOfListOfShape aIt1, aIt2;
TopoDS_Iterator aIt;
BOPCol_IndexedMapOfShape aME1, aME2, aMEP;
BOPCol_IndexedDataMapOfShapeListOfShape aMVE;
BOPCol_ListOfShape aLSI;
TopTools_IndexedMapOfShape aME1, aME2, aMEP;
TopTools_IndexedDataMapOfShapeListOfShape aMVE;
TopTools_ListOfShape aLSI;
//
// 1. All internal edges
aIt1.Initialize(myLoopsInternal);
@@ -712,7 +615,7 @@ void BOPAlgo_BuilderFace::PerformInternalShapes()
TopoDS_Face& aF=(*(TopoDS_Face *)(&aIt2.Value()));
//
aMVE.Clear();
BOPTools::MapShapesAndAncestors(aF, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
TopExp::MapShapesAndAncestors(aF, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
//
// 2.1 Separate faces to process aMEP
aME2.Clear();
@@ -752,19 +655,19 @@ void BOPAlgo_BuilderFace::PerformInternalShapes()
//function : MakeInternalWires
//purpose :
//=======================================================================
void MakeInternalWires(const BOPCol_IndexedMapOfShape& theME,
BOPCol_ListOfShape& theWires)
void MakeInternalWires(const TopTools_IndexedMapOfShape& theME,
TopTools_ListOfShape& theWires)
{
Standard_Integer i, aNbE;
BOPCol_MapOfShape aAddedMap;
BOPCol_ListIteratorOfListOfShape aItE;
BOPCol_IndexedDataMapOfShapeListOfShape aMVE;
TopTools_MapOfShape aAddedMap;
TopTools_ListIteratorOfListOfShape aItE;
TopTools_IndexedDataMapOfShapeListOfShape aMVE;
BRep_Builder aBB;
//
aNbE = theME.Extent();
for (i = 1; i <= aNbE; ++i) {
const TopoDS_Shape& aE = theME(i);
BOPTools::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
TopExp::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
}
//
for (i = 1; i <= aNbE; ++i) {
@@ -786,7 +689,7 @@ void MakeInternalWires(const BOPCol_IndexedMapOfShape& theME,
TopExp_Explorer aExp(aE, TopAbs_VERTEX);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aV =aExp.Current();
const BOPCol_ListOfShape& aLE=aMVE.FindFromKey(aV);
const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aV);
aItE.Initialize(aLE);
for (; aItE.More(); aItE.Next()) {
TopoDS_Shape aEL=aItE.Value();
@@ -814,14 +717,14 @@ Standard_Boolean IsInside(const TopoDS_Shape& theHole,
TopAbs_State aState;
TopExp_Explorer aExp;
BOPCol_IndexedMapOfShape aME2;
TopTools_IndexedMapOfShape aME2;
gp_Pnt2d aP2D;
//
bRet=Standard_False;
aState=TopAbs_UNKNOWN;
const TopoDS_Face& aF2=(*(TopoDS_Face *)(&theF2));
//
BOPTools::MapShapes(aF2, TopAbs_EDGE, aME2);//AA
TopExp::MapShapes(aF2, TopAbs_EDGE, aME2);//AA
//
aExp.Init(theHole, TopAbs_EDGE);
if (aExp.More()) {
@@ -849,20 +752,16 @@ Standard_Boolean IsInside(const TopoDS_Shape& theHole,
//purpose :
//=======================================================================
Standard_Boolean IsGrowthWire(const TopoDS_Shape& theWire,
const BOPCol_IndexedMapOfShape& theMHE)
const TopTools_IndexedMapOfShape& theMHE)
{
Standard_Boolean bRet;
TopoDS_Iterator aIt;
//
bRet=Standard_False;
if (theMHE.Extent()) {
aIt.Initialize(theWire);
for(; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aE=aIt.Value();
if (theMHE.Contains(aE)) {
return !bRet;
}
if (theMHE.Extent())
{
TopoDS_Iterator aIt(theWire);
for(; aIt.More(); aIt.Next())
{
if (theMHE.Contains(aIt.Value()))
return Standard_True;
}
}
return bRet;
return Standard_False;
}

View File

@@ -25,7 +25,7 @@
#include <TopoDS_Face.hxx>
#include <TopAbs_Orientation.hxx>
#include <BOPAlgo_BuilderArea.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <NCollection_BaseAllocator.hxx>
class TopoDS_Face;
@@ -45,7 +45,7 @@ public:
Standard_EXPORT BOPAlgo_BuilderFace();
Standard_EXPORT virtual ~BOPAlgo_BuilderFace();
Standard_EXPORT BOPAlgo_BuilderFace(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT BOPAlgo_BuilderFace(const Handle(NCollection_BaseAllocator)& theAllocator);
//! Sets the face generatix
Standard_EXPORT void SetFace (const TopoDS_Face& theFace);

View File

@@ -122,6 +122,7 @@
{
myHistShapes.Clear();
myMapShape.Clear();
myImagesResult.Clear();
myHasDeleted=Standard_False;
myHasGenerated=Standard_False;
myHasModified=Standard_False;
@@ -132,7 +133,7 @@
//function : ImagesResult
//purpose :
//=======================================================================
const BOPCol_IndexedDataMapOfShapeListOfShape&
const TopTools_IndexedDataMapOfShapeListOfShape&
BOPAlgo_BuilderShape::ImagesResult()const
{
return myImagesResult;

View File

@@ -21,14 +21,14 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <BOPAlgo_Algo.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <Standard_Boolean.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPAlgo_Algo.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
class TopoDS_Shape;
@@ -69,7 +69,7 @@ public:
//! of arguments has modified shapes.
Standard_EXPORT Standard_Boolean HasModified() const;
Standard_EXPORT const BOPCol_IndexedDataMapOfShapeListOfShape& ImagesResult() const;
Standard_EXPORT const TopTools_IndexedDataMapOfShapeListOfShape& ImagesResult() const;
@@ -80,7 +80,7 @@ protected:
Standard_EXPORT BOPAlgo_BuilderShape();
Standard_EXPORT virtual ~BOPAlgo_BuilderShape();
Standard_EXPORT BOPAlgo_BuilderShape(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT BOPAlgo_BuilderShape(const Handle(NCollection_BaseAllocator)& theAllocator);
//! Prepare information for history support
Standard_EXPORT virtual void PrepareHistory();
@@ -88,26 +88,15 @@ Standard_EXPORT virtual ~BOPAlgo_BuilderShape();
TopoDS_Shape myShape;
TopTools_ListOfShape myHistShapes;
BOPCol_MapOfShape myMapShape;
TopTools_MapOfShape myMapShape;
Standard_Boolean myHasDeleted;
Standard_Boolean myHasGenerated;
Standard_Boolean myHasModified;
BOPCol_IndexedDataMapOfShapeListOfShape myImagesResult;
TopTools_IndexedDataMapOfShapeListOfShape myImagesResult;
Standard_Boolean myFlagHistory;
private:
};
#endif // _BOPAlgo_BuilderShape_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@@ -22,70 +22,120 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopoDS_Solid.hxx>
#include <BOPAlgo_BuilderArea.hxx>
#include <BOPCol_BaseAllocator.hxx>
class TopoDS_Solid;
#include <NCollection_BaseAllocator.hxx>
#include <TopTools_DataMapOfShapeBox.hxx>
//! The algorithm to build solids from set of faces
//! Solid Builder is the algorithm for building solids from set of faces.
//! The given faces should be non-intersecting, i.e. all coinciding parts
//! of the faces should be shared among them.
//!
//! The algorithm performs the following steps to build the solids:
//! 1. Find:
//! - faces orientated INTERNAL;
//! - alone faces given twice with different orientation;
//! 2. Build all possible closed shells from the rest of the faces
//! (*BOPAlgo_ShellSplitter* is used for that);
//! 3. Classify the obtained shells on the Holes and Growths;
//! 4. Build solids from the Growth shells, put Hole shells into closest Growth solids;
//! 5. Classify all unused faces relatively created solids and put them as internal
//! shells into the closest solids;
//! 6. Find all unclassified faces, i.e. faces outside of all created solids,
//! make internal shells from them and put these shells into a warning.
//!
//! It is possible to avoid all internal shells in the resulting solids.
//! For that it is necessary to use the method SetAvoidInternalShapes(true)
//! of the base class. In this case the steps 5 and 6 will not be performed at all.
//!
//! The algorithm may return the following warnings:
//! - *BOPAlgo_AlertShellSplitterFailed* in case the ShellSplitter algorithm has failed;
//! - *BOPAlgo_AlertSolidBuilderUnusedFaces* in case there are some faces outside of
//! created solids left.
//!
//! Example of usage of the algorithm:
//! ~~~~
//! const TopTools_ListOfShape& aFaces = ...; // Faces to build the solids
//! Standard_Boolean isAvoidInternals = ...; // Flag which defines whether to create the internal shells or not
//! BOPAlgo_BuilderSolid aBS; // Solid Builder tool
//! aBS.SetShapes(aFaces); // Set the faces
//! aBS.SetAvoidInternalShapes(isAvoidInternals); // Set the AvoidInternalShapesFlag
//! aBS.Perform(); // Perform the operation
//! if (!aBS.IsDone()) // Check for the errors
//! {
//! // error treatment
//! Standard_SStream aSStream;
//! aBS.DumpErrors(aSStream);
//! return;
//! }
//! if (aBS.HasWarnings()) // Check for the warnings
//! {
//! // warnings treatment
//! Standard_SStream aSStream;
//! aBS.DumpWarnings(aSStream);
//! }
//!
//! const TopTools_ListOfShape& aSolids = aBS.Areas(); // Obtaining the result solids
//! ~~~~
//!
class BOPAlgo_BuilderSolid : public BOPAlgo_BuilderArea
{
public:
DEFINE_STANDARD_ALLOC
public: //! @name Constructors
//! Empty constructor
Standard_EXPORT BOPAlgo_BuilderSolid();
Standard_EXPORT virtual ~BOPAlgo_BuilderSolid();
Standard_EXPORT BOPAlgo_BuilderSolid(const BOPCol_BaseAllocator& theAllocator);
//! Sets the source solid <theSolid>
Standard_EXPORT void SetSolid (const TopoDS_Solid& theSolid);
//! Returns the source solid
Standard_EXPORT const TopoDS_Solid& Solid() const;
//! Performs the algorithm
Standard_EXPORT virtual ~BOPAlgo_BuilderSolid();
//! Constructor with allocator
Standard_EXPORT BOPAlgo_BuilderSolid(const Handle(NCollection_BaseAllocator)& theAllocator);
public: //! @name Performing the operation
//! Performs the construction of the solids from the given faces
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
protected:
//! Collect the faces that
//! a) are internal
//! b) are the same and have different orientation
public: //! @name Getting the bounding boxes of the created solids
//! For classification purposes the algorithm builds the bounding boxes
//! for all created solids. This method returns the data map of solid - box pairs.
const TopTools_DataMapOfShapeBox& GetBoxesMap() const
{
return myBoxes;
}
protected: //! @name Protected methods performing the operation
//! Collect the faces:
//! - with INTERNAL orientation;
//! - that are alone but given twice with different orientation.
//! These faces will be put into the map *myShapesToAvoid* and will be
//! avoided in shells construction, but will be classified later on.
Standard_EXPORT virtual void PerformShapesToAvoid() Standard_OVERRIDE;
//! Build draft shells
//! a)myLoops - draft shells that consist of
//! boundary faces
//! b)myLoopsInternal - draft shells that contains
//! inner faces
//! Build all possible closed shells from the given faces.
//! The method fills the following maps:
//! - myLoops - Created closed shells;
//! - myLoopsInternal - The shells created from unused faces.
Standard_EXPORT virtual void PerformLoops() Standard_OVERRIDE;
//! Build draft solids that contains boundary faces
//! Classifies the created shells on the Holes and Growths.
//! Creates the solids from the Growths shells.
//! Puts the Hole shells into the closest Growths solids.
Standard_EXPORT virtual void PerformAreas() Standard_OVERRIDE;
//! Build finalized solids with internal shells
//! Classifies the unused faces relatively the created solids.
//! Puts the classified faces into the closest solids as internal shells.
//! Warns the user about unclassified faces if any.
Standard_EXPORT virtual void PerformInternalShapes() Standard_OVERRIDE;
TopoDS_Solid mySolid;
private:
TopTools_DataMapOfShapeBox myBoxes; // Boxes of the produced solids
};
#endif // _BOPAlgo_BuilderSolid_HeaderFile

View File

@@ -18,9 +18,6 @@
#include <BOPAlgo_Builder.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPCol_DataMapOfIntegerInteger.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
#include <BOPDS_PaveBlock.hxx>
@@ -31,8 +28,11 @@
#include <BRep_Tool.hxx>
#include <IntTools_Context.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TColStd_DataMapOfIntegerInteger.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
//=======================================================================
//function : FillImagesVertices
@@ -40,28 +40,22 @@
//=======================================================================
void BOPAlgo_Builder::FillImagesVertices()
{
Standard_Integer nV, nVSD;
BOPCol_DataMapIteratorOfDataMapOfIntegerInteger aIt;
//
const BOPCol_DataMapOfIntegerInteger& aMSDV=myDS->ShapesSD();
aIt.Initialize(aMSDV);
for (; aIt.More(); aIt.Next()) {
nV=aIt.Key();
nVSD=aIt.Value();
const TopoDS_Shape& aV=myDS->Shape(nV);
const TopoDS_Shape& aVSD=myDS->Shape(nVSD);
//
BOPCol_ListOfShape aLVSD(myAllocator);
//
aLVSD.Append(aVSD);
myImages.Bind(aV, aLVSD);
//
TColStd_DataMapIteratorOfDataMapOfIntegerInteger aIt(myDS->ShapesSD());
for (; aIt.More(); aIt.Next())
{
Standard_Integer nV = aIt.Key();
Standard_Integer nVSD = aIt.Value();
const TopoDS_Shape& aV = myDS->Shape(nV);
const TopoDS_Shape& aVSD = myDS->Shape(nVSD);
// Add to Images map
myImages.Bound(aV, TopTools_ListOfShape(myAllocator))->Append(aVSD);
// Add to SD map
myShapesSD.Bind(aV, aVSD);
//
BOPCol_ListOfShape* pLOr = myOrigins.ChangeSeek(aVSD);
if (!pLOr) {
pLOr = myOrigins.Bound(aVSD, BOPCol_ListOfShape());
}
// Add to Origins map
TopTools_ListOfShape* pLOr = myOrigins.ChangeSeek(aVSD);
if (!pLOr)
pLOr = myOrigins.Bound(aVSD, TopTools_ListOfShape());
pLOr->Append(aV);
}
}
@@ -89,7 +83,7 @@ void BOPAlgo_Builder::FillImagesVertices()
// Fill the images of the edge from the list of its pave blocks.
// The small edges, having no pave blocks, will have the empty list
// of images and, thus, will be avoided in the result.
BOPCol_ListOfShape *pLS = myImages.Bound(aE, BOPCol_ListOfShape());
TopTools_ListOfShape *pLS = myImages.Bound(aE, TopTools_ListOfShape());
//
BOPDS_ListIteratorOfListOfPaveBlock aItPB(aLPB);
for (; aItPB.More(); aItPB.Next()) {
@@ -100,9 +94,9 @@ void BOPAlgo_Builder::FillImagesVertices()
const TopoDS_Shape& aSpR = myDS->Shape(nSpR);
pLS->Append(aSpR);
//
BOPCol_ListOfShape* pLOr = myOrigins.ChangeSeek(aSpR);
TopTools_ListOfShape* pLOr = myOrigins.ChangeSeek(aSpR);
if (!pLOr) {
pLOr = myOrigins.Bound(aSpR, BOPCol_ListOfShape());
pLOr = myOrigins.Bound(aSpR, TopTools_ListOfShape());
}
pLOr->Append(aE);
//
@@ -115,26 +109,6 @@ void BOPAlgo_Builder::FillImagesVertices()
}
}
//=======================================================================
// function: IsInterferred
// purpose:
//=======================================================================
Standard_Boolean BOPAlgo_Builder::IsInterferred(const TopoDS_Shape& theS)const
{
Standard_Boolean bInterferred;
TopoDS_Iterator aIt;
//
bInterferred=Standard_False;
aIt.Initialize(theS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx=aIt.Value();
if (myImages.IsBound(aSx)) {
bInterferred=!bInterferred;
break;
}
}
return bInterferred;
}
//=======================================================================
//function : BuildResult
//purpose :
//=======================================================================
@@ -142,8 +116,8 @@ void BOPAlgo_Builder::FillImagesVertices()
{
TopAbs_ShapeEnum aType;
BRep_Builder aBB;
BOPCol_MapOfShape aM;
BOPCol_ListIteratorOfListOfShape aIt, aItIm;
TopTools_MapOfShape aM;
TopTools_ListIteratorOfListOfShape aIt, aItIm;
//
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
@@ -151,7 +125,7 @@ void BOPAlgo_Builder::FillImagesVertices()
aType=aS.ShapeType();
if (aType==theType) {
if (myImages.IsBound(aS)){
const BOPCol_ListOfShape& aLSIm=myImages.Find(aS);
const TopTools_ListOfShape& aLSIm=myImages.Find(aS);
aItIm.Initialize(aLSIm);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aSIm=aItIm.Value();
@@ -175,7 +149,7 @@ void BOPAlgo_Builder::FillImagesVertices()
void BOPAlgo_Builder::FillImagesContainers(const TopAbs_ShapeEnum theType)
{
Standard_Integer i, aNbS;
BOPCol_MapOfShape aMFP(100, myAllocator);
TopTools_MapOfShape aMFP(100, myAllocator);
//
aNbS=myDS->NbSourceShapes();
for (i=0; i<aNbS; ++i) {
@@ -193,7 +167,7 @@ void BOPAlgo_Builder::FillImagesVertices()
void BOPAlgo_Builder::FillImagesCompounds()
{
Standard_Integer i, aNbS;
BOPCol_MapOfShape aMFP(100, myAllocator);
TopTools_MapOfShape aMFP(100, myAllocator);
//
aNbS=myDS->NbSourceShapes();
for (i=0; i<aNbS; ++i) {
@@ -211,58 +185,70 @@ void BOPAlgo_Builder::FillImagesVertices()
void BOPAlgo_Builder::FillImagesContainer(const TopoDS_Shape& theS,
const TopAbs_ShapeEnum theType)
{
Standard_Boolean bInterferred, bToReverse;
TopoDS_Iterator aIt;
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfShape aItIm;
//
bInterferred=IsInterferred(theS);
if (!bInterferred){
// Check if any of the sub-shapes of the container have been modified
TopoDS_Iterator aIt(theS);
for (; aIt.More(); aIt.Next())
{
const TopoDS_Shape& aSS = aIt.Value();
const TopTools_ListOfShape* pLFIm = myImages.Seek(aSS);
if (pLFIm && ((pLFIm->Extent() != 1) || !pLFIm->First().IsSame(aSS)))
break;
}
if (!aIt.More())
{
// Non of the sub-shapes have been modified.
// No need to create the new container.
return;
}
//
BRep_Builder aBB;
// Make the new container of the splits of its sub-shapes
TopoDS_Shape aCIm;
BOPTools_AlgoTools::MakeContainer(theType, aCIm);
//
aIt.Initialize(theS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx=aIt.Value();
if (myImages.IsBound(aSx)) {
const BOPCol_ListOfShape& aLFIm=myImages.Find(aSx);
aItIm.Initialize(aLFIm);
for (; aItIm.More(); aItIm.Next()) {
TopoDS_Shape aSxIm=aItIm.Value();
//
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSxIm, aSx, myContext);
if (bToReverse) {
aSxIm.Reverse();
}
aBB.Add(aCIm, aSxIm);
}
for (; aIt.More(); aIt.Next())
{
const TopoDS_Shape& aSS = aIt.Value();
const TopTools_ListOfShape* pLSSIm = myImages.Seek(aSS);
if (!pLSSIm)
{
// No splits, add the sub-shape itself
aBB.Add(aCIm, aSS);
continue;
}
else {
aBB.Add(aCIm, aSx);
// Add the splits
TopTools_ListIteratorOfListOfShape aItIm(*pLSSIm);
for (; aItIm.More(); aItIm.Next())
{
TopoDS_Shape aSSIm = aItIm.Value();
if (!aSSIm.IsEqual(aSS) &&
BOPTools_AlgoTools::IsSplitToReverse(aSSIm, aSS, myContext))
{
aSSIm.Reverse();
}
aBB.Add(aCIm, aSSIm);
}
}
//
aCIm.Closed(BRep_Tool::IsClosed(aCIm));
//
BOPCol_ListOfShape aLSIm(myAllocator);
aLSIm.Append(aCIm);
myImages.Bind(theS, aLSIm);
myImages.Bound(theS, TopTools_ListOfShape(myAllocator))->Append(aCIm);
}
//=======================================================================
//function : FillImagesCompound
//purpose :
//=======================================================================
void BOPAlgo_Builder::FillImagesCompound(const TopoDS_Shape& theS,
BOPCol_MapOfShape& theMFP)
TopTools_MapOfShape& theMFP)
{
Standard_Boolean bInterferred;
TopAbs_Orientation aOrX;
TopoDS_Iterator aIt;
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfShape aItIm;
TopTools_ListIteratorOfListOfShape aItIm;
//
if (!theMFP.Add(theS)) {
return;
@@ -291,7 +277,7 @@ void BOPAlgo_Builder::FillImagesVertices()
const TopoDS_Shape& aSX=aIt.Value();
aOrX=aSX.Orientation();
if (myImages.IsBound(aSX)) {
const BOPCol_ListOfShape& aLFIm=myImages.Find(aSX);
const TopTools_ListOfShape& aLFIm=myImages.Find(aSX);
aItIm.Initialize(aLFIm);
for (; aItIm.More(); aItIm.Next()) {
TopoDS_Shape aSXIm=aItIm.Value();
@@ -304,7 +290,7 @@ void BOPAlgo_Builder::FillImagesVertices()
}
}
//
BOPCol_ListOfShape aLSIm(myAllocator);
TopTools_ListOfShape aLSIm(myAllocator);
aLSIm.Append(aCIm);
myImages.Bind(theS, aLSIm);
}

View File

@@ -20,13 +20,6 @@
#include <BOPAlgo_BuilderFace.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPCol_DataMapOfIntegerListOfShape.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPCol_ListOfInteger.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_FaceInfo.hxx>
#include <BOPDS_Interf.hxx>
@@ -36,7 +29,6 @@
#include <BOPDS_VectorOfCurve.hxx>
#include <BOPDS_VectorOfInterfFF.hxx>
#include <BOPDS_VectorOfPoint.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
#include <BOPTools_AlgoTools3D.hxx>
@@ -44,33 +36,34 @@
#include <BOPTools_DataMapOfShapeSet.hxx>
#include <BOPTools_ListOfCoupleOfShape.hxx>
#include <BOPTools_MapOfSet.hxx>
#include <BOPTools_Parallel.hxx>
#include <BRep_Builder.hxx>
#include <BRepLib.hxx>
#include <BRep_Tool.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomLib.hxx>
#include <NCollection_IncAllocator.hxx>
#include <NCollection_Vector.hxx>
#include <Precision.hxx>
#include <IntTools_Context.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopTools_ListOfShape.hxx>
#include <algorithm>
//
static
Standard_Boolean HasPaveBlocksOnIn(const BOPDS_FaceInfo& aFI1,
const BOPDS_FaceInfo& aFI2);
//
typedef BOPCol_NCVector<TopoDS_Shape> BOPAlgo_VectorOfShape;
//
typedef BOPCol_NCVector<BOPAlgo_VectorOfShape> \
BOPAlgo_VectorOfVectorOfShape;
//
typedef NCollection_IndexedDataMap\
<BOPTools_Set, Standard_Integer, BOPTools_SetMapHasher> \
BOPAlgo_IndexedDataMapOfSetInteger;
//
TopoDS_Face BuildDraftFace(const TopoDS_Face& theFace,
const TopTools_DataMapOfShapeListOfShape& theImages,
Handle(IntTools_Context)& theCtx);
//=======================================================================
//class : BOPAlgo_PairOfShapeBoolean
//purpose :
@@ -123,30 +116,30 @@ class BOPAlgo_PairOfShapeBoolean : public BOPAlgo_Algo {
Handle(IntTools_Context) myContext;
};
//
typedef BOPCol_NCVector<BOPAlgo_PairOfShapeBoolean> \
typedef NCollection_Vector<BOPAlgo_PairOfShapeBoolean> \
BOPAlgo_VectorOfPairOfShapeBoolean;
//
typedef BOPCol_ContextFunctor
typedef BOPTools_ContextFunctor
<BOPAlgo_PairOfShapeBoolean,
BOPAlgo_VectorOfPairOfShapeBoolean,
Handle(IntTools_Context),
IntTools_Context> BOPCol_BuilderSDFaceFunctor;
IntTools_Context> BOPAlgo_BuilderSDFaceFunctor;
//
typedef BOPCol_ContextCnt
<BOPCol_BuilderSDFaceFunctor,
typedef BOPTools_ContextCnt
<BOPAlgo_BuilderSDFaceFunctor,
BOPAlgo_VectorOfPairOfShapeBoolean,
Handle(IntTools_Context)> BOPAlgo_BuilderSDFaceCnt;
//
//=======================================================================
// BuilderFace
//
typedef BOPCol_NCVector<BOPAlgo_BuilderFace> BOPAlgo_VectorOfBuilderFace;
typedef NCollection_Vector<BOPAlgo_BuilderFace> BOPAlgo_VectorOfBuilderFace;
//
typedef BOPCol_Functor
typedef BOPTools_Functor
<BOPAlgo_BuilderFace,
BOPAlgo_VectorOfBuilderFace> BOPAlgo_BuilderFaceFunctor;
//
typedef BOPCol_Cnt
typedef BOPTools_Cnt
<BOPAlgo_BuilderFaceFunctor,
BOPAlgo_VectorOfBuilderFace> BOPAlgo_BuilderFaceCnt;
//
@@ -161,7 +154,7 @@ class BOPAlgo_VFI : public BOPAlgo_Algo {
BOPAlgo_VFI() :
BOPAlgo_Algo(),
myFlag(-1) {
myIsInternal(Standard_False) {
}
//
virtual ~BOPAlgo_VFI(){
@@ -183,8 +176,8 @@ class BOPAlgo_VFI : public BOPAlgo_Algo {
return myF;
}
//
Standard_Integer Flag()const {
return myFlag;
Standard_Boolean IsInternal()const {
return myIsInternal;
}
//
void SetContext(const Handle(IntTools_Context)& aContext) {
@@ -199,25 +192,27 @@ class BOPAlgo_VFI : public BOPAlgo_Algo {
Standard_Real aT1, aT2, dummy;
//
BOPAlgo_Algo::UserBreak();
myFlag = myContext->ComputeVF(myV, myF, aT1, aT2, dummy, myFuzzyValue);
Standard_Integer iFlag =
myContext->ComputeVF(myV, myF, aT1, aT2, dummy, myFuzzyValue);
myIsInternal = (iFlag == 0);
}
//
protected:
Standard_Integer myFlag;
Standard_Boolean myIsInternal;
TopoDS_Vertex myV;
TopoDS_Face myF;
Handle(IntTools_Context) myContext;
};
//
typedef BOPCol_NCVector<BOPAlgo_VFI> BOPAlgo_VectorOfVFI;
typedef NCollection_Vector<BOPAlgo_VFI> BOPAlgo_VectorOfVFI;
//
typedef BOPCol_ContextFunctor
typedef BOPTools_ContextFunctor
<BOPAlgo_VFI,
BOPAlgo_VectorOfVFI,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_VFIFunctor;
//
typedef BOPCol_ContextCnt
typedef BOPTools_ContextCnt
<BOPAlgo_VFIFunctor,
BOPAlgo_VectorOfVFI,
Handle(IntTools_Context)> BOPAlgo_VFICnt;
@@ -230,7 +225,7 @@ void BOPAlgo_Builder::FillImagesFaces()
{
BuildSplitFaces();
FillSameDomainFaces();
FillImagesFaces1();
FillInternalVertices();
}
//=======================================================================
//function : BuildSplitFaces
@@ -240,24 +235,26 @@ void BOPAlgo_Builder::BuildSplitFaces()
{
Standard_Boolean bHasFaceInfo, bIsClosed, bIsDegenerated, bToReverse;
Standard_Integer i, j, k, aNbS, aNbPBIn, aNbPBOn, aNbPBSc, aNbAV, nSp;
Standard_Size aNbBF;
TopoDS_Face aFF, aFSD;
TopoDS_Edge aSp, aEE;
TopAbs_Orientation anOriF, anOriE;
TopExp_Explorer aExp;
BOPCol_ListIteratorOfListOfShape aIt;
BOPCol_ListOfInteger aLIAV;
BOPCol_MapOfShape aMFence;
TopTools_ListIteratorOfListOfShape aIt;
TColStd_ListOfInteger aLIAV;
TopTools_MapOfShape aMFence;
Handle(NCollection_BaseAllocator) aAllocator;
BOPCol_ListOfShape aLFIm(myAllocator);
BOPAlgo_VectorOfBuilderFace aVBF;
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~scope f
aAllocator=
NCollection_BaseAllocator::CommonBaseAllocator();
//
BOPCol_ListOfShape aLE(aAllocator);
BOPCol_MapOfShape aMDE(100, aAllocator);
TopTools_ListOfShape aLE(aAllocator);
TopTools_MapOfShape aMDE(100, aAllocator);
//
// Build temporary map of faces images to avoid rebuilding
// of the faces without any IN or section edges
NCollection_IndexedDataMap<Standard_Integer, TopTools_ListOfShape> aFacesIm;
//
aNbS=myDS->NbSourceShapes();
//
@@ -292,17 +289,46 @@ void BOPAlgo_Builder::BuildSplitFaces()
if (!aNbPBIn && !aNbPBOn && !aNbPBSc && !aNbAV) { // not compete
continue;
}
//
if (!aNbPBIn && !aNbPBSc)
{
if (!aNbAV)
{
// Check if any wires of the face have been modified.
// If not, there is no need to create the new face.
TopoDS_Iterator aItW(aF);
for (; aItW.More(); aItW.Next())
{
if (myImages.IsBound(aItW.Value()))
break;
}
if (!aItW.More())
continue;
}
// No internal parts for the face, so just build the draft face
// and keep it to pass directly into result.
// If the original face has any internal edges, the draft face
// will be null, as the internal edges may split the face on parts
// (as in the case "bugs modalg_5 bug25245_1").
// The BuilderFace algorithm will be called in this case.
TopoDS_Face aFD = BuildDraftFace(aF, myImages, myContext);
if (!aFD.IsNull())
{
aFacesIm(aFacesIm.Add(i, TopTools_ListOfShape())).Append(aFD);
continue;
}
}
aMFence.Clear();
//
anOriF=aF.Orientation();
aFF=aF;
aFF.Orientation(TopAbs_FORWARD);
//
// 1. Fill the egdes set for the face aFF -> LE
// 1. Fill the edges set for the face aFF -> LE
aLE.Clear();
//
//
// 1.1 Bounding edges
aExp.Init(aFF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
@@ -346,7 +372,7 @@ void BOPAlgo_Builder::BuildSplitFaces()
bIsDegenerated=BRep_Tool::Degenerated(aE);
const BOPCol_ListOfShape& aLIE=myImages.Find(aE);
const TopTools_ListOfShape& aLIE=myImages.Find(aE);
aIt.Initialize(aLIE);
for (; aIt.More(); aIt.Next()) {
aSp=(*(TopoDS_Edge*)(&aIt.Value()));
@@ -415,10 +441,10 @@ void BOPAlgo_Builder::BuildSplitFaces()
//
if (!myPaveFiller->NonDestructive()) {
// speed up for planar faces
BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane (aLE, aFF);
BRepLib::BuildPCurveForEdgesOnPlane(aLE, aFF);
}
// 3 Build split faces
BOPAlgo_BuilderFace& aBF=aVBF.Append1();
BOPAlgo_BuilderFace& aBF=aVBF.Appended();
aBF.SetFace(aF);
aBF.SetShapes(aLE);
aBF.SetRunParallel(myRunParallel);
@@ -426,208 +452,296 @@ void BOPAlgo_Builder::BuildSplitFaces()
//
}// for (i=0; i<aNbS; ++i) {
//
aNbBF=aVBF.Extent();
//
//===================================================
BOPAlgo_BuilderFaceCnt::Perform(myRunParallel, aVBF);
//===================================================
//
for (k=0; k<(Standard_Integer)aNbBF; ++k) {
aLFIm.Clear();
Standard_Integer aNbBF = aVBF.Length();
for (k = 0; k < aNbBF; ++k)
{
BOPAlgo_BuilderFace& aBF = aVBF(k);
aFacesIm.Add(myDS->Index(aBF.Face()), aBF.Areas());
}
aNbBF = aFacesIm.Extent();
for (k = 1; k <= aNbBF; ++k)
{
const TopoDS_Face& aF = TopoDS::Face(myDS->Shape(aFacesIm.FindKey(k)));
anOriF = aF.Orientation();
const TopTools_ListOfShape& aLFR = aFacesIm(k);
//
BOPAlgo_BuilderFace& aBF=aVBF(k);
TopoDS_Face aF=aBF.Face();
anOriF=aBF.Orientation();
aF.Orientation(anOriF);
//
const BOPCol_ListOfShape& aLFR=aBF.Areas();
TopTools_ListOfShape* pLFIm = myImages.Bound(aF, TopTools_ListOfShape());
aIt.Initialize(aLFR);
for (; aIt.More(); aIt.Next()) {
TopoDS_Shape& aFR=aIt.ChangeValue();
if (anOriF==TopAbs_REVERSED) {
if (anOriF==TopAbs_REVERSED)
aFR.Orientation(TopAbs_REVERSED);
}
//aFR.Orientation(anOriF);
aLFIm.Append(aFR);
pLFIm->Append(aFR);
}
//
mySplits.Bind(aF, aLFIm);
}// for (k=0; k<aNbBF; ++k) {
}
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~scope t
}
//=======================================================================
//function : AddEdgeSet
//purpose :
//=======================================================================
typedef
NCollection_IndexedDataMap<BOPTools_Set,
TopTools_ListOfShape,
BOPTools_SetMapHasher> BOPAlgo_IndexedDataMapOfSetListOfShape;
static void AddEdgeSet(const TopoDS_Shape& theS,
BOPAlgo_IndexedDataMapOfSetListOfShape& theMap,
const Handle(NCollection_BaseAllocator)& theAllocator)
{
// Make set
BOPTools_Set aSE;
aSE.Add(theS, TopAbs_EDGE);
// Add set to the map, keeping connection to the shape
TopTools_ListOfShape* pLF = theMap.ChangeSeek(aSE);
if (!pLF)
pLF = &theMap(theMap.Add(aSE, TopTools_ListOfShape(theAllocator)));
pLF->Append(theS);
}
//=======================================================================
//function : FillSameDomainFaces
//purpose :
//=======================================================================
void BOPAlgo_Builder::FillSameDomainFaces()
{
Standard_Boolean bFlag;
Standard_Integer i, j, k, aNbFFs, nF1, nF2;
Handle(NCollection_BaseAllocator) aAllocator;
BOPCol_ListIteratorOfListOfShape aItF;
BOPCol_MapOfShape aMFence;
BOPAlgo_IndexedDataMapOfSetInteger aIDMSS;
BOPAlgo_VectorOfVectorOfShape aVVS;
//
const BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
//
aNbFFs=aFFs.Extent();
if (!aNbFFs) {
// It is necessary to analyze all Face/Face intersections
// and find all faces with equal sets of edges
const BOPDS_VectorOfInterfFF& aFFs = myDS->InterfFF();
Standard_Integer aNbFFs = aFFs.Length();
if (!aNbFFs)
return;
Handle(NCollection_BaseAllocator) aAllocator = new NCollection_IncAllocator;
// Vector to store the indices of faces for future sorting
// for making the SD face for the group from the face with
// smallest index in Data structure
NCollection_Vector<Standard_Integer> aFIVec(256, aAllocator);
// Fence map to avoid repeated checks of the same face.
TColStd_MapOfInteger aMFence(1, aAllocator);
// Fill the vector with indices of faces
for (Standard_Integer i = 0; i < aNbFFs; ++i)
{
const BOPDS_InterfFF& aFF = aFFs(i);
// get indices
Standard_Integer nF[2];
aFF.Indices(nF[0], nF[1]);
// store indices to the vector
for (Standard_Integer j = 0; j < 2; ++j)
{
if (!myDS->HasFaceInfo(nF[j]))
continue;
if (!aMFence.Add(nF[j]))
continue;
aFIVec.Appended() = nF[j];
}
}
//
for (i=0; i<aNbFFs; ++i) {
const BOPDS_InterfFF& aFF=aFFs(i);
aFF.Indices(nF1, nF2);
//
if (!myDS->HasFaceInfo(nF1) || !myDS->HasFaceInfo(nF2) ) {
continue;
}
//
const BOPDS_FaceInfo& aFI1=myDS->FaceInfo(nF1);
const BOPDS_FaceInfo& aFI2=myDS->FaceInfo(nF2);
//
const TopoDS_Shape& aF1=myDS->Shape(nF1);
const TopoDS_Shape& aF2=myDS->Shape(nF2);
//
bFlag=HasPaveBlocksOnIn(aFI1, aFI2);
bFlag=bFlag && (mySplits.IsBound(aF1) && mySplits.IsBound(aF2));
//
if (bFlag) {
for (k=0; k<2; ++k) {
const TopoDS_Shape& aF=(!k) ? aF1 : aF2;
const BOPCol_ListOfShape& aLF=mySplits.Find(aF);
//
aItF.Initialize(aLF);
for (; aItF.More(); aItF.Next()) {
const TopoDS_Shape& aFx=aItF.Value();
//
if (aMFence.Add(aFx)) {
BOPTools_Set aSTx;
//
aSTx.Add(aFx, TopAbs_EDGE);
//
if (!aIDMSS.Contains(aSTx)) {
BOPAlgo_VectorOfShape& aVS=aVVS.Append1();
aVS.Append(aFx);
//
j=aVVS.Extent()-1;
aIDMSS.Add (aSTx, j);
}
else {
j=aIDMSS.ChangeFromKey(aSTx);
BOPAlgo_VectorOfShape& aVS=aVVS(j);
aVS.Append(aFx);
}
}
}
// Sort the indices
std::sort(aFIVec.begin(), aFIVec.end());
// Data map of set of edges with all faces having this set
NCollection_IndexedDataMap<BOPTools_Set,
TopTools_ListOfShape,
BOPTools_SetMapHasher> anESetFaces(1, aAllocator);
// Map of planar bounded faces. If such faces have the same Edge set
// they are considered Same domain, without additional check.
TopTools_MapOfShape aMFPlanar(1, aAllocator);
Standard_Integer aNbF = aFIVec.Length();
for (Standard_Integer i = 0; i < aNbF; ++i)
{
const Standard_Integer nF = aFIVec(i);
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(nF);
const TopoDS_Shape& aF = aSI.Shape();
Standard_Boolean bCheckPlanar = Standard_False;
{
// At this stage, context should contain adaptor for all intersected faces,
// so getting a type of the underlying surface should be done at no cost.
if (myContext->SurfaceAdaptor(TopoDS::Face(aF)).GetType() == GeomAbs_Plane)
{
// Check bounding box of the face - it should not be open in any side
const Bnd_Box& aBox = aSI.Box();
bCheckPlanar = !(aBox.IsOpenXmin() || aBox.IsOpenXmax() ||
aBox.IsOpenYmin() || aBox.IsOpenYmax() ||
aBox.IsOpenZmin() || aBox.IsOpenZmax());
}
}// if (bFlag) {
else {// if (!bFlag)
BOPTools_Set aST1, aST2;
//
aST1.Add(aF1, TopAbs_EDGE);
aST2.Add(aF2, TopAbs_EDGE);
//
if (aST1.IsEqual(aST2)) {
if (!aIDMSS.Contains(aST1)) {
BOPAlgo_VectorOfShape& aVS=aVVS.Append1();
if (aMFence.Add(aF1)) {
aVS.Append(aF1);
}
if (aMFence.Add(aF2)) {
aVS.Append(aF2);
}
//
k=aVVS.Extent()-1;
aIDMSS.Add (aST1, k);
}
else {
k=aIDMSS.ChangeFromKey(aST1);
BOPAlgo_VectorOfShape& aVS=aVVS(k);
if (aMFence.Add(aF1)) {
aVS.Append(aF1);
}
if (aMFence.Add(aF2)) {
aVS.Append(aF2);
}
}
}//if (aST1.IsEqual(aST2)) {
}// else {// if (!bFlag)
//
}// for (i=0; i<aNbFFs; ++i) {
//
aIDMSS.Clear();
//
Standard_Boolean bFlagSD;
Standard_Integer aNbVPSB, aNbVVS, aNbF, aNbF1;
BOPAlgo_VectorOfPairOfShapeBoolean aVPSB;
//
aNbVVS=aVVS.Extent();
for (i=0; i<aNbVVS; ++i) {
const BOPAlgo_VectorOfShape& aVS=aVVS(i);
aNbF=aVS.Extent();
if (aNbF<2) {
continue;
}
//
aNbF1=aNbF-1;
for (j=0; j<aNbF1; ++j) {
const TopoDS_Shape& aFj=aVS(j);
for (k=j+1; k<aNbF; ++k) {
const TopoDS_Shape& aFk=aVS(k);
BOPAlgo_PairOfShapeBoolean& aPSB=aVPSB.Append1();
aPSB.Shape1()=aFj;
aPSB.Shape2()=aFk;
const TopTools_ListOfShape* pLFSp = myImages.Seek(aF);
if (pLFSp)
{
TopTools_ListIteratorOfListOfShape aItLF(*pLFSp);
for (; aItLF.More(); aItLF.Next())
{
AddEdgeSet(aItLF.Value(), anESetFaces, aAllocator);
if (bCheckPlanar)
aMFPlanar.Add(aItLF.Value());
}
}
else
{
AddEdgeSet(aF, anESetFaces, aAllocator);
if (bCheckPlanar)
aMFPlanar.Add(aF);
}
}
// Store pairs of faces with equal set of edges to check if they are really Same Domain
BOPAlgo_VectorOfPairOfShapeBoolean aVPSB;
// Back and forth map of SD faces to make the blocks
TopTools_IndexedDataMapOfShapeListOfShape aDMSLS(1, aAllocator);
Standard_Integer aNbSets = anESetFaces.Extent();
for (Standard_Integer i = 1; i <= aNbSets; ++i)
{
const TopTools_ListOfShape& aLF = anESetFaces(i);
if (aLF.Extent() < 2)
continue;
// All possible pairs from <aLF> should be checked
TopTools_ListIteratorOfListOfShape aIt1(aLF);
for (; aIt1.More(); aIt1.Next())
{
const TopoDS_Shape& aF1 = aIt1.Value();
Standard_Boolean bCheckPlanar = aMFPlanar.Contains(aF1);
TopTools_ListIteratorOfListOfShape aIt2 = aIt1;
for (aIt2.Next(); aIt2.More(); aIt2.Next())
{
const TopoDS_Shape& aF2 = aIt2.Value();
if (bCheckPlanar && aMFPlanar.Contains(aF2))
{
// Consider planar bounded faces as Same Domain without additional check
BOPAlgo_Tools::FillMap<TopoDS_Shape, TopTools_ShapeMapHasher>(aF1, aF2, aDMSLS, aAllocator);
continue;
}
// Add pair for analysis
BOPAlgo_PairOfShapeBoolean& aPSB = aVPSB.Appended();
aPSB.Shape1() = aF1;
aPSB.Shape2() = aF2;
aPSB.SetFuzzyValue(myFuzzyValue);
aPSB.SetProgressIndicator(myProgressIndicator);
}
}
}
//================================================================
// Perform analysis
BOPAlgo_BuilderSDFaceCnt::Perform(myRunParallel, aVPSB, myContext);
//================================================================
aAllocator=
NCollection_BaseAllocator::CommonBaseAllocator();
BOPCol_IndexedDataMapOfShapeListOfShape aDMSLS(100, aAllocator);
NCollection_List<BOPCol_ListOfShape> aMBlocks(aAllocator);
//
aNbVPSB=aVPSB.Extent();
for (i=0; i<aNbVPSB; ++i) {
BOPAlgo_PairOfShapeBoolean& aPSB=aVPSB(i);
bFlagSD=aPSB.Flag();
if (bFlagSD) {
const TopoDS_Shape& aFj=aPSB.Shape1();
const TopoDS_Shape& aFk=aPSB.Shape2();
BOPAlgo_Tools::FillMap<TopoDS_Shape, TopTools_ShapeMapHasher>(aFj, aFk, aDMSLS, aAllocator);
}
NCollection_List<TopTools_ListOfShape> aMBlocks(aAllocator);
// Fill map with SD faces to make the blocks
Standard_Integer aNbPairs = aVPSB.Length();
for (Standard_Integer i = 0; i < aNbPairs; ++i)
{
BOPAlgo_PairOfShapeBoolean& aPSB = aVPSB(i);
if (aPSB.Flag())
BOPAlgo_Tools::FillMap<TopoDS_Shape, TopTools_ShapeMapHasher>
(aPSB.Shape1(), aPSB.Shape2(), aDMSLS, aAllocator);
}
aVPSB.Clear();
//
// 2. Make blocks
BOPAlgo_Tools::MakeBlocks<TopoDS_Shape, TopTools_ShapeMapHasher>(aDMSLS, aMBlocks, aAllocator);
//
// 3. Fill same domain faces map -> aMSDF
NCollection_List<BOPCol_ListOfShape>::Iterator aItB(aMBlocks);
for (; aItB.More(); aItB.Next()) {
const BOPCol_ListOfShape& aLSD = aItB.Value();
//
const TopoDS_Shape& aFSD1=aLSD.First();
aItF.Initialize(aLSD);
for (; aItF.More(); aItF.Next()) {
const TopoDS_Shape& aFSD=aItF.Value();
myShapesSD.Bind(aFSD, aFSD1);
//
// If the face has no splits but are SD face,
// it is considered as splitted face
if (!mySplits.IsBound(aFSD)) {
BOPCol_ListOfShape aLS;
aLS.Append(aFSD);
mySplits.Bind(aFSD, aLS);
// Make blocks of SD faces using the back and forth map
BOPAlgo_Tools::MakeBlocks<TopoDS_Shape, TopTools_ShapeMapHasher>
(aDMSLS, aMBlocks, aAllocator);
// Fill same domain faces map
NCollection_List<TopTools_ListOfShape>::Iterator aItB(aMBlocks);
for (; aItB.More(); aItB.Next())
{
const TopTools_ListOfShape& aLSD = aItB.Value();
// If the group contains some original faces, the one with minimal
// index in the DS will be chosen as the SD for the whole group.
// If there are no original faces in the group, the first face from
// the group will be used as the SD face.
// Such SD face will be representative of the whole group in the result.
TopoDS_Face* pFSD = NULL;
Standard_Integer nFMin = ::IntegerLast();
TopTools_ListIteratorOfListOfShape aItLF(aLSD);
for (; aItLF.More(); aItLF.Next())
{
const TopoDS_Shape& aF = aItLF.Value();
// Check the index of the face in DS
const Standard_Integer nF = myDS->Index(aF);
if (nF >= 0)
{
// The fact that the face is found in the DS, means that
// the face has not been change, and thus it is original one.
//
// Such face does not have any splits, but have an SD face.
// Consider it being split.
myImages.Bound(aF, TopTools_ListOfShape())->Append(aF);
// For the SD face chose the one with minimal index
if (nF < nFMin)
{
nFMin = nF;
pFSD = (TopoDS_Face*)&aF;
}
}
}
if (!pFSD)
{
// No original faces in the group, take the first one
pFSD = (TopoDS_Face*)&aLSD.First();
}
// Save all SD connections
aItLF.Initialize(aLSD);
for (; aItLF.More(); aItLF.Next())
{
const TopoDS_Shape& aF = aItLF.Value();
myShapesSD.Bind(aF, *pFSD);
}
}
// Update the map of images with SD faces and
// fill the map of origins.
Standard_Integer aNbS = myDS->NbSourceShapes();
for (Standard_Integer i = 0; i < aNbS; ++i)
{
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
if (aSI.ShapeType() != TopAbs_FACE)
continue;
const TopoDS_Shape& aF = aSI.Shape();
TopTools_ListOfShape* pLFIm = myImages.ChangeSeek(aF);
if (!pLFIm)
continue;
TopTools_ListIteratorOfListOfShape aItLFIm(*pLFIm);
for (; aItLFIm.More(); aItLFIm.Next())
{
TopoDS_Shape& aFIm = aItLFIm.ChangeValue();
const TopoDS_Shape* pFSD = myShapesSD.Seek(aFIm);
if (pFSD)
// Update image with SD face
aFIm = *pFSD;
// Fill the map of origins
TopTools_ListOfShape* pLFOr = myOrigins.ChangeSeek(aFIm);
if (!pLFOr)
pLFOr = myOrigins.Bound(aFIm, TopTools_ListOfShape());
pLFOr->Append(aF);
}
}
aMBlocks.Clear();
aDMSLS.Clear();
}
@@ -635,138 +749,157 @@ void BOPAlgo_Builder::FillSameDomainFaces()
// function: FillImagesFaces1
// purpose:
//=======================================================================
void BOPAlgo_Builder::FillImagesFaces1()
void BOPAlgo_Builder::FillInternalVertices()
{
Standard_Integer i, aNbS, iSense, nVx, aNbVFI, iFlag;
TopoDS_Face aFSD;
TopoDS_Vertex aVx;
BRep_Builder aBB;
BOPCol_ListOfInteger aLIAV;
BOPCol_ListOfShape aLFIm;
BOPCol_ListIteratorOfListOfInteger aItV;
BOPCol_ListIteratorOfListOfShape aItLS, aItF;
// Vector of pairs of Vertex/Face for classification of the vertices
// relatively faces, and adding them as internal into the faces
BOPAlgo_VectorOfVFI aVVFI;
//
aNbS=myDS->NbSourceShapes();
for (i=0; i<aNbS; ++i) {
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
if (aSI.ShapeType()!=TopAbs_FACE) {
Standard_Integer aNbS = myDS->NbSourceShapes();
for (Standard_Integer i = 0; i < aNbS; ++i)
{
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
if (aSI.ShapeType() != TopAbs_FACE)
continue;
}
//
const TopoDS_Face& aF=(*(TopoDS_Face*)(&aSI.Shape()));
//
if (!mySplits.IsBound(aF)) {
const TopoDS_Shape& aF = aSI.Shape();
const TopTools_ListOfShape* pLFIm = myImages.Seek(aF);
if (!pLFIm)
continue;
}
//
// 1.
aLIAV.Clear();
// Find vertices to add as internal into the splits
TColStd_ListOfInteger aLIAV;
myDS->AloneVertices(i, aLIAV);
aLFIm.Clear();
//
const BOPCol_ListOfShape& aLSp=mySplits.Find(aF);
aItLS.Initialize(aLSp);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Face& aFSp=(*(TopoDS_Face*)(&aItLS.Value()));
if (!myShapesSD.IsBound(aFSp)) {
aLFIm.Append(aFSp);
}
else {
aFSD=(*(TopoDS_Face*)(&myShapesSD.Find(aFSp)));
iSense=BOPTools_AlgoTools::Sense(aFSp, aFSD, myContext);
if (iSense<0) {
aFSD.Reverse();
}
aLFIm.Append(aFSD);
}
}
//
//FillInternalVertices(aLFIm, aLIAV);
//
myImages.Bind(aF, aLFIm);
//
// 2. fill myOrigins
aItLS.Initialize(aLFIm);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Face& aFSp=(*(TopoDS_Face*)(&aItLS.Value()));
//
BOPCol_ListOfShape* pLOr = myOrigins.ChangeSeek(aFSp);
if (!pLOr) {
pLOr = myOrigins.Bound(aFSp, BOPCol_ListOfShape());
}
pLOr->Append(aF);
}
//
// 3.
aItV.Initialize(aLIAV);
for (; aItV.More(); aItV.Next()) {
nVx=aItV.Value();
aVx=(*(TopoDS_Vertex*)(&myDS->Shape(nVx)));
aVx.Orientation(TopAbs_INTERNAL);
//
aItF.Initialize(aLFIm);
for (; aItF.More(); aItF.Next()) {
TopoDS_Face& aFy=(*(TopoDS_Face*)(&aItF.Value()));
//
BOPAlgo_VFI& aVFI=aVVFI.Append1();
aVFI.SetVertex(aVx);
aVFI.SetFace(aFy);
// Add vertices and faces for classification
TColStd_ListIteratorOfListOfInteger aItLV(aLIAV);
for (; aItLV.More(); aItLV.Next())
{
TopoDS_Vertex aV = TopoDS::Vertex(myDS->Shape(aItLV.Value()));
aV.Orientation(TopAbs_INTERNAL);
TopTools_ListIteratorOfListOfShape aItLFIm(*pLFIm);
for (; aItLFIm.More(); aItLFIm.Next())
{
const TopoDS_Face& aFIm = TopoDS::Face(aItLFIm.Value());
// Make the pair
BOPAlgo_VFI& aVFI = aVVFI.Appended();
aVFI.SetVertex(aV);
aVFI.SetFace(aFIm);
aVFI.SetFuzzyValue(myFuzzyValue);
aVFI.SetProgressIndicator(myProgressIndicator);
}
}
}// for (i=0; i<aNbS; ++i) {
//
// 4.
aNbVFI=aVVFI.Extent();
}
// Perform classification
//================================================================
BOPAlgo_VFICnt::Perform(myRunParallel, aVVFI, myContext);
//================================================================
//
for (i=0; i < aNbVFI; ++i) {
BOPAlgo_VFI& aVFI=aVVFI(i);
//
iFlag=aVFI.Flag();
if (!iFlag) {
TopoDS_Vertex& aVertex=aVFI.Vertex();
TopoDS_Face& aFy=aVFI.Face();
aBB.Add(aFy, aVertex);
Standard_Integer aNbVFI = aVVFI.Length();
for (Standard_Integer i = 0; i < aNbVFI; ++i)
{
BOPAlgo_VFI& aVFI = aVVFI(i);
if (aVFI.IsInternal())
{
TopoDS_Vertex& aV = aVFI.Vertex();
TopoDS_Face& aF = aVFI.Face();
BRep_Builder().Add(aF, aV);
}
}
}
//=======================================================================
//function :HasPaveBlocksOnIn
//purpose :
//function : BuildDraftFace
//purpose : Build draft faces, updating the bounding edges,
// according to the information stored into the <theImages> map
//=======================================================================
Standard_Boolean HasPaveBlocksOnIn(const BOPDS_FaceInfo& aFI1,
const BOPDS_FaceInfo& aFI2)
TopoDS_Face BuildDraftFace(const TopoDS_Face& theFace,
const TopTools_DataMapOfShapeListOfShape& theImages,
Handle(IntTools_Context)& theCtx)
{
Standard_Boolean bRet;
Standard_Integer i, aNbPB;
//
bRet=Standard_False;
const BOPDS_IndexedMapOfPaveBlock& aMPBOn1 = aFI1.PaveBlocksOn();
const BOPDS_IndexedMapOfPaveBlock& aMPBIn1 = aFI1.PaveBlocksIn();
//
const BOPDS_IndexedMapOfPaveBlock& aMPBOn2 = aFI2.PaveBlocksOn();
aNbPB = aMPBOn2.Extent();
for (i = 1; i <= aNbPB; ++i) {
const Handle(BOPDS_PaveBlock)& aPB = aMPBOn2(i);
bRet = aMPBOn1.Contains(aPB) || aMPBIn1.Contains(aPB);
if (bRet) {
return bRet;
BRep_Builder aBB;
// Take the information from the original face
TopLoc_Location aLoc;
const Handle(Geom_Surface)& aS = BRep_Tool::Surface(theFace, aLoc);
const Standard_Real aTol = BRep_Tool::Tolerance(theFace);
// Make the new face, without any wires
TopoDS_Face aDraftFace;
aBB.MakeFace(aDraftFace, aS, aLoc, aTol);
// Update wires of the original face and add them to draft face
TopoDS_Iterator aItW(theFace.Oriented(TopAbs_FORWARD));
for (; aItW.More(); aItW.Next())
{
const TopoDS_Shape& aW = aItW.Value();
if (aW.ShapeType() != TopAbs_WIRE)
continue;
// Rebuild wire using images of edges
TopoDS_Iterator aItE(aW.Oriented(TopAbs_FORWARD));
if (!aItE.More())
continue;
TopoDS_Wire aNewWire;
aBB.MakeWire(aNewWire);
for (; aItE.More(); aItE.Next())
{
const TopoDS_Edge& aE = TopoDS::Edge(aItE.Value());
TopAbs_Orientation anOriE = aE.Orientation();
if (anOriE == TopAbs_INTERNAL)
{
// The internal edges could split the original face on halves.
// Thus, use the BuilderFace algorithm to build the new face.
TopoDS_Face aNull;
return aNull;
}
const TopTools_ListOfShape* pLEIm = theImages.Seek(aE);
if (!pLEIm)
{
aBB.Add(aNewWire, aE);
continue;
}
// Check if the original edge is degenerated
Standard_Boolean bIsDegenerated = BRep_Tool::Degenerated(aE);
// Check if the original edge is closed on the face
Standard_Boolean bIsClosed = BRep_Tool::IsClosed(aE, theFace);
TopTools_ListIteratorOfListOfShape aItLEIm(*pLEIm);
for (; aItLEIm.More(); aItLEIm.Next())
{
TopoDS_Edge& aSp = TopoDS::Edge(aItLEIm.Value());
aSp.Orientation(anOriE);
if (bIsDegenerated)
{
aBB.Add(aNewWire, aSp);
continue;
}
// Check closeness of the split edge and if it is not
// make the second PCurve
if (bIsClosed && !BRep_Tool::IsClosed(aSp, theFace))
BOPTools_AlgoTools3D::DoSplitSEAMOnFace(aSp, theFace);
// Check if the split should be reversed
if (BOPTools_AlgoTools::IsSplitToReverse(aSp, aE, theCtx))
aSp.Reverse();
aBB.Add(aNewWire, aSp);
}
}
aNewWire.Orientation(aW.Orientation());
aNewWire.Closed(BRep_Tool::IsClosed(aNewWire));
aBB.Add(aDraftFace, aNewWire);
}
//
const BOPDS_IndexedMapOfPaveBlock& aMPBIn2 = aFI2.PaveBlocksIn();
aNbPB = aMPBIn2.Extent();
for (i = 1; i <= aNbPB; ++i) {
const Handle(BOPDS_PaveBlock)& aPB = aMPBIn2(i);
bRet = aMPBOn1.Contains(aPB) || aMPBIn1.Contains(aPB);
if (bRet) {
return bRet;
}
}
return bRet;
if (theFace.Orientation() == TopAbs_REVERSED)
aDraftFace.Reverse();
return aDraftFace;
}

File diff suppressed because it is too large Load Diff

View File

@@ -17,24 +17,127 @@
#include <BOPAlgo_Builder.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPDS_DS.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools3D.hxx>
#include <IntTools_Context.hxx>
#include <TopExp.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BOPAlgo_Builder::Generated
(const TopoDS_Shape&)
(const TopoDS_Shape& theS)
{
// The rules for Generated shapes are these:
// 1. The EDGE may be generated from the FACES as an intersection edge;
// 2. The VERTEX may be generated from the EDGES and FACES as an intersection vertex.
//
// The list of generated elements will contain only those which are contained
// in the result of the operation.
myHistShapes.Clear();
if (!myHasGenerated)
return myHistShapes;
if (theS.IsNull())
return myHistShapes;
// Only EDGES and FACES should be considered
TopAbs_ShapeEnum aType = theS.ShapeType();
if (aType != TopAbs_EDGE && aType != TopAbs_FACE)
// Wrong type
return myHistShapes;
// Check that DS contains the shape, i.e. it is from the arguments of the operation
Standard_Integer nS = myDS->Index(theS);
if (nS < 0)
// Unknown shape
return myHistShapes;
// Check that the shape has participated in any intersections
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(nS);
if (!aSI.HasReference())
// Untouched shape
return myHistShapes;
// Analyze all types of Interferences which can produce
// new vertices - Edge/Edge and Edge/Face
BOPDS_VectorOfInterfEE& aEEs = myDS->InterfEE();
BOPDS_VectorOfInterfEF& aEFs = myDS->InterfEF();
// Fence map to avoid duplicates in the list of Generated;
TColStd_MapOfInteger aMFence;
// Analyze each interference and find those in which the given shape has participated
// No need to analyze Edge/Edge interferences for the shapes of type FACE
Standard_Boolean isFace = (aType == TopAbs_FACE);
for (Standard_Integer k = (isFace ? 1 : 0); k < 2; ++k)
{
Standard_Integer aNbLines = !k ? aEEs.Length() : aEFs.Length();
for (Standard_Integer i = 0; i < aNbLines; ++i)
{
BOPDS_Interf *aInt = !k ? (BOPDS_Interf*)(&aEEs(i)) : (BOPDS_Interf*)(&aEFs(i));
if (!aInt->HasIndexNew())
// No new vertices created
continue;
if (!aInt->Contains(nS))
continue;
Standard_Integer nVNew = aInt->IndexNew();
myDS->HasShapeSD(nVNew, nVNew);
if (!aMFence.Add(nVNew))
continue;
// Get the new vertex
const TopoDS_Shape& aVNew = myDS->Shape(nVNew);
// Check that the result shape contains vertex
if (myMapShape.Contains(aVNew))
// Save the vertex as generated
myHistShapes.Append(aVNew);
}
}
if (!isFace)
return myHistShapes;
// For the FACE it is also necessary to collect all
// section elements created in FACE/FACE interferences.
// This information is available in the FaceInfo structure.
const BOPDS_FaceInfo& aFI = myDS->FaceInfo(nS);
// Section edges of the face
const BOPDS_IndexedMapOfPaveBlock& aMPBSc = aFI.PaveBlocksSc();
// Save section edges contained in the result shape
Standard_Integer aNb = aMPBSc.Extent();
for (Standard_Integer i = 1; i <= aNb; ++i)
{
const TopoDS_Shape& aENew = myDS->Shape(aMPBSc(i)->Edge());
if (myMapShape.Contains(aENew))
myHistShapes.Append(aENew);
}
// Section vertices of the face
const TColStd_MapOfInteger& aMVSc = aFI.VerticesSc();
// Save section vertices contained in the result shape
TColStd_MapOfInteger::Iterator aItM(aMVSc);
for (; aItM.More(); aItM.Next())
{
const TopoDS_Shape& aVNew = myDS->Shape(aItM.Value());
if (myMapShape.Contains(aVNew))
myHistShapes.Append(aVNew);
}
return myHistShapes;
}
//=======================================================================
@@ -44,99 +147,59 @@ const TopTools_ListOfShape& BOPAlgo_Builder::Generated
const TopTools_ListOfShape& BOPAlgo_Builder::Modified
(const TopoDS_Shape& theS)
{
Standard_Boolean bHasImage, bToReverse;
TopAbs_ShapeEnum aType;
BOPCol_ListIteratorOfListOfShape aIt;
//
myHistShapes.Clear();
//
if (theS.IsNull()) {
if (!myHasModified)
// No modified elements
return myHistShapes;
}
//
bHasImage=myImages.IsBound(theS);
if (!bHasImage) {
const TopTools_ListOfShape* pLSp = myImagesResult.Seek(theS);
if (!pLSp)
// No track in the result -> no modified
return myHistShapes;
// For modification check if the shape is not linked to itself
if (pLSp->Extent() == 1)
{
if (theS.IsSame(pLSp->First()) && !myImages.IsBound(theS))
// Shape is not modified
return myHistShapes;
}
//
aType=theS.ShapeType();
//
if (!(aType==TopAbs_EDGE || aType==TopAbs_FACE ||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID)) {
return myHistShapes;
}
//
//PrepareHistory();
//
const BOPCol_ListOfShape& aLSp=myImages.Find(theS);
aIt.Initialize(aLSp);
for (; aIt.More(); aIt.Next()) {
TopoDS_Shape aSp=aIt.Value();
if (myShapesSD.IsBound(aSp)) {
aSp = myShapesSD.Find(aSp);
}
//
if (myMapShape.Contains(aSp)) {
//
if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
aSp.Orientation(theS.Orientation());
}
else {
bToReverse=
BOPTools_AlgoTools::IsSplitToReverse(aSp, theS, myContext);
if (bToReverse) {
aSp.Reverse();
}
}
//
myHistShapes.Append(aSp);
}
// Iterate on all splits and save them with proper orientation into the result list
TopTools_ListIteratorOfListOfShape aIt(*pLSp);
for (; aIt.More(); aIt.Next())
{
TopoDS_Shape aSp = aIt.Value();
// Use the orientation of the input shape
TopAbs_ShapeEnum aType = aSp.ShapeType();
if (aType == TopAbs_VERTEX || aType == TopAbs_SOLID)
aSp.Orientation(theS.Orientation());
else if (BOPTools_AlgoTools::IsSplitToReverse(aSp, theS, myContext))
aSp.Reverse();
myHistShapes.Append(aSp);
}
//
return myHistShapes;
}
//=======================================================================
//function : IsDeleted
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_Builder::IsDeleted
(const TopoDS_Shape& theS)
Standard_Boolean BOPAlgo_Builder::IsDeleted(const TopoDS_Shape& theS)
{
Standard_Boolean bRet;
TopAbs_ShapeEnum aType;
BOPCol_ListIteratorOfListOfShape aIt;
//
bRet = Standard_True;
//
if (theS.IsNull()) {
return bRet;
}
//
aType = theS.ShapeType();
if (!(aType==TopAbs_EDGE || aType==TopAbs_FACE ||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID)) {
return bRet;
}
//
if (!myImages.IsBound(theS)) {
bRet = !myMapShape.Contains(theS);
return bRet;
}
//
const BOPCol_ListOfShape& aLSp = myImages.Find(theS);
aIt.Initialize(aLSp);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSp = aIt.Value();
const TopoDS_Shape& aSpR = myShapesSD.IsBound(aSp) ?
myShapesSD.Find(aSp) : aSp;
//
if (myMapShape.Contains(aSpR)) {
bRet = Standard_False;
break;
}
}
//
return bRet;
// The shape is considered as Deleted if the result shape
// does not contain the shape itself and none of its splits
return myHasDeleted && !myImagesResult.Contains(theS);
}
//=======================================================================
//function : LocModified
//purpose :
//=======================================================================
const TopTools_ListOfShape* BOPAlgo_Builder::LocModified(const TopoDS_Shape& theS)
{
return myImages.Seek(theS);
}
//=======================================================================
//function : PrepareHistory
@@ -144,85 +207,100 @@ Standard_Boolean BOPAlgo_Builder::IsDeleted
//=======================================================================
void BOPAlgo_Builder::PrepareHistory()
{
if (!myFlagHistory) {
if (!myFlagHistory)
{
// Clearing
BOPAlgo_BuilderShape::PrepareHistory();
return;
}
//
if(myShape.IsNull()) {
return;
}
//
Standard_Boolean bHasImage;
TopAbs_ShapeEnum aType;
BOPCol_MapOfShape aMS;
BOPCol_ListIteratorOfListOfShape aIt;
BOPCol_MapIteratorOfMapOfShape aItM;
//
// 1. Clearing
// Clearing from previous operations
BOPAlgo_BuilderShape::PrepareHistory();
//
// 2. myMapShape - all shapes of result with theirs sub-shapes
BOPTools::MapShapes(myShape, myMapShape);
//
// 3. MS - all argument shapes with theirs sub-shapes
const BOPCol_ListOfShape& aArguments=myDS->Arguments();
aIt.Initialize(aArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx=aIt.Value();
BOPTools::MapShapes(aSx, aMS);
myFlagHistory = Standard_True;
if (myShape.IsNull() ||
BOPTools_AlgoTools3D::IsEmptyShape(myShape))
{
// The result shape is a null shape or empty shape,
// thus, no modified, no generated, all deleted
myHasModified = Standard_False;
myHasGenerated = Standard_False;
myHasDeleted = Standard_True;
return;
}
//
// 4. Treatment
aItM.Initialize(aMS);
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aSx=aItM.Key();
aType = aSx.ShapeType();
if (!(aType == TopAbs_VERTEX || aType == TopAbs_EDGE ||
aType == TopAbs_FACE || aType == TopAbs_SOLID)) {
// Map the result shape
TopExp::MapShapes(myShape, myMapShape);
// Among all input shapes find those that have any trace in the result
// and save them into myImagesResult map with connection to parts
// kept in the result shape.
// Also, set the proper values to the history flags:
// - myHasDeleted for Deleted shapes;
// - myHasModified for Modified shapes;
// - myHasGenerated for Generated shapes.
Standard_Integer aNbS = myDS->NbSourceShapes();
for (Standard_Integer i = 0; i < aNbS; ++i)
{
const TopoDS_Shape& aS = myDS->Shape(i);
// History information is only available for the shapes of type
// VERTEX, EDGE, FACE and SOLID. Skip all shapes of different type.
TopAbs_ShapeEnum aType = aS.ShapeType();
if (!(aType == TopAbs_VERTEX ||
aType == TopAbs_EDGE ||
aType == TopAbs_FACE ||
aType == TopAbs_SOLID))
continue;
// Check if the shape has any splits
const TopTools_ListOfShape* pLSp = LocModified(aS);
if (!pLSp)
{
// No splits, check if the result shape contains the shape itself
if (myMapShape.Contains(aS))
// Shape has passed into result without modifications -> link the shape to itself
myImagesResult(myImagesResult.Add(aS, TopTools_ListOfShape())).Append(aS);
else
// No trace of the shape in the result -> Deleted element is found
myHasDeleted = Standard_True;
}
//
// 4.1 .myImagesResult
bHasImage=myImages.IsBound(aSx);
//
BOPCol_ListOfShape aLSx;
if (!bHasImage) {
if (myMapShape.Contains(aSx)) {
aLSx.Append(aSx);
myImagesResult.Add(aSx, aLSx);
}
}
else {
const BOPCol_ListOfShape& aLSp=myImages.Find(aSx);
aIt.Initialize(aLSp);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSp=aIt.Value();
if (myMapShape.Contains(aSp)) {
aLSx.Append(aSp);
else
{
// Find all splits of the shape which are kept in the result
TopTools_ListOfShape *pLSpKept = NULL;
TopTools_ListIteratorOfListOfShape aIt(*pLSp);
for (; aIt.More(); aIt.Next())
{
const TopoDS_Shape& aSp = aIt.Value();
// Check if the result shape contains the split
if (myMapShape.Contains(aSp))
{
if (!pLSpKept)
pLSpKept = &myImagesResult(myImagesResult.Add(aS, TopTools_ListOfShape()));
// Link the shape to the split
pLSpKept->Append(aSp);
}
}
myImagesResult.Add(aSx, aLSx);
}
// <- A
//
// 4.2 As it was
if (!myHasDeleted) {
myHasDeleted=IsDeleted(aSx);
}
//
if (!myHasModified && bHasImage) {
if (aType==TopAbs_EDGE || aType==TopAbs_FACE ||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
if (pLSpKept)
// Modified element is found
myHasModified = Standard_True;
}
else
// Deleted element is found
myHasDeleted = Standard_True;
}
//
if (!myHasGenerated) {
if (aType==TopAbs_FACE) {
const TopTools_ListOfShape& aLG = Generated(aSx);
myHasGenerated = aLG.Extent() > 0;
}
// Until first found, check if the shape has Generated elements
if (!myHasGenerated)
{
// Temporarily set the HasGenerated flag to TRUE to look for the shapes generated from aS.
// Otherwise, the method Generated will always be returning an empty list, assuming that the
// operation has no generated elements at all.
myHasGenerated = Standard_True;
myHasGenerated = (Generated(aS).Extent() > 0);
}
}
myFlagHistory=Standard_True;
}

View File

@@ -15,21 +15,17 @@
#include <BOPAlgo_CellsBuilder.hxx>
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
#include <TopExp_Explorer.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPDS_DS.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools3D.hxx>
#include <BRep_Builder.hxx>
#include <ShapeUpgrade_UnifySameDomain.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Compound.hxx>
static
@@ -39,6 +35,9 @@ static
void MakeTypedContainers(const TopoDS_Shape& theSC,
TopoDS_Shape& theResult);
static void CollectMaterialBoundaries(const TopTools_ListOfShape& theLS,
TopTools_MapOfShape& theMapKeepBnd);
//=======================================================================
//function : empty constructor
//purpose :
@@ -142,10 +141,10 @@ void BOPAlgo_CellsBuilder::IndexParts()
TopoDS_Compound anAllParts;
aBB.MakeCompound(anAllParts);
//
BOPCol_MapOfShape aMFence;
BOPCol_MapOfInteger aMDims;
TopTools_MapOfShape aMFence;
TColStd_MapOfInteger aMDims;
//
BOPCol_ListIteratorOfListOfShape aIt(myArguments);
TopTools_ListIteratorOfListOfShape aIt(myArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
//
@@ -156,11 +155,11 @@ void BOPAlgo_CellsBuilder::IndexParts()
TopExp_Explorer aExp(aS, aType);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aST = aExp.Current();
const BOPCol_ListOfShape* pLSIm = myImages.Seek(aST);
const TopTools_ListOfShape* pLSIm = myImages.Seek(aST);
if (!pLSIm) {
BOPCol_ListOfShape* pLS = myIndex.ChangeSeek(aST);
TopTools_ListOfShape* pLS = myIndex.ChangeSeek(aST);
if (!pLS) {
pLS = &myIndex(myIndex.Add(aST, BOPCol_ListOfShape()));
pLS = &myIndex(myIndex.Add(aST, TopTools_ListOfShape()));
}
pLS->Append(aS);
//
@@ -171,13 +170,13 @@ void BOPAlgo_CellsBuilder::IndexParts()
continue;
}
//
BOPCol_ListIteratorOfListOfShape aItIm(*pLSIm);
TopTools_ListIteratorOfListOfShape aItIm(*pLSIm);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aSTIm = aItIm.Value();
//
BOPCol_ListOfShape* pLS = myIndex.ChangeSeek(aSTIm);
TopTools_ListOfShape* pLS = myIndex.ChangeSeek(aSTIm);
if (!pLS) {
pLS = &myIndex(myIndex.Add(aSTIm, BOPCol_ListOfShape()));
pLS = &myIndex(myIndex.Add(aSTIm, TopTools_ListOfShape()));
}
pLS->Append(aS);
//
@@ -203,7 +202,7 @@ void BOPAlgo_CellsBuilder::IndexParts()
const TopTools_ListOfShape& aLSOr = myIndex(i);
//
Standard_Integer iType = BOPTools_AlgoTools::Dimension(aSP);
BOPCol_MapIteratorOfMapOfInteger aItM(aMDims);
TColStd_MapIteratorOfMapOfInteger aItM(aMDims);
for (; aItM.More(); aItM.Next()) {
Standard_Integer k = aItM.Value();
if (k >= iType) {
@@ -213,17 +212,17 @@ void BOPAlgo_CellsBuilder::IndexParts()
TopExp_Explorer aExp(aSP, TypeToExplore(k));
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aSS = aExp.Current();
BOPCol_ListOfShape* pLSSOr = myIndex.ChangeSeek(aSS);
TopTools_ListOfShape* pLSSOr = myIndex.ChangeSeek(aSS);
if (!pLSSOr) {
myIndex.Add(aSS, aLSOr);
continue;
}
// add ancestors of the shape to the ancestors of the sub-shape
BOPCol_ListIteratorOfListOfShape aItLS(aLSOr);
TopTools_ListIteratorOfListOfShape aItLS(aLSOr);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSOr = aItLS.Value();
// provide uniqueness of the ancestors
BOPCol_ListIteratorOfListOfShape aItLSS(*pLSSOr);
TopTools_ListIteratorOfListOfShape aItLSS(*pLSSOr);
for (; aItLSS.More(); aItLSS.Next()) {
if (aSOr.IsSame(aItLSS.Value())) {
break;
@@ -243,20 +242,20 @@ void BOPAlgo_CellsBuilder::IndexParts()
//function : AddToResult
//purpose :
//=======================================================================
void BOPAlgo_CellsBuilder::AddToResult(const BOPCol_ListOfShape& theLSToTake,
const BOPCol_ListOfShape& theLSToAvoid,
void BOPAlgo_CellsBuilder::AddToResult(const TopTools_ListOfShape& theLSToTake,
const TopTools_ListOfShape& theLSToAvoid,
const Standard_Integer theMaterial,
const Standard_Boolean theUpdate)
{
// find parts
BOPCol_ListOfShape aParts;
TopTools_ListOfShape aParts;
FindParts(theLSToTake, theLSToAvoid, aParts);
if (aParts.IsEmpty()) {
return;
}
//
// collect result parts to avoid multiple adding of the same parts
BOPCol_MapOfShape aResParts;
TopTools_MapOfShape aResParts;
TopoDS_Iterator aIt(myShape);
for (; aIt.More(); aIt.Next()) {
aResParts.Add(aIt.Value());
@@ -264,10 +263,11 @@ void BOPAlgo_CellsBuilder::AddToResult(const BOPCol_ListOfShape& theLSToTake,
//
Standard_Boolean bChanged = Standard_False;
// add parts to result
BOPCol_ListIteratorOfListOfShape aItLP(aParts);
TopTools_ListIteratorOfListOfShape aItLP(aParts);
for (; aItLP.More(); aItLP.Next()) {
const TopoDS_Shape& aPart = aItLP.Value();
if (aResParts.Add(aPart)) {
// provide uniqueness of the parts
if (aResParts.Add(aPart) && !myShapeMaterial.IsBound(aPart)) {
BRep_Builder().Add(myShape, aPart);
bChanged = Standard_True;
}
@@ -275,7 +275,7 @@ void BOPAlgo_CellsBuilder::AddToResult(const BOPCol_ListOfShape& theLSToTake,
//
// update the material
if (theMaterial != 0) {
BOPCol_ListOfShape aLSP;
TopTools_ListOfShape aLSP;
aItLP.Initialize(aParts);
for (; aItLP.More(); aItLP.Next()) {
const TopoDS_Shape& aPart = aItLP.Value();
@@ -286,9 +286,9 @@ void BOPAlgo_CellsBuilder::AddToResult(const BOPCol_ListOfShape& theLSToTake,
} // for (; aIt.More(); aIt.Next()) {
//
if (aLSP.Extent()) {
BOPCol_ListOfShape* pLS = myMaterials.ChangeSeek(theMaterial);
TopTools_ListOfShape* pLS = myMaterials.ChangeSeek(theMaterial);
if (!pLS) {
pLS = myMaterials.Bound(theMaterial, BOPCol_ListOfShape());
pLS = myMaterials.Bound(theMaterial, TopTools_ListOfShape());
}
pLS->Append(aLSP);
} // if (aLSP.Extent()) {
@@ -318,7 +318,7 @@ void BOPAlgo_CellsBuilder::AddAllToResult(const Standard_Integer theMaterial,
myShape = myAllParts;
//
if (theMaterial != 0) {
BOPCol_ListOfShape* pLSM = myMaterials.Bound(theMaterial, BOPCol_ListOfShape());
TopTools_ListOfShape* pLSM = myMaterials.Bound(theMaterial, TopTools_ListOfShape());
//
TopoDS_Iterator aIt(myAllParts);
for (; aIt.More(); aIt.Next()) {
@@ -340,28 +340,28 @@ void BOPAlgo_CellsBuilder::AddAllToResult(const Standard_Integer theMaterial,
//function : RemoveFromResult
//purpose :
//=======================================================================
void BOPAlgo_CellsBuilder::RemoveFromResult(const BOPCol_ListOfShape& theLSToTake,
const BOPCol_ListOfShape& theLSToAvoid)
void BOPAlgo_CellsBuilder::RemoveFromResult(const TopTools_ListOfShape& theLSToTake,
const TopTools_ListOfShape& theLSToAvoid)
{
// find parts
BOPCol_ListOfShape aParts;
TopTools_ListOfShape aParts;
FindParts(theLSToTake, theLSToAvoid, aParts);
if (aParts.IsEmpty()) {
return;
}
//
// collect parts into the map and remove parts from materials
BOPCol_MapOfShape aPartsToRemove;
BOPCol_ListIteratorOfListOfShape aItP(aParts);
TopTools_MapOfShape aPartsToRemove;
TopTools_ListIteratorOfListOfShape aItP(aParts);
for (; aItP.More(); aItP.Next()) {
const TopoDS_Shape& aPart = aItP.Value();
aPartsToRemove.Add(aPart);
//
const Standard_Integer* pMaterial = myShapeMaterial.Seek(aPart);
if (pMaterial) {
BOPCol_ListOfShape* pLSM = myMaterials.ChangeSeek(*pMaterial);
TopTools_ListOfShape* pLSM = myMaterials.ChangeSeek(*pMaterial);
if (pLSM) {
BOPCol_ListIteratorOfListOfShape aItM(*pLSM);
TopTools_ListIteratorOfListOfShape aItM(*pLSM);
for (; aItM.More(); aItM.Next()) {
if (aPart.IsSame(aItM.Value())) {
pLSM->Remove(aItM);
@@ -458,10 +458,12 @@ void BOPAlgo_CellsBuilder::RemoveInternalBoundaries()
Standard_Boolean bChanged = Standard_False;
// try to remove the internal boundaries between the
// shapes of the same material
BOPCol_DataMapIteratorOfDataMapOfIntegerListOfShape aItM(myMaterials);
TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape aItM(myMaterials);
TopTools_ListOfShape aLSUnify[2];
TopTools_MapOfShape aKeepMap[2];
for (; aItM.More(); aItM.Next()) {
Standard_Integer iMaterial = aItM.Key();
BOPCol_ListOfShape& aLS = aItM.ChangeValue();
TopTools_ListOfShape& aLS = aItM.ChangeValue();
//
if (aLS.IsEmpty()) {
continue;
@@ -478,41 +480,72 @@ void BOPAlgo_CellsBuilder::RemoveInternalBoundaries()
}
//
// check the shapes of the same material to be of the same type
BOPCol_ListIteratorOfListOfShape aItLS(aLS);
TopTools_ListIteratorOfListOfShape aItLS(aLS);
TopAbs_ShapeEnum aType = aItLS.Value().ShapeType();
for (aItLS.Next(); aItLS.More(); aItLS.Next()) {
if (aType != aItLS.Value().ShapeType()) {
break;
}
}
//
BOPCol_ListOfShape aLSNew;
if (aItLS.More()) {
if (aItLS.More())
{
// add the warning
TopoDS_Compound aMultiDimS;
aBB.MakeCompound(aMultiDimS);
aBB.Add(aMultiDimS, aLS.First());
aBB.Add(aMultiDimS, aItLS.Value());
AddWarning(new BOPAlgo_AlertRemovalOfIBForMDimShapes(aMultiDimS));
}
else
{
if (aType == TopAbs_EDGE || aType == TopAbs_FACE)
{
TopoDS_Compound aMultiDimS;
aBB.MakeCompound(aMultiDimS);
aBB.Add(aMultiDimS, aLS.First());
aBB.Add(aMultiDimS, aItLS.Value());
//
AddWarning (new BOPAlgo_AlertRemovalOfIBForMDimShapes (aMultiDimS));
// for edges and faces, just collect shapes to unify them later after exiting the loop;
// collect boundaries of shapes of current material in the keep map
Standard_Integer iType = (aType == TopAbs_EDGE ? 0 : 1);
CollectMaterialBoundaries(aLS, aKeepMap[iType]);
// save shapes to unify later
TopTools_ListOfShape aCopy(aLS);
aLSUnify[iType].Append(aCopy);
continue;
}
aLSNew.Assign(aLS);
}
else {
if (RemoveInternals(aLS, aLSNew)) {
bChanged = Standard_True;
else
{
// aType is Solid;
// remove internal faces between solids of the same material just now
TopTools_ListOfShape aLSNew;
if (RemoveInternals(aLS, aLSNew))
{
bChanged = Standard_True;
// update materials maps
for (aItLS.Initialize(aLSNew); aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS = aItLS.Value();
myShapeMaterial.Bind(aS, iMaterial);
}
aLS.Assign(aLSNew);
}
}
}
//
// update materials maps and add new shapes to result
aItLS.Initialize(aLSNew);
for (; aItLS.More(); aItLS.Next()) {
// add shapes to result (multidimensional and solids)
for (aItLS.Initialize(aLS); aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS = aItLS.Value();
aBB.Add(aResult, aS);
}
}
// remove internal boundaries for edges and faces
for (Standard_Integer iType = 0; iType < 2; ++iType)
{
if (aLSUnify[iType].IsEmpty())
continue;
TopTools_ListOfShape aLSN;
if (RemoveInternals(aLSUnify[iType], aLSN, aKeepMap[iType]))
bChanged = Standard_True;
// add shapes to result ([unified] edges or faces)
for (TopTools_ListIteratorOfListOfShape aItLS(aLSN); aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS = aItLS.Value();
aBB.Add(aResult, aS);
if (!myShapeMaterial.IsBound(aS)) {
myShapeMaterial.Bind(aS, iMaterial);
}
}
}
//
@@ -573,24 +606,24 @@ void BOPAlgo_CellsBuilder::RemoveInternalBoundaries()
//function : FindPart
//purpose :
//=======================================================================
void BOPAlgo_CellsBuilder::FindParts(const BOPCol_ListOfShape& theLSToTake,
const BOPCol_ListOfShape& theLSToAvoid,
BOPCol_ListOfShape& theParts)
void BOPAlgo_CellsBuilder::FindParts(const TopTools_ListOfShape& theLSToTake,
const TopTools_ListOfShape& theLSToAvoid,
TopTools_ListOfShape& theParts)
{
if (theLSToTake.IsEmpty()) {
return;
}
//
// map shapes to avoid
BOPCol_MapOfShape aMSToAvoid;
BOPCol_ListIteratorOfListOfShape aItArgs(theLSToAvoid);
TopTools_MapOfShape aMSToAvoid;
TopTools_ListIteratorOfListOfShape aItArgs(theLSToAvoid);
for (; aItArgs.More(); aItArgs.Next()) {
const TopoDS_Shape& aS = aItArgs.Value();
aMSToAvoid.Add(aS);
}
//
// map shapes to be taken
BOPCol_MapOfShape aMSToTake;
TopTools_MapOfShape aMSToTake;
aItArgs.Initialize(theLSToTake);
for (; aItArgs.More(); aItArgs.Next()) {
const TopoDS_Shape& aS = aItArgs.Value();
@@ -621,14 +654,14 @@ void BOPAlgo_CellsBuilder::FindParts(const BOPCol_ListOfShape& theLSToTake,
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aST = aExp.Current();
// get split parts of the shape
BOPCol_ListOfShape aLSTIm;
TopTools_ListOfShape aLSTIm;
if (!myImages.IsBound(aST)) {
aLSTIm.Append(aST);
} else {
aLSTIm = myImages.Find(aST);
}
//
BOPCol_ListIteratorOfListOfShape aItIm(aLSTIm);
TopTools_ListIteratorOfListOfShape aItIm(aLSTIm);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aPart = aItIm.Value();
//
@@ -637,13 +670,13 @@ void BOPAlgo_CellsBuilder::FindParts(const BOPCol_ListOfShape& theLSToTake,
}
//
// get input shapes in which the split part is contained
const BOPCol_ListOfShape& aLS = myIndex.FindFromKey(aPart);
const TopTools_ListOfShape& aLS = myIndex.FindFromKey(aPart);
if (aLS.Extent() < aNbS) {
continue;
}
//
// check that input shapes containing the part should not be avoided
BOPCol_MapOfShape aMS;
TopTools_MapOfShape aMS;
aItArgs.Initialize(aLS);
for (; aItArgs.More(); aItArgs.Next()) {
const TopoDS_Shape& aS = aItArgs.Value();
@@ -683,7 +716,7 @@ void BOPAlgo_CellsBuilder::MakeContainers()
aBB.MakeCompound(aResult);
//
// basic elements of type EDGE, FACE and SOLID added into result
BOPCol_ListOfShape aLS[3];
TopTools_ListOfShape aLS[3];
//
TopoDS_Iterator aIt(myShape);
for (; aIt.More(); aIt.Next()) {
@@ -705,7 +738,7 @@ void BOPAlgo_CellsBuilder::MakeContainers()
//
TopoDS_Compound aC;
aBB.MakeCompound(aC);
BOPCol_ListIteratorOfListOfShape aItLS(aLS[i]);
TopTools_ListIteratorOfListOfShape aItLS(aLS[i]);
for (; aItLS.More(); aItLS.Next()) {
aBB.Add(aC, aItLS.Value());
}
@@ -719,8 +752,9 @@ void BOPAlgo_CellsBuilder::MakeContainers()
//function : RemoveInternals
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape& theLS,
BOPCol_ListOfShape& theLSNew)
Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const TopTools_ListOfShape& theLS,
TopTools_ListOfShape& theLSNew,
const TopTools_MapOfShape& theMapKeepBnd)
{
Standard_Boolean bRemoved = Standard_False;
if (theLS.Extent() < 2) {
@@ -740,7 +774,7 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
BOPTools_AlgoTools::MakeContainer
((aType == TopAbs_FACE) ? TopAbs_SHELL : TopAbs_WIRE, aShape);
//
for (BOPCol_ListIteratorOfListOfShape aIt(theLS); aIt.More(); aIt.Next()) {
for (TopTools_ListIteratorOfListOfShape aIt(theLS); aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
aBB.Add(aShape, aS);
}
@@ -750,8 +784,8 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
//
bFaces = (aType == TopAbs_FACE);
bEdges = (aType == TopAbs_EDGE);
//
ShapeUpgrade_UnifySameDomain anUnify (aShape, bEdges, bFaces);
anUnify.KeepShapes(theMapKeepBnd);
anUnify.Build();
const TopoDS_Shape& aSNew = anUnify.Shape();
//
@@ -773,24 +807,25 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
}
//
// fill map of modified shapes
BOPCol_IndexedMapOfShape aMG;
TopTools_IndexedMapOfShape aMG;
Standard_Integer i, aNb;
//
BOPTools::MapShapes(aShape, TopAbs_VERTEX, aMG);
BOPTools::MapShapes(aShape, TopAbs_EDGE, aMG);
BOPTools::MapShapes(aShape, TopAbs_FACE, aMG);
TopExp::MapShapes(aShape, TopAbs_VERTEX, aMG);
TopExp::MapShapes(aShape, TopAbs_EDGE, aMG);
TopExp::MapShapes(aShape, TopAbs_FACE, aMG);
//
aNb = aMG.Extent();
for (i = 1; i <= aNb; ++i) {
const TopoDS_Shape& aSS = aMG(i);
const Standard_Integer* pMaterial = myShapeMaterial.Seek(aSS);
const TopTools_ListOfShape& aLSMod = anUnify.History()->Modified(aSS);
TopTools_ListIteratorOfListOfShape aIt(aLSMod);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSU = aIt.Value();
if (!aSU.IsNull() && !aSS.IsSame(aSU)) {
myMapModified.Bind(aSS, aSU);
bRemoved = Standard_True;
}
myMapModified.Bind(aSS, aSU);
bRemoved = Standard_True;
if (pMaterial && !myShapeMaterial.IsBound(aSU))
myShapeMaterial.Bind(aSU, *pMaterial);
}
}
}
@@ -799,7 +834,7 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
TopoDS_Compound aSolids;
aBB.MakeCompound(aSolids);
//
BOPCol_ListIteratorOfListOfShape aItLS(theLS);
TopTools_ListIteratorOfListOfShape aItLS(theLS);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSol = aItLS.Value();
aBB.Add(aSolids, aSol);
@@ -807,18 +842,18 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
//
// Make connexity blocks of solids to create from each isolated block one solid.
// It will allow attaching internal entities of the solids to new solid.
BOPCol_ListOfShape aLCB;
TopTools_ListOfShape aLCB;
BOPTools_AlgoTools::MakeConnexityBlocks(aSolids, TopAbs_FACE, TopAbs_SOLID, aLCB);
//
// for each block remove internal faces
BOPCol_ListIteratorOfListOfShape aItLCB(aLCB);
TopTools_ListIteratorOfListOfShape aItLCB(aLCB);
for (; aItLCB.More(); aItLCB.Next()) {
const TopoDS_Shape& aCB = aItLCB.Value();
//
// Map faces and solids to find boundary faces that can be removed
BOPCol_IndexedDataMapOfShapeListOfShape aDMFS;
TopTools_IndexedDataMapOfShapeListOfShape aDMFS;
// internal entities
BOPCol_ListOfShape aLSInt;
TopTools_ListOfShape aLSInt;
//
TopoDS_Iterator aItS(aCB);
for (; aItS.More(); aItS.Next()) {
@@ -834,9 +869,9 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
TopoDS_Iterator aItF(aSI);
for (; aItF.More(); aItF.Next()) {
const TopoDS_Shape& aF = aItF.Value();
BOPCol_ListOfShape *pLSols = aDMFS.ChangeSeek(aF);
TopTools_ListOfShape *pLSols = aDMFS.ChangeSeek(aF);
if (!pLSols) {
pLSols = &aDMFS(aDMFS.Add(aF, BOPCol_ListOfShape()));
pLSols = &aDMFS(aDMFS.Add(aF, TopTools_ListOfShape()));
}
pLSols->Append(aSol);
}
@@ -845,7 +880,7 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
}
//
// to build unified solid, select only faces attached to only one solid
BOPCol_ListOfShape aLFUnique;
TopTools_ListOfShape aLFUnique;
Standard_Integer i, aNb = aDMFS.Extent();
for (i = 1; i <= aNb; ++i) {
if (aDMFS(i).Extent() == 1) {
@@ -872,7 +907,7 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
{
TopoDS_Compound aUniqeFaces;
aBB.MakeCompound(aUniqeFaces);
BOPCol_ListIteratorOfListOfShape aItLFUniqe(aLFUnique);
TopTools_ListIteratorOfListOfShape aItLFUniqe(aLFUnique);
for (; aItLFUniqe.More(); aItLFUniqe.Next()) {
aBB.Add(aUniqeFaces, aItLFUniqe.Value());
}
@@ -887,11 +922,13 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
continue;
}
//
myReport->Merge(aBS.GetReport());
//
TopoDS_Solid& aSNew = *(TopoDS_Solid*)&aBS.Areas().First();
//
// put all internal parts into new solid
aSNew.Free(Standard_True);
BOPCol_ListIteratorOfListOfShape aItLSI(aLSInt);
TopTools_ListIteratorOfListOfShape aItLSI(aLSInt);
for (; aItLSI.More(); aItLSI.Next()) {
aBB.Add(aSNew, aItLSI.Value());
}
@@ -899,118 +936,54 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
//
theLSNew.Append(aSNew);
bRemoved = Standard_True;
// Save information about the fuse of the solids into a history map
aItS.Initialize(aCB);
for (; aItS.More(); aItS.Next())
myMapModified.Bind(aItS.Value(), aSNew);
}
}
return bRemoved;
}
//=======================================================================
//function : IsDeleted
//function : LocModified
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_CellsBuilder::IsDeleted(const TopoDS_Shape& theS)
const TopTools_ListOfShape* BOPAlgo_CellsBuilder::LocModified(const TopoDS_Shape& theS)
{
Standard_Boolean bRet = Standard_True;
if (theS.IsNull()) {
return bRet;
}
//
TopAbs_ShapeEnum aType = theS.ShapeType();
if (!(aType==TopAbs_EDGE || aType==TopAbs_FACE ||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID)) {
return bRet;
}
//
Standard_Boolean bHasImage, bHasModified;
//
bHasImage = myImages.IsBound(theS);
bHasModified = myMapModified.IsBound(theS);
if (!bHasImage && !bHasModified) {
bRet = !myMapShape.Contains(theS);
return bRet;
}
//
if (bHasModified) {
const TopoDS_Shape& aSG = myMapModified.Find(theS);
if (myMapShape.Contains(aSG)) {
bRet = Standard_False;
return bRet;
}
}
//
if (bHasImage) {
const BOPCol_ListOfShape& aLSp = myImages.Find(theS);
BOPCol_ListIteratorOfListOfShape aIt(aLSp);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSp = aIt.Value();
const TopoDS_Shape& aSpR = myShapesSD.IsBound(aSp) ?
myShapesSD.Find(aSp) : aSp;
//
const TopoDS_Shape& aSpRG = myMapModified.IsBound(aSpR) ?
myMapModified.Find(aSpR) : aSpR;
if (myMapShape.Contains(aSpRG)) {
bRet = Standard_False;
break;
}
}
}
//
return bRet;
}
// Get shape's modification coming from GF operation
const TopTools_ListOfShape* pLSp = BOPAlgo_Builder::LocModified(theS);
if (myMapModified.IsEmpty())
// No local modifications
return pLSp;
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BOPAlgo_CellsBuilder::Modified(const TopoDS_Shape& theS)
{
myHistShapes.Clear();
if (theS.IsNull()) {
return myHistShapes;
// Check if the shape (or its splits) has participated in unification
if (!pLSp)
{
// No splits from GF operation.
// Check if the shape has been unified with other shapes
const TopoDS_Shape* pSU = myMapModified.Seek(theS);
if (!pSU)
return NULL;
myHistShapes.Append(*pSU);
}
//
TopAbs_ShapeEnum aType = theS.ShapeType();
if (!(aType==TopAbs_EDGE || aType==TopAbs_FACE || aType==TopAbs_VERTEX)) {
return myHistShapes;
}
//
Standard_Boolean bHasModified = myMapModified.IsBound(theS);
if (bHasModified) {
const TopoDS_Shape& aSG = myMapModified.Find(theS);
if (myMapShape.Contains(aSG)) {
myHistShapes.Append(aSG);
}
return myHistShapes;
}
//
Standard_Boolean bHasImage = myImages.IsBound(theS);
if (!bHasImage) {
return myHistShapes;
}
//
BOPCol_MapOfShape aMFence;
const BOPCol_ListOfShape& aLSp = myImages.Find(theS);
BOPCol_ListIteratorOfListOfShape aIt(aLSp);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape aSp = aIt.Value();
const TopoDS_Shape& aSpR = myShapesSD.IsBound(aSp) ?
myShapesSD.Find(aSp) : aSp;
//
if (myMapModified.IsBound(aSpR)) {
const TopoDS_Shape& aSG = myMapModified.Find(aSpR);
if (myMapShape.Contains(aSG)) {
if (aMFence.Add(aSG)) {
myHistShapes.Append(aSG);
}
}
}
else if (aMFence.Add(aSpR))
else
{
// Process all GF splits and check them for local unification with other shapes
TopTools_ListIteratorOfListOfShape aIt(*pLSp);
for (; aIt.More(); aIt.Next())
{
myHistShapes.Append(aSpR);
const TopoDS_Shape* pSp = &aIt.Value();
const TopoDS_Shape* pSU = myMapModified.Seek(*pSp);
if (pSU) pSp = pSU;
myHistShapes.Append(*pSp);
}
}
//
return myHistShapes;
return &myHistShapes;
}
//=======================================================================
@@ -1043,7 +1016,7 @@ void MakeTypedContainers(const TopoDS_Shape& theSC,
return;
}
//
BOPCol_ListOfShape aLCB;
TopTools_ListOfShape aLCB;
BOPTools_AlgoTools::MakeConnexityBlocks(theSC, aConnexityType, aPartType, aLCB);
if (aLCB.IsEmpty()) {
return;
@@ -1051,7 +1024,7 @@ void MakeTypedContainers(const TopoDS_Shape& theSC,
//
BRep_Builder aBB;
TopExp_Explorer aExp;
BOPCol_ListIteratorOfListOfShape aItCB;
TopTools_ListIteratorOfListOfShape aItCB;
//
aItCB.Initialize(aLCB);
for (; aItCB.More(); aItCB.Next()) {
@@ -1073,6 +1046,33 @@ void MakeTypedContainers(const TopoDS_Shape& theSC,
}
}
//=======================================================================
//function : CollectMaterialBoundaries
//purpose : Add to theMapKeepBnd the boundary shapes of the area defined by shapes from the list
//=======================================================================
static void CollectMaterialBoundaries(const TopTools_ListOfShape& theLS,
TopTools_MapOfShape& theMapKeepBnd)
{
TopAbs_ShapeEnum aType = theLS.First().ShapeType();
TopAbs_ShapeEnum aTypeSubsh = (aType == TopAbs_FACE ? TopAbs_EDGE : TopAbs_VERTEX);
TopTools_IndexedDataMapOfShapeListOfShape aMapSubSh;
TopTools_ListIteratorOfListOfShape anIt(theLS);
for (; anIt.More(); anIt.Next())
{
const TopoDS_Shape& aS = anIt.Value();
TopExp::MapShapesAndAncestors(aS, aTypeSubsh, aType, aMapSubSh);
}
for (int i = 1; i <= aMapSubSh.Extent(); i++)
{
// check if the subshape belongs to boundary of the area
if (aMapSubSh(i).Extent() == 1)
{
// add to theMapKeepBnd
theMapKeepBnd.Add(aMapSubSh.FindKey(i));
}
}
}
//=======================================================================
//function : TypeToExplore
//purpose :

View File

@@ -23,14 +23,14 @@
#include <TopoDS_Shape.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopTools_MapOfShape.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_DataMapOfIntegerListOfShape.hxx>
#include <BOPCol_DataMapOfShapeInteger.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfIntegerListOfShape.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
//!
//! The algorithm is based on the General Fuse algorithm (GFA). The result of
@@ -90,8 +90,6 @@
//! IsDeleted() and Modified().<br>
//! In DRAW Test Harness it is available through the same
//! commands as for Boolean Operations (bmodified, bgenerated and bisdeleted).<br>
//! There could be Generated shapes only after removing of the internal boundaries
//! between faces and edges, i.e. after using ShapeUpgrade_UnifySameDomain tool.<br>
//!
//! The algorithm can return the following Error Statuses:
//! - Error status acquired in the General Fuse algorithm.
@@ -112,7 +110,7 @@
//! Examples:<br>
//! 1. API<br>
//! BOPAlgo_CellsBuilder aCBuilder;<br>
//! BOPCol_ListOfShape aLS = ...; // arguments<br>
//! TopTools_ListOfShape aLS = ...; // arguments<br>
//! /* parallel or single mode (the default value is FALSE)*/<br>
//! Standard_Boolean bRunParallel = Standard_False;<br>
//! /* fuzzy option (default value is 0)*/<br>
@@ -131,8 +129,8 @@
//! /* all split parts */<br>
//! const TopoDS_Shape& aRes = aCBuilder.GetAllParts();<br>
//! //<br>
//! BOPCol_ListOfShape aLSToTake = ...; // parts of these arguments will be taken into result<br>
//! BOPCol_ListOfShape aLSToAvoid = ...; // parts of these arguments will not be taken into result<br>
//! TopTools_ListOfShape aLSToTake = ...; // parts of these arguments will be taken into result<br>
//! TopTools_ListOfShape aLSToAvoid = ...; // parts of these arguments will not be taken into result<br>
//! //<br>
//! /* defines the material common for the cells, i.e.
//! the boundaries between cells with the same material
@@ -202,8 +200,8 @@ class BOPAlgo_CellsBuilder : public BOPAlgo_Builder
//! cells with the same material will be removed. Default value is 0.<br>
//! Thus, to remove any boundary the value of this variable should not be equal to 0.<br>
//! <theUpdate> parameter defines whether to remove boundaries now or not.
Standard_EXPORT void AddToResult(const BOPCol_ListOfShape& theLSToTake,
const BOPCol_ListOfShape& theLSToAvoid,
Standard_EXPORT void AddToResult(const TopTools_ListOfShape& theLSToTake,
const TopTools_ListOfShape& theLSToAvoid,
const Standard_Integer theMaterial = 0,
const Standard_Boolean theUpdate = Standard_False);
@@ -219,8 +217,8 @@ class BOPAlgo_CellsBuilder : public BOPAlgo_Builder
//! <theLSToAvoid> defines the arguments which parts should not be removed from result.<br>
//! To be removed from the result the part must be IN for all shapes from the list
//! <theLSToTake> and must be OUT of all shapes from the list <theLSToAvoid>.
Standard_EXPORT void RemoveFromResult(const BOPCol_ListOfShape& theLSToTake,
const BOPCol_ListOfShape& theLSToAvoid);
Standard_EXPORT void RemoveFromResult(const TopTools_ListOfShape& theLSToTake,
const TopTools_ListOfShape& theLSToAvoid);
//! Remove all parts from result.
Standard_EXPORT void RemoveAllFromResult();
@@ -238,15 +236,13 @@ class BOPAlgo_CellsBuilder : public BOPAlgo_Builder
//! Makes the Containers of proper type from the parts added to result.
Standard_EXPORT void MakeContainers();
//! Returns the list of shapes generated from the shape theS.
Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) Standard_OVERRIDE;
//! Returns true if the shape theS has been deleted.
Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& theS) Standard_OVERRIDE;
protected:
//! Redefined method Prepare - no need to prepare history
//! Prepare information for history support taking into account
//! local modification map of unified elements - myMapModified.
Standard_EXPORT virtual const TopTools_ListOfShape* LocModified(const TopoDS_Shape& theS) Standard_OVERRIDE;
//! Redefined method Prepare - no need to prepare history
//! information on the default result as it is empty compound.
Standard_EXPORT virtual void Prepare() Standard_OVERRIDE;
@@ -258,24 +254,22 @@ class BOPAlgo_CellsBuilder : public BOPAlgo_Builder
Standard_EXPORT void IndexParts();
//! Looking for the parts defined by two lists.
Standard_EXPORT void FindParts(const BOPCol_ListOfShape& theLSToTake,
const BOPCol_ListOfShape& theLSToAvoid,
BOPCol_ListOfShape& theParts);
Standard_EXPORT void FindParts(const TopTools_ListOfShape& theLSToTake,
const TopTools_ListOfShape& theLSToAvoid,
TopTools_ListOfShape& theParts);
//! Removes internal boundaries between cells with the same material.<br>
//! Returns TRUE if any internal boundaries have been removed.
Standard_EXPORT Standard_Boolean RemoveInternals(const BOPCol_ListOfShape& theLS,
BOPCol_ListOfShape& theLSNew);
Standard_EXPORT Standard_Boolean RemoveInternals(const TopTools_ListOfShape& theLS,
TopTools_ListOfShape& theLSNew,
const TopTools_MapOfShape& theMapKeepBnd = TopTools_MapOfShape());
// fields
TopoDS_Shape myAllParts;
BOPCol_IndexedDataMapOfShapeListOfShape myIndex;
BOPCol_DataMapOfIntegerListOfShape myMaterials;
BOPCol_DataMapOfShapeInteger myShapeMaterial;
BOPCol_DataMapOfShapeShape myMapModified;
private:
TopoDS_Shape myAllParts; //!< All split parts of the arguments
TopTools_IndexedDataMapOfShapeListOfShape myIndex; //!< Connection map from all splits parts to the argument shapes from which they were created
TopTools_DataMapOfIntegerListOfShape myMaterials; //!< Map of assigned materials (material -> list of shape)
TopTools_DataMapOfShapeInteger myShapeMaterial; //!< Map of assigned materials (shape -> material)
TopTools_DataMapOfShapeShape myMapModified; //!< Local modification map to track unification of the splits
};
#endif //_BOPAlgo_CellsBuilder_HeaderFile

View File

@@ -61,12 +61,12 @@ const TopoDS_Shape & BOPAlgo_CheckResult::GetShape2() const
return myShape2;
}
const BOPCol_ListOfShape& BOPAlgo_CheckResult::GetFaultyShapes1() const
const TopTools_ListOfShape& BOPAlgo_CheckResult::GetFaultyShapes1() const
{
return myFaulty1;
}
const BOPCol_ListOfShape& BOPAlgo_CheckResult::GetFaultyShapes2() const
const TopTools_ListOfShape& BOPAlgo_CheckResult::GetFaultyShapes2() const
{
return myFaulty2;
}

View File

@@ -22,7 +22,7 @@
#include <TopoDS_Shape.hxx>
#include <BOPAlgo_CheckStatus.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <Standard_Real.hxx>
class TopoDS_Shape;
@@ -58,10 +58,10 @@ public:
Standard_EXPORT const TopoDS_Shape& GetShape2() const;
//! returns list of faulty shapes for object
Standard_EXPORT const BOPCol_ListOfShape& GetFaultyShapes1() const;
Standard_EXPORT const TopTools_ListOfShape& GetFaultyShapes1() const;
//! returns list of faulty shapes for tool
Standard_EXPORT const BOPCol_ListOfShape& GetFaultyShapes2() const;
Standard_EXPORT const TopTools_ListOfShape& GetFaultyShapes2() const;
//! set status of faulty
Standard_EXPORT void SetCheckStatus (const BOPAlgo_CheckStatus TheStatus);
@@ -109,8 +109,8 @@ private:
TopoDS_Shape myShape1;
TopoDS_Shape myShape2;
BOPAlgo_CheckStatus myStatus;
BOPCol_ListOfShape myFaulty1;
BOPCol_ListOfShape myFaulty2;
TopTools_ListOfShape myFaulty1;
TopTools_ListOfShape myFaulty2;
Standard_Real myMaxDist1;
Standard_Real myMaxDist2;
Standard_Real myMaxPar1;

View File

@@ -19,8 +19,6 @@
#include <BOPAlgo_CheckerSI.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_IteratorSI.hxx>
@@ -32,8 +30,11 @@
#include <BOPDS_VectorOfInterfVE.hxx>
#include <BOPDS_VectorOfInterfVF.hxx>
#include <BOPDS_VectorOfInterfVV.hxx>
#include <BOPTools.hxx>
#include <BRep_Tool.hxx>
#include <gp_Torus.hxx>
#include <TopExp.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_Parallel.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <IntTools_Context.hxx>
#include <IntTools_Tools.hxx>
@@ -41,8 +42,7 @@
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BRep_Tool.hxx>
#include <gp_Torus.hxx>
#include <TopTools_MapOfShape.hxx>
//=======================================================================
//class : BOPAlgo_FaceSelfIntersect
@@ -102,14 +102,14 @@ class BOPAlgo_FaceSelfIntersect :
//=======================================================================
typedef BOPCol_NCVector
typedef NCollection_Vector
<BOPAlgo_FaceSelfIntersect> BOPAlgo_VectorOfFaceSelfIntersect;
//
typedef BOPCol_Functor
typedef BOPTools_Functor
<BOPAlgo_FaceSelfIntersect,
BOPAlgo_VectorOfFaceSelfIntersect> BOPAlgo_FaceSelfIntersectFunctor;
//
typedef BOPCol_Cnt
typedef BOPTools_Cnt
<BOPAlgo_FaceSelfIntersectFunctor,
BOPAlgo_VectorOfFaceSelfIntersect> BOPAlgo_FaceSelfIntersectCnt;
@@ -224,7 +224,7 @@ void BOPAlgo_CheckerSI::PostTreat()
// 0
BOPDS_VectorOfInterfVV& aVVs=myDS->InterfVV();
aNb=aVVs.Extent();
aNb=aVVs.Length();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVV& aVV=aVVs(i);
aVV.Indices(n1, n2);
@@ -237,7 +237,7 @@ void BOPAlgo_CheckerSI::PostTreat()
//
// 1
BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
aNb=aVEs.Extent();
aNb=aVEs.Length();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVE& aVE=aVEs(i);
aVE.Indices(n1, n2);
@@ -250,7 +250,7 @@ void BOPAlgo_CheckerSI::PostTreat()
//
// 2
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
aNb=aEEs.Extent();
aNb=aEEs.Length();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfEE& aEE=aEEs(i);
aEE.Indices(n1, n2);
@@ -263,7 +263,7 @@ void BOPAlgo_CheckerSI::PostTreat()
//
// 3
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
aNb=aVFs.Extent();
aNb=aVFs.Length();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVF& aVF=aVFs(i);
aVF.Indices(n1, n2);
@@ -276,7 +276,7 @@ void BOPAlgo_CheckerSI::PostTreat()
//
// 4
BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF();
aNb=aEFs.Extent();
aNb=aEFs.Length();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfEF& aEF=aEFs(i);
if (aEF.CommonPart().Type()==TopAbs_SHAPE) {
@@ -292,7 +292,7 @@ void BOPAlgo_CheckerSI::PostTreat()
//
// 5
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
aNb=aFFs.Extent();
aNb=aFFs.Length();
for (i=0; i!=aNb; ++i) {
Standard_Boolean bTangentFaces, bFlag;
Standard_Integer aNbC, aNbP, j, iFound;
@@ -301,9 +301,9 @@ void BOPAlgo_CheckerSI::PostTreat()
aFF.Indices(n1, n2);
//
bTangentFaces=aFF.TangentFaces();
aNbP=aFF.Points().Extent();
aNbP=aFF.Points().Length();
const BOPDS_VectorOfCurve& aVC=aFF.Curves();
aNbC=aVC.Extent();
aNbC=aVC.Length();
if (!aNbP && !aNbC && !bTangentFaces) {
continue;
}
@@ -344,7 +344,7 @@ void BOPAlgo_CheckerSI::PostTreat()
//
// 6
BOPDS_VectorOfInterfVZ& aVZs=myDS->InterfVZ();
aNb=aVZs.Extent();
aNb=aVZs.Length();
for (i=0; i!=aNb; ++i) {
//
const BOPDS_InterfVZ& aVZ=aVZs(i);
@@ -358,7 +358,7 @@ void BOPAlgo_CheckerSI::PostTreat()
//
// 7
BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
aNb=aEZs.Extent();
aNb=aEZs.Length();
for (i=0; i!=aNb; ++i) {
//
const BOPDS_InterfEZ& aEZ=aEZs(i);
@@ -369,7 +369,7 @@ void BOPAlgo_CheckerSI::PostTreat()
//
// 8
BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ();
aNb=aFZs.Extent();
aNb=aFZs.Length();
for (i=0; i!=aNb; ++i) {
//
const BOPDS_InterfFZ& aFZ=aFZs(i);
@@ -380,7 +380,7 @@ void BOPAlgo_CheckerSI::PostTreat()
//
// 9
BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
aNb=aZZs.Extent();
aNb=aZZs.Length();
for (i=0; i!=aNb; ++i) {
//
const BOPDS_InterfZZ& aZZ=aZZs(i);
@@ -436,7 +436,7 @@ void BOPAlgo_CheckerSI::CheckFaceSelfIntersection()
Standard_Real aTolF = BRep_Tool::Tolerance(aF);
BOPAlgo_FaceSelfIntersect& aFaceSelfIntersect = aVFace.Append1();
BOPAlgo_FaceSelfIntersect& aFaceSelfIntersect = aVFace.Appended();
//
aFaceSelfIntersect.SetIndex(i);
aFaceSelfIntersect.SetFace(aF);
@@ -445,7 +445,7 @@ void BOPAlgo_CheckerSI::CheckFaceSelfIntersection()
aFaceSelfIntersect.SetProgressIndicator(myProgressIndicator);
}
Standard_Integer aNbFace = aVFace.Extent();
Standard_Integer aNbFace = aVFace.Length();
//======================================================
BOPAlgo_FaceSelfIntersectCnt::Perform(myRunParallel, aVFace);
//======================================================

View File

@@ -21,8 +21,7 @@
#include <BOPDS_Interf.hxx>
#include <BOPDS_IteratorSI.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPTools_Parallel.hxx>
#include <BRep_Tool.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
@@ -30,8 +29,10 @@
#include <IntTools_Context.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS_Vertex.hxx>
#include <NCollection_Vector.hxx>
#include <TopAbs_State.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Solid.hxx>
@@ -114,16 +115,16 @@ class BOPAlgo_VertexSolid {
Handle(IntTools_Context) myContext;
};
//=======================================================================
typedef BOPCol_NCVector
typedef NCollection_Vector
<BOPAlgo_VertexSolid> BOPAlgo_VectorOfVertexSolid;
//
typedef BOPCol_ContextFunctor
typedef BOPTools_ContextFunctor
<BOPAlgo_VertexSolid,
BOPAlgo_VectorOfVertexSolid,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_VertexSolidFunctor;
//
typedef BOPCol_ContextCnt
typedef BOPTools_ContextCnt
<BOPAlgo_VertexSolidFunctor,
BOPAlgo_VectorOfVertexSolid,
Handle(IntTools_Context)> BOPAlgo_VertexSolidCnt;
@@ -184,14 +185,14 @@ class BOPAlgo_ShapeSolid {
BOPDS_DS* myDS;
};
//=======================================================================
typedef BOPCol_NCVector
typedef NCollection_Vector
<BOPAlgo_ShapeSolid> BOPAlgo_VectorOfShapeSolid;
//
typedef BOPCol_Functor
typedef BOPTools_Functor
<BOPAlgo_ShapeSolid,
BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidFunctor;
//
typedef BOPCol_Cnt
typedef BOPTools_Cnt
<BOPAlgo_ShapeSolidFunctor,
BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidCnt;
//
@@ -224,14 +225,14 @@ class BOPAlgo_SolidSolid : public BOPAlgo_ShapeSolid {
};
};
//=======================================================================
typedef BOPCol_NCVector
typedef NCollection_Vector
<BOPAlgo_SolidSolid> BOPAlgo_VectorOfSolidSolid;
//
typedef BOPCol_Functor
typedef BOPTools_Functor
<BOPAlgo_SolidSolid,
BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidFunctor;
//
typedef BOPCol_Cnt
typedef BOPTools_Cnt
<BOPAlgo_SolidSolidFunctor,
BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidCnt;
//
@@ -277,13 +278,13 @@ void BOPAlgo_CheckerSI::PerformVZ()
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&myDS->Shape(nVSD));
const TopoDS_Solid& aZ=*((TopoDS_Solid*)&myDS->Shape(nZ));
//
BOPAlgo_VertexSolid& aVertexSolid=aVVS.Append1();
BOPAlgo_VertexSolid& aVertexSolid=aVVS.Appended();
aVertexSolid.SetIndices(nV, nZ);
aVertexSolid.SetVertex(aV);
aVertexSolid.SetSolid(aZ);
}
//
aNbVVS=aVVS.Extent();
aNbVVS=aVVS.Length();
//=============================================================
BOPAlgo_VertexSolidCnt::Perform(myRunParallel, aVVS, myContext);
//=============================================================
@@ -293,7 +294,7 @@ void BOPAlgo_CheckerSI::PerformVZ()
if (aState==TopAbs_IN) {
aVertexSolid.Indices(nV, nZ);
//
BOPDS_InterfVZ& aVZ=aVZs.Append1();
BOPDS_InterfVZ& aVZ=aVZs.Appended();
aVZ.SetIndices(nV, nZ);
//
myDS->AddInterf(nV, nZ);
@@ -336,12 +337,12 @@ void BOPAlgo_CheckerSI::PerformZZ()
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nZ1, nZ);
//
BOPAlgo_SolidSolid& aSolidSolid=aVSolidSolid.Append1();
BOPAlgo_SolidSolid& aSolidSolid=aVSolidSolid.Appended();
aSolidSolid.SetIndices(nZ1, nZ);
aSolidSolid.SetDS(myDS);
}
//
aNbSolidSolid=aVSolidSolid.Extent();
aNbSolidSolid=aVSolidSolid.Length();
//======================================================
BOPAlgo_SolidSolidCnt::Perform(myRunParallel, aVSolidSolid);
//======================================================
@@ -356,7 +357,7 @@ void BOPAlgo_CheckerSI::PerformZZ()
if (bHasInterf) {
aSolidSolid.Indices(nZ1, nZ);
//
BOPDS_InterfZZ& aZZ=aZZs.Append1();
BOPDS_InterfZZ& aZZ=aZZs.Appended();
aZZ.SetIndices(nZ1, nZ);
//
myDS->AddInterf(nZ1, nZ);
@@ -383,12 +384,12 @@ void BOPAlgo_CheckerSI::PerformSZ(const TopAbs_ShapeEnum aTS)
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nS, nZ);
//
BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid.Append1();
BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid.Appended();
aShapeSolid.SetIndices(nS, nZ);
aShapeSolid.SetDS(myDS);
}
//
aNbShapeSolid=aVShapeSolid.Extent();
aNbShapeSolid=aVShapeSolid.Length();
//======================================================
BOPAlgo_ShapeSolidCnt::Perform(myRunParallel, aVShapeSolid);
//======================================================
@@ -410,11 +411,11 @@ void BOPAlgo_CheckerSI::PerformSZ(const TopAbs_ShapeEnum aTS)
aShapeSolid.Indices(nS, nZ);
//
if (aTS==TopAbs_EDGE) {
BOPDS_InterfEZ& aEZ=aEZs.Append1();
BOPDS_InterfEZ& aEZ=aEZs.Appended();
aEZ.SetIndices(nS, nZ);
}
else {//if (aTS==TopAbs_FACE)
BOPDS_InterfFZ& aFZ=aFZs.Append1();
BOPDS_InterfFZ& aFZ=aFZs.Appended();
aFZ.SetIndices(nS, nZ);
}
//

View File

@@ -16,23 +16,19 @@
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_MakerVolume.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPDS_DS.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Solid.hxx>
#include <TopTools_ListOfShape.hxx>
static
void AddFace(const TopoDS_Shape& theF,
BOPCol_ListOfShape& theLF);
static
void TreatCompound(const TopoDS_Shape& theS,
BOPCol_MapOfShape& aMFence,
BOPCol_ListOfShape& theLS);
TopTools_ListOfShape& theLF);
//=======================================================================
//function : CheckData
@@ -72,8 +68,8 @@ void BOPAlgo_MakerVolume::Perform()
//to create the compound of them and use it as one argument
TopoDS_Compound anArgs;
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfShape aIt;
BOPCol_ListOfShape aLS;
TopTools_ListIteratorOfListOfShape aIt;
TopTools_ListOfShape aLS;
//
aBB.MakeCompound(anArgs);
aIt.Initialize(myArguments);
@@ -153,8 +149,8 @@ void BOPAlgo_MakerVolume::PerformInternal1
return;
}
//
BOPCol_MapOfShape aBoxFaces;
BOPCol_ListOfShape aLSR;
TopTools_MapOfShape aBoxFaces;
TopTools_ListOfShape aLSR;
//
// 5. Create bounding box
MakeBox(aBoxFaces);
@@ -190,8 +186,8 @@ void BOPAlgo_MakerVolume::CollectFaces()
UserBreak();
//
Standard_Integer i, aNbShapes;
BOPCol_ListIteratorOfListOfShape aIt;
BOPCol_MapOfShape aMFence;
TopTools_ListIteratorOfListOfShape aIt;
TopTools_MapOfShape aMFence;
//
aNbShapes = myDS->NbSourceShapes();
for (i = 0; i < aNbShapes; ++i) {
@@ -205,7 +201,7 @@ void BOPAlgo_MakerVolume::CollectFaces()
//
const TopoDS_Shape& aF = aSI.Shape();
if (myImages.IsBound(aF)) {
const BOPCol_ListOfShape& aLFIm = myImages.Find(aF);
const TopTools_ListOfShape& aLFIm = myImages.Find(aF);
aIt.Initialize(aLFIm);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aFIm = aIt.Value();
@@ -224,7 +220,7 @@ void BOPAlgo_MakerVolume::CollectFaces()
//function : MakeBox
//purpose :
//=======================================================================
void BOPAlgo_MakerVolume::MakeBox(BOPCol_MapOfShape& theBoxFaces)
void BOPAlgo_MakerVolume::MakeBox(TopTools_MapOfShape& theBoxFaces)
{
UserBreak();
//
@@ -251,13 +247,12 @@ void BOPAlgo_MakerVolume::MakeBox(BOPCol_MapOfShape& theBoxFaces)
//function : BuildSolids
//purpose :
//=======================================================================
void BOPAlgo_MakerVolume::BuildSolids(BOPCol_ListOfShape& theLSR)
void BOPAlgo_MakerVolume::BuildSolids(TopTools_ListOfShape& theLSR)
{
UserBreak();
//
BOPAlgo_BuilderSolid aBS;
//
aBS.SetSolid(mySBox);
aBS.SetShapes(myFaces);
aBS.SetRunParallel(myRunParallel);
aBS.SetAvoidInternalShapes(myAvoidInternalShapes);
@@ -268,6 +263,8 @@ void BOPAlgo_MakerVolume::BuildSolids(BOPCol_ListOfShape& theLSR)
return;
}
//
myReport->Merge(aBS.GetReport());
//
theLSR = aBS.Areas();
}
@@ -275,12 +272,12 @@ void BOPAlgo_MakerVolume::BuildSolids(BOPCol_ListOfShape& theLSR)
//function : TreatResult
//purpose :
//=======================================================================
void BOPAlgo_MakerVolume::RemoveBox(BOPCol_ListOfShape& theLSR,
const BOPCol_MapOfShape& theBoxFaces)
void BOPAlgo_MakerVolume::RemoveBox(TopTools_ListOfShape& theLSR,
const TopTools_MapOfShape& theBoxFaces)
{
UserBreak();
//
BOPCol_ListIteratorOfListOfShape aIt;
TopTools_ListIteratorOfListOfShape aIt;
TopExp_Explorer aExp;
Standard_Boolean bFound;
//
@@ -308,14 +305,14 @@ void BOPAlgo_MakerVolume::RemoveBox(BOPCol_ListOfShape& theLSR,
//function : BuildShape
//purpose :
//=======================================================================
void BOPAlgo_MakerVolume::BuildShape(const BOPCol_ListOfShape& theLSR)
void BOPAlgo_MakerVolume::BuildShape(const TopTools_ListOfShape& theLSR)
{
if (theLSR.Extent() == 1) {
myShape = theLSR.First();
}
else {
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfShape aIt;
TopTools_ListIteratorOfListOfShape aIt;
//
aIt.Initialize(theLSR);
for (; aIt.More(); aIt.Next()) {
@@ -329,7 +326,7 @@ void BOPAlgo_MakerVolume::BuildShape(const BOPCol_ListOfShape& theLSR)
//function : FillInternalShapes
//purpose :
//=======================================================================
void BOPAlgo_MakerVolume::FillInternalShapes(const BOPCol_ListOfShape& theLSR)
void BOPAlgo_MakerVolume::FillInternalShapes(const TopTools_ListOfShape& theLSR)
{
if (myAvoidInternalShapes) {
return;
@@ -342,17 +339,17 @@ void BOPAlgo_MakerVolume::FillInternalShapes(const BOPCol_ListOfShape& theLSR)
TopAbs_State aState;
TopoDS_Iterator aItS;
BRep_Builder aBB;
BOPCol_MapOfShape aMFence;
BOPCol_IndexedMapOfShape aMSS;
BOPCol_ListOfShape aLVE, aLSC, aLSIn;
BOPCol_ListIteratorOfListOfShape aIt, aIt1;
TopTools_MapOfShape aMFence;
TopTools_IndexedMapOfShape aMSS;
TopTools_ListOfShape aLVE, aLSC, aLSIn;
TopTools_ListIteratorOfListOfShape aIt, aIt1;
//
// 1. Collect shapes to process: vertices, edges, wires
const BOPCol_ListOfShape& anArguments = myDS->Arguments();
const TopTools_ListOfShape& anArguments = myDS->Arguments();
aIt.Initialize(anArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
TreatCompound(aS, aMFence, aLSC);
BOPAlgo_Tools::TreatCompound(aS, aMFence, aLSC);
}
//
aIt.Initialize(aLSC);
@@ -376,15 +373,15 @@ void BOPAlgo_MakerVolume::FillInternalShapes(const BOPCol_ListOfShape& theLSR)
aIt.Initialize(theLSR);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
BOPTools::MapShapes(aS, TopAbs_EDGE, aMSS);
BOPTools::MapShapes(aS, TopAbs_VERTEX, aMSS);
TopExp::MapShapes(aS, TopAbs_EDGE, aMSS);
TopExp::MapShapes(aS, TopAbs_VERTEX, aMSS);
}
//
aIt.Initialize(aLVE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
if (myImages.IsBound(aS)) {
const BOPCol_ListOfShape &aLSp = myImages.Find(aS);
const TopTools_ListOfShape &aLSp = myImages.Find(aS);
aIt1.Initialize(aLSp);
for (; aIt1.More(); aIt1.Next()) {
const TopoDS_Shape& aSp = aIt1.Value();
@@ -432,7 +429,7 @@ void BOPAlgo_MakerVolume::FillInternalShapes(const BOPCol_ListOfShape& theLSR)
//purpose :
//=======================================================================
void AddFace(const TopoDS_Shape& theF,
BOPCol_ListOfShape& theLF)
TopTools_ListOfShape& theLF)
{
TopoDS_Shape aFF = theF;
aFF.Orientation(TopAbs_FORWARD);
@@ -440,26 +437,3 @@ void AddFace(const TopoDS_Shape& theF,
aFF.Orientation(TopAbs_REVERSED);
theLF.Append(aFF);
}
//=======================================================================
//function : TreatCompound
//purpose :
//=======================================================================
void TreatCompound(const TopoDS_Shape& theS,
BOPCol_MapOfShape& aMFence,
BOPCol_ListOfShape& theLS)
{
TopAbs_ShapeEnum aType = theS.ShapeType();
if (aType != TopAbs_COMPOUND) {
if (aMFence.Add(theS)) {
theLS.Append(theS);
}
return;
}
//
TopoDS_Iterator aIt(theS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
TreatCompound(aS, aMFence, theLS);
}
}

View File

@@ -18,14 +18,14 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <Bnd_Box.hxx>
#include <TopoDS_Solid.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <Bnd_Box.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <TopoDS_Solid.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
class TopoDS_Solid;
class BOPAlgo_PaveFiller;
@@ -120,7 +120,7 @@ public:
virtual ~BOPAlgo_MakerVolume();
//! Empty contructor.
BOPAlgo_MakerVolume(const BOPCol_BaseAllocator& theAllocator);
BOPAlgo_MakerVolume(const Handle(NCollection_BaseAllocator)& theAllocator);
//! Clears the data.
virtual void Clear() Standard_OVERRIDE;
@@ -137,7 +137,7 @@ public:
const TopoDS_Solid& Box() const;
//! Returns the processed faces <myFaces>.
const BOPCol_ListOfShape& Faces() const;
const TopTools_ListOfShape& Faces() const;
//! Defines the preventing of addition of internal for solid parts into the result.
//! By default the internal parts are added into result.
@@ -165,25 +165,25 @@ protected:
Standard_EXPORT void CollectFaces();
//! Makes solid box.
Standard_EXPORT void MakeBox (BOPCol_MapOfShape& theBoxFaces);
Standard_EXPORT void MakeBox (TopTools_MapOfShape& theBoxFaces);
//! Builds solids.
Standard_EXPORT void BuildSolids (BOPCol_ListOfShape& theLSR);
Standard_EXPORT void BuildSolids (TopTools_ListOfShape& theLSR);
//! Removes the covering box.
Standard_EXPORT void RemoveBox (BOPCol_ListOfShape& theLSR, const BOPCol_MapOfShape& theBoxFaces);
Standard_EXPORT void RemoveBox (TopTools_ListOfShape& theLSR, const TopTools_MapOfShape& theBoxFaces);
//! Fills the solids with internal shapes.
Standard_EXPORT void FillInternalShapes (const BOPCol_ListOfShape& theLSR);
Standard_EXPORT void FillInternalShapes (const TopTools_ListOfShape& theLSR);
//! Builds the result.
Standard_EXPORT void BuildShape (const BOPCol_ListOfShape& theLSR);
Standard_EXPORT void BuildShape (const TopTools_ListOfShape& theLSR);
Standard_Boolean myIntersect;
Bnd_Box myBBox;
TopoDS_Solid mySBox;
BOPCol_ListOfShape myFaces;
TopTools_ListOfShape myFaces;
Standard_Boolean myAvoidInternalShapes;
private:

View File

@@ -91,7 +91,7 @@ inline const TopoDS_Solid& BOPAlgo_MakerVolume::Box()const
//function : Faces
//purpose :
//=======================================================================
inline const BOPCol_ListOfShape& BOPAlgo_MakerVolume::Faces()const
inline const TopTools_ListOfShape& BOPAlgo_MakerVolume::Faces()const
{
return myFaces;
}

View File

@@ -18,7 +18,7 @@
#include <Message_Report.hxx>
#include <Standard_OStream.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <NCollection_BaseAllocator.hxx>
class Message_ProgressIndicator;
@@ -43,13 +43,13 @@ public:
Standard_EXPORT BOPAlgo_Options();
//! Constructor with allocator
Standard_EXPORT BOPAlgo_Options(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT BOPAlgo_Options(const Handle(NCollection_BaseAllocator)& theAllocator);
//! Destructor
Standard_EXPORT virtual ~BOPAlgo_Options();
//! Returns allocator
const BOPCol_BaseAllocator& Allocator() const
const Handle(NCollection_BaseAllocator)& Allocator() const
{
return myAllocator;
}
@@ -164,7 +164,7 @@ protected:
protected:
BOPCol_BaseAllocator myAllocator;
Handle(NCollection_BaseAllocator) myAllocator;
Handle(Message_Report) myReport;
Standard_Boolean myRunParallel;
Standard_Real myFuzzyValue;

View File

@@ -172,7 +172,7 @@ void BOPAlgo_PaveFiller::SetSectionAttribute
//function : SetArguments
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetArguments(const BOPCol_ListOfShape& theLS)
void BOPAlgo_PaveFiller::SetArguments(const TopTools_ListOfShape& theLS)
{
myArguments=theLS;
}
@@ -180,7 +180,7 @@ void BOPAlgo_PaveFiller::SetArguments(const BOPCol_ListOfShape& theLS)
//function : Arguments
//purpose :
//=======================================================================
const BOPCol_ListOfShape& BOPAlgo_PaveFiller::Arguments()const
const TopTools_ListOfShape& BOPAlgo_PaveFiller::Arguments()const
{
return myArguments;
}
@@ -195,7 +195,7 @@ void BOPAlgo_PaveFiller::Init()
return;
}
//
BOPCol_ListIteratorOfListOfShape aIt(myArguments);
TopTools_ListIteratorOfListOfShape aIt(myArguments);
for (; aIt.More(); aIt.Next()) {
if (aIt.Value().IsNull()) {
AddError (new BOPAlgo_AlertNullInputShapes);
@@ -285,6 +285,10 @@ void BOPAlgo_PaveFiller::PerformInternal()
}
UpdatePaveBlocksWithSDVertices();
UpdateInterfsWithSDVertices();
// Force intersection of edges after increase
// of the tolerance values of their vertices
ForceInterfEE();
//
// 22
PerformFF();

View File

@@ -22,36 +22,35 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPAlgo_Algo.hxx>
#include <BOPAlgo_GlueEnum.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
#include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
#include <BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx>
#include <BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx>
#include <BOPDS_IndexedMapOfPaveBlock.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
#include <BOPDS_MapOfPair.hxx>
#include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_PDS.hxx>
#include <BOPDS_PIterator.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
#include <Standard_Real.hxx>
#include <BOPAlgo_Algo.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <Standard_Integer.hxx>
#include <BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx>
#include <Standard_Boolean.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_DataMapOfIntegerReal.hxx>
#include <BOPCol_ListOfInteger.hxx>
#include <BOPDS_IndexedMapOfPaveBlock.hxx>
#include <BOPCol_DataMapOfShapeInteger.hxx>
#include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
#include <BOPCol_DataMapOfIntegerInteger.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
#include <IntSurf_ListOfPntOn2S.hxx>
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
#include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_MapOfPair.hxx>
#include <BOPDS_VectorOfCurve.hxx>
#include <BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx>
#include <BOPCol_IndexedDataMapOfShapeInteger.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPAlgo_GlueEnum.hxx>
#include <IntSurf_ListOfPntOn2S.hxx>
#include <IntTools_ShrunkRange.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <TColStd_DataMapOfIntegerInteger.hxx>
#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
#include <TColStd_DataMapOfIntegerReal.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
class IntTools_Context;
class BOPDS_DS;
class BOPAlgo_SectionAttribute;
@@ -87,13 +86,19 @@ class TopoDS_Face;
//! - *Gluing options* - allows to speed up the calculation on the special
//! cases, in which some sub-shapes are coincide.<br>
//!
//! The algorithm returns the following Warning statuses:<br>
//! - *BOPAlgo_AlertSelfInterferingShape* - in case some of the argument shapes are self-interfering shapes;<br>
//! - *BOPAlgo_AlertTooSmallEdge* - in case some edges of the input shapes have no valid range;<br>
//! The algorithm returns the following Warning statuses:
//! - *BOPAlgo_AlertSelfInterferingShape* - in case some of the argument shapes are self-interfering shapes;
//! - *BOPAlgo_AlertTooSmallEdge* - in case some edges of the input shapes have no valid range;
//! - *BOPAlgo_AlertNotSplittableEdge* - in case some edges of the input shapes has such a small
//! valid range so it cannot be split;<br>
//! valid range so it cannot be split;
//! - *BOPAlgo_AlertBadPositioning* - in case the positioning of the input shapes leads to creation
//! of small edges.<br>
//! of small edges;
//! - *BOPAlgo_AlertIntersectionOfPairOfShapesFailed* - in case intersection of some of the
//! sub-shapes has failed;
//! - *BOPAlgo_AlertAcquiredSelfIntersection* - in case some sub-shapes of the argument become connected
//! through other shapes;
//! - *BOPAlgo_AlertBuildingPCurveFailed* - in case building 2D curve for some of the edges
//! on the faces has failed.
//!
//! The algorithm returns the following Error alerts:
//! - *BOPAlgo_AlertTooFewArguments* - in case there are no enough arguments to
@@ -112,7 +117,7 @@ public:
Standard_EXPORT virtual ~BOPAlgo_PaveFiller();
Standard_EXPORT BOPAlgo_PaveFiller(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT BOPAlgo_PaveFiller(const Handle(NCollection_BaseAllocator)& theAllocator);
Standard_EXPORT const BOPDS_DS& DS();
@@ -120,9 +125,9 @@ public:
Standard_EXPORT const BOPDS_PIterator& Iterator();
Standard_EXPORT void SetArguments (const BOPCol_ListOfShape& theLS);
Standard_EXPORT void SetArguments (const TopTools_ListOfShape& theLS);
Standard_EXPORT const BOPCol_ListOfShape& Arguments() const;
Standard_EXPORT const TopTools_ListOfShape& Arguments() const;
Standard_EXPORT const Handle(IntTools_Context)& Context();
@@ -200,7 +205,7 @@ protected:
//! into common table of interferences or not.<br>
//! If some of the Pave Blocks are forming the Common Blocks, the splits
//! of the Pave Blocks will also form a Common Block.
Standard_EXPORT void SplitPaveBlocks(const BOPCol_MapOfInteger& theMEdges,
Standard_EXPORT void SplitPaveBlocks(const TColStd_MapOfInteger& theMEdges,
const Standard_Boolean theAddInterfs);
Standard_EXPORT virtual void PerformVF();
@@ -213,8 +218,8 @@ protected:
Standard_EXPORT void TreatVerticesEE();
Standard_EXPORT void MakeSDVerticesFF(const BOPCol_DataMapOfIntegerListOfInteger& aDMVLV,
BOPCol_DataMapOfIntegerInteger& theDMNewSD);
Standard_EXPORT void MakeSDVerticesFF(const TColStd_DataMapOfIntegerListOfInteger& aDMVLV,
TColStd_DataMapOfIntegerInteger& theDMNewSD);
Standard_EXPORT void MakeSplitEdges();
@@ -222,7 +227,7 @@ protected:
Standard_EXPORT void MakePCurves();
Standard_EXPORT Standard_Integer MakeSDVertices(const BOPCol_ListOfInteger& theVertIndices,
Standard_EXPORT Standard_Integer MakeSDVertices(const TColStd_ListOfInteger& theVertIndices,
const Standard_Boolean theAddInterfs = 1);
Standard_EXPORT void ProcessDE();
@@ -239,25 +244,26 @@ protected:
//! Performs intersection of new vertices, obtained in E/E and E/F intersections
Standard_EXPORT void PerformNewVertices(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
const BOPCol_BaseAllocator& theAllocator,
const Handle(NCollection_BaseAllocator)& theAllocator,
const Standard_Boolean theIsEEIntersection = Standard_True);
Standard_EXPORT Standard_Boolean CheckFacePaves (const TopoDS_Vertex& theVnew, const BOPCol_MapOfInteger& theMIF);
Standard_EXPORT Standard_Boolean CheckFacePaves (const TopoDS_Vertex& theVnew, const TColStd_MapOfInteger& theMIF);
Standard_EXPORT static Standard_Boolean CheckFacePaves (const Standard_Integer theN, const BOPCol_MapOfInteger& theMIFOn, const BOPCol_MapOfInteger& theMIFIn);
Standard_EXPORT static Standard_Boolean CheckFacePaves (const Standard_Integer theN, const TColStd_MapOfInteger& theMIFOn, const TColStd_MapOfInteger& theMIFIn);
Standard_EXPORT Standard_Boolean IsExistingVertex (const gp_Pnt& theP, const Standard_Real theTol, const BOPCol_MapOfInteger& theMVOn) const;
Standard_EXPORT Standard_Boolean IsExistingVertex (const gp_Pnt& theP, const Standard_Real theTol, const TColStd_MapOfInteger& theMVOn) const;
//! Checks and puts paves from <theMVOn> on the curve <theNC>.
Standard_EXPORT void PutPavesOnCurve (const BOPCol_MapOfInteger& theMVOn,
BOPDS_Curve& theNC,
const Standard_Integer nF1,
const Standard_Integer nF2,
const BOPCol_MapOfInteger& theMI,
const BOPCol_MapOfInteger& theMVEF,
BOPCol_DataMapOfIntegerReal& theMVTol,
BOPCol_DataMapOfIntegerListOfInteger& aDMVLV);
//! Checks and puts paves from <theMVOnIn> on the curve <theNC>.
//! At that, common (from theMVCommon) and not common vertices
//! are processed differently.
Standard_EXPORT void PutPavesOnCurve(const TColStd_MapOfInteger& theMVOnIn,
const TColStd_MapOfInteger& theMVCommon,
BOPDS_Curve& theNC,
const TColStd_MapOfInteger& theMI,
const TColStd_MapOfInteger& theMVEF,
TColStd_DataMapOfIntegerReal& theMVTol,
TColStd_DataMapOfIntegerListOfInteger& theDMVLV);
Standard_EXPORT void FilterPavesOnCurves(const BOPDS_VectorOfCurve& theVNC);
@@ -269,12 +275,12 @@ protected:
//! 1 - checks only EE;
//! 2 - checks only EF;
//! other - checks both types of intersections.
Standard_EXPORT Standard_Boolean ExtendedTolerance (const Standard_Integer nV, const BOPCol_MapOfInteger& aMI, Standard_Real& aTolVExt, const Standard_Integer aType = 0);
Standard_EXPORT Standard_Boolean ExtendedTolerance (const Standard_Integer nV, const TColStd_MapOfInteger& aMI, Standard_Real& aTolVExt, const Standard_Integer aType = 0);
Standard_EXPORT void PutBoundPaveOnCurve(const TopoDS_Face& theF1,
const TopoDS_Face& theF2,
BOPDS_Curve& theNC,
BOPCol_ListOfInteger& theLBV);
TColStd_ListOfInteger& theLBV);
Standard_EXPORT Standard_Boolean IsExistingPaveBlock
(const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC,
@@ -282,15 +288,16 @@ protected:
const BOPDS_MapOfPaveBlock& theMPBCommon,
Handle(BOPDS_PaveBlock)& thePBOut, Standard_Real& theTolNew);
Standard_EXPORT Standard_Boolean IsExistingPaveBlock (const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC, const BOPCol_ListOfInteger& theLSE);
Standard_EXPORT Standard_Boolean IsExistingPaveBlock (const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC, const TColStd_ListOfInteger& theLSE);
//! Treatment of section edges.
Standard_EXPORT void PostTreatFF (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDMExEdges,
BOPCol_DataMapOfIntegerInteger& theDMNewSD,
const BOPCol_IndexedMapOfShape& theMicroEdges,
const BOPCol_BaseAllocator& theAllocator);
TColStd_DataMapOfIntegerInteger& theDMNewSD,
const TopTools_IndexedMapOfShape& theMicroEdges,
const TopTools_IndexedMapOfShape& theVertsOnRejectedPB,
const Handle(NCollection_BaseAllocator)& theAllocator);
Standard_EXPORT void FindPaveBlocks (const Standard_Integer theV, const Standard_Integer theF, BOPDS_ListOfPaveBlock& theLPB);
@@ -303,38 +310,38 @@ protected:
//! Checks and puts paves created in EF intersections on the curve <theNC>.
Standard_EXPORT void PutEFPavesOnCurve (BOPDS_Curve& theNC,
const BOPCol_MapOfInteger& theMI,
const BOPCol_MapOfInteger& theMVEF,
BOPCol_DataMapOfIntegerReal& theMVTol,
BOPCol_DataMapOfIntegerListOfInteger& aDMVLV);
const TColStd_MapOfInteger& theMI,
const TColStd_MapOfInteger& theMVEF,
TColStd_DataMapOfIntegerReal& theMVTol,
TColStd_DataMapOfIntegerListOfInteger& aDMVLV);
//! Puts stick paves on the curve <theNC>
Standard_EXPORT void PutStickPavesOnCurve (const TopoDS_Face& aF1,
const TopoDS_Face& aF2,
const BOPCol_MapOfInteger& theMI,
const TColStd_MapOfInteger& theMI,
BOPDS_Curve& theNC,
const BOPCol_MapOfInteger& theMVStick,
BOPCol_DataMapOfIntegerReal& theMVTol,
BOPCol_DataMapOfIntegerListOfInteger& aDMVLV);
const TColStd_MapOfInteger& theMVStick,
TColStd_DataMapOfIntegerReal& theMVTol,
TColStd_DataMapOfIntegerListOfInteger& aDMVLV);
//! Collects indices of vertices created in all intersections between
//! two faces (<nF1> and <nF2>) to the map <theMVStick>.
//! Also, it collects indices of EF vertices to the <theMVEF> map
//! and indices of all subshapes of these two faces to the <theMI> map.
Standard_EXPORT void GetStickVertices (const Standard_Integer nF1, const Standard_Integer nF2, BOPCol_MapOfInteger& theMVStick, BOPCol_MapOfInteger& theMVEF, BOPCol_MapOfInteger& theMI);
Standard_EXPORT void GetStickVertices (const Standard_Integer nF1, const Standard_Integer nF2, TColStd_MapOfInteger& theMVStick, TColStd_MapOfInteger& theMVEF, TColStd_MapOfInteger& theMI);
//! Collects index nF and indices of all subshapes of the shape with index <nF>
//! to the map <theMI>.
Standard_EXPORT void GetFullShapeMap (const Standard_Integer nF, BOPCol_MapOfInteger& theMI);
Standard_EXPORT void GetFullShapeMap (const Standard_Integer nF, TColStd_MapOfInteger& theMI);
//! Removes indices of vertices that are already on the
//! curve <theNC> from the map <theMV>.
//! It is used in PutEFPavesOnCurve and PutStickPavesOnCurve methods.
Standard_EXPORT void RemoveUsedVertices (BOPDS_Curve& theNC, BOPCol_MapOfInteger& theMV);
Standard_EXPORT void RemoveUsedVertices (BOPDS_Curve& theNC, TColStd_MapOfInteger& theMV);
//! Puts the pave nV on the curve theNC.
@@ -345,15 +352,15 @@ protected:
Standard_EXPORT void PutPaveOnCurve (const Standard_Integer nV,
const Standard_Real theTolR3D,
const BOPDS_Curve& theNC,
const BOPCol_MapOfInteger& theMI,
BOPCol_DataMapOfIntegerReal& theMVTol,
BOPCol_DataMapOfIntegerListOfInteger& aDMVLV,
const TColStd_MapOfInteger& theMI,
TColStd_DataMapOfIntegerReal& theMVTol,
TColStd_DataMapOfIntegerListOfInteger& aDMVLV,
const Standard_Integer aType = 0);
//! Adds the existing edges from the map <theMPBOnIn> which interfere
//! with the vertices from <theMVB> map to the post treatment of section edges.
Standard_EXPORT void ProcessExistingPaveBlocks (const Standard_Integer theInt, const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn, const BOPCol_DataMapOfIntegerListOfInteger& theDMBV, BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB, BOPCol_DataMapOfShapeInteger& theMVI, BOPDS_MapOfPaveBlock& theMPB);
Standard_EXPORT void ProcessExistingPaveBlocks (const Standard_Integer theInt, const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn, const TColStd_DataMapOfIntegerListOfInteger& theDMBV, BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB, TopTools_DataMapOfShapeInteger& theMVI, BOPDS_MapOfPaveBlock& theMPB);
//! Replaces existing pave block <thePB> with new pave blocks <theLPB>.
@@ -363,7 +370,7 @@ protected:
//! Treatment of vertices that were created in EE intersections.
Standard_EXPORT void TreatNewVertices(const BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, BOPCol_IndexedDataMapOfShapeListOfShape& theImages);
Standard_EXPORT void TreatNewVertices(const BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, TopTools_IndexedDataMapOfShapeListOfShape& theImages);
//! Put paves on the curve <aBC> in case when <aBC>
@@ -372,17 +379,18 @@ protected:
//! Keeps data for post treatment
Standard_EXPORT void PreparePostTreatFF (const Standard_Integer aInt, const Standard_Integer aCur, const Handle(BOPDS_PaveBlock)& aPB, BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB, BOPCol_DataMapOfShapeInteger& aMVI, BOPDS_ListOfPaveBlock& aLPB);
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);
//! Updates the information about faces
Standard_EXPORT void UpdateFaceInfo (BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME, const BOPCol_DataMapOfIntegerInteger& theDMV);
Standard_EXPORT void UpdateFaceInfo (BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME, const TColStd_DataMapOfIntegerInteger& theDMV);
//! Updates tolerance of vertex with index <nV>
//! to make it interfere with edge
Standard_EXPORT void ForceInterfVE(const Standard_Integer nV,
Handle(BOPDS_PaveBlock)& aPB,
BOPCol_MapOfInteger& theMEdges);
//! to make it interfere with edge.
//! Returns TRUE if intersection happened.
Standard_EXPORT Standard_Boolean ForceInterfVE(const Standard_Integer nV,
Handle(BOPDS_PaveBlock)& aPB,
TColStd_MapOfInteger& theMEdges);
//! Updates tolerance of vertex with index <nV>
//! to make it interfere with face with index <nF>
@@ -401,7 +409,7 @@ protected:
//! Updates pave blocks which have the paves with indices contained
//! in the map <aDMNewSD>.
Standard_EXPORT void UpdatePaveBlocks(const BOPCol_DataMapOfIntegerInteger& aDMNewSD);
Standard_EXPORT void UpdatePaveBlocks(const TColStd_DataMapOfIntegerInteger& aDMNewSD);
//! Updates tolerance vertex nV due to V/E interference.
//! It always creates new vertex if nV is from arguments.
@@ -424,7 +432,7 @@ protected:
Standard_EXPORT void UpdateEdgeTolerance(const Standard_Integer nE,
const Standard_Real aTolNew);
Standard_EXPORT void RemovePaveBlocks(const BOPCol_MapOfInteger theEdges);
Standard_EXPORT void RemovePaveBlocks(const TColStd_MapOfInteger theEdges);
Standard_EXPORT void CorrectToleranceOfSE();
@@ -474,8 +482,16 @@ protected:
//! In case self-interference is found the warning is added.
Standard_EXPORT void CheckSelfInterference();
//! Adds the warning about failed intersection of pair of sub-shapes
Standard_EXPORT void AddIntersectionFailedWarning(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2);
BOPCol_ListOfShape myArguments;
//! The method looks for the additional common blocks among pairs of edges
//! which did not participate in edges intersection (PerformEE() method)
//! due to being rejected by bounding boxes intersection.
Standard_EXPORT void ForceInterfEE();
TopTools_ListOfShape myArguments;
BOPDS_PDS myDS;
BOPDS_PIterator myIterator;
Handle(IntTools_Context) myContext;

View File

@@ -20,11 +20,6 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_DataMapOfIntegerInteger.hxx>
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
#include <BOPCol_IndexedDataMapOfIntegerListOfInteger.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPDS_PaveBlock.hxx>
@@ -38,10 +33,12 @@
#include <IntTools_Context.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <Precision.hxx>
#include <TColStd_DataMapOfIntegerInteger.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
#include <TopTools_ListOfShape.hxx>
//=======================================================================
// function: PerformVV
@@ -64,8 +61,8 @@ void BOPAlgo_PaveFiller::PerformVV()
//-----------------------------------------------------scope f
aAllocator=
NCollection_BaseAllocator::CommonBaseAllocator();
BOPCol_IndexedDataMapOfIntegerListOfInteger aMILI(100, aAllocator);
NCollection_List<BOPCol_ListOfInteger> aMBlocks(aAllocator);
NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger>aMILI(100, aAllocator);
NCollection_List<TColStd_ListOfInteger> aMBlocks(aAllocator);
//
// 1. Map V/LV
for (; myIterator->More(); myIterator->Next()) {
@@ -84,15 +81,15 @@ void BOPAlgo_PaveFiller::PerformVV()
BOPAlgo_Tools::MakeBlocks<Standard_Integer, TColStd_MapIntegerHasher>(aMILI, aMBlocks, aAllocator);
//
// 3. Make vertices
NCollection_List<BOPCol_ListOfInteger>::Iterator aItB(aMBlocks);
NCollection_List<TColStd_ListOfInteger>::Iterator aItB(aMBlocks);
for (; aItB.More(); aItB.Next()) {
const BOPCol_ListOfInteger& aLI = aItB.Value();
const TColStd_ListOfInteger& aLI = aItB.Value();
MakeSDVertices(aLI);
}
//
BOPCol_DataMapIteratorOfDataMapOfIntegerInteger aItDMII;
TColStd_DataMapIteratorOfDataMapOfIntegerInteger aItDMII;
//
BOPCol_DataMapOfIntegerInteger& aDMII=myDS->ShapesSD();
TColStd_DataMapOfIntegerInteger& aDMII=myDS->ShapesSD();
aItDMII.Initialize(aDMII);
for (; aItDMII.More(); aItDMII.Next()) {
n1=aItDMII.Key();
@@ -109,13 +106,13 @@ void BOPAlgo_PaveFiller::PerformVV()
// purpose:
//=======================================================================
Standard_Integer BOPAlgo_PaveFiller::MakeSDVertices
(const BOPCol_ListOfInteger& theVertIndices,
(const TColStd_ListOfInteger& theVertIndices,
const Standard_Boolean theAddInterfs)
{
TopoDS_Vertex aVSD, aVn;
Standard_Integer nSD = -1;
BOPCol_ListIteratorOfListOfInteger aItLI(theVertIndices);
BOPCol_ListOfShape aLV;
TColStd_ListIteratorOfListOfInteger aItLI(theVertIndices);
TopTools_ListOfShape aLV;
for (; aItLI.More(); aItLI.Next()) {
Standard_Integer nX = aItLI.Value(), nSD1;
if (myDS->HasShapeSD(nX, nSD1)) {
@@ -167,7 +164,7 @@ Standard_Integer BOPAlgo_PaveFiller::MakeSDVertices
Standard_Integer iR1 = myDS->Rank(n1);
const TopoDS_Shape& aV1 = myDS->Shape(n1);
//
BOPCol_ListIteratorOfListOfInteger aItLI2 = aItLI;
TColStd_ListIteratorOfListOfInteger aItLI2 = aItLI;
aItLI2.Next();
for (; aItLI2.More(); aItLI2.Next()) {
Standard_Integer n2 = aItLI2.Value();
@@ -186,7 +183,7 @@ Standard_Integer BOPAlgo_PaveFiller::MakeSDVertices
//
if (theAddInterfs) {
myDS->AddInterf(n1, n2);
BOPDS_InterfVV& aVV = aVVs.Append1();
BOPDS_InterfVV& aVV = aVVs.Appended();
//
aVV.SetIndices(n1, n2);
aVV.SetIndexNew(nV);

View File

@@ -48,7 +48,7 @@ void BOPAlgo_PaveFiller::SetNonDestructive()
}
//
Standard_Boolean bFlag;
BOPCol_ListIteratorOfListOfShape aItLS;
TopTools_ListIteratorOfListOfShape aItLS;
//
bFlag=Standard_False;
aItLS.Initialize(myArguments);
@@ -69,10 +69,10 @@ void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
Standard_Integer nV, nVx;
Standard_Real aTolV;
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfInteger aIt;
TColStd_ListIteratorOfListOfInteger aIt;
//
BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE);
const BOPCol_ListOfInteger& aLI=aSIE.SubShapes();
const TColStd_ListOfInteger& aLI=aSIE.SubShapes();
//
if (myNonDestructive) {
bIsNewShape=myDS->IsNewShape(nE);
@@ -196,7 +196,7 @@ void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices()
Standard_Integer aNbPBP;
//
BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
aNbPBP=aPBP.Extent();
aNbPBP=aPBP.Length();
if(!aNbPBP) {
return;
}
@@ -237,7 +237,7 @@ namespace
//purpose :
//=======================================================================
template <class InterfType>
void UpdateIntfsWithSDVertices(BOPDS_PDS theDS, BOPCol_NCVector<InterfType>& theInterfs)
void UpdateIntfsWithSDVertices(BOPDS_PDS theDS, NCollection_Vector<InterfType>& theInterfs)
{
for (Standard_Integer i = 0; i < theInterfs.Length(); i++)
{

View File

@@ -42,7 +42,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
//
// Map of connections of interfering shapes
NCollection_IndexedDataMap<TopoDS_Shape,
BOPCol_IndexedMapOfShape,
TopTools_IndexedMapOfShape,
TopTools_ShapeMapHasher> aMCSI;
BOPDS_MapOfCommonBlock aMCBFence;
//
@@ -63,8 +63,8 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
//
// Analyze the shared vertices and common blocks
//
BOPCol_MapOfInteger aMSubS;
BOPCol_ListIteratorOfListOfInteger aItLI(aSI.SubShapes());
TColStd_MapOfInteger aMSubS;
TColStd_ListIteratorOfListOfInteger aItLI(aSI.SubShapes());
for (; aItLI.More(); aItLI.Next()) {
Standard_Integer nV = aItLI.Value();
myDS->HasShapeSD(nV, nV);
@@ -86,9 +86,9 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
if (!aR.Contains(nV[k]) && !aMSubS.Contains(nV[k])) {
// Add connection
const TopoDS_Shape& aV = myDS->Shape(nV[k]);
BOPCol_IndexedMapOfShape* pMSOr = aMCSI.ChangeSeek(aV);
TopTools_IndexedMapOfShape* pMSOr = aMCSI.ChangeSeek(aV);
if (!pMSOr) {
pMSOr = &aMCSI(aMCSI.Add(aV, BOPCol_IndexedMapOfShape()));
pMSOr = &aMCSI(aMCSI.Add(aV, TopTools_IndexedMapOfShape()));
}
pMSOr->Add(aS);
}
@@ -101,7 +101,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
if (aMCBFence.Add(aCB)) {
const BOPDS_ListOfPaveBlock& aLPBCB = aCB->PaveBlocks();
//
BOPCol_ListOfInteger aLE;
TColStd_ListOfInteger aLE;
BOPDS_ListIteratorOfListOfPaveBlock aItCB(aLPBCB);
for (; aItCB.More(); aItCB.Next()) {
const Handle(BOPDS_PaveBlock)& aPBCB = aItCB.Value();
@@ -112,17 +112,18 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
}
//
if (aLE.Extent() > 1) {
// Add warning
// Add the acquired self-interference warning:
// The same common block contains several edges from one argument
TopoDS_Compound aWC;
aBB.MakeCompound(aWC);
//
BOPCol_ListIteratorOfListOfInteger aItLE(aLE);
TColStd_ListIteratorOfListOfInteger aItLE(aLE);
for (; aItLE.More(); aItLE.Next()) {
const TopoDS_Shape& aE1 = myDS->Shape(aItLE.Value());
aBB.Add(aWC, aE1);
}
//
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
AddWarning (new BOPAlgo_AlertAcquiredSelfIntersection (aWC));
}
}
}
@@ -133,14 +134,14 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
const BOPDS_FaceInfo& aFI = myDS->FaceInfo(j);
//
for (Standard_Integer k = 0; k < 2; ++k) {
const BOPCol_MapOfInteger& aMVF = !k ? aFI.VerticesIn() : aFI.VerticesSc();
BOPCol_MapIteratorOfMapOfInteger aItM(aMVF);
const TColStd_MapOfInteger& aMVF = !k ? aFI.VerticesIn() : aFI.VerticesSc();
TColStd_MapIteratorOfMapOfInteger aItM(aMVF);
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aV = myDS->Shape(aItM.Value());
// add connection
BOPCol_IndexedMapOfShape* pMSOr = aMCSI.ChangeSeek(aV);
TopTools_IndexedMapOfShape* pMSOr = aMCSI.ChangeSeek(aV);
if (!pMSOr) {
pMSOr = &aMCSI(aMCSI.Add(aV, BOPCol_IndexedMapOfShape()));
pMSOr = &aMCSI(aMCSI.Add(aV, TopTools_IndexedMapOfShape()));
}
pMSOr->Add(aS);
}
@@ -153,9 +154,9 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
const Handle(BOPDS_PaveBlock)& aPB = aMPBF(iPB);
const TopoDS_Shape& aE = myDS->Shape(aPB->Edge());
// add connection
BOPCol_IndexedMapOfShape* pMSOr = aMCSI.ChangeSeek(aE);
TopTools_IndexedMapOfShape* pMSOr = aMCSI.ChangeSeek(aE);
if (!pMSOr) {
pMSOr = &aMCSI(aMCSI.Add(aE, BOPCol_IndexedMapOfShape()));
pMSOr = &aMCSI(aMCSI.Add(aE, TopTools_IndexedMapOfShape()));
}
pMSOr->Add(aS);
}
@@ -166,9 +167,10 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
// Analyze connections
Standard_Integer aNbC = aMCSI.Extent();
for (j = 1; j <= aNbC; ++j) {
const BOPCol_IndexedMapOfShape& aMCS = aMCSI(j);
const TopTools_IndexedMapOfShape& aMCS = aMCSI(j);
if (aMCS.Extent() > 1) {
// Add self-interference warning
// Add acquired self-interference warning:
// Several faces from one argument contain the same vertex or edge
TopoDS_Compound aWC;
aBB.MakeCompound(aWC);
//
@@ -177,7 +179,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
const TopoDS_Shape& aSx = aMCS(iS);
aBB.Add(aWC, aSx);
}
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
AddWarning (new BOPAlgo_AlertAcquiredSelfIntersection (aWC));
}
}
}

View File

@@ -17,9 +17,8 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_Iterator.hxx>
@@ -27,9 +26,12 @@
#include <BOPDS_PaveBlock.hxx>
#include <BOPDS_VectorOfInterfVE.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_Parallel.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <gp_Pnt.hxx>
#include <IntTools_Context.hxx>
#include <NCollection_Vector.hxx>
#include <Precision.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
@@ -110,7 +112,16 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew, myFuzzyValue);
try
{
OCC_CATCH_SIGNALS
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew, myFuzzyValue);
}
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertIntersectionFailed);
}
};
//
protected:
@@ -125,16 +136,16 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
Handle(BOPDS_PaveBlock) myPB;
};
//=======================================================================
typedef BOPCol_NCVector
typedef NCollection_Vector
<BOPAlgo_VertexEdge> BOPAlgo_VectorOfVertexEdge;
//
typedef BOPCol_ContextFunctor
typedef BOPTools_ContextFunctor
<BOPAlgo_VertexEdge,
BOPAlgo_VectorOfVertexEdge,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_VertexEdgeFunctor;
//
typedef BOPCol_ContextCnt
typedef BOPTools_ContextCnt
<BOPAlgo_VertexEdgeFunctor,
BOPAlgo_VectorOfVertexEdge,
Handle(IntTools_Context)> BOPAlgo_VertexEdgeCnt;
@@ -183,9 +194,9 @@ void BOPAlgo_PaveFiller::PerformVE()
continue;
}
//
BOPCol_ListOfInteger* pLV = aMVEPairs.ChangeSeek(aPB);
TColStd_ListOfInteger* pLV = aMVEPairs.ChangeSeek(aPB);
if (!pLV)
pLV = &aMVEPairs(aMVEPairs.Add(aPB, BOPCol_ListOfInteger()));
pLV = &aMVEPairs(aMVEPairs.Add(aPB, TColStd_ListOfInteger()));
pLV->Append(nV);
}
//
@@ -216,14 +227,14 @@ void BOPAlgo_PaveFiller::IntersectVE
// for all vertices having the same SD vertex.
// It will also be used as a Fence map to avoid repeated
// intersection of the same SD vertex with edge
NCollection_DataMap<BOPDS_Pair, BOPCol_ListOfInteger, BOPDS_PairMapHasher> aDMVSD;
NCollection_DataMap<BOPDS_Pair, TColStd_ListOfInteger, BOPDS_PairMapHasher> aDMVSD;
//
for (i = 1; i <= aNbVE; ++i) {
const Handle(BOPDS_PaveBlock)& aPB = theVEPairs.FindKey(i);
Standard_Integer nE = aPB->OriginalEdge();
//
const BOPCol_ListOfInteger& aLV = theVEPairs(i);
BOPCol_ListIteratorOfListOfInteger aItLV(aLV);
const TColStd_ListOfInteger& aLV = theVEPairs(i);
TColStd_ListIteratorOfListOfInteger aItLV(aLV);
for (; aItLV.More(); aItLV.Next()) {
Standard_Integer nV = aItLV.Value();
//
@@ -231,20 +242,20 @@ void BOPAlgo_PaveFiller::IntersectVE
myDS->HasShapeSD(nV, nVSD);
//
BOPDS_Pair aPair(nVSD, nE);
BOPCol_ListOfInteger* pLI = aDMVSD.ChangeSeek(aPair);
TColStd_ListOfInteger* pLI = aDMVSD.ChangeSeek(aPair);
if (pLI) {
// Already added
pLI->Append(nV);
continue;
}
// New pair
pLI = aDMVSD.Bound(aPair, BOPCol_ListOfInteger());
pLI = aDMVSD.Bound(aPair, TColStd_ListOfInteger());
pLI->Append(nV);
//
const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nVSD));
const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(nE));
//
BOPAlgo_VertexEdge& aVESolver = aVVE.Append1();
BOPAlgo_VertexEdge& aVESolver = aVVE.Appended();
aVESolver.SetIndices(nVSD, nE);
aVESolver.SetVertex(aV);
aVESolver.SetEdge(aE);
@@ -260,13 +271,18 @@ void BOPAlgo_PaveFiller::IntersectVE
//=============================================================
//
// Keep the modified edges for further update
BOPCol_MapOfInteger aMEdges;
TColStd_MapOfInteger aMEdges;
//
// Analyze intersections
aNbVE = aVVE.Extent();
aNbVE = aVVE.Length();
for (i = 0; i < aNbVE; ++i) {
const BOPAlgo_VertexEdge& aVESolver = aVVE(i);
if (aVESolver.Flag() != 0) {
if (aVESolver.HasErrors())
{
// Warn about failed intersection of sub-shapes
AddIntersectionFailedWarning(aVESolver.Vertex(), aVESolver.Edge());
}
continue;
}
//
@@ -289,12 +305,12 @@ void BOPAlgo_PaveFiller::IntersectVE
if (theAddInterfs) {
// Add interferences into DS
BOPDS_Pair aPair(nV, nE);
const BOPCol_ListOfInteger& aLI = aDMVSD.Find(aPair);
BOPCol_ListIteratorOfListOfInteger aItLI(aLI);
const TColStd_ListOfInteger& aLI = aDMVSD.Find(aPair);
TColStd_ListIteratorOfListOfInteger aItLI(aLI);
for (; aItLI.More(); aItLI.Next()) {
const Standard_Integer nVOld = aItLI.Value();
// 3. Create interference V/E
BOPDS_InterfVE& aVE = aVEs.Append1();
BOPDS_InterfVE& aVE = aVEs.Appended();
aVE.SetIndices(nVOld, nE);
aVE.SetParameter(aT);
// 2. Add a pair in the whole table of interferences
@@ -320,7 +336,7 @@ void BOPAlgo_PaveFiller::IntersectVE
//=======================================================================
static
void MakeNewCommonBlock(const BOPDS_ListOfPaveBlock& theLPB,
const BOPCol_ListOfInteger& theLFaces,
const TColStd_ListOfInteger& theLFaces,
BOPDS_PDS& theDS)
{
// Make Common Block from the pave blocks in the list
@@ -338,7 +354,7 @@ static
// function: SplitPaveBlocks
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::SplitPaveBlocks(const BOPCol_MapOfInteger& theMEdges,
void BOPAlgo_PaveFiller::SplitPaveBlocks(const TColStd_MapOfInteger& theMEdges,
const Standard_Boolean theAddInterfs)
{
// Fence map to avoid unification of the same vertices twice
@@ -348,7 +364,7 @@ void BOPAlgo_PaveFiller::SplitPaveBlocks(const BOPCol_MapOfInteger& theMEdges,
BOPDS_ListOfPaveBlock,
TColStd_MapTransientHasher> aMCBNewPB;
//
BOPCol_MapIteratorOfMapOfInteger aItM(theMEdges);
TColStd_MapIteratorOfMapOfInteger aItM(theMEdges);
for (; aItM.More(); aItM.Next()) {
Standard_Integer nE = aItM.Value();
BOPDS_ListOfPaveBlock& aLPB = myDS->ChangePaveBlocks(nE);
@@ -384,7 +400,7 @@ void BOPAlgo_PaveFiller::SplitPaveBlocks(const BOPCol_MapOfInteger& theMEdges,
BOPDS_Pair aPair;
aPair.SetIndices(nV1, nV2);
if (aMPairs.Add(aPair)) {
BOPCol_ListOfInteger aLV;
TColStd_ListOfInteger aLV;
aLV.Append(nV1);
aLV.Append(nV2);
MakeSDVertices(aLV, theAddInterfs);
@@ -491,3 +507,19 @@ void BOPAlgo_PaveFiller::SplitPaveBlocks(const BOPCol_MapOfInteger& theMEdges,
}
}
}
//=======================================================================
// function: AddIntersectionFailedWarning
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::AddIntersectionFailedWarning(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2)
{
// Create the warn shape
TopoDS_Compound aWC;
BRep_Builder().MakeCompound(aWC);
BRep_Builder().Add(aWC, theS1);
BRep_Builder().Add(aWC, theS2);
// Add the warning
AddWarning(new BOPAlgo_AlertIntersectionOfPairOfShapesFailed(aWC));
}

View File

@@ -20,8 +20,6 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPDS_CommonBlock.hxx>
#include <BOPDS_CoupleOfPaveBlocks.hxx>
#include <BOPDS_DS.hxx>
@@ -32,6 +30,7 @@
#include <BOPDS_PaveBlock.hxx>
#include <BOPDS_VectorOfInterfEE.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_Parallel.hxx>
#include <BndLib_Add3dCurve.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
@@ -45,6 +44,8 @@
#include <IntTools_SequenceOfRanges.hxx>
#include <IntTools_ShrunkRange.hxx>
#include <IntTools_Tools.hxx>
#include <NCollection_IncAllocator.hxx>
#include <NCollection_Vector.hxx>
#include <Precision.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
@@ -93,7 +94,16 @@ class BOPAlgo_EdgeEdge :
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
IntTools_EdgeEdge::Perform();
try
{
OCC_CATCH_SIGNALS
IntTools_EdgeEdge::Perform();
}
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertIntersectionFailed);
}
}
//
protected:
@@ -102,14 +112,14 @@ class BOPAlgo_EdgeEdge :
};
//
//=======================================================================
typedef BOPCol_NCVector
typedef NCollection_Vector
<BOPAlgo_EdgeEdge> BOPAlgo_VectorOfEdgeEdge;
//
typedef BOPCol_Functor
typedef BOPTools_Functor
<BOPAlgo_EdgeEdge,
BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeFunctor;
//
typedef BOPCol_Cnt
typedef BOPTools_Cnt
<BOPAlgo_EdgeEdgeFunctor,
BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeCnt;
//
@@ -138,7 +148,7 @@ void BOPAlgo_PaveFiller::PerformEE()
BOPAlgo_VectorOfEdgeEdge aVEdgeEdge;
BOPDS_MapIteratorOfMapOfPaveBlock aItPB;
// keep modified edges for further update
BOPCol_MapOfInteger aMEdges;
TColStd_MapOfInteger aMEdges;
//
aAllocator=NCollection_BaseAllocator::CommonBaseAllocator();
//-----------------------------------------------------scope f
@@ -205,7 +215,7 @@ void BOPAlgo_PaveFiller::PerformEE()
bExpressCompute=((nV11==nV21 && nV12==nV22) ||
(nV12==nV21 && nV11==nV22));
//
BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge.Append1();
BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge.Appended();
//
anEdgeEdge.UseQuickCoincidenceCheck(bExpressCompute);
//
@@ -220,7 +230,7 @@ void BOPAlgo_PaveFiller::PerformEE()
}//for (; aIt1.More(); aIt1.Next()) {
}//for (; myIterator->More(); myIterator->Next()) {
//
aNbEdgeEdge=aVEdgeEdge.Extent();
aNbEdgeEdge=aVEdgeEdge.Length();
//======================================================
BOPAlgo_EdgeEdgeCnt::Perform(myRunParallel, aVEdgeEdge);
//======================================================
@@ -229,7 +239,11 @@ void BOPAlgo_PaveFiller::PerformEE()
Bnd_Box aBB1, aBB2;
//
BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge(k);
if (!anEdgeEdge.IsDone()) {
if (!anEdgeEdge.IsDone() || anEdgeEdge.HasErrors()) {
// Warn about failed intersection of sub-shapes
const TopoDS_Shape& aE1 = myDS->Shape(anEdgeEdge.PaveBlock1()->OriginalEdge());
const TopoDS_Shape& aE2 = myDS->Shape(anEdgeEdge.PaveBlock2()->OriginalEdge());
AddIntersectionFailedWarning(aE1, aE2);
continue;
}
//
@@ -334,13 +348,12 @@ void BOPAlgo_PaveFiller::PerformEE()
if (bIsOnPave[j]) {
//add interf VE(nV[j], nE)
Handle(BOPDS_PaveBlock)& aPB = (j < 2) ? aPB2 : aPB1;
ForceInterfVE(nV[j], aPB, aMEdges);
bFlag = Standard_True;
bFlag = ForceInterfVE(nV[j], aPB, aMEdges);
break;
}
}
if (bFlag) {
BOPDS_InterfEE& aEE = aEEs.Append1();
BOPDS_InterfEE& aEE = aEEs.Appended();
aEE.SetIndices(nE1, nE2);
aEE.SetCommonPart(aCPart);
continue;
@@ -361,7 +374,7 @@ void BOPAlgo_PaveFiller::PerformEE()
{
Standard_Integer nVS[2], iFound;
Standard_Real aTolVx, aD2, aDT2;
BOPCol_MapOfInteger aMV;
TColStd_MapOfInteger aMV;
gp_Pnt aPnew, aPx;
//
iFound=0;
@@ -400,8 +413,8 @@ void BOPAlgo_PaveFiller::PerformEE()
}
//
// 1
BOPDS_InterfEE& aEE=aEEs.Append1();
iX=aEEs.Extent()-1;
BOPDS_InterfEE& aEE=aEEs.Appended();
iX=aEEs.Length()-1;
aEE.SetIndices(nE1, nE2);
aEE.SetCommonPart(aCPart);
// 2
@@ -427,8 +440,8 @@ void BOPAlgo_PaveFiller::PerformEE()
break;
}
// 1
BOPDS_InterfEE& aEE=aEEs.Append1();
iX=aEEs.Extent()-1;
BOPDS_InterfEE& aEE=aEEs.Appended();
iX=aEEs.Length()-1;
aEE.SetIndices(nE1, nE2);
aEE.SetCommonPart(aCPart);
// 2
@@ -484,7 +497,7 @@ void BOPAlgo_PaveFiller::PerformNewVertices
Standard_Real aTolAdd = myFuzzyValue / 2.;
//
// 1. Fuse the new vertices
BOPCol_IndexedDataMapOfShapeListOfShape aImages;
TopTools_IndexedDataMapOfShapeListOfShape aImages;
TreatNewVertices(theMVCPB, aImages);
//
// 2. Add new vertices to myDS and connect indices to CPB structure
@@ -494,7 +507,7 @@ void BOPAlgo_PaveFiller::PerformNewVertices
Standard_Integer i, aNb = aImages.Extent();
for (i = 1; i <= aNb; ++i) {
const TopoDS_Vertex& aV = TopoDS::Vertex(aImages.FindKey(i));
const BOPCol_ListOfShape& aLVSD = aImages.FindFromIndex(i);
const TopTools_ListOfShape& aLVSD = aImages.FindFromIndex(i);
//
BOPDS_ShapeInfo aSI;
aSI.SetShapeType(TopAbs_VERTEX);
@@ -506,7 +519,7 @@ void BOPAlgo_PaveFiller::PerformNewVertices
aBox.Add(BRep_Tool::Pnt(aV));
aBox.SetGap(BRep_Tool::Tolerance(aV) + aTolAdd);
//
BOPCol_ListIteratorOfListOfShape aItLS(aLVSD);
TopTools_ListIteratorOfListOfShape aItLS(aLVSD);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aVx = aItLS.Value();
BOPDS_CoupleOfPaveBlocks &aCPB = theMVCPB.ChangeFromKey(aVx);
@@ -527,9 +540,9 @@ void BOPAlgo_PaveFiller::PerformNewVertices
Handle(BOPDS_PaveBlock) aPB[2];
aCPB.PaveBlocks(aPB[0], aPB[1]);
for (Standard_Integer j = 0; j < 2; ++j) {
BOPCol_ListOfInteger *pLI = aMPBLI.ChangeSeek(aPB[j]);
TColStd_ListOfInteger *pLI = aMPBLI.ChangeSeek(aPB[j]);
if (!pLI) {
pLI = &aMPBLI(aMPBLI.Add(aPB[j], BOPCol_ListOfInteger(theAllocator)));
pLI = &aMPBLI(aMPBLI.Add(aPB[j], TColStd_ListOfInteger(theAllocator)));
}
pLI->Append(iV);
//
@@ -548,11 +561,11 @@ void BOPAlgo_PaveFiller::PerformNewVertices
//=======================================================================
void BOPAlgo_PaveFiller::TreatNewVertices
(const BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
BOPCol_IndexedDataMapOfShapeListOfShape& myImages)
TopTools_IndexedDataMapOfShapeListOfShape& myImages)
{
//
// Prepare for intersection
BOPCol_IndexedDataMapOfShapeReal aVerts;
TopTools_IndexedDataMapOfShapeReal aVerts;
Standard_Integer i, aNbV = theMVCPB.Extent();
for (i = 1; i <= aNbV; ++i) {
const TopoDS_Shape& aV = theMVCPB.FindKey(i);
@@ -561,13 +574,13 @@ void BOPAlgo_PaveFiller::TreatNewVertices
}
//
// Perform intersection
BOPCol_ListOfListOfShape aChains;
TopTools_ListOfListOfShape aChains;
BOPAlgo_Tools::IntersectVertices(aVerts, myRunParallel, myFuzzyValue, aChains);
//
// Treat the results - make new vertices for each chain
BOPCol_ListOfListOfShape::Iterator aItC(aChains);
TopTools_ListOfListOfShape::Iterator aItC(aChains);
for (; aItC.More(); aItC.Next()) {
const BOPCol_ListOfShape& aLVSD = aItC.Value();
const TopTools_ListOfShape& aLVSD = aItC.Value();
//
TopoDS_Vertex aVNew;
BOPTools_AlgoTools::MakeVertex(aLVSD, aVNew);
@@ -651,9 +664,9 @@ void BOPAlgo_PaveFiller::AnalyzeShrunkData(const Handle(BOPDS_PaveBlock)& thePB,
//function : ForceInterfVE
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
Handle(BOPDS_PaveBlock)& aPB,
BOPCol_MapOfInteger& theMEdges)
Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
Handle(BOPDS_PaveBlock)& aPB,
TColStd_MapOfInteger& theMEdges)
{
Standard_Integer nE, nVx, nVSD, iFlag;
Standard_Real aT, aTolVNew;
@@ -662,20 +675,20 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
//
const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
if (aSIE.HasSubShape(nV)) {
return;
return Standard_False;
}
//
if (myDS->HasInterf(nV, nE)) {
return;
return Standard_False;
}
//
if (myDS->HasInterfShapeSubShapes(nV, nE)) {
return;
return Standard_False;
}
//
if (aPB->Pave1().Index() == nV ||
aPB->Pave2().Index() == nV) {
return;
return Standard_False;
}
//
nVx = nV;
@@ -694,7 +707,7 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
aVEs.SetIncrement(10);
// 1
BOPDS_InterfVE& aVE=aVEs.Append1();
BOPDS_InterfVE& aVE=aVEs.Appended();
aVE.SetIndices(nV, nE);
aVE.SetParameter(aT);
// 2
@@ -723,7 +736,9 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
BRep_Builder().Add(aWC, aE);
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
}
return Standard_True;
}
return Standard_False;
}
//=======================================================================
@@ -768,3 +783,212 @@ Standard_Boolean BOPAlgo_PaveFiller::GetPBBox(const TopoDS_Edge& theE,
}
return bValid;
}
//=======================================================================
//function : ForceInterfEE
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::ForceInterfEE()
{
// Now that we have vertices increased and unified, try to find additional
// common blocks among the pairs of edges that did not participate in
// intersection (PerformEE() method) due to being rejected by bounding boxes.
// Here, we are interested in common blocks only, as all real intersections
// should have happened already. Thus, we need to look only for the same
// vertices in the pairs of pave blocks and check the coincidence of such pave blocks.
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
// Initialize pave blocks for all SD vertices
Standard_Integer i, aNbS = myDS->NbSourceShapes();
for (i = 0; i < aNbS; ++i)
{
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
if (aSI.ShapeType() == TopAbs_VERTEX)
{
Standard_Integer nVSD;
if (myDS->HasShapeSD(i, nVSD))
myDS->InitPaveBlocksForVertex(i);
}
}
// Find all Pave Blocks with both paves being SD vertices.
NCollection_IndexedDataMap<BOPDS_Pair,
BOPDS_ListOfPaveBlock,
BOPDS_PairMapHasher> aPBMap(1, anAlloc);
// Fence map of pave blocks
BOPDS_MapOfPaveBlock aMPBFence(1, anAlloc);
BOPDS_VectorOfListOfPaveBlock& aPBP = myDS->ChangePaveBlocksPool();
Standard_Integer aNbPBP = aPBP.Length();
for (i = 0; i < aNbPBP; ++i)
{
BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB);
for (; aItLPB.More(); aItLPB.Next())
{
const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
const Handle(BOPDS_PaveBlock)& aPBR = myDS->RealPaveBlock(aPB);
if (!aMPBFence.Add(aPBR))
continue;
// Get indices
Standard_Integer nV1, nV2;
aPBR->Indices(nV1, nV2);
// Add pave block to a map
BOPDS_Pair aPair(nV1, nV2);
BOPDS_ListOfPaveBlock *pList = aPBMap.ChangeSeek(aPair);
if (!pList)
pList = &aPBMap(aPBMap.Add(aPair, BOPDS_ListOfPaveBlock(anAlloc)));
pList->Append(aPBR);
}
}
Standard_Integer aNbPB = aPBMap.Extent();
if (!aNbPB)
return;
// Find pairs of Pave Blocks having the same SD vertices,
// rejecting the pairs of edges that have already been intersected
// Prepare map of pairs of intersected edges
BOPDS_MapOfPair aMEEDone(1, anAlloc);
myIterator->Initialize(TopAbs_EDGE, TopAbs_EDGE);
for (; myIterator->More(); myIterator->Next())
{
Standard_Integer nE1, nE2;
myIterator->Value(nE1, nE2);
aMEEDone.Add(BOPDS_Pair(nE1, nE2));
}
// Vector of pairs for intersection
BOPAlgo_VectorOfEdgeEdge aVEdgeEdge;
for (i = 1; i <= aNbPB; ++i)
{
const BOPDS_ListOfPaveBlock& aLPB = aPBMap(i);
if (aLPB.Extent() < 2)
continue;
const BOPDS_Pair& aPair = aPBMap.FindKey(i);
Standard_Integer nV1, nV2;
aPair.Indices(nV1, nV2);
const TopoDS_Vertex& aV1 = TopoDS::Vertex(myDS->Shape(nV1));
const TopoDS_Vertex& aV2 = TopoDS::Vertex(myDS->Shape(nV2));
// Use the max tolerance of vertices as Fuzzy value for intersection
// of edges
Standard_Real aTolAdd = 2 * Max(BRep_Tool::Tolerance(aV1),
BRep_Tool::Tolerance(aV2));
// All possible pairs combined from the list <aLPB> should be checked
BOPDS_ListIteratorOfListOfPaveBlock aItLPB1(aLPB);
for (; aItLPB1.More(); aItLPB1.Next())
{
const Handle(BOPDS_PaveBlock)& aPB1 = aItLPB1.Value();
const Standard_Integer nE1 = aPB1->OriginalEdge();
const TopoDS_Edge& aE1 = TopoDS::Edge(myDS->Shape(nE1));
Standard_Real aT11, aT12;
aPB1->Range(aT11, aT12);
BOPDS_ListIteratorOfListOfPaveBlock aItLPB2 = aItLPB1;
for (aItLPB2.Next(); aItLPB2.More(); aItLPB2.Next())
{
const Handle(BOPDS_PaveBlock)& aPB2 = aItLPB2.Value();
const Standard_Integer nE2 = aPB2->OriginalEdge();
if (aMEEDone.Contains(BOPDS_Pair(nE1, nE2)))
continue;
// Make sure that the edges came from different arguments
if (myDS->Rank(nE1) == myDS->Rank(nE2))
continue;
const TopoDS_Edge& aE2 = TopoDS::Edge(myDS->Shape(nE2));
Standard_Real aT21, aT22;
aPB2->Range(aT21, aT22);
// Add pair for intersection
BOPAlgo_EdgeEdge& anEdgeEdge = aVEdgeEdge.Appended();
anEdgeEdge.UseQuickCoincidenceCheck(Standard_True);
anEdgeEdge.SetPaveBlock1(aPB1);
anEdgeEdge.SetPaveBlock2(aPB2);
anEdgeEdge.SetEdge1(aE1, aT11, aT12);
anEdgeEdge.SetEdge2(aE2, aT21, aT22);
anEdgeEdge.SetFuzzyValue(myFuzzyValue + aTolAdd);
anEdgeEdge.SetProgressIndicator(myProgressIndicator);
}
}
}
Standard_Integer aNbPairs = aVEdgeEdge.Length();
if (!aNbPairs)
return;
aPBMap.Clear();
aMPBFence.Clear();
aMEEDone.Clear();
anAlloc->Reset();
// Perform intersection of the found pairs
BOPAlgo_EdgeEdgeCnt::Perform(myRunParallel, aVEdgeEdge);
BOPDS_VectorOfInterfEE& aEEs = myDS->InterfEE();
if (aEEs.IsEmpty())
aEEs.SetIncrement(10);
// Analyze the results of intersection looking for TopAbs_EDGE
// intersection type only.
BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock aMPBLPB(1, anAlloc);
for (i = 0; i < aNbPairs; ++i)
{
BOPAlgo_EdgeEdge& anEdgeEdge = aVEdgeEdge(i);
if (!anEdgeEdge.IsDone() || anEdgeEdge.HasErrors())
{
// Warn about failed intersection of sub-shapes
const TopoDS_Shape& aE1 = myDS->Shape(anEdgeEdge.PaveBlock1()->OriginalEdge());
const TopoDS_Shape& aE2 = myDS->Shape(anEdgeEdge.PaveBlock2()->OriginalEdge());
AddIntersectionFailedWarning(aE1, aE2);
continue;
}
const IntTools_SequenceOfCommonPrts& aCParts = anEdgeEdge.CommonParts();
if (aCParts.Length() != 1)
continue;
const IntTools_CommonPrt& aCP = aCParts(1);
if (aCP.Type() != TopAbs_EDGE)
continue;
Handle(BOPDS_PaveBlock) aPB[] = {anEdgeEdge.PaveBlock1(), anEdgeEdge.PaveBlock2()};
const Standard_Integer nE1 = aPB[0]->OriginalEdge();
const Standard_Integer nE2 = aPB[1]->OriginalEdge();
BOPDS_InterfEE& aEE = aEEs.Appended();
aEE.SetIndices(nE1, nE2);
aEE.SetCommonPart(aCP);
myDS->AddInterf(nE1, nE2);
// Fill map for common blocks creation
for (Standard_Integer j = 0; j < 2; ++j)
{
if (myDS->IsCommonBlock(aPB[j]))
{
const BOPDS_ListOfPaveBlock& aLPBCB = myDS->CommonBlock(aPB[j])->PaveBlocks();
BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPBCB);
for (; aItLPB.More(); aItLPB.Next())
BOPAlgo_Tools::FillMap<Handle(BOPDS_PaveBlock),
TColStd_MapTransientHasher>(aPB[j], aItLPB.Value(), aMPBLPB, anAlloc);
}
}
BOPAlgo_Tools::FillMap<Handle(BOPDS_PaveBlock),
TColStd_MapTransientHasher>(aPB[0], aPB[1], aMPBLPB, anAlloc);
}
// Create new common blocks of coinciding pairs.
BOPAlgo_Tools::PerformCommonBlocks(aMPBLPB, anAlloc, myDS);
}

View File

@@ -17,10 +17,8 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPDS_Curve.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_FaceInfo.hxx>
@@ -30,11 +28,14 @@
#include <BOPDS_PaveBlock.hxx>
#include <BOPDS_SubIterator.hxx>
#include <BOPDS_VectorOfInterfVF.hxx>
#include <BOPTools_Parallel.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepBndLib.hxx>
#include <gp_Pnt.hxx>
#include <IntTools_Context.hxx>
#include <NCollection_Vector.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
@@ -107,7 +108,16 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew, myFuzzyValue);
try
{
OCC_CATCH_SIGNALS
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew, myFuzzyValue);
}
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertIntersectionFailed);
}
}
//
protected:
@@ -122,16 +132,16 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
Handle(IntTools_Context) myContext;
};
//=======================================================================
typedef BOPCol_NCVector<BOPAlgo_VertexFace>
typedef NCollection_Vector<BOPAlgo_VertexFace>
BOPAlgo_VectorOfVertexFace;
//
typedef BOPCol_ContextFunctor
typedef BOPTools_ContextFunctor
<BOPAlgo_VertexFace,
BOPAlgo_VectorOfVertexFace,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_VertexFaceFunctor;
//
typedef BOPCol_ContextCnt
typedef BOPTools_ContextCnt
<BOPAlgo_VertexFaceFunctor,
BOPAlgo_VectorOfVertexFace,
Handle(IntTools_Context)> BOPAlgo_VertexFaceCnt;
@@ -194,7 +204,7 @@ void BOPAlgo_PaveFiller::PerformVF()
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
//
BOPAlgo_VertexFace& aVertexFace=aVVF.Append1();
BOPAlgo_VertexFace& aVertexFace=aVVF.Appended();
//
aVertexFace.SetIndices(nV, nF);
aVertexFace.SetVertex(aV);
@@ -203,7 +213,7 @@ void BOPAlgo_PaveFiller::PerformVF()
aVertexFace.SetProgressIndicator(myProgressIndicator);
}//for (; myIterator->More(); myIterator->Next()) {
//
aNbVF=aVVF.Extent();
aNbVF=aVVF.Length();
//================================================================
BOPAlgo_VertexFaceCnt::Perform(myRunParallel, aVVF, myContext);
//================================================================
@@ -212,14 +222,19 @@ void BOPAlgo_PaveFiller::PerformVF()
const BOPAlgo_VertexFace& aVertexFace=aVVF(k);
//
iFlag=aVertexFace.Flag();
if (iFlag) {
if (iFlag != 0) {
if (aVertexFace.HasErrors())
{
// Warn about failed intersection of sub-shapes
AddIntersectionFailedWarning(aVertexFace.Vertex(), aVertexFace.Face());
}
continue;
}
//
aVertexFace.Indices(nV, nF);
aVertexFace.Parameters(aT1, aT2);
// 1
BOPDS_InterfVF& aVF=aVFs.Append1();
BOPDS_InterfVF& aVF=aVFs.Appended();
aVF.SetIndices(nV, nF);
aVF.SetUV(aT1, aT2);
// 2
@@ -235,7 +250,7 @@ void BOPAlgo_PaveFiller::PerformVF()
}
// 5 update FaceInfo
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
TColStd_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
aMVIn.Add(nVx);
}//for (k=0; k < aNbVF; ++k) {
//
@@ -249,19 +264,19 @@ void BOPAlgo_PaveFiller::TreatVerticesEE()
{
Standard_Integer i, aNbS,aNbEEs, nF, nV, iFlag;
Standard_Real aT1, aT2, dummy;
BOPCol_ListIteratorOfListOfInteger aItLI;
TColStd_ListIteratorOfListOfInteger aItLI;
Handle(NCollection_BaseAllocator) aAllocator;
//
aAllocator=
NCollection_BaseAllocator::CommonBaseAllocator();
BOPCol_ListOfInteger aLIV(aAllocator), aLIF(aAllocator);
BOPCol_MapOfInteger aMI(100, aAllocator);
TColStd_ListOfInteger aLIV(aAllocator), aLIF(aAllocator);
TColStd_MapOfInteger aMI(100, aAllocator);
BOPDS_MapOfPaveBlock aMPBF(100, aAllocator);
//
aNbS=myDS->NbSourceShapes();
//
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
aNbEEs=aEEs.Extent();
aNbEEs=aEEs.Length();
for (i=0; i<aNbEEs; ++i) {
BOPDS_InterfEE& aEE=aEEs(i);
if (aEE.HasIndexNew()) {
@@ -301,7 +316,7 @@ void BOPAlgo_PaveFiller::TreatVerticesEE()
aIt.Value(nV, nF);
//
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
const BOPCol_MapOfInteger& aMVOn=aFI.VerticesOn();
const TColStd_MapOfInteger& aMVOn=aFI.VerticesOn();
//
if (!aMVOn.Contains(nV)) {
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nV)));
@@ -309,14 +324,14 @@ void BOPAlgo_PaveFiller::TreatVerticesEE()
iFlag = myContext->ComputeVF(aV, aF, aT1, aT2, dummy, myFuzzyValue);
if (!iFlag) {
// 1
BOPDS_InterfVF& aVF=aVFs.Append1();
i=aVFs.Extent()-1;
BOPDS_InterfVF& aVF=aVFs.Appended();
i=aVFs.Length()-1;
aVF.SetIndices(nV, nF);
aVF.SetUV(aT1, aT2);
// 2
myDS->AddInterf(nV, nF);
//
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
TColStd_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
aMVIn.Add(nV);
}
}

View File

@@ -20,9 +20,6 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPDS_CommonBlock.hxx>
#include <BOPDS_CoupleOfPaveBlocks.hxx>
#include <BOPDS_Curve.hxx>
@@ -33,6 +30,7 @@
#include <BOPDS_Pave.hxx>
#include <BOPDS_PaveBlock.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_Parallel.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
@@ -43,7 +41,9 @@
#include <IntTools_Range.hxx>
#include <IntTools_SequenceOfCommonPrts.hxx>
#include <IntTools_Tools.hxx>
#include <NCollection_Vector.hxx>
#include <Precision.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
@@ -103,7 +103,16 @@ class BOPAlgo_EdgeFace :
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
IntTools_EdgeFace::Perform();
try
{
OCC_CATCH_SIGNALS
IntTools_EdgeFace::Perform();
}
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertIntersectionFailed);
}
}
//
protected:
@@ -114,15 +123,15 @@ class BOPAlgo_EdgeFace :
};
//
//=======================================================================
typedef BOPCol_NCVector<BOPAlgo_EdgeFace> BOPAlgo_VectorOfEdgeFace;
typedef NCollection_Vector<BOPAlgo_EdgeFace> BOPAlgo_VectorOfEdgeFace;
//
typedef BOPCol_ContextFunctor
typedef BOPTools_ContextFunctor
<BOPAlgo_EdgeFace,
BOPAlgo_VectorOfEdgeFace,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_EdgeFaceFunctor;
//
typedef BOPCol_ContextCnt
typedef BOPTools_ContextCnt
<BOPAlgo_EdgeFaceFunctor,
BOPAlgo_VectorOfEdgeFace,
Handle(IntTools_Context)> BOPAlgo_EdgeFaceCnt;
@@ -169,7 +178,7 @@ void BOPAlgo_PaveFiller::PerformEF()
//
aAllocator=NCollection_BaseAllocator::CommonBaseAllocator();
//
BOPCol_MapOfInteger aMIEFC(100, aAllocator);
TColStd_MapOfInteger aMIEFC(100, aAllocator);
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMVCPB(100, aAllocator);
BOPDS_IndexedDataMapOfPaveBlockListOfInteger aMPBLI(100, aAllocator);
BOPAlgo_DataMapOfPaveBlockBndBox aDMPBBox(100, aAllocator);
@@ -195,8 +204,8 @@ void BOPAlgo_PaveFiller::PerformEF()
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
const BOPDS_IndexedMapOfPaveBlock& aMPBF=aFI.PaveBlocksOn();
//
const BOPCol_MapOfInteger& aMVIn=aFI.VerticesIn();
const BOPCol_MapOfInteger& aMVOn=aFI.VerticesOn();
const TColStd_MapOfInteger& aMVIn=aFI.VerticesIn();
const TColStd_MapOfInteger& aMVOn=aFI.VerticesOn();
//
aTolE=BRep_Tool::Tolerance(aE);
aTolF=BRep_Tool::Tolerance(aF);
@@ -225,7 +234,7 @@ void BOPAlgo_PaveFiller::PerformEF()
bV2=aMVIn.Contains(nV2) || aMVOn.Contains(nV2);
bExpressCompute=bV1 && bV2;
//
BOPAlgo_EdgeFace& aEdgeFace=aVEdgeFace.Append1();
BOPAlgo_EdgeFace& aEdgeFace=aVEdgeFace.Appended();
//
aEdgeFace.SetIndices(nE, nF);
aEdgeFace.SetPaveBlock(aPB);
@@ -251,14 +260,16 @@ void BOPAlgo_PaveFiller::PerformEF()
}//for (; aIt.More(); aIt.Next()) {
}//for (; myIterator->More(); myIterator->Next()) {
//
aNbEdgeFace=aVEdgeFace.Extent();
aNbEdgeFace=aVEdgeFace.Length();
//=================================================================
BOPAlgo_EdgeFaceCnt::Perform(myRunParallel, aVEdgeFace, myContext);
//=================================================================
//
for (k=0; k < aNbEdgeFace; ++k) {
BOPAlgo_EdgeFace& aEdgeFace=aVEdgeFace(k);
if (!aEdgeFace.IsDone()) {
if (!aEdgeFace.IsDone() || aEdgeFace.HasErrors()) {
// Warn about failed intersection of sub-shapes
AddIntersectionFailedWarning(aEdgeFace.Edge(), aEdgeFace.Face());
continue;
}
//
@@ -295,8 +306,8 @@ void BOPAlgo_PaveFiller::PerformEF()
IntTools_Range aR1(aT1, aTS1), aR2(aTS2, aT2);
//
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
const BOPCol_MapOfInteger& aMIFOn=aFI.VerticesOn();
const BOPCol_MapOfInteger& aMIFIn=aFI.VerticesIn();
const TColStd_MapOfInteger& aMIFOn=aFI.VerticesOn();
const TColStd_MapOfInteger& aMIFIn=aFI.VerticesIn();
//
Standard_Boolean bLinePlane = Standard_False;
if (aNbCPrts) {
@@ -331,8 +342,8 @@ void BOPAlgo_PaveFiller::PerformEF()
if (bV[0] && bV[1]) {
IntTools_CommonPrt aCP = aCPart;
aCP.SetType(TopAbs_EDGE);
BOPDS_InterfEF& aEF=aEFs.Append1();
iX=aEFs.Extent()-1;
BOPDS_InterfEF& aEF=aEFs.Appended();
iX=aEFs.Length()-1;
aEF.SetIndices(nE, nF);
aEF.SetCommonPart(aCP);
myDS->AddInterf(nE, nF);
@@ -400,8 +411,8 @@ void BOPAlgo_PaveFiller::PerformEF()
//
aMIEFC.Add(nF);
// 1
BOPDS_InterfEF& aEF=aEFs.Append1();
iX=aEFs.Extent()-1;
BOPDS_InterfEF& aEF=aEFs.Appended();
iX=aEFs.Length()-1;
aEF.SetIndices(nE, nF);
aEF.SetCommonPart(aCPart);
// 2
@@ -420,8 +431,8 @@ void BOPAlgo_PaveFiller::PerformEF()
aMIEFC.Add(nF);
//
// 1
BOPDS_InterfEF& aEF=aEFs.Append1();
iX=aEFs.Extent()-1;
BOPDS_InterfEF& aEF=aEFs.Appended();
iX=aEFs.Length()-1;
aEF.SetIndices(nE, nF);
//
bV[0]=CheckFacePaves(nV[0], aMIFOn, aMIFIn);
@@ -451,7 +462,7 @@ void BOPAlgo_PaveFiller::PerformEF()
PerformNewVertices(aMVCPB, aAllocator, Standard_False);
//
// Update FaceInfoIn for all faces having EF common parts
BOPCol_MapIteratorOfMapOfInteger aItMI;
TColStd_MapIteratorOfMapOfInteger aItMI;
aItMI.Initialize(aMIEFC);
for (; aItMI.More(); aItMI.Next()) {
nF=aItMI.Value();
@@ -469,12 +480,12 @@ void BOPAlgo_PaveFiller::PerformEF()
//=======================================================================
Standard_Boolean BOPAlgo_PaveFiller::CheckFacePaves
(const Standard_Integer nVx,
const BOPCol_MapOfInteger& aMIFOn,
const BOPCol_MapOfInteger& aMIFIn)
const TColStd_MapOfInteger& aMIFOn,
const TColStd_MapOfInteger& aMIFIn)
{
Standard_Boolean bRet;
Standard_Integer nV;
BOPCol_MapIteratorOfMapOfInteger aIt;
TColStd_MapIteratorOfMapOfInteger aIt;
//
bRet=Standard_False;
//
@@ -503,11 +514,11 @@ Standard_Boolean BOPAlgo_PaveFiller::CheckFacePaves
//=======================================================================
Standard_Boolean BOPAlgo_PaveFiller::CheckFacePaves
(const TopoDS_Vertex& aVnew,
const BOPCol_MapOfInteger& aMIF)
const TColStd_MapOfInteger& aMIF)
{
Standard_Boolean bRet;
Standard_Integer nV, iFlag;
BOPCol_MapIteratorOfMapOfInteger aIt;
TColStd_MapIteratorOfMapOfInteger aIt;
//
bRet=Standard_True;
//
@@ -546,7 +557,7 @@ Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVF
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
aVFs.SetIncrement(10);
// 1
BOPDS_InterfVF& aVF=aVFs.Append1();
BOPDS_InterfVF& aVF=aVFs.Appended();
//
aVF.SetIndices(nV, nF);
aVF.SetUV(U, V);
@@ -561,7 +572,7 @@ Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVF
}
//
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
TColStd_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
aMVIn.Add(nVx);
//
// check for self-interference
@@ -599,7 +610,7 @@ void BOPAlgo_PaveFiller::ReduceIntersectionRange(const Standard_Integer theV1,
}
//
BOPDS_VectorOfInterfEE& aEEs = myDS->InterfEE();
Standard_Integer aNbEEs = aEEs.Extent();
Standard_Integer aNbEEs = aEEs.Length();
if (!aNbEEs) {
return;
}
@@ -608,9 +619,9 @@ void BOPAlgo_PaveFiller::ReduceIntersectionRange(const Standard_Integer theV1,
Standard_Real aTR1, aTR2;
//
// get face's edges to check that E/E contains the edge from the face
BOPCol_MapOfInteger aMFE;
const BOPCol_ListOfInteger& aLI = myDS->ShapeInfo(theF).SubShapes();
BOPCol_ListIteratorOfListOfInteger aItLI(aLI);
TColStd_MapOfInteger aMFE;
const TColStd_ListOfInteger& aLI = myDS->ShapeInfo(theF).SubShapes();
TColStd_ListIteratorOfListOfInteger aItLI(aLI);
for (; aItLI.More(); aItLI.Next()) {
nE1 = aItLI.Value();
if (myDS->ShapeInfo(nE1).ShapeType() == TopAbs_EDGE) {

File diff suppressed because it is too large Load Diff

View File

@@ -16,11 +16,9 @@
// commercial license or contractual agreement.
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPDS_CommonBlock.hxx>
#include <BOPDS_Curve.hxx>
#include <BOPDS_DS.hxx>
@@ -28,6 +26,8 @@
#include <BOPDS_Interf.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
#include <BOPDS_MapOfCommonBlock.hxx>
#include <BOPDS_MapOfPair.hxx>
#include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_Pave.hxx>
#include <BOPDS_PaveBlock.hxx>
@@ -38,6 +38,8 @@
#include <BOPDS_VectorOfListOfPaveBlock.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
#include <BOPTools_Parallel.hxx>
#include <BRepLib.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepBndLib.hxx>
@@ -51,12 +53,14 @@
#include <gp_Pnt.hxx>
#include <IntTools_Context.hxx>
#include <IntTools_Tools.hxx>
#include <NCollection_Vector.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
static
@@ -165,16 +169,16 @@ class BOPAlgo_SplitEdge : public BOPAlgo_Algo {
};
//
//=======================================================================
typedef BOPCol_NCVector
typedef NCollection_Vector
<BOPAlgo_SplitEdge> BOPAlgo_VectorOfSplitEdge;
//
typedef BOPCol_ContextFunctor
typedef BOPTools_ContextFunctor
<BOPAlgo_SplitEdge,
BOPAlgo_VectorOfSplitEdge,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_SplitEdgeFunctor;
//
typedef BOPCol_ContextCnt
typedef BOPTools_ContextCnt
<BOPAlgo_SplitEdgeFunctor,
BOPAlgo_VectorOfSplitEdge,
Handle(IntTools_Context)> BOPAlgo_SplitEdgeCnt;
@@ -241,31 +245,78 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
}
//
virtual void Perform() {
Standard_Integer iErr;
//
iErr=1;
if (!myEz.IsNull()) {
TopoDS_Edge aSpz;
//
BOPTools_AlgoTools::MakeSplitEdge(myEz,myV1, myT1,
myV2, myT2, aSpz);
//
iErr=
BOPTools_AlgoTools2D::AttachExistingPCurve(aSpz,
myE,
myF,
myContext);
try
{
OCC_CATCH_SIGNALS
// Check if edge has pcurve. If no then make its copy to avoid data races,
// and use it to build pcurve.
TopoDS_Edge aCopyE = myE;
Standard_Real f, l;
Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(aCopyE, myF, f, l);
if (aC2d.IsNull())
{
aCopyE = BOPTools_AlgoTools::CopyEdge(aCopyE);
Standard_Integer iErr = 1;
if (!myEz.IsNull())
{
// Attach pcurve from the original edge
TopoDS_Edge aSpz;
BOPTools_AlgoTools::MakeSplitEdge(myEz, myV1, myT1,
myV2, myT2, aSpz);
iErr = BOPTools_AlgoTools2D::AttachExistingPCurve(aSpz,
aCopyE,
myF,
myContext);
}
if (iErr)
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aCopyE, myF, myContext);
myNewC2d = BRep_Tool::CurveOnSurface(aCopyE, myF, f, l);
if (myNewC2d.IsNull())
{
AddError(new BOPAlgo_AlertBuildingPCurveFailed(TopoDS_Shape()));
return;
}
else
myNewTol = BRep_Tool::Tolerance(aCopyE);
}
else
{
const BRepAdaptor_Surface& aBAS = myContext->SurfaceAdaptor(myF);
if (aBAS.IsUPeriodic() || aBAS.IsVPeriodic())
{
// The curve already exists. Adjust it for periodic cases.
BOPTools_AlgoTools2D::AdjustPCurveOnSurf
(myContext->SurfaceAdaptor(myF), f, l, aC2d, myNewC2d);
if (myNewC2d != aC2d)
myNewTol = BRep_Tool::Tolerance(aCopyE);
else
myNewC2d.Nullify();
}
}
if (myFlag) {
UpdateVertices(aCopyE, myF);
}
}
//
if (iErr) {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF, myContext);
}
//
if (myFlag) {
UpdateVertices(myE, myF);
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertBuildingPCurveFailed(TopoDS_Shape()));
}
}
//
const Handle(Geom2d_Curve)& GetNewPCurve() const
{
return myNewC2d;
}
Standard_Real GetNewTolerance() const
{
return myNewTol;
}
protected:
Standard_Boolean myFlag;
TopoDS_Edge myE;
@@ -275,21 +326,23 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
Standard_Real myT1;
TopoDS_Vertex myV2;
Standard_Real myT2;
Handle(Geom2d_Curve) myNewC2d;
Standard_Real myNewTol;
//
Handle(IntTools_Context) myContext;
};
//
//=======================================================================
typedef BOPCol_NCVector
typedef NCollection_Vector
<BOPAlgo_MPC> BOPAlgo_VectorOfMPC;
//
typedef BOPCol_ContextFunctor
typedef BOPTools_ContextFunctor
<BOPAlgo_MPC,
BOPAlgo_VectorOfMPC,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_MPCFunctor;
//
typedef BOPCol_ContextCnt
typedef BOPTools_ContextCnt
<BOPAlgo_MPCFunctor,
BOPAlgo_VectorOfMPC,
Handle(IntTools_Context)> BOPAlgo_MPCCnt;
@@ -328,7 +381,7 @@ class BOPAlgo_BPC {
}
//
void Perform() {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnPlane (myE, myF, myCurve, myToUpdate);
BRepLib::BuildPCurveForEdgeOnPlane(myE, myF, myCurve, myToUpdate);
};
//
protected:
@@ -338,14 +391,14 @@ class BOPAlgo_BPC {
Standard_Boolean myToUpdate;
};
//=======================================================================
typedef BOPCol_NCVector
typedef NCollection_Vector
<BOPAlgo_BPC> BOPAlgo_VectorOfBPC;
//
typedef BOPCol_Functor
typedef BOPTools_Functor
<BOPAlgo_BPC,
BOPAlgo_VectorOfBPC> BOPAlgo_BPCFunctor;
//
typedef BOPCol_Cnt
typedef BOPTools_Cnt
<BOPAlgo_BPCFunctor,
BOPAlgo_VectorOfBPC> BOPAlgo_BPCCnt;
//
@@ -357,17 +410,16 @@ typedef BOPCol_Cnt
void BOPAlgo_PaveFiller::MakeSplitEdges()
{
BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
Standard_Integer aNbPBP = aPBP.Extent();
Standard_Integer aNbPBP = aPBP.Length();
if(!aNbPBP) {
return;
}
//
Standard_Boolean bCB, bV1, bV2;
Standard_Integer i, nE, nV1, nV2, nSp, aNbPB, aNbVBSE, k;
Standard_Integer i, nE, nV1, nV2, nSp, aNbVBSE, k;
Standard_Real aT1, aT2;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
Handle(BOPDS_PaveBlock) aPB;
BOPDS_MapOfPaveBlock aMPB(100);
BOPDS_MapOfCommonBlock aMCB(100);
TopoDS_Vertex aV1, aV2;
TopoDS_Edge aE;
BOPAlgo_VectorOfSplitEdge aVBSE;
@@ -375,83 +427,102 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
//
UpdateCommonBlocksWithSDVertices();
//
aNbPBP=aPBP.Extent();
aNbPBP=aPBP.Length();
//
for (i=0; i<aNbPBP; ++i) {
BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
//
aNbPB=aLPB.Extent();
if (aNbPB==1) {
aPB=aLPB.First();
aPB->Indices(nV1, nV2);
bV1=myDS->IsNewShape(nV1);
bV2=myDS->IsNewShape(nV2);
bCB=myDS->IsCommonBlock(aPB);
//
if (!(bV1 || bV2)) { // no new vertices here
if (!myNonDestructive || !bCB) {
if (bCB) {
if (!aPB->HasEdge()) {
const Handle(BOPDS_CommonBlock)& aCB = myDS->CommonBlock(aPB);
nE = aCB->PaveBlock1()->OriginalEdge();
aCB->SetEdge(nE);
// Compute tolerance of the common block and update the edge
Standard_Real aTol = BOPAlgo_Tools::ComputeToleranceOfCB(aCB, myDS, myContext);
myDS->UpdateEdgeTolerance(nE, aTol);
}
}
else {
nE = aPB->OriginalEdge();
aPB->SetEdge(nE);
}
continue;
}
}
}
for (i = 0; i < aNbPBP; ++i)
{
BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
//
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
aPB=aItPB.Value();
nE=aPB->OriginalEdge();
const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
if (aSIE.HasFlag()){
aPB = aItPB.Value();
nE = aPB->OriginalEdge();
const BOPDS_ShapeInfo& aSIE = myDS->ShapeInfo(nE);
if (aSIE.HasFlag())
{
// Skip degenerated edges
continue;
}
//
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
bCB=!aCB.IsNull();
if (bCB) {
aPB=aCB->PaveBlock1();
}
//
if (aMPB.Add(aPB)) {
nE=aPB->OriginalEdge();
aPB->Indices(nV1, nV2);
aPB->Range(aT1, aT2);
//
aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
aE.Orientation(TopAbs_FORWARD);
//
aV1=(*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
aV1.Orientation(TopAbs_FORWARD);
//
aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
aV2.Orientation(TopAbs_REVERSED);
//
BOPAlgo_SplitEdge& aBSE=aVBSE.Append1();
//
aBSE.SetData(aE, aV1, aT1, aV2, aT2);
aBSE.SetPaveBlock(aPB);
if (bCB) {
aBSE.SetCommonBlock(aCB);
const Handle(BOPDS_CommonBlock)& aCB = myDS->CommonBlock(aPB);
Standard_Boolean bCB = !aCB.IsNull();
if (bCB && !aMCB.Add(aCB))
continue;
aPB->Indices(nV1, nV2);
// Check if it is necessary to make the split of the edge
{
Standard_Boolean bV1 = myDS->IsNewShape(nV1);
Standard_Boolean bV2 = myDS->IsNewShape(nV2);
Standard_Boolean bToSplit = Standard_True;
if (!bV1 && !bV2) // no new vertices here
{
if (!myNonDestructive || !bCB)
{
if (bCB)
{
// Find the edge with these vertices
BOPDS_ListIteratorOfListOfPaveBlock it(aCB->PaveBlocks());
for (; it.More(); it.Next())
{
nE = it.Value()->OriginalEdge();
if (myDS->PaveBlocks(nE).Extent() == 1)
break;
}
if (it.More())
{
// The pave block is found
bToSplit = Standard_False;
aCB->SetRealPaveBlock(it.Value());
aCB->SetEdge(nE);
// Compute tolerance of the common block and update the edge
Standard_Real aTol = BOPAlgo_Tools::ComputeToleranceOfCB(aCB, myDS, myContext);
myDS->UpdateEdgeTolerance(nE, aTol);
}
}
else if (aLPB.Extent() == 1)
{
bToSplit = Standard_False;
aPB->SetEdge(nE);
}
if (!bToSplit)
continue;
}
}
aBSE.SetDS(myDS);
aBSE.SetProgressIndicator(myProgressIndicator);
}
// Split the edge
if (bCB)
{
aPB = aCB->PaveBlock1();
nE = aPB->OriginalEdge();
aPB->Indices(nV1, nV2);
}
aPB->Range(aT1, aT2);
//
aE = (*(TopoDS_Edge *)(&myDS->Shape(nE)));
aE.Orientation(TopAbs_FORWARD);
//
aV1 = (*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
aV1.Orientation(TopAbs_FORWARD);
//
aV2 = (*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
aV2.Orientation(TopAbs_REVERSED);
//
BOPAlgo_SplitEdge& aBSE = aVBSE.Appended();
//
aBSE.SetData(aE, aV1, aT1, aV2, aT2);
aBSE.SetPaveBlock(aPB);
if (bCB) {
aBSE.SetCommonBlock(aCB);
}
aBSE.SetDS(myDS);
aBSE.SetProgressIndicator(myProgressIndicator);
} // for (; aItPB.More(); aItPB.Next()) {
} // for (i=0; i<aNbPBP; ++i) {
//
aNbVBSE=aVBSE.Extent();
aNbVBSE=aVBSE.Length();
//======================================================
BOPAlgo_SplitEdgeCnt::Perform(myRunParallel, aVBSE, myContext);
//======================================================
@@ -531,7 +602,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
(!mySectionAttribute.PCurveOnS1() && !mySectionAttribute.PCurveOnS2()))
return;
Standard_Boolean bHasPC;
Standard_Integer i, nF1, nF2, aNbC, k, nE, aNbFF, aNbFI, nEx;
Standard_Integer i, nF1, aNbC, k, nE, aNbFF, aNbFI, nEx;
Standard_Integer j, aNbPBIn, aNbPBOn;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
TopoDS_Face aF1F, aF2F;
@@ -540,7 +611,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
// 1. Process Common Blocks
const BOPDS_VectorOfFaceInfo& aFIP=myDS->FaceInfoPool();
//
aNbFI=aFIP.Extent();
aNbFI=aFIP.Length();
for (i=0; i<aNbFI; ++i) {
const BOPDS_FaceInfo& aFI=aFIP(i);
nF1=aFI.Index();
@@ -555,7 +626,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
nE=aPB->Edge();
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
//
BOPAlgo_MPC& aMPC=aVMPC.Append1();
BOPAlgo_MPC& aMPC=aVMPC.Appended();
aMPC.SetEdge(aE);
aMPC.SetFace(aF1F);
aMPC.SetProgressIndicator(myProgressIndicator);
@@ -583,7 +654,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
continue;
}
//
BOPAlgo_MPC& aMPC=aVMPC.Append1();
BOPAlgo_MPC& aMPC=aVMPC.Appended();
//
aItLPB.Initialize(aLPB);
for(; aItLPB.More(); aItLPB.Next()) {
@@ -627,44 +698,52 @@ void BOPAlgo_PaveFiller::MakePCurves()
}
}// for (i=0; i<aNbFI; ++i) {
//
// 2. Process section edges
// 2. Process section edges. P-curves on them must already be computed.
// However, we must provide the call to UpdateVertices.
Standard_Boolean bPCurveOnS[2];
Standard_Integer m;
TopoDS_Face aFf[2];
//
bPCurveOnS[0]=mySectionAttribute.PCurveOnS1();
bPCurveOnS[1]=mySectionAttribute.PCurveOnS2();
//
if (bPCurveOnS[0] || bPCurveOnS[1]) {
// container to remember already added edge-face pairs
BOPDS_MapOfPair anEFPairs;
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
aNbFF=aFFs.Extent();
aNbFF=aFFs.Length();
for (i=0; i<aNbFF; ++i) {
const BOPDS_InterfFF& aFF=aFFs(i);
aFF.Indices(nF1, nF2);
const BOPDS_VectorOfCurve& aVNC = aFF.Curves();
aNbC = aVNC.Length();
if (aNbC == 0)
continue;
Standard_Integer nF[2];
aFF.Indices(nF[0], nF[1]);
//
aFf[0]=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
TopoDS_Face aFf[2];
aFf[0] = (*(TopoDS_Face *)(&myDS->Shape(nF[0])));
aFf[0].Orientation(TopAbs_FORWARD);
//
aFf[1]=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
aFf[1]=(*(TopoDS_Face *)(&myDS->Shape(nF[1])));
aFf[1].Orientation(TopAbs_FORWARD);
//
const BOPDS_VectorOfCurve& aVNC=aFF.Curves();
aNbC=aVNC.Extent();
for (k=0; k<aNbC; ++k) {
for (k=0; k<aNbC; ++k)
{
const BOPDS_Curve& aNC=aVNC(k);
const BOPDS_ListOfPaveBlock& aLPB=aNC.PaveBlocks();
aItLPB.Initialize(aLPB);
for(; aItLPB.More(); aItLPB.Next()) {
for(; aItLPB.More(); aItLPB.Next())
{
const Handle(BOPDS_PaveBlock)& aPB=aItLPB.Value();
nE=aPB->Edge();
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
//
for (m=0; m<2; ++m) {
if (bPCurveOnS[m]) {
BOPAlgo_MPC& aMPC=aVMPC.Append1();
for (Standard_Integer m = 0; m<2; ++m)
{
if (bPCurveOnS[m] && anEFPairs.Add(BOPDS_Pair(nE, nF[m])))
{
BOPAlgo_MPC& aMPC = aVMPC.Appended();
aMPC.SetEdge(aE);
aMPC.SetFace(aFf[m]);
aMPC.SetFlag(bPCurveOnS[m]);
aMPC.SetFlag(Standard_True);
aMPC.SetProgressIndicator(myProgressIndicator);
}
}
@@ -676,6 +755,29 @@ void BOPAlgo_PaveFiller::MakePCurves()
//======================================================
BOPAlgo_MPCCnt::Perform(myRunParallel, aVMPC, myContext);
//======================================================
// Add warnings of the failed projections and update edges with new pcurves
Standard_Integer aNb = aVMPC.Length();
for (i = 0; i < aNb; ++i)
{
const BOPAlgo_MPC& aMPC = aVMPC(i);
if (aMPC.HasErrors())
{
TopoDS_Compound aWC;
BRep_Builder().MakeCompound(aWC);
BRep_Builder().Add(aWC, aMPC.Edge());
BRep_Builder().Add(aWC, aMPC.Face());
AddWarning(new BOPAlgo_AlertBuildingPCurveFailed(aWC));
}
else
{
const Handle(Geom2d_Curve)& aNewPC = aMPC.GetNewPCurve();
// if aNewPC is null we do not need to update the edge because it already contains
// valid p-curve, and only vertices have been updated.
if (!aNewPC.IsNull())
BRep_Builder().UpdateEdge(aMPC.Edge(), aNewPC, aMPC.Face(), aMPC.GetNewTolerance());
}
}
}
//=======================================================================
//function : UpdateVertices
@@ -738,7 +840,7 @@ void BOPAlgo_PaveFiller::Prepare()
Standard_Boolean bIsBasedOnPlane;
Standard_Integer i, aNb, n1, nF, aNbF;
TopExp_Explorer aExp;
BOPCol_IndexedMapOfShape aMF;
TopTools_IndexedMapOfShape aMF;
//
aNb=3;
for(i=0; i<aNb; ++i) {
@@ -767,7 +869,7 @@ void BOPAlgo_PaveFiller::Prepare()
aExp.Init(aF, aType[1]);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE=*((TopoDS_Edge *)&aExp.Current());
BOPAlgo_BPC& aBPC=aVBPC.Append1();
BOPAlgo_BPC& aBPC=aVBPC.Appended();
aBPC.SetEdge(aE);
aBPC.SetFace(aF);
}
@@ -780,7 +882,7 @@ void BOPAlgo_PaveFiller::Prepare()
// pcurves are built, and now update edges
BRep_Builder aBB;
TopoDS_Edge E;
for (i = 0; i < aVBPC.Extent(); i++) {
for (i = 0; i < aVBPC.Length(); i++) {
const BOPAlgo_BPC& aBPC=aVBPC(i);
if (aBPC.IsToUpdate()) {
Standard_Real aTolE = BRep_Tool::Tolerance(aBPC.GetEdge());

View File

@@ -17,7 +17,6 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
#include <BOPCol_ListOfInteger.hxx>
#include <BOPDS_Curve.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_FaceInfo.hxx>
@@ -32,6 +31,7 @@
#include <Geom2d_Line.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dAPI_ProjectPointOnCurve.hxx>
#include <Geom2dInt_GInter.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Pnt.hxx>
@@ -39,6 +39,7 @@
#include <IntRes2d_IntersectionPoint.hxx>
#include <IntTools_Context.hxx>
#include <Precision.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
@@ -52,6 +53,11 @@ static
const Standard_Real aP2,
TopoDS_Edge& aNewEdge);
static
Standard_Boolean AddSplitPoint(const Handle(BOPDS_PaveBlock)& thePBD,
const BOPDS_Pave& thePave,
const Standard_Real theTol);
//=======================================================================
//function : ProcessDE
//purpose :
@@ -61,7 +67,7 @@ void BOPAlgo_PaveFiller::ProcessDE()
Standard_Integer nF, aNb, nE, nV, nVSD, aNbPB;
Handle(NCollection_BaseAllocator) aAllocator;
Handle(BOPDS_PaveBlock) aPBD;
BOPCol_ListIteratorOfListOfInteger aItLI;
TColStd_ListIteratorOfListOfInteger aItLI;
//
// 1. Find degnerated edges
//-----------------------------------------------------scope f
@@ -304,25 +310,30 @@ void BOPAlgo_PaveFiller::ProcessDE()
}
// Intersection
Geom2dInt_GInter aGInter(aGAC1, aGAC2, aTolInt, aTolInt);
if (!aGInter.IsDone()) {
continue;
if (aGInter.IsDone() && aGInter.NbPoints())
{
// Analyze intersection points
Standard_Integer i, aNbPoints = aGInter.NbPoints();
for (i = 1; i <= aNbPoints; ++i) {
Standard_Real aX = aGInter.Point(i).ParamOnFirst();
aPave.SetParameter(aX);
AddSplitPoint(aPBD, aPave, aTolCmp);
}
}
//
// Analyze intersection points
Standard_Integer i, aNbPoints = aGInter.NbPoints();
for (i = 1; i <= aNbPoints; ++i) {
Standard_Real aX = aGInter.Point(i).ParamOnFirst();
if (aX - aTD1 < aTolCmp || aTD2 - aX < aTolCmp) {
continue;
else
{
// If the intersection did not succeed, try the projection of the end point
// of the curve corresponding to the vertex of degenerated edge
Standard_Real aT = (nVD == aPB->Pave1().Index() ?
aPB->Pave1().Parameter() : aPB->Pave2().Parameter());
gp_Pnt2d aP2d = aC2D->Value(aT);
Geom2dAPI_ProjectPointOnCurve aProj2d(aP2d, aC2DDE, aTD1, aTD2);
if (aProj2d.NbPoints())
{
Standard_Real aX = aProj2d.LowerDistanceParameter();
aPave.SetParameter(aX);
AddSplitPoint(aPBD, aPave, aTolCmp);
}
//
Standard_Integer anInd;
if (aPBD->ContainsParameter(aX, aTolCmp, anInd)) {
continue;
}
//
aPave.SetParameter(aX);
aPBD->AppendExtPave1(aPave);
}
}
}
@@ -354,3 +365,34 @@ void BOPAlgo_PaveFiller::ProcessDE()
BB.UpdateEdge(E, aTol);
aNewEdge=E;
}
//=======================================================================
// function: AddSplitPoint
// purpose: Validates the point represented by the pave <thePave>
// for the Pave Block <thePBD>.
// In case the point passes the checks it is added as an
// Extra Pave to the Pave Block for further splitting of the latter.
// Returns TRUE if the point is added, otherwise returns FALSE.
//=======================================================================
Standard_Boolean AddSplitPoint(const Handle(BOPDS_PaveBlock)& thePBD,
const BOPDS_Pave& thePave,
const Standard_Real theTol)
{
Standard_Real aTD1, aTD2;
thePBD->Range(aTD1, aTD2);
Standard_Real aT = thePave.Parameter();
// Check that the parameter is inside the Pave Block
if (aT - aTD1 < theTol || aTD2 - aT < theTol)
return Standard_False;
// Check that the pave block does not contain the same parameter
Standard_Integer anInd;
if (thePBD->ContainsParameter(aT, theTol, anInd))
return Standard_False;
// Add the point as an Extra pave to the Pave Block for further
// splitting of the latter
thePBD->AppendExtPave1(thePave);
return Standard_True;
}

View File

@@ -16,18 +16,18 @@
#include <Bnd_Box.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPDS_Curve.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
#include <BOPDS_PaveBlock.hxx>
#include <BOPDS_ShapeInfo.hxx>
#include <BOPTools_Parallel.hxx>
#include <gp_Pnt.hxx>
#include <IntTools_Context.hxx>
#include <IntTools_ShrunkRange.hxx>
#include <NCollection_Vector.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
@@ -63,16 +63,16 @@ class BOPAlgo_ShrunkRange : public IntTools_ShrunkRange {
};
//
//=======================================================================
typedef BOPCol_NCVector
typedef NCollection_Vector
<BOPAlgo_ShrunkRange> BOPAlgo_VectorOfShrunkRange;
//
typedef BOPCol_ContextFunctor
typedef BOPTools_ContextFunctor
<BOPAlgo_ShrunkRange,
BOPAlgo_VectorOfShrunkRange,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_ShrunkRangeFunctor;
//
typedef BOPCol_ContextCnt
typedef BOPTools_ContextCnt
<BOPAlgo_ShrunkRangeFunctor,
BOPAlgo_VectorOfShrunkRange,
Handle(IntTools_Context)> BOPAlgo_ShrunkRangeCnt;
@@ -93,7 +93,7 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
Standard_Integer i, nS[2], nE, nV1, nV2, aNbVSD, k;
Standard_Real aT1, aT2;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
BOPCol_MapOfInteger aMI;
TColStd_MapOfInteger aMI;
BOPAlgo_VectorOfShrunkRange aVSD;
TopAbs_ShapeEnum aType[2] = { aType1, aType2 };
//
@@ -131,7 +131,7 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
const TopoDS_Vertex& aV2=
(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
//
BOPAlgo_ShrunkRange& aSD=aVSD.Append1();
BOPAlgo_ShrunkRange& aSD=aVSD.Appended();
//
aSD.SetPaveBlock(aPB);
aSD.SetData(aE, aT1, aT2, aV1, aV2);
@@ -139,7 +139,7 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
}
}
//
aNbVSD=aVSD.Extent();
aNbVSD=aVSD.Length();
//=============================================================
BOPAlgo_ShrunkRangeCnt::Perform(myRunParallel, aVSD, myContext);
//=============================================================

View File

@@ -13,15 +13,9 @@
// commercial license or contractual agreement.
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Section.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPDS_CommonBlock.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_FaceInfo.hxx>
@@ -30,20 +24,21 @@
#include <BOPDS_PaveBlock.hxx>
#include <BOPDS_VectorOfFaceInfo.hxx>
#include <BOPDS_VectorOfListOfPaveBlock.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools3D.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
//
//
//=======================================================================
//function :
//purpose :
@@ -158,12 +153,14 @@ void BOPAlgo_Section::BuildSection()
TopoDS_Shape aRC, aRC1;
BRep_Builder aBB;
TopExp_Explorer aExp;
BOPCol_ListOfShape aLSA, aLS;
BOPCol_ListIteratorOfListOfShape aIt, aItIm, aItLS;
BOPCol_IndexedDataMapOfShapeInteger aMSI(100, myAllocator);
BOPCol_IndexedMapOfShape aMS(100, myAllocator);
BOPCol_MapOfShape aMFence(100, myAllocator);
BOPCol_MapIteratorOfMapOfInteger aItMI;
TopTools_ListOfShape aLSA, aLS;
TopTools_ListIteratorOfListOfShape aIt, aItIm, aItLS;
NCollection_IndexedDataMap<TopoDS_Shape,
Standard_Integer,
TopTools_ShapeMapHasher> aMSI(100, myAllocator);
TopTools_IndexedMapOfShape aMS(100, myAllocator);
TopTools_MapOfShape aMFence(100, myAllocator);
TColStd_MapIteratorOfMapOfInteger aItMI;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
//
GetReport()->Clear();
@@ -181,7 +178,7 @@ void BOPAlgo_Section::BuildSection()
const BOPDS_FaceInfo& aFI=myDS->FaceInfo(i);
//
// 1.1 Vertices that are section vertices
const BOPCol_MapOfInteger& aMVSc=aFI.VerticesSc();
const TColStd_MapOfInteger& aMVSc=aFI.VerticesSc();
aItMI.Initialize(aMVSc);
for(; aItMI.More(); aItMI.Next()) {
nV=aItMI.Key();
@@ -190,7 +187,7 @@ void BOPAlgo_Section::BuildSection()
}
//
// 1.2 Vertices that are in a face
const BOPCol_MapOfInteger& aMI=aFI.VerticesIn();
const TColStd_MapOfInteger& aMI=aFI.VerticesIn();
aItMI.Initialize(aMI);
for(; aItMI.More(); aItMI.Next()) {
nV=aItMI.Key();
@@ -226,7 +223,7 @@ void BOPAlgo_Section::BuildSection()
const Handle(BOPDS_PaveBlock)& aPB=aItPB.Value();
Handle(BOPDS_CommonBlock) aCB=myDS->CommonBlock(aPB);
if (!aCB.IsNull()) {
const BOPCol_ListOfInteger& aLF=aCB->Faces();
const TColStd_ListOfInteger& aLF=aCB->Faces();
aNbF=aLF.Extent();
if (aNbF) {
const Handle(BOPDS_PaveBlock)& aPBR=aCB->PaveBlock1();
@@ -280,17 +277,17 @@ void BOPAlgo_Section::BuildSection()
const TopoDS_Shape& aS=aItLS.Value();
//
if (myImages.IsBound(aS)){
const BOPCol_ListOfShape& aLSIm=myImages.Find(aS);
const TopTools_ListOfShape& aLSIm=myImages.Find(aS);
aItIm.Initialize(aLSIm);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aSIm=aItIm.Value();
BOPTools::MapShapes(aSIm, TopAbs_VERTEX, aMS);
BOPTools::MapShapes(aSIm, TopAbs_EDGE , aMS);
TopExp::MapShapes(aSIm, TopAbs_VERTEX, aMS);
TopExp::MapShapes(aSIm, TopAbs_EDGE , aMS);
}
}// if (myImages.IsBound(aF)){
else {
BOPTools::MapShapes(aS, TopAbs_VERTEX, aMS);
BOPTools::MapShapes(aS, TopAbs_EDGE , aMS);
TopExp::MapShapes(aS, TopAbs_VERTEX, aMS);
TopExp::MapShapes(aS, TopAbs_EDGE , aMS);
}
}//for (; aItLS.More(); aItLS.Next()) {
//
@@ -311,9 +308,9 @@ void BOPAlgo_Section::BuildSection()
aMFence.Clear();
//
// 4. Build the result
BOPCol_IndexedDataMapOfShapeListOfShape aMVE(100, myAllocator);
TopTools_IndexedDataMapOfShapeListOfShape aMVE(100, myAllocator);
//
BOPTools::MapShapesAndAncestors(aRC1,
TopExp::MapShapesAndAncestors(aRC1,
TopAbs_VERTEX,
TopAbs_EDGE,
aMVE);
@@ -323,7 +320,7 @@ void BOPAlgo_Section::BuildSection()
const TopoDS_Shape& aV=aMSI.FindKey(i);
const Standard_Integer& iCnt=aMSI.FindFromIndex(i);
if (iCnt>1) {
BOPTools::MapShapesAndAncestors(aV,
TopExp::MapShapesAndAncestors(aV,
TopAbs_VERTEX,
TopAbs_EDGE,
aMVE);
@@ -335,7 +332,7 @@ void BOPAlgo_Section::BuildSection()
aNbMS=aMVE.Extent();
for (i=1; i<=aNbMS; ++i) {
const TopoDS_Shape& aV=aMVE.FindKey(i);
const BOPCol_ListOfShape& aLE=aMVE.FindFromIndex(i);
const TopTools_ListOfShape& aLE=aMVE.FindFromIndex(i);
aNbLE=aLE.Extent();
if (!aNbLE) {
// alone vertices
@@ -357,44 +354,3 @@ void BOPAlgo_Section::BuildSection()
//
myShape=aRC;
}
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BOPAlgo_Section::Generated
(const TopoDS_Shape& theS)
{
myHistShapes.Clear();
if (theS.IsNull()) {
return myHistShapes;
}
//
TopAbs_ShapeEnum aType = theS.ShapeType();
if (aType != TopAbs_FACE) {
return myHistShapes;
}
//
Standard_Integer nS = myDS->Index(theS);
if (nS < 0) {
return myHistShapes;
}
//
if (!myDS->HasFaceInfo(nS)) {
return myHistShapes;
}
//
//collect section edges of the face theS
Standard_Integer i, aNb, nSp;
//
const BOPDS_FaceInfo& aFI = myDS->FaceInfo(nS);
const BOPDS_IndexedMapOfPaveBlock& aMPBSc = aFI.PaveBlocksSc();
aNb = aMPBSc.Extent();
for (i = 1; i <= aNb; ++i) {
const Handle(BOPDS_PaveBlock)& aPB = aMPBSc(i);
nSp = aPB->Edge();
const TopoDS_Shape& aSp = myDS->Shape(nSp);
myHistShapes.Append(aSp);
}
//
return myHistShapes;
}

View File

@@ -20,7 +20,7 @@
#include <Standard_Handle.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <TopTools_ListOfShape.hxx>
class BOPAlgo_PaveFiller;
class TopoDS_Shape;
@@ -43,26 +43,20 @@ public:
//! Empty constructor
Standard_EXPORT BOPAlgo_Section();
Standard_EXPORT virtual ~BOPAlgo_Section();
//! Empty constructor
//!
//! protected methods
Standard_EXPORT BOPAlgo_Section(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT virtual void BuildSection();
//! Returns the list of shapes generated from the
//! shape theS.
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& theS) Standard_OVERRIDE;
//! Constructor with allocator
Standard_EXPORT BOPAlgo_Section(const Handle(NCollection_BaseAllocator)& theAllocator);
protected:
//! Checks the data before performing the operation
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
//! Performs calculations using prepared Filler
//! object <thePF>
Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF) Standard_OVERRIDE;
//! Combine the result of section operation
Standard_EXPORT virtual void BuildSection();
//! Performs calculations using prepared Filler object <thePF>
Standard_EXPORT virtual void PerformInternal1(const BOPAlgo_PaveFiller& thePF) Standard_OVERRIDE;
private:

View File

@@ -16,38 +16,32 @@
// Created: Thu Jan 16 08:33:50 2014
#include <BOPAlgo_ShellSplitter.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_MapOfOrientedShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_CoupleOfShape.hxx>
#include <BOPTools_Parallel.hxx>
#include <BRep_Builder.hxx>
#include <IntTools_Context.hxx>
#include <NCollection_Vector.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_MapOfOrientedShape.hxx>
#include <TopTools_MapOfShape.hxx>
//
static
void MakeShell(const BOPCol_ListOfShape& ,
void MakeShell(const TopTools_ListOfShape& ,
TopoDS_Shell& );
//
static
void RefineShell(TopoDS_Shell& theShell,
const BOPCol_IndexedDataMapOfShapeListOfShape& theMEF,
BOPCol_ListOfShape& aLShX);
//
static
void MapEdgesAndFaces
(const TopoDS_Shape& aF,
BOPCol_IndexedDataMapOfShapeListOfShape& aMEF,
const Handle(NCollection_BaseAllocator)& theAllocator);
const TopTools_IndexedDataMapOfShapeListOfShape& theMEF,
TopTools_ListOfShape& aLShX);
//=======================================================================
//class : BOPAlgo_CBK
@@ -77,14 +71,14 @@ class BOPAlgo_CBK {
BOPTools_ConnexityBlock *myPCB;
};
//=======================================================================
typedef BOPCol_NCVector
typedef NCollection_Vector
<BOPAlgo_CBK> BOPAlgo_VectorOfCBK;
//
typedef BOPCol_Functor
typedef BOPTools_Functor
<BOPAlgo_CBK,
BOPAlgo_VectorOfCBK> BOPAlgo_CBKFunctor;
//
typedef BOPCol_Cnt
typedef BOPTools_Cnt
<BOPAlgo_CBKFunctor,
BOPAlgo_VectorOfCBK> BOPAlgo_CBKCnt;
//
@@ -132,7 +126,7 @@ void BOPAlgo_ShellSplitter::AddStartElement(const TopoDS_Shape& aE)
//function : StartElements
//purpose :
//=======================================================================
const BOPCol_ListOfShape& BOPAlgo_ShellSplitter::StartElements()const
const TopTools_ListOfShape& BOPAlgo_ShellSplitter::StartElements()const
{
return myStartShapes;
}
@@ -140,7 +134,7 @@ const BOPCol_ListOfShape& BOPAlgo_ShellSplitter::StartElements()const
//function : Loops
//purpose :
//=======================================================================
const BOPCol_ListOfShape& BOPAlgo_ShellSplitter::Shells()const
const TopTools_ListOfShape& BOPAlgo_ShellSplitter::Shells()const
{
return myShells;
}
@@ -152,162 +146,12 @@ void BOPAlgo_ShellSplitter::Perform()
{
GetReport()->Clear();
//
MakeConnexityBlocks();
if (HasErrors()) {
return;
}
BOPTools_AlgoTools::MakeConnexityBlocks
(myStartShapes, TopAbs_EDGE, TopAbs_FACE, myLCB);
//
MakeShells();
}
//=======================================================================
//function : MakeConnexityBlocks
//purpose :
//=======================================================================
void BOPAlgo_ShellSplitter::MakeConnexityBlocks()
{
Standard_Boolean bRegular;
Standard_Integer i, j, aNbE, aNbES, aNbEP, k, aNbCB;
TopoDS_Shape aFR;
TopoDS_Iterator aItF, aItW;
BOPCol_IndexedDataMapOfShapeListOfShape aMEF(100, myAllocator);
BOPCol_IndexedMapOfShape aMEP(100, myAllocator);
BOPCol_IndexedMapOfShape aMFC(100, myAllocator);
BOPCol_MapOfShape aMER(100, myAllocator);
BOPCol_MapOfShape aMFP(100, myAllocator);
BOPCol_IndexedMapOfShape aMEAdd(100, myAllocator);
BOPCol_MapOfShape aMES(100, myAllocator);
BOPCol_ListIteratorOfListOfShape aIt;
//
myLCB.Clear();
//
const BOPCol_ListOfShape& aLSE=myStartShapes;
aIt.Initialize(aLSE);
for (i=1; aIt.More(); aIt.Next(), ++i) {
const TopoDS_Shape& aSE=aIt.Value();
if (!aMEP.Contains(aSE)) {
aMEP.Add(aSE);
MapEdgesAndFaces(aSE, aMEF, myAllocator);
}
else {
aMER.Add(aSE);
}
}
//
// 2
aNbE=aMEF.Extent();
for (i=1; i<=aNbE; ++i) {
aNbES=aMES.Extent();
if (aNbES==aNbE) {
break;
}
//
const TopoDS_Shape& aE=aMEF.FindKey(i);
//
if (!aMES.Add(aE)) {
continue;
}
// aMES - globally processed edges
//
//------------------------------------- goal: aMEC
aMFC.Clear(); // aMEC - edges of CB
aMEP.Clear(); // aMVP - edges to process right now
aMEAdd.Clear(); // aMVAdd edges to process on next step of for(;;) {
//
aMEP.Add(aE);
//
for(;;) {
aNbEP=aMEP.Extent();
for (k=1; k<=aNbEP; ++k) {
const TopoDS_Shape& aEP=aMEP(k);
const BOPCol_ListOfShape& aLF=aMEF.FindFromKey(aEP);
aIt.Initialize(aLF);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value();
if (aMFC.Add(aF)) {
aItF.Initialize(aF);
while (aItF.More()) {
const TopoDS_Shape& aW=aItF.Value();
if (aW.ShapeType()!=TopAbs_WIRE) {
aItF.Next();
continue;
}
//
aItW.Initialize(aW);
while (aItW.More()) {
const TopoDS_Shape& aEF=aItW.Value();
//
if (aMES.Add(aEF)) {
aMEAdd.Add(aEF);
}
//
aItW.Next();
}
//
aItF.Next();
}
}
}
}
//
aNbEP=aMEAdd.Extent();
if (!aNbEP) {
break; // from for(;;) {
}
//
aMEP.Clear();
//
for (k=1; k<=aNbEP; ++k) {
const TopoDS_Shape& aEF=aMEAdd(k);
aMEP.Add(aEF);
}
aMEAdd.Clear();
}// for(;;) {
//
//-------------------------------------
BOPTools_ConnexityBlock aCB(myAllocator);
//
BOPCol_ListOfShape& aLECB=aCB.ChangeShapes();
BOPCol_IndexedDataMapOfShapeListOfShape aMEFR(100, myAllocator);
//
bRegular=Standard_True;
aNbCB = aMFC.Extent();
for (j=1; j<=aNbCB; ++j) {
aFR = aMFC(j);
//
if (aMER.Contains(aFR)) {
aFR.Orientation(TopAbs_FORWARD);
aLECB.Append(aFR);
aFR.Orientation(TopAbs_REVERSED);
aLECB.Append(aFR);
bRegular=Standard_False;
}
else {
aLECB.Append(aFR);
}
//
if (bRegular) {
MapEdgesAndFaces(aFR, aMEFR, myAllocator);
}
}
//
if (bRegular) {
Standard_Integer aNbER, aNbFR;
//
aNbER=aMEFR.Extent();
for (k=1; k<=aNbER; ++k) {
const BOPCol_ListOfShape& aLFR=aMEFR(k);
aNbFR=aLFR.Extent();
if (aNbFR>2) {
bRegular=!bRegular;
break;
}
}
}
//
aCB.SetRegular(bRegular);
myLCB.Append(aCB);
}
}
//=======================================================================
//function : SplitBlock
//purpose :
@@ -321,21 +165,21 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
BRep_Builder aBB;
TopoDS_Iterator aItS;
TopExp_Explorer aExp;
BOPCol_ListIteratorOfListOfShape aItF;
TopTools_ListIteratorOfListOfShape aItF;
BOPTools_CoupleOfShape aCSOff;
BOPCol_MapOfOrientedShape AddedFacesMap;
BOPCol_IndexedDataMapOfShapeListOfShape aEFMap, aMEFP;
TopTools_MapOfOrientedShape AddedFacesMap;
TopTools_IndexedDataMapOfShapeListOfShape aEFMap, aMEFP;
Handle (IntTools_Context) aContext;
//
aContext=new IntTools_Context;
//
const BOPCol_ListOfShape& myShapes=aCB.Shapes();
const TopTools_ListOfShape& myShapes=aCB.Shapes();
//
BOPCol_ListOfShape& myLoops=aCB.ChangeLoops();
TopTools_ListOfShape& myLoops=aCB.ChangeLoops();
myLoops.Clear();
//
// Copy faces into the map, for recursive search of free bounds
BOPCol_MapOfOrientedShape aMFaces;
TopTools_MapOfOrientedShape aMFaces;
aItF.Initialize (myShapes);
for (; aItF.More(); aItF.Next()) {
aMFaces.Add(aItF.Value());
@@ -349,7 +193,7 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
for (; aItF.More(); aItF.Next()) {
const TopoDS_Shape& aF = aItF.Value();
if (aMFaces.Contains(aF)) {
BOPTools::MapShapesAndAncestors (aF, TopAbs_EDGE, TopAbs_FACE, aEFMap);
TopExp::MapShapesAndAncestors (aF, TopAbs_EDGE, TopAbs_FACE, aEFMap);
}
}
//
@@ -359,7 +203,7 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
for (i = 1; i <= aNbE; ++i) {
const TopoDS_Edge& aE = TopoDS::Edge(aEFMap.FindKey(i));
if (!(BRep_Tool::Degenerated(aE) || aE.Orientation() == TopAbs_INTERNAL)) {
const BOPCol_ListOfShape& aLF = aEFMap(i);
const TopTools_ListOfShape& aLF = aEFMap(i);
if (aLF.Extent() == 1) {
// remove the face
aMFaces.Remove(aLF.First());
@@ -379,7 +223,7 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
}
//
// use only connected faces
BOPCol_ListOfShape aLFConnected;
TopTools_ListOfShape aLFConnected;
aItF.Initialize (myShapes);
for (; aItF.More(); aItF.Next()) {
const TopoDS_Shape& aF = aItF.Value();
@@ -404,15 +248,15 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
aBB.MakeShell(aShellStart);
aBB.Add(aShellStart, aFF);
//
BOPCol_ListOfShape aLShells;
TopTools_ListOfShape aLShells;
aLShells.Append(aShellStart);
//
BOPCol_ListIteratorOfListOfShape aItLShells(aLShells);
TopTools_ListIteratorOfListOfShape aItLShells(aLShells);
for (; aItLShells.More(); aItLShells.Next()) {
TopoDS_Shell& aShell = TopoDS::Shell(aItLShells.ChangeValue());
//
aMEFP.Clear();
BOPTools::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEFP);
TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEFP);
//
// loop on faces added to Shell;
// add their neighbor faces to Shell and so on
@@ -427,7 +271,7 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
//
// proceed only free edges in this shell
if (aMEFP.Contains(aE)) {
const BOPCol_ListOfShape& aLFP = aMEFP.FindFromKey(aE);
const TopTools_ListOfShape& aLFP = aMEFP.FindFromKey(aE);
aNbFP = aLFP.Extent();
if (aNbFP > 1) {
continue;
@@ -444,7 +288,7 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
}
//
// candidate faces list
const BOPCol_ListOfShape& aLF = aEFMap.FindFromKey(aE);
const TopTools_ListOfShape& aLF = aEFMap.FindFromKey(aE);
aNbLF = aLF.Extent();
if (!aNbLF) {
continue;
@@ -454,7 +298,7 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
// take only not-processed faces as a candidates
BOPTools_ListOfCoupleOfShape aLCSOff;
//
BOPCol_ListIteratorOfListOfShape aItLF(aLF);
TopTools_ListIteratorOfListOfShape aItLF(aLF);
for (; aItLF.More(); aItLF.Next()) {
const TopoDS_Face& aFL = (*(TopoDS_Face*)(&aItLF.Value()));
if (aF.IsSame(aFL) || AddedFacesMap.Contains(aFL)) {
@@ -488,19 +332,19 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
//
if (!aSelF.IsNull() && AddedFacesMap.Add(aSelF)) {
aBB.Add(aShell, aSelF);
BOPTools::MapShapesAndAncestors(aSelF, TopAbs_EDGE, TopAbs_FACE, aMEFP);
TopExp::MapShapesAndAncestors(aSelF, TopAbs_EDGE, TopAbs_FACE, aMEFP);
}
} // for (; aExp.More(); aExp.Next()) {
} // for (; aItS.More(); aItS.Next()) {
//
// split the shell on multi-connected edges
BOPCol_ListOfShape aLShSp;
TopTools_ListOfShape aLShSp;
RefineShell(aShell, aMEFP, aLShSp);
//
// collect the not closed shells for further processing
BOPCol_ListOfShape aLShNC;
TopTools_ListOfShape aLShNC;
//
BOPCol_ListIteratorOfListOfShape aItLShSp(aLShSp);
TopTools_ListIteratorOfListOfShape aItLShSp(aLShSp);
for (; aItLShSp.More(); aItLShSp.Next()) {
TopoDS_Shell& aShSp = *((TopoDS_Shell*)&aItLShSp.Value());
//
@@ -533,7 +377,7 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
// remove th faces of not closed shells from the map of processed faces
// and try to rebuild the shells using all not processed faces,
// because faces of one shell might be needed for building the other
BOPCol_ListIteratorOfListOfShape aItLShNC(aLShNC);
TopTools_ListIteratorOfListOfShape aItLShNC(aLShNC);
for (; aItLShNC.More(); aItLShNC.Next()) {
TopoDS_Iterator aItNC(aItLShNC.Value());
for (; aItNC.More(); aItNC.Next()) {
@@ -549,8 +393,8 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
//purpose :
//=======================================================================
void RefineShell(TopoDS_Shell& theShell,
const BOPCol_IndexedDataMapOfShapeListOfShape& theMEF,
BOPCol_ListOfShape& theLShSp)
const TopTools_IndexedDataMapOfShapeListOfShape& theMEF,
TopTools_ListOfShape& theLShSp)
{
TopoDS_Iterator aIt(theShell);
if(!aIt.More()) {
@@ -559,12 +403,12 @@ void RefineShell(TopoDS_Shell& theShell,
//
// Find edges with more than 2 adjacent faces - branch edges -
// edges on which the input shell should be split
BOPCol_MapOfShape aMEStop;
TopTools_MapOfShape aMEStop;
//
Standard_Integer i, aNbMEF = theMEF.Extent();
for (i = 1; i <= aNbMEF; ++i) {
const TopoDS_Edge& aE = TopoDS::Edge(theMEF.FindKey(i));
const BOPCol_ListOfShape& aLF = theMEF(i);
const TopTools_ListOfShape& aLF = theMEF(i);
if (aLF.Extent() > 2) {
aMEStop.Add(aE);
continue;
@@ -573,7 +417,7 @@ void RefineShell(TopoDS_Shell& theShell,
// check for internal edges - count faces, in which the edge
// is internal, twice
Standard_Integer aNbF = 0;
BOPCol_ListIteratorOfListOfShape aItLF(aLF);
TopTools_ListIteratorOfListOfShape aItLF(aLF);
for (; aItLF.More() && aNbF <= 2; aItLF.Next()) {
const TopoDS_Face& aF = TopoDS::Face(aItLF.Value());
++aNbF;
@@ -601,10 +445,10 @@ void RefineShell(TopoDS_Shell& theShell,
//
TopoDS_Builder aBB;
TopExp_Explorer aExp;
BOPCol_IndexedMapOfShape aMFB;
BOPCol_MapOfOrientedShape aMFProcessed;
BOPCol_ListOfShape aLFP, aLFP1;
BOPCol_ListIteratorOfListOfShape aItLF, aItLFP;
TopTools_IndexedMapOfShape aMFB;
TopTools_MapOfOrientedShape aMFProcessed;
TopTools_ListOfShape aLFP, aLFP1;
TopTools_ListIteratorOfListOfShape aItLF, aItLFP;
//
// The first Face
for (; aIt.More(); aIt.Next()) {
@@ -640,7 +484,7 @@ void RefineShell(TopoDS_Shell& theShell,
continue;
}
//
const BOPCol_ListOfShape& aLF = theMEF.FindFromKey(aE);
const TopTools_ListOfShape& aLF = theMEF.FindFromKey(aE);
//
aItLF.Initialize(aLF);
for (; aItLF.More(); aItLF.Next()) {
@@ -691,7 +535,7 @@ void BOPAlgo_ShellSplitter::MakeShells()
Standard_Boolean bIsRegular;
Standard_Integer aNbVCBK, k;
BOPTools_ListIteratorOfListOfConnexityBlock aItCB;
BOPCol_ListIteratorOfListOfShape aIt;
TopTools_ListIteratorOfListOfShape aIt;
BOPAlgo_VectorOfCBK aVCBK;
//
myShells.Clear();
@@ -703,25 +547,25 @@ void BOPAlgo_ShellSplitter::MakeShells()
if (bIsRegular) {
TopoDS_Shell aShell;
//
const BOPCol_ListOfShape& aLF=aCB.Shapes();
const TopTools_ListOfShape& aLF=aCB.Shapes();
MakeShell(aLF, aShell);
aShell.Closed(Standard_True);
myShells.Append(aShell);
}
else {
BOPAlgo_CBK& aCBK=aVCBK.Append1();
BOPAlgo_CBK& aCBK=aVCBK.Appended();
aCBK.SetConnexityBlock(aCB);
}
}
//
aNbVCBK=aVCBK.Extent();
aNbVCBK=aVCBK.Length();
//===================================================
BOPAlgo_CBKCnt::Perform(myRunParallel, aVCBK);
//===================================================
for (k=0; k<aNbVCBK; ++k) {
BOPAlgo_CBK& aCBK=aVCBK(k);
const BOPTools_ConnexityBlock& aCB=aCBK.ConnexityBlock();
const BOPCol_ListOfShape& aLS=aCB.Loops();
const TopTools_ListOfShape& aLS=aCB.Loops();
aIt.Initialize(aLS);
for (; aIt.More(); aIt.Next()) {
TopoDS_Shape& aShell=aIt.ChangeValue();
@@ -734,11 +578,11 @@ void BOPAlgo_ShellSplitter::MakeShells()
//function : MakeShell
//purpose :
//=======================================================================
void MakeShell(const BOPCol_ListOfShape& aLS,
void MakeShell(const TopTools_ListOfShape& aLS,
TopoDS_Shell& aShell)
{
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfShape aIt;
TopTools_ListIteratorOfListOfShape aIt;
//
aBB.MakeShell(aShell);
//
@@ -750,43 +594,3 @@ void MakeShell(const BOPCol_ListOfShape& aLS,
//
BOPTools_AlgoTools::OrientFacesOnShell(aShell);
}
//=======================================================================
// function: MapEdgesAndFaces
// purpose:
//=======================================================================
void MapEdgesAndFaces
(const TopoDS_Shape& aF,
BOPCol_IndexedDataMapOfShapeListOfShape& aMEF,
const Handle(NCollection_BaseAllocator)& theAllocator)
{
TopoDS_Iterator aItF, aItW;
//
aItF.Initialize(aF);
while (aItF.More()) {
const TopoDS_Shape& aW=aItF.Value();
if (aW.ShapeType()!=TopAbs_WIRE) {
aItF.Next();
continue;
}
//
aItW.Initialize(aW);
while (aItW.More()) {
const TopoDS_Shape& aE=aItW.Value();
//
if (aMEF.Contains(aE)) {
BOPCol_ListOfShape& aLF=aMEF.ChangeFromKey(aE);
aLF.Append(aF);
}
else {
BOPCol_ListOfShape aLS(theAllocator);
//
aLS.Append(aF);
aMEF.Add(aE, aLS);
}
//
aItW.Next();
}
//
aItF.Next();
}
}

View File

@@ -19,11 +19,11 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPTools_ListOfConnexityBlock.hxx>
#include <BOPAlgo_Algo.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <BOPTools_ConnexityBlock.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <TopTools_ListOfShape.hxx>
class TopoDS_Shape;
@@ -42,32 +42,30 @@ public:
Standard_EXPORT virtual ~BOPAlgo_ShellSplitter();
//! constructor
Standard_EXPORT BOPAlgo_ShellSplitter(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT BOPAlgo_ShellSplitter(const Handle(NCollection_BaseAllocator)& theAllocator);
//! adds a face <theS> to process
Standard_EXPORT void AddStartElement (const TopoDS_Shape& theS);
//! return the faces to process
Standard_EXPORT const BOPCol_ListOfShape& StartElements() const;
Standard_EXPORT const TopTools_ListOfShape& StartElements() const;
//! performs the algorithm
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
//! returns the loops
Standard_EXPORT const BOPCol_ListOfShape& Shells() const;
Standard_EXPORT const TopTools_ListOfShape& Shells() const;
Standard_EXPORT static void SplitBlock (BOPTools_ConnexityBlock& theCB);
protected:
Standard_EXPORT void MakeConnexityBlocks();
Standard_EXPORT void MakeShells();
BOPCol_ListOfShape myStartShapes;
BOPCol_ListOfShape myShells;
TopTools_ListOfShape myStartShapes;
TopTools_ListOfShape myShells;
BOPTools_ListOfConnexityBlock myLCB;
private:

View File

@@ -22,22 +22,15 @@
//purpose :
//=======================================================================
BOPAlgo_Splitter::BOPAlgo_Splitter()
:
BOPAlgo_Builder(),
myTools(myAllocator),
myMapTools(100, myAllocator)
: BOPAlgo_ToolsProvider()
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
BOPAlgo_Splitter::BOPAlgo_Splitter
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Builder(theAllocator),
myTools(myAllocator),
myMapTools(100, myAllocator)
BOPAlgo_Splitter::BOPAlgo_Splitter(const Handle(NCollection_BaseAllocator)& theAllocator)
: BOPAlgo_ToolsProvider(theAllocator)
{
}
//=======================================================================
@@ -47,39 +40,6 @@ BOPAlgo_Splitter::BOPAlgo_Splitter
BOPAlgo_Splitter::~BOPAlgo_Splitter()
{
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void BOPAlgo_Splitter::Clear()
{
BOPAlgo_Builder::Clear();
myTools.Clear();
myMapTools.Clear();
}
//=======================================================================
//function : AddTool
//purpose :
//=======================================================================
void BOPAlgo_Splitter::AddTool(const TopoDS_Shape& theShape)
{
if (myMapTools.Add(theShape)) {
myTools.Append(theShape);
}
}
//=======================================================================
//function : SetTools
//purpose :
//=======================================================================
void BOPAlgo_Splitter::SetTools(const BOPCol_ListOfShape& theShapes)
{
myTools.Clear();
BOPCol_ListIteratorOfListOfShape aIt(theShapes);
for (; aIt.More(); aIt.Next()) {
AddTool(aIt.Value());
}
}
//=======================================================================
// function: CheckData
// purpose:
@@ -112,9 +72,9 @@ void BOPAlgo_Splitter::Perform()
}
//
// prepare shapes for intersection
BOPCol_ListOfShape aLS;
TopTools_ListOfShape aLS;
//
BOPCol_ListIteratorOfListOfShape aItLS(myArguments);
TopTools_ListIteratorOfListOfShape aItLS(myArguments);
for (; aItLS.More(); aItLS.Next()) {
aLS.Append(aItLS.Value());
}

View File

@@ -19,7 +19,7 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPAlgo_ToolsProvider.hxx>
//! The **Splitter algorithm** is the algorithm for splitting a group of
//! arbitrary shapes by the other group of arbitrary shapes.<br>
@@ -47,7 +47,7 @@
//! into result, does not have to be overridden, because its native implementation
//! performs the necessary actions for the Splitter algorithm - it adds
//! the split parts of only Objects into result, avoiding the split parts of Tools.
class BOPAlgo_Splitter : public BOPAlgo_Builder
class BOPAlgo_Splitter : public BOPAlgo_ToolsProvider
{
public:
@@ -57,37 +57,15 @@ public:
Standard_EXPORT BOPAlgo_Splitter();
Standard_EXPORT virtual ~BOPAlgo_Splitter();
Standard_EXPORT BOPAlgo_Splitter(const BOPCol_BaseAllocator& theAllocator);
//! Clears internal fields and arguments
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
//! Adds Tool argument of the operation
Standard_EXPORT virtual void AddTool(const TopoDS_Shape& theShape);
//! Adds the Tool arguments of the operation
Standard_EXPORT virtual void SetTools(const BOPCol_ListOfShape& theShapes);
//! Returns the Tool arguments of the operation
const BOPCol_ListOfShape& Tools() const
{
return myTools;
}
Standard_EXPORT BOPAlgo_Splitter(const Handle(NCollection_BaseAllocator)& theAllocator);
//! Performs the operation
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
protected:
//! Checks the input data
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
BOPCol_ListOfShape myTools;
BOPCol_MapOfShape myMapTools;
private:
};
#endif // _BOPAlgo_Splitter_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@@ -19,12 +19,17 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx>
#include <BOPCol_IndexedDataMapOfShapeReal.hxx>
#include <BOPCol_ListOfListOfShape.hxx>
#include <BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock.hxx>
#include <BOPDS_PDS.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <TopTools_DataMapOfShapeBox.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeReal.hxx>
#include <TopTools_ListOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <Standard_Integer.hxx>
class BOPDS_PaveBlock;
@@ -32,6 +37,7 @@ class BOPDS_CommonBlock;
class IntTools_Context;
class TopoDS_Shape;
//! Provides tools used in the intersection part of Boolean operations
class BOPAlgo_Tools
{
public:
@@ -40,7 +46,7 @@ public:
template <class theType, class theTypeHasher>
static void MakeBlocks(const NCollection_IndexedDataMap<theType, NCollection_List<theType>, theTypeHasher>& theMILI,
NCollection_List<NCollection_List<theType>>& theMBlocks,
const BOPCol_BaseAllocator& theAllocator)
const Handle(NCollection_BaseAllocator)& theAllocator)
{
NCollection_Map<theType, theTypeHasher> aMFence;
Standard_Integer i, aNb = theMILI.Extent();
@@ -74,7 +80,7 @@ public:
static void FillMap(const theType& n1,
const theType& n2,
NCollection_IndexedDataMap<theType, NCollection_List<theType>, theTypeHasher>& theMILI,
const BOPCol_BaseAllocator& theAllocator)
const Handle(NCollection_BaseAllocator)& theAllocator)
{
NCollection_List<theType> *pList1 = theMILI.ChangeSeek(n1);
if (!pList1) {
@@ -92,14 +98,14 @@ public:
Standard_EXPORT static void FillMap(const Handle(BOPDS_PaveBlock)& thePB1,
const Standard_Integer theF,
BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theMILI,
const BOPCol_BaseAllocator& theAllocator);
const Handle(NCollection_BaseAllocator)& theAllocator);
Standard_EXPORT static void PerformCommonBlocks(BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& theMBlocks,
const BOPCol_BaseAllocator& theAllocator,
const Handle(NCollection_BaseAllocator)& theAllocator,
BOPDS_PDS& theDS);
Standard_EXPORT static void PerformCommonBlocks(const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theMBlocks,
const BOPCol_BaseAllocator& theAllocator,
const Handle(NCollection_BaseAllocator)& theAllocator,
BOPDS_PDS& pDS);
Standard_EXPORT static Standard_Real ComputeToleranceOfCB
@@ -150,10 +156,38 @@ public:
const Standard_Real theAngTol = 1.e-8);
//! Finds chains of intersecting vertices
Standard_EXPORT static void IntersectVertices(const BOPCol_IndexedDataMapOfShapeReal& theVertices,
Standard_EXPORT static void IntersectVertices(const TopTools_IndexedDataMapOfShapeReal& theVertices,
const Standard_Boolean theRunParallel,
const Standard_Real theFuzzyValue,
BOPCol_ListOfListOfShape& theChains);
TopTools_ListOfListOfShape& theChains);
//! Collect in the output list recursively all non-compound subshapes of the first level
//! of the given shape theS. If a shape presents in the map theMFence it is skipped.
//! All shapes put in the output are also added into theMFence.
Standard_EXPORT static void TreatCompound(const TopoDS_Shape& theS,
TopTools_MapOfShape& theMFence,
TopTools_ListOfShape& theLS);
//! Classifies the faces <theFaces> relatively solids <theSolids>.
//! The IN faces for solids are stored into output data map <theInParts>.
//!
//! The map <theSolidsIF> contains INTERNAL faces of the solids, to avoid
//! their additional classification.
//!
//! Firstly, it checks the intersection of bounding boxes of the shapes.
//! If the Box is not stored in the <theShapeBoxMap> map, it builds the box.
//! If the bounding boxes of solid and face are interfering the classification is performed.
//!
//! It is assumed that all faces and solids are already intersected and
//! do not have any geometrically coinciding parts without topological
//! sharing of these parts
Standard_EXPORT static void ClassifyFaces(const TopTools_ListOfShape& theFaces,
const TopTools_ListOfShape& theSolids,
const Standard_Boolean theRunParallel,
Handle(IntTools_Context)& theContext,
TopTools_IndexedDataMapOfShapeListOfShape& theInParts,
const TopTools_DataMapOfShapeBox& theShapeBoxMap = TopTools_DataMapOfShapeBox(),
const TopTools_DataMapOfShapeListOfShape& theSolidsIF = TopTools_DataMapOfShapeListOfShape());
};

View File

@@ -1,8 +1,5 @@
// 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
// Created by: Oleg AGASHIN
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -15,63 +12,65 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPCol_BoxBndTree.hxx>
#include <BOPAlgo_ToolsProvider.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
//=======================================================================
//function :
//function : Constructor
//purpose :
//=======================================================================
BOPCol_BoxBndTreeSelector::BOPCol_BoxBndTreeSelector()
BOPAlgo_ToolsProvider::BOPAlgo_ToolsProvider()
:
BOPAlgo_Builder(),
myTools(myAllocator),
myMapTools(100, myAllocator)
{
}
//=======================================================================
//function : ~
//function : Constructor
//purpose :
//=======================================================================
BOPCol_BoxBndTreeSelector::~BOPCol_BoxBndTreeSelector()
BOPAlgo_ToolsProvider::BOPAlgo_ToolsProvider
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Builder(theAllocator),
myTools(myAllocator),
myMapTools(100, myAllocator)
{
}
//=======================================================================
//function : Reject
//purpose :
//=======================================================================
Standard_Boolean BOPCol_BoxBndTreeSelector::Reject (const Bnd_Box& aBox) const
{
return myBox.IsOut(aBox);
}
//=======================================================================
//function : Accept
//purpose :
//=======================================================================
Standard_Boolean BOPCol_BoxBndTreeSelector::Accept (const Standard_Integer& aIndex)
{
Standard_Boolean bRet=Standard_False;
//
myIndices.Append(aIndex);
bRet=!bRet;
return bRet;
}
//=======================================================================
//function : SetBox
//purpose :
//=======================================================================
void BOPCol_BoxBndTreeSelector::SetBox(const Bnd_Box& aBox)
{
myBox=aBox;
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void BOPCol_BoxBndTreeSelector::Clear()
void BOPAlgo_ToolsProvider::Clear()
{
myIndices.Clear();
BOPAlgo_Builder::Clear();
myTools.Clear();
myMapTools.Clear();
}
//=======================================================================
//function : Indices
//function : AddTool
//purpose :
//=======================================================================
const BOPCol_ListOfInteger& BOPCol_BoxBndTreeSelector::Indices() const
void BOPAlgo_ToolsProvider::AddTool(const TopoDS_Shape& theShape)
{
return myIndices;
if (myMapTools.Add(theShape))
myTools.Append(theShape);
}
//=======================================================================
//function : SetTools
//purpose :
//=======================================================================
void BOPAlgo_ToolsProvider::SetTools(const TopTools_ListOfShape& theShapes)
{
myTools.Clear();
TopTools_ListIteratorOfListOfShape aIt(theShapes);
for (; aIt.More(); aIt.Next())
AddTool(aIt.Value());
}

View File

@@ -0,0 +1,57 @@
// Created by: Oleg AGASHIN
// Copyright (c) 2017 OPEN CASCADE SAS
//
// 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.
#ifndef _BOPAlgo_ToolsProvider_HeaderFile
#define _BOPAlgo_ToolsProvider_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPAlgo_Builder.hxx>
//! Auxiliary class providing API to operate tool arguments.
class BOPAlgo_ToolsProvider : public BOPAlgo_Builder
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
Standard_EXPORT BOPAlgo_ToolsProvider();
Standard_EXPORT BOPAlgo_ToolsProvider(const Handle(NCollection_BaseAllocator)& theAllocator);
//! Clears internal fields and arguments
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
//! Adds Tool argument of the operation
Standard_EXPORT virtual void AddTool(const TopoDS_Shape& theShape);
//! Adds the Tool arguments of the operation
Standard_EXPORT virtual void SetTools(const TopTools_ListOfShape& theShapes);
//! Returns the Tool arguments of the operation
const TopTools_ListOfShape& Tools() const
{
return myTools;
}
protected:
TopTools_ListOfShape myTools;
TopTools_MapOfShape myMapTools;
};
#endif // _BOPAlgo_ToolsProvider_HeaderFile

View File

@@ -22,9 +22,9 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <TopoDS_Face.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <TopTools_ListOfShape.hxx>
class TopoDS_Face;
class TopoDS_Shape;
@@ -40,7 +40,7 @@ public:
BOPAlgo_WireEdgeSet();
virtual ~BOPAlgo_WireEdgeSet();
BOPAlgo_WireEdgeSet(const BOPCol_BaseAllocator& theAllocator);
BOPAlgo_WireEdgeSet(const Handle(NCollection_BaseAllocator)& theAllocator);
void Clear();
@@ -50,11 +50,11 @@ public:
void AddStartElement (const TopoDS_Shape& sS);
const BOPCol_ListOfShape& StartElements() const;
const TopTools_ListOfShape& StartElements() const;
void AddShape (const TopoDS_Shape& sS);
const BOPCol_ListOfShape& Shapes() const;
const TopTools_ListOfShape& Shapes() const;
@@ -64,8 +64,8 @@ protected:
TopoDS_Face myFace;
BOPCol_ListOfShape myStartShapes;
BOPCol_ListOfShape myShapes;
TopTools_ListOfShape myStartShapes;
TopTools_ListOfShape myShapes;
private:

View File

@@ -76,7 +76,7 @@
//function : StartElements
//purpose :
//=======================================================================
inline const BOPCol_ListOfShape& BOPAlgo_WireEdgeSet::StartElements()const
inline const TopTools_ListOfShape& BOPAlgo_WireEdgeSet::StartElements()const
{
return myStartShapes;
}
@@ -92,7 +92,7 @@
//function : Shapes
//purpose :
//=======================================================================
inline const BOPCol_ListOfShape& BOPAlgo_WireEdgeSet::Shapes()const
inline const TopTools_ListOfShape& BOPAlgo_WireEdgeSet::Shapes()const
{
return myShapes;
}

View File

@@ -17,21 +17,21 @@
#include <BOPAlgo_WireEdgeSet.hxx>
#include <BOPAlgo_WireSplitter.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_Parallel.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <NCollection_Vector.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
//=======================================================================
//function :
@@ -124,153 +124,12 @@ void BOPAlgo_WireSplitter::Perform()
myContext = new IntTools_Context;
}
//
MakeConnexityBlocks();
BOPTools_AlgoTools::MakeConnexityBlocks
(myWES->StartElements(), TopAbs_VERTEX, TopAbs_EDGE, myLCB);
MakeWires();
}
//=======================================================================
//function : MakeConnexityBlocks
//purpose :
//=======================================================================
void BOPAlgo_WireSplitter::MakeConnexityBlocks()
{
Standard_Boolean bRegular, bClosed;
Standard_Integer i, j, aNbV, aNbVS, aNbVP, k;
TopoDS_Iterator aItE;
TopoDS_Shape aER;
BOPCol_ListIteratorOfListOfShape aIt;
//
BOPCol_IndexedDataMapOfShapeListOfShape aMVE(100, myAllocator);
BOPCol_IndexedMapOfShape aMVP(100, myAllocator);
BOPCol_IndexedMapOfShape aMEC(100, myAllocator);
BOPCol_MapOfShape aMER(100, myAllocator);
BOPCol_MapOfShape aMEP(100, myAllocator);
BOPCol_IndexedMapOfShape aMVAdd(100, myAllocator);
BOPCol_MapOfShape aMVS(100, myAllocator);
//
myLCB.Clear();
//
const BOPCol_ListOfShape& aLSE=myWES->StartElements();
aIt.Initialize(aLSE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aE=aIt.Value();
if (aMEP.Add(aE)) {
BOPTools::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
}
else {
aMER.Add(aE);
}
}
//
// 2
aNbV=aMVE.Extent();
for (i=1; i<=aNbV; ++i) {
aNbVS=aMVS.Extent();
if (aNbVS==aNbV) {
break;
}
//
const TopoDS_Shape& aV=aMVE.FindKey(i);
//
if (!aMVS.Add(aV)) {
continue;
}
// aMVS - globally processed vertices
//
//------------------------------------- goal: aMEC
aMEC.Clear(); // aMEC - edges of CB
aMVP.Clear(); // aMVP - vertices to process right now
aMVAdd.Clear(); // aMVAdd vertices to process on next step of while(1)
//
aMVP.Add(aV);
//
for(;;) {
aNbVP=aMVP.Extent();
for (k=1; k<=aNbVP; ++k) {
const TopoDS_Shape& aVP=aMVP(k);
const BOPCol_ListOfShape& aLE=aMVE.FindFromKey(aVP);
aIt.Initialize(aLE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aE=aIt.Value();
if (aMEC.Add(aE)) {
aItE.Initialize(aE);
for (; aItE.More(); aItE.Next()) {
const TopoDS_Shape& aVE=aItE.Value();
if (aMVS.Add(aVE)) {
aMVAdd.Add(aVE);
}
}
}
}
}//for (k=1; k<=aNbVP; ++k) {
//
aNbVP=aMVAdd.Extent();
if (!aNbVP) {
break; // from while(1)
}
//
aMVP.Clear();
//
for (k=1; k<=aNbVP; ++k) {
const TopoDS_Shape& aVE=aMVAdd(k);
aMVP.Add(aVE);
}
aMVAdd.Clear();
}// while(1) {
//-------------------------------------
BOPTools_ConnexityBlock aCB(myAllocator);
BOPCol_ListOfShape& aLEC=aCB.ChangeShapes();
BOPCol_IndexedDataMapOfShapeListOfShape aMVER(100, myAllocator);
//
bRegular=Standard_True;
Standard_Integer aNbCB = aMEC.Extent();
for (j = 1; j <= aNbCB; j++) {
aER = aMEC(j);
//
if (aMER.Contains(aER)) {
aER.Orientation(TopAbs_FORWARD);
aLEC.Append(aER);
aER.Orientation(TopAbs_REVERSED);
aLEC.Append(aER);
bRegular=Standard_False;
}
else {
aLEC.Append(aER);
}
//
if (bRegular) {
BOPTools::MapShapesAndAncestors(aER, TopAbs_VERTEX, TopAbs_EDGE, aMVER);
}
}
//
if (bRegular) {
Standard_Integer aNbVR, aNbER;
//
aNbVR=aMVER.Extent();
for (k=1; k<=aNbVR; ++k) {
const BOPCol_ListOfShape& aLER=aMVER(k);
aNbER=aLER.Extent();
if (aNbER==1) {
const TopoDS_Edge& aEx=TopoDS::Edge(aER);
bClosed=BRep_Tool::IsClosed(aEx, myWES->Face());
if (!bClosed) {
bRegular=!bRegular;
break;
}
}
if (aNbER>2) {
bRegular=!bRegular;
break;
}
}
}
//
aCB.SetRegular(bRegular);
myLCB.Append(aCB);
}
}
/////////////////////////////////////////////////////////////////////////
class BOPAlgo_WS_ConnexityBlock {
public:
@@ -311,16 +170,16 @@ protected:
Handle(IntTools_Context) myContext;
};
typedef BOPCol_NCVector<BOPAlgo_WS_ConnexityBlock> \
typedef NCollection_Vector<BOPAlgo_WS_ConnexityBlock> \
BOPAlgo_VectorOfConnexityBlock;
//
typedef BOPCol_ContextFunctor
typedef BOPTools_ContextFunctor
<BOPAlgo_WS_ConnexityBlock,
BOPAlgo_VectorOfConnexityBlock,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_SplitBlockFunctor;
//
typedef BOPCol_ContextCnt
typedef BOPTools_ContextCnt
<BOPAlgo_SplitBlockFunctor,
BOPAlgo_VectorOfConnexityBlock,
Handle(IntTools_Context)> BOPAlgo_SplitBlockCnt;
@@ -335,7 +194,7 @@ void BOPAlgo_WireSplitter::MakeWires()
Standard_Integer aNbVCB, k;
TopoDS_Wire aW;
BOPTools_ListIteratorOfListOfConnexityBlock aItCB;
BOPCol_ListIteratorOfListOfShape aIt;
TopTools_ListIteratorOfListOfShape aIt;
BOPAlgo_VectorOfConnexityBlock aVCB;
//
const TopoDS_Face& aF=myWES->Face();
@@ -345,12 +204,12 @@ void BOPAlgo_WireSplitter::MakeWires()
BOPTools_ConnexityBlock& aCB=aItCB.ChangeValue();
bIsRegular=aCB.IsRegular();
if (bIsRegular) {
BOPCol_ListOfShape& aLE=aCB.ChangeShapes();
TopTools_ListOfShape& aLE=aCB.ChangeShapes();
BOPAlgo_WireSplitter::MakeWire(aLE, aW);
myWES->AddShape(aW);
}
else {
BOPAlgo_WS_ConnexityBlock& aWSCB = aVCB.Append1();
BOPAlgo_WS_ConnexityBlock& aWSCB = aVCB.Appended();
aWSCB.SetFace(aF);
aWSCB.SetConnexityBlock(aCB);
}
@@ -358,10 +217,10 @@ void BOPAlgo_WireSplitter::MakeWires()
//===================================================
BOPAlgo_SplitBlockCnt::Perform(myRunParallel, aVCB, myContext);
//===================================================
aNbVCB=aVCB.Extent();
aNbVCB=aVCB.Length();
for (k=0; k<aNbVCB; ++k) {
const BOPAlgo_WS_ConnexityBlock& aCB=aVCB(k);
const BOPCol_ListOfShape& aLW=aCB.ConnexityBlock().Loops();
const TopTools_ListOfShape& aLW=aCB.ConnexityBlock().Loops();
aIt.Initialize(aLW);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aWx=aIt.Value();

View File

@@ -22,10 +22,10 @@
#include <BOPAlgo_PWireEdgeSet.hxx>
#include <BOPTools_ListOfConnexityBlock.hxx>
#include <BOPAlgo_Algo.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPTools_ConnexityBlock.hxx>
#include <IntTools_Context.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <TopTools_ListOfShape.hxx>
class BOPAlgo_WireEdgeSet;
class TopoDS_Wire;
class TopoDS_Face;
@@ -46,7 +46,7 @@ public:
Standard_EXPORT BOPAlgo_WireSplitter();
Standard_EXPORT virtual ~BOPAlgo_WireSplitter();
Standard_EXPORT BOPAlgo_WireSplitter(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT BOPAlgo_WireSplitter(const Handle(NCollection_BaseAllocator)& theAllocator);
Standard_EXPORT void SetWES (const BOPAlgo_WireEdgeSet& theWES);
@@ -60,7 +60,7 @@ public:
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
static void MakeWire(BOPCol_ListOfShape& theLE, TopoDS_Wire& theW);
static void MakeWire(TopTools_ListOfShape& theLE, TopoDS_Wire& theW);
Standard_EXPORT static void SplitBlock (const TopoDS_Face& theF,
BOPTools_ConnexityBlock& theCB,
@@ -70,8 +70,6 @@ protected:
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
Standard_EXPORT void MakeConnexityBlocks();
Standard_EXPORT void MakeWires();
BOPAlgo_PWireEdgeSet myWES;

View File

@@ -85,13 +85,13 @@ typedef NCollection_IndexedDataMap<TopoDS_Shape, \
//function : MakeWire
//purpose :
//=======================================================================
inline void BOPAlgo_WireSplitter::MakeWire(BOPCol_ListOfShape& aLE,
inline void BOPAlgo_WireSplitter::MakeWire(TopTools_ListOfShape& aLE,
TopoDS_Wire& aWire)
{
BRep_Builder aBB;
aBB.MakeWire(aWire);
//
BOPCol_ListIteratorOfListOfShape aIt(aLE);
TopTools_ListIteratorOfListOfShape aIt(aLE);
for (; aIt.More(); aIt.Next()){
aBB.Add(aWire, aIt.Value());
}

View File

@@ -14,13 +14,6 @@
#include <BOPAlgo_WireEdgeSet.hxx>
#include <BOPAlgo_WireSplitter.hxx>
#include <BOPCol_IndexedDataMapOfShapeInteger.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_SequenceOfPnt2d.hxx>
#include <BOPCol_SequenceOfReal.hxx>
#include <BOPCol_SequenceOfShape.hxx>
#include <BOPTools_AlgoTools2D.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
@@ -50,9 +43,16 @@
#include <TopoDS_Wire.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <Geom2dLProp_CLProps2d.hxx>
#include <TColgp_SequenceOfPnt2d.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
typedef NCollection_DataMap \
<TopoDS_Shape, Standard_Boolean, TopTools_ShapeMapHasher> \
BOPCol_DataMapOfShapeBoolean;
MyDataMapOfShapeBoolean;
//
static
@@ -97,12 +97,12 @@ static
const TopoDS_Vertex& aVa,
const TopoDS_Edge& aEOuta,
BOPAlgo_EdgeInfo& anEdgeInfo,
BOPCol_SequenceOfShape& aLS,
BOPCol_SequenceOfShape& aVertVa,
BOPCol_SequenceOfPnt2d& aCoordVa,
TopTools_SequenceOfShape& aLS,
TopTools_SequenceOfShape& aVertVa,
TColgp_SequenceOfPnt2d& aCoordVa,
BOPTools_ConnexityBlock& aCB,
BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo& mySmartMap,
BOPCol_DataMapOfShapeBoolean aVertMap);
MyDataMapOfShapeBoolean aVertMap);
static
Standard_Real Angle (const gp_Dir2d& aDir2D);
@@ -122,7 +122,7 @@ static
static
void RefineAngles(const TopoDS_Face& myFace,
const BOPCol_ListOfShape&,
const TopTools_ListOfShape&,
BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo&,
const Handle(IntTools_Context)&);
@@ -130,7 +130,7 @@ static
static
void RefineAngles(const TopoDS_Vertex& ,
const TopoDS_Face& ,
const BOPCol_MapOfShape& ,
const TopTools_MapOfShape& ,
BOPAlgo_ListOfEdgeInfo&,
const Handle(IntTools_Context)&);
@@ -159,13 +159,13 @@ void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
TopoDS_Iterator aItS;
TopoDS_Vertex aVV;
TopoDS_Shape aV1;
BOPCol_ListIteratorOfListOfShape aIt;
TopTools_ListIteratorOfListOfShape aIt;
BOPAlgo_ListIteratorOfListOfEdgeInfo aItLEI;
//
BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo mySmartMap(100);
BOPCol_DataMapOfShapeBoolean aVertMap;
MyDataMapOfShapeBoolean aVertMap;
//
const BOPCol_ListOfShape& myEdges=aCB.Shapes();
const TopTools_ListOfShape& myEdges=aCB.Shapes();
//
// 1.Filling mySmartMap
aIt.Initialize(myEdges);
@@ -242,19 +242,19 @@ void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
Standard_Integer aNbE, aNbMapEE;
Standard_Boolean bFlag;
//
BOPCol_IndexedDataMapOfShapeListOfShape aMapEE(100);
TopTools_IndexedDataMapOfShapeListOfShape aMapEE(100);
aNbE=myEdges.Extent();
//
aIt.Initialize(myEdges);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aE = aIt.Value();
if (!aMapEE.Contains(aE)) {
BOPCol_ListOfShape aLEx;
TopTools_ListOfShape aLEx;
aLEx.Append(aE);
aMapEE.Add(aE, aLEx);
}
else {
BOPCol_ListOfShape& aLEx=aMapEE.ChangeFromKey(aE);
TopTools_ListOfShape& aLEx=aMapEE.ChangeFromKey(aE);
aLEx.Append(aE);
}
}
@@ -262,7 +262,7 @@ void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
bFlag=Standard_True;
aNbMapEE=aMapEE.Extent();
for (i=1; i<=aNbMapEE; ++i) {
const BOPCol_ListOfShape& aLEx=aMapEE(i);
const TopTools_ListOfShape& aLEx=aMapEE(i);
aNbE=aLEx.Extent();
if (aNbE==1) {// usual case
continue;
@@ -285,9 +285,9 @@ void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
if (bNothingToDo) {
TopoDS_Wire aW;
//
BOPCol_ListOfShape& aLECB=aCB.ChangeShapes();
TopTools_ListOfShape& aLECB=aCB.ChangeShapes();
BOPAlgo_WireSplitter::MakeWire(aLECB, aW);
BOPCol_ListOfShape& aLoops=aCB.ChangeLoops();
TopTools_ListOfShape& aLoops=aCB.ChangeLoops();
aLoops.Append(aW);
//
return;
@@ -322,8 +322,8 @@ void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
// 4. Do
//
Standard_Boolean bIsOut, bIsNotPassed;
BOPCol_SequenceOfShape aLS, aVertVa;
BOPCol_SequenceOfPnt2d aCoordVa;
TopTools_SequenceOfShape aLS, aVertVa;
TColgp_SequenceOfPnt2d aCoordVa;
//
for (i=1; i<=aNb; ++i) {
const TopoDS_Vertex& aVa=(*(TopoDS_Vertex *)(&mySmartMap.FindKey(i)));
@@ -356,13 +356,12 @@ void Path (const GeomAdaptor_Surface& aGAS,
const TopoDS_Vertex& aVFirst,
const TopoDS_Edge& aEFirst,
BOPAlgo_EdgeInfo& aEIFirst,
BOPCol_SequenceOfShape& aLS,
BOPCol_SequenceOfShape& aVertVa,
BOPCol_SequenceOfPnt2d& aCoordVa,
TopTools_SequenceOfShape& aLS,
TopTools_SequenceOfShape& aVertVa,
TColgp_SequenceOfPnt2d& aCoordVa,
BOPTools_ConnexityBlock& aCB,
BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo& mySmartMap,
BOPCol_DataMapOfShapeBoolean aVertMap)
MyDataMapOfShapeBoolean aVertMap)
{
Standard_Integer i, j, aNb, aNbj;
Standard_Real anAngleIn, anAngleOut, anAngle, aMinAngle;
@@ -412,7 +411,7 @@ void Path (const GeomAdaptor_Surface& aGAS,
//
bIsClosed = aVertMap.Find(aVb);
{
BOPCol_ListOfShape aBuf;
TopTools_ListOfShape aBuf;
Standard_Boolean bHasEdge = Standard_False;
//
aNb = aLS.Length();
@@ -473,8 +472,8 @@ void Path (const GeomAdaptor_Surface& aGAS,
return;
}
//
BOPCol_SequenceOfShape aLSt, aVertVat;
BOPCol_SequenceOfPnt2d aCoordVat;
TopTools_SequenceOfShape aLSt, aVertVat;
TColgp_SequenceOfPnt2d aCoordVat;
//
aVb=(*(TopoDS_Vertex *)(&aVertVa(i)));
//
@@ -861,14 +860,16 @@ Standard_Real VTolerance2D (const TopoDS_Vertex& aV,
//purpose :
//=======================================================================
void RefineAngles(const TopoDS_Face& myFace,
const BOPCol_ListOfShape& myEdges,
const TopTools_ListOfShape& myEdges,
BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo& mySmartMap,
const Handle(IntTools_Context)& theContext)
{
Standard_Integer aNb, i;
BOPCol_IndexedDataMapOfShapeInteger aMSI;
BOPCol_MapOfShape aMBE;
BOPCol_ListIteratorOfListOfShape aIt;
NCollection_IndexedDataMap<TopoDS_Shape,
Standard_Integer,
TopTools_ShapeMapHasher> aMSI;
TopTools_MapOfShape aMBE;
TopTools_ListIteratorOfListOfShape aIt;
//
// 1. Boundary Edges
aIt.Initialize(myEdges);
@@ -906,9 +907,9 @@ void RefineAngles(const TopoDS_Face& myFace,
//=======================================================================
typedef NCollection_DataMap \
<TopoDS_Shape, Standard_Real, TopTools_ShapeMapHasher> \
BOPCol_DataMapOfShapeReal;
typedef BOPCol_DataMapOfShapeReal::Iterator \
BOPCol_DataMapIteratorOfDataMapOfShapeReal;
TopTools_DataMapOfShapeReal;
typedef TopTools_DataMapOfShapeReal::Iterator \
TopTools_DataMapIteratorOfDataMapOfShapeReal;
//
//=======================================================================
//function : RefineAngles
@@ -916,14 +917,14 @@ typedef BOPCol_DataMapOfShapeReal::Iterator \
//=======================================================================
void RefineAngles(const TopoDS_Vertex& aV,
const TopoDS_Face& myFace,
const BOPCol_MapOfShape& aMBE,
const TopTools_MapOfShape& aMBE,
BOPAlgo_ListOfEdgeInfo& aLEI,
const Handle(IntTools_Context)& theContext)
{
Standard_Boolean bIsIn, bIsBoundary, bRefined;
Standard_Integer iCntBnd, iCntInt;
Standard_Real aA, aA1, aA2;
BOPCol_DataMapOfShapeReal aDMSR;
TopTools_DataMapOfShapeReal aDMSR;
BOPAlgo_ListIteratorOfListOfEdgeInfo aItLEI;
//
aA1=0.; // angle of outgoing edge

View File

@@ -3,6 +3,8 @@ BOPAlgo_Algo.hxx
BOPAlgo_ArgumentAnalyzer.cxx
BOPAlgo_ArgumentAnalyzer.hxx
BOPAlgo_ArgumentAnalyzer.lxx
BOPAlgo_ToolsProvider.cxx
BOPAlgo_ToolsProvider.hxx
BOPAlgo_BOP.cxx
BOPAlgo_BOP.hxx
BOPAlgo_Builder.cxx

View File

@@ -1,22 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_BaseAllocator_HeaderFile
#define BOPCol_BaseAllocator_HeaderFile
#include <NCollection_BaseAllocator.hxx>
typedef Handle(NCollection_BaseAllocator) BOPCol_BaseAllocator;
#endif

View File

@@ -1,81 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 2010-2012 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 <BOPCol_Box2DBndTree.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
BOPCol_Box2DBndTreeSelector::BOPCol_Box2DBndTreeSelector()
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
BOPCol_Box2DBndTreeSelector::~BOPCol_Box2DBndTreeSelector()
{
}
//=======================================================================
//function : Reject
//purpose :
//=======================================================================
Standard_Boolean BOPCol_Box2DBndTreeSelector::Reject
(const Bnd_Box2d& aBox2D) const
{
return myBox2D.IsOut(aBox2D);
}
//=======================================================================
//function : Accept
//purpose :
//=======================================================================
Standard_Boolean BOPCol_Box2DBndTreeSelector::Accept
(const Standard_Integer& aIndex)
{
Standard_Boolean bRet=Standard_False;
//
myIndices.Append(aIndex);
bRet=!bRet;
//}
return bRet;
}
//=======================================================================
//function : SetBox
//purpose :
//=======================================================================
void BOPCol_Box2DBndTreeSelector::SetBox(const Bnd_Box2d& aBox2D)
{
myBox2D=aBox2D;
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void BOPCol_Box2DBndTreeSelector::Clear()
{
myIndices.Clear();
}
//=======================================================================
//function : Indices
//purpose :
//=======================================================================
const BOPCol_ListOfInteger& BOPCol_Box2DBndTreeSelector::Indices() const
{
return myIndices;
}

View File

@@ -1,48 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 2010-2012 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.
#ifndef BOPCol_Box2DBndTree_HeaderFile
#define BOPCol_Box2DBndTree_HeaderFile
#include <NCollection_UBTree.hxx>
#include <Bnd_Box2d.hxx>
#include <BOPCol_ListOfInteger.hxx>
/**
* The instantiation of the algorithm of unbalanced binary tree
* of overlapped bounding boxes 2D.
*
*/
typedef NCollection_UBTree <Standard_Integer , Bnd_Box2d> BOPCol_Box2DBndTree;
class BOPCol_Box2DBndTreeSelector : public BOPCol_Box2DBndTree::Selector {
public:
Standard_EXPORT BOPCol_Box2DBndTreeSelector();
Standard_EXPORT virtual Standard_Boolean Reject(const Bnd_Box2d&) const;
Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &);
Standard_EXPORT virtual ~BOPCol_Box2DBndTreeSelector();
Standard_EXPORT void Clear();
Standard_EXPORT void SetBox(const Bnd_Box2d&);
Standard_EXPORT const BOPCol_ListOfInteger& Indices() const;
protected:
Bnd_Box2d myBox2D;
BOPCol_ListOfInteger myIndices;
};
#endif

View File

@@ -1,48 +0,0 @@
// 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.
#ifndef NMTDS_BoxBndTree_HeaderFile
#define NMTDS_BoxBndTree_HeaderFile
#include <NCollection_UBTree.hxx>
#include <Bnd_Box.hxx>
#include <BOPCol_ListOfInteger.hxx>
/**
* The instantiation of the algorithm of unbalanced binary tree
* of overlapped bounding boxes.
*
*/
typedef NCollection_UBTree <Standard_Integer , Bnd_Box> BOPCol_BoxBndTree;
class BOPCol_BoxBndTreeSelector : public BOPCol_BoxBndTree::Selector {
public:
Standard_EXPORT BOPCol_BoxBndTreeSelector();
Standard_EXPORT virtual Standard_Boolean Reject(const Bnd_Box&) const;
Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &);
Standard_EXPORT virtual ~BOPCol_BoxBndTreeSelector();
Standard_EXPORT void Clear();
Standard_EXPORT void SetBox(const Bnd_Box&);
Standard_EXPORT const BOPCol_ListOfInteger& Indices() const;
protected:
Bnd_Box myBox;
BOPCol_ListOfInteger myIndices;
};
#endif

View File

@@ -1,25 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_DataMapOfIntegerInteger_HeaderFile
#define BOPCol_DataMapOfIntegerInteger_HeaderFile
#include <NCollection_DataMap.hxx>
#include <TColStd_MapIntegerHasher.hxx>
typedef NCollection_DataMap<Standard_Integer, Standard_Integer, TColStd_MapIntegerHasher> BOPCol_DataMapOfIntegerInteger;
typedef BOPCol_DataMapOfIntegerInteger::Iterator BOPCol_DataMapIteratorOfDataMapOfIntegerInteger;
#endif

View File

@@ -1,27 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_DataMapOfIntegerListOfInteger_HeaderFile
#define BOPCol_DataMapOfIntegerListOfInteger_HeaderFile
#include <NCollection_DataMap.hxx>
#include <TColStd_MapIntegerHasher.hxx>
#include <BOPCol_ListOfInteger.hxx>
typedef NCollection_DataMap<Standard_Integer, BOPCol_ListOfInteger, TColStd_MapIntegerHasher> BOPCol_DataMapOfIntegerListOfInteger;
typedef BOPCol_DataMapOfIntegerListOfInteger::Iterator BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger;
#endif

View File

@@ -1,26 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_DataMapOfIntegerListOfShape_HeaderFile
#define BOPCol_DataMapOfIntegerListOfShape_HeaderFile
#include <NCollection_DataMap.hxx>
#include <TColStd_MapIntegerHasher.hxx>
#include <BOPCol_ListOfShape.hxx>
typedef NCollection_DataMap<Standard_Integer, BOPCol_ListOfShape, TColStd_MapIntegerHasher> BOPCol_DataMapOfIntegerListOfShape;
typedef BOPCol_DataMapOfIntegerListOfShape::Iterator BOPCol_DataMapIteratorOfDataMapOfIntegerListOfShape;
#endif

View File

@@ -1,27 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_DataMapOfIntegerMapOfInteger_HeaderFile
#define BOPCol_DataMapOfIntegerMapOfInteger_HeaderFile
#include <NCollection_DataMap.hxx>
#include <TColStd_MapIntegerHasher.hxx>
#include <BOPCol_MapOfInteger.hxx>
typedef NCollection_DataMap<Standard_Integer, BOPCol_MapOfInteger, TColStd_MapIntegerHasher> BOPCol_DataMapOfIntegerMapOfInteger;
typedef BOPCol_DataMapOfIntegerMapOfInteger::Iterator BOPCol_DataMapIteratorOfDataMapOfIntegerMapOfInteger;
#endif

View File

@@ -1,25 +0,0 @@
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_DataMapOfIntegerReal_HeaderFile
#define BOPCol_DataMapOfIntegerReal_HeaderFile
#include <NCollection_DataMap.hxx>
#include <TColStd_MapIntegerHasher.hxx>
typedef NCollection_DataMap<Standard_Integer, Standard_Real, TColStd_MapIntegerHasher> BOPCol_DataMapOfIntegerReal;
typedef BOPCol_DataMapOfIntegerReal::Iterator BOPCol_DataMapIteratorOfDataMapOfIntegerReal;
#endif

View File

@@ -1,26 +0,0 @@
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_DataMapOfIntegerShape_HeaderFile
#define BOPCol_DataMapOfIntegerShape_HeaderFile
#include <TopoDS_Shape.hxx>
#include <TColStd_MapIntegerHasher.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<Standard_Integer, TopoDS_Shape, TColStd_MapIntegerHasher> BOPCol_DataMapOfIntegerShape;
typedef BOPCol_DataMapOfIntegerShape::Iterator BOPCol_DataMapIteratorOfDataMapOfIntegerShape;
#endif

View File

@@ -1,26 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_DataMapOfShapeInteger_HeaderFile
#define BOPCol_DataMapOfShapeInteger_HeaderFile
#include <TopoDS_Shape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<TopoDS_Shape, Standard_Integer, TopTools_ShapeMapHasher> BOPCol_DataMapOfShapeInteger;
typedef BOPCol_DataMapOfShapeInteger::Iterator BOPCol_DataMapIteratorOfDataMapOfShapeInteger;
#endif

View File

@@ -1,27 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_DataMapOfShapeListOfShape_HeaderFile
#define BOPCol_DataMapOfShapeListOfShape_HeaderFile
#include <TopoDS_Shape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<TopoDS_Shape, BOPCol_ListOfShape, TopTools_ShapeMapHasher> BOPCol_DataMapOfShapeListOfShape;
typedef BOPCol_DataMapOfShapeListOfShape::Iterator BOPCol_DataMapIteratorOfDataMapOfShapeListOfShape;
#endif

View File

@@ -1,26 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_DataMapOfShapeReal_HeaderFile
#define BOPCol_DataMapOfShapeReal_HeaderFile
#include <TopoDS_Shape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<TopoDS_Shape, Standard_Real, TopTools_ShapeMapHasher> BOPCol_DataMapOfShapeReal;
typedef BOPCol_DataMapOfShapeReal::Iterator BOPCol_DataMapIteratorOfDataMapOfShapeReal;
#endif

View File

@@ -1,26 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_DataMapOfShapeShape_HeaderFile
#define BOPCol_DataMapOfShapeShape_HeaderFile
#include <TopoDS_Shape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> BOPCol_DataMapOfShapeShape;
typedef BOPCol_DataMapOfShapeShape::Iterator BOPCol_DataMapIteratorOfDataMapOfShapeShape;
#endif

View File

@@ -1,24 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_DataMapOfTransientAddress_HeaderFile
#define BOPCol_DataMapOfTransientAddress_HeaderFile
#include <NCollection_DataMap.hxx>
#include <TColStd_MapTransientHasher.hxx>
typedef NCollection_DataMap<Handle(Standard_Transient), Standard_Address, TColStd_MapTransientHasher> BOPCol_DataMapOfTransientAddress;
typedef BOPCol_DataMapOfTransientAddress::Iterator BOPCol_DataMapIteratorOfDataMapOfTransientAddress;
#endif

View File

@@ -1,26 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_IndexedDataMapOfIntegerListOfInteger_HeaderFile
#define BOPCol_IndexedDataMapOfIntegerListOfInteger_HeaderFile
#include <NCollection_IndexedDataMap.hxx>
#include <TColStd_MapIntegerHasher.hxx>
#include <BOPCol_ListOfInteger.hxx>
typedef NCollection_IndexedDataMap<Standard_Integer, BOPCol_ListOfInteger, TColStd_MapIntegerHasher> BOPCol_IndexedDataMapOfIntegerListOfInteger;
#endif

View File

@@ -1,26 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_IndexedDataMapOfShapeBox_HeaderFile
#define BOPCol_IndexedDataMapOfShapeBox_HeaderFile
#include <TopoDS_Shape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <Bnd_Box.hxx>
#include <NCollection_IndexedDataMap.hxx>
typedef NCollection_IndexedDataMap<TopoDS_Shape, Bnd_Box, TopTools_ShapeMapHasher> BOPCol_IndexedDataMapOfShapeBox;
#endif

View File

@@ -1,25 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_IndexedDataMapOfShapeInteger_HeaderFile
#define BOPCol_IndexedDataMapOfShapeInteger_HeaderFile
#include <TopoDS_Shape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_IndexedDataMap.hxx>
typedef NCollection_IndexedDataMap<TopoDS_Shape, Standard_Integer, TopTools_ShapeMapHasher> BOPCol_IndexedDataMapOfShapeInteger;
#endif

View File

@@ -1,27 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_IndexedDataMapOfShapeListOfShape_HeaderFile
#define BOPCol_IndexedDataMapOfShapeListOfShape_HeaderFile
#include <TopoDS_Shape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <NCollection_IndexedDataMap.hxx>
typedef NCollection_IndexedDataMap<TopoDS_Shape, BOPCol_ListOfShape, TopTools_ShapeMapHasher> BOPCol_IndexedDataMapOfShapeListOfShape;
#endif

View File

@@ -1,23 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_IndexedMapOfInteger_HeaderFile
#define BOPCol_IndexedMapOfInteger_HeaderFile
#include <NCollection_IndexedMap.hxx>
#include <TColStd_MapIntegerHasher.hxx>
typedef NCollection_IndexedMap<Standard_Integer, TColStd_MapIntegerHasher> BOPCol_IndexedMapOfInteger;
#endif

View File

@@ -1,24 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_IndexedMapOfShape_HeaderFile
#define BOPCol_IndexedMapOfShape_HeaderFile
#include <TopoDS_Shape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_IndexedMap.hxx>
typedef NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> BOPCol_IndexedMapOfShape;
#endif

View File

@@ -1,24 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_ListOfInteger_HeaderFile
#define BOPCol_ListOfInteger_HeaderFile
#include <NCollection_List.hxx>
typedef NCollection_List<Standard_Integer> BOPCol_ListOfInteger;
typedef BOPCol_ListOfInteger::Iterator BOPCol_ListIteratorOfListOfInteger;
typedef BOPCol_ListOfInteger* BOPCol_PListOfInteger;
#endif

View File

@@ -1,26 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_ListOfListOfShape_HeaderFile
#define BOPCol_ListOfListOfShape_HeaderFile
#include <NCollection_List.hxx>
#include <BOPCol_ListOfShape.hxx>
typedef NCollection_List<BOPCol_ListOfShape> BOPCol_ListOfListOfShape;
typedef BOPCol_ListOfListOfShape::Iterator BOPCol_ListIteratorOfListOfListOfShape;
#endif

View File

@@ -1,25 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_ListOfShape_HeaderFile
#define BOPCol_ListOfShape_HeaderFile
#include <NCollection_List.hxx>
#include <TopoDS_Shape.hxx>
typedef NCollection_List<TopoDS_Shape> BOPCol_ListOfShape;
typedef BOPCol_ListOfShape::Iterator BOPCol_ListIteratorOfListOfShape;
#endif

View File

@@ -1,24 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_MapOfInteger_HeaderFile
#define BOPCol_MapOfInteger_HeaderFile
#include <TColStd_MapIntegerHasher.hxx>
#include <NCollection_Map.hxx>
typedef NCollection_Map<Standard_Integer, TColStd_MapIntegerHasher> BOPCol_MapOfInteger;
typedef BOPCol_MapOfInteger::Iterator BOPCol_MapIteratorOfMapOfInteger;
#endif

View File

@@ -1,26 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_MapOfOrientedShape_HeaderFile
#define BOPCol_MapOfOrientedShape_HeaderFile
#include <TopoDS_Shape.hxx>
#include <TopTools_OrientedShapeMapHasher.hxx>
#include <NCollection_Map.hxx>
typedef NCollection_Map<TopoDS_Shape, TopTools_OrientedShapeMapHasher> BOPCol_MapOfOrientedShape;
typedef BOPCol_MapOfOrientedShape::Iterator BOPCol_MapIteratorOfMapOfOrientedShape;
#endif

View File

@@ -1,26 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_MapOfShape_HeaderFile
#define BOPCol_MapOfShape_HeaderFile
#include <TopoDS_Shape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_Map.hxx>
typedef NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> BOPCol_MapOfShape;
typedef BOPCol_MapOfShape::Iterator BOPCol_MapIteratorOfMapOfShape;
#endif

View File

@@ -1,48 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2013 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_NCVector_HeaderFile
#define BOPCol_NCVector_HeaderFile
#include <Standard.hxx>
#include <NCollection_Vector.hxx>
#include <NCollection_BaseAllocator.hxx>
//=======================================================================
//class : BOPCol_NCVector
//purpose :
//=======================================================================
template <class Type> class BOPCol_NCVector
:
public NCollection_Vector<Type>
{
public:
BOPCol_NCVector(const Standard_Integer theIncrement=256,
const Handle(NCollection_BaseAllocator)& theAlloc = NULL)
: NCollection_Vector<Type>(theIncrement, theAlloc)
{}
//
Type& Append1 ()
{
Type& anAppended = *(Type*)this->expandV (this->myLength);
return anAppended;
}
//
Standard_Integer Extent() const
{
return this->myLength;
}
};
#endif

View File

@@ -1,23 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_PInteger_HeaderFile
#define BOPCol_PInteger_HeaderFile
#include <Standard_TypeDef.hxx>
#include <BOPCol_ListOfInteger.hxx>
typedef Standard_Integer* BOPCol_PInteger;
#endif

View File

@@ -1,20 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_PListOfInteger_HeaderFile
#define BOPCol_PListOfInteger_HeaderFile
#include <BOPCol_ListOfInteger.hxx>
#endif

View File

@@ -1,25 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_SequenceOfPnt2d_HeaderFile
#define BOPCol_SequenceOfPnt2d_HeaderFile
#include <NCollection_Sequence.hxx>
#include <gp_Pnt2d.hxx>
typedef NCollection_Sequence<gp_Pnt2d> BOPCol_SequenceOfPnt2d;
#endif

View File

@@ -1,24 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// 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.
#ifndef BOPCol_SequenceOfShape_HeaderFile
#define BOPCol_SequenceOfShape_HeaderFile
#include <NCollection_Sequence.hxx>
#include <TopoDS_Shape.hxx>
typedef NCollection_Sequence<TopoDS_Shape> BOPCol_SequenceOfShape;
#endif

View File

@@ -1,39 +0,0 @@
BOPCol_BaseAllocator.hxx
BOPCol_Box2DBndTree.cxx
BOPCol_Box2DBndTree.hxx
BOPCol_BoxBndTree.cxx
BOPCol_BoxBndTree.hxx
BOPCol_DataMapOfIntegerInteger.hxx
BOPCol_DataMapOfIntegerListOfInteger.hxx
BOPCol_DataMapOfIntegerListOfShape.hxx
BOPCol_DataMapOfIntegerMapOfInteger.hxx
BOPCol_DataMapOfIntegerReal.hxx
BOPCol_DataMapOfIntegerShape.hxx
BOPCol_DataMapOfShapeAddress.hxx
BOPCol_DataMapOfShapeInteger.hxx
BOPCol_DataMapOfShapeListOfShape.hxx
BOPCol_DataMapOfShapeReal.hxx
BOPCol_DataMapOfShapeShape.hxx
BOPCol_DataMapOfTransientAddress.hxx
BOPCol_IndexedDataMapOfIntegerListOfInteger.hxx
BOPCol_IndexedDataMapOfShapeBox.hxx
BOPCol_IndexedDataMapOfShapeInteger.hxx
BOPCol_IndexedDataMapOfShapeListOfShape.hxx
BOPCol_IndexedMapOfInteger.hxx
BOPCol_IndexedMapOfShape.hxx
BOPCol_IndexedDataMapOfShapeShape.hxx
BOPCol_IndexedDataMapOfShapeReal.hxx
BOPCol_IndexedMapOfOrientedShape.hxx
BOPCol_ListOfInteger.hxx
BOPCol_ListOfListOfShape.hxx
BOPCol_ListOfShape.hxx
BOPCol_MapOfInteger.hxx
BOPCol_MapOfOrientedShape.hxx
BOPCol_MapOfShape.hxx
BOPCol_NCVector.hxx
BOPCol_Parallel.hxx
BOPCol_PInteger.hxx
BOPCol_PListOfInteger.hxx
BOPCol_SequenceOfPnt2d.hxx
BOPCol_SequenceOfReal.hxx
BOPCol_SequenceOfShape.hxx

View File

@@ -87,7 +87,7 @@ IMPLEMENT_STANDARD_RTTIEXT(BOPDS_CommonBlock,Standard_Transient)
// function: AddFaces
// purpose:
//=======================================================================
void BOPDS_CommonBlock::SetFaces(const BOPCol_ListOfInteger& aLF)
void BOPDS_CommonBlock::SetFaces(const TColStd_ListOfInteger& aLF)
{
myFaces=aLF;
}
@@ -95,7 +95,7 @@ IMPLEMENT_STANDARD_RTTIEXT(BOPDS_CommonBlock,Standard_Transient)
// function: AppendFaces
// purpose:
//=======================================================================
void BOPDS_CommonBlock::AppendFaces(BOPCol_ListOfInteger& aLF)
void BOPDS_CommonBlock::AppendFaces(TColStd_ListOfInteger& aLF)
{
myFaces.Append(aLF);
}
@@ -103,7 +103,7 @@ void BOPDS_CommonBlock::AppendFaces(BOPCol_ListOfInteger& aLF)
// function: Faces
// purpose:
//=======================================================================
const BOPCol_ListOfInteger& BOPDS_CommonBlock::Faces()const
const TColStd_ListOfInteger& BOPDS_CommonBlock::Faces()const
{
return myFaces;
}
@@ -116,6 +116,23 @@ void BOPDS_CommonBlock::AppendFaces(BOPCol_ListOfInteger& aLF)
return myPaveBlocks.First();
}
//=======================================================================
// function: SetRealPaveBlock
// purpose:
//=======================================================================
void BOPDS_CommonBlock::SetRealPaveBlock(const Handle(BOPDS_PaveBlock)& thePB)
{
BOPDS_ListIteratorOfListOfPaveBlock it(myPaveBlocks);
for (; it.More(); it.Next())
{
if (it.Value() == thePB)
{
myPaveBlocks.Prepend(thePB);
myPaveBlocks.Remove(it);
break;
}
}
}
//=======================================================================
// function: PaveBlockOnEdge
// purpose:
//=======================================================================
@@ -144,7 +161,7 @@ void BOPDS_CommonBlock::AppendFaces(BOPCol_ListOfInteger& aLF)
{
Standard_Boolean bFound;
Standard_Integer nF;
BOPCol_ListIteratorOfListOfInteger anIt;
TColStd_ListIteratorOfListOfInteger anIt;
//
bFound=Standard_False;
anIt.Initialize(myFaces);
@@ -236,7 +253,7 @@ void BOPDS_CommonBlock::AppendFaces(BOPCol_ListOfInteger& aLF)
Standard_Boolean BOPDS_CommonBlock::Contains(const Standard_Integer theF)const
{
Standard_Boolean bFound;
BOPCol_ListIteratorOfListOfInteger aIt;
TColStd_ListIteratorOfListOfInteger aIt;
//
bFound=Standard_False;
aIt.Initialize(myFaces);
@@ -254,7 +271,7 @@ void BOPDS_CommonBlock::AppendFaces(BOPCol_ListOfInteger& aLF)
void BOPDS_CommonBlock::Dump()const
{
Standard_Integer nF;
BOPCol_ListIteratorOfListOfInteger aIt;
TColStd_ListIteratorOfListOfInteger aIt;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
//
printf(" -- CB:\n");

Some files were not shown because too many files have changed in this diff Show More