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

Compare commits

..

146 Commits

Author SHA1 Message Date
nbv
eb31eda8fc 0029548: BRepFill_Pipe algorithm produces result with self-interferences
The region of self-interference is restricted.
2018-03-12 16:21:15 +03:00
kgv
726b5d9e92 0029529: Volume Rendering - crash on re-displaying the object
Added missing getters: OpenGl_TextureBufferArb::TextureFormat() and OpenGl_ShaderManager::OitState().
2018-03-02 15:27:57 +03:00
kgv
c40eb6b950 0029517: Visualization - introduce AlphaMode property defining alpha value handling options 2018-03-02 15:27:53 +03:00
kgv
ff6d145402 0029524: Modeling Algorithms - access violation in HLRBRep_PolyAlgo while computing HLR for triangulation-only surface 2018-03-02 15:27:49 +03:00
kgv
db5d29de1c 0029519: Visualization, TKOpenGl - fallback to Graphic3d_TOSM_FACET from Gouraud/Phong when nodal normals are undefined 2018-03-02 15:27:44 +03:00
anv
dc89236fee 0029097: Visualization - allow picking Graphic3d_TypeOfShadingModel per-object
Graphic3d_AspectFillArea3d has been extended by new property ::ShadingModel(),
which is set to Graphic3d_TOSM_DEFAULT by default.
The new API allows assigning Shading Model to specific Primitive Array groups
instead of entire Viewer, which was the only possibility before.

Graphic3d_TypeOfShadingModel has been extended with Graphic3d_TOSM_DEFAULT value
meaining that Shading Model defined as default for the Viewer should be used.
Graphic3d_TOSM_NONE has been renamed to Graphic3d_TOSM_UNLIT.
Documentation of Shading Models has been improved by more details.

V3d_TypeOfShadingModel enumeration has been merged into Graphic3d_TypeOfShadingModel
avoiding duplicated definitions and confusion.
Old values has been left for compatibility with old code and can be marked deprecated in future.

Draw Harness command vaspects has been extended by new argument -setShadingModel
for testing Shading Models assigned to entire objects.

OpenGl_SetOfShaderPrograms now holds an array of Shading Models.
OpenGl_ShaderManager interface has been modified and now requires enumeration as input
in several places where Boolean flags have been used previously
(methods ::BindFaceProgram(), ::BindLineProgram(), ::BindMarkerProgram()).

OpenGl_Workspace now defines default (undefined) OpenGl_AspectFace as Graphic3d_TOSM_UNLIT
to simplify indication of primitive groups with undefined Fill Area aspects,
and so that Graphic3d_TOSM_UNLIT set as default Shading Model will not make artifacts on Lines and Markers.

AIS_Manipulator::Axis::Compute() - added missing initialization of Fill Area aspects (leading to undefined behavior).
2018-02-22 11:32:55 +03:00
apn
8bf738e673 0029514: Configuration, CMake - OpenGL ES should be available for Linux
Allow optionally building OCCT with GLESv2 and EGL on Linux
2018-02-22 11:25:17 +03:00
kgv
94807a7d97 0029492: Coding Rules. NCollection_IndexedDataMap - add missing documentation to method ::Add() 2018-02-22 11:15:42 +03:00
apn
0b35e9d037 0029513: Replace OCC logo in user guides
Replace OCC logo by occ_logo.png in higher quality
2018-02-16 17:17:02 +03:00
apn
3f912eb289 0027747: Incomplete section curves between faces
Added test case bugs/modalg_7/bug27747
2018-02-16 15:12:43 +03:00
nbv
5c655dd566 0029510: IntWalk_PWalking:: PutToBoundary(...) method results in appearing several coincident points in Walking-line
Places have been detected where coincident points are created. The problem has been fixed.
2018-02-16 15:11:12 +03:00
nbv
8dc56d0f88 0029494: Intersection line between two parametric surfaces is restricted incorrectly if it matches the surface boundary
Creation of IntPatch_Points is forbidden in tangent-zones exceptionally domain boundaries of intersected surface.
2018-02-16 15:09:10 +03:00
nbv
7797eb389a 0029496: No intersection curve between faces if starting points are given
Now, bounded IntPatch_Points are found in case when starting points are used in intersection algorithm. Before the fix, these points were not looked for (even).
2018-02-16 15:07:01 +03:00
kgv
e3744452bb 0029509: Visualization, TKOpenGl - Weighted OIT + MSAA shader compilation errors
Fix implicit cast ivec2->vec2 and specify GLSL version to "320 es" on appropriate devices.
2018-02-15 16:56:25 +03:00
kgv
c5a65111c4 0029508: Visualization, TKOpenGl - visual artifacts on Adreno 305/308
OpenGl_ShaderManager now:
- prefers GLSL ES 100 over GLSL ES 300 on devices reporting OpenGL ES 3.0;
- prefers GLSL ES 300 on devices reporting OpenGL ES 3.1+.
to workaround known buggy implementations of OpenGL ES 3.0 drivers.
2018-02-15 16:55:32 +03:00
kgv
12d6e15582 0029507: Visualization, TKOpenGl - uninitialized class field OpenGl_FrameBuffer::myIsOwnDepth 2018-02-15 16:54:29 +03:00
kgv
0793c4f942 0029503: Visualization, TKOpenGl - fix access violation due to misprint in OpenGl_AspectMarker
Misprint mySprite->mySpriteA has been corrected.
2018-02-15 16:53:44 +03:00
apl
b17e5bae1a 0029337: Visualization, TKOpenGl - visual artifacts on Intel Broadwell GPU
Enable multiple draw buffers in shader program only if its required by specific application.

occSetFragColor() - a new GLSL function has been introduced
as an alternative to setting occFragColor/occFragCoverage variables.
2018-02-15 16:52:50 +03:00
emv
12d71ad6a5 0029502: Improve performance of the ShapeUpgrade_UnifySameDomain::UnifyEdges() method
Avoid repeated merging of the same chains of edges by processing all edges at once.

Test cases for the issue.
2018-02-15 16:51:46 +03:00
dipts
db60634ed1 0029500: Visualization - AIS_Point dynamic highlighting is not drawn on RedrawImmediate
ZLayer for Dynamic highlighting of AIS_Point has been set to Graphic3d_ZLayerId_Top
and of Selected highlighting to Graphic3d_ZLayerId_UNKNOWN,
to follow the behavior of normal AIS object.
2018-02-15 16:50:30 +03:00
dipts
5f6e3a0711 0029395: Visualization, V3d_View - Grid disappears forever after enabling RayTracing
Custom Graphic3d_Structure implementation has been added to V3d_RectangularGrid and V3d_CircularGrid to trigger recompute in case of device lost.
Primitive arrays are no more (re)computed while grid is not actually displayed.
2018-02-11 12:06:57 +03:00
kgv
f8e0c6c48a 0029491: Visualization, AIS_Shape - filter unsupported Display Modes within ::AcceptDisplayMode()
AIS_Shape::AcceptDisplayMode() now accepts only modes 0,1 and 2.
AIS_ColoredShape::Compute() no more computes presentation for unknown display mode.
2018-02-09 16:13:39 +03:00
emv
8a7476a622 0029488: Regression: boolean operation " general fuse" creates solid containing 5 not connected shells lying on the one level.
Boolean Operations - when checking two faces with the same bounds on Same Domain, take into account possible deviation of the edges from the faces surfaces.

Test cases for the issue.
2018-02-09 16:12:40 +03:00
gka
a8fea2a924 0029473: DRAW command "splitshape" produces invalid result on the cylindrical face.
Added taking into account distance between edges in the UV space for periodical surfaces in the LocOpe_SplitShape.cxx method ChoixUV
2018-02-06 18:58:05 +03:00
emv
a981082925 0029484: Avoid inheritance of the BRepAlgoAPI_Check from BRepBuilderAPI_MakeShape
Inherit BRepAlgoAPI_Check class from BOPAlgo_Options instead of BRepAlgoAPI_Algo, as the latter is too excessive for checking purposes.

Implementation of the Draw command "bopapicheck" for testing the BRepAlgoAPI_Check algorithm.
2018-02-06 18:57:01 +03:00
nbv
03a3ba9ebe 0028886: infinite loop at intersecting two faces / surfaces
The reason of constantly increasing/decreasing steps has been eliminated for the problem case.
2018-02-06 10:50:13 +03:00
kgv
161e0e95b7 0029477: Visualization, TKOpenGl - MSAA FBO initialization failure on OpenGL ES 3.2 device
OpenGl_View::myFboColorFormat now initialized using sized texture format GL_RGBA8
on mobile platforms (as in case of desktop platform).
2018-02-02 20:39:53 +03:00
emv
f9ffd4f9f3 0029465: Regression relation to 691 version: Extrema_ExtCC returns IsParallel equal to true for not parallel curves
Strengthening of the criteria of the parallel status of the curves by additional checking if the ends of the curves do not diverge.
Test cases for the issue.
2018-02-02 17:17:47 +03:00
kgv
05fb2b05af 0029474: Visualization, TKOpenGl - GLSL compilation errors on buggy OpenGL ES driver for PowerVR SGX 544MP
OpenGl_ShaderProgram::Initialize() now defines THE_MAX_LIGHTS/THE_MAX_CLIP_PLANES
to zeros to workaround issues with some buggy OpenGL drivers.
2018-02-02 16:43:48 +03:00
emv
03cca6f742 0028599: Replacement of old Boolean operations with new ones in BRepProj_Projection algorithm
The usage of *BRepAlgo_Section* has been replaced with the usage of *BRepAlgoAPI_Section* in *BRepProj_Projection* algorithm.

The TODO statements have been removed from the failing test case in the "prj" grid as they are working correctly now.

The following changes have been made to improve the performance *BRepAlgoAPI_Section*:
1. Revision of the *IntPolyh_Intersection* class to avoid repeated calculation of the deflection of the same triangulation.
2. Small revision of the Edge/Face intersection algorithm to perform Extrema computation on the whole intersection range of the edge instead of discrete ranges.
3. Implementation of the extrema computation for the Circle and Sphere.
4. Correct computation of the parameter of the point on the Circle.
2018-02-01 18:46:36 +03:00
kgv
95f688263d 0029069: Samples - handle UNICODE filenames within C++/CLI CSharp sample 2018-01-31 17:23:29 +03:00
msv
1d53219a28 0029463: Regression relation to 691 version: Method BndBox::IsOut() returns true for point lying on the planar face
Correct the method BRepBndLib::Add so that to enlarge the bounding box on the tolerance of edges which curves participate in calculation of the box.
2018-01-31 17:22:16 +03:00
aml
9b1d4e7fbe 0028176: Draw Harness - "reshape" command usage is not properly documented
Help message is corrected for "reshape" command. Command implementation is corrected according OCCT coding rules.
2018-01-31 17:20:29 +03:00
abv
32712d67c1 0029447: The constructor of Message_PrinterOStream mixes up cout and cerr
Use of cerr or cout is corrected in Message_PrinterOStream constructor
2018-01-29 21:11:51 +03:00
aml
ca4e36ae5b 0029453: Draw Harness - unclear syntax of "add" command
Help message is corrected for "add" command.
2018-01-29 07:06:51 +03:00
abv
07bbde451a 0029399: Optimize reading of floating point values from text strings
Function Strtod() is reimplemented using open source (MIT-style license) code by David M. Gay instead of strtod() provided by standard run-time library. This improves its performance by 3-10 times.

Functions Atof(), Strtod(), Printf(), Sprintf(), Fprintf() are declared as extern "C" to be usable from C programs.

Strtod() is used in Interface_FileReaderData::Fastof() and in RWStl_Reader to accelerate their work.

DRAW command QATestAtof and test perf fclasses strtod are added to check correctness and performance of Strtod().
Test perf draw restore is added to monitor performance of reading BREP files.

Minor off-topic corrections:
- method Standard_GUID::Assign (const Standard_UUID&) is implemented (was empty);
- Precision.hxx is included in BRepMesh_Vertex.hxx that uses it.
2018-01-26 20:11:03 +03:00
abv
0edbf10564 0029399: Optimize reading of floating point values from text strings -- base dtoa.c
Fast implementation of strtod downloaded from www.netlib.org/fp/dtoa.c (base version) is integrated as Standard_Strtod.cxx.
2018-01-26 20:10:56 +03:00
msv
ca9faa284d 0029448: The method Extrema_FuncExtCS::GetStateNumber mixes up parameter on curve with parameter U on surface
The code has been corrected to eliminate the mess.
2018-01-26 16:33:03 +03:00
nbv
779d6bc6a5 0028102: Problem cutting a plate with several holes (670)
Algorithm of processing cases when point of splitting Walking-line is near to the boundary of the intersection domain but does not match this boundary has been improved.
2018-01-25 19:36:37 +03:00
vro
93445088d8 0029443: It is not possible to store an ExtStringArray Ocaf attribute to any previous version in XML file format 2018-01-25 19:35:50 +03:00
ika
00dfcc765a 0029436: Data Exchange - Extend Expand compounds functionality.
Extend permissions for expand in ShapeTool
Fix processing of subshapes
Fix misprints
Add test cases
2018-01-23 20:13:11 +03:00
emv
b6cf8ffa35 0028385: Improve drawing isolines (DBRep_IsoBuilder algorithm)
1. When computing the iso-lines for the face (*DBRep_IsoBuilder*) prepare the Hatching algorithm with the following elements:
a. Trimmed p-curves of edges. The trimming parameters are computed by intersection with p-curves of the neighboring edges. The trimming will be performed only if the intersection point is covered by the tolerance of common vertex.
b. 2D segments connecting the p-curves of the neighboring edges. These segments will close the 2D gaps, which are closed in 3D by the tolerance of vertices shared between edges. This will allow trimming correctly the iso-lines passing through such gaps.

2. Implementation of the additional Init() method for WireExplorer algorithm taking UV bounds of the face to avoid their repeated computation when work working with a face having multiple wires.

3. Test cases for the issue.
2018-01-23 20:11:08 +03:00
nbv
f24150b851 0029430: [Regression] Curve evaluation at boundary point.
Before the fix, BRepAdaptor_CompCurve considered the input wire to be periodic with period LastParameter()-FirstParameter().
Now, method IsPeriodic will always return FALSE because it is impossible to obtain correspondence between the members of BRepAdaptor_CompCurve class and its periodicity status.
New behavior has been documented in upgrade-guide.
2018-01-17 16:44:57 +03:00
msv
4bc805bfc6 0029368: Incorrect intersection state of the intersection point of two 2d curves
In the algorithm math_FunctionRoots, improve the case when it is needed to find the extremum of the function. Earlier, to solve this task the method of gold section was used. With the patch, firstly the algorithm tries to find zero value of the derivative function. In most cases it gives precise result. Secondly, the algorithm tries to find zero value of the function using the old approach. The algorithm chooses the best solution among two computed by different methods.

In the method PutStickPavesOnCurve of BOPAlgo_PaveFiller, forbid putting a vertex to the end of the curve if this end already has a vertex assigned to it. This allows getting rid of unwanted colliding of vertices.

In the method UpdatePaveBlocks of BOPAlgo_PaveFiller, make the check for micro edges more precise.

New category of tests "lowalgos" has been added. Tests for low level algorithms are to be put there. "2dinter" is a new group of tests in this category.

Introduction of the new key for "2dintersect" command, allowing printing the intersection state for each point.
It has the following syntax now:
"2dintersect curve1 [curve2] [-tol tol] [-state]"
Options:
-tol - allows changing the intersection tolerance (default value is 1.e-3);
-state - allows printing the intersection state for each point.

Correct the test case bugs/modalg_7/bug28274 to make proper checks of the result.
2018-01-17 16:43:31 +03:00
szy
14abe5dc81 0029385: OCAF - TDataStd_IntPackedMap lacks interface to set map as TColStd_PackedMapOfInteger
Added method ChangeMap (const TColStd_PackedMapOfInteger& theMap).
2018-01-17 16:42:28 +03:00
abv
fcca9d7cd0 0029422: OCAF, old persistence - wrong implementation of writing a reference 2018-01-12 16:34:41 +03:00
msv
2651bb324e 0028211: Modeling Algorithms - Boolean fuse operation produces incorrect result
Correct procedure of initialization of BRepTopAdaptor_FClass2d and IntTools_FClass2d classifiers so as to produce more tight polygon in the case of self-intersections on very thin faces.

The idea is concluded in checking the condition:
defl < 2 * S / P, where S - is the surface area computed on produced polygon, P - its perimeter, defl - deflection computed on it.
If the condition is not true the polygon is discretized again using QuasiUniformDeflection tool.
2018-01-12 14:54:59 +03:00
kgv
67b3d2a8ad 0029419: Make V3d_Viewer::PrivilegedPlane() return const reference rather than a temp object 2018-01-12 12:25:59 +03:00
isn
1f59dfa9c2 0028681: UnifySameDomain distorts face boundary when merges a chain of small linear edges
In case of sequence of edges based on lines (which are going to be unified into one line-segment), take into account a linear tolerance  value.
Get rid of regressions.
Updates of USD-tests.
2018-01-12 12:25:02 +03:00
abv
2c3f1a579b 0029409: Configuration, macOS - "Appkit" is spelled in CMake scripts using wrong case for "K"
Spelling error is corrected in name of AppKit library in CMake and genproj scripts for macOS
2018-01-12 12:25:02 +03:00
ifv
5d010b1d05 0028499: Checkshape incorrectly reports BRepCheck_NotClosed when gap is covered by vertex tolerance
Calculation of 2d tolerance is improved
2017-12-29 15:44:06 +03:00
szy
409095ba18 0029402: In OCCT7.2.1-dev the names written into a FSD_File are associated with the wrong shapes.
The issue of incorrect Roots indexing is fixed by changing DataMap to IndexedDataMap.
Draw command fsdread was improved to allow restoring of shapes with kept names.
2017-12-28 16:34:19 +03:00
ika
44f2982356 0029403: Data Exchange - subshapes names are not imported from step
Fix processing of subshape names in STEP in reading and writing.
Replace creating subshapes in Document as tree (invalid) with plain subshapes structure.
Update test cases.
2017-12-27 19:13:08 +03:00
msv
62a672fb35 0029358: Unifysamedomain is unable to merge faces with the same underlying surface
The documentation has been updated to avoid misunderstanding of algorithm behavior.
2017-12-26 19:07:48 +03:00
emv
bfb6523573 0029387: Incorrect result of cut a face with several shapes
Remove section edges having no valid range.
Test case for the issue.
2017-12-26 19:06:10 +03:00
szy
4a5eefb909 0029371: The problem of the attributes constructor call
Default Guid is assigned in constructor.
Add test case: tests\bugs\caf\bug29371.
2017-12-25 18:33:05 +03:00
skl
153fee015d 0029391: Invalid import of TrimmedSurface
Fix and test for bug 29391.
2017-12-25 18:31:36 +03:00
msv
d9f2bc6b08 0029380: Delete "checknbshapes" from bugs/modalg_6/bug27341* test cases 2017-12-25 18:30:29 +03:00
emv
e25185fff0 0029400: Fuse of two edges creates self-interfered shape
Avoid creation of the edges with too small valid range (not allowing to split the edge) and interfering vertices.
Test case for the issue.
2017-12-25 11:47:53 +03:00
ski
8197951d7e 0029396: Configuration, Cmake: restore 3rd-party libraries into INTERFACE_LINK_LIBRARIES property of installed OCCT targets
Changes from branch CR29277 were reverted.
2017-12-22 13:16:32 +03:00
bugmaster
2e473bb049 0029398: Configuration - list lex and yacc files in the StepFile/FILES to avoid CMake warnings
Adding step.lex and step.yacc to StepFile/FILES
2017-12-22 10:31:15 +03:00
szy
83ae35919c 0029220: Application Framework - replace CDM_MessageDriver interface by Message_Messenger. 2017-12-21 13:02:39 +03:00
anv
31e026ba63 0029352: Adding support of GBK and Big5 code pages
Added methods to convert GBK and Big5 encodings to Unicode
2017-12-21 13:02:07 +03:00
msv
0ab4e62183 0028248: [Regression] HLR Algo result is retrieved from the last added shape only
Mistakes in retrieving of HLRBRep_EdgeData by value instead of reference have been corrected.
2017-12-20 18:51:43 +03:00
kgv
81a2800c0d 0029393: Samples - AndroidQt sample build fail
AndroidQt - dropped removed arguments within V3d_View::SetWindow() usage [0024776].
AndroidQt_Window - add missing NativeFBConfig() method declared in the interface [0026732].
2017-12-20 18:51:29 +03:00
ifv
c805f9a8f8 0028722: Conversion of a spherical face to a spline produces an invalid shape
Correction of 2d tolerance calculation for BSpline/Bezier surfaces
Test cases are corrected according to current behavior of algorithm
2017-12-20 18:51:13 +03:00
ika
5b7f8e0a69 0029362: Data Exchange - Crash during reading step file
Additional check for wires into searching of attached shapes,
Fix Dimension value processing,
2017-12-20 18:50:58 +03:00
kgv
77cd443b99 0029377: Configuration, CMake - linkage errors while using static OCCT libraries on Windows platform
HAVE_NO_DLL is now defined when building Static libraries.
2017-12-20 18:50:45 +03:00
kgv
683d15cbd4 0029376: Coding Rules, TColStd_PackedMapOfInteger - declare Iterator as nested class of map collection 2017-12-20 18:50:35 +03:00
emv
803a8cafe5 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.
2017-12-20 18:50:21 +03:00
nbv
6f1ea0f4b1 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.
2017-12-14 17:44:27 +03:00
nbv
624c599cd3 0029359: Approximation algorithm computes multidimensional distance in Euclidean space incorrectly
Wrong distance computation has been corrected.

Some test-cases have been corrected according to their new behavior. Namely, built (by approximation algorithm) curve(s) has changed its geometrical position.

1. tests/blend/simple/X4

It is not a regression because the result is not correct on both MASTER and FIX (see explanation in the issue #26740). This problem is expected to be solved after porting Fillet-algorithm to new Boolean operation. Old Boolean operations do not cover Edge-Edge tangent-zone by vertex.

2. tests/bugs/modalg_6/bug27341_318

"checknbshapes" has been deleted in order to avoid non-stable behavior (see issue #29360) of this test case. New result is OK on both Linux and Windows platform.
2017-12-11 11:19:22 +03:00
emv
0a807dd9a3 0029351: Boolean Operations create invalid pcurves
When making pcurve for edge on face make sure that the produced 2D curve will have the same range as 3D curve of the edge.
2017-12-08 16:39:34 +03:00
vro
4e882c7153 0026570: Crash on attempt to rotate a shape.
An extended draw-command trotate (ttranslate, tmirror, ...) by an additional parameter "-copy".
New check of edge range is added in BRepCheck/BRepCheck_Edge.cxx
The same checking is added in ShapeAnalysis_Edge.cxx
Fixing this problem is added in ShapeFix_Wire.cxx
GeomLib::SameRange(...) and BRepTools_TrsfModification::NewCurve2d(...) are modified to avoid exception in TrimmedCurve
2017-12-08 16:39:30 +03:00
abv
472433e2c7 0029355: OCCT 6.9.1 persistence restored in OCCT 7.2.0 not working
Auxiliary classes StdObjMgt_ReadData::Object and StdObjMgt_WriteData::Object are renamed to "ObjectSentry" (to better reflect their nature); constructor is made explicit to ensure that such objects are always created intentionally.
These objects are instantiated explicitly in the body of relevant functions, instead of implicit creation as temporary objects when function requires such object as argument.
Variable used to get char from stream is nullified in several places in FSD_File and other classes, to avoid possible usage of uninitialized memory in case if stream is bad.
2017-12-08 16:39:26 +03:00
kgv
67160f4e79 0029372: Graphic3d_TransformPers - improve description of Local Coordinate system defined by Transformation Persistence 2017-12-08 16:39:22 +03:00
kgv
5dc0517d2d 0029365: Visualization, TKOpenGl - do not include hidden structures to Rendered within frame statistics
OpenGl_Layer::UpdateCulling() now considers structure as culled in case if it has Hidden state.
2017-12-08 16:39:19 +03:00
emv
944768d277 0029312: Using OBB to speed up Boolean Operations
1. Implementation of the user-defined option for usage of Oriented Bounding Boxes (OBB) in Boolean Operations for additional filtering (rejection) of selected for intersection pairs of sub-shapes.

By default the usage of OBB is turned off.
To enable/disable its usage the method SetUseOBB(flag) should be used. This method is available for all operations in Boolean Component.
To enable/disable it in draw the command "buseobb 0/1" should be used. Note, that this will affect all subsequent operations.

The OBB for the shapes are built by first necessity and stored into operation context (IntTools_Context).

2. Usage of the OBB in some test cases.
2017-12-08 16:39:15 +03:00
nbv
1a0339b464 0029311: Implementation of the Oriented Bounding Boxes (OBB) functionality
1. The class Bnd_OBB has been created to describe the Oriented Bounding Box.

2. Several key methods have been implemented: Bnd_OBB::IsOut(...), Bnd_OBB::Add(...) and Bnd_OBB::Enlarge(...).

3. Interface of Bnd_Box class has changed. New methods have been created. See Bnd_Box.hxx for detailed information.

4. BRepBndLib and Draw_Box classes have been amended in order to provide correct work with Bnd_OBB class.

5. Interface of "bounding" DRAW-command has been changed. Please see help for detailed information.

6. New DRAW-command "isbbinterf" has been created. Please see help for detailed information.

7. "boundingstr" and "optbounding" DRAW-commands have been eliminated because their function can be made by "bounding" DRAW-command (e.g. see tests/bugs/vis/buc60857 or samples/tcl/snowflake.tcl test cases).

8. Documentation has been updated.
2017-12-08 16:39:11 +03:00
kgv
8d1a539c4a 0029366: Visualization, OpenGl_Text - artifacts when using Aspect_TODT_SHADOW/Aspect_TODT_DEKALE at different zoom level
OpenGl_Text now applies Polygon Offset instead of Z-shift in world coordinates for drawing background.
OpenGl_Context::SetPolygonOffset() - polygon offset state has been moved from OpenGl_Workspace to OpenGl_Context.
2017-12-08 16:39:06 +03:00
nbv
faaa95cbe7 0029323: Intersection algorithm produces the curve with oscillation
Sometimes the algorithm of purging of extra points in the walking line makes enormous difference in distance between two neighbor segments of the line. This badly impacts the quality of approximation result. This patch balances the difference in distances by forbidding deletion of some points.

1. tests/bugs/modalg_6/bug27615

The reason of the correction is explained in the message ~0072580 (see issue #28557).

2. tests/bugs/modalg_7/bug28892*
   tests/bugs/modalg_7/bug28984

The reason of the correction is explained in the message ~0072583 (see issue #28984).
2017-12-08 16:39:03 +03:00
kgv
48a2dd2012 0029344: Foundation Classes, TCollection_AsciiString - replace confusing strncpy with memcpy
strncpy() usage within TCollection_AsciiString has been replaced by memcpy()
where string length has been already determined.

TCollection_AsciiString::SetValue() now throws exception
on attempt to set '\0' - TCollection_AsciiString::Trunc() should be used instead.
TCollection_AsciiString(const char* , int ) has been modified to properly set string length
in case of NULL-terminator appeared earlier then specified length.

Interface_LineBuffer has been revised for using NCollection_Array1 instead of TCollection_AsciiString
to avoid misusing TCollection_AsciiString interface.
2017-12-08 16:38:59 +03:00
kgv
15669413da 0029346: Visualization, TKOpenGl - collect frame statistics
Graphic3d_RenderingParams::ToShowStats - new option displaying rendering statistics.

OpenGl_FrameStats - new class for accumulating frame statistics.
OpenGl_Context::FrameStats() provides an access to the frame stats
used for currently rendered context.
OpenGl_View::Redraw() and OpenGl_View::RedrawImmediate()
resets counters within OpenGl_Context::FrameStats().

OpenGl_Layer::UpdateCulling() - simplified resetting of culling state for cullable structures.
2017-12-01 15:36:55 +03:00
vro
ab3ff92cc0 0029353: Optimization of TPrsStd_AISPresentation::SetSelectionMode() 2017-12-01 12:04:42 +03:00
kgv
992ed6b3c0 0029290: Visualization, TKOpenGl - allow defining Light source per ZLayer
Graphic3d_CLight is now defined as a class inheriting Standard_Transient,
so that it's fields now should be accessed through methods.
Graphic3d_CLight::IsEnabled() - new property allowing to disable light source everywhere.
Confusing alias OpenGl_Light has been removed.

Graphic3d_CLight::SetAttenuation() - the upper limit 1.0 of attenuation factors has been removed
since it contradicts to OpenGL specs and does not make sense.

Graphic3d_ZLayerSettings::Lights() - light sources list is now property of ZLayer.
When defined, it overrides light sources defined for View/Viewer.
New class Graphic3d_LightSet has been defined to define a set of light sources.

V3d_Light - removed obsolete interface for debug drawing lights sources.
V3d_Light is now an alias to Graphic3d_CLight.
V3d_TypeOfLight is now defined as a typedef to Graphic3d_TypeOfLightSource.
2017-11-30 23:09:23 +03:00
kgv
3cbd0a8e87 0029350: Visualization, OpenGl_Text - add Aspect_TODT_SHADOW text style
Within new style Aspect_TODT_SHADOW, a tiny shadow is drawn at right-bottom corner
with one pixel shift, producing a slightly nicer visual look than Aspect_TODT_DEKALE.
2017-11-30 23:09:22 +03:00
kgv
64c6d8df50 0029331: Visualization, TKOpenGl - make OpenGl_PrimitiveArray::IsFillDrawMode() as virtual method of OpenGl_Element 2017-11-30 23:09:22 +03:00
kgv
f47849f49e 0028416: Visualization - SelectMgr_SelectionManager::Activate() should not implicitly deactivate Global Selection Mode
Implicit deactivation of global selection mode has been removed from SelectMgr_SelectionManager::Activate().

Added new method AIS_InteractiveContext::SetSelectionModeActive() as replacement
of AIS_InteractiveContext::Activate() / ::Deactivate().
New method takes an argument AIS_SelectionModesConcurrency which defines
what to do with already activated selection modes in 3 ways:
- AIS_SelectionModesConcurrency_Single, only one selection mode can be activated at
  the same moment - previously activated should be deactivated
- AIS_SelectionModesConcurrency_GlobalOrLocal, either Global (AIS_InteractiveObject::GlobalSelectionMode()
  or Local (multiple) selection modes can be active at the same moment
- AIS_SelectionModesConcurrency_Multiple, any combination of selection modes can be activated.
2017-11-30 23:08:56 +03:00
emv
81a55a6996 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*.
2017-11-30 12:11:20 +03:00
emv
1155d05a06 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*;
2017-11-30 12:11:15 +03:00
kgv
2da5126371 0029349: Foundation Classes, OSD_Timer - add missing theThisThreadOnly constructor option available in OSD_Chronometer
OSD_Timer constructor now has theThisThreadOnly option passed to OSD_Chronometer,
which is FALSE by default.

OSD_Chronometer now provides methods ::UserTimeCPU(), ::SystemTimeCPU() allowing
to fetch CPU times without akward syntax through overloaded ::Show().
2017-11-28 17:11:14 +03:00
ifv
18d8e3e794 0029289: Wrong derivatives in math_TrigonometricFunctionRoots.cxx file
Class MyTrigoFunction is removed from file math_TrigonometricFunctionRoots.cxx.
New class math_TrigonometricEquationFunction with the same functionality is created to provide possibilities
for individual testing.
Expressions for derivatives are corrected.
New Draw command "intconcon" for intersection 2d conic curves is created.
Test command OCC29289 (file QABugs_20.cxx) is created for individual testing math_TrigonometricEquationFunction.
It is used in tests/bugs/modalg_7/bug29289
2017-11-27 11:01:21 +03:00
ika
b8bf959578 0029338: Data Exchange - Add Planes for Tolerance zones in Geometric tolerances
Add new poles to Geometric Tolerance objects
Some code refactoring in GDT attributes
Add Draw functions for affected plane
2017-11-24 15:48:11 +03:00
mkv
c2e47bdd8d Update of tests database
Test for 0023171: Got wrong result after stitching
Test for 0023612: BRepPrimAPI_MakeTorus
Test for 0023610: checkshape command does not detect mismatch of the tolerance values among the sub-shapes of the shape
Test for 0023660: 'bsection' produces result with gap
Test for 0024397: BRepBuilderAPI_Copy works not correct
Test for 0023927: BRepProj_Projection produces Edge with one Vertex outside from curve
Test for 0023902: Cannot build fillet
Test for 0023669: Error in Boolean operations algorithm: section between cylindrical face and prism is incomplete
Test for 0023660: 'bsection' produces result with gap
Test for 0024100: Bad pcurve is built on a face while converting the shape from STEP format.
Test for 0024319: Sewing makes a solid transparent
Test for 0024302: Section operation modifies input argument
Test for 0024397: BRepBuilderAPI_Copy works not correct
Test for 0024418: Wrong section curves when intersecting analytical surfaces
2017-11-24 15:39:23 +03:00
szy
a7378539f1 0029142: Exception on Redo.
Order of attributes deltas is fixed.
2017-11-23 13:05:30 +03:00
emv
0ccd71060a 0029175: BRepOffsetAPI_MakeOffset problem
The problem is fixed by the fix for the issue #29162.
Creating test case for the issue.
2017-11-23 13:05:02 +03:00
emv
e7384fd437 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.
2017-11-23 13:04:58 +03:00
emv
b7cd7c2b7c 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"
2017-11-23 13:04:52 +03:00
aml
c5b89fa358 0025879: result of blend fails the bopcheck
Protection from the zero-length gp_Dir construction is added.
2017-11-22 15:45:26 +03:00
abv
e7174545eb 0029113: Coding Rules - fix convention to have one header per API type
Paragraph on naming of classes is revised to describe correspondence of names of public types and files.
2017-11-22 15:41:13 +03:00
msv
977ad98334 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.
2017-11-14 16:52:41 +03:00
kgv
2c26e60bf9 0029317: Configuration, CMake - CSF_d3d9 should be processed for building TKD3DHost using MinGW 2017-11-14 16:49:33 +03:00
msv
2829097547 0029287: Move package GProp from TKG2d to TKG3d 2017-11-14 16:48:12 +03:00
jgv
833e75611f 0029204: BRepOffsetAPI_MakePipeShell produces invalid result and raises exception in Draw
1.The algorithm searching the section in the corner (ChooseSection) is modified to be able to find simple cases with rather big tolerance.

2. The constructor of BRepFill_Section is modified: now it removes locations in the shape of section like it was done in BRepFill_Pipe.

3. Correction of U-edges by Same Parameter has been added to the method BRepFill_Sweep::Build.
2017-11-14 15:57:57 +03:00
aml
d193f101a7 0025968: boolean returning an invalid shape
Problem is not reproduced on current master.
Testing case was created
2017-11-14 15:57:02 +03:00
emv
8621854853 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.
2017-11-14 15:57:00 +03:00
aml
b39485d9e3 0025966: Booleans with tangent faces
Problem is not reproduced on current master.
Testing case was created
2017-11-14 15:56:57 +03:00
aml
90f0fdad2a 0025104: Prism from BSpline curve can not be chamfered
Protection from zero-length vectors has been added.
2017-11-14 15:56:55 +03:00
msv
f16a6cc5aa 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.
2017-11-14 15:56:53 +03:00
kgv
2b8832bb0e 0028760: Visualization, TKOpenGl - avoid excessive frustum culling traverse within extra OIT rendering pass
Culling traverse is no more called implicitly within OpenGl_Layer::Render().
Instead, all layers are traversed at onces within OpenGl_View::render() beforehand.

OpenGl_BVHTreeSelector methods have been renamed to better reflect their meaning.
Non-persistent culling options has been moved to dedicated structure OpenGl_BVHTreeSelector::CullingContext
so that OpenGl_BVHTreeSelector instance can be used for different Layers without modifying its state.
2017-11-10 07:34:58 +03:00
kgv
daf73ab7c9 0029283: Visualization - allow defining more than 8 light sources
OpenGl_ShaderManager now overrides THE_MAX_LIGHTS within built-in shading programs
so that maximum number of lights is now limited only by OpenGL hardware
(e.g. length of GLSL program, number of defined uniforms, result performance, etc.).
THE_MAX_CLIP_PLANES is now also defined by OpenGl_ShaderManager,
so that unused lights and clipping planes do not reserve extra uniforms in GLSL programs.

V3d_View::SetLightOn() does not throw exception anymore, when the number of lights exceeds 8.
Instead, OpenGl_ShaderManager::PushLightSourceState() emits warning
in case of usage of FFP providing consistent behavior with Clipping Planes number limit.
2017-11-09 18:08:34 +03:00
kgv
182bd7bc42 0029304: Draw Harness, DBRep_DrawableShape - fix inappropriate use of unordered map
TColStd_DataMapOfIntegerInteger has been replaced by NCollection_Vector.
2017-11-09 18:08:22 +03:00
kgv
b6a0525bcb 0029299: Foundation Classes, NCollection - define explicit empty constructor for map classes
Ambiguous constructors have been marked with explicit keyword for classes
NCollection_DataMap, NCollection_DoubleMap, NCollection_IndexedDataMap, NCollection_IndexedMap,
NCollection_List, NCollection_LocalArray, NCollection_Map, NCollection_Sequence,
NCollection_SparseArray, NCollection_UBTree,
2017-11-09 18:08:20 +03:00
kgv
510cb85241 0029302: Foundation Classes, NCollection - optimize iteration of indexed maps
NCollection_IndexedMap and NCollection_IndexedDataMap
now access Key by Index number without computing Hash code.
IndexedMapNode::myNext2 and IndexedDataMapNode::myNext2 fields
have been removed, so that indexed map now may utilize less memory.

TCollection::NextPrimeForMap() has been extended upto 2038431745
(almost full signed 32-bit integer range),
and NCollection_BaseMap::mySaturated property has been removed.

NCollection_IndexedDataMap::RemoveFromIndex(), FindKey(), FindFromIndex(),
ChangeFromIndex() - removed duplicating checks for out of range input.
2017-11-09 18:08:18 +03:00
kgv
f88457e638 0029300: Visualization, TKOpenGl - provide depth pre-pass option
OpenGl_LayerList::Render() now handles new option Graphic3d_RenderingParams::ToEnableDepthPrepass
which prepends additional pass to rendering pipeline filling Depth Buffer in advance.
2017-11-09 18:08:16 +03:00
kgv
21b2385fcb 0029292: Coding Rules - remove Graphic3d_Vector duplicating gp_XYZ
Graphic3d_Vector has been replaced by gp_Pnt/gp_XYZ/gp_Dir depending on context.
StdSelect_ViewerSelector3d::ToPixMap() - fixed unsafe float math causing out-of-range color results.
2017-11-09 18:08:13 +03:00
ifv
69f87d091e 0029162: Geom2dInt_GInter algorithm does not find intersection of ellipse and line
Analytical intersection algorithm is implemented for ellipse-line intersection
2017-11-09 18:08:11 +03:00
abv
a89a630e2a 0029297: [Regression] Configuration - Mingw-w64 build fails for TKOpenGl due to missing link to OpenGl
The order of external libraries is corrected in TKOpenGl/EXTERNLIB so that more higher-level libs are mentioned earlier than low-level libs on which the former depend (e.g. Gl2Ps before OpenGl) to ensure that GCC linker is able to resolve dependencies.
2017-11-09 18:08:09 +03:00
kgv
6286195cff 0029258: Foundation Classes - provide move constructors for string classes
New macro OCCT_NO_RVALUE_REFERENCE is introduced to disable methods using move semantics on obsolete compilers that do not support rvalue references.

TCollection_AsciiString, TCollection_ExtendedString, NCollection_UtfString - added method Swap(), move constructor, and move assignment operator.

Draw command QATestArrayMove is added to test for memory corruption if NCollection_Array1<> bound to local C buffer is returned from function by value.
2017-11-09 18:08:07 +03:00
kgv
4ecf34cce7 0029295: Visualization, TKOpenGl - provide distance culling option
Graphic3d_ZLayerSettings::CullingDistance() and ::CullingSize() - added
new properties configuring culling of small and distant objects, disabled by default.
OpenGl_BVHTreeSelector now handles size culling and distance culling in addition to frustom culling.
2017-11-09 18:08:05 +03:00
kgv
761d880766 0029285: Visualization, V3d_View::UpdateLights() - eliminate implicit redraw 2017-11-08 16:42:01 +03:00
kgv
dd1ae9df09 0029286: Visualization, TKOpenGl - do not update FFP state when OpenGl_Caps::ffpEnable is disabled 2017-11-08 16:41:59 +03:00
emv
93964cc239 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.
2017-11-08 16:38:56 +03:00
mnt
53a1447a00 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
2017-11-02 17:02:45 +03:00
ika
b2e3ec8d1c 0029282: Data Exchange - UpdateAssemblies is not working for located root assemblies
Add check for located root assemblies.
2017-11-01 17:28:26 +03:00
emv
98b3765966 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.
2017-11-01 17:27:08 +03:00
aml
3cdf48fe62 0027784: Thickness fails on cylinder with draft
Incorrect calculation of intersection in 2D space is fixed.
2017-11-01 17:01:59 +03:00
ski
5891b8ba41 0029277: Configuration, Cmake - remove 3rd-party libraries from INTERFACE_LINK_LIBRARIES property of installed OCCT targets
3rd-party libraries were removed from INTERFACE_LINK_LIBRARIES properties of OCCT targets.
2017-11-01 16:51:12 +03:00
kgv
777ca20ad9 0029249: Configuration - Standard_Failure compilation fails on VS2013 + Intel Compiler due to unavailability of thread_local
Check __INTEL_COMPILER version in combination with _MSC_VER on Windows.
2017-11-01 16:48:19 +03:00
kgv
6194ee76fb 0029262: Visualization - AIS_InteractiveContext::Load() does not register Object in the Viewer
AIS_InteractiveContext::Load() now loads the object regardless specified selection mode and decomposition flag.
AIS_InteractiveContext::Load() and ::KeepTemporary() now register object in the Viewer
in the same way as ::Display() does.

Draw Harness command vdisplay has been extended with new flag -erased to load object into context in erased state.
2017-10-26 12:53:38 +03:00
apn
4f26118e3b 0029250: Configuration, TKIVtk - build failure with VTK 6.3+ due to vtkRenderingFreeTypeOpenGL being removed
Remove vtkRenderingFreeTypeOpenGL from EXTERNLIB if used vtk version is 6.3.0 and above
2017-10-25 18:41:32 +03:00
kgv
59e353b75d 0029251: Configuration - problem compiling OCCT 7.2 with glibc 2.26
Standard_CLocaleSentry does not include xlocale.h when using glibc anymore.
HAVE_XLOCALE_H has been renamed to OCCT_CLOCALE_POSIX2008 to avoid confusion.

Renamed macros OCC_CHECK_BASE_CLASS -> OCCT_CHECK_BASE_CLASS.
2017-10-24 18:32:01 +03:00
kgv
ab8566c904 0029255: Configuration, .gitignore - do not track generated files with extensions VC.db, VC.opendb 2017-10-24 18:29:42 +03:00
kgv
65ada1f174 0029252: Coding rules - eliminate GCC compiler warnings -Wformat-overflow
OSD_DirectoryIterator and OSD_FileIterator now uses TCollection_AsciiString instead of unsafe sprintf.
2017-10-24 18:27:00 +03:00
abv
cf0786daf1 0024574: ICC compiler warnings on Windows
NCollection_UtfString and NCollection_UtfIterator classes are refactored to use methods overloading instead of switches to dispatch implementation depending on character (Unicode code unit) size.

ICC-specific preprocessor directives are added to avoid warnings.
Unused local functions and variables, class methods, unreachable statements, and extra throw() declarations reported by ICC are removed.
Usage of "expl" for name of local variable is avoided as it conflicts with standard C function "expl" defined in math.h as preprocessor macro.

Non-standard (MS-specific) argument envp is removed in definition of main() function on Windows.
Functions _main_ and _WinMain_ are renamed to Draw_Main and Draw_WinMain, respectively, to avoid using names reserved in C++.

Doxygen warning is fixed in XDE User's Guide.
2017-10-23 16:54:48 +03:00
kgv
f6c2b39aac 0029214: Application Framework - TPrsStd_AISPresentation::AISUpdate() should not implicitly redraw 3D Viewer 2017-10-23 16:53:32 +03:00
apn
72bcf3c7be 0029247: Tests, CheckCommands.tcl - Tcl exception "expected integer but got 3dviewer" in test cases on macOS
Test cases on macOS (using native tcl from /usr/lib) fail when $lst starts with numeral, because upvar guesses that its first parameter is level rather than otherVar.
The fix is to explicitly supply level to 1 (default value if uplevel is omitted) to avoid tcl exception "expected integer but got 3dviewer".
2017-10-19 12:27:45 +03:00
ifv
47a2717138 0029183: Result of general fuse of shell and edge produces a shape with too large tolerance
Adjusting parameters on approximation (boundary condition) for case when projected curve is far from surface
Test case is created
2017-10-19 12:26:52 +03:00
msv
6da5b3004c 0029157: Modeling - suspicious pass-through of case labels in switch statements
Suspicious passes through case labels have been resolved either by using Standard_FALLTHROUGH macro or by redesigning the code.
2017-10-19 12:26:50 +03:00
msv
56c62737ee 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.
2017-10-19 12:26:47 +03:00
oan
5fbe3d01e6 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
2017-10-19 12:26:45 +03:00
kgv
744d9c0d22 0029228: Coding Rules - define rule for avoiding header inclusion list pollution 2017-10-19 12:26:43 +03:00
dbv
4ea76aea75 0029229: Crash at Poly_Triangulation::Normal
Fixed creation of returning gp_Dir
2017-10-19 12:26:41 +03:00
emv
4b1a240135 0028763: Projection of a short line segment on a polar surface causes exception
Test case for the issue.
The problem has been fixed by the fix for the issue 0028150
2017-10-19 12:26:39 +03:00
kgv
82be4141b6 0029225: Visualization - Font_FTFont::AdvanceX() retrieves kerning value for incorrect characters pair
Fixed FT_Get_Kerning misuse within Font_FTFont::AdvanceX()/Font_FTFont::AdvanceY().
Font_FTFont::loadGlyph() has been corrected to not return TRUE
in case if method called with 0 argument second+ time.
2017-10-16 17:56:14 +03:00
emv
bc4a38670e 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.
2017-10-16 17:54:42 +03:00
1535 changed files with 50178 additions and 23995 deletions

2
.gitignore vendored
View File

@@ -35,6 +35,8 @@ Release
*.suo
*.sdf
*.opensdf
*.VC.db
*.VC.opendb
*.ipch
*.aps

View File

@@ -583,7 +583,7 @@ else()
endif()
# OpenGL ES 2.0
if (WIN32 AND CAN_USE_GLES2)
if (CAN_USE_GLES2)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
set (USE_GLES2 ON)
else()

View File

@@ -73,6 +73,7 @@ if (WIN32)
set (CSF_user32 "user32.lib")
set (CSF_wsock32 "wsock32.lib")
set (CSF_psapi "Psapi.lib")
set (CSF_d3d9 "D3D9.lib")
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" OR USE_GLES2)
set (CSF_OpenGlLibs "libEGL libGLESv2")
else()
@@ -85,7 +86,7 @@ if (WIN32)
set (CSF_objc "objc")
# frameworks
find_library (Appkit_LIB NAMES Appkit)
find_library (Appkit_LIB NAMES AppKit)
set (CSF_Appkit ${Appkit_LIB})
find_library (IOKit_LIB NAMES IOKit)
@@ -109,7 +110,11 @@ if (WIN32)
set (CSF_OpenGlLibs "EGL GLESv2")
elseif (UNIX)
set (CSF_ThreadLibs "pthread rt stdc++")
set (CSF_OpenGlLibs "GL")
if (USE_GLES2)
set (CSF_OpenGlLibs "EGL GLESv2")
else()
set (CSF_OpenGlLibs "GL")
endif()
set (CSF_XwLibs "X11 Xext Xmu Xi")
set (CSF_dl "dl")
endif()

View File

@@ -11,6 +11,9 @@ set (PRECOMPILED_DEFS)
if (NOT BUILD_SHARED_LIBS)
list (APPEND PRECOMPILED_DEFS "-DOCCT_NO_PLUGINS")
if (WIN32)
list (APPEND PRECOMPILED_DEFS "-DHAVE_NO_DLL")
endif()
endif()
# Get all used packages from toolkit
@@ -281,9 +284,19 @@ if("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL2")
list (REMOVE_ITEM USED_TOOLKITS_BY_CURRENT_PROJECT ${VTK_EXCLUDE_LIBRARY})
if (${VTK_EXCLUDE_LIBRARY} STREQUAL vtkRenderingOpenGL)
list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT vtkRenderingOpenGL2)
if(VTK_MAJOR_VERSION GREATER 6)
list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT vtkRenderingGL2PSOpenGL2)
endif()
endif()
endif()
endforeach()
else()
if(VTK_MAJOR_VERSION EQUAL 6 AND VTK_MINOR_VERSION GREATER 2 OR VTK_MAJOR_VERSION GREATER 6)
list (FIND USED_TOOLKITS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL" IS_VTK_RENDER_FREETYPE_FOUND)
if (NOT ${IS_VTK_RENDER_FREETYPE_FOUND} EQUAL -1)
list (REMOVE_ITEM USED_TOOLKITS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL")
endif()
endif()
endif()
if (BUILD_SHARED_LIBS)

View File

@@ -37,6 +37,9 @@ set (PRECOMPILED_DEFS)
if (NOT BUILD_SHARED_LIBS)
list (APPEND PRECOMPILED_DEFS "-DOCCT_NO_PLUGINS")
if (WIN32)
list (APPEND PRECOMPILED_DEFS "-DHAVE_NO_DLL")
endif()
endif()
# Get all used packages from toolkit

View File

@@ -1366,7 +1366,7 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
set aLibsMap(CSF_dl) "dl"
if { "$theOS" == "mac" } {
set aLibsMap(CSF_objc) "objc"
set aFrmsMap(CSF_Appkit) "Appkit"
set aFrmsMap(CSF_Appkit) "AppKit"
set aFrmsMap(CSF_IOKit) "IOKit"
set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
set aFrmsMap(CSF_TclLibs) "Tcl"

View File

@@ -93,7 +93,7 @@ The following table gives the full list of environment variables used at the con
| 3RDPARTY_TBB* | Path | Path to TBB binaries |
| 3RDPARTY_VTK_* | Path | Path to VTK binaries |
| BUILD_MODULE_<MODULE>| Boolean flag | Indicates whether the corresponding OCCT module should be built or not. It should be noted that some toolkits of a module can be built even if this module is not checked (this happens if some other modules depend on these toolkits). The main modules and their descriptions can be found in @ref user_guides |
| BUILD_LIBRARY_TYPE | String | Specifies the type of library to be created. "Shared" libraries are linked dynamically and loaded at runtime. "Static" libraries are archives of object files used when linking other targets |
| BUILD_LIBRARY_TYPE | String | Specifies the type of library to be created. "Shared" libraries are linked dynamically and loaded at runtime. "Static" libraries are archives of object files used when linking other targets. Note that Draw Harness plugin system is incompatible with "Static" builds, and therefore it should be excluded. Using "Static" libraries also might require modification in building procedures of user application (and OCCT samples); on Windows platform, user application should define HAVE_NO_DLL. |
| BUILD_ADDITIONAL_TOOLKITS | String | Semicolon-separated individual toolkits to include into build process. If you want to build some particular libraries (toolkits) only, then you may uncheck all modules in the corresponding *BUILD_MODUE_\<MODULE\>* options and provide the list of necessary libraries here. Of course, all dependencies will be resolved automatically |
| BUILD_YACCLEX | Boolean flag | Enables Flex/Bison lexical analyzers. OCCT source files relating to STEP reader and ExprIntrp functionality are generated automatically with Flex/Bison. Checking this option leads to automatic search of Flex/Bison binaries and regeneration of the mentioned files |
| BUILD_MODULE_MfcSamples | Boolean flag | Indicates whether MFC samples should be built together with OCCT. This option is only relevant to Windows platforms |

View File

@@ -76,19 +76,28 @@ Note that .lxx files should be avoided in most cases - inline method should be p
Toolkit names are prefixed by *TK*, followed by a meaningful part of the name explaining the domain of functionality covered by the toolkit (e.g. *TKOpenGl*).
### Names of classes
### Names of public types
Usually the names of source files located in a unit start from the unit name separated from the other part of the file name by underscore "_".
Thus, the names of files containing sources of C++ classes that belong to a package are constructed according to the following template:
Names of public classes and other types (structures, enums, typedefs) should match the common pattern: name of the package followed by underscore and suffix (the own name of the type):
~~~~~
<package-name>_<class-name>.cxx (or .hxx)
<package-name>_<class-name>
~~~~~
For example, file *Adaptor2d_Curve2d.cxx* belongs to the package *Adaptor2d*
Static methods related to the whole package are defined in the class with the same name as package (without suffix).
Files that contain sources related to the whole unit are called by the unit name with appropriate extension.
Each type should be defined in its own header file with the name of the type and extension ".hxx".
Implementation should be placed in the file with the same name and extension ".cxx"; for large classes it is possible to split implementation into multiple source files with additional suffixes in the names (usually numerical, e.g. *BSplCLib_1.cxx*).
For example, class *Adaptor2d_Curve2d* belongs to the package *Adaptor2d*; it is defined in header file *Adaptor2d_Curve2d.hxx* and implemented in source file *Adaptor2d_Curve2d.cxx*.
This rule also applies to complex types constructed by instantiation of templates.
Such types should be given own names using *typedef* statement, located in same-named header file.
For example, see definition in the file *TColStd_IndexedDataMapOfStringString.hxx*:
~~~~~
typedef NCollection_IndexedDataMap<TCollection_AsciiString,TCollection_AsciiString,TCollection_AsciiString> TColStd_IndexedDataMapOfStringString;
~~~~~
### Names of functions
@@ -479,6 +488,8 @@ Inclusion of class header on top verifies consistency of the header (e.g. that h
An exception to the rule is ordering system headers generating a macros declaration conflicts (like "windows.h" or "X11/Xlib.h") - these headers should be placed in the way solving the conflict.
The source or header file should include only minimal set of headers necessary for compilation, without duplicates (considering nested includes).
~~~~~{.cpp}
// the header file of implemented class
#include <PackageName_ClassName.hxx>

View File

@@ -1437,3 +1437,117 @@ 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*;
* The method *BOPAlgo_Builder::Splits()* has been removed as excessive. The method *BOPAlgo_Builder::Images()* can be used instead.
@section upgrade_occt730 Upgrade to OCCT 7.3.0
@subsection upgrade_730_lights Light sources
Multiple changes have been applied to lights management within TKV3d and TKOpenGl:
* V3d_Light class is now an alias to Graphic3d_CLight.
Graphic3d_CLight is now a Handle class with refactored methods for managing light source parameters
(preserving most methods of V3d_Light sub-classes to simplify porting).
* Obsolete debugging functionality for drawing lights source has been removed from V3d_Light.
Methods and constructors taking parameters for this drawing and not affecting light definition itself has been also removed.
* Light constructors taking V3d_Viewer has been marked deprecated.
Application may call V3d_Viewer::AddLight() explicitly to register new light sources created by new constructors within V3d_Viewer, but this step is now optional.
* The upper limit of 8 light sources has been removed.
* Dedicated classes per light source type V3d_AmbientLight, V3d_DirectionalLight, V3d_PositionalLight and V3d_SpotLight have been preserved,
but it is now possible defining light of any type by creating base class Graphic3d_CLight directly.
Dedicated classes only hides visibility of unrelated light properties depending on its type.
* Calling V3d_Viewer::UpdateLights() is no more required after modifying light sources properties (color, position, etc.).
@subsection upgrade_730_shadingmodels Shading Models
*Graphic3d_AspectFillArea3d* has been extended by a new property ::ShadingModel(), which previously has been defined globally for entire View.
Previously, triangle array without normal vertex attributes was implicitly considered as unshaded,
but now such array will be shaded using *Graphic3d_TOSM_FACET* model (e.g. by computing per-triangle normals).
Therefore, *Graphic3d_TOSM_UNLIT* should be explicitly specified for disabling shading or triangles array.
Alternatively, material without reflectance properties can be used for disabling shading as before.
@subsection upgrade_730_tkopengl Custom low-level OpenGL elements
The following API changes should be considered while porting custom OpenGl_Element objects:
* OpenGl_ShaderManager::BindFaceProgram(), ::BindLineProgram(), ::BindMarkerProgram() now takes enumeration arguments instead of Boolean flags.
@subsection upgrade_730_BOPAlgo_Section Changes in BOPAlgo_Section
The public method *BuildSection()* in the class *BOPAlgo_Section* has became protected. The methods *Perform()* or *PerformWithFiller()* should be called for construction of the result of SECTION operation.
@subsection upgrade_730_BRepAdaptor_CompCurve Changes in BRepAdaptor_CompCurve
The method BRepAdaptor_CompCurve::SetPeriodic has been eliminated.
Since new version, the method BRepAdaptor_CompCurve::IsPeriodic() will always return FALSE. Earlier, it could return TRUE in case if the wire contained only one edge based on periodic curve.
@subsection upgrade_730_removed Removed features
* The methods *SetDeflection*, *SetEpsilonT*, *SetDiscretize* of the class *IntTools_EdgeFace* have been removed as excessive.
@subsection upgrade_730_IntersectionAPI Changes in classes responsible for intersection algorithm
Interfaces of the following methods have been changed: IntPatch_WLineTool::ComputePurgedWLine(...), IntPatch_PrmPrmIntersection::Perform(...), IntPatch_Intersection::Perform(...), IntPatch_Intersection::ParamParamPerfom(...), IntPatch_Intersection::GeomGeomPerfom(...). Please see documentation about corresponding methods.

View File

@@ -136,6 +136,9 @@ FreeImage is easy to use, fast, multithreading safe, compatible with all 32-bit
and cross-platform (works both with Linux and Mac OS X). FreeImage is optionally used by OCCT to work
with images, on conditions of the FreeImage Public License (FIPL) (http://freeimage.sourceforge.net/freeimage-license.txt).
**David M. Gay's floating point routines** (dtoa.c) are used for fast reading of floating point values from text strings.
These routines are available under MIT-like license (see http://www.netlib.org/fp/).
**CMake** is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice.
OCCT uses CMake as a build system. CMake is available under BSD 3-Clause license. See more at https://cmake.org/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@@ -548,7 +548,8 @@ The class *BOPAlgo_Options* provides the following options for the algorithms:
* Check the presence of the Errors and Warnings;
* Turn on/off the parallel processing;
* Set the additional tolerance for the operation;
* Break the operations by user request.
* Break the operations by user request;
* Usage of Oriented Bounding boxes in the operation.
@subsection occt_algorithms_root_classes_2 Class BOPAlgo_Algo
@@ -785,6 +786,118 @@ The types of resulting shapes depend on the type of the corresponding argument p
| 7 | EDGE | Set of split EDGEs | |
| 8 | VERTEX | VERTEX | |
@subsection occt_algorithms_7_3a Options
The General Fuse algorithm has a set of options, which allow speeding-up the operation and improving the quality of the result:
* Parallel processing option allows running the algorithm in parallel mode;
* Fuzzy option allows setting the additional tolerance for the operation;
* Safe input shapes option allows preventing modification of the input shapes;
* Gluing option allows speeding-up the intersection of the arguments;
* Possibility to disable the check for the inverted solids among input shapes;
* Usage of Oriented Bounding Boxes in the operation;
* History support.
For more detailed information on these options please see the @ref occt_algorithms_11a "Advanced options" section.
@subsection occt_algorithms_7_3b Usage
The following example illustrates how to use the GF algorithm:
#### Usage of the GF algorithm on C++ level
~~~~
BOPAlgo_Builder aBuilder;
// Setting arguments
TopTools_ListOfShape aLSObjects = …; // Objects
aBuilder.SetArguments(aLSObjects);
// Setting options for GF
// Set parallel processing mode (default is false)
Standard_Boolean bRunParallel = Standard_True;
aBuilder.SetRunParallel(bRunParallel);
// Set Fuzzy value (default is Precision::Confusion())
Standard_Real aFuzzyValue = 1.e-5;
aBuilder.SetFuzzyValue(aFuzzyValue);
// Set safe processing mode (default is false)
Standard_Boolean bSafeMode = Standard_True;
aBuilder.SetNonDestructive(bSafeMode);
// Set Gluing mode for coinciding arguments (default is off)
BOPAlgo_GlueEnum aGlue = BOPAlgo_GlueShift;
aBuilder.SetGlue(aGlue);
// Disabling/Enabling the check for inverted solids (default is true)
Standard Boolean bCheckInverted = Standard_False;
aBuilder.SetCheckInverted(bCheckInverted);
// Set OBB usage (default is false)
Standard_Boolean bUseOBB = Standard_True;
aBuilder.SetUseOBB(buseobb);
// Perform the operation
aBuilder.Perform();
// Check for the errors
if (aBuilder.HasErrors())
{
return;
}
// Check for the warnings
if (aBuilder.HasWarnings())
{
// treatment of the warnings
...
}
// result of the operation
const TopoDS_Shape& aResult = aBuilder.Shape();
~~~~
#### Usage of the GF algorithm on Tcl level
~~~~
# prepare the arguments
box b1 10 10 10
box b2 3 4 5 10 10 10
box b3 5 6 7 10 10 10
# clear inner contents
bclearobjects; bcleartools;
# set the arguments
baddobjects b1 b2 b3
# setting options for GF
# set parallel processing mode (default is 0)
brunparallel 1
# set Fuzzy value
bfuzzyvalue 1.e-5
# set safe processing mode (default is 0)
bnondestructive 1
# set gluing mode (default is 0)
bglue 1
# set check for inverted (default is 1)
bcheckinverted 0
# set obb usage (default is 0)
buseobb 1
# perform intersection
bfillds
# perform GF operaton
bbuild result
~~~~
@subsection occt_algorithms_7_3 Examples
Please, have a look at the examples, which can help to better understand the definitions.
@@ -1061,7 +1174,7 @@ The input data for this step is a *BOPAlgo_Builder* object after building result
@section occt_algorithms_8 Splitter Algorithm
The Splitter algorithm allows splitting a group of arbitrary shapes by another group of arbitrary shapes.<br>
It is based on the General Fuse algorithm, thus all options of the General Fuse such as Fuzzy mode, safe processing mode, parallel mode, gluing mode and history support are also available in this algorithm.
It is based on the General Fuse algorithm, thus all options of the General Fuse (see @ref occt_algorithms_7_3a "GF Options") are also available in this algorithm.
@subsection occt_algorithms_8_1 Arguments
@@ -1082,22 +1195,18 @@ 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
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*/
BOPAlgo_Glue aGlue = BOPAlgo_GlueOff; /* Glue option to speed up intersection of the arguments*/
// setting arguments
// Setting arguments and tools
TopTools_ListOfShape aLSObjects = …; // Objects
TopTools_ListOfShape aLSTools = …; // Tools
aSplitter.SetArguments(aLSObjects);
aSplitter.SetTools(aLSTools);
// setting options
aSplitter.SetRunParallel(bRunParallel);
aSplitter.SetFuzzyValue(aTol);
aSplitter.SetNonDestructive(bSafeMode);
aSplitter.SetGlue(aGlue);
//
aSplitter.Perform(); //perform the operation
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
// Perform the operation
aSplitter.Perform();
if (aSplitter.HasErrors()) { //check error status
return;
}
@@ -2041,7 +2150,7 @@ The algorithm creates only closed solids. In general case the result solids are
But the algorithm allows preventing the addition of the internal for solids parts into result. In this case the result solids will be manifold and not contain any internal parts. However, this option does not prevent from the occurrence of the internal edges or vertices in the faces.<br>
Non-closed faces, free wires etc. located outside of any solid are always excluded from the result.
The Volume Maker algorithm is implemented in the class BOPAlgo_MakerVolume. It is based on the General Fuse (GF) algorithm. All the options of the GF algorithm such as possibility to run algorithm in parallel mode, fuzzy option, safe mode, glue options and history support are also available in this algorithm.
The Volume Maker algorithm is implemented in the class BOPAlgo_MakerVolume. It is based on the General Fuse (GF) algorithm. All the options of the GF algorithm (see @ref occt_algorithms_7_3a "GF Options") are also available in this algorithm.
The requirements for the arguments are the same as for the arguments of GF algorithm - they could be of any type, but each argument should be valid and not self-interfered.
@@ -2054,23 +2163,19 @@ 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
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)*/
Standard_Boolean bSafeMode = Standard_False; /* protect or not the arguments from modification*/
BOPAlgo_Glue aGlue = BOPAlgo_GlueOff; /* Glue option to speed up intersection of the arguments*/
Standard_Boolean bAvoidInternalShapes = Standard_False; /* Avoid or not the internal for solids shapes in the result*/
//
// Set the arguments
TopTools_ListOfShape aLS = …; // arguments
aMV.SetArguments(aLS);
aMV.SetRunParallel(bRunParallel);
aMV.SetIntersect(bIntersect);
aMV.SetFuzzyValue(aTol);
aMV.SetNonDestructive(bSafeMode);
aMV.SetGlue(aGlue);
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
// Additional option of the algorithm
Standard_Boolean bAvoidInternalShapes = Standard_False; /* Avoid or not the internal for solids shapes in the result*/
aMV.SetAvoidInternalShapes(bAvoidInternalShapes);
//
aMV.Perform(); //perform the operation
// Perform the operation
aMV.Perform();
if (aMV.HasErrors()) { //check error status
return;
}
@@ -2128,7 +2233,7 @@ The algorithm can also create containers from the connected Cells added into res
The algorithm has been implemented in the *BOPAlgo_CellsBuilder* class.
Cells Builder is based on the General Fuse algorithm. Thus all options of the General Fuse algorithm, such as parallel processing mode, fuzzy mode, safe processing mode, gluing mode and history support are also available in this algorithm.
Cells Builder is based on the General Fuse algorithm. Thus all options of the General Fuse algorithm (see @ref occt_algorithms_7_3a "GF Options") are also available in this algorithm.
The requirements for the input shapes are the same as for General Fuse - each argument should be valid in terms of *BRepCheck_Analyzer* and *BOPAlgo_ArgumentAnalyzer*.
@@ -2148,18 +2253,14 @@ 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
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*/
BOPAlgo_Glue aGlue = BOPAlgo_GlueOff; /* Glue option to speed up the intersection of arguments*/
//
// Set the arguments
TopTools_ListOfShape aLS = …; // arguments
aCBuilder.SetArguments(aLS);
aCBuilder.SetRunParallel(bRunParallel);
aCBuilder.SetFuzzyValue(aTol);
aCBuilder.SetNonDestructive(bSafeMode);
aCBuilder.SetGlue(aGlue);
//
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
aCBuilder.Perform(); // build splits of all arguments (GF)
if (aCBuilder.HasErrors()) { // check error status
return;
@@ -2169,8 +2270,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 +2819,63 @@ 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
~~~~
@subsection occt_algorithms_11a_5_obb Usage of Oriented Bounding Boxes
Since Oriented Bounding Boxes are usually much tighter than Axes Aligned Bounding Boxes (for more information on OBB please see the @ref occt_modat_6 "Bounding boxes" chapter of Modeling data User guide) its usage can significantly speed-up the intersection stage of the operation by reducing the number of interfering objects.
@subsubsection occt_algorithms_11a_5_obb_1 Usage
#### API level
To enable/disable the usage of OBB in the operation it is necessary to call the *SetUseOBB()* method with the approriate value:
~~~~
BOPAlgo_Builder aGF;
//
....
// Enabling the usage of OBB in the operation
aGF.SetUseOBB(Standard_True);
//
....
~~~~
#### TCL level
To enable/disable the usage of OBB in the operation in DRAW it is necessary to call the *buseobb* command with the approriate value:
* 0 - disabling the usage of OBB;
* 1 - enabling the usage of OBB.
~~~~
buseobb 1
~~~~
@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 +2929,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.
@@ -2813,41 +3124,18 @@ The following example illustrates how to use General Fuse operator:
#include <TopTools_ListOfShape.hxx>
#include <BRepAlgoAPI_BuilderAlgo.hxx>
{…
Standard_Boolean bRunParallel;
Standard_Real aFuzzyValue;
BRepAlgoAPI_BuilderAlgo aBuilder;
//
// prepare the arguments
TopTools_ListOfShape& aLS=…;
//
bRunParallel=Standard_True;
aFuzzyValue=2.1e-5;
//
// set the arguments
aBuilder.SetArguments(aLS);
// set parallel processing mode
// if bRunParallel= Standard_True : the parallel processing is switched on
// if bRunParallel= Standard_False : the parallel processing is switched off
aBuilder.SetRunParallel(bRunParallel);
//
// set Fuzzy value
// if aFuzzyValue=0.: the Fuzzy option is off
// if aFuzzyValue>0.: the Fuzzy option is on
aBuilder.SetFuzzyValue(aFuzzyValue);
//
// safe mode - avoid modification of the arguments
Standard_Boolean bSafeMode = Standard_True;
// if bSafeMode == Standard_True - the safe mode is switched on
// if bSafeMode == Standard_False - the safe mode is switched off
aBuilder.SetNonDestructive(bSafeMode);
//
// gluing options - for coinciding arguments
BOPAlgo_GlueEnum aGlueOpt = BOPAlgo_GlueFull;
// if aGlueOpt == BOPAlgo_GlueOff - the gluing mode is switched off
// if aGlueOpt == BOPAlgo_GlueShift - the gluing mode is switched on
// if aGlueOpt == BOPAlgo_GlueFull - the gluing mode is switched on
aBuilder.SetGlue(aGlueOpt);
//
// Set options for the algorithm
// setting options on this level is similar to setting options to GF algorithm on low level (see "GF Usage" chapter)
...
// run the algorithm
aBuilder.Build();
if (aBuilder.HasErrors()) {
@@ -2874,28 +3162,10 @@ bclearobjects; bcleartools;
#
# set the arguments
baddobjects b1 b2 b3
# set parallel processing mode
# 1: the parallel processing is switched on
# 0: the parallel processing is switched off
brunparallel 1
#
# set Fuzzy value
# 0. : the Fuzzy option is off
# >0. : the Fuzzy option is on
bfuzzyvalue 0.
#
# set safe processing mode
bnondestructive 1
# set safe mode
# 1 - the safe processing mode is switched on
# 0 - the safe processing mode is switched off
#
# set gluing mode
bglue 1
# set the gluing mode
# 1 or 2 - the gluing mode is switched on
# 0 - the gluing mode is switched off
#
# set options for the algorithm (see "GF Usage" chapter)
...
# run the algorithm
# r is the result of the operation
bapibuild r
@@ -2924,31 +3194,9 @@ TopTools_ListOfShape& aLSTools = … ;
aSplitter.SetArguments(aLSObjects);
aSplitter.SetTools(aLSTools);
//
// set options
// parallel processing mode
Standard_Boolean bRunParallel = Standard_True;
// bRunParallel == Standard_True - the parallel processing is switched on
// bRunParallel == Standard_False - the parallel processing is switched off
aSplitter.SetRunParallel();
//
// fuzzy value - additional tolerance for the operation
Standard_Real aFuzzyValue = 1.e-5;
// if aFuzzyValue == 0. - the Fuzzy option is off
// if aFuzzyValue > 0. - the Fuzzy option is on
aSplitter.SetFuzzyValue(aFuzzyValue);
//
// safe mode - avoid modification of the arguments
Standard_Boolean bSafeMode = Standard_True;
// if bSafeMode == Standard_True - the safe mode is switched on
// if bSafeMode == Standard_False - the safe mode is switched off
aSplitter.SetNonDestructive(bSafeMode);
//
// gluing options - for coinciding arguments
BOPAlgo_GlueEnum aGlueOpt = BOPAlgo_GlueFull;
// if aGlueOpt == BOPAlgo_GlueOff - the gluing mode is switched off
// if aGlueOpt == BOPAlgo_GlueShift - the gluing mode is switched on
// if aGlueOpt == BOPAlgo_GlueFull - the gluing mode is switched on
aSplitter.SetGlue(aGlueOpt);
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
//
// run the algorithm
aSplitter.Build();
@@ -2981,27 +3229,8 @@ baddobjects b1 b2
# set the tools
baddtools f
#
# set parallel processing mode
# 1: the parallel processing is switched on
# 0: the parallel processing is switched off
brunparallel 1
#
# set Fuzzy value
# 0. : the Fuzzy option is off
# >0. : the Fuzzy option is on
bfuzzyvalue 0.
#
# set safe processing mode
bnondestructive 1
# set safe mode
# 1 - the safe processing mode is switched on
# 0 - the safe processing mode is switched off
#
# set gluing mode
bglue 1
# set the gluing mode
# 1 or 2 - the gluing mode is switched on
# 0 - the gluing mode is switched off
# set options for the algorithm (see "GF Usage" chapter)
...
#
# run the algorithm
# r is the result of the operation
@@ -3034,28 +3263,9 @@ The following example illustrates how to use Common operation:
aBuilder.SetArguments(aLS);
aBuilder.SetTools(aLT);
//
// set parallel processing mode
// if bRunParallel= Standard_True : the parallel processing is switched on
// if bRunParallel= Standard_False : the parallel processing is switched off
aBuilder.SetRunParallel(bRunParallel);
//
// set Fuzzy value
// if aFuzzyValue=0.: the Fuzzy option is off
// if aFuzzyValue>0.: the Fuzzy option is on
aBuilder.SetFuzzyValue(aFuzzyValue);
//
// safe mode - avoid modification of the arguments
Standard_Boolean bSafeMode = Standard_True;
// if bSafeMode == Standard_True - the safe mode is switched on
// if bSafeMode == Standard_False - the safe mode is switched off
aBuilder.SetNonDestructive(bSafeMode);
//
// gluing options - for coinciding arguments
BOPAlgo_GlueEnum aGlueOpt = BOPAlgo_GlueFull;
// if aGlueOpt == BOPAlgo_GlueOff - the gluing mode is switched off
// if aGlueOpt == BOPAlgo_GlueShift - the gluing mode is switched on
// if aGlueOpt == BOPAlgo_GlueFull - the gluing mode is switched on
aBuilder.SetGlue(aGlueOpt);
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
//
// run the algorithm
aBuilder.Build();
@@ -3085,27 +3295,8 @@ bclearobjects; bcleartools;
baddobjects b1 b3
baddtools b2
#
# set parallel processing mode
# 1: the parallel processing is switched on
# 0: the parallel processing is switched off
brunparallel 1
#
# set Fuzzy value
# 0. : the Fuzzy option is off
# >0. : the Fuzzy option is on
bfuzzyvalue 0.
#
# set safe processing mode
bnondestructive 1
# set safe mode
# 1 - the safe processing mode is switched on
# 0 - the safe processing mode is switched off
#
# set gluing mode
bglue 1
# set the gluing mode
# 1 or 2 - the gluing mode is switched on
# 0 - the gluing mode is switched off
# set options for the algorithm (see "GF Usage" chapter)
...
#
# run the algorithm
# r is the result of the operation
@@ -3139,28 +3330,9 @@ The following example illustrates how to use Fuse operation:
aBuilder.SetArguments(aLS);
aBuilder.SetTools(aLT);
//
// set parallel processing mode
// if bRunParallel= Standard_True : the parallel processing is switched on
// if bRunParallel= Standard_False : the parallel processing is switched off
aBuilder.SetRunParallel(bRunParallel);
//
// set Fuzzy value
// if aFuzzyValue=0.: the Fuzzy option is off
// if aFuzzyValue>0.: the Fuzzy option is on
aBuilder.SetFuzzyValue(aFuzzyValue);
//
// safe mode - avoid modification of the arguments
Standard_Boolean bSafeMode = Standard_True;
// if bSafeMode == Standard_True - the safe mode is switched on
// if bSafeMode == Standard_False - the safe mode is switched off
aBuilder.SetNonDestructive(bSafeMode);
//
// gluing options - for coinciding arguments
BOPAlgo_GlueEnum aGlueOpt = BOPAlgo_GlueFull;
// if aGlueOpt == BOPAlgo_GlueOff - the gluing mode is switched off
// if aGlueOpt == BOPAlgo_GlueShift - the gluing mode is switched on
// if aGlueOpt == BOPAlgo_GlueFull - the gluing mode is switched on
aBuilder.SetGlue(aGlueOpt);
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
//
// run the algorithm
aBuilder.Build();
@@ -3190,27 +3362,8 @@ bclearobjects; bcleartools;
baddobjects b1 b3
baddtools b2
#
# set parallel processing mode
# 1: the parallel processing is switched on
# 0: the parallel processing is switched off
brunparallel 1
#
# set Fuzzy value
# 0. : the Fuzzy option is off
# >0. : the Fuzzy option is on
bfuzzyvalue 0.
#
# set safe processing mode
bnondestructive 1
# set safe mode
# 1 - the safe processing mode is switched on
# 0 - the safe processing mode is switched off
#
# set gluing mode
bglue 1
# set the gluing mode
# 1 or 2 - the gluing mode is switched on
# 0 - the gluing mode is switched off
# set options for the algorithm (see "GF Usage" chapter)
...
#
# run the algorithm
# r is the result of the operation
@@ -3244,28 +3397,9 @@ The following example illustrates how to use Cut operation:
aBuilder.SetArguments(aLS);
aBuilder.SetTools(aLT);
//
// set parallel processing mode
// if bRunParallel= Standard_True : the parallel processing is switched on
// if bRunParallel= Standard_False : the parallel processing is switched off
aBuilder.SetRunParallel(bRunParallel);
//
// set Fuzzy value
// if aFuzzyValue=0.: the Fuzzy option is off
// if aFuzzyValue>0.: the Fuzzy option is on
aBuilder.SetFuzzyValue(aFuzzyValue);
//
// safe mode - avoid modification of the arguments
Standard_Boolean bSafeMode = Standard_True;
// if bSafeMode == Standard_True - the safe mode is switched on
// if bSafeMode == Standard_False - the safe mode is switched off
aBuilder.SetNonDestructive(bSafeMode);
//
// gluing options - for coinciding arguments
BOPAlgo_GlueEnum aGlueOpt = BOPAlgo_GlueFull;
// if aGlueOpt == BOPAlgo_GlueOff - the gluing mode is switched off
// if aGlueOpt == BOPAlgo_GlueShift - the gluing mode is switched on
// if aGlueOpt == BOPAlgo_GlueFull - the gluing mode is switched on
aBuilder.SetGlue(aGlueOpt);
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
//
// run the algorithm
aBuilder.Build();
@@ -3295,27 +3429,8 @@ bclearobjects; bcleartools;
baddobjects b1 b3
baddtools b2
#
# set parallel processing mode
# 1: the parallel processing is switched on
# 0: the parallel processing is switched off
brunparallel 1
#
# set Fuzzy value
# 0. : the Fuzzy option is off
# >0. : the Fuzzy option is on
bfuzzyvalue 0.
#
# set safe processing mode
bnondestructive 1
# set safe mode
# 1 - the safe processing mode is switched on
# 0 - the safe processing mode is switched off
# set gluing mode
#
bglue 1
# set the gluing mode
# 1 or 2 - the gluing mode is switched on
# 0 - the gluing mode is switched off
# set options for the algorithm (see "GF Usage" chapter)
...
#
# run the algorithm
# r is the result of the operation
@@ -3350,28 +3465,9 @@ The following example illustrates how to use Section operation:
aBuilder.SetArguments(aLS);
aBuilder.SetTools(aLT);
//
// set parallel processing mode
// if bRunParallel= Standard_True : the parallel processing is switched on
// if bRunParallel= Standard_False : the parallel processing is switched off
aBuilder.SetRunParallel(bRunParallel);
//
// set Fuzzy value
// if aFuzzyValue=0.: the Fuzzy option is off
// if aFuzzyValue>0.: the Fuzzy option is on
aBuilder.SetFuzzyValue(aFuzzyValue);
//
// safe mode - avoid modification of the arguments
Standard_Boolean bSafeMode = Standard_True;
// if bSafeMode == Standard_True - the safe mode is switched on
// if bSafeMode == Standard_False - the safe mode is switched off
aBuilder.SetNonDestructive(bSafeMode);
//
// gluing options - for coinciding arguments
BOPAlgo_GlueEnum aGlueOpt = BOPAlgo_GlueFull;
// if aGlueOpt == BOPAlgo_GlueOff - the gluing mode is switched off
// if aGlueOpt == BOPAlgo_GlueShift - the gluing mode is switched on
// if aGlueOpt == BOPAlgo_GlueFull - the gluing mode is switched on
aBuilder.SetGlue(aGlueOpt);
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
//
// run the algorithm
aBuilder.Build();
@@ -3401,27 +3497,8 @@ bclearobjects; bcleartools;
baddobjects b1 b3
baddtools b2
#
# set parallel processing mode
# 1: the parallel processing is switched on
# 0: the parallel processing is switched off
brunparallel 1
#
# set Fuzzy value
# 0. : the Fuzzy option is off
# >0. : the Fuzzy option is on
bfuzzyvalue 0.
#
# set safe processing mode
bnondestructive 1
# set safe mode
# 1 - the safe processing mode is switched on
# 0 - the safe processing mode is switched off
#
# set gluing mode
bglue 1
# set the gluing mode
# 1 or 2 - the gluing mode is switched on
# 0 - the gluing mode is switched off
# set options for the algorithm (see "GF Usage" chapter)
...
#
# run the algorithm
# r is the result of the operation

View File

@@ -5529,6 +5529,7 @@ surface_radius c pi 3 c1 c2
* **intersect** computes intersections of surfaces;
* **2dintersect** computes intersections of 2d curves.
* **intconcon** computes intersections of 2d conic curves.
@subsubsection occt_draw_6_7_1 intersect
@@ -5547,21 +5548,43 @@ plane p 0 0 40 0 1 5
intersect e c p
~~~~~
@subsubsection occt_draw_6_7_2 dintersect
@subsubsection occt_draw_6_7_2 2dintersect
Syntax:
~~~~~
2dintersect curve1 curve2
2dintersect curve1 [curve2] [-tol tol] [-state]
~~~~~
Displays the intersection points between two 2d curves.
Displays the intersection points between 2d curves.
Options:
-tol - allows changing the intersection tolerance (default value is 1.e-3);
-state - allows printing the intersection state for each point.
**Example:**
~~~~~
# intersect two 2d ellipses
ellipse e1 0 0 5 2
ellipse e2 0 0 0 1 5 2
2dintersect e1 e2
2dintersect e1 e2 -tol 1.e-10 -state
~~~~~
@subsubsection occt_draw_6_7_3 intconcon
Syntax:
~~~~~
intconcon curve1 curve2
~~~~~
Displays the intersection points between two 2d curves.
Curves must be only conic sections: 2d lines, circles, ellipses,
hyperbolas, parabolas. Algorithm from IntAna2d_AnaIntersection is used.
**Example:**
~~~~~
# intersect two 2d ellipses
ellipse e1 0 0 5 2
ellipse e2 0 0 0 1 5 2
intconcon e1 e2
~~~~~
@subsection occt_draw_6_8 Approximations
@@ -7304,8 +7327,9 @@ buildevol
Analysis of shapes includes commands to compute length, area, volumes and inertial properties, as well as to compute some aspects impacting shape validity.
* Use **lprops**, **sprops**, **vprops** to compute integral properties.
* Use **bounding** to display the bounding box of a shape.
* Use **bounding** to compute and to display the bounding box of a shape.
* Use **distmini** to calculate the minimum distance between two shapes.
* Use **isbbinterf** to check if the two shapes are interfered by their bounding boxes.
* Use **xdistef**, **xdistcs**, **xdistcc**, **xdistc2dc2dss**, **xdistcc2ds** to check the distance between two objects on even grid.
* Use **checkshape** to check validity of the shape.
* Use **tolsphere** to see the tolerance spheres of all vertices in the shape.
@@ -7358,20 +7382,135 @@ I.Z = 314159.265357595
Syntax:
~~~~~
bounding shape
bounding {-s shape | -c xmin ymin zmin xmax ymax zmax} [-obb] [-shape name] [-dump] [-notriangulation] [-perfmeter name NbIters] [-save xmin ymin zmin xmax ymax zmax] [-nodraw] [-optimal] [-exttoler]
~~~~~
Displays the bounding box of a shape. The bounding box is a cuboid created with faces parallel to the x, y, and z planes. The command returns the dimension values of the the box, *xmin ymin zmin xmax ymax zmax.*
Computes and displays the bounding box (BndBox) of a shape. The bounding box is a cuboid circumscribes the source shape.
Generaly, bounding boxes can be divided on two main types:
- axis-aligned BndBox (AABB). I.e. the box whose edges are parallel to the some axis of World Coordinate System (WCS);
- oriented BndBox (OBB). I.e. not AABB.
**Example:**
Detailed information about this command is availabe in DRAW help-system (enter "help bounding" in DRAW-application).
**Example 1: Creation of AABB with given corners**
~~~~~
# bounding box of a torus
bounding -c 50 100 30 180 200 100 -shape result
# look at the box
vdisplay result
vfit
vsetdispmode 1
~~~~~
**Example 2: Compare AABB and OBB**
~~~~~
# Create a torus and rotate it
ptorus t 20 5
bounding t
==-27.059805107309852 -27.059805107309852 -
5.0000001000000003
==27.059805107309852 27.059805107309852
5.0000001000000003
trotate t 5 10 15 1 1 1 28
# Create AABB from the torus
bounding -s t -shape ra -dump -save x1 y1 z1 x2 y2 z2
==Axes-aligned bounding box
==X-range: -26.888704600189307 23.007685197265488
==Y-range: -22.237699567214314 27.658690230240481
==Z-range: -13.813966507560762 12.273995247458407
# Obtain the boundaries
dump x1 y1 z1 x2 y2 z2
==*********** Dump of x1 *************
==-26.8887046001893
==*********** Dump of y1 *************
==-22.2376995672143
==*********** Dump of z1 *************
==-13.8139665075608
==*********** Dump of x2 *************
==23.0076851972655
==*********** Dump of y2 *************
==27.6586902302405
==*********** Dump of z2 *************
==12.2739952474584
# Compute the volume of AABB
vprops ra 1.0e-12
==Mass : 64949.9
# Let us check this value
dval (x2-x1)*(y2-y1)*(z2-z1)
==64949.886543606823
~~~~~
The same result is obtained.
~~~~~
# Create OBB from the torus
bounding -s t -shape ro -dump -obb
==Oriented bounding box
==Center: -1.9405097014619073 2.7104953315130857 -0.76998563005117782
==X-axis: 0.31006700219833244 -0.23203206410428409 0.9219650619059514
==Y-axis: 0.098302309139513336 -0.95673739537318336 -0.27384340837854165
==Z-axis: 0.94561890324040099 0.17554109923901748 -0.27384340837854493
==Half X: 5.0000002000000077
==Half Y: 26.783728747002169
==Half Z: 26.783728747002165
# Compute the volume of OBB
vprops ro 1.0e-12
==Mass : 28694.7
~~~~~
As we can see, the volume of OBB is significantly less than the volume of AABB.
@subsubsection occt_draw_7_9_2a isbbinterf
Syntax:
~~~~~
isbbinterf shape1 shape2 [-o]
~~~~~
Checks whether the bounding-boxes created from the given shapes are interfered. If "-o"-option is switched on then the oriented boxes will be checked. Otherwise, axes-aligned boxes will be checked.
**Example 1: Not interfered AABB**
~~~~~
box b1 100 60 140 20 10 80
box b2 210 200 80 120 60 90
isbbinterf b1 b2
==The shapes are NOT interfered by AABB.
~~~~~
**Example 2: Interfered AABB**
~~~~~
box b1 300 300 300
box b2 100 100 100 50 50 50
isbbinterf b1 b2
==The shapes are interfered by AABB.
~~~~~
**Example 3: Not interfered OBB**
~~~~~
box b1 100 150 200
copy b1 b2
trotate b1 -150 -150 -150 1 2 3 -40
trotate b2 -150 -150 -150 1 5 2 60
# Check of interference
isbbinterf b1 b2 -o
==The shapes are NOT interfered by OBB.
~~~~~
**Example 4: Interfered OBB**
~~~~~
box b1 100 150 200
copy b1 b2
trotate b1 -50 -50 -50 1 1 1 -40
trotate b2 -50 -50 -50 1 1 1 60
# Check of interference
isbbinterf b1 b2 -o
==The shapes are interfered by OBB.
~~~~~
@subsubsection occt_draw_7_9_3 distmini

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 KiB

View File

@@ -1294,3 +1294,99 @@ The following sample code reads a shape from ASCII file and writes it to a binar
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@section occt_modat_6 Bounding boxes
*Bounding box(es) (BndBox(es))* is used in many OCCT algorithms. In general, it is some filter to avoid check of excess interferences between pairs of shapes (check of interferences between BndBoxes is much simpler then between shapes and if BndBoxes do not interfere then there is no point in searching interferences between the corresponding shapes).
Generally, BndBoxes can be divided on two main types:
- axis-aligned BndBox (AABB). I.e. the box whose edges are parallel to the axes of World Coordinate System (WCS);
- oriented BndBox (OBB). I.e. not AABB.
In fact, every AABB is a specific case of OBB.<br>
The image below illustrates the example, when using OBB is better than AABB.
@figure{/user_guides/modeling_data/images/modeling_data_image015.png,"Illustrating the problem with AABB.",320}
AABBs in this picture are interfered. Therefore, many OCCT-algorithms will spend much time to interfere the shapes. However, if we check OBBs, which are not interfered, then searching of interferences between the shapes will not be necessary. At that, creation and analysis of OBBs takes significantly more time than the analogical operations with AABB.
Later in this section, the BndBox having the smallest surface area will be called as <b> optimal </b>.
In OCCT, BndBox(es) are described in Bnd package. In general, Bnd_Box class describes AABB, Bnd_OBB class describes OBB. These classes contain the following common methods (this list is not complete; please see the documentation about corresponding class for detailed information):
- SetVoid() and IsVoid(). SetVoid method clears the existing BndBox. IsVoid method indicates whether the BndBox is initialized.
- Enlarge(...). Extends the current BndBox.
- Add(...). Rebuilds the current BndBox in order to cover all previous objects (which it was created from) and the argument of the method.
- IsOut(...). Checks whether the argument is inside/outside of the current BndBox.
Also, BRepBndLib class contains methods to provide creation of BndBox (both AABB and OBB) from the complex shape.
@subsection occt_modat_6_1 Brief description of some algorithms working with OBB
@subsubsection occt_modat_6_1_1 Creation of OBB from set of points
The algorithm is described in <a href="http://www.idt.mdh.se/~tla/publ/FastOBBs.pdf">"Fast Computation of Tight Fitting Oriented Bounding Boxes" by Thomas Larsson and Linus Källberg</a>. It includes the following steps:
<span>1.</span> Choose \f$ N_{a} (N_{a} \geq 3) \f$ initial axes.<br>
<span>2.</span> Project every given point to the every chosen (in item 1) axis. At that, "minimal" and "maximal" points of every axis (i.e. point having minimal and maximal parameter (correspondingly) of the projection to this axis) are chosen. I.e. \f$ 2*N_{a} \f$ points will be held and this set can contain equal points. Later (unless otherwise specified) in this algorithm we will work with these \f$ 2*N_{a} \f$ points only.<br>
<span>3.</span> Choose one pair of points among all pairs of "minimal" and "maximal" points of every axis (from item 1), with two furthest points. Let \f$ p_{0} \f$ and \f$ p_{1} \f$ be the "minimal" and "maximal" point of this pair.<br>
<span>4.</span> Create an axis \f$ \mathbf{e_{0}}\left \{ \overrightarrow{p_{0}p_{1}} \right \} \f$ (i.e. having direction \f$ \overrightarrow{p_{0}p_{1}} \f$ ).<br>
<span>5.</span> Choose the point \f$ p_{2} \f$ (from the set defined in item 2) which is in the maximal distance from the infinite line directed along \f$ \mathbf{e_{0}} \f$ axis.<br>
Further, let us consider the triangle \f$ T_{0}\left \langle p_{0}, p_{1}, p_{2} \right \rangle \f$ (i.e. having vertices \f$ p_{0}, p_{1} \f$ and \f$ p_{2} \f$). Namely:
<span>6.</span> Create new axes: \f$ \mathbf{e_{1}}\left \{ \overrightarrow{p_{1}p_{2}} \right \} \f$, \f$ \mathbf{e_{2}}\left \{ \overrightarrow{p_{2}p_{0}} \right \} \f$, \f$ \mathbf{n}\left \{ \overrightarrow{\mathbf{e_{0}}} \times \overrightarrow{\mathbf{e_{1}}} \right \} \f$, \f$ \mathbf{m_{0}}\left \{ \overrightarrow{\mathbf{e_{0}}} \times \overrightarrow{\mathbf{n}} \right \} \f$, \f$ \mathbf{m_{1}}\left \{ \overrightarrow{\mathbf{e_{1}}} \times \overrightarrow{\mathbf{n}} \right \} \f$, \f$ \mathbf{m_{2}}\left \{ \overrightarrow{\mathbf{e_{2}}} \times \overrightarrow{\mathbf{n}} \right \} \f$.<br>
<span>7.</span> Create OBBs based on the following axis: \f$ \left \{ \mathbf{e_{0}} \vdots \mathbf{m_{0}} \vdots \mathbf{n} \right \} \f$, \f$ \left \{ \mathbf{e_{1}} \vdots \mathbf{m_{1}} \vdots \mathbf{n} \right \} \f$ and \f$ \left \{ \mathbf{e_{2}} \vdots \mathbf{m_{2}} \vdots \mathbf{n} \right \} \f$ . Choose optimal OBB.<br>
<span>8.</span> Choose the points \f$ q_{0} \f$ and \f$ q_{1} \f$ (from the set defined in item 2), which are in maximal distance from the plane of the triangle \f$ T_{0} \f$ (from both sides of this plane). At that, \f$ q_{0} \f$ has minimal coordinate along the axis \f$ \mathbf{n} \f$, \f$ q_{1} \f$ has a maximal coordinate.<br>
<span>9.</span> Repeat the step 6...7 for the triangles \f$ T_{1}\left \langle p_{0}, p_{1}, q_{0} \right \rangle \f$, \f$ T_{2}\left \langle p_{1}, p_{2}, q_{0} \right \rangle \f$, \f$ T_{3}\left \langle p_{0}, p_{2}, q_{0} \right \rangle \f$, \f$ T_{4}\left \langle p_{0}, p_{1}, q_{1} \right \rangle \f$, \f$ T_{5}\left \langle p_{1}, p_{2}, q_{1} \right \rangle \f$, \f$ T_{6}\left \langle p_{0}, p_{2}, q_{1} \right \rangle \f$.<br>
<span>10.</span> Compute the center of OBB and its half dimensions.<br>
<span>11.</span> Create OBB using the center, axes and half dimensions.<br>
This algorithm is realized in Bnd_OBB::ReBuild(...) method.
@subsubsection occt_modat_6_1_2 Creation of OBB based on Axes of inertia
The algorithm contains the following steps:
1. Calculate three inertia axes, which will be the axes of the OBB.
2. Transform the source object (TopoDS_Shape) into the local coordinate system based on the axes from item 1.
3. Create an AABB for the shape obtained in the item 2.
4. Compute the center of AABB and its half dimensions
5. Transform the center into the WCS
6. Create OBB using the center, axes and half dimensions.
@subsubsection occt_modat_6_1_3 Method IsOut for a point
1. Project the point to each axis.
2. Check, whether the absolute value of the projection parameter greater than the correspond half-dimension. In this case, IsOut method will return TRUE.
@subsubsection occt_modat_6_1_4 Method IsOut for another OBB
According to the <a href="http://www.jkh.me/files/tutorials/Separating%20Axis%20Theorem%20for%20Oriented%20Bounding%20Boxes.pdf">"Separating Axis Theorem for Oriented Bounding Boxes"</a>, it is necessary to check the 15 separating axes: 6 axes of the boxes and 9 are their cross products.<br>
The algorithm of analyzing axis \f$ \mathbf{l} \f$ is following:
1. Compute the "length" according to the formula: \f$ L_{j}=\sum_{i=0}^{2}{H_{i}\cdot \left | \overrightarrow{\mathbf{a_{i}}} \cdot \overrightarrow{\mathbf{l}} \right |} \f$. Here, \f$ \mathbf{a_{i}} \f$ is an i-th axis (X-axis, Y-axis, Z-axis) of j-th BndBox (j=1...2). \f$ H_{i} \f$ is a half-dimension along i-th axis.
2. If \f$ \left |\overrightarrow{C_{1}C_{2}} \cdot \overrightarrow{\mathbf{l}} \right | > L_{1}+L_{2} \f$ (where \f$ C_{j} \f$ is the center of j-th OBB) then the considered OBBs are not interfered in terms of the axis \f$ \mathbf{l} \f$.
If OBBs are not interfered in terms of at least one axis (of 15) then they are not interfered at all.
@subsubsection occt_modat_6_1_5 Method Add for point or another BndBox
Create new OBB (see the section @ref occt_modat_6_1_1) based on the source point and all vertices of the given BndBoxes.
@subsection occt_modat_6_2 Add a shape
Method BRepBndLib::AddOBB(...) allows creating BndBox from the complex object (TopoDS_Shape). This method uses both algorithms described in the sections @ref occt_modat_6_1_1 and sections @ref occt_modat_6_1_2.
The first algorithm is used if the shape outer shell can be represented by a set of points contained in the shape. Namely, only the following elements are the source of set of points:
- Nodes of triangulation;
- Nodes of Poly_Polygon3D;
- Vertices of edges with linear 3D-curve lying in the planar face;
- Vertices of edges with linear 3D-curve if the source shape does not contain more complex topological structure (e.g. the source shape is a compound of edges);
- Vertices if the source shape does not contain more complex topological structure (e.g. the source shape is a compound of vertices).
If required set of points cannot be extracted then the algorithm from section @ref occt_modat_6_1_2 is used for OBB creation.
The package BRepBndLib contains the methods BRepBndLib::Add(...), BRepBndLib::AddClose(...) and BRepBndLib::AddOptimal(...) for creation of AABB of a shape. Please see reference manual for detailed information.
@subsection occt_modat_6_3 Limitations of algorithm for OBB creation.
1. The algorithm described in the section @ref occt_modat_6_1_1 works significantly better (finds resulting OBB with less surface area) and faster than the algorithm from the section @ref occt_modat_6_1_2. Nevertheless, (in general) the result returned by both algorithms is not always optimal (i.e. sometimes another OBB exists having less surface area). Moreover, the first method does not allow computing OBB of shapes with complex geometry.
2. Currently, the algorithm of OBB creation is implemented for objects in 3D-space only.

View File

@@ -91,18 +91,18 @@ XDE can read and write colors and layers assigned to shapes or their subparts (d
@figure{/user_guides/xde/images/xde_image006.png,"Colors and Layers",240}
@subsection occt_xde_1_7 Geometric Dimensions & Tolerances (GD&T)
@subsection occt_xde_1_7 Geometric Dimensions & Tolerances (GD\&T)
GD&T are a type of Product and Manufacturing Information (PMI) that can be either computed automatically by a CAD system,
GD\&T are a type of Product and Manufacturing Information (PMI) that can be either computed automatically by a CAD system,
or entered manually by the user. For detailed information use <a href="https://www.cax-if.org/documents/rec_pracs_pmi_v40.pdf">CAx-IF Recommended Practices
for the Representation and Presentation of Product Manufacturing Information (PMI) (AP242)</a>
XDE can read and write GD&T data of the following types:
XDE can read and write GD\&T data of the following types:
* dimensions, such as distance, length, radius and so on;
* geometric tolerances;
* datums, i.e a theoretically exact geometric references, such as point, line or plane, to which toleranced features are related.
XDE supports two presentations of GD&T data:
XDE supports two presentations of GD\&T data:
* semantic presentation, i.e. data is stored in a machine-consumable way and includes all information required to understand the
specification without the aid of any presentation elements;
* tessellated presentation, i.e. data is displayed in a human-readable way.
@@ -660,42 +660,42 @@ To remove a Color and all the references to it (so that the related shapes will
myColors->RemoveColor(ColLabel);
~~~~~
@subsection occt_xde_2_7 Geometric Dimensions & Tolerances (GD&T)
@subsection occt_xde_2_7 Geometric Dimensions & Tolerances (GD\&T)
XDE can read and write GD&T assigned to shapes or their subparts (down to the level of faces and edges) to and from STEP formats.
XDE can read and write GD\&T assigned to shapes or their subparts (down to the level of faces and edges) to and from STEP formats.
In an XDE document, GD&T are managed by the class *XCAFDoc_DimTolTool*. It works basing on the same principles as ShapeTool works with Shapes. This tool can be provided on the Main Label or on any sub-label. The GD&T entities themselves are defined as the following sub-classes of *TDF_Attribute*:
In an XDE document, GD\&T are managed by the class *XCAFDoc_DimTolTool*. It works basing on the same principles as ShapeTool works with Shapes. This tool can be provided on the Main Label or on any sub-label. The GD\&T entities themselves are defined as the following sub-classes of *TDF_Attribute*:
* *XCAFDoc_Dimension* - for dimensions;
* *XCAFDoc_GeomTolerance* - for geometric tolerances;
* *XCAFDoc_Datum* - for geometric tolerance Datums.
A GD&T type is identified by the attributes listed above, i.e. *XCAFDoc_DimTolTool* methods working with particular entity types check
A GD\&T type is identified by the attributes listed above, i.e. *XCAFDoc_DimTolTool* methods working with particular entity types check
for presence of the corresponding attributes in passed labels. One can use methods of *XCAFDoc_DimTolTool* beginning with 'Is' for this purpose.
GD&T entities are stored in a child of the starting document label 0.1.4.
Each GD&T entity then corresponds to the dedicated label, the property itself is one of access classes:
GD\&T entities are stored in a child of the starting document label 0.1.4.
Each GD\&T entity then corresponds to the dedicated label, the property itself is one of access classes:
* *XCAFDimTolObject_DimensionObject* - for dimensions;
* *XCAFDimTolObject_GeomToleranceObject* - for geometric tolerances;
* *XCAFDimTolObject_DatumObject* - for geometric tolerance Datums.
GD&Ts and Shapes are related to by Graph Nodes.
GD\&Ts and Shapes are related to by Graph Nodes.
These definitions are common to various exchange formats, at least for STEP.
@subsubsection occt_xde_2_7_1 Initialization
To query, edit, or initialize a Document to handle GD&Ts of XCAF, use:
To query, edit, or initialize a Document to handle GD\&Ts of XCAF, use:
~~~~~
Handle(XCAFDoc_DimTolTool) myDimTolTool =
XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
~~~~~
This call can be used at any time. When it is used for the first time, a relevant structure is added to the document. This definition is used for all later GD&T calls and is not repeated for them.
This call can be used at any time. When it is used for the first time, a relevant structure is added to the document. This definition is used for all later GD\&T calls and is not repeated for them.
@subsubsection occt_xde_2_7_2 Adding a GD&T
*XCAFDoc_DimTolTool* provides methods to create GD&T 'empty' entities:
@subsubsection occt_xde_2_7_2 Adding a GD\&T
*XCAFDoc_DimTolTool* provides methods to create GD\&T 'empty' entities:
* *AddDimension* - for a new dimension;
* *AddGeomTolerance* - for a new geometric tolerance;
* *AddDatum* - for a new geometric tolerance datum.
All methods create a sub-label for the corresponding GD&T entity of the tool master label and attach an attribute specific for the
All methods create a sub-label for the corresponding GD\&T entity of the tool master label and attach an attribute specific for the
created entity.
Here is an example of adding a new dimension:
@@ -706,10 +706,10 @@ if (!aDimLabel.IsNull())
// error processing
}
~~~~~
A similar approach can be used for other GD&T types.
A similar approach can be used for other GD\&T types.
@subsubsection occt_xde_2_7_3 Editing a GD&T
A newly added GD&T entity is empty. To set its data a corresponding access object should be used as it is demonstrated
@subsubsection occt_xde_2_7_3 Editing a GD\&T
A newly added GD\&T entity is empty. To set its data a corresponding access object should be used as it is demonstrated
below, where the dimension becomes the linear distance between two points.
~~~~~
Handle(XCAFDoc_Dimension) aDimAttr;
@@ -726,10 +726,10 @@ if (!aDimAttr.IsNull())
aDimAttr->SetObject(aDimObject);
}
~~~~~
A similar approach can be used for other GD&T types.
A similar approach can be used for other GD\&T types.
@subsubsection occt_xde_2_7_4 Linking GD&Ts
To link a GD&T entity with other OCAF labels (e.g. representing shapes) one should use the following methods:
@subsubsection occt_xde_2_7_4 Linking GD\&Ts
To link a GD\&T entity with other OCAF labels (e.g. representing shapes) one should use the following methods:
* *SetDimension* - for dimensions;
* *SetGeomTolerance* - for geometric tolerances;
* SetDatum - for geometric tolerance datums.
@@ -748,20 +748,20 @@ aDGTTool->SetDimension(aShapes1, aShapes2, aDimLabel);
In addition, a special method *SetDatumToGeomTol* should be used to link a datum with a geometric tolerance.
@subsubsection occt_xde_2_7_5 Finding GD&Ts and reference shapes
@subsubsection occt_xde_2_7_5 Finding GD\&Ts and reference shapes
*XCAFDimTolObjects_Tool* class provides basic capabilities for searching GD&Ts linked to shapes.
*XCAFDimTolObjects_Tool* class provides basic capabilities for searching GD\&Ts linked to shapes.
Using the tool one can get sequences of dimensions, geometric tolerances and datums linked with a shape. A series of related datums is also returned for geometric tolerances.
To get reference shapes for a GD&T entity one can use *GetRefShapeLabel* from *XCAFDoc_DimTolTool*.
To get reference shapes for a GD\&T entity one can use *GetRefShapeLabel* from *XCAFDoc_DimTolTool*.
*XCAFDoc_DimTolTool* provides methods to get lists of all dimensions, geometric tolerances and datums.
@subsubsection occt_xde_2_7_6 Storing custom data
Every GD&T entity in XDE is represented as a label with attached attribute identifying entity type. All specific data is
Every GD\&T entity in XDE is represented as a label with attached attribute identifying entity type. All specific data is
stored in sub-labels in standard OCAF attributes, such as *TDataStd_Integer*, *TDataStd_IntegerArray*, *TDataStd_RealArray* and so on.
Sub-label tags are reserved for internal use and cannot be used for storing custom data. The following tag ranges are reserved for
GD&T entities:
GD\&T entities:
* 1 - 17 - for dimensions;
* 1 - 17 - for geometric tolerances;
* 1 - 19 - for datums.
@@ -834,7 +834,7 @@ for (TDF_LabelSequence::Iterator anIt(aClipPlaneLbls); anIt.More(); anIt.Next())
@subsection occt_xde_2_9 Saved views
In an XDE document, Views are managed by the class *XCAFDoc_ViewTool*. It works basing on the same principles as ShapeTool works with Shapes. This tool can be provided on the Main Label or on any sub-label. Views are stored in a child of the starting document label 0.1.7, where a view itself is defined as *XCAFDoc_View* sub-class of *TDF_Attribute*. Views and selected shapes, clipping planes, GD&Ts and notes are related to by Graph Nodes.
In an XDE document, Views are managed by the class *XCAFDoc_ViewTool*. It works basing on the same principles as ShapeTool works with Shapes. This tool can be provided on the Main Label or on any sub-label. Views are stored in a child of the starting document label 0.1.7, where a view itself is defined as *XCAFDoc_View* sub-class of *TDF_Attribute*. Views and selected shapes, clipping planes, GD\&Ts and notes are related to by Graph Nodes.
To query, edit, or initialize a Document to handle views of XCAF, use:
~~~~~
@@ -864,7 +864,7 @@ if (!aViewAttr.IsNull())
}
~~~~~
To set shapes, clipping planes, GD&Ts and notes selected for the view use one of overloaded *SetView* methods of *XCAFDoc_ViewTool*.
To set shapes, clipping planes, GD\&Ts and notes selected for the view use one of overloaded *SetView* methods of *XCAFDoc_ViewTool*.
To set only clipping planes one should use *SetClippingPlanes* method.
~~~~~
TDF_LabelSequence aShapes; ...
@@ -891,23 +891,26 @@ for (TDF_LabelSequence::Iterator anIt(aViewLbls); anIt.More(); anIt.Next())
}
~~~~~
To get shapes, clipping planes, GD&Ts or notes associated with a particular view use the following methods:
To get shapes, clipping planes, GD\&Ts or notes associated with a particular view use the following methods:
* *GetRefShapeLabel* - returns a sequence of associated shape labels;
* *GetRefGDTLabel* - returns a sequence of associated GDT labels;
* *GetRefClippingPlaneLabel* - returns a sequence of associated clipping plane labels;
* *GetRefNoteLabel* - returns a sequence of associated note labels;
* *GetRefAnnotationLabel* - returns a sequence of associated annotated labels.
And vice versa, to get views that display a particular clipping plane, GD&T or note use the following methods:
And vice versa, to get views that display a particular clipping plane, GD\&T or note use the following methods:
* *GetViewLabelsForShape* - returns a sequence of associated view labels for a shape;
* *GetViewLabelsForGDT* - returns a sequence of associated view labels for a GD&T;
* *GetViewLabelsForGDT* - returns a sequence of associated view labels for a GD\&T;
* *GetViewLabelsForClippingPlane* - returns a sequence of associated view labels for a clipping plane;
* *GetViewLabelsForNote* - returns a sequence of associated view labels for a note;
* *GetViewLabelsForAnnotation* - returns a sequence of associated view labels for an annotated label.
@subsection occt_xde_2_10 Custom notes
In an XDE document, custom notes are managed by the class *XCAFDoc_NotesTool*. It works basing on the same principles as ShapeTool works with Shapes. This tool can be provided on the Main Label or on any sub-label. The Property itself is defined as sub-class of *XCAFDoc_Note* abstract class, which is a sub-class of *TDF_Attribute* one.
In an XDE document, custom notes are managed by the class *XCAFDoc_NotesTool*.
It works basing on the same principles as ShapeTool works with Shapes.
This tool can be provided on the Main Label or on any sub-label.
The Property itself is defined as sub-class of *XCAFDoc_Note* abstract class, which is a sub-class of *TDF_Attribute* one.
Custom notes are stored in a child of the *XCAFDoc_NotesTool* label, at label 0.1.9.1. Each note then corresponds to a dedicated label. A note may be attached to a document item identified by a label, a sub-shape identified by integer index or an attribute identified by GUID. Annotations are stored in a child of the *XCAFDoc_NotesTool* label, at label 0.1.9.2.
Notes binding is done through *XCAFDoc_GraphNode* attribute.
@@ -1042,7 +1045,7 @@ The same can be said for Viewing: presentations can be defined from Shapes and C
There are several important points to consider:
* Previously defined Readers and Writers for dealing with Shapes only, whether Standard or Advanced, remain unchanged in their form and in their dependencies. In addition, functions other than mapping are also unchanged.
* XDE provides mapping with data other than Shapes. Names, Colors, Layers, GD&T, Clipping planes, Views, Validation Properties (Centroid, Volume, Area), and Assembly Structure are hierarchic with rigid motion. Currently, Clipping planes and Views writing supported for XBF format only.
* XDE provides mapping with data other than Shapes. Names, Colors, Layers, GD\&T, Clipping planes, Views, Validation Properties (Centroid, Volume, Area), and Assembly Structure are hierarchic with rigid motion. Currently, Clipping planes and Views writing supported for XBF format only.
* XDE mapping is relevant for use within the Advanced level of Data Exchanges, rather than Standard ones, because a higher level of information is better suited to a higher quality of shapes. In addition, this allows to avoid the multiplicity of combinations between various options. Note that this choice is not one of architecture but of practical usage and packaging.
* Reader and Writer classes for XDE are generally used like those for Shapes. However, their use is adapted to manage a Document rather than a Shape.

View File

@@ -32,6 +32,8 @@
//wrapper of pure C++ classes to ref classes
#include <NCollection_Haft.h>
#include <vcclr.h>
// list of required OCCT libraries
#pragma comment(lib, "TKernel.lib")
#pragma comment(lib, "TKMath.lib")
@@ -45,6 +47,24 @@
#pragma comment(lib, "TKStl.lib")
#pragma comment(lib, "TKVrml.lib")
//! Auxiliary tool for converting C# string into UTF-8 string.
static TCollection_AsciiString toAsciiString (String^ theString)
{
if (theString == nullptr)
{
return TCollection_AsciiString();
}
pin_ptr<const wchar_t> aPinChars = PtrToStringChars (theString);
const wchar_t* aWCharPtr = aPinChars;
if (aWCharPtr == NULL
|| *aWCharPtr == L'\0')
{
return TCollection_AsciiString();
}
return TCollection_AsciiString (aWCharPtr);
}
/// <summary>
/// Proxy class encapsulating calls to OCCT C++ classes within
/// C++/CLI class visible from .Net (CSharp)
@@ -93,14 +113,14 @@ public:
/// Make dump of current view to file
/// </summary>
/// <param name="theFileName">Name of dump file</param>
bool Dump(char *theFileName)
bool Dump(const TCollection_AsciiString& theFileName)
{
if (myView().IsNull())
{
return false;
}
myView()->Redraw();
return myView()->Dump(theFileName) != Standard_False;
return myView()->Dump(theFileName.ToCString()) != Standard_False;
}
/// <summary>
@@ -731,28 +751,18 @@ public:
/// <param name="theFileName">Name of import file</param>
bool ImportBrep(System::String^ theFileName)
{
bool isResult = false;
int aLength = theFileName->Length;
char* aFilename = new char[aLength+1];
for(int i = 0; i<aLength; i++)
{
aFilename[i] = (char)theFileName->ToCharArray()[i];
}
aFilename[aLength] = '\0';
isResult = ImportBrep(aFilename);
return isResult;
return ImportBrep (toAsciiString (theFileName));
}
/// <summary>
///Import BRep file
/// </summary>
/// <param name="theFileName">Name of import file</param>
bool ImportBrep(char* theFileName)
bool ImportBrep (const TCollection_AsciiString& theFileName)
{
Standard_CString aFileName = (Standard_CString) theFileName;
TopoDS_Shape aShape;
BRep_Builder aBuilder;
Standard_Boolean isResult = BRepTools::Read(aShape,aFileName,aBuilder);
Standard_Boolean isResult = BRepTools::Read(aShape,theFileName.ToCString(),aBuilder);
if (!isResult)
{
return false;
@@ -766,11 +776,10 @@ public:
///Import Step file
/// </summary>
/// <param name="theFileName">Name of import file</param>
bool ImportStep(char* theFileName)
bool ImportStep(const TCollection_AsciiString& theFileName)
{
Standard_CString aFileName = (Standard_CString) theFileName;
STEPControl_Reader aReader;
IFSelect_ReturnStatus aStatus = aReader.ReadFile(aFileName);
IFSelect_ReturnStatus aStatus = aReader.ReadFile(theFileName.ToCString());
if ( aStatus == IFSelect_RetDone )
{
bool isFailsonly = false;
@@ -805,11 +814,10 @@ public:
///Import Iges file
/// </summary>
/// <param name="theFileName">Name of import file</param>
bool ImportIges(char* theFileName)
bool ImportIges(const TCollection_AsciiString& theFileName)
{
Standard_CString aFileName = (Standard_CString) theFileName;
IGESControl_Reader aReader;
int aStatus = aReader.ReadFile( aFileName );
int aStatus = aReader.ReadFile( theFileName.ToCString() );
if ( aStatus == IFSelect_RetDone )
{
@@ -830,7 +838,7 @@ public:
///Export BRep file
/// </summary>
/// <param name="theFileName">Name of export file</param>
bool ExportBRep(char* theFileName)
bool ExportBRep(const TCollection_AsciiString& theFileName)
{
myAISContext()->InitSelected();
if (!myAISContext()->MoreSelected())
@@ -840,14 +848,14 @@ public:
Handle(AIS_InteractiveObject) anIO = myAISContext()->SelectedInteractive();
Handle(AIS_Shape) anIS = Handle(AIS_Shape)::DownCast(anIO);
return BRepTools::Write (anIS->Shape(), (Standard_CString)theFileName) != Standard_False;
return BRepTools::Write (anIS->Shape(), theFileName.ToCString()) != Standard_False;
}
/// <summary>
///Export Step file
/// </summary>
/// <param name="theFileName">Name of export file</param>
bool ExportStep(char* theFileName)
bool ExportStep(const TCollection_AsciiString& theFileName)
{
STEPControl_StepModelType aType = STEPControl_AsIs;
IFSelect_ReturnStatus aStatus;
@@ -864,7 +872,7 @@ public:
}
}
aStatus = aWriter.Write( (Standard_CString)theFileName );
aStatus = aWriter.Write(theFileName.ToCString());
if ( aStatus != IFSelect_RetDone )
{
return false;
@@ -877,7 +885,7 @@ public:
///Export Iges file
/// </summary>
/// <param name="theFileName">Name of export file</param>
bool ExportIges(char* theFileName)
bool ExportIges(const TCollection_AsciiString& theFileName)
{
IGESControl_Controller::Init();
IGESControl_Writer aWriter( Interface_Static::CVal( "XSTEP.iges.unit" ),
@@ -892,14 +900,14 @@ public:
}
aWriter.ComputeModel();
return aWriter.Write( (Standard_CString)theFileName) != Standard_False;
return aWriter.Write(theFileName.ToCString()) != Standard_False;
}
/// <summary>
///Export Vrml file
/// </summary>
/// <param name="theFileName">Name of export file</param>
bool ExportVrml(char* theFileName)
bool ExportVrml(const TCollection_AsciiString& theFileName)
{
TopoDS_Compound aRes;
BRep_Builder aBuilder;
@@ -919,7 +927,7 @@ public:
}
VrmlAPI_Writer aWriter;
aWriter.Write( aRes, (Standard_CString)theFileName );
aWriter.Write(aRes, theFileName.ToCString());
return true;
}
@@ -928,7 +936,7 @@ public:
///Export Stl file
/// </summary>
/// <param name="theFileName">Name of export file</param>
bool ExportStl(char* theFileName)
bool ExportStl(const TCollection_AsciiString& theFileName)
{
TopoDS_Compound aComp;
BRep_Builder aBuilder;
@@ -947,7 +955,7 @@ public:
}
StlAPI_Writer aWriter;
aWriter.Write( aComp, (Standard_CString)theFileName );
aWriter.Write(aComp, theFileName.ToCString());
return true;
}
@@ -960,14 +968,8 @@ public:
bool TranslateModel(System::String^ theFileName, int theFormat, bool theIsImport)
{
bool isResult;
int aLength = theFileName->Length;
char* aFilename = new char[aLength+1];
for(int i = 0; i<aLength; i++)
{
aFilename[i] = (char)theFileName->ToCharArray()[i];
}
aFilename[aLength] = '\0';
const TCollection_AsciiString aFilename = toAsciiString (theFileName);
if (theIsImport)
{
switch(theFormat)

View File

@@ -39,6 +39,8 @@
//wrapper of pure C++ classes to ref classes
#include <NCollection_Haft.h>
#include <vcclr.h>
// list of required OCCT libraries
#pragma comment(lib, "TKernel.lib")
#pragma comment(lib, "TKMath.lib")
@@ -55,6 +57,24 @@
#pragma comment(lib, "D3D9.lib")
//! Auxiliary tool for converting C# string into UTF-8 string.
static TCollection_AsciiString toAsciiString (String^ theString)
{
if (theString == nullptr)
{
return TCollection_AsciiString();
}
pin_ptr<const wchar_t> aPinChars = PtrToStringChars (theString);
const wchar_t* aWCharPtr = aPinChars;
if (aWCharPtr == NULL
|| *aWCharPtr == L'\0')
{
return TCollection_AsciiString();
}
return TCollection_AsciiString (aWCharPtr);
}
/// <summary>
/// Proxy class encapsulating calls to OCCT C++ classes within
/// C++/CLI class visible from .Net (CSharp)
@@ -109,14 +129,14 @@ public:
/// Make dump of current view to file
/// </summary>
/// <param name="theFileName">Name of dump file</param>
bool Dump (const char* theFileName)
bool Dump (const TCollection_AsciiString& theFileName)
{
if (myView().IsNull())
{
return false;
}
myView()->Redraw();
return myView()->Dump (theFileName) != Standard_False;
return myView()->Dump (theFileName.ToCString()) != Standard_False;
}
/// <summary>
@@ -709,28 +729,18 @@ public:
/// <param name="theFileName">Name of import file</param>
bool ImportBrep (System::String^ theFileName)
{
bool isResult = false;
int aLength = theFileName->Length;
char* aFilename = new char[aLength + 1];
for(int i = 0; i < aLength; ++i)
{
aFilename[i] = (char )theFileName->ToCharArray()[i];
}
aFilename[aLength] = '\0';
isResult = ImportBrep (aFilename);
delete[] aFilename;
return isResult;
return ImportBrep (toAsciiString (theFileName));
}
/// <summary>
///Import BRep file
/// </summary>
/// <param name="theFileName">Name of import file</param>
bool ImportBrep (char* theFileName)
bool ImportBrep (const TCollection_AsciiString& theFileName)
{
TopoDS_Shape aShape;
BRep_Builder aBuilder;
if (!BRepTools::Read (aShape, theFileName, aBuilder))
if (!BRepTools::Read (aShape, theFileName.ToCString(), aBuilder))
{
return false;
}
@@ -746,10 +756,10 @@ public:
///Import Step file
/// </summary>
/// <param name="theFileName">Name of import file</param>
bool ImportStep (char* theFileName)
bool ImportStep (const TCollection_AsciiString& theFileName)
{
STEPControl_Reader aReader;
if (aReader.ReadFile (theFileName) != IFSelect_RetDone)
if (aReader.ReadFile (theFileName.ToCString()) != IFSelect_RetDone)
{
return false;
}
@@ -779,10 +789,10 @@ public:
///Import Iges file
/// </summary>
/// <param name="theFileName">Name of import file</param>
bool ImportIges (char* theFileName)
bool ImportIges (const TCollection_AsciiString& theFileName)
{
IGESControl_Reader aReader;
if (aReader.ReadFile (theFileName) != IFSelect_RetDone)
if (aReader.ReadFile (theFileName.ToCString()) != IFSelect_RetDone)
{
return false;
}
@@ -798,7 +808,7 @@ public:
///Export BRep file
/// </summary>
/// <param name="theFileName">Name of export file</param>
bool ExportBRep (char* theFileName)
bool ExportBRep (const TCollection_AsciiString& theFileName)
{
myAISContext()->InitSelected();
if (!myAISContext()->MoreSelected())
@@ -808,14 +818,14 @@ public:
Handle(AIS_Shape) anIS = Handle(AIS_Shape)::DownCast (myAISContext()->SelectedInteractive());
return !anIS.IsNull()
&& BRepTools::Write (anIS->Shape(), theFileName);
&& BRepTools::Write (anIS->Shape(), theFileName.ToCString());
}
/// <summary>
///Export Step file
/// </summary>
/// <param name="theFileName">Name of export file</param>
bool ExportStep (char* theFileName)
bool ExportStep (const TCollection_AsciiString& theFileName)
{
STEPControl_StepModelType aType = STEPControl_AsIs;
STEPControl_Writer aWriter;
@@ -833,14 +843,14 @@ public:
return false;
}
}
return aWriter.Write (theFileName) == IFSelect_RetDone;
return aWriter.Write (theFileName.ToCString()) == IFSelect_RetDone;
}
/// <summary>
///Export Iges file
/// </summary>
/// <param name="theFileName">Name of export file</param>
bool ExportIges (char* theFileName)
bool ExportIges (const TCollection_AsciiString& theFileName)
{
IGESControl_Controller::Init();
IGESControl_Writer aWriter (Interface_Static::CVal ("XSTEP.iges.unit"),
@@ -857,14 +867,14 @@ public:
}
aWriter.ComputeModel();
return aWriter.Write (theFileName) != Standard_False;
return aWriter.Write (theFileName.ToCString()) != Standard_False;
}
/// <summary>
///Export Vrml file
/// </summary>
/// <param name="theFileName">Name of export file</param>
bool ExportVrml (char* theFileName)
bool ExportVrml (const TCollection_AsciiString& theFileName)
{
TopoDS_Compound aRes;
BRep_Builder aBuilder;
@@ -880,7 +890,7 @@ public:
}
VrmlAPI_Writer aWriter;
aWriter.Write (aRes, theFileName);
aWriter.Write (aRes, theFileName.ToCString());
return true;
}
@@ -888,7 +898,7 @@ public:
///Export Stl file
/// </summary>
/// <param name="theFileName">Name of export file</param>
bool ExportStl (char* theFileName)
bool ExportStl (const TCollection_AsciiString& theFileName)
{
TopoDS_Compound aComp;
BRep_Builder aBuilder;
@@ -904,7 +914,7 @@ public:
}
StlAPI_Writer aWriter;
aWriter.Write (aComp, theFileName);
aWriter.Write (aComp, theFileName.ToCString());
return true;
}
@@ -917,14 +927,7 @@ public:
bool TranslateModel (System::String^ theFileName, int theFormat, bool theIsImport)
{
bool isResult = false;
int aLength = theFileName->Length;
char* aFilename = new char[aLength + 1];
for (int aCharIter = 0; aCharIter < aLength; ++aCharIter)
{
aFilename[aCharIter] = (char)theFileName->ToCharArray()[aCharIter];
}
aFilename[aLength] = '\0';
const TCollection_AsciiString aFilename = toAsciiString (theFileName);
if (theIsImport)
{
switch (theFormat)
@@ -946,7 +949,6 @@ public:
case 5: isResult = Dump (aFilename); break;
}
}
delete[] aFilename;
return isResult;
}

View File

@@ -137,12 +137,12 @@ void Textures_Presentation::Init()
//================================================================
void Textures_Presentation::lightsOnOff(Standard_Boolean isOn)
{
static Handle(V3d_Light) aLight1 = new V3d_DirectionalLight(getViewer(), V3d_XnegYposZneg);
static Handle(V3d_Light) aLight2 = new V3d_DirectionalLight(getViewer(), V3d_XnegYnegZpos);
static Handle(V3d_Light) aLight3 = new V3d_DirectionalLight(getViewer(), V3d_XposYnegZpos);
static Handle(V3d_Light) aLight4 = new V3d_DirectionalLight(getViewer(), V3d_XnegYnegZneg);
static Handle(V3d_Light) aLight5 = new V3d_DirectionalLight(getViewer(), V3d_XnegYposZpos);
static Handle(V3d_Light) aLight6 = new V3d_DirectionalLight(getViewer(), V3d_XposYposZpos);
static Handle(V3d_Light) aLight1 = new V3d_DirectionalLight(V3d_XnegYposZneg);
static Handle(V3d_Light) aLight2 = new V3d_DirectionalLight(V3d_XnegYnegZpos);
static Handle(V3d_Light) aLight3 = new V3d_DirectionalLight(V3d_XposYnegZpos);
static Handle(V3d_Light) aLight4 = new V3d_DirectionalLight(V3d_XnegYnegZneg);
static Handle(V3d_Light) aLight5 = new V3d_DirectionalLight(V3d_XnegYposZpos);
static Handle(V3d_Light) aLight6 = new V3d_DirectionalLight(V3d_XposYposZpos);
if (isOn)
{

View File

@@ -185,12 +185,12 @@ Standard_Boolean TexturesExt_Presentation::loadShape(TopoDS_Shape& aShape,
//================================================================
void TexturesExt_Presentation::lightsOnOff(Standard_Boolean isOn)
{
static Handle(V3d_Light) aLight1 = new V3d_DirectionalLight(getViewer(), V3d_XnegYposZneg);
static Handle(V3d_Light) aLight2 = new V3d_DirectionalLight(getViewer(), V3d_XnegYnegZpos);
static Handle(V3d_Light) aLight3 = new V3d_DirectionalLight(getViewer(), V3d_XposYnegZpos);
static Handle(V3d_Light) aLight4 = new V3d_DirectionalLight(getViewer(), V3d_XnegYnegZneg);
static Handle(V3d_Light) aLight5 = new V3d_DirectionalLight(getViewer(), V3d_XnegYposZpos);
static Handle(V3d_Light) aLight6 = new V3d_DirectionalLight(getViewer(), V3d_XposYposZpos);
static Handle(V3d_Light) aLight1 = new V3d_DirectionalLight(V3d_XnegYposZneg);
static Handle(V3d_Light) aLight2 = new V3d_DirectionalLight(V3d_XnegYnegZpos);
static Handle(V3d_Light) aLight3 = new V3d_DirectionalLight(V3d_XposYnegZpos);
static Handle(V3d_Light) aLight4 = new V3d_DirectionalLight(V3d_XnegYnegZneg);
static Handle(V3d_Light) aLight5 = new V3d_DirectionalLight(V3d_XnegYposZpos);
static Handle(V3d_Light) aLight6 = new V3d_DirectionalLight(V3d_XposYposZpos);
if (isOn)
{

View File

@@ -191,12 +191,12 @@ Standard_Boolean TexturesExt_Presentation::loadShape(TopoDS_Shape& aShape,
//================================================================
void TexturesExt_Presentation::lightsOnOff(Standard_Boolean isOn)
{
static Handle(V3d_Light) aLight1 = new V3d_DirectionalLight(getViewer(), V3d_XnegYposZneg);
static Handle(V3d_Light) aLight2 = new V3d_DirectionalLight(getViewer(), V3d_XnegYnegZpos);
static Handle(V3d_Light) aLight3 = new V3d_DirectionalLight(getViewer(), V3d_XposYnegZpos);
static Handle(V3d_Light) aLight4 = new V3d_DirectionalLight(getViewer(), V3d_XnegYnegZneg);
static Handle(V3d_Light) aLight5 = new V3d_DirectionalLight(getViewer(), V3d_XnegYposZpos);
static Handle(V3d_Light) aLight6 = new V3d_DirectionalLight(getViewer(), V3d_XposYposZpos);
static Handle(V3d_Light) aLight1 = new V3d_DirectionalLight(V3d_XnegYposZneg);
static Handle(V3d_Light) aLight2 = new V3d_DirectionalLight(V3d_XnegYnegZpos);
static Handle(V3d_Light) aLight3 = new V3d_DirectionalLight(V3d_XposYnegZpos);
static Handle(V3d_Light) aLight4 = new V3d_DirectionalLight(V3d_XnegYnegZneg);
static Handle(V3d_Light) aLight5 = new V3d_DirectionalLight(V3d_XnegYposZpos);
static Handle(V3d_Light) aLight6 = new V3d_DirectionalLight(V3d_XposYposZpos);
if (isOn)
{

View File

@@ -416,7 +416,7 @@ GetDocument()->UpdateResultMessageDlg("SetPosition",Message);
case CurAction3d_BeginSpotLight :
{
p1 = ConvertClickToPoint(point.x,point.y,myView);
myCurrent_SpotLight = new V3d_SpotLight(myView->Viewer(),0.,0.,1., p1.X(),p1.Y(),p1.Z(),Quantity_NOC_RED);
myCurrent_SpotLight = new V3d_SpotLight (p1, gp_Dir (gp_XYZ (0.0, 0.0, 1.0) - p1.XYZ()), Quantity_NOC_RED);
myView->SetLightOn(myCurrent_SpotLight);
NbActiveLights++;
p2 = gp_Pnt(p1.X(),p1.Y(),p1.Z()+1.);
@@ -461,7 +461,7 @@ GetDocument()->UpdateResultMessageDlg("SetAngle",Message);
directionalEdgeShape->Set(MakeEdge.Edge());
GetDocument()->GetAISContext()->Display (directionalEdgeShape, 0, -1, Standard_True);
// Create a directional light
myCurrent_DirectionalLight = new V3d_DirectionalLight(myView->Viewer(), p1.X(),p1.Y(),p1.Z(),0.,0.,1.);
myCurrent_DirectionalLight = new V3d_DirectionalLight (gp_Dir (p1.XYZ() - gp_XYZ (0.,0.,1.)));
myView->SetLightOn(myCurrent_DirectionalLight);
NbActiveLights++;
((OCC_MainFrame*)AfxGetMainWnd())->SetStatusMessage("Pick the target point");
@@ -745,7 +745,7 @@ void CViewer3dView::OnMouseMove(UINT nFlags, CPoint point)
0, p2.Distance(p3), coneHeigth);
spotConeShape->Set(MakeCone.Solid());
GetDocument()->GetAISContext()->Redisplay(spotConeShape,0,Standard_True);
myCurrent_SpotLight->SetAngle(atan(p2.Distance(p3)/p1.Distance(p2))) ;
myCurrent_SpotLight->SetAngle((float )atan(p2.Distance(p3)/p1.Distance(p2))) ;
myView->UpdateLights();
}
}
@@ -894,7 +894,7 @@ void CViewer3dView::OnDirectionalLight()
myCurrentMode = CurAction3d_BeginDirectionalLight;
TCollection_AsciiString Message("\
myCurrent_DirectionalLight = new V3d_DirectionalLight(myView->Viewer(), Xt, Yt, Zt, Xp, Yp, Zp);\n\
myCurrent_DirectionalLight = new V3d_DirectionalLight (gp_Dir (theDirection));\n\
\n\
myView->SetLightOn(myCurrent_DirectionalLight);\n\
\n\
@@ -920,7 +920,7 @@ void CViewer3dView::OnSpotLight()
myCurrentMode = CurAction3d_BeginSpotLight;
TCollection_AsciiString Message("\
myCurrent_SpotLight = new V3d_SpotLight(myView->Viewer(), Xt, Yt, Zt, Xp, Yp, Zp,Quantity_NOC_RED);\n\
myCurrent_SpotLight = new V3d_SpotLight (gp_Pnt (thePosition), gp_Dir (theDirection), Quantity_NOC_RED);\n\
\n\
myView->SetLightOn(myCurrent_SpotLight);\n\
\n\
@@ -942,14 +942,16 @@ void CViewer3dView::OnPositionalLight()
return;
}
myCurrent_PositionalLight=new V3d_PositionalLight(myView->Viewer(),0,0,0,Quantity_NOC_GREEN,1,0);
myCurrent_PositionalLight=new V3d_PositionalLight (gp_Pnt (0,0,0), Quantity_NOC_GREEN);
myCurrent_PositionalLight->SetAttenuation (1, 0);
myView->SetLightOn(myCurrent_PositionalLight);
NbActiveLights++;
((OCC_MainFrame*)AfxGetMainWnd())->SetStatusMessage("Pick the light position");
myCurrentMode = CurAction3d_BeginPositionalLight;
TCollection_AsciiString Message("\
myCurrent_PositionalLight=new V3d_PositionalLight(myView->Viewer(),Xp, Yp, Zp,Quantity_NOC_GREEN,1,0);\n\
myCurrent_PositionalLight=new V3d_PositionalLight (gp_Pnt(thePosition),Quantity_NOC_GREEN);\n\
myCurrent_PositionalLight->SetAttenuation (1, 0);\n\
\n\
myView->SetLightOn(myCurrent_PositionalLight) ;\n\
");
@@ -971,14 +973,14 @@ void CViewer3dView::OnAmbientLight()
return;
}
myCurrent_AmbientLight=new V3d_AmbientLight(myView->Viewer(), Quantity_NOC_GRAY);
myCurrent_AmbientLight=new V3d_AmbientLight (Quantity_NOC_GRAY);
myView->SetLightOn(myCurrent_AmbientLight) ;
NbActiveLights++;
myView->UpdateLights();
TCollection_AsciiString Message("\
myCurrent_AmbientLight=new V3d_AmbientLight(myView->Viewer(), Quantity_NOC_GRAY);\n\
myCurrent_AmbientLight=new V3d_AmbientLight(Quantity_NOC_GRAY);\n\
\n\
myView->SetLightOn(myCurrent_AmbientLight) ;\n\
");

View File

@@ -170,7 +170,7 @@ void AndroidQt::sync()
//myView->MustBeResized(); // can be used instead of SetWindow() when EGLsurface has not been changed
EGLContext anEglContext = eglGetCurrentContext();
myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext, NULL, NULL);
myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext);
}
}
}
@@ -247,7 +247,7 @@ bool AndroidQt::initViewer()
}
aWindow->SetSize (aWidth, aHeight);
myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext, NULL, NULL);
myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext);
}
Handle(OpenGl_GraphicDriver) aDriver = new OpenGl_GraphicDriver (NULL, Standard_False);
@@ -273,7 +273,7 @@ bool AndroidQt::initViewer()
Handle(AndroidQt_Window) aWindow = new AndroidQt_Window (aWidth, aHeight);
myView = myViewer->CreateView();
myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext, NULL, NULL);
myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext);
myView->TriedronDisplay (Aspect_TOTP_RIGHT_LOWER, Quantity_NOC_WHITE, 0.08, V3d_ZBUFFER);
return true;

View File

@@ -20,7 +20,7 @@
//! The main functionality is viewport dimensions.
class AndroidQt_Window : public Aspect_Window
{
DEFINE_STANDARD_RTTIEXT(AndroidQt_Window, Aspect_Window)
public:
//! Creates a wrapper over existing Window handle
@@ -34,7 +34,8 @@ public:
//! Returns parent of native Window handle.
virtual Aspect_Drawable NativeParentHandle() const { return 0; }
virtual void Destroy() {}
//! Returns native Window FB config (GLXFBConfig on Xlib)
virtual Aspect_FBConfig NativeFBConfig() const { return 0; }
//! Opens the window <me>
virtual void Map() const {}
@@ -84,12 +85,6 @@ private:
int myY1;
int myY2;
public:
DEFINE_STANDARD_RTTIEXT(AndroidQt_Window,Aspect_Window)
};
DEFINE_STANDARD_HANDLE(AndroidQt_Window, Aspect_Window)
#endif // ANDROIDQT_WINDOW_H

View File

@@ -41,11 +41,11 @@ tcopy bxx b10
# make some boxes hollow
for {set i 1} {$i <= 1} {incr i} {
set dim [boundingstr b$i]
set dx [expr [lindex $dim 3] - [lindex $dim 0]]
set x1 [expr [lindex $dim 0] + 0.1 * $dx]
set x2 [expr [lindex $dim 1] + 0.1 * $dx]
set x3 [expr [lindex $dim 2] + 0.1 * $dx]
set dim [bounding -s b$i -save xmin ymin zmin xmax ymax zmax]
set dx [dval xmax-xmin]
set x1 [dval xmin+0.1*$dx]
set x2 [dval ymin+0.1*$dx]
set x3 [dval zmin+0.1*$dx]
box bc $x1 $x2 $x3 0.8*$dx 0.8*$dx $dx
bcut bb b$i bc
tcopy bb b$i

View File

@@ -70,7 +70,8 @@ vclear
vtop
vglinfo
vsetgradientbg 180 200 255 180 180 180 2
vlight change 0 pos -1 1 1
vlight -change 0 -dir 0.577 -0.577 -0.577
vsetdispmode 1
vrenderparams -msaa 8

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
bounding -s snowflake -save 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

@@ -9,6 +9,8 @@ pload VISUALIZATION
vinit View1 w=1024 h=1024
vclear
vdefaults -autoTriang 0
vrenderparams -stats basic
# parameter NB defines number of spheres by each coordinate
set NB 10
@@ -23,11 +25,12 @@ for {set i 0} {$i < $NB} {incr i} {
}
}
}
eval compound $slist c
incmesh c 0.006
puts "Measuring FPS of display of spheres as separate objects..."
vaxo
vsetdispmode 1
eval vdisplay $slist
eval vdisplay -dispMode 1 $slist
vfit
# measure FPS
@@ -35,16 +38,14 @@ puts [set fps_separate [vfps]]
vclear
puts "Measuring FPS of display of spheres as single object..."
eval compound $slist c
vdisplay c
vdisplay -dispMode 1 c
# measure FPS
puts [set fps_compound [vfps]]
vclear
# redisplay individual spheres, trying to avoid unnecessary internal updates
#vfrustumculling 0 ;# try to disable updates of frustum culling structures
eval vdisplay -mutable $slist
eval vdisplay -dispMode 1 $slist
# auxiliary procedure to make random update of variable
proc upd {theValueName theDeltaName theTime theToRand} {
@@ -69,8 +70,10 @@ proc animateSpheres {{theDuration 10.0}} {
for {set i 0} {$i < $::NB} {incr i $nb} {
for {set j 0} {$j < $::NB} {incr j $nb} {
for {set k 0} {$k < $::NB} {incr k $nb} {
# mark animated spheres mutable for faster updates
uplevel #0 vdisplay -dispMode 1 -mutable s$i$j$k
# vaspects -noupdate s$i$j$k -setcolor red -setmaterial plastic
vaspects -noupdate s$i$j$k -setcolor red
uplevel #0 vaspects -noupdate s$i$j$k -setcolor red
set x$i$j$k 0.0
set y$i$j$k 0.0
set z$i$j$k 0.0
@@ -142,4 +145,4 @@ puts "Animation FPS: $fps_animation"
puts ""
puts "Scene contains [lindex [trinfo c] 3] triangles"
puts ""
puts "Print 'animateSpheres 10.0' to restart animation"
puts "Print 'animateSpheres 10.0' to restart animation"

View File

@@ -345,7 +345,7 @@ void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
//function : Compute
//purpose :
//=======================================================================
void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
@@ -359,31 +359,45 @@ void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
thePrs->SetInfiniteState (Standard_True);
}
if (theMode == AIS_Shaded)
switch (theMode)
{
if (myDrawer->IsAutoTriangulation())
case AIS_WireFrame:
{
// compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
// After this call if type of deflection is relative
// computed deflection coefficient is stored as absolute.
Standard_Boolean wasRecomputed = StdPrs_ToolTriangulatedShape::Tessellate (myshape, myDrawer);
// Set to update wireframe presentation on triangulation.
if (myDrawer->IsoOnTriangulation() && wasRecomputed)
{
SetToUpdate (AIS_WireFrame);
}
Prs3d::GetDeflection (myshape, myDrawer);
break;
}
}
else // WireFrame mode
{
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
case AIS_Shaded:
{
if (myDrawer->IsAutoTriangulation())
{
// compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
// After this call if type of deflection is relative
// computed deflection coefficient is stored as absolute.
Prs3d::GetDeflection (myshape, myDrawer);
// After this call if type of deflection is relative
// computed deflection coefficient is stored as absolute.
Standard_Boolean wasRecomputed = StdPrs_ToolTriangulatedShape::Tessellate (myshape, myDrawer);
// Set to update wireframe presentation on triangulation.
if (myDrawer->IsoOnTriangulation() && wasRecomputed)
{
SetToUpdate (AIS_WireFrame);
}
}
break;
}
case 2:
{
AIS_Shape::Compute (thePrsMgr, thePrs, theMode);
return;
}
default:
{
return;
}
}
// Extract myShapeColors map (KeyshapeColored -> Color) to subshapes map (Subshape -> Color).

View File

@@ -457,6 +457,10 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
{
Erase (theIObj, theToUpdateViewer);
Load (theIObj, theSelectionMode, theToAllowDecomposition);
if (Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (theIObj))
{
(*aStatusPtr)->SetDisplayMode (theDispMode);
}
return;
}
@@ -484,7 +488,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
{
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
myObjects.Bind (theIObj, aStatus);
Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->StructureManager()->RegisterObject (theIObj);
myMainVwr->StructureManager()->RegisterObject (theIObj);
myMainPM->Display(theIObj, theDispMode);
if (theSelectionMode != -1)
{
@@ -567,23 +571,20 @@ void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
return;
}
if (theSelMode == -1
&& !theToAllowDecomposition)
if (!myObjects.IsBound (theIObj))
{
if (!myObjects.IsBound (theIObj))
{
Standard_Integer aDispMode, aHiMod, aSelModeDef;
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, aSelModeDef);
myObjects.Bind (theIObj, aStatus);
}
Standard_Integer aDispMode, aHiMod, aSelModeDef;
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
myObjects.Bind (theIObj, aStatus);
myMainVwr->StructureManager()->RegisterObject (theIObj);
}
// Register theIObj in the selection manager to prepare further activation of selection
const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity
if (!mgrSelector->Contains (anObj))
{
mgrSelector->Load (theIObj);
}
// Register theIObj in the selection manager to prepare further activation of selection
const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity
if (!mgrSelector->Contains (anObj))
{
mgrSelector->Load (theIObj);
}
}
@@ -785,6 +786,7 @@ Standard_Boolean AIS_InteractiveContext::KeepTemporary(const Handle(AIS_Interact
Standard_False);
// GS->SubIntensityOn();
myObjects.Bind(anIObj,GS);
myMainVwr->StructureManager()->RegisterObject (anIObj);
mgrSelector->Load(anIObj);
mgrSelector->Activate(anIObj,SM,myMainSel);

View File

@@ -25,6 +25,7 @@
#include <AIS_KindOfInteractive.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_Selection.hxx>
#include <AIS_SelectionModesConcurrency.hxx>
#include <AIS_StatusOfDetection.hxx>
#include <AIS_StatusOfPick.hxx>
#include <AIS_TypeOfIso.hxx>
@@ -121,7 +122,6 @@ public: //! @name object display management
//! If AllowDecomp = Standard_True and, if the interactive object is of the "Shape" type,
//! these "standard" selection modes will be automatically activated as a function of the modes present in the Local Context.
//! The loaded objects will be selectable but displayable in highlighting only when detected by the Selector.
//! This method is available only when Local Contexts are open.
Standard_EXPORT void Load (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer SelectionMode = -1, const Standard_Boolean AllowDecomp = Standard_False);
//! Hides the object. The object's presentations are simply flagged as invisible and therefore excluded from redrawing.
@@ -597,18 +597,48 @@ public: //! @name immediate mode rendering
public: //! @name management of active Selection Modes
//! Activates or deactivates the selection mode for specified object.
//! Has no effect if selection mode was already active/deactivated.
//! @param theObj object to activate/deactivate selection mode
//! @param theMode selection mode to activate/deactivate;
//! deactivation of -1 selection mode will effectively deactivate all selection modes;
//! activation of -1 selection mode with AIS_SelectionModesConcurrency_Single
//! will deactivate all selection modes, and will has no effect otherwise
//! @param theToActivate activation/deactivation flag
//! @param theConcurrency specifies how to handle already activated selection modes;
//! default value (AIS_SelectionModesConcurrency_Multiple) means active selection modes should be left as is,
//! AIS_SelectionModesConcurrency_Single can be used if only one selection mode is expected to be active
//! and AIS_SelectionModesConcurrency_GlobalOrLocal can be used if either AIS_InteractiveObject::GlobalSelectionMode()
//! or any combination of Local selection modes is acceptable;
//! this value is considered only if theToActivate set to TRUE
//! @param theIsForce when set to TRUE, the display status will be ignored while activating selection mode
Standard_EXPORT void SetSelectionModeActive (const Handle(AIS_InteractiveObject)& theObj,
const Standard_Integer theMode,
const Standard_Boolean theToActivate,
const AIS_SelectionModesConcurrency theConcurrency = AIS_SelectionModesConcurrency_Multiple,
const Standard_Boolean theIsForce = Standard_False);
//! Activates the selection mode aMode whose index is given, for the given interactive entity anIobj.
Standard_EXPORT void Activate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode = 0, const Standard_Boolean theIsForce = Standard_False);
void Activate (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode = 0, const Standard_Boolean theIsForce = Standard_False)
{
SetSelectionModeActive (theObj, theMode, Standard_True, AIS_SelectionModesConcurrency_GlobalOrLocal, theIsForce);
}
//! Activates the given selection mode for the all displayed objects.
Standard_EXPORT void Activate (const Standard_Integer theMode,
const Standard_Boolean theIsForce = Standard_False);
//! Deactivates all the activated selection modes of an object.
Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIObj);
void Deactivate (const Handle(AIS_InteractiveObject)& theObj)
{
SetSelectionModeActive (theObj, -1, Standard_False, AIS_SelectionModesConcurrency_Single);
}
//! Deactivates all the activated selection modes of the interactive object anIobj with a given selection mode aMode.
Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode);
void Deactivate (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode)
{
SetSelectionModeActive (theObj, theMode, Standard_False);
}
//! Deactivates the given selection mode for all displayed objects.
Standard_EXPORT void Deactivate (const Standard_Integer theMode);

View File

@@ -216,27 +216,121 @@ Standard_Integer AIS_InteractiveContext::HighestIndex() const
}
//=======================================================================
//function : Activate
//purpose :
//function : SetSelectionModeActive
//purpose :
//=======================================================================
void AIS_InteractiveContext::
Activate(const Handle(AIS_InteractiveObject)& anIObj,
const Standard_Integer aMode,
const Standard_Boolean theIsForce)
void AIS_InteractiveContext::SetSelectionModeActive (const Handle(AIS_InteractiveObject)& theObj,
const Standard_Integer theMode,
const Standard_Boolean theIsActive,
const AIS_SelectionModesConcurrency theActiveFilter,
const Standard_Boolean theIsForce)
{
if(!HasOpenedContext()){
if(!myObjects.IsBound(anIObj)) return;
const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
if(STAT->GraphicStatus()==AIS_DS_Displayed || theIsForce)
mgrSelector->Activate(anIObj,aMode,myMainSel);
STAT ->AddSelectionMode(aMode);
if (theObj.IsNull())
{
return;
}
else{
myLocalContexts(myCurLocalIndex)->ActivateMode(anIObj,aMode);
else if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->SetSelectionModeActive (theObj, theMode, theIsActive, theActiveFilter);
return;
}
const Handle(AIS_GlobalStatus)* aStat = myObjects.Seek (theObj);
if (aStat == NULL)
{
return;
}
if (!theIsActive
|| (theMode == -1
&& theActiveFilter == AIS_SelectionModesConcurrency_Single))
{
if ((*aStat)->GraphicStatus() == AIS_DS_Displayed
|| theIsForce)
{
if (theMode == -1)
{
for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
{
mgrSelector->Deactivate (theObj, aModeIter.Value(), myMainSel);
}
}
else
{
mgrSelector->Deactivate (theObj, theMode, myMainSel);
}
}
if (theMode == -1)
{
(*aStat)->ClearSelectionModes();
}
else
{
(*aStat)->RemoveSelectionMode (theMode);
}
return;
}
else if (theMode == -1)
{
return;
}
if ((*aStat)->SelectionModes().Size() == 1
&& (*aStat)->SelectionModes().First() == theMode)
{
return;
}
if ((*aStat)->GraphicStatus() == AIS_DS_Displayed
|| theIsForce)
{
switch (theActiveFilter)
{
case AIS_SelectionModesConcurrency_Single:
{
for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
{
mgrSelector->Deactivate (theObj, aModeIter.Value(), myMainSel);
}
(*aStat)->ClearSelectionModes();
break;
}
case AIS_SelectionModesConcurrency_GlobalOrLocal:
{
const Standard_Integer aGlobSelMode = theObj->GlobalSelectionMode();
TColStd_ListOfInteger aRemovedModes;
for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
{
if ((theMode == aGlobSelMode && aModeIter.Value() != aGlobSelMode)
|| (theMode != aGlobSelMode && aModeIter.Value() == aGlobSelMode))
{
mgrSelector->Deactivate (theObj, aModeIter.Value(), myMainSel);
aRemovedModes.Append (aModeIter.Value());
}
}
if (aRemovedModes.Size() == (*aStat)->SelectionModes().Size())
{
(*aStat)->ClearSelectionModes();
}
else
{
for (TColStd_ListIteratorOfListOfInteger aModeIter (aRemovedModes); aModeIter.More(); aModeIter.Next())
{
(*aStat)->RemoveSelectionMode (aModeIter.Value());
}
}
break;
}
case AIS_SelectionModesConcurrency_Multiple:
{
break;
}
}
mgrSelector->Activate (theObj, theMode, myMainSel);
}
(*aStat)->AddSelectionMode (theMode);
}
// ============================================================================
@@ -269,52 +363,6 @@ Handle( StdSelect_ViewerSelector3d ) AIS_InteractiveContext::LocalSelector() con
return myLocalContexts( myCurLocalIndex )->MainSelector();
}
//=======================================================================
//function : DeActivate
//purpose :
//=======================================================================
void AIS_InteractiveContext::
Deactivate(const Handle(AIS_InteractiveObject)& anIObj)
{
if(!HasOpenedContext()){
if(!myObjects.IsBound(anIObj)) return;
TColStd_ListIteratorOfListOfInteger ItL;
for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
ItL.More();
ItL.Next()){
if(myObjects(anIObj)->GraphicStatus() == AIS_DS_Displayed)
mgrSelector->Deactivate(anIObj,ItL.Value(),myMainSel);
}
myObjects(anIObj)->ClearSelectionModes();
}
else{
const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
LC->Deactivate(anIObj);
}
}
//=======================================================================
//function : Deactivate
//purpose :
//=======================================================================
void AIS_InteractiveContext::Deactivate(const Handle(AIS_InteractiveObject)& anIObj,
const Standard_Integer aMode)
{
if(!HasOpenedContext()){
if(!myObjects.IsBound(anIObj)) return;
const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
if(STAT->GraphicStatus() == AIS_DS_Displayed)
mgrSelector->Deactivate(anIObj,aMode,myMainSel);
STAT->RemoveSelectionMode(aMode);
}
else{
myLocalContexts(myCurLocalIndex)->DeactivateMode(anIObj,aMode);
}
}
// ============================================================================
// function : Deactivate
// purpose :

View File

@@ -376,48 +376,95 @@ void AIS_LocalContext::Clear(const AIS_ClearMode aType)
ClearDetected();
}
}
//=======================================================================
//function : ActivateMode
//purpose :
//=======================================================================
void AIS_LocalContext::ActivateMode(const Handle(AIS_InteractiveObject)& aSelectable,
const Standard_Integer aMode)
//=======================================================================
//function : SetSelectionModeActive
//purpose :
//=======================================================================
void AIS_LocalContext::SetSelectionModeActive (const Handle(AIS_InteractiveObject)& theObj,
const Standard_Integer theMode,
const Standard_Boolean theIsActive,
const AIS_SelectionModesConcurrency theActiveFilter)
{
if(!myActiveObjects.IsBound(aSelectable)) return;
// if(myActiveObjects(aSelectable)->SelectionMode()!=aMode)
// mySM->Deactivate(aSelectable,aMode,myMainVS);
if(aMode != -1){
myActiveObjects(aSelectable)->AddSelectionMode(aMode);
mySM->Activate(aSelectable,aMode,myMainVS);
const Handle(AIS_LocalStatus)* aStat = myActiveObjects.Seek (theObj);
if (aStat == NULL)
{
return;
}
}
//=======================================================================
//function : ActivateMode
//purpose :
//=======================================================================
void AIS_LocalContext::DeactivateMode(const Handle(AIS_InteractiveObject)& aSelectable,
const Standard_Integer aMode)
{
if(!myActiveObjects.IsBound(aSelectable)) return;
if(aMode==-1) return;
myActiveObjects(aSelectable)->RemoveSelectionMode(aMode);
mySM->Deactivate(aSelectable,aMode,myMainVS);
}
//=======================================================================
//function : ActivateMode
//purpose :
//=======================================================================
if (!theIsActive
|| (theMode == -1
&& theActiveFilter == AIS_SelectionModesConcurrency_Single))
{
if (theMode == -1)
{
for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
{
mySM->Deactivate (theObj, aModeIter.Value(), myMainVS);
}
(*aStat)->ClearSelectionModes();
}
else
{
mySM->Deactivate (theObj, theMode, myMainVS);
(*aStat)->RemoveSelectionMode (theMode);
}
return;
}
else if (theMode == -1)
{
return;
}
else if ((*aStat)->SelectionModes().Size() == 1
&& (*aStat)->SelectionModes().First() == theMode)
{
return;
}
void AIS_LocalContext::Deactivate(const Handle(AIS_InteractiveObject)& aSelectable)
{
if(!myActiveObjects.IsBound(aSelectable)) return;
mySM->Deactivate(aSelectable, -1, myMainVS);
myActiveObjects(aSelectable)->ClearSelectionModes();
switch (theActiveFilter)
{
case AIS_SelectionModesConcurrency_Single:
{
for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
{
mySM->Deactivate (theObj, aModeIter.Value(), myMainVS);
}
(*aStat)->ClearSelectionModes();
break;
}
case AIS_SelectionModesConcurrency_GlobalOrLocal:
{
const Standard_Integer aGlobSelMode = theObj->GlobalSelectionMode();
TColStd_ListOfInteger aRemovedModes;
for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
{
if ((theMode == aGlobSelMode && aModeIter.Value() != aGlobSelMode)
|| (theMode != aGlobSelMode && aModeIter.Value() == aGlobSelMode))
{
mySM->Deactivate (theObj, aModeIter.Value(), myMainVS);
aRemovedModes.Append (aModeIter.Value());
}
}
if (aRemovedModes.Size() == (*aStat)->SelectionModes().Size())
{
(*aStat)->ClearSelectionModes();
}
else
{
for (TColStd_ListIteratorOfListOfInteger aModeIter (aRemovedModes); aModeIter.More(); aModeIter.Next())
{
(*aStat)->RemoveSelectionMode (aModeIter.Value());
}
}
break;
}
case AIS_SelectionModesConcurrency_Multiple:
{
break;
}
}
mySM->Activate (theObj, theMode, myMainVS);
(*aStat)->AddSelectionMode (theMode);
}
//=======================================================================

View File

@@ -30,6 +30,7 @@
#include <Standard_Integer.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <AIS_SequenceOfInteractive.hxx>
#include <AIS_SelectionModesConcurrency.hxx>
#include <Standard_Transient.hxx>
#include <AIS_ClearMode.hxx>
#include <TopAbs_ShapeEnum.hxx>
@@ -120,12 +121,26 @@ public:
//! the selector (filters, modeof activation, objects...)
Standard_EXPORT void Clear (const AIS_ClearMode atype = AIS_CM_All);
Standard_EXPORT void SetSelectionModeActive (const Handle(AIS_InteractiveObject)& theObj,
const Standard_Integer theMode,
const Standard_Boolean theIsActive,
const AIS_SelectionModesConcurrency theActiveFilter);
//! optional : activation of a mode which is not 0 for a selectable...
Standard_EXPORT void ActivateMode (const Handle(AIS_InteractiveObject)& aSelectable, const Standard_Integer aMode);
Standard_EXPORT void DeactivateMode (const Handle(AIS_InteractiveObject)& aSelectable, const Standard_Integer aMode);
Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& aSelectable);
void ActivateMode (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode)
{
SetSelectionModeActive (theObj, theMode, Standard_True, AIS_SelectionModesConcurrency_GlobalOrLocal);
}
void DeactivateMode (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode)
{
SetSelectionModeActive (theObj, theMode, Standard_False, AIS_SelectionModesConcurrency_GlobalOrLocal);
}
void Deactivate (const Handle(AIS_InteractiveObject)& theObj)
{
SetSelectionModeActive (theObj, -1, Standard_False, AIS_SelectionModesConcurrency_Single);
}
//! decomposition of shapes into <aType>
Standard_EXPORT void ActivateStandardMode (const TopAbs_ShapeEnum aType);

View File

@@ -1178,8 +1178,11 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
{
myHighlightTranslator->Clear();
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightTranslator);
aGroup->AddPrimitiveArray (myTriangleArray);
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightTranslator);
aGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
aGroup->AddPrimitiveArray (myTriangleArray);
}
}
if (myHasScaling)
@@ -1199,8 +1202,11 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
{
myHighlightScaler->Clear();
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightScaler);
aGroup->AddPrimitiveArray (myCube.Array());
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightScaler);
aGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
aGroup->AddPrimitiveArray (myCube.Array());
}
}
if (myHasRotation)
@@ -1219,7 +1225,10 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
{
myHighlightRotator->Clear();
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightRotator);
Prs3d_Root::CurrentGroup (myHighlightRotator)->AddPrimitiveArray (myCircle.Array());
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightRotator);
aGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
aGroup->AddPrimitiveArray (myCircle.Array());
}
}
}

View File

@@ -52,10 +52,12 @@ myTOM(Aspect_TOM_PLUS)
myHilightDrawer->SetDisplayMode (-99);
myHilightDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_GRAY80, 3.0));
myHilightDrawer->SetColor (Quantity_NOC_GRAY80);
myHilightDrawer->SetZLayer (Graphic3d_ZLayerId_UNKNOWN);
myDynHilightDrawer = new Prs3d_Drawer();
myDynHilightDrawer->SetDisplayMode (-99);
myDynHilightDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_CYAN1, 3.0));
myDynHilightDrawer->SetColor (Quantity_NOC_CYAN1);
myDynHilightDrawer->SetZLayer (Graphic3d_ZLayerId_Top);
}
//=======================================================================

View File

@@ -45,6 +45,7 @@ AIS_RubberBand::AIS_RubberBand()
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_EMPTY);
myDrawer->ShadingAspect()->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend);
myDrawer->ShadingAspect()->SetTransparency (1.0);
myDrawer->ShadingAspect()->SetColor (Quantity_NOC_WHITE);
@@ -66,6 +67,7 @@ AIS_RubberBand::AIS_RubberBand (const Quantity_Color& theLineColor,
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_EMPTY);
myDrawer->ShadingAspect()->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend);
myDrawer->ShadingAspect()->SetTransparency (1.0);
myDrawer->ShadingAspect()->SetColor (Quantity_NOC_WHITE);
@@ -90,6 +92,7 @@ AIS_RubberBand::AIS_RubberBand (const Quantity_Color& theLineColor,
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
myDrawer->ShadingAspect()->SetColor (theFillColor);
myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
myDrawer->ShadingAspect()->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend);
myDrawer->ShadingAspect()->SetTransparency (theTransparency);
SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));

View File

@@ -0,0 +1,25 @@
// 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 _AIS_SelectionModesConcurrency_HeaderFile
#define _AIS_SelectionModesConcurrency_HeaderFile
//! The mode specifying how multiple active Selection Modes should be treated during activation of new one.
enum AIS_SelectionModesConcurrency
{
AIS_SelectionModesConcurrency_Single, //!< only one selection mode can be activated at the same moment - previously activated should be deactivated
AIS_SelectionModesConcurrency_GlobalOrLocal, //!< either Global (AIS_InteractiveObject::GlobalSelectionMode() or Local (multiple) selection modes can be active at the same moment
AIS_SelectionModesConcurrency_Multiple, //!< any combination of selection modes can be activated
};
#endif // _AIS_SelectionModesConcurrency_HeaderFile

View File

@@ -19,7 +19,6 @@
#include <AIS_GraphicTool.hxx>
#include <AIS_InteractiveContext.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Bnd_Box.hxx>
#include <BRep_Builder.hxx>
#include <BRepBndLib.hxx>
#include <BRepTools.hxx>
@@ -68,7 +67,6 @@
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_Shape,AIS_InteractiveObject)
@@ -97,28 +95,6 @@ AIS_Shape::AIS_Shape(const TopoDS_Shape& theShape)
//
}
//=======================================================================
//function : Type
//purpose :
//=======================================================================
AIS_KindOfInteractive AIS_Shape::Type() const
{return AIS_KOI_Shape;}
//=======================================================================
//function : Signature
//purpose :
//=======================================================================
Standard_Integer AIS_Shape::Signature() const
{return 0;}
//=======================================================================
//function : AcceptShapeDecomposition
//purpose :
//=======================================================================
Standard_Boolean AIS_Shape::AcceptShapeDecomposition() const
{return Standard_True;}
//=======================================================================
//function : Compute
//purpose :

View File

@@ -19,14 +19,10 @@
#include <AIS_InteractiveObject.hxx>
#include <Bnd_Box.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS_Shape.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_TypeOfHLR.hxx>
class TopoDS_Shape;
class Bnd_Box;
//! A framework to manage presentation and selection of shapes.
//! AIS_Shape is the interactive object which is used the
//! most by applications. There are standard functions
@@ -68,25 +64,31 @@ public:
//! Initializes construction of the shape shap from wires,
//! edges and vertices.
Standard_EXPORT AIS_Shape(const TopoDS_Shape& shap);
//! Returns index 0. This value refers to SHAPE from TopAbs_ShapeEnum
Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 0; }
//! Returns Object as the type of Interactive Object.
Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Shape; }
//! Returns true if the Interactive Object accepts shape decomposition.
Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE;
virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE { return Standard_True; }
//! Return true if specified display mode is supported.
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode >= 0 && theMode <= 2; }
//! Returns this shape object.
const TopoDS_Shape& Shape() const { return myshape; }
//! Constructs an instance of the shape object theShape.
void Set (const TopoDS_Shape& theShape)
void SetShape (const TopoDS_Shape& theShape)
{
myshape = theShape;
myCompBB = Standard_True;
}
//! Returns this shape object.
const TopoDS_Shape& Shape() const { return myshape; }
//! Alias for ::SetShape().
void Set (const TopoDS_Shape& theShape) { SetShape (theShape); }
//! Sets a local value for deviation coefficient for this specific shape.
Standard_EXPORT Standard_Boolean SetOwnDeviationCoefficient();

View File

@@ -146,6 +146,7 @@ AIS_RubberBand.cxx
AIS_Selection.cxx
AIS_Selection.hxx
AIS_SelectStatus.hxx
AIS_SelectionModesConcurrency.hxx
AIS_SequenceOfDimension.hxx
AIS_SequenceOfInteractive.hxx
AIS_Shape.cxx

View File

@@ -22,7 +22,6 @@
#include <TDocStd_Application.hxx>
#include <TColStd_SequenceOfExtendedString.hxx>
#include <Standard_CString.hxx>
class CDM_MessageDriver;
class AppStd_Application;

View File

@@ -22,8 +22,6 @@
#include <TDocStd_Application.hxx>
#include <TColStd_SequenceOfExtendedString.hxx>
#include <Standard_CString.hxx>
class CDM_MessageDriver;
class AppStdL_Application;
DEFINE_STANDARD_HANDLE(AppStdL_Application, TDocStd_Application)

View File

@@ -799,23 +799,22 @@ void Approx_BSplComputeLine::Parameters(const MultiLine& Line,
const Standard_Integer lastP,
math_Vector& TheParameters) const
{
Standard_Integer i, j, Nbp, nbP2d, nbP3d;
Standard_Integer i, j, nbP2d, nbP3d;
Standard_Real dist;
gp_Pnt P1, P2;
gp_Pnt2d P12d, P22d;
Nbp = lastP-firstP+1;
const Standard_Integer aNbp = lastP - firstP + 1;
if (Nbp == 2) {
if (aNbp == 2) {
TheParameters(firstP) = 0.0;
TheParameters(lastP) = 1.0;
}
else if (Par == Approx_ChordLength || Par == Approx_Centripetal) {
else if(Par == Approx_ChordLength || Par == Approx_Centripetal)
{
nbP3d = LineTool::NbP3d(Line);
nbP2d = LineTool::NbP2d(Line);
Standard_Integer mynbP3d=nbP3d, mynbP2d=nbP2d;
if (nbP3d == 0) mynbP3d = 1;
if (nbP2d == 0) mynbP2d = 1;
Standard_Integer mynbP3d = nbP3d, mynbP2d = nbP2d;
if(nbP3d == 0) mynbP3d = 1;
if(nbP2d == 0) mynbP2d = 1;
TheParameters(firstP) = 0.0;
dist = 0.0;
@@ -824,35 +823,41 @@ void Approx_BSplComputeLine::Parameters(const MultiLine& Line,
TColgp_Array1OfPnt2d tabP2d(1, mynbP2d);
TColgp_Array1OfPnt2d tabPP2d(1, mynbP2d);
for (i = firstP+1; i <= lastP; i++) {
if (nbP3d != 0 && nbP2d != 0) LineTool::Value(Line, i-1, tabP, tabP2d);
else if (nbP2d != 0) LineTool::Value(Line, i-1, tabP2d);
else if (nbP3d != 0) LineTool::Value(Line, i-1, tabP);
for(i = firstP + 1; i <= lastP; i++)
{
if(nbP3d != 0 && nbP2d != 0) LineTool::Value(Line, i - 1, tabP, tabP2d);
else if(nbP2d != 0) LineTool::Value(Line, i - 1, tabP2d);
else if(nbP3d != 0) LineTool::Value(Line, i - 1, tabP);
if (nbP3d != 0 && nbP2d != 0) LineTool::Value(Line, i, tabPP, tabPP2d);
else if (nbP2d != 0) LineTool::Value(Line, i, tabPP2d);
else if (nbP3d != 0) LineTool::Value(Line, i, tabPP);
dist = 0;
for (j = 1; j <= nbP3d; j++) {
P1 = tabP(j);
P2 = tabPP(j);
dist += P2.Distance(P1);
if(nbP3d != 0 && nbP2d != 0) LineTool::Value(Line, i, tabPP, tabPP2d);
else if(nbP2d != 0) LineTool::Value(Line, i, tabPP2d);
else if(nbP3d != 0) LineTool::Value(Line, i, tabPP);
dist = 0.0;
for(j = 1; j <= nbP3d; j++)
{
const gp_Pnt &aP1 = tabP(j),
&aP2 = tabPP(j);
dist += aP2.SquareDistance(aP1);
}
for (j = 1; j <= nbP2d; j++) {
P12d = tabP2d(j);
P22d = tabPP2d(j);
dist += P22d.Distance(P12d);
for(j = 1; j <= nbP2d; j++)
{
const gp_Pnt2d &aP12d = tabP2d(j),
&aP22d = tabPP2d(j);
dist += aP22d.SquareDistance(aP12d);
}
dist = dist/(nbP3d+nbP2d);
dist = Sqrt(dist);
if(Par == Approx_ChordLength)
TheParameters(i) = TheParameters(i-1) + dist;
else {// Par == Approx_Centripetal
TheParameters(i) = TheParameters(i-1) + Sqrt(dist);
{
TheParameters(i) = TheParameters(i - 1) + dist;
}
else
{// Par == Approx_Centripetal
TheParameters(i) = TheParameters(i - 1) + Sqrt(dist);
}
}
for (i = firstP; i <= lastP; i++) TheParameters(i) /= TheParameters(lastP);
for(i = firstP; i <= lastP; i++) TheParameters(i) /= TheParameters(lastP);
}
else {
for (i = firstP; i <= lastP; i++) {

View File

@@ -1180,15 +1180,14 @@ void Approx_ComputeLine::Parameters(const MultiLine& Line,
{
Standard_Integer i, j, nbP2d, nbP3d;
Standard_Real dist;
gp_Pnt P1, P2;
gp_Pnt2d P12d, P22d;
if (Par == Approx_ChordLength || Par == Approx_Centripetal) {
if(Par == Approx_ChordLength || Par == Approx_Centripetal)
{
nbP3d = LineTool::NbP3d(Line);
nbP2d = LineTool::NbP2d(Line);
Standard_Integer mynbP3d=nbP3d, mynbP2d=nbP2d;
if (nbP3d == 0) mynbP3d = 1;
if (nbP2d == 0) mynbP2d = 1;
Standard_Integer mynbP3d = nbP3d, mynbP2d = nbP2d;
if(nbP3d == 0) mynbP3d = 1;
if(nbP2d == 0) mynbP2d = 1;
TheParameters(firstP) = 0.0;
dist = 0.0;
@@ -1197,32 +1196,41 @@ void Approx_ComputeLine::Parameters(const MultiLine& Line,
TColgp_Array1OfPnt2d tabP2d(1, mynbP2d);
TColgp_Array1OfPnt2d tabPP2d(1, mynbP2d);
for (i = firstP+1; i <= lastP; i++) {
if (nbP3d != 0 && nbP2d != 0) LineTool::Value(Line, i-1, tabP, tabP2d);
else if (nbP2d != 0) LineTool::Value(Line, i-1, tabP2d);
else if (nbP3d != 0) LineTool::Value(Line, i-1, tabP);
for(i = firstP + 1; i <= lastP; i++)
{
if(nbP3d != 0 && nbP2d != 0) LineTool::Value(Line, i - 1, tabP, tabP2d);
else if(nbP2d != 0) LineTool::Value(Line, i - 1, tabP2d);
else if(nbP3d != 0) LineTool::Value(Line, i - 1, tabP);
if (nbP3d != 0 && nbP2d != 0) LineTool::Value(Line, i, tabPP, tabPP2d);
else if (nbP2d != 0) LineTool::Value(Line, i, tabPP2d);
else if (nbP3d != 0) LineTool::Value(Line, i, tabPP);
if(nbP3d != 0 && nbP2d != 0) LineTool::Value(Line, i, tabPP, tabPP2d);
else if(nbP2d != 0) LineTool::Value(Line, i, tabPP2d);
else if(nbP3d != 0) LineTool::Value(Line, i, tabPP);
dist = 0;
for (j = 1; j <= nbP3d; j++) {
P1 = tabP(j);
P2 = tabPP(j);
dist += P2.Distance(P1);
for(j = 1; j <= nbP3d; j++)
{
const gp_Pnt &aP1 = tabP(j),
&aP2 = tabPP(j);
dist += aP2.SquareDistance(aP1);
}
for (j = 1; j <= nbP2d; j++) {
P12d = tabP2d(j);
P22d = tabPP2d(j);
dist += P22d.Distance(P12d);
for(j = 1; j <= nbP2d; j++)
{
const gp_Pnt2d &aP12d = tabP2d(j),
&aP22d = tabPP2d(j);
dist += aP22d.SquareDistance(aP12d);
}
dist = Sqrt(dist);
if(Par == Approx_ChordLength)
TheParameters(i) = TheParameters(i-1) + dist;
else {// Par == Approx_Centripetal
TheParameters(i) = TheParameters(i-1) + Sqrt(dist);
{
TheParameters(i) = TheParameters(i - 1) + dist;
}
else
{// Par == Approx_Centripetal
TheParameters(i) = TheParameters(i - 1) + Sqrt(dist);
}
}
for (i = firstP; i <= lastP; i++) TheParameters(i) /= TheParameters(lastP);
for(i = firstP; i <= lastP; i++) TheParameters(i) /= TheParameters(lastP);
}
else {
for (i = firstP; i <= lastP; i++) {

View File

@@ -99,8 +99,6 @@ static void Parameters(const ApproxInt_TheMultiLine& Line,
{
Standard_Integer i, j, nbP2d, nbP3d;
Standard_Real dist;
gp_Pnt P1, P2;
gp_Pnt2d P12d, P22d;
if (Par == Approx_ChordLength || Par == Approx_Centripetal) {
nbP3d = ApproxInt_TheMultiLineTool::NbP3d(Line);
@@ -126,19 +124,25 @@ static void Parameters(const ApproxInt_TheMultiLine& Line,
else if (nbP3d != 0) ApproxInt_TheMultiLineTool::Value(Line, i, tabPP);
dist = 0;
for (j = 1; j <= nbP3d; j++) {
P1 = tabP(j);
P2 = tabPP(j);
dist += P2.Distance(P1);
const gp_Pnt &aP1 = tabP(j),
&aP2 = tabPP(j);
dist += aP2.SquareDistance(aP1);
}
for (j = 1; j <= nbP2d; j++) {
P12d = tabP2d(j);
P22d = tabPP2d(j);
dist += P22d.Distance(P12d);
const gp_Pnt2d &aP12d = tabP2d(j),
&aP22d = tabPP2d(j);
dist += aP22d.SquareDistance(aP12d);
}
dist = Sqrt(dist);
if(Par == Approx_ChordLength)
TheParameters(i) = TheParameters(i-1) + dist;
else {// Par == Approx_Centripetal
TheParameters(i) = TheParameters(i-1) + Sqrt(dist);
{
TheParameters(i) = TheParameters(i - 1) + dist;
}
else
{// Par == Approx_Centripetal
TheParameters(i) = TheParameters(i - 1) + Sqrt(dist);
}
}
for (i = firstP; i <= lastP; i++) TheParameters(i) /= TheParameters(lastP);

View File

@@ -17,19 +17,14 @@
#define _Aspect_TypeOfDisplayText_HeaderFile
//! Define the display type of the text.
//!
//! TODT_NORMAL Default display. Text only.
//! TODT_SUBTITLE There is a subtitle under the text.
//! TODT_DEKALE The text is displayed with a 3D style.
//! TODT_BLEND The text is displayed in XOR.
//! TODT_DIMENSION Dimension line under text will be invisible.
enum Aspect_TypeOfDisplayText
{
Aspect_TODT_NORMAL,
Aspect_TODT_SUBTITLE,
Aspect_TODT_DEKALE,
Aspect_TODT_BLEND,
Aspect_TODT_DIMENSION
Aspect_TODT_NORMAL, //!< default display, text only
Aspect_TODT_SUBTITLE, //!< there is a subtitle under the text
Aspect_TODT_DEKALE, //!< the text is displayed with a 3D style
Aspect_TODT_BLEND, //!< the text is displayed in XOR
Aspect_TODT_DIMENSION, //!< dimension line under text will be invisible
Aspect_TODT_SHADOW //!< the text will have a shadow at the right-bottom corner
};
#endif // _Aspect_TypeOfDisplayText_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()) {
@@ -411,6 +373,7 @@ void BOPAlgo_BOP::Perform()
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
pPF->SetUseOBB(myUseOBB);
//
pPF->Perform();
//
@@ -563,7 +526,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 +543,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 +558,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 +586,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 +614,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 +627,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 +642,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 +672,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 +684,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 +698,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 +752,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 +773,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 +786,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 +860,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 +907,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 +926,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 +935,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 +948,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 +995,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) {
@@ -1059,7 +1028,7 @@ void BOPAlgo_BOP::BuildSolid()
return;
}
// new solids
const BOPCol_ListOfShape& aLSR = aSB.Areas();
const TopTools_ListOfShape& aLSR = aSB.Areas();
//
// add new solids to result
aItLS.Initialize(aLSR);
@@ -1110,19 +1079,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 +1100,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 +1138,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 +1169,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 +1194,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 +1205,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 +1223,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 +1238,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 +1246,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 +1254,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 +1291,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 +1303,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 +1317,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 +1329,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

@@ -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:
//=======================================================================
@@ -286,6 +195,7 @@ void BOPAlgo_Builder::Perform()
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
pPF->SetUseOBB(myUseOBB);
//
pPF->Perform();
//
@@ -303,6 +213,7 @@ void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller)
myNonDestructive = theFiller.NonDestructive();
myFuzzyValue = theFiller.FuzzyValue();
myGlue = theFiller.Glue();
myUseOBB = theFiller.UseOBB();
PerformInternal(theFiller);
}
//=======================================================================
@@ -447,7 +358,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::AddOptimal(myFace, aBoxF, Standard_True, Standard_True);
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();
@@ -810,32 +713,34 @@ Standard_Boolean IsInside(const TopoDS_Shape& theHole,
Handle(IntTools_Context)& theContext)
{
Standard_Boolean bRet;
Standard_Real aT, aU, aV;
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())
{
const TopoDS_Edge& aE = (*(TopoDS_Edge *) (&aExp.Current()));
if (aME2.Contains(aE))
{
if (aExp.More()) {
const TopoDS_Edge& aE =(*(TopoDS_Edge *)(&aExp.Current()));
if (aME2.Contains(aE)) {
return bRet;
}
if (!BRep_Tool::Degenerated(aE))
{
if (!BRep_Tool::Degenerated(aE)) {
//
gp_Pnt aP3D;
BOPTools_AlgoTools::PointOnEdge(aE, BOPTools_AlgoTools2D::IntermediatePoint(aE), aP3D);
bRet = theContext->IsPointInFace(aP3D, aF2, BRep_Tool::Tolerance(aE));
aT=BOPTools_AlgoTools2D::IntermediatePoint(aE);
BOPTools_AlgoTools2D::PointOnSurface(aE, aF2, aT, aU, aV, theContext);
aP2D.SetCoord(aU, aV);
//
IntTools_FClass2d& aClsf=theContext->FClass2d(aF2);
aState=aClsf.Perform(aP2D);
bRet=(aState==TopAbs_IN);
}
}
//
@@ -847,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

@@ -24,7 +24,8 @@
#include <TopoDS_Solid.hxx>
#include <BOPAlgo_BuilderArea.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <TopTools_DataMapOfShapeBox.hxx>
class TopoDS_Solid;
@@ -39,7 +40,7 @@ public:
Standard_EXPORT BOPAlgo_BuilderSolid();
Standard_EXPORT virtual ~BOPAlgo_BuilderSolid();
Standard_EXPORT BOPAlgo_BuilderSolid(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT BOPAlgo_BuilderSolid(const Handle(NCollection_BaseAllocator)& theAllocator);
//! Sets the source solid <theSolid>
Standard_EXPORT void SetSolid (const TopoDS_Solid& theSolid);
@@ -50,6 +51,12 @@ Standard_EXPORT virtual ~BOPAlgo_BuilderSolid();
//! Performs the algorithm
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
//! Returns the map of solid/box pairs
const TopTools_DataMapOfShapeBox& GetBoxesMap() const
{
return myBoxes;
}
protected:
//! Collect the faces that
@@ -76,16 +83,8 @@ protected:
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,22 +15,17 @@
#include <BOPAlgo_CellsBuilder.hxx>
#include <TopoDS_Compound.hxx>
#include <BOPAlgo_Alerts.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 <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <ShapeUpgrade_UnifySameDomain.hxx>
#include <TopoDS_Compound.hxx>
static
@@ -40,7 +35,7 @@ static
void MakeTypedContainers(const TopoDS_Shape& theSC,
TopoDS_Shape& theResult);
static void CollectMaterialBoundaries(const BOPCol_ListOfShape& theLS,
static void CollectMaterialBoundaries(const TopTools_ListOfShape& theLS,
TopTools_MapOfShape& theMapKeepBnd);
//=======================================================================
@@ -146,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();
//
@@ -160,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);
//
@@ -175,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);
//
@@ -207,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) {
@@ -217,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;
@@ -247,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());
@@ -268,7 +263,7 @@ 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();
// provide uniqueness of the parts
@@ -280,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();
@@ -291,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()) {
@@ -323,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()) {
@@ -345,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);
@@ -463,12 +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);
BOPCol_ListOfShape aLSUnify[2];
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;
@@ -485,7 +480,7 @@ 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()) {
@@ -511,7 +506,7 @@ void BOPAlgo_CellsBuilder::RemoveInternalBoundaries()
Standard_Integer iType = (aType == TopAbs_EDGE ? 0 : 1);
CollectMaterialBoundaries(aLS, aKeepMap[iType]);
// save shapes to unify later
BOPCol_ListOfShape aCopy(aLS);
TopTools_ListOfShape aCopy(aLS);
aLSUnify[iType].Append(aCopy);
continue;
}
@@ -519,7 +514,7 @@ void BOPAlgo_CellsBuilder::RemoveInternalBoundaries()
{
// aType is Solid;
// remove internal faces between solids of the same material just now
BOPCol_ListOfShape aLSNew;
TopTools_ListOfShape aLSNew;
if (RemoveInternals(aLS, aLSNew))
{
bChanged = Standard_True;
@@ -544,11 +539,11 @@ void BOPAlgo_CellsBuilder::RemoveInternalBoundaries()
{
if (aLSUnify[iType].IsEmpty())
continue;
BOPCol_ListOfShape aLSN;
TopTools_ListOfShape aLSN;
if (RemoveInternals(aLSUnify[iType], aLSN, aKeepMap[iType]))
bChanged = Standard_True;
// add shapes to result ([unified] edges or faces)
for (BOPCol_ListIteratorOfListOfShape aItLS(aLSN); aItLS.More(); aItLS.Next()) {
for (TopTools_ListIteratorOfListOfShape aItLS(aLSN); aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS = aItLS.Value();
aBB.Add(aResult, aS);
}
@@ -611,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();
@@ -659,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();
//
@@ -675,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();
@@ -721,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()) {
@@ -743,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());
}
@@ -757,8 +752,8 @@ 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;
@@ -779,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);
}
@@ -812,12 +807,12 @@ 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) {
@@ -839,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);
@@ -847,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()) {
@@ -874,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);
}
@@ -885,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) {
@@ -912,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());
}
@@ -931,7 +926,7 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
//
// 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());
}
@@ -939,118 +934,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;
}
//=======================================================================
@@ -1083,7 +1014,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;
@@ -1091,7 +1022,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()) {
@@ -1117,13 +1048,13 @@ 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 BOPCol_ListOfShape& theLS,
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;
BOPCol_ListIteratorOfListOfShape anIt(theLS);
TopTools_ListIteratorOfListOfShape anIt(theLS);
for (; anIt.More(); anIt.Next())
{
const TopoDS_Shape& aS = anIt.Value();

View File

@@ -26,11 +26,11 @@
#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,22 +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;
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;
@@ -159,16 +159,16 @@ void BOPAlgo_CheckerSI::Init()
myDS->SetArguments(myArguments);
myDS->Init(myFuzzyValue);
//
// 2.myIterator
// 2 myContext
myContext=new IntTools_Context;
//
// 3.myIterator
BOPDS_PIteratorSI theIterSI=new BOPDS_IteratorSI(myAllocator);
theIterSI->SetDS(myDS);
theIterSI->Prepare();
theIterSI->Prepare(myContext, myUseOBB, myFuzzyValue);
theIterSI->UpdateByLevelOfCheck(myLevelOfCheck);
//
myIterator=theIterSI;
//
// 3 myContext
myContext=new IntTools_Context;
}
//=======================================================================
//function : Perform
@@ -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);
@@ -94,6 +90,7 @@ void BOPAlgo_MakerVolume::Perform()
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
pPF->SetUseOBB(myUseOBB);
pPF->Perform();
//
myEntryPoint = 1;
@@ -153,8 +150,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 +187,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 +202,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 +221,7 @@ void BOPAlgo_MakerVolume::CollectFaces()
//function : MakeBox
//purpose :
//=======================================================================
void BOPAlgo_MakerVolume::MakeBox(BOPCol_MapOfShape& theBoxFaces)
void BOPAlgo_MakerVolume::MakeBox(TopTools_MapOfShape& theBoxFaces)
{
UserBreak();
//
@@ -251,7 +248,7 @@ 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();
//
@@ -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

@@ -50,7 +50,8 @@ BOPAlgo_Options::BOPAlgo_Options()
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
myReport(new Message_Report),
myRunParallel(myGlobalRunParallel),
myFuzzyValue(Precision::Confusion())
myFuzzyValue(Precision::Confusion()),
myUseOBB(Standard_False)
{
BOPAlgo_LoadMessages();
}
@@ -65,7 +66,8 @@ BOPAlgo_Options::BOPAlgo_Options
myAllocator(theAllocator),
myReport(new Message_Report),
myRunParallel(myGlobalRunParallel),
myFuzzyValue(Precision::Confusion())
myFuzzyValue(Precision::Confusion()),
myUseOBB(Standard_False)
{
BOPAlgo_LoadMessages();
}

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;
@@ -32,6 +32,8 @@ class Message_ProgressIndicator;
//! touching or coinciding cases;
//! - *Progress indicator* - provides interface to track the progress of
//! operation and stop the operation by user's break.
//! - *Using the Oriented Bounding Boxes* - Allows using the Oriented Bounding Boxes of the shapes
//! for filtering the intersections.
//!
class BOPAlgo_Options
{
@@ -43,13 +45,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;
}
@@ -156,6 +158,21 @@ public:
//! Set the Progress Indicator object.
Standard_EXPORT void SetProgressIndicator(const Handle(Message_ProgressIndicator)& theObj);
public:
//!@name Usage of Oriented Bounding boxes
//! Enables/Disables the usage of OBB
void SetUseOBB(const Standard_Boolean theUseOBB)
{
myUseOBB = theUseOBB;
}
//! Returns the flag defining usage of OBB
Standard_Boolean UseOBB() const
{
return myUseOBB;
}
protected:
//! Breaks the execution if the break signal
@@ -164,11 +181,12 @@ protected:
protected:
BOPCol_BaseAllocator myAllocator;
Handle(NCollection_BaseAllocator) myAllocator;
Handle(Message_Report) myReport;
Standard_Boolean myRunParallel;
Standard_Real myFuzzyValue;
Handle(Message_ProgressIndicator) myProgressIndicator;
Standard_Boolean myUseOBB;
};

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);
@@ -211,14 +211,14 @@ void BOPAlgo_PaveFiller::Init()
myDS->SetArguments(myArguments);
myDS->Init(myFuzzyValue);
//
// 2.myIterator
// 2 myContext
myContext=new IntTools_Context;
//
// 3.myIterator
myIterator=new BOPDS_Iterator(myAllocator);
myIterator->SetRunParallel(myRunParallel);
myIterator->SetDS(myDS);
myIterator->Prepare();
//
// 3 myContext
myContext=new IntTools_Context;
myIterator->Prepare(myContext, myUseOBB, myFuzzyValue);
//
// 4 NonDestructive flag
SetNonDestructive();
@@ -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;
@@ -118,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();
@@ -126,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();
@@ -206,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();
@@ -219,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();
@@ -228,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();
@@ -245,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);
@@ -275,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,
@@ -288,16 +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_IndexedMapOfShape& theVertsOnRejectedPB,
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);
@@ -310,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.
@@ -352,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>.
@@ -370,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>
@@ -379,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>
@@ -408,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.
@@ -431,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();
@@ -484,7 +485,28 @@ protected:
//! 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();
//! When all section edges are created and no increase of the tolerance
//! of vertices put on the section edges is expected, make sure that
//! the created sections have valid range.
//! If any of the section edges do not have valid range, remove them
//! from Face/Face intersection info and from the input <theMSCPB> map.
//! Put such edges into <aMicroEdges> map for further unification of their
//! vertices in the PostTreatFF method.
//!
//! All these section edges have already been checked to have valid range.
//! Current check is necessary for the edges whose vertices have also
//! been put on other section edges with greater tolerance, which has caused
//! increase of the tolerance value of the vertices.
Standard_EXPORT void RemoveMicroSectionEdges(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
TopTools_IndexedMapOfShape& theMicroEdges);
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);
@@ -97,7 +97,7 @@ void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
aBB.UpdateEdge(aE, aTol);
Bnd_Box& aBoxE=aSIE.ChangeBox();
BRepBndLib::AddOptimal(aE, aBoxE, Standard_True, Standard_True);
BRepBndLib::Add(aE, aBoxE);
aBoxE.SetGap(aBoxE.GetGap() + Precision::Confusion());
//
aIt.Initialize(aLI);
@@ -113,7 +113,7 @@ void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
aBB.UpdateVertex(aV, aTol);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nV);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::AddOptimal(aV, aBoxV, Standard_True, Standard_True);
BRepBndLib::Add(aV, aBoxV);
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
}
}
@@ -141,7 +141,7 @@ Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
aBB.UpdateVertex(aVSD, aTolNew);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVNew);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::AddOptimal(aVSD, aBoxV, Standard_True, Standard_True);
BRepBndLib::Add(aVSD, aBoxV);
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
}
return nVNew;
@@ -165,7 +165,7 @@ Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
// bounding box for the new vertex
BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nVNew);
Bnd_Box& aBoxDS = aSIDS.ChangeBox();
BRepBndLib::AddOptimal(aVNew, aBoxDS, Standard_True, Standard_True);
BRepBndLib::Add(aVNew, aBoxDS);
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
//
// add vertex to SD map
@@ -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();
@@ -117,7 +117,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
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);
@@ -134,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);
}
@@ -154,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);
}
@@ -167,7 +167,7 @@ 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 acquired self-interference warning:
// Several faces from one argument contain the same vertex or edge

View File

@@ -19,8 +19,6 @@
#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>
@@ -28,10 +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>
@@ -136,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;
@@ -194,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);
}
//
@@ -227,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();
//
@@ -242,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);
@@ -271,10 +271,10 @@ 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) {
@@ -305,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
@@ -336,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
@@ -354,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
@@ -364,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);
@@ -392,21 +392,42 @@ void BOPAlgo_PaveFiller::SplitPaveBlocks(const BOPCol_MapOfInteger& theMEdges,
myDS->UpdatePaveBlockWithSDVertices(aPBN);
FillShrunkData(aPBN);
//
if (!aPBN->HasShrunkData()) {
// No valid range, unify vertices
Standard_Boolean bHasValidRange = aPBN->HasShrunkData();
// Take into account that the edge could have really small valid range,
// so that the Pave Block cannot be further split. In this case, check if
// the vertices of the Pave Block do not interfere. And if they are, unify them.
Standard_Boolean bCheckDist = (bHasValidRange && !aPBN->IsSplittable());
if (!bHasValidRange || bCheckDist)
{
Standard_Integer nV1, nV2;
aPBN->Indices(nV1, nV2);
if (nV1 != nV2) {
if (nV1 == nV2)
// Same vertices -> no valid range, no need to unify vertices
continue;
// Decide whether to unify vertices or not
if (bCheckDist)
{
const TopoDS_Vertex& aV1 = TopoDS::Vertex(myDS->Shape(nV1));
const TopoDS_Vertex& aV2 = TopoDS::Vertex(myDS->Shape(nV2));
if (BOPTools_AlgoTools::ComputeVV(aV1, aV2, myFuzzyValue) == 0)
// vertices are interfering -> no valid range, unify vertices
bHasValidRange = Standard_False;
}
if (!bHasValidRange)
{
BOPDS_Pair aPair;
aPair.SetIndices(nV1, nV2);
if (aMPairs.Add(aPair)) {
BOPCol_ListOfInteger aLV;
if (aMPairs.Add(aPair))
{
TColStd_ListOfInteger aLV;
aLV.Append(nV1);
aLV.Append(nV2);
MakeSDVertices(aLV, theAddInterfs);
}
continue;
}
continue;
}
//
// Update the list with new pave block

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>
@@ -111,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;
//
@@ -147,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
@@ -214,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);
//
@@ -229,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);
//======================================================
@@ -347,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;
@@ -374,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;
@@ -413,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
@@ -440,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
@@ -497,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
@@ -507,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);
@@ -519,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);
@@ -540,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);
//
@@ -561,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);
@@ -574,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);
@@ -645,6 +645,9 @@ void BOPAlgo_PaveFiller::AnalyzeShrunkData(const Handle(BOPDS_PaveBlock)& thePB,
AddWarning (new BOPAlgo_AlertTooSmallEdge (aWarnShape));
else
AddWarning (new BOPAlgo_AlertBadPositioning (aWarnShape));
Standard_Real aTS1, aTS2;
theSR.ShrunkRange(aTS1, aTS2);
thePB->SetShrunkData(aTS1, aTS2, Bnd_Box(), Standard_False);
return;
}
//
@@ -664,9 +667,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;
@@ -675,20 +678,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;
@@ -707,7 +710,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
@@ -736,7 +739,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;
}
//=======================================================================
@@ -781,3 +786,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

@@ -19,9 +19,6 @@
#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>
@@ -31,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>
@@ -132,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;
@@ -204,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);
@@ -213,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);
//================================================================
@@ -234,7 +234,7 @@ void BOPAlgo_PaveFiller::PerformVF()
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
@@ -250,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) {
//
@@ -264,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()) {
@@ -316,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)));
@@ -324,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>
@@ -123,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;
@@ -167,9 +167,9 @@ void BOPAlgo_PaveFiller::PerformEF()
Standard_Boolean bV[2], bIsPBSplittable;
Standard_Boolean bV1, bV2, bExpressCompute;
Standard_Integer nV1, nV2;
Standard_Integer aDiscretize, i, aNbCPrts, iX, nV[2];
Standard_Integer i, aNbCPrts, iX, nV[2];
Standard_Integer aNbEdgeFace, k;
Standard_Real aTolE, aTolF, aTS1, aTS2, aT1, aT2, aDeflection;
Standard_Real aTolE, aTolF, aTS1, aTS2, aT1, aT2;
Handle(NCollection_BaseAllocator) aAllocator;
TopAbs_ShapeEnum aType;
BOPDS_ListIteratorOfListOfPaveBlock aIt;
@@ -178,14 +178,11 @@ 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);
//
aDiscretize=35;
aDeflection=0.01;
//
BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF();
aEFs.SetIncrement(iSize);
//
@@ -204,8 +201,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);
@@ -234,7 +231,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);
@@ -242,8 +239,6 @@ void BOPAlgo_PaveFiller::PerformEF()
aEdgeFace.SetEdge (aE);
aEdgeFace.SetFace (aF);
aEdgeFace.SetFuzzyValue(myFuzzyValue);
aEdgeFace.SetDiscretize (aDiscretize);
aEdgeFace.SetDeflection (aDeflection);
aEdgeFace.UseQuickCoincidenceCheck(bExpressCompute);
//
IntTools_Range aSR(aTS1, aTS2);
@@ -260,7 +255,7 @@ 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);
//=================================================================
@@ -306,8 +301,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) {
@@ -342,8 +337,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);
@@ -411,8 +406,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
@@ -431,8 +426,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);
@@ -462,7 +457,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();
@@ -480,12 +475,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;
//
@@ -514,11 +509,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;
//
@@ -557,7 +552,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);
@@ -572,7 +567,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
@@ -610,7 +605,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;
}
@@ -619,9 +614,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

@@ -19,9 +19,6 @@
#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>
@@ -29,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>
@@ -39,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>
@@ -52,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
@@ -142,7 +145,7 @@ class BOPAlgo_SplitEdge : public BOPAlgo_Algo {
myV1, myT1,
myV2, myT2,
myESp);
BRepBndLib::AddOptimal(myESp, myBox, Standard_True, Standard_True);
BRepBndLib::Add(myESp, myBox);
myBox.SetGap(myBox.GetGap() + Precision::Confusion());
}
//
@@ -166,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;
@@ -246,28 +249,56 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
{
OCC_CATCH_SIGNALS
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);
// 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);
}
//
if (iErr) {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF, myContext);
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(myE, myF);
UpdateVertices(aCopyE, myF);
}
}
catch (Standard_Failure)
@@ -275,7 +306,17 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
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;
@@ -285,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;
@@ -338,7 +381,7 @@ class BOPAlgo_BPC {
}
//
void Perform() {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnPlane (myE, myF, myCurve, myToUpdate);
BRepLib::BuildPCurveForEdgeOnPlane(myE, myF, myCurve, myToUpdate);
};
//
protected:
@@ -348,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;
//
@@ -367,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;
@@ -385,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);
//======================================================
@@ -525,7 +586,7 @@ Standard_Integer BOPAlgo_PaveFiller::SplitEdge(const Standard_Integer nE,
aSI.SetShape(aSp);
//
Bnd_Box& aBox=aSI.ChangeBox();
BRepBndLib::AddOptimal(aSp, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aSp, aBox);
aBox.SetGap(aBox.GetGap() + Precision::Confusion());
//
nSp=myDS->Append(aSI);
@@ -541,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;
@@ -550,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();
@@ -565,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);
@@ -593,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()) {
@@ -637,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);
}
}
@@ -687,18 +756,27 @@ void BOPAlgo_PaveFiller::MakePCurves()
BOPAlgo_MPCCnt::Perform(myRunParallel, aVMPC, myContext);
//======================================================
// Add warnings of the failed projections
Standard_Integer aNb = aVMPC.Extent();
// Add warnings of the failed projections and update edges with new pcurves
Standard_Integer aNb = aVMPC.Length();
for (i = 0; i < aNb; ++i)
{
if (aVMPC(i).HasErrors())
const BOPAlgo_MPC& aMPC = aVMPC(i);
if (aMPC.HasErrors())
{
TopoDS_Compound aWC;
BRep_Builder().MakeCompound(aWC);
BRep_Builder().Add(aWC, aVMPC(i).Edge());
BRep_Builder().Add(aWC, aVMPC(i).Face());
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());
}
}
}
//=======================================================================
@@ -762,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) {
@@ -791,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);
}
@@ -804,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>
@@ -40,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>
@@ -67,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

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

@@ -1,55 +0,0 @@
// Created on: 2002-03-04
// Created by: Michael KLOKOV
// Copyright (c) 2002-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.
#include <BOPAlgo_SectionAttribute.hxx>
//=======================================================================
// function: BOPAlgo_SectionAttribute
// purpose:
//=======================================================================
BOPAlgo_SectionAttribute::BOPAlgo_SectionAttribute(const Standard_Boolean Aproximation,
const Standard_Boolean PCurveOnS1,
const Standard_Boolean PCurveOnS2)
{
myApproximation = Aproximation;
myPCurve1 = PCurveOnS1;
myPCurve2 = PCurveOnS2;
}
//=======================================================================
// function: Approximation
// purpose:
//=======================================================================
void BOPAlgo_SectionAttribute::Approximation(const Standard_Boolean theFlag)
{
myApproximation = theFlag;
}
//=======================================================================
// function: PCurveOnS1
// purpose:
//=======================================================================
void BOPAlgo_SectionAttribute::PCurveOnS1(const Standard_Boolean theFlag)
{
myPCurve1 = theFlag;
}
//=======================================================================
// function: PCurveOnS2
// purpose:
//=======================================================================
void BOPAlgo_SectionAttribute::PCurveOnS2(const Standard_Boolean theFlag)
{
myPCurve2 = theFlag;
}

View File

@@ -16,75 +16,72 @@
#ifndef _BOPAlgo_SectionAttribute_HeaderFile
#define _BOPAlgo_SectionAttribute_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
//! Class is a container of three flags used
//! Class is a container of the flags used
//! by intersection algorithm
class BOPAlgo_SectionAttribute
class BOPAlgo_SectionAttribute
{
public:
DEFINE_STANDARD_ALLOC
//! Default constructor
BOPAlgo_SectionAttribute()
: myApproximation(Standard_True),
myPCurve1(Standard_True),
myPCurve2(Standard_True) {}
//! Constructor
BOPAlgo_SectionAttribute(const Standard_Boolean theAproximation,
const Standard_Boolean thePCurveOnS1,
const Standard_Boolean thePCurveOnS2)
: myApproximation(theAproximation),
myPCurve1(thePCurveOnS1),
myPCurve2(thePCurveOnS2) {}
//! Initializes me by flags
Standard_EXPORT BOPAlgo_SectionAttribute(const Standard_Boolean Aproximation = Standard_True, const Standard_Boolean PCurveOnS1 = Standard_True, const Standard_Boolean PCurveOnS2 = Standard_True);
//! Sets the Approximation flag
void Approximation(const Standard_Boolean theApprox)
{
myApproximation = theApprox;
}
//! Modifier
Standard_EXPORT void Approximation (const Standard_Boolean theFlag);
//! Sets the PCurveOnS1 flag
void PCurveOnS1(const Standard_Boolean thePCurveOnS1)
{
myPCurve1 = thePCurveOnS1;
}
//! Modifier
Standard_EXPORT void PCurveOnS1 (const Standard_Boolean theFlag);
//! Modifier
Standard_EXPORT void PCurveOnS2 (const Standard_Boolean theFlag);
//! Selector
Standard_Boolean Approximation() const;
//! Selector
Standard_Boolean PCurveOnS1() const;
//! Selector
Standard_Boolean PCurveOnS2() const;
//! Sets the PCurveOnS2 flag
void PCurveOnS2(const Standard_Boolean thePCurveOnS2)
{
myPCurve2 = thePCurveOnS2;
}
//! Returns the Approximation flag
Standard_Boolean Approximation() const
{
return myApproximation;
}
//! Returns the PCurveOnS1 flag
Standard_Boolean PCurveOnS1() const
{
return myPCurve1;
}
//! Returns the PCurveOnS2 flag
Standard_Boolean PCurveOnS2() const
{
return myPCurve2;
}
protected:
private:
Standard_Boolean myApproximation;
Standard_Boolean myPCurve1;
Standard_Boolean myPCurve2;
};
#include <BOPAlgo_SectionAttribute.lxx>
#endif // _BOPAlgo_SectionAttribute_HeaderFile

View File

@@ -1,41 +0,0 @@
// Created on: 2002-03-04
// Created by: Michael KLOKOV
// Copyright (c) 2002-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.
//=======================================================================
// function:Approximation
// purpose:
//=======================================================================
inline Standard_Boolean BOPAlgo_SectionAttribute::Approximation() const
{
return myApproximation;
}
//=======================================================================
// function:PCurveOnS1
// purpose:
//=======================================================================
inline Standard_Boolean BOPAlgo_SectionAttribute::PCurveOnS1() const
{
return myPCurve1;
}
//=======================================================================
// function:PCurveOnS2
// purpose:
//=======================================================================
inline Standard_Boolean BOPAlgo_SectionAttribute::PCurveOnS2() const
{
return myPCurve2;
}

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());
}
@@ -131,6 +91,7 @@ void BOPAlgo_Splitter::Perform()
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
pPF->SetUseOBB(myUseOBB);
//
pPF->Perform();
//

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());
};

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