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

Compare commits

..

9 Commits

Author SHA1 Message Date
nbv
99ecc57f23 Debug 2018-04-28 10:29:31 +03:00
nbv
7908f97c1b 0029523: Problem with BRepOffsetAPI_MakeEvolved
1. New class BRepFill_Voluved has been created in order to provide new OCCT-algorithm combining BRepFill_PipeShell and BOPAlgo_MakerVolume.

2. The interface of DRAW-command "evolved" has been corrected.

3. DRAW-command "evolvedsolid" has been deleted. Currently it can be replaced with DRAW-command "evolved" with specific options.

4. Some test cases have been corrected.

5. Testgrid "evolved" has been created.
2018-04-28 10:13:53 +03:00
nbv
9a49e2ce57 # Warning: Building 2D curve of edge on face has failed.
(cherry picked from commit d0d712265120631f5cc58c3d480492e79a6c5123)
2018-04-28 09:31:21 +03:00
nbv
bf878e54e3 # Walking hangs 2018-04-28 09:31:20 +03:00
nbv
efb8681bfc 0029663: Exception in BRepFill_PipeShell algorithm
BRepFill_Sweep algorithm is improved to handle cases when generated revolution surface has degenerated point in the middle.

Added test bugs modalg_7 bug29663

TODO added in test bugs modalg_1 bug1477_11: here two additional self-intersecting faces are now created, previously missing from the result.

(cherry picked from commit c37f570215)
2018-04-28 09:31:18 +03:00
nbv
34b2e62bd6 0029660: Misprint in BuildEdge(...) static function of BRepFill_Sweep.cxx file
Misprint has been eliminated.

(cherry picked from commit 10a55e0d05)
2018-04-28 09:31:16 +03:00
jgv
8c2adc035d 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.

(cherry picked from commit 833e75611f)
2018-04-28 09:31:15 +03:00
emv
a829053aed 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.

(cherry picked from commit 0a807dd9a3)
2018-04-28 09:31:13 +03:00
emv
f109d88899 0029073: Regression: General Cut produces invalid shape
Boolean Operations:
1. Face/Face intersection post treatment - Unify vertices put on the section curves, which were rejected as existing ones, with the vertices of edges by which these section curves have been rejected.

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

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

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

3. Print messages for the Warnings/Errors met during checking of the shape on self-intersection ("bopcheck" command).

(cherry picked from commit ad8b073e19)
2018-04-19 15:33:38 +03:00
827 changed files with 20721 additions and 21021 deletions

2
.gitignore vendored
View File

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

View File

@@ -25,7 +25,7 @@ if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
endif()
endif()
if (MSVC)
if (WIN32)
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")

View File

@@ -211,11 +211,9 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
string (REGEX MATCH "^TK" TK_FOUND ${USED_ITEM})
string (REGEX MATCH "^vtk" VTK_FOUND ${USED_ITEM})
if (NOT "${TK_FOUND}" STREQUAL "")
if (NOT "${TK_FOUND}" STREQUAL "" OR NOT "${VTK_FOUND}" STREQUAL "")
list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT ${USED_ITEM})
elseif (NOT "${VTK_FOUND}" STREQUAL "")
list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${USED_ITEM})
if (BUILD_SHARED_LIBS AND INSTALL_VTK AND COMMAND OCCT_INSTALL_VTK)
if (NOT "${VTK_FOUND}" STREQUAL "" AND BUILD_SHARED_LIBS AND INSTALL_VTK AND COMMAND OCCT_INSTALL_VTK)
OCCT_INSTALL_VTK(${USED_ITEM})
endif()
else()
@@ -278,29 +276,18 @@ endif()
if("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL2")
add_definitions(-DVTK_OPENGL2_BACKEND)
foreach (VTK_EXCLUDE_LIBRARY vtkRenderingOpenGL vtkRenderingFreeTypeOpenGL)
list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT "${VTK_EXCLUDE_LIBRARY}" IS_VTK_OPENGL_FOUND)
list (FIND USED_TOOLKITS_BY_CURRENT_PROJECT "${VTK_EXCLUDE_LIBRARY}" IS_VTK_OPENGL_FOUND)
if (NOT ${IS_VTK_OPENGL_FOUND} EQUAL -1)
list (REMOVE_ITEM USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${VTK_EXCLUDE_LIBRARY})
list (REMOVE_ITEM USED_TOOLKITS_BY_CURRENT_PROJECT ${VTK_EXCLUDE_LIBRARY})
if (${VTK_EXCLUDE_LIBRARY} STREQUAL vtkRenderingOpenGL)
list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT vtkRenderingOpenGL2)
if(VTK_MAJOR_VERSION GREATER 6)
list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT vtkRenderingGL2PSOpenGL2)
endif()
list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT vtkRenderingOpenGL2)
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_EXTERNAL_LIBS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL" IS_VTK_RENDER_FREETYPE_FOUND)
if (NOT ${IS_VTK_RENDER_FREETYPE_FOUND} EQUAL -1)
list (REMOVE_ITEM USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL")
endif()
endif()
endif()
if (BUILD_SHARED_LIBS)
target_link_libraries (${PROJECT_NAME} PUBLIC ${USED_TOOLKITS_BY_CURRENT_PROJECT})
target_link_libraries (${PROJECT_NAME} PRIVATE ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
endif()
# suppress deprecation warnings inside OCCT itself for old gcc versions with unavailable Standard_DISABLE_DEPRECATION_WARNINGS

View File

@@ -142,6 +142,9 @@ proc wokdep:gui:UpdateList {} {
if { "$::HAVE_GL2PS" == "true" } {
lappend anIncErrs "Error: gl2ps can not be used with OpenGL ES"
}
if { "$::HAVE_D3D" == "true" } {
lappend anIncErrs "Error: Direct3D can not be used with OpenGL ES"
}
wokdep:SearchEGL anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
wokdep:SearchGLES anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}

View File

@@ -655,8 +655,6 @@ proc OCCDoc_Main {docType {docfiles {}} {modules {}} generatorMode verboseMode s
# Generates Doxygen configuration file for Overview documentation
proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMode ""} {DocFilesList {}} {ModulesList {}} verboseMode searchMode hhcPath mathjaxLocation graphvizPath productsPath} {
global module_dependency
set inputDir [OCCDoc_GetDoxDir [OCCDoc_GetProdRootDir]]
set TEMPLATES_DIR [OCCDoc_GetDoxDir]/resources
@@ -727,16 +725,6 @@ proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMod
set name OCCT
}
OCCDoc_LoadData "${productsPath}"
# Add all dependencies of modules to the graph
set additional_modules {}
foreach module $modules {
set additional_modules [list {*}$additional_modules {*}$module_dependency($module)]
}
set modules [list {*}$modules {*}$additional_modules]
set modules [lsort -unique $modules]
# Get list of header files in the specified modules
set filelist {}
foreach module $modules {

View File

@@ -82,8 +82,6 @@ set "VisualStudioExpressName=VCExpress"
if not "%DevEnvDir%" == "" (
rem If DevEnvDir is already defined (e.g. in custom.bat), use that value
) else if /I "%VCFMT%" == "vc9" (
set "DevEnvDir=%VS90COMNTOOLS%..\IDE"
) else if /I "%VCFMT%" == "vc10" (
set "DevEnvDir=%VS100COMNTOOLS%..\IDE"
) else if /I "%VCFMT%" == "vc11" (
@@ -103,22 +101,12 @@ if not "%DevEnvDir%" == "" (
) else if /I "%VCFMT%" == "gcc" (
rem MinGW
) else (
echo Error: first argument ^(%VCVER%^) should specify supported version of Visual C++,
echo one of:
echo vc9 = VS 2008 ^(SP1^)
echo vc10 = VS 2010 ^(SP3^)
echo vc11 = VS 2012 ^(SP3^)
echo vc12 = VS 2013 ^(SP3^)
echo vc14 = VS 2015
echo vc141 = VS 2017
echo Error: wrong VS identifier
exit /B
)
rem ----- Parsing vcvarsall for qt samples and define PlatformToolset -----
if /I "%VCFMT%" == "vc9" (
set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
set "VCPlatformToolSet=v90"
) else if /I "%VCFMT%" == "vc10" (
if /I "%VCFMT%" == "vc10" (
set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
set "VCPlatformToolSet=v100"
) else if /I "%VCFMT%" == "vc11" (
@@ -138,8 +126,9 @@ if /I "%VCFMT%" == "vc9" (
) else if /I "%VCFMT%" == "gcc" (
rem MinGW
) else (
echo Error: wrong VS identifier
exit /B
echo Error: first argument ^(%VCVER%^) should specify supported version of Visual C++,
echo one of: vc10 ^(VS 2010 SP3^), vc11 ^(VS 2012 SP3^), vc12 ^(VS 2013^) or vc14 ^(VS 2015^)
exit
)
set "CSF_OPT_LIB32D=%CSF_OPT_LIB32%"

View File

@@ -52,8 +52,6 @@ set "VisualStudioExpressName=VCExpress"
if not "%DevEnvDir%" == "" (
rem If DevEnvDir is already defined (e.g. in custom.bat), use that value
) else if /I "%VCFMT%" == "vc9" (
set "DevEnvDir=%VS90COMNTOOLS%..\IDE"
) else if /I "%VCFMT%" == "vc10" (
set "DevEnvDir=%VS100COMNTOOLS%..\IDE"
) else if /I "%VCFMT%" == "vc11" (
@@ -78,10 +76,7 @@ if not "%DevEnvDir%" == "" (
)
rem ----- Parsing vcvarsall for qt samples and define PlatformToolset -----
if /I "%VCFMT%" == "vc9" (
set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
set "VCPlatformToolSet=v90"
) else if /I "%VCFMT%" == "vc10" (
if /I "%VCFMT%" == "vc10" (
set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
set "VCPlatformToolSet=v100"
) else if /I "%VCFMT%" == "vc11" (

View File

@@ -24,7 +24,6 @@
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -121,7 +120,7 @@
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
ManagedExtensions="0"
>
<Tool
Name="VCPreBuildEventTool"
@@ -219,7 +218,6 @@
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -313,7 +311,7 @@
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
ManagedExtensions="0"
>
<Tool
Name="VCPreBuildEventTool"

282
data/occ/Box.brep Normal file
View File

@@ -0,0 +1,282 @@
DBRep_DrawableShape
CASCADE Topology V1, (c) Matra-Datavision
Locations 0
Curve2ds 24
1 0 0 1 0
1 0 0 1 0
1 50 0 0 -1
1 0 0 0 1
1 0 -80 1 0
1 0 0 1 0
1 0 0 0 -1
1 0 0 0 1
1 0 0 1 0
1 0 77 1 0
1 50 0 0 -1
1 77 0 0 1
1 0 -80 1 0
1 0 77 1 0
1 0 0 0 -1
1 77 0 0 1
1 0 0 0 1
1 0 0 1 0
1 50 0 0 1
1 0 0 1 0
1 0 0 0 1
1 0 80 1 0
1 50 0 0 1
1 0 80 1 0
Curves 12
1 821 803 0 0 0 1
1 821 803 50 0 1 0
1 821 883 0 0 0 1
1 821 803 0 0 1 0
1 898 803 0 0 0 1
1 898 803 50 0 1 0
1 898 883 0 0 0 1
1 898 803 0 0 1 0
1 821 803 0 1 0 0
1 821 803 50 1 0 0
1 821 883 0 1 0 0
1 821 883 50 1 0 0
Polygon3D 0
PolygonOnTriangulations 0
Surfaces 6
1 821 803 0 1 0 0 0 0 1 0 -1 0
1 821 803 0 0 1 0 0 0 1 1 0 0
1 821 803 50 0 0 1 1 0 0 0 1 0
1 821 883 0 0 1 0 0 0 1 1 0 0
1 821 803 0 0 0 1 1 0 0 0 1 0
1 898 803 0 1 0 0 0 0 1 0 -1 0
Triangulations 0
TShapes 34
Ve
1e-007
821 803 50
0 0
0101100
*
Ve
1e-007
821 803 0
0 0
0101100
*
Ed
1e-007 1 1 0
1 1 0 0 50
2 1 1 0 0 50
2 2 2 0 0 50
0
0101000
-34 0 +33 0 *
Ve
1e-007
821 883 50
0 0
0101100
*
Ed
1e-007 1 1 0
1 2 0 0 80
2 3 1 0 0 80
2 4 3 0 0 80
0
0101000
-31 0 +34 0 *
Ve
1e-007
821 883 0
0 0
0101100
*
Ed
1e-007 1 1 0
1 3 0 0 50
2 5 1 0 0 50
2 6 4 0 0 50
0
0101000
-31 0 +29 0 *
Ed
1e-007 1 1 0
1 4 0 0 80
2 7 1 0 0 80
2 8 5 0 0 80
0
0101000
-29 0 +33 0 *
Wi
0101000
-32 0 -30 0 +28 0 +27 0 *
Fa
0 1e-007 1 0
0111000
+26 0 *
Ve
1e-007
898 803 50
0 0
0101100
*
Ve
1e-007
898 803 0
0 0
0101100
*
Ed
1e-007 1 1 0
1 5 0 0 50
2 9 6 0 0 50
2 10 2 0 0 50
0
0101000
-24 0 +23 0 *
Ve
1e-007
898 883 50
0 0
0101100
*
Ed
1e-007 1 1 0
1 6 0 0 80
2 11 6 0 0 80
2 12 3 0 0 80
0
0101000
-21 0 +24 0 *
Ve
1e-007
898 883 0
0 0
0101100
*
Ed
1e-007 1 1 0
1 7 0 0 50
2 13 6 0 0 50
2 14 4 0 0 50
0
0101000
-21 0 +19 0 *
Ed
1e-007 1 1 0
1 8 0 0 80
2 15 6 0 0 80
2 16 5 0 0 80
0
0101000
-19 0 +23 0 *
Wi
0101000
-22 0 -20 0 +18 0 +17 0 *
Fa
0 1e-007 6 0
0111000
+16 0 *
Ed
1e-007 1 1 0
1 9 0 0 77
2 17 2 0 0 77
2 18 5 0 0 77
0
0101000
-23 0 +33 0 *
Ed
1e-007 1 1 0
1 10 0 0 77
2 19 2 0 0 77
2 20 3 0 0 77
0
0101000
-24 0 +34 0 *
Wi
0101000
-14 0 -22 0 +13 0 +32 0 *
Fa
0 1e-007 2 0
0111000
+12 0 *
Ed
1e-007 1 1 0
1 11 0 0 77
2 21 4 0 0 77
2 22 5 0 0 77
0
0101000
-19 0 +29 0 *
Ed
1e-007 1 1 0
1 12 0 0 77
2 23 4 0 0 77
2 24 3 0 0 77
0
0101000
-21 0 +31 0 *
Wi
0101000
-10 0 -18 0 +9 0 +28 0 *
Fa
0 1e-007 4 0
0111000
+8 0 *
Wi
0101000
-27 0 -10 0 +17 0 +14 0 *
Fa
0 1e-007 5 0
0111000
+6 0 *
Wi
0101000
-30 0 -9 0 +20 0 +13 0 *
Fa
0 1e-007 3 0
0111000
+4 0 *
Sh
0101100
-25 0 +15 0 -11 0 +7 0 -5 0 +3 0 *
So
1100000
+2 0 *
+1 0

File diff suppressed because one or more lines are too long

View File

@@ -479,8 +479,6 @@ 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

@@ -192,11 +192,7 @@ Use prefix <i>bug</i> followed by Mantis issue ID and, if necessary, additional
* If the test case reports error due to an existing problem and the fix is not available, add @ref testmanual_3_6 "TODO" statement for each error to mark it as a known problem. The TODO statements must be specific so as to match the actually generated messages but not all similar errors.
* To check expected output which should be obtained as the test result, add @ref testmanual_3_7 "REQUIRED" statement for each line of output to mark it as required.
* If the test case produces error messages (contained in parse.rules), which are expected in that test and should not be considered as its failure (e.g. test for *checkshape* command), add REQUIRED statement for each error to mark it as required output.
4. To check whether the data files needed for the test are already present in the database, use DRAW command *testfile* (see below).
If the data file is already present, use it for new test instead of adding a duplicate.
If the data file(s) are not yet present in the test database, put them to some folder and add it to the environment variable *CSF_TestDataPath* to be found by the test system.
Information on where the data files can be accessed by OCC team for putting to official database should be provided in comment to Mantis issue, clearly indicating how names of the files used by the test script match the actual names of the files.
The simplest way is to attach the data files to the Mantis issue, with the same names as used by the test script.
4. If the test uses data file(s) that are not yet present in the test database, it is possible to put them to (sub)directory pointed out by *CSF_TestDataPath* variable for running test. The files should be attached to the Mantis issue corresponding to the tested modification.
5. Check that the test case runs as expected (test for fix: OK with the fix, FAILED without the fix; test for existing problem: BAD), and integrate it to the Git branch created for the issue.
Example:
@@ -222,33 +218,6 @@ fixshape result a 0.01 0.01
checkshape result
~~~~~
DRAW command testfile should be used to check the data files being used by the test for possible duplication of content or names.
The command accepts list of paths to files being checked as single argument, and will give conclusion on each of the files, for instance:
~~~~~
Draw[1]> testfile [glob /my/data/path/bug12345*]
Collecting info on test data files repository...
Checking new file(s)...
* /my/data/path/bug12345.brep: duplicate
already present under name bug28773_1.brep
--> //server/occt_tests_data/public/brep/bug28773_1.brep
* /my/data/path/cadso.brep: new file
Warning: DOS encoding detected, consider converting to
UNIX unless DOS line ends are needed for the test
Warning: shape contains triangulation (946 triangles),
consider removing them unless they are needed for the test!
BREP size=201 KiB, nbfaces=33, nbedges=94 -> private
* /my/data/path/case_8_wire3.brep: already present
--> //server/occt_tests_data/public/brep/case_8_wire3.brep
* /my/data/path/case_8_wire4.brep: error
name is already used by existing file
--> //server/occt_tests_data/public/brep/case_8_wire4.brep
~~~~~
@section testmanual_2 Organization of Test Scripts
@subsection testmanual_2_1 General Layout

View File

@@ -28,22 +28,13 @@ https://www.opencascade.com
License
--------
Open CASCADE Technology is free software; you can redistribute it and / or modify it under the terms of the
@ref license_lgpl_21 "GNU Lesser General Public License (LGPL) version 2.1", with additional @ref occt_lgpl_exception "exception".
Open CASCADE Technology is free software; you can redistribute it and / or
modify it under the terms of the
@ref license_lgpl_21 "GNU Lesser General Public License (LGPL) version 2.1",
with additional @ref occt_lgpl_exception "exception".
Note that LGPL imposes some obligations on the application linked with Open CASCADE Technology.
If you wish to use OCCT in a proprietary application, please, pay special attention to address the requirements of LGPL section 6.
At minimum the following should be considered:
1. Add the notice visible to the users of your application clearly stating that Open CASCADE Technology is used in this application, and that they have rights in this regard according to LGPL.
Such notice can be added in About dialog box (this is mandatory if this box contains copyright statements) or a similar place and/or in the documentation.
The text of LGPL license should be accessible to the user.
2. Make the copy of OCCT sources used by the application available to its users, and if necessary provide instructions on how to build it in a way compatible with the application.
3. Ensure that the user actually can exercise the right to run your application with a modified version of OCCT.
If the application is distributed in a form that does not allow the user to modify OCCT part (e.g. the application is linked to OCCT statically or is distributed via AppStore on iOS, GooglePlay on Android, Windows Store, etc.),
the application should be provided separately in a modifiable form, with all materials needed for the user to be able to run the application with a modified version of OCCT.
If you want to use Open CASCADE Technology without being bound by LGPL requirements,
please <a href="https://www.opencascade.com/contact">contact Open CASCADE company</a> for a commercial license.
Alternatively, Open CASCADE Technology may be used under the terms of Open
CASCADE commercial license or contractual agreement.
Note that Open CASCADE Technology is provided on an "AS IS" basis, WITHOUT
WARRANTY OF ANY KIND. The entire risk related to any use of the OCCT code and
@@ -205,9 +196,9 @@ for which OCCT is certified to work.
| OS | Compiler |
| --------- | ----------- |
| Windows | Microsoft Visual Studio: 2008 SP1, 2010 SP1<sup>1</sup>, 2012 Update 4, 2013 Update 5, 2015, 2017 <br> GCC 4.3+ (Mingw-w64)|
| Windows | Microsoft Visual Studio: 2010 SP1<sup>1</sup>, 2012 Update 4, 2013 Update 5, 2015, 2017 <br> Intel C++ Composer XE 2013 SP1 <br> GCC 4.3+ (Mingw-w64)|
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
| OS X / macOS | XCode 6 or newer |
| OS X | XCode 6 or newer |
| Android | NDK r10, GNU gcc 4.8 or newer |
1) VC++ 10 64-bit is used for regular testing and for building

View File

@@ -2718,38 +2718,6 @@ To enable the safe processing mode for the operation in DRAW, it is necessary to
bnondestructive 1
~~~~
@subsection occt_algorithms_11a_4 Disabling check of the input solids for inverted status
By default, all input solids are checked for inverted status, i.e. the solids are classified to understand if they are holes in the space (negative volumes) or normal solids (positive volumes). The possibility to disable the check of the input solids for inverted status is the advanced option in Boolean Operation component. This option can be applied to all Basic operations such as General Fuse, Splitting, Boolean, Section, Maker Volume, Cells building.
This option allows avoiding time-consuming classification of the input solids and operate with them as with positive volumes, saving up to 10 percent of time on the cases with big number of input solids.
The classification should be disabled only if the user is sure that there are no negative volumes among the input solids, otherwise the result may be invalid.
@subsubsection occt_algorithms_11a_4_1 Usage
#### API level
To enable/disable the classification of the input solids it is necessary to call *SetCheckInverted()* method with the appropriate value:
~~~~
BOPAlgo_Builder aGF;
//
....
// disabling the classification of the input solid
aGF.SetCheckInverted(Standard_False);
//
....
~~~~
#### TCL level
To enable/disable the classification of the solids in DRAW, it is necessary to call the *bcheckinverted* command with appropriate value:
* 0 - disabling the classification;
* 1 - default value, enabling the classification.
~~~~
bcheckinverted 0
~~~~
@section occt_algorithms_ers Errors and warnings reporting system
The chapter describes the Error/Warning reporting system of the algorithms in the Boolean Component.

View File

@@ -1481,7 +1481,7 @@ General types of STEP entities imported by OCCT are listed in the table below:
|Datum_Feature|XCAFDoc_Datum|
|Datum_Target|XCAFDoc_Datum|
Processing of GD&T is realized in accordance with <a href="https://www.cax-if.org/documents/rec_pracs_pmi_v40.pdf">Recommended practices for the Representation and Presentation of Product Manufacturing</a> for AP242.
Processing of GD&T is realized in accordance with <a href="http://www.cax-if.org/documents/rec_pracs_pmi_v40.pdf">Recommended practices for the Representation and Presentation of Product Manufacturing</a> for AP242.
The general restriction is that OCCT STEP Reader imports GD&T assigned only to shapes (faces, edges, vertices, etc) or to shape groups from general shape model i.e. any constructive geometries are not translated as referenced shapes.
#### Dimensions

View File

@@ -91,59 +91,26 @@ 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)
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:
* 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:
* 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.
@subsection occt_xde_1_8 Clipping planes
XDE supports reading from STEP and storing named planes used for clipping.
Currently, XDE supports saving of clipping planes in XBF format only.
XDE provides capabilities for adding, editing and removing clipping planes.
@subsection occt_xde_1_9 Saved views
XDE supports reading from STEP views. Views allow to save information about camera parameters (position, direction, zoom factor, etc.)
and visible shapes, PMIs, used clipping planes and notes. Currently, XDE supports saving of clipping planes in XBF format only.
XDE provides the following view management capabilities:
* add/remove views;
* set view camera parameters;
* set visible shapes, PMIs, used clipping planes and notes.
@subsection occt_xde_1_10 Custom notes
@subsection occt_xde_1_7 Custom notes
Custom notes is a kind of application-specific data attached to assembly items, their attributes and sub-shapes. Basically, there are simple textual comments, binary data and other application-specific data. Each note is provided with a timestamp and the user who created it.
Custom notes is a kind of application specific data attached to assembly items, their attributes and sub-shapes. Basically, there are simple textual comments, binary data and other application specific data. Each note is provided with a timestamp and the user created it.
Notes API provides the following functionality:
* Returns the total number of notes and annotated items;
* Returns labels for all notes and annotated items;
* Returns total number of notes and annotated items
* Returns labels for all notes and annotated items
* Creates notes:
- Comment note from a text string;
- Binary data note from a file or byte array;
* Checks if an assembly item is annotated;
* Finds a label for the annotated item;
* Returns all note labels for the annotated item;
* Adds a note to item(s):
- Assembly item;
- Assembly item attribute;
- Assembly item subshape index;
* Removes note(s) from an annotated assembly item; orphan note(s) might be deleted optionally (items without linked notes will be deleted automatically);
* Deletes note(s) and removes them from annotated items;
* Gets / deletes orphan notes.
- Comment note from a text string
- Binary data note from a file or byte array
* Checks if an assembly item is annotated
* Finds a label for the annotated item
* Returns all note labels for the annotated item
* Add a note to item(s):
- Assembly item
- Assembly item attribute
- Assembly item subshape index
* Remove note(s) from an annotated assembly item; orphan note(s) might be deleted optionally (items without linked notes will be deleted automatically)
* Delete note(s) and removes them from annotated items
* Get / delete orphan notes
@section occt_xde_2 Working with XDE
@@ -537,7 +504,7 @@ XDE can read and write colors and layers assigned to shapes or their subparts (d
@figure{/user_guides/xde/images/239_xde_12_400.png,"Motor Head",240}
In an XDE document, colors are managed by the class *XCAFDoc_ColorTool*. 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 an *XCAFDoc_Color*, sub-class of *TDF_Attribute*.
In an XDE document, colors are managed by the class *XCAFDoc_ColorTool*. This is done with the same principles as for ShapeTool with Shapes, and with the same capability of having a tool on the Main Label, or on any sub-label. The Property itself is defined as an *XCAFDoc_Color*, sub-class of *TDF_Attribute*.
Colors are stored in a child of the starting document label: it is the second level (0.1.2), while Shapes are at the first level. Each color then corresponds to a dedicated label, the property itself is a Quantity_Color, which has a name and value for Red, Green, Blue. A Color may be attached to Surfaces (flat colors) or to Curves (wireframe colors), or to both. A Color may be attached to a sub-shape. In such a case, the sub-shape (and its own sub-shapes) takes its own Color as a priority.
@@ -660,277 +627,29 @@ 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 Custom notes
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, custom notes are managed by the class *XCAFDoc_NotesTool*. This is done with the same principles as for ShapeTool with Shapes, and with the same capability of having a tool on the Main Label, or on any sub-label. The Property itself is defined as sub-classes of an *XCAFDoc_Note* abstract class, which is a sub-class of *TDF_Attribute* one.
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
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:
* *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.
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:
~~~~~
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.
@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
created entity.
Here is an example of adding a new dimension:
~~~~~
TDF_Label aDimLabel = myDimTolTool->AddDimension();
if (!aDimLabel.IsNull())
{
// error processing
}
~~~~~
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
below, where the dimension becomes the linear distance between two points.
~~~~~
Handle(XCAFDoc_Dimension) aDimAttr;
aDimLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimAttr);
if (!aDimAttr.IsNull())
{
Handle(XCAFDimTolObjects_DimensionObject) aDimObject = aDimAttr->GetObject();
// set dimension data
aDimObject->SetType(XCAFDimTolObjects_DimensionType_Location_LinearDistance);
aDimObject->SetPoint(thePnt1); // the first reference point
aDimObject->SetPoint2(thePnt2); // the second reference point
aDimObject->SetValue(theValue); // the distance value
//...
aDimAttr->SetObject(aDimObject);
}
~~~~~
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:
* *SetDimension* - for dimensions;
* *SetGeomTolerance* - for geometric tolerances;
* SetDatum - for geometric tolerance datums.
These methods can take a single label or a sequence of labels. All previous links will be removed.
The example below demonstrates linking of a dimension to sequences of shape labels:
~~~~~
TDF_LabelSequence aShapes1, aShapes2;
aShapes1.Append(aShape11);
//...
aShapes2.Append(aShape21);
//...
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
*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*.
*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
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:
* 1 - 17 - for dimensions;
* 1 - 17 - for geometric tolerances;
* 1 - 19 - for datums.
Custom data can be stored in labels with tags beyond the ranges listed above.
@subsection occt_xde_2_8 Clipping planes
In an XDE document, Clipping planes are managed by the class *XCAFDoc_ClippingPlaneTool*. 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. Clipping planes are stored in a child of the starting document label 0.1.8, where planes themselves are defined as *TDataXtd_Plane* attribute. *TDataStd_Name* attribute is used for naming.
To query, edit, or initialize a Document to handle clipping planes of XCAF, use:
~~~~~
Handle(XCAFDoc_ClippingPlaneTool) myClipPlaneTool =
XCAFDoc_DocumentTool::ClippingPlaneTool(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.
To add a clipping plane use one of overloaded methods *AddClippingPlane*, e.g.:
~~~~~
gp_Pln aPln = ...
Standard_Boolean aCapping = ...
TDF_Label aClipPlnLbl = myClipPlaneTool->AddClippingPlane(aPln, "Name of plane", aCapping);
if (aClipPlnLbl.IsNull())
{
// error processing
}
~~~~~
To remove a plane use *RemoveClippingPlane* method, e.g.:
~~~~~
if (!myClipPlaneTool->RemoveClippingPlane(aClipPlnLbl))
{
// not removed
}
~~~~~
The plane will not be removed if it is referenced in at least one view.
To change clipping plane and its name use *UpdateClippingPlane* method, e.g.:
~~~~~
gp_Pln aPln = ...
myClipPlaneTool->UpdateClippingPlane(aClipPlnLbl, aPln, "New name of plane");
~~~~~
Capping property can be changed using *SetCapping* method, e.g.:
~~~~~
Standard_Boolean aCapping = ...
myClipPlaneTool->SetCapping(aClipPlnLbl, aCapping);
~~~~~
*XCAFDoc_ClippingPlaneTool* can be used to get all clipping plane labels and to check if a label belongs to the ClippingPlane table, e.g.:
~~~~~
TDF_LabelSequence aClipPlaneLbls;
myClipPlaneTool->GetClippingPlanes(aClipPlaneLbls);
...
for (TDF_LabelSequence::Iterator anIt(aClipPlaneLbls); anIt.More(); anIt.Next())
{
if (myClipPlaneTool->IsClippingPlane(anIt.Value()))
{
// the label is a clipping plane
gp_Pln aPln;
TCollection_ExtendedString aName;
Standard_Boolean aCapping;
if (!myClipPlaneTool->GetClippingPlane(anIt.Value(), aPln, aName, aCapping))
{
// error processing
}
...
}
}
~~~~~
@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.
To query, edit, or initialize a Document to handle views of XCAF, use:
~~~~~
Handle(XCAFDoc_ViewTool) myViewTool =
XCAFDoc_DocumentTool::ViewTool(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.
To add a view use *AddView* method and an access *XCAFView_Object* object to set camera parameters, e.g.:
~~~~~
TDF_Label aViewLbl = myViewTool->AddView();
if (aViewLbl.IsNull())
{
// error processing
}
Handle(XCAFDoc_View) aViewAttr;
aViewLbl.FindAttribute(XCAFDoc_View::GetID(), aViewAttr);
if (!aViewAttr.IsNull())
{
Handle(XCAFView_Object) aViewObject = aViewAttr->GetObject();
// set view data
aViewObject->SetType(XCAFView_ProjectionType_Parallel);
aViewObject->SetViewDirection(theViewDir);
aViewObject->SetZoomFactor(2.0);
...
aViewAttr->SetObject(aViewObject);
}
~~~~~
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; ...
TDF_LabelSequence aGDTs; ...
myViewTool->SetView(aShapes, aGDTs, aViewLbl);
TDF_LabelSequence aClippingPlanes; ...
myViewTool->SetClippingPlanes(aClippingPlanes, aViewLbl);
~~~~~
To remove a view use *RemoveView* method.
To get all view labels and check if a label belongs to the View table use:
~~~~~
TDF_LabelSequence aViewLbls;
myViewTool->GetViewLabels(aViewLbls);
...
for (TDF_LabelSequence::Iterator anIt(aViewLbls); anIt.More(); anIt.Next())
{
if (myViewTool->IsView(anIt.Value()))
{
// the label is a view
...
}
}
~~~~~
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:
* *GetViewLabelsForShape* - returns a sequence of associated view labels for a shape;
* *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.
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.
Custom notes are stored in a child of the *XCAFDoc_NotesTool* label: it is 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: it is at label 0.1.9.2.
Notes binding is done through *XCAFDoc_GraphNode* attribute.
@figure{/user_guides/xde/images/xde_notes001.png,"Structure of notes part of XCAF document",240}
@subsubsection occt_xde_2_10_1 Initialization
@subsubsection occt_xde_2_7_1 Initialization
To query, edit, or initialize a Document to handle custom notes of XCAF, use:
~~~~~
Handle(XCAFDoc_NotesTool) myNotes =
XCAFDoc_DocumentTool::NotesTool(Doc->Main ());
~~~~~
This call can be used at any time. The first time it is used, a relevant structure is added to the document. This definition is used for all later notes calls and will not be repeated for them.
This call can be used at any time. The first time it is used, a relevant structure is added to the document. This definition is used for all the following notes calls and will not be repeated for these.
@subsubsection occt_xde_2_10_2 Creating Notes
@subsubsection occt_xde_2_7_2 Creating Notes
Before annotating a Document item a note must be created using one of the following methods of *XCAFDoc_NotesTool* class:
- *CreateComment* : creates a note with a textual comment;
- *CreateBinData* : creates a note with arbitrary binary data, e.g. contents of a file.
- CreateComment : creates a note with a textual comment
- CreateBinData : creates a note with arbitrary binary data, e.g. contents of a file
Both methods return an instance of *XCAFDoc_Note* class.
~~~~~
@@ -939,13 +658,13 @@ Handle(XCAFDoc_Note) myNote = myNotes->CreateComment("User", "Timestamp", "Hello
~~~~~
This code adds a child label to label 0.1.9.1 with *XCAFDoc_NoteComment* attribute.
@subsubsection occt_xde_2_10_3 Editing a Note
@subsubsection occt_xde_2_7_3 Editing a Note
An instance of *XCAFDoc_Note* class can be used for note editing.
One may change common note data.
~~~~~
myNote->Set("New User", "New Timestamp");
~~~~~
To change specific data one needs to down cast *myNote* handle to the appropriate sub-class:
To change specific data one need to down cast *myNote* handle to the appropriate sub-class:
~~~~~
Handle(XCAFDoc_NoteComment) myCommentNote = Handle(XCAFDoc_NoteComment)::DownCast(myNote);
if (!myCommentNote.IsNull()) {
@@ -953,12 +672,12 @@ if (!myCommentNote.IsNull()) {
}
~~~~~
@subsubsection occt_xde_2_10_4 Adding Notes
@subsubsection occt_xde_2_7_4 Adding Notes
Once a note has been created it can be bound to a Document item using the following *XCAFDoc_NotesTool* methods:
- *AddNote* : binds a note to a label;
- *AddNoteToAttr* : binds a note to a label's attribute;
- *AddNoteToSubshape* : binds a note to a sub-shape.
- AddNote : binds a note to a label
- AddNoteToAttr : binds a note to a label's attribute
- AddNoteToSubshape : binds a note to a sub-shape
All methods return a pointer to *XCAFDoc_AssemblyItemRef* attribute identifying the annotated item.
~~~~~
@@ -971,14 +690,14 @@ Handle(XCAFDoc_AssemblyItemRef) myRefAttr = myNotes->AddNoteToAttr(myNote->Label
Standard_Integer theSubshape = 1;
Handle(XCAFDoc_AssemblyItemRef) myRefSubshape = myNotes->AddNoteToSubshape(myNote->Label(), theSubshape);
~~~~~
This code adds three child labels with *XCAFDoc_AssemblyItemRef* attribute to label 0.1.9.2. *XCAFDoc_GraphNode* attributes are added to the child labels and note labels.
This code adds three child labels to label 0.1.9.2 with *XCAFDoc_AssemblyItemRef* attribute with *XCAFDoc_GraphNode* attributes added to this and note labels.
@subsubsection occt_xde_2_10_5 Finding Notes
@subsubsection occt_xde_2_7_5 Finding Notes
To find annotation labels under label 0.1.9.2 use the following *XCAFDoc_NotesTool* methods:
- *FindAnnotatedItem* : returns an annotation label for a label;
- *FindAnnotatedItemAttr* : returns an annotation label for a label's attribute;
- *FindAnnotatedItemSubshape* : returns an annotation label for a sub-shape.
- FindAnnotatedItem : returns an annotation label for a label
- FindAnnotatedItemAttr : returns an annotation label for a label's attribute
- FindAnnotatedItemSubshape : returns an annotation label for a sub-shape
~~~~~
Handle(XCAFDoc_NotesTool) myNotes = ...
@@ -992,9 +711,9 @@ TDF_Label myLabelSubshape = myNotes->FindAnnotatedItemSubshape(theLabel, theSubs
Null label will be returned if there is no corresponding annotation.
To get all notes of the Document item use the following *XCAFDoc_NotesTool* methods:
- *GetNotes* : outputs a sequence of note labels bound to a label;
- *GetAttrNotes* : outputs a sequence of note labels bound to a label's attribute;
- *GetAttrSubshape* : outputs a sequence of note labels bound to a sub-shape.
- GetNotes : outputs a sequence of note labels bound to a label
- GetAttrNotes : outputs a sequence of note labels bound to a label's attribute
- GetAttrSubshape : outputs a sequence of note labels bound to a sub-shape
All these methods return the number of notes.
~~~~~
@@ -1010,12 +729,12 @@ TDF_LabelSequence theNotesSubshape;
myNotes->GetAttrSubshape(theLabel, theSubshape, theNotesSubshape);
~~~~~
@subsubsection occt_xde_2_10_6 Removing Notes
@subsubsection occt_xde_2_7_6 Removing Notes
To remove a note use one of the following *XCAFDoc_NotesTool* methods:
- *RemoveNote* : unbinds a note from a label;
- *RemoveAttrNote* : unbinds a note from a label's attribute;
- *RemoveSubshapeNote* : unbinds a note from a sub-shape.
- RemoveNote : unbinds a note from a label
- RemoveAttrNote : unbinds a note from a label's attribute
- RemoveSubshapeNote : unbinds a note from a sub-shape
~~~~~
Handle(XCAFDoc_Note) myNote = ...
@@ -1027,31 +746,30 @@ Standard_Integer theSubshape = 1;
myNotes->RemoveSubshapeNote(myNote->Label(), theSubshape);
~~~~~
A note will not be deleted automatically.
Counterpart methods to remove all notes are available, too.
Counterpart methods to remove all notes are available too.
@subsubsection occt_xde_2_10_7 Deleting Notes
@subsubsection occt_xde_2_7_7 Deleting Notes
To delete note(s) use the following *XCAFDoc_NotesTool* methods:
- *DeleteNote* : deletes a single note;
- *DeleteNotes* : deletes a sequence of notes;
- *DeleteAllNotes* : deletes all Document notes;
- *DeleteOrphanNotes* : deletes notes not bound to Document items.
- DeleteNote : deletes a single note
- DeleteNotes : deletes a sequence of notes
- DeleteAllNotes : deletes all Document notes
- DeleteOrphanNotes : deletes notes not bound to Document items
All these methods except for the last one break all links with Document items as well.
All these methods excepting the last one break all links with Document items as well.
@subsection occt_xde_2_11 Reading and Writing STEP or IGES
@subsection occt_xde_2_8 Reading and Writing STEP or IGES
Note that saving and restoring the document itself are standard OCAF operations. As the various previously described definitions enter into this frame, they will not be explained any further.
The same can be said for Viewing: presentations can be defined from Shapes and Colors.
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, Validation Properties (Centroid, Volume, Area), and Assembly Structure are hierarchic with rigid motion.
* 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.
The packages to manage this are *IGESCAFControl* for IGES, and *STEPCAFControl* for STEP.
@subsubsection occt_xde_2_11_1 Reading a STEP file
@subsubsection occt_xde_2_8_1 Reading a STEP file
To read a STEP file by itself, use:
~~~~~
@@ -1072,7 +790,7 @@ if ( !reader.Transfer ( doc ) ) {
~~~~~
In addition, the reader provides methods that are applicable to document transfers and for directly querying of the data produced.
@subsubsection occt_xde_2_11_2 Writing a STEP file
@subsubsection occt_xde_2_8_2 Writing a STEP file
To write a STEP file by itself, use:
~~~~~
@@ -1093,19 +811,18 @@ if ( ! writer.Transfer ( Doc, mode ) ) {
IFSelect_ReturnStatus stat = writer.Write(file-name);
~~~~~
@subsubsection occt_xde_2_11_3 Reading an IGES File
@subsubsection occt_xde_2_8_3 Reading an IGES File
Use the same procedure as for a STEP file but with IGESCAFControl instead of STEPCAFControl.
@subsubsection occt_xde_2_11_4 Writing an IGES File
@subsubsection occt_xde_2_8_4 Writing an IGES File
Use the same procedure as for a STEP file but with IGESCAFControl instead of STEPCAFControl.
@subsection occt_xde_2_12 Using an XDE Document
@subsection occt_xde_2_9 Using an XDE Document
There are several ways of exploiting XDE data from an application, you can:
1. Get the data relevant for the application by mapping XDE/Appli, then discard the XDE data once it has been used.
2. Create a reference from the Application Document to the XDE Document, to have its data available as external data.
3. Embed XDE data inside the Application Document (see the following section for details).
4. Directly exploit XDE data such as when using file checkers.
@subsubsection occt_xde_2_12_1 XDE Data inside an Application Document
@subsubsection occt_xde_2_91 XDE Data inside an Application Document
To have XCAF data elsewhere than under label 0.1, you use the DocLabel of XDE. The method DocLabel from XCAFDoc_DocumentTool determines the relevant Label for XCAF. However, note that the default is 0.1.
In addition, as XDE data is defined and managed in a modular way, you can consider exclusively Assembly Structure, only Colors, and so on.

View File

@@ -1,4 +1,3 @@
#include <d3d9.h>
#include <windows.h>
// include required OCCT headers
@@ -620,7 +619,7 @@ public:
}
for (myAISContext()->InitSelected(); myAISContext()->MoreSelected(); myAISContext()->NextSelected())
{
myAISContext()->SetTransparency (myAISContext()->SelectedInteractive(), ((Standard_Real )theTrans) / 10.0, Standard_False);
myAISContext()->SetTransparency (myAISContext()->Current(), ((Standard_Real )theTrans) / 10.0, Standard_False);
}
myAISContext()->UpdateCurrentViewer();
}

View File

@@ -3,24 +3,19 @@
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "custom.sh" ]; then
source "custom.sh" $*;
source "custom.sh";
fi
if [ -e "${aSamplePath}/../../../env.sh" ]; then
source "${aSamplePath}/../../../env.sh" $*;
source "${aSamplePath}/../../../env.sh";
fi
if [ "${QTDIR}" != "" ]; then
export PATH=${QTDIR}/bin:${PATH}
else
aQMakePath=`which qmake`
echo "Environment variable \"QTDIR\" not defined.. Define it in \"custom.sh\" script."
if [ -x "$aQMakePath" ]; then
echo "qmake from PATH will be used instead."
else
exit 1
fi
if test "${QTDIR}" == ""; then
echo "Environment variable \"QTDIR\" not defined. Define it in \"custom.sh\" script."
exit 1
fi
host=`uname -s`
export STATION=$host
export PATH=${QTDIR}/bin:${PATH}

View File

@@ -1,14 +1,13 @@
#!/bin/bash
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
cd $aSamplePath
qmake FuncDemo.pro
if [ "$(uname -s)" != "Darwin" ] || [ "$MACOSX_USE_GLX" == "true" ]; then
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
if [ "${CASDEB}" == "d" ]; then
make -j $aNbJobs debug
make debug
else
make -j $aNbJobs release
make release
fi
fi

View File

@@ -2,7 +2,7 @@
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
cd $aSamplePath
aSystem=`uname -s`

View File

@@ -3,25 +3,20 @@
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "custom.sh" ]; then
source "custom.sh" $*;
source "custom.sh";
fi
if [ -e "${aSamplePath}/../../../env.sh" ]; then
source "${aSamplePath}/../../../env.sh" $*;
source "${aSamplePath}/../../../env.sh";
fi
if [ "${QTDIR}" != "" ]; then
export PATH=${QTDIR}/bin:${PATH}
else
aQMakePath=`which qmake`
echo "Environment variable \"QTDIR\" not defined.. Define it in \"custom.sh\" script."
if [ -x "$aQMakePath" ]; then
echo "qmake from PATH will be used instead."
else
exit 1
fi
if test "${QTDIR}" == ""; then
echo "Environment variable \"QTDIR\" not defined. Define it in \"custom.sh\" script."
exit 1
fi
host=`uname -s`
export STATION=$host
export RES_DIR=${aSamplePath}/${STATION}/res
export PATH=${QTDIR}/bin:${PATH}

View File

@@ -1,14 +1,13 @@
#!/bin/bash
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
cd $aSamplePath
qmake IESample.pro
if [ "$(uname -s)" != "Darwin" ] || [ "$MACOSX_USE_GLX" == "true" ]; then
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
if [ "${CASDEB}" == "d" ]; then
make -j $aNbJobs debug
make debug
else
make -j $aNbJobs release
make release
fi
fi

View File

@@ -2,7 +2,7 @@
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
cd $aSamplePath
aSystem=`uname -s`

View File

@@ -3,25 +3,20 @@
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "custom.sh" ]; then
source "custom.sh" $*;
source "custom.sh";
fi
if [ -e "${aSamplePath}/../../../env.sh" ]; then
source "${aSamplePath}/../../../env.sh" $*;
source "${aSamplePath}/../../../env.sh";
fi
if [ "${QTDIR}" != "" ]; then
export PATH=${QTDIR}/bin:${PATH}
else
aQMakePath=`which qmake`
echo "Environment variable \"QTDIR\" not defined.. Define it in \"custom.sh\" script."
if [ -x "$aQMakePath" ]; then
echo "qmake from PATH will be used instead."
else
exit 1
fi
if test "${QTDIR}" == ""; then
echo "Environment variable \"QTDIR\" not defined. Define it in \"custom.sh\" script."
exit 1
fi
host=`uname -s`
export STATION=$host
export RES_DIR=${aSamplePath}/${STATION}/res
export PATH=${QTDIR}/bin:${PATH}

View File

@@ -1,14 +1,13 @@
#!/bin/bash
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
cd $aSamplePath
qmake Tutorial.pro
if [ "$(uname -s)" != "Darwin" ] || [ "$MACOSX_USE_GLX" == "true" ]; then
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
if [ "${CASDEB}" == "d" ]; then
make -j $aNbJobs debug
make debug
else
make -j $aNbJobs release
make release
fi
fi

View File

@@ -2,7 +2,7 @@
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
cd $aSamplePath
aSystem=`uname -s`

View File

@@ -59,7 +59,7 @@ vdimension ad_1 -angle -shapes as_38 as_49 -color black
vdimension ad_2 -angle -shapes bs_24 bs_25 -color black
vdimension ad_3 -angle -shapes as_48 as_43 -color black
puts "Changing text and arrow parameters of dimensions..."
puts "Changing text and arrow paramaters of dimensions..."
foreach i $aList {
vdimparam $i -text 3d sh 6 -arrowlength 4 -arrowangle $anArrAngle
}

View File

@@ -495,9 +495,9 @@ void AIS_ColoredShape::ComputeSelection (const Handle(SelectMgr_Selection)& theS
aTypOfSel, aPriority, aDeflection, aDeviationAngle);
Handle(SelectMgr_SelectableObject) aThis (this);
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
for (theSelection->Init(); theSelection->More(); theSelection->Next())
{
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelEntIter.Value()->BaseSensitive()->OwnerId());
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (theSelection->Sensitive()->BaseSensitive()->OwnerId());
anOwner->Set (aThis);
}

View File

@@ -164,10 +164,54 @@ void AIS_ConnectedInteractive::Compute(const Handle(Prs3d_Projector)& aProjector
//purpose :
//=======================================================================
void AIS_ConnectedInteractive::Compute (const Handle(Prs3d_Projector)& theProjector,
const Handle(Prs3d_Presentation)& thePrs,
const Handle(Prs3d_Presentation)& thePresentation,
const TopoDS_Shape& theShape)
{
AIS_Shape::computeHlrPresentation (theProjector, thePrs, theShape, myDrawer);
if (myShape.IsNull())
{
return;
}
switch (theShape.ShapeType())
{
case TopAbs_VERTEX:
case TopAbs_EDGE:
case TopAbs_WIRE:
{
thePresentation->SetDisplayPriority (4);
StdPrs_WFShape::Add (thePresentation, theShape, myDrawer);
break;
}
default:
{
Handle(Prs3d_Drawer) aDefaultDrawer = GetContext()->DefaultDrawer();
if (aDefaultDrawer->DrawHiddenLine())
{
myDrawer->EnableDrawHiddenLine();
}
else
{
myDrawer->DisableDrawHiddenLine();
}
Aspect_TypeOfDeflection aPrevDeflection = aDefaultDrawer->TypeOfDeflection();
aDefaultDrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
// process HLRAngle and HLRDeviationCoefficient()
Standard_Real aPrevAngle = myDrawer->HLRAngle();
Standard_Real aNewAngle = aDefaultDrawer->HLRAngle();
if (myDrawer->IsAutoTriangulation() &&
Abs (aNewAngle - aPrevAngle) > Precision::Angular())
{
BRepTools::Clean (theShape);
}
myDrawer->SetHLRAngle (aNewAngle);
myDrawer->SetHLRDeviationCoefficient (aDefaultDrawer->HLRDeviationCoefficient());
StdPrs_HLRPolyShape::Add (thePresentation, theShape, myDrawer, theProjector);
aDefaultDrawer->SetTypeOfDeflection (aPrevDeflection);
}
}
}
//=======================================================================
@@ -233,9 +277,9 @@ void AIS_ConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selectio
myReference->RecomputePrimitives (theMode);
}
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (TheRefSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
for (TheRefSel->Init(); TheRefSel->More(); TheRefSel->Next())
{
aSensitive = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive());
aSensitive = Handle(Select3D_SensitiveEntity)::DownCast (TheRefSel->Sensitive()->BaseSensitive());
if (!aSensitive.IsNull())
{
// Get the copy of SE3D
@@ -260,28 +304,38 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
Shapes2EntitiesMap;
if (!myReference->HasSelection (theMode))
{
myReference->RecomputePrimitives (theMode);
}
const Handle(SelectMgr_Selection)& aRefSel = myReference->Selection (theMode);
if (aRefSel->IsEmpty() || aRefSel->UpdateStatus() == SelectMgr_TOU_Full)
{
myReference->RecomputePrimitives (theMode);
}
Handle(StdSelect_BRepOwner) anOwner;
TopLoc_Location aDummyLoc;
// Fill in the map of subshapes and corresponding sensitive entities associated with aMode
Handle(Select3D_SensitiveEntity) aSE, aNewSE;
Shapes2EntitiesMap aShapes2EntitiesMap;
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aRefSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
SensitiveList aSEList;
TopoDS_Shape aSubShape;
// Fill in the map of subshapes and corresponding
// sensitive entities associated with aMode
for (aRefSel->Init(); aRefSel->More(); aRefSel->Next())
{
if (Handle(Select3D_SensitiveEntity) aSE = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
aSE = Handle(Select3D_SensitiveEntity)::DownCast (aRefSel->Sensitive()->BaseSensitive());
if(!aSE.IsNull())
{
if (Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast (aSE->OwnerId()))
anOwner = Handle(StdSelect_BRepOwner)::DownCast (aSE->OwnerId());
if(!anOwner.IsNull())
{
const TopoDS_Shape& aSubShape = anOwner->Shape();
aSubShape = anOwner->Shape();
if(!aShapes2EntitiesMap.IsBound (aSubShape))
{
aShapes2EntitiesMap.Bind (aSubShape, SensitiveList());
aShapes2EntitiesMap.Bind (aSubShape, aSEList);
}
aShapes2EntitiesMap (aSubShape).Append (aSE);
}
@@ -291,14 +345,20 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
// Fill in selection from aShapes2EntitiesMap
for (Shapes2EntitiesMap::Iterator aMapIt (aShapes2EntitiesMap); aMapIt.More(); aMapIt.Next())
{
const SensitiveList& aSEList = aMapIt.Value();
Handle(StdSelect_BRepOwner) anOwner = new StdSelect_BRepOwner (aMapIt.Key(), this, aSEList.First()->OwnerId()->Priority(), Standard_True);
aSEList = aMapIt.Value();
anOwner = new StdSelect_BRepOwner (aMapIt.Key(),
this,
aSEList.First()->OwnerId()->Priority(),
Standard_True);
anOwner->SetLocation (Transformation());
for (SensitiveList::Iterator aListIt (aSEList); aListIt.More(); aListIt.Next())
{
Handle(Select3D_SensitiveEntity) aSE = aListIt.Value();
Handle(Select3D_SensitiveEntity) aNewSE = aSE->GetConnected();
aSE = aListIt.Value();
aNewSE = aSE->GetConnected();
aNewSE->Set (anOwner);
theSelection->Add (aNewSE);
}
}

View File

@@ -639,8 +639,8 @@ void AIS_EqualDistanceRelation::ComputeTwoVerticesLength( const Handle( Prs3d_Pr
curpos.Translate(offset);
Position = curpos;
}
else {
gp_Dir aDir = Plane->Pln().Axis().Direction();
else {
const gp_Dir& aDir = Plane->Pln().Axis().Direction();
gp_Vec aVec (aDir.XYZ()*10*ArrowSize);
//Position = gp_Pnt(FirstAttach.XYZ()+gp_XYZ(1.,1.,1.)); // not correct
Position = FirstAttach.Translated(aVec);

View File

@@ -186,11 +186,11 @@ AIS_InteractiveContext::~AIS_InteractiveContext()
Handle(AIS_InteractiveContext) aNullContext;
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
const Handle(AIS_InteractiveObject)& anObj = anObjIter.Key();
Handle(AIS_InteractiveObject) anObj = anObjIter.Key();
anObj->SetContext (aNullContext);
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
for (anObj->Init(); anObj->More(); anObj->Next())
{
aSelIter.Value()->UpdateBVHStatus (SelectMgr_TBU_Renew);
anObj->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Renew);
}
}
}
@@ -457,10 +457,6 @@ 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;
}
@@ -488,7 +484,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);
myMainVwr->StructureManager()->RegisterObject (theIObj);
Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->StructureManager()->RegisterObject (theIObj);
myMainPM->Display(theIObj, theDispMode);
if (theSelectionMode != -1)
{
@@ -571,20 +567,23 @@ void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
return;
}
if (!myObjects.IsBound (theIObj))
if (theSelMode == -1
&& !theToAllowDecomposition)
{
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);
}
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);
}
// 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);
}
}
}
@@ -693,13 +692,15 @@ void AIS_InteractiveContext::DisplaySelected (const Standard_Boolean theToUpdate
return;
}
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
Standard_Boolean isFound = Standard_False;
for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (mySelection->Value()->Selectable());
Display (anObj, Standard_False);
isFound = Standard_True;
}
if (theToUpdateViewer && !mySelection->Objects().IsEmpty())
if (isFound && theToUpdateViewer)
{
myMainVwr->Update();
}
@@ -716,12 +717,17 @@ void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateVi
return;
}
Standard_Boolean isFound = Standard_False;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Init (mySelection->Objects()))
Standard_Boolean isFound = Standard_False;
mySelection->Init();
while (mySelection->More())
{
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
Handle(SelectMgr_EntityOwner) anOwner = mySelection->Value();
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
Erase (anObj, Standard_False);
isFound = Standard_True;
mySelection->Init();
}
if (isFound && theToUpdateViewer)
@@ -786,7 +792,6 @@ 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);
@@ -2853,14 +2858,15 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
const Standard_Real theMargin,
const Standard_Boolean theToUpdate)
{
const Handle(AIS_Selection)& aSelection = HasOpenedContext()
? myLocalContexts(myCurLocalIndex)->Selection()
: mySelection;
const Handle(AIS_Selection)& aSelection = HasOpenedContext() ?
myLocalContexts(myCurLocalIndex)->Selection() : mySelection;
Bnd_Box aBndSelected;
AIS_MapOfObjectOwners anObjectOwnerMap;
for (AIS_NListOfEntityOwner::Iterator aSelIter (aSelection->Objects()); aSelIter.More(); aSelIter.Next())
for (aSelection->Init(); aSelection->More(); aSelection->Next())
{
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
const Handle(SelectMgr_EntityOwner)& anOwner = aSelection->Value();
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
if (anObj->IsInfinite())
{

View File

@@ -121,6 +121,7 @@ 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.

View File

@@ -564,9 +564,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdate
clearDynamicHighlight();
if (myWasLastMain && !myLastinMain.IsNull())
{
if (!myLastinMain->IsSelected()
|| myLastinMain->IsForcedHilight()
|| NbSelected() > 1)
if (!myLastinMain->IsSelected() || myLastinMain->IsForcedHilight())
{
SetSelected (myLastinMain, Standard_False);
if(toUpdateViewer)
@@ -1015,7 +1013,10 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
{
Display (theObject, Standard_False);
}
if (!theObject->HasSelection (theObject->GlobalSelectionMode()))
{
return;
}
Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
if (anOwner.IsNull())
{
@@ -1036,9 +1037,9 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
return;
}
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
const Handle(SelectMgr_EntityOwner)& aSelOwner = aSelIter.Value();
const Handle(SelectMgr_EntityOwner) aSelOwner = mySelection->Value();
if (!myFilters->IsOk (aSelOwner))
{
continue;
@@ -1136,26 +1137,22 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(AIS_InteractiveOb
const Standard_Boolean theToUpdateViewer)
{
if (theObject.IsNull())
{
return;
}
if (HasOpenedContext())
{
return myLocalContexts (myCurLocalIndex)->AddOrRemoveSelected (theObject, theToUpdateViewer);
}
if (!myObjects.IsBound (theObject))
{
const Standard_Integer aGlobalSelMode = theObject->GlobalSelectionMode();
if (!myObjects.IsBound (theObject) || !theObject->HasSelection (aGlobalSelMode))
return;
}
setContextToObject (theObject);
const Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
if (!anOwner.IsNull()
&& anOwner->HasSelectable())
{
AddOrRemoveSelected (anOwner, theToUpdateViewer);
}
if (anOwner.IsNull() || !anOwner->HasSelectable())
return;
AddOrRemoveSelected (anOwner, theToUpdateViewer);
}
//=======================================================================
//function : AddOrRemoveSelected
@@ -1196,7 +1193,8 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
theOwner->SetSelected (aSelStat == AIS_SS_Added);
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
const Handle(AIS_InteractiveObject) anObj =
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
const Standard_Boolean isGlobal = anObj->GlobalSelOwner() == theOwner;
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
if (theOwner->IsSelected())
@@ -1241,18 +1239,19 @@ Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(AIS_Interactiv
const Standard_Integer aGlobalSelMode = theObj->GlobalSelectionMode();
const TColStd_ListOfInteger& anActivatedModes = myObjects (theObj)->SelectionModes();
Standard_Boolean isGlobalModeActivated = Standard_False;
for (TColStd_ListIteratorOfListOfInteger aModeIter (anActivatedModes); aModeIter.More(); aModeIter.Next())
{
if (aModeIter.Value() == aGlobalSelMode)
{
if (Handle(SelectMgr_EntityOwner) aGlobOwner = theObj->GlobalSelOwner())
{
return aGlobOwner->IsSelected();
}
return Standard_False;
isGlobalModeActivated = Standard_True;
break;
}
}
return Standard_False;
if (!theObj->HasSelection (aGlobalSelMode) || !isGlobalModeActivated || theObj->GlobalSelOwner().IsNull())
return Standard_False;
return theObj->GlobalSelOwner()->IsSelected();
}
//=======================================================================
@@ -1262,11 +1261,12 @@ Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(AIS_Interactiv
Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const
{
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->IsSelected (theOwner);
}
return !theOwner.IsNull()
&& theOwner->IsSelected();
if (theOwner.IsNull())
return Standard_False;
return theOwner->IsSelected();
}
//=======================================================================
@@ -1390,44 +1390,37 @@ void AIS_InteractiveContext::EntityOwners(Handle(SelectMgr_IndexedMapOfOwner)& t
const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Integer theMode) const
{
if (theIObj.IsNull())
{
return;
}
if ( theIObj.IsNull() )
return;
TColStd_ListOfInteger aModes;
if (theMode == -1)
{
ActivatedModes (theIObj, aModes);
}
if ( theMode == -1 )
ActivatedModes( theIObj, aModes );
else
{
aModes.Append (theMode);
}
aModes.Append( theMode );
if (theOwners.IsNull())
{
theOwners = new SelectMgr_IndexedMapOfOwner();
}
for (TColStd_ListIteratorOfListOfInteger anItr (aModes); anItr.More(); anItr.Next())
TColStd_ListIteratorOfListOfInteger anItr( aModes );
for (; anItr.More(); anItr.Next() )
{
const int aMode = anItr.Value();
const Handle(SelectMgr_Selection)& aSel = theIObj->Selection (aMode);
if (aSel.IsNull())
{
int aMode = anItr.Value();
if ( !theIObj->HasSelection( aMode ) )
continue;
}
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
Handle(SelectMgr_Selection) aSel = theIObj->Selection(aMode);
for ( aSel->Init(); aSel->More(); aSel->Next() )
{
if (Handle(SelectBasics_SensitiveEntity) aEntity = aSelEntIter.Value()->BaseSensitive())
{
if (Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast(aEntity->OwnerId()))
{
theOwners->Add (aOwner);
}
}
Handle(SelectBasics_SensitiveEntity) aEntity = aSel->Sensitive()->BaseSensitive();
if ( aEntity.IsNull() )
continue;
Handle(SelectMgr_EntityOwner) aOwner =
Handle(SelectMgr_EntityOwner)::DownCast(aEntity->OwnerId());
if ( !aOwner.IsNull() )
theOwners->Add( aOwner );
}
}
}
@@ -1438,11 +1431,13 @@ void AIS_InteractiveContext::EntityOwners(Handle(SelectMgr_IndexedMapOfOwner)& t
//=======================================================================
Standard_Integer AIS_InteractiveContext::NbSelected()
{
if (HasOpenedContext())
Standard_Integer aNbSelected = 0;
for (InitSelected(); MoreSelected(); NextSelected())
{
return myLocalContexts (myCurLocalIndex)->Selection()->Extent();
aNbSelected++;
}
return mySelection->Extent();
return aNbSelected;
}
//=======================================================================

View File

@@ -202,8 +202,9 @@ Load(const Handle(AIS_InteractiveObject)& anInteractive,
{
if (myActiveObjects.IsBound (anInteractive))
{
if (const Handle(SelectMgr_Selection)& aSel = anInteractive->Selection (ActivationMode))
if (anInteractive->HasSelection (ActivationMode))
{
const Handle(SelectMgr_Selection)& aSel = anInteractive->Selection (ActivationMode);
if (aSel->GetSelectionState() != SelectMgr_SOS_Activated)
{
if (!myMainVS->Contains (anInteractive))
@@ -863,26 +864,24 @@ const Handle(AIS_LocalStatus)& AIS_LocalContext::Status(const Handle(AIS_Interac
void AIS_LocalContext::LoadContextObjects()
{
if (!myLoadDisplayed)
{
return;
}
AIS_ListOfInteractive LL;
myCTX->DisplayedObjects(LL,Standard_True);
for (AIS_ListIteratorOfListOfInteractive It (LL); It.More(); It.Next())
{
const Handle(AIS_InteractiveObject)& anObj = It.Value();
Handle(AIS_LocalStatus) Att = new AIS_LocalStatus();
Att->SetDecomposition((anObj->AcceptShapeDecomposition() && myAcceptStdMode));
Att->SetTemporary(Standard_False);
Att->SetHilightMode(anObj->HasHilightMode()? anObj->HilightMode(): 0);
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
aSel->SetSelectionState (SelectMgr_SOS_Deactivated);
AIS_ListIteratorOfListOfInteractive It;
if(myLoadDisplayed) {
AIS_ListOfInteractive LL;
myCTX->DisplayedObjects(LL,Standard_True);
Handle(AIS_LocalStatus) Att;
for (It.Initialize(LL);It.More();It.Next()){
const Handle(AIS_InteractiveObject)& anObj = It.Value();
Att= new AIS_LocalStatus();
Att->SetDecomposition((anObj->AcceptShapeDecomposition() && myAcceptStdMode));
Att->SetTemporary(Standard_False);
Att->SetHilightMode(anObj->HasHilightMode()? anObj->HilightMode(): 0);
for (anObj->Init(); anObj->More(); anObj->Next())
{
const Handle(SelectMgr_Selection)& aSel = anObj->CurrentSelection();
aSel->SetSelectionState (SelectMgr_SOS_Deactivated);
}
myActiveObjects.Bind(anObj,Att);
}
myActiveObjects.Bind(anObj,Att);
}
}

View File

@@ -91,8 +91,8 @@ public:
Standard_Boolean AcceptErase() const;
Standard_EXPORT void SetContext (const Handle(AIS_InteractiveContext)& aCtx);
const Handle(AIS_Selection)& Selection() const { return mySelection; }
const Handle(AIS_Selection) Selection() const;
Standard_EXPORT void Terminate (const Standard_Boolean updateviewer = Standard_True);

View File

@@ -18,6 +18,9 @@
#include <SelectMgr_OrFilter.hxx>
inline const Handle(AIS_Selection) AIS_LocalContext::Selection() const
{return mySelection;}
inline void AIS_LocalContext::SetAutomaticHilight(const Standard_Boolean aStatus)
{myAutoHilight = aStatus;}

View File

@@ -804,10 +804,13 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
{
// 1. Collect selectable entities
SelectMgr_IndexedMapOfOwner aValidOwners;
const TColStd_ListOfInteger& aModes = SelectionModes (theIO);
for (TColStd_ListIteratorOfListOfInteger aModeIter (aModes); aModeIter.More(); aModeIter.Next())
TColStd_ListIteratorOfListOfInteger aModeIter (aModes);
for (; aModeIter.More(); aModeIter.Next())
{
const int aMode = aModeIter.Value();
int aMode = aModeIter.Value();
if (!theIO->HasSelection(aMode))
{
continue;
@@ -818,16 +821,24 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
continue;
}
const Handle(SelectMgr_Selection)& aSelection = theIO->Selection (aMode);
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
Handle(SelectMgr_Selection) aSelection = theIO->Selection(aMode);
for (aSelection->Init(); aSelection->More(); aSelection->Next())
{
if (Handle(SelectBasics_SensitiveEntity) anEntity = aSelEntIter.Value()->BaseSensitive())
Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
if (anEntity.IsNull())
{
if (Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId()))
{
aValidOwners.Add (anOwner);
}
continue;
}
Handle(SelectMgr_EntityOwner) anOwner =
Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId());
if (anOwner.IsNull())
{
continue;
}
aValidOwners.Add(anOwner);
}
}

View File

@@ -43,22 +43,6 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_Manipulator, AIS_InteractiveObject)
IMPLEMENT_HSEQUENCE(AIS_ManipulatorObjectSequence)
namespace
{
//! Return Ax1 for specified direction of Ax2.
static gp_Ax1 getAx1FromAx2Dir (const gp_Ax2& theAx2,
int theIndex)
{
switch (theIndex)
{
case 0: return gp_Ax1 (theAx2.Location(), theAx2.XDirection());
case 1: return gp_Ax1 (theAx2.Location(), theAx2.YDirection());
case 2: return theAx2.Axis();
}
throw Standard_ProgramError ("AIS_Manipulator - Invalid axis index");
}
}
//=======================================================================
//function : init
//purpose :
@@ -400,19 +384,22 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
// Initialize start reference data
if (!myHasStartedTransformation)
{
myStartTrsfs.Clear();
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
for (AIS_ManipulatorObjectSequence::Iterator anObjIter (*anObjects); anObjIter.More(); anObjIter.Next())
myStartTrsfs.Clear();
for (Standard_Integer anIt = anObjects->Lower(); anIt <= anObjects->Upper(); ++anIt)
{
myStartTrsfs.Append (anObjIter.Value()->LocalTransformation());
myStartTrsfs.Append (anObjects->Value (anIt)->LocalTransformation());
}
myStartPosition = myPosition;
}
// Get 3d point with projection vector
Graphic3d_Vec3d anInputPoint, aProj;
Graphic3d_Vec3d anInputPoint;
Graphic3d_Vec3d aProj;
theView->ConvertWithProj (theMaxX, theMaxY, anInputPoint.x(), anInputPoint.y(), anInputPoint.z(), aProj.x(), aProj.y(), aProj.z());
const gp_Lin anInputLine (gp_Pnt (anInputPoint.x(), anInputPoint.y(), anInputPoint.z()), gp_Dir (aProj.x(), aProj.y(), aProj.z()));
gp_Lin anInputLine (gp_Pnt (anInputPoint.x(), anInputPoint.y(), anInputPoint.z()), gp_Dir (aProj.x(), aProj.y(), aProj.z()));
gp_Pnt aNewPosition = gp::Origin();
switch (myCurrentMode)
{
case AIS_MM_Translation:
@@ -423,7 +410,7 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
GeomAPI_ExtremaCurveCurve anExtrema (anInputCurve, aCurve);
gp_Pnt aP1, aP2;
anExtrema.NearestPoints (aP1, aP2);
const gp_Pnt aNewPosition = aP2;
aNewPosition = aP2;
if (!myHasStartedTransformation)
{
@@ -440,28 +427,26 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
gp_Trsf aNewTrsf;
aNewTrsf.SetTranslation (gp_Vec(myStartPick, aNewPosition));
theTrsf *= aNewTrsf;
return Standard_True;
break;
}
case AIS_MM_Rotation:
{
const gp_Pnt aPosLoc = myStartPosition.Location();
const gp_Ax1 aCurrAxis = getAx1FromAx2Dir (myStartPosition, myCurrentIndex);
Handle(Geom_Curve) anInputCurve = new Geom_Line (anInputLine);
Handle(Geom_Surface) aSurface = new Geom_Plane (aPosLoc, aCurrAxis.Direction());
Handle(Geom_Surface) aSurface = new Geom_Plane (myPosition.Location(), myAxes[myCurrentIndex].Position().Direction());
GeomAPI_IntCS aIntersector (anInputCurve, aSurface);
if (!aIntersector.IsDone() || aIntersector.NbPoints() < 1)
{
return Standard_False;
}
const gp_Pnt aNewPosition = aIntersector.Point (1);
aNewPosition = aIntersector.Point (1);
if (!myHasStartedTransformation)
{
myStartPick = aNewPosition;
myHasStartedTransformation = Standard_True;
gp_Dir aStartAxis = gce_MakeDir (aPosLoc, myStartPick);
myPrevState = aStartAxis.AngleWithRef (gce_MakeDir(aPosLoc, aNewPosition), aCurrAxis.Direction());
gp_Dir aStartAxis = gce_MakeDir (myPosition.Location(), myStartPick);
myPrevState = aStartAxis.AngleWithRef (gce_MakeDir(myPosition.Location(), aNewPosition), myAxes[myCurrentIndex].Position().Direction());
return Standard_True;
}
@@ -470,17 +455,17 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
return Standard_False;
}
gp_Dir aStartAxis = aPosLoc.IsEqual (myStartPick, Precision::Confusion())
? getAx1FromAx2Dir (myStartPosition, (myCurrentIndex + 1) % 3).Direction()
: gce_MakeDir (aPosLoc, myStartPick);
gp_Dir aStartAxis = myPosition.Location().IsEqual (myStartPick, Precision::Confusion())
? myAxes[(myCurrentIndex + 1) % 3].Position().Direction()
: gce_MakeDir (myPosition.Location(), myStartPick);
gp_Dir aCurrentAxis = gce_MakeDir (aPosLoc, aNewPosition);
Standard_Real anAngle = aStartAxis.AngleWithRef (aCurrentAxis, aCurrAxis.Direction());
gp_Dir aCurrentAxis = gce_MakeDir (myPosition.Location(), aNewPosition);
Standard_Real anAngle = aStartAxis.AngleWithRef (aCurrentAxis, myAxes[myCurrentIndex].Position().Direction());
// Change value of an angle if it should have different sign.
if (anAngle * myPrevState < 0 && Abs (anAngle) < M_PI_2)
{
Standard_Real aSign = myPrevState > 0 ? -1.0 : 1.0;
Standard_ShortReal aSign = myPrevState > 0 ? -1.0f : 1.0f;
anAngle = aSign * (M_PI * 2 - anAngle);
}
@@ -490,10 +475,10 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
}
gp_Trsf aNewTrsf;
aNewTrsf.SetRotation (aCurrAxis, anAngle);
aNewTrsf.SetRotation (myAxes[myCurrentIndex].Position(), anAngle);
theTrsf *= aNewTrsf;
myPrevState = anAngle;
return Standard_True;
break;
}
case AIS_MM_Scaling:
{
@@ -501,7 +486,7 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
Handle(Geom_Curve) anInputCurve = new Geom_Line (anInputLine);
Handle(Geom_Curve) aCurve = new Geom_Line (aLine);
GeomAPI_ExtremaCurveCurve anExtrema (anInputCurve, aCurve);
gp_Pnt aNewPosition, aTmp;
gp_Pnt aTmp;
anExtrema.NearestPoints (aTmp, aNewPosition);
if (!myHasStartedTransformation)
@@ -523,14 +508,13 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
aNewTrsf.SetScale (myPosition.Location(), aCoeff);
theTrsf = aNewTrsf;
return Standard_True;
break;
}
case AIS_MM_None:
{
return Standard_False;
}
}
return Standard_False;
return Standard_True;
}
//=======================================================================
@@ -560,19 +544,18 @@ void AIS_Manipulator::StopTransform (const Standard_Boolean theToApply)
}
myHasStartedTransformation = Standard_False;
if (theToApply)
{
return;
}
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
AIS_ManipulatorObjectSequence::Iterator anObjIter (*anObjects);
NCollection_Sequence<gp_Trsf>::Iterator aTrsfIter (myStartTrsfs);
for (; anObjIter.More(); anObjIter.Next(), aTrsfIter.Next())
if (!theToApply)
{
anObjIter.ChangeValue()->SetLocalTransformation (aTrsfIter.Value());
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
for (Standard_Integer anIt = anObjects->Lower(); anIt <= anObjects->Upper(); ++anIt)
{
anObjects->Value (anIt)->SetLocalTransformation (myStartTrsfs(anIt));
}
SetPosition (myStartPosition);
}
SetPosition (myStartPosition);
}
//=======================================================================
@@ -586,14 +569,11 @@ void AIS_Manipulator::Transform (const gp_Trsf& theTrsf)
return;
}
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
for (Standard_Integer anIt = anObjects->Lower(); anIt <= anObjects->Upper(); ++anIt)
{
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
AIS_ManipulatorObjectSequence::Iterator anObjIter (*anObjects);
NCollection_Sequence<gp_Trsf>::Iterator aTrsfIter (myStartTrsfs);
for (; anObjIter.More(); anObjIter.Next(), aTrsfIter.Next())
{
anObjIter.ChangeValue()->SetLocalTransformation (theTrsf * aTrsfIter.Value());
}
anObjects->Value (anIt)->SetLocalTransformation (theTrsf * myStartTrsfs(anIt));
}
if ((myCurrentMode == AIS_MM_Translation && myBehaviorOnTransform.FollowTranslation)
@@ -633,9 +613,10 @@ void AIS_Manipulator::SetPosition (const gp_Ax2& thePosition)
|| !myPosition.XDirection().IsEqual (thePosition.XDirection(), Precision::Angular()))
{
myPosition = thePosition;
myAxes[0].SetPosition (getAx1FromAx2Dir (thePosition, 0));
myAxes[1].SetPosition (getAx1FromAx2Dir (thePosition, 1));
myAxes[2].SetPosition (getAx1FromAx2Dir (thePosition, 2));
myAxes[0].SetPosition (gp_Ax1 (myPosition.Location(), myPosition.XDirection()));
myAxes[1].SetPosition (gp_Ax1 (myPosition.Location(), myPosition.YDirection()));
myAxes[2].SetPosition (gp_Ax1 (myPosition.Location(), myPosition.Direction()));
updateTransformation();
}
}

View File

@@ -215,18 +215,18 @@ public:
//! @return true if manipulator is attached to some interactive object (has owning object).
Standard_Boolean IsAttached() const { return HasOwner(); }
//! @return true if some part of manipulator is selected (transformation mode is active, and owning object can be transformed).
//! @return true if some part of manipulator is selected (tranformation mode is active, and owning object can be rtansformated).
Standard_Boolean HasActiveMode() const { return IsAttached() && myCurrentMode != AIS_MM_None; }
Standard_Boolean HasActiveTransformation() { return myHasStartedTransformation; }
gp_Trsf StartTransformation() const { return !myStartTrsfs.IsEmpty() ? myStartTrsfs.First() : gp_Trsf(); }
gp_Trsf StartTransformation() const { return myStartTrsfs.Size() < 1 ? gp_Trsf() : myStartTrsfs(1); }
gp_Trsf StartTransformation (Standard_Integer theIndex) const
gp_Trsf StartTransformation (const Standard_Integer theIndex) const
{
Standard_ProgramError_Raise_if (theIndex < 1 || theIndex > Objects()->Upper(),
"AIS_Manipulator::StartTransformation(): theIndex is out of bounds");
return !myStartTrsfs.IsEmpty() ? myStartTrsfs (theIndex) : gp_Trsf();
return myStartTrsfs.Size() < 1 ? gp_Trsf() : myStartTrsfs (theIndex);
}
public: //! @name Configuration of graphical transformations
@@ -245,7 +245,7 @@ public: //! @name Configuration of graphical transformations
//! Redefines transform persistence management to setup transformation for sub-presentation of axes.
//! @warning this interactive object does not support custom transformation persistence when
//! using \sa ZoomPersistence mode. In this mode the transformation persistence flags for
//! presentations are overridden by this class.
//! presentations are overriden by this class.
//! @warning Invokes debug assertion to catch incompatible usage of the method with \sa ZoomPersistence mode,
//! silently does nothing in release mode.
//! @warning revise use of AdjustSize argument of of \sa AttachToObjects method
@@ -298,17 +298,17 @@ public:
public: //! @name Presentation computation
//! Fills presentation.
//! @note Manipulator presentation does not use display mode and for all modes has the same presentation.
//! @note Manipulator presentation does not use display mode and for all modes has the same presenatation.
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode = 0) Standard_OVERRIDE;
//! Computes selection sensitive zones (triangulation) for manipulator.
//! @param theNode [in] Selection mode that is treated as transformation mode.
//! @param theNode [in] Seldction mode that is treated as transformation mode.
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden methods.
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overriden methods.
Standard_EXPORT virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE
{
return Standard_False;
@@ -352,7 +352,7 @@ protected:
Standard_EXPORT virtual void setLocalTransformation (const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE;
using AIS_InteractiveObject::SetLocalTransformation; // hide visibility
protected: //! @name Auxiliary classes to fill presentation with proper primitives
protected: //! @name Auxilliary classes to fill presentation with proper primitives
class Quadric
{
@@ -616,16 +616,16 @@ protected:
Axis myAxes[3]; //!< Tree axes of the manipulator.
Sphere myCenter; //!< Visual part displaying the center sphere of the manipulator.
gp_Ax2 myPosition; //!< Position of the manipulator object. it displays its location and position of its axes.
gp_Ax2 myPosition; //!< Position of the manipualtor object. it displayes its location and position of its axes.
Standard_Integer myCurrentIndex; //!< Index of active axis.
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipulation mode.
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipualtion mode.
Standard_Boolean myIsActivationOnDetection; //!< Manual activation of modes (not on parts selection).
Standard_Boolean myIsZoomPersistentMode; //!< Zoom persistence mode activation.
BehaviorOnTransform myBehaviorOnTransform; //!< Behavior settings applied on manipulator when transforming an object.
protected: //! @name Fields for interactive transformation. Fields only for internal needs. They do not have public interface.
protected: //! @name Fields for interactive trnasformation. Fields only for internal needs. They do not have public interface.
NCollection_Sequence<gp_Trsf> myStartTrsfs; //!< Owning object transformation for start. It is used internally.
Standard_Boolean myHasStartedTransformation; //!< Shows if transformation is processed (sequential calls of Transform()).
@@ -633,7 +633,7 @@ protected: //! @name Fields for interactive transformation. Fields only for inte
gp_Pnt myStartPick; //! 3d point corresponding to start mouse pick.
Standard_Real myPrevState; //! Previous value of angle during rotation.
//! Aspect used to color current detected part and current selected part.
//! Aspect used to colour current detected part and current selected part.
Handle(Prs3d_ShadingAspect) myHighlightAspect;
public:

View File

@@ -30,13 +30,14 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_MultipleConnectedInteractive,AIS_InteractiveObjec
//=======================================================================
//function : AIS_MultipleConnectedInteractive
//purpose :
//purpose :
//=======================================================================
AIS_MultipleConnectedInteractive::AIS_MultipleConnectedInteractive()
: AIS_InteractiveObject (PrsMgr_TOP_AllView)
: AIS_InteractiveObject (PrsMgr_TOP_AllView)
{
myHasOwnPresentations = Standard_False;
myAssemblyOwner = NULL;
}
//=======================================================================
@@ -212,27 +213,53 @@ Standard_Boolean AIS_MultipleConnectedInteractive::AcceptShapeDecomposition() co
void AIS_MultipleConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selection)& /*theSelection*/,
const Standard_Integer theMode)
{
if (theMode == 0)
if (theMode != 0)
{
return;
}
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
{
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
if (aChild.IsNull())
{
continue;
}
if (!aChild->HasSelection (theMode))
{
aChild->RecomputePrimitives (theMode);
}
Handle(SelectMgr_Selection) aSelection = new SelectMgr_Selection (theMode);
aChild->ComputeSelection (aSelection, theMode);
}
}
}
//=======================================================================
//function : GlobalSelOwner
//purpose :
//=======================================================================
Handle(SelectMgr_EntityOwner) AIS_MultipleConnectedInteractive::GlobalSelOwner() const
{
return myAssemblyOwner;
}
//=======================================================================
//function : HasSelection
//purpose :
//=======================================================================
Standard_Boolean AIS_MultipleConnectedInteractive::HasSelection (const Standard_Integer theMode) const
{
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
{
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
if (aChild.IsNull())
{
continue;
}
if (!aChild->HasSelection (theMode))
{
aChild->RecomputePrimitives (theMode);
}
Handle(SelectMgr_Selection) aSelection = new SelectMgr_Selection (theMode);
aChild->ComputeSelection (aSelection, theMode);
return Standard_False;
}
return Standard_True;
}
//=======================================================================

View File

@@ -72,11 +72,12 @@ public:
//! may be decomposed into sub-shapes for dynamic selection.
Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE;
//! Returns common entity owner if the object is an assembly
virtual const Handle(SelectMgr_EntityOwner)& GetAssemblyOwner() const Standard_OVERRIDE { return myAssemblyOwner; }
//! Returns the owner of mode for selection of object as a whole
virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE { return myAssemblyOwner; }
Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE;
//! Returns true if a selection corresponding to the selection mode theMode was computed for all
//! children of multiple connected interactive object.
Standard_EXPORT virtual Standard_Boolean HasSelection (const Standard_Integer theMode) const Standard_OVERRIDE;
//! Assigns interactive context.
Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& theCtx) Standard_OVERRIDE;
@@ -141,10 +142,6 @@ private:
//! Computes the selection for whole subtree in scene hierarchy.
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
protected:
Handle(SelectMgr_EntityOwner) myAssemblyOwner;
};
DEFINE_STANDARD_HANDLE(AIS_MultipleConnectedInteractive, AIS_InteractiveObject)

View File

@@ -41,7 +41,6 @@ void AIS_Selection::Clear()
{
myresult.Clear();
myResultMap.Clear();
myIterator = AIS_NListOfEntityOwner::Iterator();
}
//=======================================================================

View File

@@ -35,8 +35,6 @@
#include <Graphic3d_MaterialAspect.hxx>
#include <Graphic3d_SequenceOfGroup.hxx>
#include <Graphic3d_Structure.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <HLRBRep.hxx>
#include <OSD_Timer.hxx>
#include <Precision.hxx>
@@ -159,11 +157,14 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
OCC_CATCH_SIGNALS
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
}
catch (Standard_Failure const& anException)
catch (Standard_Failure)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::Compute() wireframe presentation builder has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
#ifdef OCCT_DEBUG
cout << "AIS_Shape::Compute() failed" << endl;
cout << "a Shape should be incorrect : No Compute can be maked on it " << endl;
#endif
// presentation of the bounding box is calculated
// Compute(aPresentationManager,aPrs,2);
}
break;
}
@@ -190,11 +191,11 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
&& !myDrawer->ShadingAspect()->Aspect()->TextureMap().IsNull(),
myUVOrigin, myUVRepeat, myUVScale);
}
catch (Standard_Failure const& anException)
catch (Standard_Failure)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::Compute() shaded presentation builder has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
#ifdef OCCT_DEBUG
cout << "AIS_Shape::Compute() in ShadingMode failed" << endl;
#endif
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
}
}
@@ -226,88 +227,150 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
}
//=======================================================================
//function : computeHlrPresentation
//purpose :
//function : Compute
//purpose : Hidden Line Removal
//=======================================================================
void AIS_Shape::computeHlrPresentation (const Handle(Prs3d_Projector)& theProjector,
const Handle(Prs3d_Presentation)& thePrs,
const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer)
void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation)
{
if (theShape.IsNull())
{
return;
}
Compute(aProjector,aPresentation,myshape);
}
switch (theShape.ShapeType())
{
case TopAbs_VERTEX:
case TopAbs_EDGE:
case TopAbs_WIRE:
{
thePrs->SetDisplayPriority (4);
StdPrs_WFShape::Add (thePrs, theShape, theDrawer);
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
const Handle(Geom_Transformation)& TheTrsf,
const Handle(Prs3d_Presentation)& aPresentation)
{
const TopLoc_Location& loc = myshape.Location();
TopoDS_Shape shbis = myshape.Located(TopLoc_Location(TheTrsf->Trsf())*loc);
Compute(aProjector,aPresentation,shbis);
}
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation,
const TopoDS_Shape& SH)
{
if (SH.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Iterator anExplor (SH);
if (!anExplor.More()) // Shape vide -> Assemblage vide.
return;
}
case TopAbs_COMPOUND:
{
TopoDS_Iterator anExplor (theShape);
if (!anExplor.More())
{
return;
}
break;
}
default:
{
break;
}
}
const Handle(Prs3d_Drawer)& aDefDrawer = theDrawer->Link();
if (aDefDrawer->DrawHiddenLine())
{
theDrawer->EnableDrawHiddenLine();
}
else
{
theDrawer->DisableDrawHiddenLine();
}
Handle (Prs3d_Drawer) defdrawer = GetContext()->DefaultDrawer();
if (defdrawer->DrawHiddenLine())
{myDrawer->EnableDrawHiddenLine();}
else {myDrawer->DisableDrawHiddenLine();}
const Aspect_TypeOfDeflection aPrevDef = aDefDrawer->TypeOfDeflection();
aDefDrawer->SetTypeOfDeflection (Aspect_TOD_RELATIVE);
if (theDrawer->IsAutoTriangulation())
{
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (theShape, theDrawer, Standard_True);
}
Aspect_TypeOfDeflection prevdef = defdrawer->TypeOfDeflection();
defdrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
if (myDrawer->IsAutoTriangulation())
{
try
// coefficients for calculation
Standard_Real aPrevAngle, aNewAngle, aPrevCoeff, aNewCoeff;
Standard_Boolean isOwnHLRDeviationAngle = OwnHLRDeviationAngle (aNewAngle, aPrevAngle);
Standard_Boolean isOwnHLRDeviationCoefficient = OwnHLRDeviationCoefficient (aNewCoeff, aPrevCoeff);
if (((Abs (aNewAngle - aPrevAngle) > Precision::Angular()) && isOwnHLRDeviationAngle) ||
((Abs (aNewCoeff - aPrevCoeff) > Precision::Confusion()) && isOwnHLRDeviationCoefficient))
{
BRepTools::Clean(SH);
}
}
{
try {
OCC_CATCH_SIGNALS
switch (theDrawer->TypeOfHLR())
{
switch (TypeOfHLR()) {
case Prs3d_TOH_Algo:
StdPrs_HLRShape::Add (thePrs, theShape, theDrawer, theProjector);
StdPrs_HLRShape::Add (aPresentation, SH, myDrawer, aProjector);
break;
case Prs3d_TOH_PolyAlgo:
default:
StdPrs_HLRPolyShape::Add (thePrs, theShape, theDrawer, theProjector);
StdPrs_HLRPolyShape::Add (aPresentation, SH, myDrawer, aProjector);
break;
}
}
catch (Standard_Failure const& anException)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::Compute() HLR Algorithm has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
StdPrs_WFShape::Add (thePrs, theShape, theDrawer);
catch (Standard_Failure) {
#ifdef OCCT_DEBUG
cout <<"AIS_Shape::Compute(Proj) HLR Algorithm failed" << endl;
#endif
StdPrs_WFShape::Add(aPresentation,SH,myDrawer);
}
}
aDefDrawer->SetTypeOfDeflection (aPrevDef);
defdrawer->SetTypeOfDeflection (prevdef);
}
//=======================================================================
//function : SelectionType
//purpose : gives the type according to the Index of Selection Mode
//=======================================================================
TopAbs_ShapeEnum AIS_Shape::SelectionType(const Standard_Integer aMode)
{
switch(aMode){
case 1:
return TopAbs_VERTEX;
case 2:
return TopAbs_EDGE;
case 3:
return TopAbs_WIRE;
case 4:
return TopAbs_FACE;
case 5:
return TopAbs_SHELL;
case 6:
return TopAbs_SOLID;
case 7:
return TopAbs_COMPSOLID;
case 8:
return TopAbs_COMPOUND;
case 0:
default:
return TopAbs_SHAPE;
}
}
//=======================================================================
//function : SelectionType
//purpose : gives the SelectionMode according to the Type od Decomposition...
//=======================================================================
Standard_Integer AIS_Shape::SelectionMode(const TopAbs_ShapeEnum aType)
{
switch(aType){
case TopAbs_VERTEX:
return 1;
case TopAbs_EDGE:
return 2;
case TopAbs_WIRE:
return 3;
case TopAbs_FACE:
return 4;
case TopAbs_SHELL:
return 5;
case TopAbs_SOLID:
return 6;
case TopAbs_COMPSOLID:
return 7;
case TopAbs_COMPOUND:
return 8;
case TopAbs_SHAPE:
default:
return 0;
}
}
//=======================================================================
//function : ComputeSelection
//purpose :
@@ -330,8 +393,7 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
// POP protection against crash in low layers
Standard_Real aDeflection = Prs3d::GetDeflection(shape, myDrawer);
try
{
try {
OCC_CATCH_SIGNALS
StdSelect_BRepSelectionTool::Load(aSelection,
this,
@@ -340,14 +402,9 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
aDeflection,
myDrawer->HLRAngle(),
myDrawer->IsAutoTriangulation());
}
catch (Standard_Failure const& anException)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::ComputeSelection(" + aMode + ") has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
if (aMode == 0)
{
} catch ( Standard_Failure ) {
// cout << "a Shape should be incorrect : A Selection on the Bnd is activated "<<endl;
if ( aMode == 0 ) {
aSelection->Clear();
Bnd_Box B = BoundingBox();
Handle(StdSelect_BRepOwner) aOwner = new StdSelect_BRepOwner(shape,this);

View File

@@ -211,42 +211,23 @@ public:
//! Returns the transparency attributes of the shape accordingly to
//! the current facing model;
Standard_EXPORT virtual Standard_Real Transparency() const Standard_OVERRIDE;
//! Return shape type for specified selection mode.
static TopAbs_ShapeEnum SelectionType (const Standard_Integer theSelMode)
{
switch (theSelMode)
{
case 1: return TopAbs_VERTEX;
case 2: return TopAbs_EDGE;
case 3: return TopAbs_WIRE;
case 4: return TopAbs_FACE;
case 5: return TopAbs_SHELL;
case 6: return TopAbs_SOLID;
case 7: return TopAbs_COMPSOLID;
case 8: return TopAbs_COMPOUND;
case 0: return TopAbs_SHAPE;
}
return TopAbs_SHAPE;
}
//! Return selection mode for specified shape type.
static Standard_Integer SelectionMode (const TopAbs_ShapeEnum theShapeType)
{
switch (theShapeType)
{
case TopAbs_VERTEX: return 1;
case TopAbs_EDGE: return 2;
case TopAbs_WIRE: return 3;
case TopAbs_FACE: return 4;
case TopAbs_SHELL: return 5;
case TopAbs_SOLID: return 6;
case TopAbs_COMPSOLID: return 7;
case TopAbs_COMPOUND: return 8;
case TopAbs_SHAPE: return 0;
}
return 0;
}
//! Activates the same TopAbs shape enumerations as
//! those used by SelectionMode assigning a type to the mode aDecompositionMode.
Standard_EXPORT static TopAbs_ShapeEnum SelectionType (const Standard_Integer aDecompositionMode);
//! Establishes an equivalence between a mode and the
//! type, aShapeType, of selection. The correspondences are as follows:
//! - mode 0 - Shape
//! - mode 1 - Vertex
//! - mode 2 - Edge
//! - mode 3 - Wire
//! - mode 4 - Face
//! - mode 5 - Shell
//! - mode 6 - Solid
//! - mode 7 - Compsolid
//! - mode 8 - Compound
Standard_EXPORT static Standard_Integer SelectionMode (const TopAbs_ShapeEnum aShapeType);
public: //! @name methods to alter texture mapping properties
@@ -275,31 +256,13 @@ public: //! @name methods to alter texture mapping properties
protected:
//! Compute normal presentation.
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Compute projected presentation.
virtual void Compute (const Handle(Prs3d_Projector)& theProjector,
const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE
{
computeHlrPresentation (theProjector, thePrs, myshape, myDrawer);
}
//! Compute projected presentation with transformation.
virtual void Compute (const Handle(Prs3d_Projector)& theProjector,
const Handle(Geom_Transformation)& theTrsf,
const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE
{
const TopLoc_Location& aLoc = myshape.Location();
const TopoDS_Shape aShape = myshape.Located (TopLoc_Location (theTrsf->Trsf()) * aLoc);
computeHlrPresentation (theProjector, thePrs, aShape, myDrawer);
}
//! Compute selection.
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
Standard_EXPORT void LoadRecomputable (const Standard_Integer TheMode);
@@ -311,13 +274,9 @@ protected:
Standard_EXPORT void setMaterial (const Handle(Prs3d_Drawer)& theDrawer, const Graphic3d_MaterialAspect& theMaterial, const Standard_Boolean theToKeepColor, const Standard_Boolean theToKeepTransp) const;
public:
private:
//! Compute HLR presentation for specified shape.
Standard_EXPORT static void computeHlrPresentation (const Handle(Prs3d_Projector)& theProjector,
const Handle(Prs3d_Presentation)& thePrs,
const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer);
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation, const TopoDS_Shape& ashape);
protected:

View File

@@ -103,8 +103,6 @@ void AIS_Trihedron::setOwnDatumAspect()
if (myDrawer->Link().IsNull())
return;
myDrawer->DatumAspect()->SetDrawArrows (myDrawer->Link()->DatumAspect()->ToDrawArrows());
myDrawer->DatumAspect()->SetDrawLabels (myDrawer->Link()->DatumAspect()->ToDrawLabels());
*myDrawer->DatumAspect()->TextAspect()->Aspect() =
*myDrawer->Link()->DatumAspect()->TextAspect()->Aspect();
*myDrawer->DatumAspect()->PointAspect()->Aspect() =
@@ -495,14 +493,14 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager
anAxisGroup->AddPrimitiveArray (arrayOfPrimitives (aPart));
// draw arrow
Handle(Graphic3d_Group) anArrowGroup = Prs3d_Root::NewGroup (thePrs);
anArrowGroup->SetPrimitivesAspect (anAspect->ArrowAspect()->Aspect());
Prs3d_DatumParts anArrowPart = anAspect->ArrowPartForAxis (aPart);
if (!anAspect->DrawDatumPart (anArrowPart))
{
continue;
}
Handle(Graphic3d_Group) anArrowGroup = Prs3d_Root::NewGroup (thePrs);
anArrowGroup->SetGroupPrimitivesAspect (anAspect->ArrowAspect()->Aspect());
anArrowGroup->AddPrimitiveArray (arrayOfPrimitives (anArrowPart));
}
}
@@ -716,25 +714,6 @@ void AIS_Trihedron::UnsetColor()
}
}
//=======================================================================
//function : ToDrawArrows
//purpose :
//=======================================================================
Standard_Boolean AIS_Trihedron::ToDrawArrows() const
{
return myDrawer->DatumAspect()->ToDrawArrows();
}
//=======================================================================
//function : SetDrawArrows
//purpose :
//=======================================================================
void AIS_Trihedron::SetDrawArrows (const Standard_Boolean theToDraw)
{
setOwnDatumAspect();
myDrawer->DatumAspect()->SetDrawArrows (theToDraw);
}
//=======================================================================
//function : createSensitiveEntity
//purpose :

View File

@@ -152,12 +152,6 @@ public:
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
Standard_EXPORT void SetAxisColor (const Quantity_Color& theColor);
//! Returns true if arrows are to be drawn
Standard_EXPORT Standard_Boolean ToDrawArrows() const;
//! Sets whether to draw the arrows in visualization
Standard_EXPORT void SetDrawArrows (const Standard_Boolean theToDraw);
//! Sets priority of selection for owner of the given type
void SetSelectionPriority (Prs3d_DatumParts thePart,
Standard_Integer thePriority)

View File

@@ -45,34 +45,29 @@ static Standard_Boolean IsTimeStamp
case 4 : if (uncar < '0' || uncar > '9') return Standard_False;
break;
case 5 : if (uncar != '-') return Standard_False;
Standard_FALLTHROUGH
case 6 : if (uncar != '0' && uncar != '1') return Standard_False;
break;
case 7 : if (uncar < '0' || uncar > '9') return Standard_False;
if (dizmois == '1' && (uncar < '0' || uncar > '2')) return Standard_False;
break;
case 8 : if (uncar != '-') return Standard_False;
Standard_FALLTHROUGH
case 9 : if (uncar < '0' || uncar > '3') return Standard_False;
break;
case 10 : if (uncar < '0' || uncar > '9') return Standard_False;
if (dizjour == '3' && (uncar != '0' && uncar != '1')) return Standard_False;
break;
case 11 : if (uncar != 'T') return Standard_False;
Standard_FALLTHROUGH
case 12 : if (uncar < '0' || uncar > '2') return Standard_False;
break;
case 13 : if (uncar < '0' || uncar > '9') return Standard_False;
if (dizheur == '2' && (uncar < '0' || uncar > '3')) return Standard_False;
break;
case 14 : if (uncar != ':') return Standard_False;
Standard_FALLTHROUGH
case 15 : if (uncar < '0' || uncar > '5') return Standard_False;
break;
case 16 : if (uncar < '0' || uncar > '9') return Standard_False;
break;
case 17 : if (uncar != ':') return Standard_False;
Standard_FALLTHROUGH
case 18 : if (uncar < '0' || uncar > '5') return Standard_False;
break;
case 19 : if (uncar < '0' || uncar > '9') return Standard_False;

View File

@@ -138,12 +138,12 @@ Standard_Boolean AppDef_MyLineTool::Tangency(const AppDef_MultiLine& ML,
}
AppDef_MultiLine AppDef_MyLineTool::MakeMLBetween(const AppDef_MultiLine& theML,
AppDef_MultiLine& AppDef_MyLineTool::MakeMLBetween(const AppDef_MultiLine&,
const Standard_Integer ,
const Standard_Integer ,
const Standard_Integer )
{
return theML; // stub
return *((AppDef_MultiLine*) 0);
}
Standard_Boolean AppDef_MyLineTool::MakeMLOneMorePoint(const AppDef_MultiLine& ,

View File

@@ -94,7 +94,7 @@ public:
//! Is never called in the algorithms.
//! Nothing is done.
Standard_EXPORT static AppDef_MultiLine MakeMLBetween (const AppDef_MultiLine& ML,
Standard_EXPORT static AppDef_MultiLine& MakeMLBetween (const AppDef_MultiLine& ML,
const Standard_Integer I1,
const Standard_Integer I2,
const Standard_Integer NbPMin);
@@ -106,6 +106,27 @@ public:
const Standard_Integer I2,
const Standard_Integer indbad,
AppDef_MultiLine& OtherLine);
protected:
private:
};
#endif // _AppDef_MyLineTool_HeaderFile

View File

@@ -50,7 +50,6 @@ Approx_ComputeCLine::Approx_ComputeCLine
mycut = cutting;
myfirstC = FirstC;
mylastC = LastC;
myMaxSegments = IntegerLast();
alldone = Standard_False;
Perform(Line);
}
@@ -77,7 +76,6 @@ Approx_ComputeCLine::Approx_ComputeCLine
mycut = cutting;
myfirstC = FirstC;
mylastC = LastC;
myMaxSegments = IntegerLast();
}
//=======================================================================
@@ -93,11 +91,9 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
Standard_Real thetol3d = Precision::Confusion(), thetol2d = Precision::Confusion();
UFirst = Line.FirstParameter();
ULast = Line.LastParameter();
Standard_Real TolU = Max((ULast-UFirst)*1.e-05, Precision::PApproximation());
Standard_Real TolU = (ULast-UFirst)*1.e-05;
Standard_Real myfirstU = UFirst;
Standard_Real mylastU = ULast;
Standard_Integer aMaxSegments = 0;
Standard_Integer aMaxSegments1 = myMaxSegments - 1;
if (!mycut)
{
@@ -130,8 +126,7 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
// Calcul de la partie a approximer.
myfirstU = mylastU;
mylastU = ULast;
if (Abs(ULast-myfirstU) <= RealEpsilon()
|| aMaxSegments >= myMaxSegments)
if (Abs(ULast-myfirstU) <= RealEpsilon())
{
Finish = Standard_True;
alldone = Standard_True;
@@ -160,15 +155,11 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
// Calcul des parametres sur ce nouvel intervalle.
Ok = Compute(Line, myfirstU, mylastU, thetol3d, thetol2d);
if(Ok)
{
aMaxSegments++;
}
//cout << myfirstU << " - " << mylastU << " tol : " << thetol3d << " " << thetol2d << endl;
// is new decision better?
if (!Ok && (Abs(myfirstU-mylastU) <= TolU || aMaxSegments >= aMaxSegments1))
if (!Ok && Abs(myfirstU-mylastU) <= TolU)
{
Ok = Standard_True; // stop interval cutting, approx the rest part
@@ -185,7 +176,6 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
tolreached = Standard_False; // helas
myMultiCurves.Append(KeptMultiCurve);
aMaxSegments++;
Tolers3d.Append (KeptT3d);
Tolers2d.Append (KeptT2d);
myfirstparam.Append (KeptUfirst);
@@ -313,16 +303,6 @@ void Approx_ComputeCLine::SetConstraints(const AppParCurves_Constraint FirstC,
mylastC = LastC;
}
//=======================================================================
//function : SetMaxSegments
//purpose : Changes the max number of segments, which is allowed for cutting.
//=======================================================================
void Approx_ComputeCLine:: SetMaxSegments(const Standard_Integer theMaxSegments)
{
myMaxSegments = theMaxSegments;
}
//=======================================================================
//function : IsAllApproximated
//purpose : returns False if at a moment of the approximation,

View File

@@ -354,7 +354,6 @@ void Approx_CurvlinFunc::Trim(const Standard_Real First, const Standard_Real Las
myC2D2 = ((Adaptor3d_CurveOnSurface *)(&(HCurOnSur->Curve())))->GetCurve();
mySurf2 = ((Adaptor3d_CurveOnSurface *)(&(HCurOnSur->Curve())))->GetSurface();
Standard_FALLTHROUGH
case 2:
CurOnSur.Load(myC2D1);
CurOnSur.Load(mySurf1);

View File

@@ -60,9 +60,6 @@ public:
//! Changes the constraints of the approximation.
Standard_EXPORT void SetConstraints (const AppParCurves_Constraint FirstC, const AppParCurves_Constraint LastC);
//! Changes the max number of segments, which is allowed for cutting.
Standard_EXPORT void SetMaxSegments (const Standard_Integer theMaxSegments);
//! returns False if at a moment of the approximation,
//! the status NoApproximation has been sent by the user
@@ -117,7 +114,6 @@ private:
Standard_Boolean mycut;
AppParCurves_Constraint myfirstC;
AppParCurves_Constraint mylastC;
Standard_Integer myMaxSegments;
};

View File

@@ -60,9 +60,6 @@ public:
//! Changes the constraints of the approximation.
Standard_EXPORT void SetConstraints (const AppParCurves_Constraint FirstC, const AppParCurves_Constraint LastC);
//! Changes the max number of segments, which is allowed for cutting.
Standard_EXPORT void SetMaxSegments (const Standard_Integer theMaxSegments);
//! returns False if at a moment of the approximation,
//! the status NoApproximation has been sent by the user
@@ -117,7 +114,6 @@ private:
Standard_Boolean mycut;
AppParCurves_Constraint myfirstC;
AppParCurves_Constraint mylastC;
Standard_Integer myMaxSegments;
};

View File

@@ -71,7 +71,10 @@ static
//purpose :
//=======================================================================
BOPAlgo_BOP::BOPAlgo_BOP()
: BOPAlgo_ToolsProvider()
:
BOPAlgo_Builder(),
myTools(myAllocator),
myMapTools(100, myAllocator)
{
Clear();
}
@@ -79,8 +82,12 @@ BOPAlgo_BOP::BOPAlgo_BOP()
//function :
//purpose :
//=======================================================================
BOPAlgo_BOP::BOPAlgo_BOP(const Handle(NCollection_BaseAllocator)& theAllocator)
: BOPAlgo_ToolsProvider(theAllocator)
BOPAlgo_BOP::BOPAlgo_BOP
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Builder(theAllocator),
myTools(myAllocator),
myMapTools(100, myAllocator)
{
Clear();
}
@@ -98,10 +105,12 @@ BOPAlgo_BOP::~BOPAlgo_BOP()
void BOPAlgo_BOP::Clear()
{
myOperation=BOPAlgo_UNKNOWN;
myTools.Clear();
myMapTools.Clear();
myDims[0]=-1;
myDims[1]=-1;
BOPAlgo_ToolsProvider::Clear();
//
BOPAlgo_Builder::Clear();
}
//=======================================================================
//function : SetOperation
@@ -120,6 +129,31 @@ 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 :
//=======================================================================

View File

@@ -24,7 +24,7 @@
#include <TopoDS_Shape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPAlgo_ToolsProvider.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <Standard_Boolean.hxx>
@@ -66,7 +66,7 @@ class BOPAlgo_PaveFiller;
//! - *BOPAlgo_AlertSolidBuilderFailed* - in case the BuilderSolid algorithm failed to
//! produce the Fused solid.
//!
class BOPAlgo_BOP : public BOPAlgo_ToolsProvider
class BOPAlgo_BOP : public BOPAlgo_Builder
{
public:
@@ -75,13 +75,18 @@ 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);
//! 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;
@@ -111,11 +116,16 @@ protected:
//! 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;
Standard_Integer myDims[2];
TopoDS_Shape myRC;
BOPCol_ListOfShape myTools;
BOPCol_MapOfShape myMapTools;
private:
};
#endif // _BOPAlgo_BOP_HeaderFile

View File

@@ -25,7 +25,6 @@
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_MapOfOrientedShape.hxx>
@@ -51,7 +50,6 @@
#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>
@@ -71,7 +69,65 @@ static
static
void MakeInternalWires(const BOPCol_IndexedMapOfShape& ,
BOPCol_ListOfShape& );
static
void GetWire(const TopoDS_Shape& ,
TopoDS_Shape& );
//
//
//=======================================================================
//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 :
@@ -380,198 +436,239 @@ void BOPAlgo_BuilderFace::PerformLoops()
//=======================================================================
void BOPAlgo_BuilderFace::PerformAreas()
{
myAreas.Clear();
BRep_Builder aBB;
// Location of the myFace
Standard_Boolean bIsGrowth, bIsHole;
Standard_Integer k, aNbS, aNbHoles, aNbDMISB, m, aNbMSH, aNbInOutMap;
Standard_Real aTol;
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;
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)) {
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;
}
// The new faces
BOPCol_ListOfShape aNewFaces;
// The hole faces which has to be classified relatively new faces
BOPCol_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.
BOPCol_IndexedMapOfShape aMHE;
// Analyze the new wires - classify them to be the holes and growths
BOPCol_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);
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();
}
// Save the face
if (bIsGrowth)
{
aNewFaces.Append(aFace);
}
else
{
aHoleFaces.Add(aFace);
BOPTools::MapShapes(aWire, TopAbs_EDGE, aMHE);
}
}
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
BOPCol_Box2DBndTree 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));
//
// 1. Growthes and Holes -> aDMISB: [Index/ShapeBox2D]
aIt1.Initialize(myLoops);
for (k=0 ; aIt1.More(); aIt1.Next(), ++k) {
Bnd_Box2d aBox2D;
//
Bnd_Box2d aBox;
BRepTools::AddUVBounds(aHFace, aBox);
aTreeFiller.Add(i, aBox);
const TopoDS_Shape& aWire=aIt1.Value();
//
aBB.MakeFace(aFace, aS, aLoc, aTol);
aBB.Add (aFace, aWire);
BRepTools::AddUVBounds(aFace, aBox2D);
//
bIsGrowth=IsGrowthWire(aWire, aMHE);
if (bIsGrowth) {
bIsHole=Standard_False;
}
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;
}
}
//
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;
}
}
// Shake TreeFiller
//
// 3. Shake TreeFiller
aTreeFiller.Fill();
// Find outer growth face that is most close to each hole face
BOPCol_IndexedDataMapOfShapeShape aHoleFaceMap;
BOPCol_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);
BOPCol_Box2DBndTreeSelector aSelector;
aSelector.SetBox(aBox);
aBBTree.Select(aSelector);
const BOPCol_ListOfInteger& aLI = aSelector.Indices();
BOPCol_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))
//
// 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();
//
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)){
continue;
// Save the relation
TopoDS_Shape* pFaceWas = aHoleFaceMap.ChangeSeek(aHole);
if (pFaceWas)
{
if (IsInside(aFace, *pFaceWas, myContext))
{
*pFaceWas = aFace;
}
//
if (aInOutMap.Contains(aHole)){
TopoDS_Shape& aF2=aInOutMap.ChangeFromKey(aHole);
if (IsInside(aF, aF2, myContext)) {
aF2=aF;
}
}
else
{
aHoleFaceMap.Add(aHole, aFace);
else{
aInOutMap.Add(aHole, aF);
}
}
}
// Make the back map from faces to holes
BOPCol_IndexedDataMapOfShapeListOfShape aFaceHolesMap;
aNbH = aHoleFaceMap.Extent();
for (i = 1; i <= aNbH; ++i)
{
const TopoDS_Shape& aHole = aHoleFaceMap.FindKey(i);
const TopoDS_Shape& aFace = aHoleFaceMap(i);
}// 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);
//
BOPCol_ListOfShape* pLHoles = aFaceHolesMap.ChangeSeek(aFace);
if (!pLHoles)
pLHoles = &aFaceHolesMap(aFaceHolesMap.Add(aFace, BOPCol_ListOfShape()));
pLHoles->Append(aHole);
if (aMSH.Contains(aF)) {
BOPCol_ListOfShape& aLH=aMSH.ChangeFromKey(aF);
aLH.Append(aHole);
}
else {
BOPCol_ListOfShape aLH;
aLH.Append(aHole);
aMSH.Add(aF, aLH);
}
}
// Add unused holes to the original face
if (aHoleFaces.Extent() != aHoleFaceMap.Extent())
{
//
// 5.2. Add unused holes to the original face
if (aNbHoles != aNbInOutMap) {
Bnd_Box aBoxF;
BRepBndLib::Add(myFace, aBoxF);
if (aBoxF.IsOpenXmin() || aBoxF.IsOpenXmax() ||
aBoxF.IsOpenYmin() || aBoxF.IsOpenYmax() ||
aBoxF.IsOpenZmin() || aBoxF.IsOpenZmax())
{
TopoDS_Face aFace;
aBB.MakeFace(aFace, aS, aLoc, aTol);
BOPCol_ListOfShape& anUnUsedHoles = aFaceHolesMap(aFaceHolesMap.Add(aFace, BOPCol_ListOfShape()));
aNbH = aHoleFaces.Extent();
for (i = 1; i <= aNbH; ++i)
{
const TopoDS_Shape& aHole = aHoleFaces(i);
if (!aHoleFaceMap.Contains(aHole))
anUnUsedHoles.Append(aHole);
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);
}
}
}
//
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 BOPCol_ListOfShape* pLHoles = aFaceHolesMap.Seek(aFace);
if (pLHoles)
{
// update faces with the holes
BOPCol_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);
}
// The face is just a draft that does not contain any internal shapes
myAreas.Append(aFace);
//
// 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();
}
}
//=======================================================================
@@ -754,14 +851,18 @@ Standard_Boolean IsInside(const TopoDS_Shape& theHole,
Standard_Boolean IsGrowthWire(const TopoDS_Shape& theWire,
const BOPCol_IndexedMapOfShape& theMHE)
{
if (theMHE.Extent())
{
TopoDS_Iterator aIt(theWire);
for(; aIt.More(); aIt.Next())
{
if (theMHE.Contains(aIt.Value()))
return Standard_True;
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;
}
}
}
return Standard_False;
return bRet;
}

View File

@@ -77,6 +77,57 @@ static
void MakeInternalShells(const BOPCol_IndexedMapOfShape& ,
BOPCol_ListOfShape& );
//=======================================================================
//class : BOPAlgo_BuilderSolid_ShapeBox
//purpose : Auxiliary class
//=======================================================================
class BOPAlgo_BuilderSolid_ShapeBox {
public:
BOPAlgo_BuilderSolid_ShapeBox() {
myIsHole=Standard_False;
};
//
~BOPAlgo_BuilderSolid_ShapeBox() {
};
//
void SetShape(const TopoDS_Shape& aS) {
myShape=aS;
};
//
const TopoDS_Shape& Shape()const {
return myShape;
};
//
void SetBox(const Bnd_Box& aBox) {
myBox=aBox;
};
//
const Bnd_Box& Box()const {
return myBox;
};
//
void SetIsHole(const Standard_Boolean bFlag) {
myIsHole=bFlag;
};
//
Standard_Boolean IsHole()const {
return myIsHole;
};
//
protected:
Standard_Boolean myIsHole;
TopoDS_Shape myShape;
Bnd_Box myBox;
};
//
typedef NCollection_DataMap
<Standard_Integer,
BOPAlgo_BuilderSolid_ShapeBox,
TColStd_MapIntegerHasher> BOPAlgo_DataMapOfIntegerBSSB;
//
typedef BOPAlgo_DataMapOfIntegerBSSB::Iterator
BOPAlgo_DataMapIteratorOfDataMapOfIntegerBSSB;
//
//=======================================================================
//function : BOPAlgo_FacePnt
//purpose :
@@ -249,9 +300,6 @@ void BOPAlgo_BuilderSolid::Perform()
{
GetReport()->Clear();
//
if (myShapes.IsEmpty())
return;
if (myContext.IsNull()) {
myContext=new IntTools_Context;
}
@@ -524,158 +572,178 @@ void BOPAlgo_BuilderSolid::PerformLoops()
//=======================================================================
void BOPAlgo_BuilderSolid::PerformAreas()
{
myAreas.Clear();
BRep_Builder aBB;
// The new solids
BOPCol_ListOfShape aNewSolids;
// The hole shells which has to be classified relatively new solids
BOPCol_IndexedMapOfShape aHoleShells;
// Map of the faces of the hole shells for quick check of the growths.
// If the analyzed shell contains any of the hole faces, it is considered as growth.
Standard_Boolean bIsGrowth, bIsHole;
Standard_Integer i, k, aNbInOut, aNbMSH;
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfShape aItLS;
BOPCol_ListOfShape aNewSolids, aHoleShells;
BOPCol_IndexedDataMapOfShapeShape aInOutMap;
BOPCol_IndexedMapOfShape aMHF;
// Analyze the shells
BOPCol_ListIteratorOfListOfShape aItLL(myLoops);
for (; aItLL.More(); aItLL.Next())
{
const TopoDS_Shape& aShell = aItLL.Value();
Standard_Boolean bIsGrowth = IsGrowthShell(aShell, aMHF);
if (!bIsGrowth)
{
// Fast check did not give the result, run classification
bIsGrowth = !IsHole(aShell, myContext);
}
// Save the solid
if (bIsGrowth)
{
TopoDS_Solid aSolid;
BOPCol_ListIteratorOfListOfInteger aItLI;
BOPCol_BoxBndTreeSelector aSelector;
BOPCol_BoxBndTree aBBTree;
NCollection_UBTreeFiller
<Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
BOPAlgo_DataMapOfIntegerBSSB aDMISB(100);
BOPCol_IndexedDataMapOfShapeListOfShape aMSH;
BOPAlgo_DataMapIteratorOfDataMapOfIntegerBSSB aItDMISB;
//
myAreas.Clear();
//
// Draft solids [aNewSolids]
aItLS.Initialize(myLoops);
for (k=0; aItLS.More(); aItLS.Next(), ++k) {
TopoDS_Solid aSolid;
Bnd_Box aBox;
BOPAlgo_BuilderSolid_ShapeBox aSB;
//
const TopoDS_Shape& aShell = aItLS.Value();
aSB.SetShape(aShell);
//
BRepBndLib::Add(aShell, aBox);
bIsHole=Standard_False;
//
bIsGrowth=IsGrowthShell(aShell, aMHF);
if (bIsGrowth) {
// make a growth solid from a shell
aBB.MakeSolid(aSolid);
aBB.Add (aSolid, aShell);
//
aNewSolids.Append (aSolid);
aSB.SetShape(aSolid);
}
else
{
aHoleShells.Add(aShell);
BOPTools::MapShapes(aShell, TopAbs_FACE, aMHF);
else{
// check if a shell is a hole
bIsHole=IsHole(aShell, myContext);
if (bIsHole) {
aHoleShells.Append(aShell);
BOPTools::MapShapes(aShell, TopAbs_FACE, aMHF);
aSB.SetShape(aShell);
}
else {
// make a growth solid from a shell
aBB.MakeSolid(aSolid);
aBB.Add (aSolid, aShell);
//
aNewSolids.Append (aSolid);
aSB.SetShape(aSolid);
}
}
}
if (aHoleShells.IsEmpty())
{
// No holes, stop the analysis
myAreas.Append(aNewSolids);
return;
}
// Classify holes relatively solids
// Prepare tree filler with the boxes of the hole shells
BOPCol_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
Standard_Integer i, aNbH = aHoleShells.Extent();
for (i = 1; i <= aNbH; ++i)
{
const TopoDS_Shape& aHShell = aHoleShells(i);
//
Bnd_Box aBox;
BRepBndLib::Add(aHShell, aBox);
aTreeFiller.Add(i, aBox);
aSB.SetBox(aBox);
aSB.SetIsHole(bIsHole);
aDMISB.Bind(k, aSB);
}
//
// 2. Prepare TreeFiller
aItDMISB.Initialize(aDMISB);
for (; aItDMISB.More(); aItDMISB.Next()) {
k=aItDMISB.Key();
const BOPAlgo_BuilderSolid_ShapeBox& aSB=aItDMISB.Value();
//
bIsHole=aSB.IsHole();
if (bIsHole) {
const Bnd_Box& aBox=aSB.Box();
aTreeFiller.Add(k, aBox);
}
}
// Shake TreeFiller
//
// 3. Shake TreeFiller
aTreeFiller.Fill();
// Find outer growth shell that is most close to each hole shell
BOPCol_IndexedDataMapOfShapeShape aHoleSolidMap;
BOPCol_ListIteratorOfListOfShape aItLS(aNewSolids);
for (; aItLS.More(); aItLS.Next())
{
const TopoDS_Shape& aSolid = aItLS.Value();
// Build box
Bnd_Box aBox;
BRepBndLib::Add(aSolid, aBox);
BOPCol_BoxBndTreeSelector aSelector;
aSelector.SetBox(aBox);
//
// 4. Find outer growth shell that is most close
// to each hole shell
aItDMISB.Initialize(aDMISB);
for (; aItDMISB.More(); aItDMISB.Next()) {
k=aItDMISB.Key();
const BOPAlgo_BuilderSolid_ShapeBox& aSB=aItDMISB.Value();
bIsHole=aSB.IsHole();
if (bIsHole) {
continue;
}
//
const TopoDS_Shape aSolid=aSB.Shape();
const Bnd_Box& aBoxSolid=aSB.Box();
//
aSelector.Clear();
aSelector.SetBox(aBoxSolid);
//
aBBTree.Select(aSelector);
const BOPCol_ListOfInteger& aLI = aSelector.Indices();
BOPCol_ListIteratorOfListOfInteger aItLI(aLI);
for (; aItLI.More(); aItLI.Next())
{
Standard_Integer k = aItLI.Value();
const TopoDS_Shape& aHole = aHoleShells(k);
// Check if it is inside
if (!IsInside(aHole, aSolid, myContext))
//
const BOPCol_ListOfInteger& aLI=aSelector.Indices();
//
aItLI.Initialize(aLI);
for (; aItLI.More(); aItLI.Next()) {
k=aItLI.Value();
const BOPAlgo_BuilderSolid_ShapeBox& aSBk=aDMISB.Find(k);
const TopoDS_Shape& aHole=aSBk.Shape();
//
if (!IsInside(aHole, aSolid, myContext)){
continue;
// Save the relation
TopoDS_Shape* pSolidWas = aHoleSolidMap.ChangeSeek(aHole);
if (pSolidWas)
{
if (IsInside(aSolid, *pSolidWas, myContext))
{
*pSolidWas = aSolid;
}
//
if (aInOutMap.Contains (aHole)){
const TopoDS_Shape& aSolidWas = aInOutMap.FindFromKey(aHole);
if (IsInside(aSolid, aSolidWas, myContext)) {
aInOutMap.ChangeFromKey(aHole) = aSolid;
}
}
else
{
aHoleSolidMap.Add(aHole, aSolid);
else{
aInOutMap.Add(aHole, aSolid);
}
}
}
// Make the back map from solids to holes
BOPCol_IndexedDataMapOfShapeListOfShape aSolidHolesMap;
aNbH = aHoleSolidMap.Extent();
for (i = 1; i <= aNbH; ++i)
{
const TopoDS_Shape& aHole = aHoleSolidMap.FindKey(i);
const TopoDS_Shape& aSolid = aHoleSolidMap(i);
}//for (i = 1; i <= aNbDMISB; ++i) {
//
// 5. Map [Solid/Holes] -> aMSH
aNbInOut = aInOutMap.Extent();
for (i = 1; i <= aNbInOut; ++i) {
const TopoDS_Shape& aHole = aInOutMap.FindKey(i);
const TopoDS_Shape& aSolid = aInOutMap(i);
//
BOPCol_ListOfShape* pLHoles = aSolidHolesMap.ChangeSeek(aSolid);
if (!pLHoles)
pLHoles = &aSolidHolesMap(aSolidHolesMap.Add(aSolid, BOPCol_ListOfShape()));
pLHoles->Append(aHole);
}
// Add Holes to Solids and add them to myAreas
aItLS.Initialize(aNewSolids);
for ( ; aItLS.More(); aItLS.Next())
{
TopoDS_Solid& aSolid = *(TopoDS_Solid*)&aItLS.Value();
const BOPCol_ListOfShape* pLHoles = aSolidHolesMap.Seek(aSolid);
if (pLHoles)
{
// update solid
BOPCol_ListIteratorOfListOfShape aItLH(*pLHoles);
for (; aItLH.More(); aItLH.Next())
{
const TopoDS_Shape& aHole = aItLH.Value();
aBB.Add(aSolid, aHole);
}
// update classifier
myContext->SolidClassifier(aSolid).Load(aSolid);
if (aMSH.Contains(aSolid)) {
BOPCol_ListOfShape& aLH = aMSH.ChangeFromKey(aSolid);
aLH.Append(aHole);
}
else {
BOPCol_ListOfShape aLH;
aLH.Append(aHole);
aMSH.Add(aSolid, aLH);
}
myAreas.Append(aSolid);
}
//
// 6. Add aHoles to Solids
aNbMSH = aMSH.Extent();
for (i = 1; i <= aNbMSH; ++i) {
TopoDS_Solid aSolid=(*(TopoDS_Solid*)(&(aMSH.FindKey(i))));
const BOPCol_ListOfShape& aLH = aMSH(i);
//
aItLS.Initialize(aLH);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aHole = aItLS.Value();
aBB.Add (aSolid, aHole);
}
//
// update classifier
BRepClass3d_SolidClassifier& aSC=
myContext->SolidClassifier(aSolid);
aSC.Load(aSolid);
//
}
//
// 7. These aNewSolids are draft solids that
// do not contain any internal shapes
aItLS.Initialize(aNewSolids);
for ( ; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSx=aItLS.Value();
myAreas.Append(aSx);
}
// Add holes that outside the solids to myAreas
aNbH = aHoleShells.Extent();
for (i = 1; i <= aNbH; ++i)
{
const TopoDS_Shape& aHole = aHoleShells(i);
if (!aHoleSolidMap.Contains(aHole))
{
aItLS.Initialize(aHoleShells);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aHole = aItLS.Value();
if (!aInOutMap.Contains(aHole)){
TopoDS_Solid aSolid;
//
aBB.MakeSolid(aSolid);
aBB.Add (aSolid, aHole);
//
@@ -1005,14 +1073,18 @@ Standard_Boolean IsInside(const TopoDS_Shape& theS1,
Standard_Boolean IsGrowthShell(const TopoDS_Shape& theShell,
const BOPCol_IndexedMapOfShape& theMHF)
{
if (theMHF.Extent())
{
TopoDS_Iterator aIt(theShell);
for(; aIt.More(); aIt.Next())
{
if (theMHF.Contains(aIt.Value()))
return Standard_True;
Standard_Boolean bRet;
TopoDS_Iterator aIt;
//
bRet=Standard_False;
if (theMHF.Extent()) {
aIt.Initialize(theShell);
for(; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value();
if (theMHF.Contains(aF)) {
return !bRet;
}
}
}
return Standard_False;
return bRet;
}

View File

@@ -51,7 +51,6 @@
#include <Precision.hxx>
#include <IntTools_Context.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
@@ -63,11 +62,6 @@ static
Standard_Boolean HasPaveBlocksOnIn(const BOPDS_FaceInfo& aFI1,
const BOPDS_FaceInfo& aFI2);
//
static
TopoDS_Face BuildDraftFace(const TopoDS_Face& theFace,
const BOPCol_DataMapOfShapeListOfShape& theImages,
Handle(IntTools_Context)& theCtx);
//
typedef BOPCol_NCVector<TopoDS_Shape> BOPAlgo_VectorOfShape;
//
typedef BOPCol_NCVector<BOPAlgo_VectorOfShape> \
@@ -246,6 +240,7 @@ 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;
@@ -254,6 +249,7 @@ void BOPAlgo_Builder::BuildSplitFaces()
BOPCol_ListOfInteger aLIAV;
BOPCol_MapOfShape aMFence;
Handle(NCollection_BaseAllocator) aAllocator;
BOPCol_ListOfShape aLFIm(myAllocator);
BOPAlgo_VectorOfBuilderFace aVBF;
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~scope f
@@ -263,10 +259,6 @@ void BOPAlgo_Builder::BuildSplitFaces()
BOPCol_ListOfShape aLE(aAllocator);
BOPCol_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, BOPCol_ListOfShape> aFacesIm;
//
aNbS=myDS->NbSourceShapes();
//
for (i=0; i<aNbS; ++i) {
@@ -300,32 +292,17 @@ void BOPAlgo_Builder::BuildSplitFaces()
if (!aNbPBIn && !aNbPBOn && !aNbPBSc && !aNbAV) { // not compete
continue;
}
if (!aNbPBIn && !aNbPBSc)
{
// 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, BOPCol_ListOfShape())).Append(aFD);
continue;
}
}
//
aMFence.Clear();
//
anOriF=aF.Orientation();
aFF=aF;
aFF.Orientation(TopAbs_FORWARD);
//
// 1. Fill the edges set for the face aFF -> LE
// 1. Fill the egdes set for the face aFF -> LE
aLE.Clear();
//
//
// 1.1 Bounding edges
aExp.Init(aFF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
@@ -449,33 +426,33 @@ void BOPAlgo_Builder::BuildSplitFaces()
//
}// for (i=0; i<aNbS; ++i) {
//
aNbBF=aVBF.Extent();
//
//===================================================
BOPAlgo_BuilderFaceCnt::Perform(myRunParallel, aVBF);
//===================================================
//
Standard_Integer aNbBF = aVBF.Extent();
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 BOPCol_ListOfShape& aLFR = aFacesIm(k);
for (k=0; k<(Standard_Integer)aNbBF; ++k) {
aLFIm.Clear();
//
BOPCol_ListOfShape* pLFIm = mySplits.Bound(aF, BOPCol_ListOfShape());
BOPAlgo_BuilderFace& aBF=aVBF(k);
TopoDS_Face aF=aBF.Face();
anOriF=aBF.Orientation();
aF.Orientation(anOriF);
//
const BOPCol_ListOfShape& aLFR=aBF.Areas();
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);
pLFIm->Append(aFR);
}
//aFR.Orientation(anOriF);
aLFIm.Append(aFR);
}
}
//
mySplits.Bind(aF, aLFIm);
}// for (k=0; k<aNbBF; ++k) {
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~scope t
}
@@ -793,98 +770,3 @@ Standard_Boolean HasPaveBlocksOnIn(const BOPDS_FaceInfo& aFI1,
}
return bRet;
}
//=======================================================================
//function : BuildDraftFace
//purpose : Build draft faces, updating the bounding edges,
// according to the information stored into the <theImages> map
//=======================================================================
TopoDS_Face BuildDraftFace(const TopoDS_Face& theFace,
const BOPCol_DataMapOfShapeListOfShape& theImages,
Handle(IntTools_Context)& theCtx)
{
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 BOPCol_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);
BOPCol_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);
}
if (theFace.Orientation() == TopAbs_REVERSED)
aDraftFace.Reverse();
return aDraftFace;
}

View File

@@ -222,11 +222,12 @@ class BOPAlgo_FillIn3DParts : public BOPAlgo_Algo {
const Handle(NCollection_BaseAllocator)& );
void MakeConnexityBlock
(const TopoDS_Face& ,
(const BOPCol_ListOfShape& ,
const BOPCol_IndexedMapOfShape& ,
const BOPCol_MapOfShape& ,
const BOPCol_IndexedDataMapOfShapeListOfShape& ,
BOPCol_MapOfShape& ,
BOPCol_ListOfShape& );
BOPCol_ListOfShape& ,
const Handle(NCollection_BaseAllocator)& );
//
protected:
TopoDS_Solid mySolid;
@@ -256,13 +257,14 @@ void BOPAlgo_FillIn3DParts::Perform()
//
Standard_Integer aNbFP, k, nFP, iIsIN;
Standard_Real aTolPC;
BOPCol_ListIteratorOfListOfInteger aItLI;
BOPCol_ListIteratorOfListOfInteger aItLI, aItLI1;
BOPCol_ListIteratorOfListOfShape aItLS;
BOPCol_BoxBndTreeSelector aSelector;
//
aAlr1=
NCollection_BaseAllocator::CommonBaseAllocator();
//
BOPCol_ListOfShape aLFP(aAlr1);
BOPCol_ListOfShape aLCBF(aAlr1);
BOPCol_MapOfShape aMFDone(100, aAlr1);
BOPCol_IndexedMapOfShape aME(100, aAlr1);
@@ -332,16 +334,28 @@ void BOPAlgo_FillIn3DParts::Perform()
iIsIN=BOPTools_AlgoTools::IsInternalFace
(aFP, myDraftSolid, aMEF, aTolPC, myContext);
//
// Make connexity blocks of faces, avoiding passing through the
// borders of the solid.
// It helps to reduce significantly the number of classified faces.
aLCBF.Clear();
MakeConnexityBlock(aFP, aME, aMEFP, aMFDone, aLCBF);
aLFP.Clear();
aLFP.Append(aFP);
//
if (iIsIN) {
aItLS.Initialize(aLCBF);
for (; aItLS.More(); aItLS.Next())
myLFIN.Append(aItLS.Value());
aItLI1.Initialize(aLIFP);
for (; aItLI1.More(); aItLI1.Next()) {
const TopoDS_Shape& aFx=aVSB(aItLI1.Value()).Shape();
if (!aMFDone.Contains(aFx)) {
aLFP.Append(aFx);
}
}
//
aLCBF.Clear();
//
MakeConnexityBlock(aLFP, aME, aMFDone, aMEFP, aLCBF, aAlr1);
//
aItLS.Initialize(aLCBF);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aFx=aItLS.Value();
aMFDone.Add(aFx);
if (iIsIN) {
myLFIN.Append(aFx);
}
}
} // for (k=0; k<aNbFP; ++k) {
}
@@ -365,10 +379,16 @@ void BOPAlgo_FillIn3DParts::MapEdgesAndFaces
for (; myItW.More(); myItW.Next()) {
const TopoDS_Shape& aE=myItW.Value();
//
BOPCol_ListOfShape* pLF = aMEF.ChangeSeek(aE);
if (!pLF)
pLF = &aMEF(aMEF.Add(aE, BOPCol_ListOfShape(theAllocator)));
pLF->Append(aF);
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);
}
}
}
}
@@ -376,44 +396,84 @@ void BOPAlgo_FillIn3DParts::MapEdgesAndFaces
// function: MakeConnexityBlock
// purpose:
//=======================================================================
void BOPAlgo_FillIn3DParts::MakeConnexityBlock
(const TopoDS_Face& theFStart,
void BOPAlgo_FillIn3DParts::MakeConnexityBlock
(const BOPCol_ListOfShape& theLFIn,
const BOPCol_IndexedMapOfShape& theMEAvoid,
const BOPCol_IndexedDataMapOfShapeListOfShape& theMEF,
BOPCol_MapOfShape& theMFDone,
BOPCol_ListOfShape& theLCB)
const BOPCol_MapOfShape& aMFDone,
const BOPCol_IndexedDataMapOfShapeListOfShape& aMEF,
BOPCol_ListOfShape& theLCB,
const Handle(NCollection_BaseAllocator)& theAlr)
{
// Add start element
theLCB.Append(theFStart);
BOPCol_ListIteratorOfListOfShape aItCB(theLCB);
for (; aItCB.More(); aItCB.Next())
{
const TopoDS_Shape& aF = aItCB.Value();
myItF.Initialize(aF);
for (; myItF.More(); myItF.Next())
{
const TopoDS_Shape& aW = myItF.Value();
if (aW.ShapeType() != TopAbs_WIRE)
continue;
myItW.Initialize(aW);
for (; myItW.More(); myItW.Next())
{
const TopoDS_Shape& aE = myItW.Value();
if (theMEAvoid.Contains(aE))
Standard_Integer aNbF, aNbAdd1, aNbAdd, i;
BOPCol_ListIteratorOfListOfShape aIt;
//
BOPCol_IndexedMapOfShape aMCB(100, theAlr);
BOPCol_IndexedMapOfShape aMAdd(100, theAlr);
BOPCol_IndexedMapOfShape aMAdd1(100, theAlr);
//
aNbF=theLFIn.Extent();
//
// 2. aMCB
const TopoDS_Shape& aF1=theLFIn.First();
aMAdd.Add(aF1);
//
for(;;) {
aMAdd1.Clear();
aNbAdd = aMAdd.Extent();
for (i=1; i<=aNbAdd; ++i) {
const TopoDS_Shape& aF=aMAdd(i);
//
myItF.Initialize(aF);
for (; myItF.More(); myItF.Next()) {
const TopoDS_Shape& aW=myItF.Value();
if (aW.ShapeType()!=TopAbs_WIRE) {
continue;
const BOPCol_ListOfShape& aLF = theMEF.FindFromKey(aE);
BOPCol_ListIteratorOfListOfShape aItLF(aLF);
for (; aItLF.More(); aItLF.Next())
{
const TopoDS_Shape& aFx = aItLF.Value();
if (!aFx.IsSame(aF) && theMFDone.Add(aFx))
theLCB.Append(aFx);
}
}
//
myItW.Initialize(aW);
for (; myItW.More(); myItW.Next()) {
const TopoDS_Shape& aE=myItW.Value();
if (theMEAvoid.Contains(aE)){
continue;
}
//
const BOPCol_ListOfShape& aLF=aMEF.FindFromKey(aE);
aIt.Initialize(aLF);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aFx=aIt.Value();
if (aFx.IsSame(aF)) {
continue;
}
if (aMCB.Contains(aFx)) {
continue;
}
if (aMFDone.Contains(aFx)) {
continue;
}
aMAdd1.Add(aFx);
}
}// for (; myItW.More(); myItW.Next()) {
}// for (; myItF.More(); myItF.Next()) {
aMCB.Add(aF);
}// for (i=1; i<=aNbAdd; ++i) {
//
aNbAdd1=aMAdd1.Extent();
if (!aNbAdd1) {
break;
}
//
aMAdd.Clear();
for (i=1; i<=aNbAdd1; ++i) {
const TopoDS_Shape& aFAdd=aMAdd1(i);
aMAdd.Add(aFAdd);
}
//
}//while(1) {
//
aNbF=aMCB.Extent();
for (i=1; i<=aNbF; ++i) {
const TopoDS_Shape& aF=aMCB(i);
theLCB.Append(aF);
}
}
//
@@ -556,7 +616,7 @@ void BOPAlgo_Builder::FillIn3DParts
BOPAlgo_VectorOfFillIn3DParts aVFIP;
//
for (i=0; i<aNbS; ++i) {
BOPDS_ShapeInfo& aSI=myDS->ChangeShapeInfo(i);
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
if (aSI.ShapeType()!=TopAbs_SOLID) {
continue;
}
@@ -576,9 +636,8 @@ void BOPAlgo_Builder::FillIn3DParts
}
//
// 2.1 Bounding box for the solid aS [ aBoxS ]
Bnd_Box& aBoxS = aSI.ChangeBox();
if (aBoxS.IsVoid())
myDS->BuildBndBoxSolid(i, aBoxS, myCheckInverted);
Bnd_Box aBoxS;
aBoxS=aSI.Box();
//
// 2.2 Build Draft Solid [aSD]
BOPCol_ListOfShape aLIF;
@@ -771,41 +830,34 @@ void BOPAlgo_Builder::BuildSplitSolids
//
} //for (i=1; i<=aNbS; ++i)
//
// Build temporary map of solids images to avoid rebuilding
// of the solids without internal faces
BOPCol_IndexedDataMapOfShapeListOfShape aSolidsIm;
// 1. Build solids for interfered source solids
for (i = 0; i < aNbS; ++i) {
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
if (aSI.ShapeType() != TopAbs_SOLID)
continue;
const TopoDS_Shape& aS = aSI.Shape();
const TopoDS_Solid& aSolid=(*(TopoDS_Solid*)(&aS));
if (!theDraftSolids.IsBound(aS))
continue;
const TopoDS_Shape& aSD = theDraftSolids.Find(aS);
const BOPCol_ListOfShape* pLFIN = theInParts.Seek(aS);
if (!pLFIN)
{
aSolidsIm(aSolidsIm.Add(aS, BOPCol_ListOfShape())).Append(aSD);
// 1. Build solids for interferred source solids
for (i=0; i<aNbS; ++i) {
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
//
if (aSI.ShapeType()!=TopAbs_SOLID) {
continue;
}
aSFS.Clear();
//
const TopoDS_Shape& aS=aSI.Shape();
const TopoDS_Solid& aSolid=(*(TopoDS_Solid*)(&aS));
if(!theDraftSolids.IsBound(aS)) {
continue;
}
const TopoDS_Shape& aSD=theDraftSolids.Find(aS);
const BOPCol_ListOfShape& aLFIN=
(theInParts.IsBound(aS)) ? theInParts.Find(aS) : aLSEmpty;
//
// 1.1 Fill Shell Faces Set
aSFS.Clear();
aExp.Init(aSD, TopAbs_FACE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aF = aExp.Current();
const TopoDS_Shape& aF=aExp.Current();
aSFS.Append(aF);
}
//
// 1.2 Fill internal faces
aIt.Initialize(*pLFIN);
aIt.Initialize(aLFIN);
for (; aIt.More(); aIt.Next()) {
TopoDS_Shape aF = aIt.Value();
TopoDS_Shape aF=aIt.Value();
//
aF.Orientation(TopAbs_FORWARD);
aSFS.Append(aF);
@@ -813,7 +865,7 @@ void BOPAlgo_Builder::BuildSplitSolids
aSFS.Append(aF);
}
//
// 1.3 Build new solids
// 1.3 Build new solids
BOPAlgo_BuilderSolid& aBS=aVBS.Append1();
aBS.SetSolid(aSolid);
aBS.SetShapes(aSFS);
@@ -829,18 +881,10 @@ void BOPAlgo_Builder::BuildSplitSolids
BOPAlgo_BuilderSolidCnt::Perform(myRunParallel, aVBS);
//===================================================
//
for (k = 0; k < aNbBS; ++k)
{
BOPAlgo_BuilderSolid& aBS = aVBS(k);
aSolidsIm.Add(aBS.Solid(), aBS.Areas());
}
//
// Add new solids to images map
aNbBS = aSolidsIm.Extent();
for (k = 1; k <= aNbBS; ++k)
{
const TopoDS_Shape& aS = aSolidsIm.FindKey(k);
const BOPCol_ListOfShape& aLSR = aSolidsIm(k);
for (k=0; k<aNbBS; ++k) {
BOPAlgo_BuilderSolid& aBS=aVBS(k);
const TopoDS_Solid& aS=aBS.Solid();
const BOPCol_ListOfShape& aLSR=aBS.Areas();
//
if (!myImages.IsBound(aS)) {
BOPCol_ListOfShape* pLSx = myImages.Bound(aS, BOPCol_ListOfShape());

View File

@@ -19,7 +19,6 @@
#include <BRep_Builder.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <BOPTools.hxx>
@@ -40,9 +39,6 @@ static
void MakeTypedContainers(const TopoDS_Shape& theSC,
TopoDS_Shape& theResult);
static void CollectMaterialBoundaries(const BOPCol_ListOfShape& theLS,
TopTools_MapOfShape& theMapKeepBnd);
//=======================================================================
//function : empty constructor
//purpose :
@@ -271,8 +267,7 @@ void BOPAlgo_CellsBuilder::AddToResult(const BOPCol_ListOfShape& theLSToTake,
BOPCol_ListIteratorOfListOfShape aItLP(aParts);
for (; aItLP.More(); aItLP.Next()) {
const TopoDS_Shape& aPart = aItLP.Value();
// provide uniqueness of the parts
if (aResParts.Add(aPart) && !myShapeMaterial.IsBound(aPart)) {
if (aResParts.Add(aPart)) {
BRep_Builder().Add(myShape, aPart);
bChanged = Standard_True;
}
@@ -464,8 +459,6 @@ void BOPAlgo_CellsBuilder::RemoveInternalBoundaries()
// try to remove the internal boundaries between the
// shapes of the same material
BOPCol_DataMapIteratorOfDataMapOfIntegerListOfShape aItM(myMaterials);
BOPCol_ListOfShape aLSUnify[2];
TopTools_MapOfShape aKeepMap[2];
for (; aItM.More(); aItM.Next()) {
Standard_Integer iMaterial = aItM.Key();
BOPCol_ListOfShape& aLS = aItM.ChangeValue();
@@ -492,65 +485,34 @@ void BOPAlgo_CellsBuilder::RemoveInternalBoundaries()
break;
}
}
if (aItLS.More())
{
//
BOPCol_ListOfShape aLSNew;
if (aItLS.More()) {
// add the warning
TopoDS_Compound aMultiDimS;
aBB.MakeCompound(aMultiDimS);
aBB.Add(aMultiDimS, aLS.First());
aBB.Add(aMultiDimS, aItLS.Value());
AddWarning(new BOPAlgo_AlertRemovalOfIBForMDimShapes(aMultiDimS));
}
else
{
if (aType == TopAbs_EDGE || aType == TopAbs_FACE)
{
// for edges and faces, just collect shapes to unify them later after exiting the loop;
// collect boundaries of shapes of current material in the keep map
Standard_Integer iType = (aType == TopAbs_EDGE ? 0 : 1);
CollectMaterialBoundaries(aLS, aKeepMap[iType]);
// save shapes to unify later
BOPCol_ListOfShape aCopy(aLS);
aLSUnify[iType].Append(aCopy);
continue;
TopoDS_Compound aMultiDimS;
aBB.MakeCompound(aMultiDimS);
aBB.Add(aMultiDimS, aLS.First());
aBB.Add(aMultiDimS, aItLS.Value());
//
AddWarning (new BOPAlgo_AlertRemovalOfIBForMDimShapes (aMultiDimS));
}
else
{
// aType is Solid;
// remove internal faces between solids of the same material just now
BOPCol_ListOfShape aLSNew;
if (RemoveInternals(aLS, aLSNew))
{
bChanged = Standard_True;
// update materials maps
for (aItLS.Initialize(aLSNew); aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS = aItLS.Value();
myShapeMaterial.Bind(aS, iMaterial);
}
aLS.Assign(aLSNew);
}
aLSNew.Assign(aLS);
}
else {
if (RemoveInternals(aLS, aLSNew)) {
bChanged = Standard_True;
}
}
// add shapes to result (multidimensional and solids)
for (aItLS.Initialize(aLS); aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS = aItLS.Value();
aBB.Add(aResult, aS);
}
}
// remove internal boundaries for edges and faces
for (Standard_Integer iType = 0; iType < 2; ++iType)
{
if (aLSUnify[iType].IsEmpty())
continue;
BOPCol_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()) {
//
// update materials maps and add new shapes to result
aItLS.Initialize(aLSNew);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS = aItLS.Value();
aBB.Add(aResult, aS);
if (!myShapeMaterial.IsBound(aS)) {
myShapeMaterial.Bind(aS, iMaterial);
}
}
}
//
@@ -758,8 +720,7 @@ void BOPAlgo_CellsBuilder::MakeContainers()
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape& theLS,
BOPCol_ListOfShape& theLSNew,
const TopTools_MapOfShape& theMapKeepBnd)
BOPCol_ListOfShape& theLSNew)
{
Standard_Boolean bRemoved = Standard_False;
if (theLS.Extent() < 2) {
@@ -789,8 +750,8 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
//
bFaces = (aType == TopAbs_FACE);
bEdges = (aType == TopAbs_EDGE);
//
ShapeUpgrade_UnifySameDomain anUnify (aShape, bEdges, bFaces);
anUnify.KeepShapes(theMapKeepBnd);
anUnify.Build();
const TopoDS_Shape& aSNew = anUnify.Shape();
//
@@ -822,15 +783,14 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
aNb = aMG.Extent();
for (i = 1; i <= aNb; ++i) {
const TopoDS_Shape& aSS = aMG(i);
const Standard_Integer* pMaterial = myShapeMaterial.Seek(aSS);
const TopTools_ListOfShape& aLSMod = anUnify.History()->Modified(aSS);
TopTools_ListIteratorOfListOfShape aIt(aLSMod);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSU = aIt.Value();
myMapModified.Bind(aSS, aSU);
bRemoved = Standard_True;
if (pMaterial && !myShapeMaterial.IsBound(aSU))
myShapeMaterial.Bind(aSU, *pMaterial);
if (!aSU.IsNull() && !aSS.IsSame(aSU)) {
myMapModified.Bind(aSS, aSU);
bRemoved = Standard_True;
}
}
}
}
@@ -1113,33 +1073,6 @@ 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,
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);
for (; anIt.More(); anIt.Next())
{
const TopoDS_Shape& aS = anIt.Value();
TopExp::MapShapesAndAncestors(aS, aTypeSubsh, aType, aMapSubSh);
}
for (int i = 1; i <= aMapSubSh.Extent(); i++)
{
// check if the subshape belongs to boundary of the area
if (aMapSubSh(i).Extent() == 1)
{
// add to theMapKeepBnd
theMapKeepBnd.Add(aMapSubSh.FindKey(i));
}
}
}
//=======================================================================
//function : TypeToExplore
//purpose :

View File

@@ -23,7 +23,7 @@
#include <TopoDS_Shape.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopTools_MapOfShape.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPCol_ListOfShape.hxx>
@@ -265,8 +265,7 @@ class BOPAlgo_CellsBuilder : public BOPAlgo_Builder
//! 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,
const TopTools_MapOfShape& theMapKeepBnd = TopTools_MapOfShape());
BOPCol_ListOfShape& theLSNew);
// fields
TopoDS_Shape myAllParts;
@@ -274,6 +273,9 @@ class BOPAlgo_CellsBuilder : public BOPAlgo_Builder
BOPCol_DataMapOfIntegerListOfShape myMaterials;
BOPCol_DataMapOfShapeInteger myShapeMaterial;
BOPCol_DataMapOfShapeShape myMapModified;
private:
};
#endif //_BOPAlgo_CellsBuilder_HeaderFile

View File

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

View File

@@ -32,10 +32,6 @@ 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.
//! - *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.
//!
class BOPAlgo_Options
{
@@ -160,22 +156,6 @@ public:
//! Set the Progress Indicator object.
Standard_EXPORT void SetProgressIndicator(const Handle(Message_ProgressIndicator)& theObj);
public:
//!@name Check input solids for inverted status
//! Enables/Disables the check of the input solids for inverted status
void SetCheckInverted(const Standard_Boolean theCheck)
{
myCheckInverted = theCheck;
}
//! Returns the flag defining whether the check for input solids on inverted status
//! should be performed or not.
Standard_Boolean CheckInverted() const
{
return myCheckInverted;
}
protected:
//! Breaks the execution if the break signal
@@ -189,7 +169,6 @@ protected:
Standard_Boolean myRunParallel;
Standard_Real myFuzzyValue;
Handle(Message_ProgressIndicator) myProgressIndicator;
Standard_Boolean myCheckInverted;
};

View File

@@ -294,6 +294,8 @@ void BOPAlgo_PaveFiller::PerformInternal()
//
UpdateBlocksWithSharedVertices();
//
myDS->RefineFaceInfoIn();
//
MakeSplitEdges();
if (HasErrors()) {
return;

View File

@@ -207,56 +207,34 @@ void BOPAlgo_PaveFiller::PerformFF()
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nF1, nF2);
// Update/Initialize FaceInfo structure for first face
if (myDS->HasFaceInfo(nF1))
{
if (aMIFence.Add(nF1))
{
myDS->UpdateFaceInfoOn(nF1);
myDS->UpdateFaceInfoIn(nF1);
}
//
const TopoDS_Face& aF1=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
const TopoDS_Face& aF2=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
//
if (aMIFence.Add(nF1)) {
myDS->UpdateFaceInfoOn(nF1);
myDS->UpdateFaceInfoIn(nF1);
}
else if (myDS->HasInterfShapeSubShapes(nF2, nF1))
{
myDS->ChangeFaceInfo(nF1);
aMIFence.Add(nF1);
}
// Update/Initialize FaceInfo structure for second face
if (myDS->HasFaceInfo(nF2))
{
if (aMIFence.Add(nF2))
{
myDS->UpdateFaceInfoOn(nF2);
myDS->UpdateFaceInfoIn(nF2);
}
}
else if (myDS->HasInterfShapeSubShapes(nF1, nF2))
{
myDS->ChangeFaceInfo(nF2);
aMIFence.Add(nF2);
if (aMIFence.Add(nF2)) {
myDS->UpdateFaceInfoOn(nF2);
myDS->UpdateFaceInfoIn(nF2);
}
//
if (myGlue == BOPAlgo_GlueOff)
{
const TopoDS_Face& aF1 = (*(TopoDS_Face *)(&myDS->Shape(nF1)));
const TopoDS_Face& aF2 = (*(TopoDS_Face *)(&myDS->Shape(nF2)));
//
const BRepAdaptor_Surface& aBAS1 = myContext->SurfaceAdaptor(aF1);
const BRepAdaptor_Surface& aBAS2 = myContext->SurfaceAdaptor(aF2);
if (aBAS1.GetType() == GeomAbs_Plane &&
aBAS2.GetType() == GeomAbs_Plane) {
// Check if the planes are really interfering
Standard_Boolean bToIntersect = CheckPlanes(nF1, nF2);
if (!bToIntersect) {
BOPDS_InterfFF& aFF = aFFs.Append1();
aFF.SetIndices(nF1, nF2);
aFF.Init(0, 0);
continue;
}
const BRepAdaptor_Surface& aBAS1 = myContext->SurfaceAdaptor(aF1);
const BRepAdaptor_Surface& aBAS2 = myContext->SurfaceAdaptor(aF2);
if (aBAS1.GetType() == GeomAbs_Plane &&
aBAS2.GetType() == GeomAbs_Plane) {
// Check if the planes are really interfering
Standard_Boolean bToIntersect = CheckPlanes(nF1, nF2);
if (!bToIntersect) {
BOPDS_InterfFF& aFF=aFFs.Append1();
aFF.SetIndices(nF1, nF2);
aFF.Init(0, 0);
continue;
}
//
}
//
if (myGlue == BOPAlgo_GlueOff) {
BOPAlgo_FaceFace& aFaceFace=aVFaceFace.Append1();
//
aFaceFace.SetIndices(nF1, nF2);

View File

@@ -29,7 +29,6 @@
#include <BOPDS_Interf.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
#include <BOPDS_MapOfPair.hxx>
#include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_Pave.hxx>
#include <BOPDS_PaveBlock.hxx>
@@ -247,42 +246,28 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
{
OCC_CATCH_SIGNALS
// Check if edge has pcurve. If no then make its copy to avoid data races,
// and use it to build pcurve.
TopoDS_Edge aCopyE = myE;
Standard_Real f, l;
Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(aCopyE, myF, f, l);
if (aC2d.IsNull())
{
aCopyE = BOPTools_AlgoTools::CopyEdge(aCopyE);
Standard_Integer iErr = 1;
if (!myEz.IsNull())
{
// Attach pcurve from the original edge
TopoDS_Edge aSpz;
BOPTools_AlgoTools::MakeSplitEdge(myEz, myV1, myT1,
myV2, myT2, aSpz);
iErr = BOPTools_AlgoTools2D::AttachExistingPCurve(aSpz,
aCopyE,
myF,
myContext);
}
if (iErr)
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aCopyE, myF, myContext);
myNewC2d = BRep_Tool::CurveOnSurface(aCopyE, myF, f, l);
if (myNewC2d.IsNull())
{
AddError(new BOPAlgo_AlertBuildingPCurveFailed(TopoDS_Shape()));
return;
}
else
myNewTol = BRep_Tool::Tolerance(aCopyE);
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);
}
//
if (iErr) {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF, myContext);
}
//
if (myFlag) {
UpdateVertices(aCopyE, myF);
UpdateVertices(myE, myF);
}
}
catch (Standard_Failure)
@@ -290,17 +275,7 @@ 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;
@@ -310,8 +285,6 @@ 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;
};
@@ -568,7 +541,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
(!mySectionAttribute.PCurveOnS1() && !mySectionAttribute.PCurveOnS2()))
return;
Standard_Boolean bHasPC;
Standard_Integer i, nF1, aNbC, k, nE, aNbFF, aNbFI, nEx;
Standard_Integer i, nF1, nF2, aNbC, k, nE, aNbFF, aNbFI, nEx;
Standard_Integer j, aNbPBIn, aNbPBOn;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
TopoDS_Face aF1F, aF2F;
@@ -664,52 +637,44 @@ void BOPAlgo_PaveFiller::MakePCurves()
}
}// for (i=0; i<aNbFI; ++i) {
//
// 2. Process section edges. P-curves on them must already be computed.
// However, we must provide the call to UpdateVertices.
// 2. Process section edges
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();
for (i=0; i<aNbFF; ++i) {
const BOPDS_InterfFF& aFF=aFFs(i);
const BOPDS_VectorOfCurve& aVNC = aFF.Curves();
aNbC = aVNC.Extent();
if (aNbC == 0)
continue;
Standard_Integer nF[2];
aFF.Indices(nF[0], nF[1]);
aFF.Indices(nF1, nF2);
//
TopoDS_Face aFf[2];
aFf[0] = (*(TopoDS_Face *)(&myDS->Shape(nF[0])));
aFf[0]=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
aFf[0].Orientation(TopAbs_FORWARD);
//
aFf[1]=(*(TopoDS_Face *)(&myDS->Shape(nF[1])));
aFf[1]=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
aFf[1].Orientation(TopAbs_FORWARD);
//
for (k=0; k<aNbC; ++k)
{
const BOPDS_VectorOfCurve& aVNC=aFF.Curves();
aNbC=aVNC.Extent();
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 (Standard_Integer m = 0; m<2; ++m)
{
if (bPCurveOnS[m] && anEFPairs.Add(BOPDS_Pair(nE, nF[m])))
{
BOPAlgo_MPC& aMPC = aVMPC.Append1();
for (m=0; m<2; ++m) {
if (bPCurveOnS[m]) {
BOPAlgo_MPC& aMPC=aVMPC.Append1();
aMPC.SetEdge(aE);
aMPC.SetFace(aFf[m]);
aMPC.SetFlag(Standard_True);
aMPC.SetFlag(bPCurveOnS[m]);
aMPC.SetProgressIndicator(myProgressIndicator);
}
}
@@ -722,27 +687,18 @@ void BOPAlgo_PaveFiller::MakePCurves()
BOPAlgo_MPCCnt::Perform(myRunParallel, aVMPC, myContext);
//======================================================
// Add warnings of the failed projections and update edges with new pcurves
// Add warnings of the failed projections
Standard_Integer aNb = aVMPC.Extent();
for (i = 0; i < aNb; ++i)
{
const BOPAlgo_MPC& aMPC = aVMPC(i);
if (aMPC.HasErrors())
if (aVMPC(i).HasErrors())
{
TopoDS_Compound aWC;
BRep_Builder().MakeCompound(aWC);
BRep_Builder().Add(aWC, aMPC.Edge());
BRep_Builder().Add(aWC, aMPC.Face());
BRep_Builder().Add(aWC, aVMPC(i).Edge());
BRep_Builder().Add(aWC, aVMPC(i).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());
}
}
}
//=======================================================================

View File

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

View File

@@ -42,6 +42,12 @@ 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);
//=======================================================================
//class : BOPAlgo_CBK
@@ -146,12 +152,162 @@ void BOPAlgo_ShellSplitter::Perform()
{
GetReport()->Clear();
//
BOPTools_AlgoTools::MakeConnexityBlocks
(myStartShapes, TopAbs_EDGE, TopAbs_FACE, myLCB);
MakeConnexityBlocks();
if (HasErrors()) {
return;
}
//
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 :
@@ -594,3 +750,43 @@ 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

@@ -61,6 +61,8 @@ Standard_EXPORT virtual ~BOPAlgo_ShellSplitter();
protected:
Standard_EXPORT void MakeConnexityBlocks();
Standard_EXPORT void MakeShells();

View File

@@ -22,15 +22,22 @@
//purpose :
//=======================================================================
BOPAlgo_Splitter::BOPAlgo_Splitter()
: BOPAlgo_ToolsProvider()
:
BOPAlgo_Builder(),
myTools(myAllocator),
myMapTools(100, myAllocator)
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
BOPAlgo_Splitter::BOPAlgo_Splitter(const Handle(NCollection_BaseAllocator)& theAllocator)
: BOPAlgo_ToolsProvider(theAllocator)
BOPAlgo_Splitter::BOPAlgo_Splitter
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Builder(theAllocator),
myTools(myAllocator),
myMapTools(100, myAllocator)
{
}
//=======================================================================
@@ -40,6 +47,39 @@ BOPAlgo_Splitter::BOPAlgo_Splitter(const Handle(NCollection_BaseAllocator)& theA
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:

View File

@@ -19,7 +19,7 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPAlgo_ToolsProvider.hxx>
#include <BOPAlgo_Builder.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_ToolsProvider
class BOPAlgo_Splitter : public BOPAlgo_Builder
{
public:
@@ -59,13 +59,35 @@ public:
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;
}
//! 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

View File

@@ -1,76 +0,0 @@
// Created by: Oleg AGASHIN
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPAlgo_ToolsProvider.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BOPAlgo_ToolsProvider::BOPAlgo_ToolsProvider()
:
BOPAlgo_Builder(),
myTools(myAllocator),
myMapTools(100, myAllocator)
{
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BOPAlgo_ToolsProvider::BOPAlgo_ToolsProvider
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Builder(theAllocator),
myTools(myAllocator),
myMapTools(100, myAllocator)
{
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void BOPAlgo_ToolsProvider::Clear()
{
BOPAlgo_Builder::Clear();
myTools.Clear();
myMapTools.Clear();
}
//=======================================================================
//function : AddTool
//purpose :
//=======================================================================
void BOPAlgo_ToolsProvider::AddTool(const TopoDS_Shape& theShape)
{
if (myMapTools.Add(theShape))
myTools.Append(theShape);
}
//=======================================================================
//function : SetTools
//purpose :
//=======================================================================
void BOPAlgo_ToolsProvider::SetTools(const BOPCol_ListOfShape& theShapes)
{
myTools.Clear();
BOPCol_ListIteratorOfListOfShape aIt(theShapes);
for (; aIt.More(); aIt.Next())
AddTool(aIt.Value());
}

View File

@@ -1,57 +0,0 @@
// Created by: Oleg AGASHIN
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BOPAlgo_ToolsProvider_HeaderFile
#define _BOPAlgo_ToolsProvider_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPAlgo_Builder.hxx>
//! Auxiliary class providing API to operate tool arguments.
class BOPAlgo_ToolsProvider : public BOPAlgo_Builder
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
Standard_EXPORT BOPAlgo_ToolsProvider();
Standard_EXPORT BOPAlgo_ToolsProvider(const 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;
}
protected:
BOPCol_ListOfShape myTools;
BOPCol_MapOfShape myMapTools;
};
#endif // _BOPAlgo_ToolsProvider_HeaderFile

View File

@@ -24,7 +24,6 @@
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
@@ -125,12 +124,153 @@ void BOPAlgo_WireSplitter::Perform()
myContext = new IntTools_Context;
}
//
BOPTools_AlgoTools::MakeConnexityBlocks
(myWES->StartElements(), TopAbs_VERTEX, TopAbs_EDGE, myLCB);
MakeConnexityBlocks();
MakeWires();
}
//=======================================================================
//function : MakeConnexityBlocks
//purpose :
//=======================================================================
void BOPAlgo_WireSplitter::MakeConnexityBlocks()
{
Standard_Boolean bRegular, bClosed;
Standard_Integer i, j, aNbV, aNbVS, aNbVP, k;
TopoDS_Iterator aItE;
TopoDS_Shape aER;
BOPCol_ListIteratorOfListOfShape aIt;
//
BOPCol_IndexedDataMapOfShapeListOfShape aMVE(100, myAllocator);
BOPCol_IndexedMapOfShape aMVP(100, myAllocator);
BOPCol_IndexedMapOfShape aMEC(100, myAllocator);
BOPCol_MapOfShape aMER(100, myAllocator);
BOPCol_MapOfShape aMEP(100, myAllocator);
BOPCol_IndexedMapOfShape aMVAdd(100, myAllocator);
BOPCol_MapOfShape aMVS(100, myAllocator);
//
myLCB.Clear();
//
const BOPCol_ListOfShape& aLSE=myWES->StartElements();
aIt.Initialize(aLSE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aE=aIt.Value();
if (aMEP.Add(aE)) {
BOPTools::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
}
else {
aMER.Add(aE);
}
}
//
// 2
aNbV=aMVE.Extent();
for (i=1; i<=aNbV; ++i) {
aNbVS=aMVS.Extent();
if (aNbVS==aNbV) {
break;
}
//
const TopoDS_Shape& aV=aMVE.FindKey(i);
//
if (!aMVS.Add(aV)) {
continue;
}
// aMVS - globally processed vertices
//
//------------------------------------- goal: aMEC
aMEC.Clear(); // aMEC - edges of CB
aMVP.Clear(); // aMVP - vertices to process right now
aMVAdd.Clear(); // aMVAdd vertices to process on next step of while(1)
//
aMVP.Add(aV);
//
for(;;) {
aNbVP=aMVP.Extent();
for (k=1; k<=aNbVP; ++k) {
const TopoDS_Shape& aVP=aMVP(k);
const BOPCol_ListOfShape& aLE=aMVE.FindFromKey(aVP);
aIt.Initialize(aLE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aE=aIt.Value();
if (aMEC.Add(aE)) {
aItE.Initialize(aE);
for (; aItE.More(); aItE.Next()) {
const TopoDS_Shape& aVE=aItE.Value();
if (aMVS.Add(aVE)) {
aMVAdd.Add(aVE);
}
}
}
}
}//for (k=1; k<=aNbVP; ++k) {
//
aNbVP=aMVAdd.Extent();
if (!aNbVP) {
break; // from while(1)
}
//
aMVP.Clear();
//
for (k=1; k<=aNbVP; ++k) {
const TopoDS_Shape& aVE=aMVAdd(k);
aMVP.Add(aVE);
}
aMVAdd.Clear();
}// while(1) {
//-------------------------------------
BOPTools_ConnexityBlock aCB(myAllocator);
BOPCol_ListOfShape& aLEC=aCB.ChangeShapes();
BOPCol_IndexedDataMapOfShapeListOfShape aMVER(100, myAllocator);
//
bRegular=Standard_True;
Standard_Integer aNbCB = aMEC.Extent();
for (j = 1; j <= aNbCB; j++) {
aER = aMEC(j);
//
if (aMER.Contains(aER)) {
aER.Orientation(TopAbs_FORWARD);
aLEC.Append(aER);
aER.Orientation(TopAbs_REVERSED);
aLEC.Append(aER);
bRegular=Standard_False;
}
else {
aLEC.Append(aER);
}
//
if (bRegular) {
BOPTools::MapShapesAndAncestors(aER, TopAbs_VERTEX, TopAbs_EDGE, aMVER);
}
}
//
if (bRegular) {
Standard_Integer aNbVR, aNbER;
//
aNbVR=aMVER.Extent();
for (k=1; k<=aNbVR; ++k) {
const BOPCol_ListOfShape& aLER=aMVER(k);
aNbER=aLER.Extent();
if (aNbER==1) {
const TopoDS_Edge& aEx=TopoDS::Edge(aER);
bClosed=BRep_Tool::IsClosed(aEx, myWES->Face());
if (!bClosed) {
bRegular=!bRegular;
break;
}
}
if (aNbER>2) {
bRegular=!bRegular;
break;
}
}
}
//
aCB.SetRegular(bRegular);
myLCB.Append(aCB);
}
}
/////////////////////////////////////////////////////////////////////////
class BOPAlgo_WS_ConnexityBlock {
public:

View File

@@ -70,6 +70,8 @@ protected:
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
Standard_EXPORT void MakeConnexityBlocks();
Standard_EXPORT void MakeWires();
BOPAlgo_PWireEdgeSet myWES;

View File

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

View File

@@ -19,8 +19,6 @@
#include <Standard_NotImplemented.hxx>
#include <OSD_Parallel.hxx>
#include <NCollection_DataMap.hxx>
#include <Standard_Mutex.hxx>
#include <OSD_Thread.hxx>
//
// 1. Implementation of Functors/Starters

View File

@@ -545,64 +545,58 @@ void BOPDS_DS::Init(const Standard_Real theFuzz)
}//if (aTS==TopAbs_FACE) {
}//for (j=0; j<myNbSourceShapes; ++j) {
//
// For the check mode we need to compute the bounding box for solid.
// Otherwise, it will be computed on the building stage
Standard_Boolean bCheckMode = (myArguments.Extent() == 1);
if (bCheckMode)
{
// 2.4 Solids
for (j=0; j<myNbSourceShapes; ++j) {
BOPDS_ShapeInfo& aSI=ChangeShapeInfo(j);
//
aTS=aSI.ShapeType();
if (aTS!=TopAbs_SOLID) {
// 2.4 Solids
for (j=0; j<myNbSourceShapes; ++j) {
BOPDS_ShapeInfo& aSI=ChangeShapeInfo(j);
//
aTS=aSI.ShapeType();
if (aTS!=TopAbs_SOLID) {
continue;
}
Bnd_Box& aBox=aSI.ChangeBox();
BuildBndBoxSolid(j, aBox);
//
//
// update sub-shapes by BRep comprising ones
aMI.Clear();
BOPCol_ListOfInteger& aLI1=aSI.ChangeSubShapes();
//
aIt1.Initialize(aLI1);
for (; aIt1.More(); aIt1.Next()) {
n1=aIt1.Value();
BOPDS_ShapeInfo& aSI1=ChangeShapeInfo(n1);
if (aSI1.ShapeType()!=TopAbs_SHELL) {
continue;
}
Bnd_Box& aBox=aSI.ChangeBox();
BuildBndBoxSolid(j, aBox);
//
//
// update sub-shapes by BRep comprising ones
aMI.Clear();
BOPCol_ListOfInteger& aLI1=aSI.ChangeSubShapes();
//
aIt1.Initialize(aLI1);
for (; aIt1.More(); aIt1.Next()) {
n1=aIt1.Value();
BOPDS_ShapeInfo& aSI1=ChangeShapeInfo(n1);
if (aSI1.ShapeType()!=TopAbs_SHELL) {
const BOPCol_ListOfInteger& aLI2=aSI1.SubShapes();
aIt2.Initialize(aLI2);
for (; aIt2.More(); aIt2.Next()) {
n2=aIt2.Value();
BOPDS_ShapeInfo& aSI2=ChangeShapeInfo(n2);
if (aSI2.ShapeType()!=TopAbs_FACE) {
continue;
}
//
const BOPCol_ListOfInteger& aLI2=aSI1.SubShapes();
aIt2.Initialize(aLI2);
for (; aIt2.More(); aIt2.Next()) {
n2=aIt2.Value();
BOPDS_ShapeInfo& aSI2=ChangeShapeInfo(n2);
if (aSI2.ShapeType()!=TopAbs_FACE) {
continue;
}
//
aMI.Add(n2);
//
const BOPCol_ListOfInteger& aLI3=aSI2.SubShapes();
aIt3.Initialize(aLI3);
for (; aIt3.More(); aIt3.Next()) {
n3=aIt3.Value();
aMI.Add(n3);
}
aMI.Add(n2);
//
const BOPCol_ListOfInteger& aLI3=aSI2.SubShapes();
aIt3.Initialize(aLI3);
for (; aIt3.More(); aIt3.Next()) {
n3=aIt3.Value();
aMI.Add(n3);
}
}
//
aLI1.Clear();
aItMI.Initialize(aMI);
for (; aItMI.More(); aItMI.Next()) {
n1=aItMI.Value();
aLI1.Append(n1);
}
aMI.Clear();
}//for (j=0; j<myNbSourceShapes; ++j) {
}
}
//
aLI1.Clear();
aItMI.Initialize(aMI);
for (; aItMI.More(); aItMI.Next()) {
n1=aItMI.Value();
aLI1.Append(n1);
}
aMI.Clear();
}//for (j=0; j<myNbSourceShapes; ++j) {
//
aMI.Clear();
//-----------------------------------------------------
@@ -1424,6 +1418,44 @@ void BOPDS_DS::RefineFaceInfoOn()
}
}
}
//=======================================================================
//function : RefineFaceInfoIn
//purpose :
//=======================================================================
void BOPDS_DS::RefineFaceInfoIn()
{
for (Standard_Integer i = 0; i < myNbSourceShapes; ++i)
{
const BOPDS_ShapeInfo& aSI = ShapeInfo(i);
if (aSI.ShapeType() != TopAbs_FACE)
continue;
if (!aSI.HasReference())
continue;
BOPDS_FaceInfo& aFI = ChangeFaceInfo(i);
const BOPDS_IndexedMapOfPaveBlock& aMPBOn = aFI.PaveBlocksOn();
BOPDS_IndexedMapOfPaveBlock& aMPBIn = aFI.ChangePaveBlocksIn();
if (aMPBIn.IsEmpty() || aMPBOn.IsEmpty())
continue;
BOPDS_IndexedMapOfPaveBlock aMPBInNew;
const Standard_Integer aNbPBIn = aMPBIn.Extent();
for (Standard_Integer j = 1; j <= aNbPBIn; ++j)
{
if (!aMPBOn.Contains(aMPBIn(j)))
aMPBInNew.Add(aMPBIn(j));
}
if (aMPBInNew.Extent() < aNbPBIn)
aMPBIn = aMPBInNew;
}
}
//=======================================================================
//function : AloneVertices
//purpose :
@@ -1872,8 +1904,7 @@ Standard_Real ComputeParameter(const TopoDS_Vertex& aV,
//purpose :
//=======================================================================
void BOPDS_DS::BuildBndBoxSolid(const Standard_Integer theIndex,
Bnd_Box& aBoxS,
const Standard_Boolean theCheckInverted)
Bnd_Box& aBoxS)
{
Standard_Boolean bIsOpenBox, bIsInverted;
Standard_Integer nSh, nFc;
@@ -1937,7 +1968,7 @@ void BOPDS_DS::BuildBndBoxSolid(const Standard_Integer theIndex,
if (bIsOpenBox) {
aBoxS.SetWhole();
}
else if (theCheckInverted) {
else {
bIsInverted=BOPTools_AlgoTools::IsInvertedSolid(aSolid);
if (bIsInverted) {
aBoxS.SetWhole();

View File

@@ -302,6 +302,9 @@ Standard_EXPORT virtual ~BOPDS_DS();
//! ++
Standard_EXPORT void RefineFaceInfoOn();
//! Removes faces with state ON from the
//! list of IN-faces
Standard_EXPORT void RefineFaceInfoIn();
//! Returns information about ON/IN subshapes of the given faces.
//! @param theMVOnIn the indices of ON/IN vertices from both faces
@@ -468,13 +471,6 @@ Standard_EXPORT virtual ~BOPDS_DS();
//! of the existing vertices have been increased.
Standard_EXPORT Standard_Boolean IsValidShrunkData(const Handle(BOPDS_PaveBlock)& thePB);
//! Computes bounding box <theBox> for the solid with DS-index <theIndex>.
//! The flag <theCheckInverted> enables/disables the check of the solid
//! for inverted status. By default the solids will be checked.
Standard_EXPORT void BuildBndBoxSolid (const Standard_Integer theIndex,
Bnd_Box& theBox,
const Standard_Boolean theCheckInverted = Standard_True);
protected:
@@ -492,6 +488,10 @@ protected:
const Standard_Real theFuzz);
//! Computes bouding box <theBox> for the solid with DS-index <theIndex>
Standard_EXPORT void BuildBndBoxSolid (const Standard_Integer theIndex, Bnd_Box& theBox);
BOPCol_BaseAllocator myAllocator;
BOPCol_ListOfShape myArguments;
Standard_Integer myNbShapes;

View File

@@ -133,7 +133,6 @@ Standard_Integer bapibop(Draw_Interpretor& di,
pBuilder->SetFuzzyValue(aFuzzyValue);
pBuilder->SetNonDestructive(bNonDestructive);
pBuilder->SetGlue(aGlue);
pBuilder->SetCheckInverted(BOPTest_Objects::CheckInverted());
//
pBuilder->Build();
//
@@ -194,7 +193,6 @@ Standard_Integer bapibuild(Draw_Interpretor& di,
aBuilder.SetFuzzyValue(aFuzzyValue);
aBuilder.SetNonDestructive(bNonDestructive);
aBuilder.SetGlue(aGlue);
aBuilder.SetCheckInverted(BOPTest_Objects::CheckInverted());
//
aBuilder.Build();
//
@@ -259,7 +257,6 @@ Standard_Integer bapisplit(Draw_Interpretor& di,
aSplitter.SetFuzzyValue(BOPTest_Objects::FuzzyValue());
aSplitter.SetNonDestructive(BOPTest_Objects::NonDestructive());
aSplitter.SetGlue(BOPTest_Objects::Glue());
aSplitter.SetCheckInverted(BOPTest_Objects::CheckInverted());
//
// performing operation
aSplitter.Build();

View File

@@ -250,7 +250,6 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
aBOP.AddTool(aS2);
aBOP.SetOperation(aOp);
aBOP.SetRunParallel (bRunParallel);
aBOP.SetCheckInverted(BOPTest_Objects::CheckInverted());
//
aBOP.PerformWithFiller(*pPF);
BOPTest::ReportAlerts(aBOP);
@@ -311,7 +310,6 @@ Standard_Integer bopsection(Draw_Interpretor& di,
aBOP.AddArgument(aS1);
aBOP.AddArgument(aS2);
aBOP.SetRunParallel (bRunParallel);
aBOP.SetCheckInverted(BOPTest_Objects::CheckInverted());
//
aBOP.PerformWithFiller(*pPF);
BOPTest::ReportAlerts(aBOP);
@@ -510,7 +508,6 @@ Standard_Integer bsmt (Draw_Interpretor& di,
aBOP.AddTool(aS2);
aBOP.SetOperation(aOp);
aBOP.SetRunParallel(bRunParallel);
aBOP.SetCheckInverted(BOPTest_Objects::CheckInverted());
//
aBOP.PerformWithFiller(aPF);
BOPTest::ReportAlerts(aBOP);

View File

@@ -111,7 +111,6 @@ Standard_Integer bcbuild(Draw_Interpretor& di,
aCBuilder.SetFuzzyValue(aTol);
aCBuilder.SetNonDestructive(bNonDestructive);
aCBuilder.SetGlue(aGlue);
aCBuilder.SetCheckInverted(BOPTest_Objects::CheckInverted());
//
aCBuilder.PerformWithFiller(aPF);
BOPTest::ReportAlerts(aCBuilder);

View File

@@ -55,7 +55,6 @@ class BOPTest_Session {
myFuzzyValue = 0.;
myGlue = BOPAlgo_GlueOff;
myDrawWarnShapes = Standard_False;
myCheckInverted = Standard_True;
};
//
// Clear
@@ -143,14 +142,6 @@ class BOPTest_Session {
return myDrawWarnShapes;
};
//
void SetCheckInverted(const Standard_Boolean bCheck) {
myCheckInverted = bCheck;
};
//
Standard_Boolean CheckInverted() const {
return myCheckInverted;
};
//
protected:
//
BOPTest_Session(const BOPTest_Session&);
@@ -169,7 +160,6 @@ protected:
Standard_Real myFuzzyValue;
BOPAlgo_GlueEnum myGlue;
Standard_Boolean myDrawWarnShapes;
Standard_Boolean myCheckInverted;
};
//
//=======================================================================
@@ -380,22 +370,6 @@ Standard_Boolean BOPTest_Objects::DrawWarnShapes()
return GetSession().DrawWarnShapes();
}
//=======================================================================
//function : SetCheckInverted
//purpose :
//=======================================================================
void BOPTest_Objects::SetCheckInverted(const Standard_Boolean bCheck)
{
GetSession().SetCheckInverted(bCheck);
}
//=======================================================================
//function : CheckInverted
//purpose :
//=======================================================================
Standard_Boolean BOPTest_Objects::CheckInverted()
{
return GetSession().CheckInverted();
}
//=======================================================================
//function : Allocator1
//purpose :
//=======================================================================

View File

@@ -87,10 +87,6 @@ public:
Standard_EXPORT static Standard_Boolean DrawWarnShapes();
Standard_EXPORT static void SetCheckInverted(const Standard_Boolean bCheck);
Standard_EXPORT static Standard_Boolean CheckInverted();
protected:
private:

View File

@@ -27,7 +27,6 @@ static Standard_Integer bnondestructive(Draw_Interpretor&, Standard_Integer, con
static Standard_Integer bfuzzyvalue(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bGlue(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bdrawwarnshapes(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bcheckinverted(Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//function : OptionCommands
@@ -49,8 +48,6 @@ void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
theCommands.Add("bdrawwarnshapes", "Defines whether to draw warning shapes or not\n"
"Usage: bdrawwarnshapes [0 (do not draw) / 1 (draw warning shapes)",
__FILE__, bdrawwarnshapes, g);
theCommands.Add("bcheckinverted", "Defines whether to check the input solids on inverted status or not\n"
"Usage: bcheckinverted [0 (off) / 1 (on)]", __FILE__, bcheckinverted, g);
}
//=======================================================================
//function : boptions
@@ -75,7 +72,6 @@ Standard_Integer boptions(Draw_Interpretor& di,
aFuzzyValue = BOPTest_Objects::FuzzyValue();
aGlue = BOPTest_Objects::Glue();
Standard_Boolean bDrawWarnShapes = BOPTest_Objects::DrawWarnShapes();
Standard_Boolean bCheckInverted = BOPTest_Objects::CheckInverted();
//
Sprintf(buf, " RunParallel: %d\n", bRunParallel);
di << buf;
@@ -88,8 +84,6 @@ Standard_Integer boptions(Draw_Interpretor& di,
di << buf;
Sprintf(buf, " Draw Warning Shapes: %s\n", bDrawWarnShapes ? "Yes" : "No");
di << buf;
Sprintf(buf, " Check for inverted solids: %s\n", bCheckInverted ? "Yes" : "No");
di << buf;
//
return 0;
}
@@ -215,21 +209,3 @@ Standard_Integer bdrawwarnshapes(Draw_Interpretor& di,
BOPTest_Objects::SetDrawWarnShapes(iDraw != 0);
return 0;
}
//=======================================================================
//function : bcheckinverted
//purpose :
//=======================================================================
Standard_Integer bcheckinverted(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n != 2) {
di.PrintHelp(a[0]);
return 1;
}
//
Standard_Integer iCheck = Draw::Atoi(a[1]);
BOPTest_Objects::SetCheckInverted(iCheck != 0);
return 0;
}

View File

@@ -188,7 +188,6 @@ Standard_Integer bbuild(Draw_Interpretor& di,
}
}
aBuilder.SetRunParallel(bRunParallel);
aBuilder.SetCheckInverted(BOPTest_Objects::CheckInverted());
//
//
OSD_Timer aTimer;
@@ -299,7 +298,6 @@ Standard_Integer bbop(Draw_Interpretor& di,
}
//
pBuilder->SetRunParallel(bRunParallel);
pBuilder->SetCheckInverted(BOPTest_Objects::CheckInverted());
//
OSD_Timer aTimer;
aTimer.Start();
@@ -365,7 +363,6 @@ Standard_Integer bsplit(Draw_Interpretor& di,
pSplitter->SetRunParallel(BOPTest_Objects::RunParallel());
pSplitter->SetNonDestructive(BOPTest_Objects::NonDestructive());
pSplitter->SetFuzzyValue(BOPTest_Objects::FuzzyValue());
pSplitter->SetCheckInverted(BOPTest_Objects::CheckInverted());
//
// measure the time of the operation
OSD_Timer aTimer;

View File

@@ -71,28 +71,38 @@ void BOPTools::MapShapesAndAncestors
(const TopoDS_Shape& S,
const TopAbs_ShapeEnum TS,
const TopAbs_ShapeEnum TA,
BOPCol_IndexedDataMapOfShapeListOfShape& Map)
BOPCol_IndexedDataMapOfShapeListOfShape& aMEF)
{
TopExp_Explorer aExS, aExA;
//
// visit ancestors
TopExp_Explorer aExA(S, TA);
for (; aExA.More(); aExA.Next())
{
aExA.Init(S, TA);
while (aExA.More()) {
// visit shapes
const TopoDS_Shape& anAnc = aExA.Current();
const TopoDS_Shape& aF = aExA.Current();
//
TopExp_Explorer aExS(anAnc, TS);
for (; aExS.More(); aExS.Next())
{
const TopoDS_Shape& aSS = aExS.Current();
BOPCol_ListOfShape* pLA = Map.ChangeSeek(aSS);
if (!pLA)
pLA = &Map(Map.Add(aSS, BOPCol_ListOfShape()));
pLA->Append(anAnc);
aExS.Init(aF, TS);
while (aExS.More()) {
const TopoDS_Shape& aE= aExS.Current();
if (aMEF.Contains(aE)) {
aMEF.ChangeFromKey(aE).Append(aF);
}
else {
BOPCol_ListOfShape aLS;
aLS.Append(aF);
aMEF.Add(aE, aLS);
}
aExS.Next();
}
aExA.Next();
}
//
// visit shapes not under ancestors
TopExp_Explorer aExS(S, TS, TA);
for (; aExS.More(); aExS.Next())
Map.Add(aExS.Current(), BOPCol_ListOfShape());
aExS.Init(S, TS, TA);
while (aExS.More()) {
const TopoDS_Shape& aE=aExS.Current();
BOPCol_ListOfShape aLS;
aMEF.Add(aE, aLS);
aExS.Next();
}
}

View File

@@ -120,149 +120,52 @@ static
//=======================================================================
void BOPTools_AlgoTools::MakeConnexityBlocks
(const TopoDS_Shape& theS,
const TopAbs_ShapeEnum theConnectionType,
const TopAbs_ShapeEnum theElementType,
BOPCol_ListOfListOfShape& theLCB,
BOPCol_IndexedDataMapOfShapeListOfShape& theConnectionMap)
const TopAbs_ShapeEnum theType1,
const TopAbs_ShapeEnum theType2,
BOPCol_ListOfShape& theLCB)
{
// Map shapes to find connected elements
BOPTools::MapShapesAndAncestors(theS, theConnectionType, theElementType, theConnectionMap);
BOPCol_IndexedDataMapOfShapeListOfShape aDMSLS;
BOPTools::MapShapesAndAncestors(theS, theType1, theType2, aDMSLS);
// Fence map
BOPCol_MapOfShape aMFence;
TopExp_Explorer aExp(theS, theElementType);
for (; aExp.More(); aExp.Next())
{
Standard_Integer i;
BRep_Builder aBB;
//
TopExp_Explorer aExp(theS, theType2);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aS = aExp.Current();
if (!aMFence.Add(aS)) {
continue;
}
// The block
BOPCol_ListOfShape aLBlock;
BOPCol_IndexedMapOfShape aMBlock;
TopoDS_Compound aBlock;
aBB.MakeCompound(aBlock);
// Start the block
aLBlock.Append(aS);
aMBlock.Add(aS);
aBB.Add(aBlock, aS);
// Look for connected parts
BOPCol_ListIteratorOfListOfShape aItB(aLBlock);
for (; aItB.More(); aItB.Next())
{
const TopoDS_Shape& aS1 = aItB.Value();
TopExp_Explorer aExpSS(aS1, theConnectionType);
for (; aExpSS.More(); aExpSS.Next())
{
for (i = 1; i <= aMBlock.Extent(); ++i) {
const TopoDS_Shape& aS1 = aMBlock(i);
TopExp_Explorer aExpSS(aS1, theType1);
for (; aExpSS.More(); aExpSS.Next()) {
const TopoDS_Shape& aSubS = aExpSS.Current();
const BOPCol_ListOfShape& aLS = theConnectionMap.FindFromKey(aSubS);
const BOPCol_ListOfShape& aLS = aDMSLS.FindFromKey(aSubS);
BOPCol_ListIteratorOfListOfShape aItLS(aLS);
for (; aItLS.More(); aItLS.Next())
{
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS2 = aItLS.Value();
if (aMFence.Add(aS2))
aLBlock.Append(aS2);
if (aMFence.Add(aS2)) {
aMBlock.Add(aS2);
aBB.Add(aBlock, aS2);
}
}
}
}
// Add the block into result
theLCB.Append(aLBlock);
}
}
//=======================================================================
// function: MakeConnexityBlocks
// purpose:
//=======================================================================
void BOPTools_AlgoTools::MakeConnexityBlocks
(const TopoDS_Shape& theS,
const TopAbs_ShapeEnum theConnectionType,
const TopAbs_ShapeEnum theElementType,
BOPCol_ListOfShape& theLCB)
{
BOPCol_ListOfListOfShape aLBlocks;
BOPCol_IndexedDataMapOfShapeListOfShape aCMap;
BOPTools_AlgoTools::MakeConnexityBlocks(theS, theConnectionType, theElementType, aLBlocks, aCMap);
// Make compound from each block
BOPCol_ListIteratorOfListOfListOfShape aItB(aLBlocks);
for (; aItB.More(); aItB.Next())
{
const BOPCol_ListOfShape& aLB = aItB.Value();
TopoDS_Compound aBlock;
BRep_Builder().MakeCompound(aBlock);
for (BOPCol_ListIteratorOfListOfShape it(aLB); it.More(); it.Next())
BRep_Builder().Add(aBlock, it.Value());
theLCB.Append(aBlock);
}
}
//=======================================================================
// function: MakeConnexityBlocks
// purpose:
//=======================================================================
void BOPTools_AlgoTools::MakeConnexityBlocks
(const BOPCol_ListOfShape& theLS,
const TopAbs_ShapeEnum theConnectionType,
const TopAbs_ShapeEnum theElementType,
BOPTools_ListOfConnexityBlock& theLCB)
{
BRep_Builder aBB;
// Make connexity blocks from start elements
TopoDS_Compound aCStart;
aBB.MakeCompound(aCStart);
BOPCol_MapOfShape aMFence, aMNRegular;
BOPCol_ListIteratorOfListOfShape aItL(theLS);
for (; aItL.More(); aItL.Next())
{
const TopoDS_Shape& aS = aItL.Value();
if (aMFence.Add(aS))
aBB.Add(aCStart, aS);
else
aMNRegular.Add(aS);
}
BOPCol_ListOfListOfShape aLCB;
BOPCol_IndexedDataMapOfShapeListOfShape aCMap;
BOPTools_AlgoTools::MakeConnexityBlocks(aCStart, theConnectionType, theElementType, aLCB, aCMap);
// Save the blocks and check their regularity
BOPCol_ListIteratorOfListOfListOfShape aItB(aLCB);
for (; aItB.More(); aItB.Next())
{
const BOPCol_ListOfShape& aBlock = aItB.Value();
BOPTools_ConnexityBlock aCB;
BOPCol_ListOfShape& aLCS = aCB.ChangeShapes();
Standard_Boolean bRegular = Standard_True;
for (BOPCol_ListIteratorOfListOfShape it(aBlock); it.More(); it.Next())
{
TopoDS_Shape aS = it.Value();
if (aMNRegular.Contains(aS))
{
bRegular = Standard_False;
aS.Orientation(TopAbs_FORWARD);
aLCS.Append(aS);
aS.Orientation(TopAbs_REVERSED);
aLCS.Append(aS);
}
else
{
aLCS.Append(aS);
if (bRegular)
{
// Check if there are no multi-connected shapes
for (TopExp_Explorer ex(aS, theConnectionType); ex.More() && bRegular; ex.Next())
bRegular = (aCMap.FindFromKey(ex.Current()).Extent() == 2);
}
}
}
aCB.SetRegular(bRegular);
theLCB.Append(aCB);
}
}
//=======================================================================
// function: OrientEdgesOnWire
// purpose: Reorient edges on wire for correct ordering
@@ -1985,8 +1888,6 @@ Standard_Boolean GetFaceDir(const TopoDS_Edge& aE,
bFound = BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge
(aE, aF, aT, aDt, aPx, aDN, theContext);
aProjPL.Perform(aPx);
Standard_ASSERT_RETURN(aProjPL.IsDone(),
"GetFaceDir: Project point on plane is failed", Standard_False);
aPx = aProjPL.NearestPoint();
gp_Vec aVec(aP, aPx);
aDB.SetXYZ(aVec.XYZ());

View File

@@ -28,9 +28,7 @@
#include <Standard_Boolean.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <BOPTools_ListOfCoupleOfShape.hxx>
#include <BOPTools_ListOfConnexityBlock.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_ListOfListOfShape.hxx>
#include <TopAbs_State.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_BaseAllocator.hxx>
@@ -190,34 +188,11 @@ public:
//! theMapAvoid - set of edges to avoid for
//! the treatment
Standard_EXPORT static void MakeConnexityBlock (BOPCol_ListOfShape& theLS, BOPCol_IndexedMapOfShape& theMapAvoid, BOPCol_ListOfShape& theLSCB, const BOPCol_BaseAllocator& theAllocator);
//! For the compound <theS> builds the blocks (compounds) of
//! elements of type <theElementType> connected through the shapes
//! of the type <theConnectionType>.
//! The blocks are stored into the list <theLCB>.
Standard_EXPORT static void MakeConnexityBlocks(const TopoDS_Shape& theS,
const TopAbs_ShapeEnum theConnectionType,
const TopAbs_ShapeEnum theElementType,
BOPCol_ListOfShape& theLCB);
//! For the compound <theS> builds the blocks (compounds) of
//! elements of type <theElementType> connected through the shapes
//! of the type <theConnectionType>.
//! The blocks are stored into the list of lists <theLCB>.
//! Returns also the connection map <theConnectionMap>, filled during operation.
Standard_EXPORT static void MakeConnexityBlocks(const TopoDS_Shape& theS,
const TopAbs_ShapeEnum theConnectionType,
const TopAbs_ShapeEnum theElementType,
BOPCol_ListOfListOfShape& theLCB,
BOPCol_IndexedDataMapOfShapeListOfShape& theConnectionMap);
//! Makes connexity blocks of elements of the given type with the given type of the
//! connecting elements. The blocks are checked on regularity (multi-connectivity)
//! and stored to the list of blocks <theLCB>.
Standard_EXPORT static void MakeConnexityBlocks(const BOPCol_ListOfShape& theLS,
const TopAbs_ShapeEnum theConnectionType,
const TopAbs_ShapeEnum theElementType,
BOPTools_ListOfConnexityBlock& theLCB);
//! For the compound theS build the blocks
//! theLCB (as list of compounds)
//! in terms of connexity by the shapes of theType
Standard_EXPORT static void MakeConnexityBlocks (const TopoDS_Shape& theS, const TopAbs_ShapeEnum theType1, const TopAbs_ShapeEnum theType2, BOPCol_ListOfShape& theLCB);
//! Correctly orients edges on the wire
Standard_EXPORT static void OrientEdgesOnWire (TopoDS_Shape& theWire);
@@ -273,9 +248,7 @@ public:
//! Compute a 3D-point on the edge <aEdge> at parameter <aPrm>
Standard_EXPORT static void PointOnEdge (const TopoDS_Edge& aEdge, const Standard_Real aPrm, gp_Pnt& aP);
//! Makes a copy of <theEdge> with vertices.
Standard_EXPORT static TopoDS_Edge CopyEdge(const TopoDS_Edge& theEdge);
//! Make the edge from base edge <aE1> and two vertices <aV1,aV2>
//! at parameters <aP1,aP2>

View File

@@ -46,6 +46,7 @@
#include <GeomAdaptor_HSurface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomInt.hxx>
#include <GeomLib.hxx>
#include <GeomProjLib.hxx>
#include <gp.hxx>
#include <gp_Cylinder.hxx>
@@ -66,6 +67,9 @@
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
static
Standard_Boolean CheckEdgeLength (const TopoDS_Edge& );
static
Handle(Geom2d_Curve) BRep_Tool_CurveOnSurface(const TopoDS_Edge& ,
const TopoDS_Face& ,
@@ -129,6 +133,9 @@ Standard_Boolean BOPTools_AlgoTools2D::EdgeTangent
if (isdgE) {
return Standard_False;
}
if (!CheckEdgeLength(anEdge)) {
return Standard_False;
}
Handle(Geom_Curve) aC=BRep_Tool::Curve(anEdge, first, last);
gp_Pnt aP;
@@ -623,13 +630,11 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
Handle(GeomAdaptor_HCurve) aBAHC = new GeomAdaptor_HCurve(aC3D, aT1, aT2);
//
Standard_Real aTolR;
Standard_Real aTR = Precision::Confusion();//1.e-7;
Standard_Real aMaxTol = 1.e3 * aTR; //0.0001
Standard_Boolean isAnaSurf = ProjLib::IsAnaSurf(aBAHS);
//when the type of surface is GeomAbs_SurfaceOfRevolution
if (pBAS->GetType() == GeomAbs_SurfaceOfRevolution)
{
if (pBAS->GetType() == GeomAbs_SurfaceOfRevolution) {
Standard_Real aTR;
//
aTR=Precision::Confusion();//1.e-7;
if (TolReached2d > aTR) {
aTR=TolReached2d;
}
@@ -638,44 +643,23 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
ProjLib::MakePCurveOfType(aProj1, aC2D);
aTolR = aProj1.GetTolerance();
}
else
{
ProjLib_ProjectedCurve aProjCurv(aBAHS);
Standard_Integer aDegMin = -1, aDegMax = -1, aMaxSegments = -1;
Standard_Real aMaxDist = -1;
AppParCurves_Constraint aBndPnt = AppParCurves_TangencyPoint;
if ((TolReached2d >= 10. * aTR) && (TolReached2d <= aMaxTol || isAnaSurf))
{
aTR = Min(aMaxTol, 0.1*TolReached2d);
aMaxSegments = 100;
aMaxDist = 1.e3*TolReached2d;
if(!isAnaSurf || TolReached2d > 1.)
{
aBndPnt = AppParCurves_PassPoint;
}
}
else if(TolReached2d > aMaxTol)
{
aTR = Min(TolReached2d, 1.e3 * aMaxTol);
aMaxDist = 1.e2 * aTR;
aMaxSegments = 100;
}
aProjCurv.Load(aTR);
aProjCurv.SetDegree(aDegMin, aDegMax);
aProjCurv.SetMaxSegments(aMaxSegments);
aProjCurv.SetBndPnt(aBndPnt);
aProjCurv.SetMaxDist(aMaxDist);
aProjCurv.Perform(aBAHC);
else {
ProjLib_ProjectedCurve aProjCurv(aBAHS, aBAHC);// 1
ProjLib::MakePCurveOfType(aProjCurv, aC2D);
aTolR=aProjCurv.GetTolerance();
}
//
if (aC2D.IsNull() && (aTR < aMaxTol || aTR < TolReached2d))
{
aTR = Max(TolReached2d, aMaxTol);
ProjLib_ProjectedCurve aProjCurvAgain(aBAHS, aBAHC, aTR);// 2
if (aC2D.IsNull()) {
ProjLib_ProjectedCurve aProjCurvAgain(aBAHS, aBAHC, TolReached2d);// 2
ProjLib::MakePCurveOfType(aProjCurvAgain, aC2D);
aTolR = aProjCurvAgain.GetTolerance();
//
if (aC2D.IsNull()) {
Standard_Real aTR=0.0001;
ProjLib_ProjectedCurve aProj3(aBAHS, aBAHC, aTR);// 3
ProjLib::MakePCurveOfType(aProj3, aC2D);
aTolR = aProj3.GetTolerance();
}
}
//
if(aC2D.IsNull())
@@ -684,12 +668,25 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
}
//
TolReached2d=aTolR;
//
// Adjust curve for periodic surface
Handle(Geom2d_Curve) aC2DA;
BOPTools_AlgoTools2D::AdjustPCurveOnSurf (*pBAS, aT1, aT2, aC2D, aC2DA);
//
aC2D=aC2DA;
//
aC2D = aC2DA;
// Make sure that the range of the 2D curve is sufficient for representation of the 3D curve.
Standard_Real aTCFirst = aC2D->FirstParameter();
Standard_Real aTCLast = aC2D->LastParameter();
if ((aTCFirst - aT1) > Precision::PConfusion() ||
(aT2 - aTCLast ) > Precision::PConfusion())
{
if (aTCFirst < aT1) aTCFirst = aT1;
if (aTCLast > aT2) aTCLast = aT2;
GeomLib::SameRange(Precision::PConfusion(), aC2D,
aTCFirst, aTCLast, aT1, aT2, aC2D);
}
// compute the appropriate tolerance for the edge
Handle(Geom_Surface) aS = pBAS->Surface().Surface();
aS = Handle(Geom_Surface)::DownCast(aS->Transformed(pBAS->Trsf()));
@@ -703,6 +700,44 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
}
}
//=======================================================================
//function : CheckEdgeLength
//purpose :
//=======================================================================
Standard_Boolean CheckEdgeLength (const TopoDS_Edge& E)
{
BRepAdaptor_Curve BC(E);
BOPCol_IndexedMapOfShape aM;
BOPTools::MapShapes(E, TopAbs_VERTEX, aM);
Standard_Integer i, anExtent, aN=10;
Standard_Real ln=0., d, t, f, l, dt;
anExtent=aM.Extent();
if (anExtent!=1)
return Standard_True;
gp_Pnt p1, p2;
f = BC.FirstParameter();
l = BC.LastParameter();
dt=(l-f)/aN;
BC.D0(f, p1);
for (i=1; i<=aN; i++) {
t=f+i*dt;
if (i==aN)
BC.D0(l, p2);
else
BC.D0(t, p2);
d=p1.Distance(p2);
ln+=d;
p1=p2;
}
//
return (ln > Precision::Confusion());
}
//=======================================================================
//function : BRep_Tool_CurveOnSurface
//purpose :

View File

@@ -113,6 +113,14 @@ static
const Standard_Real aTol,
const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
Standard_Real IntersectCurves2d(const TopoDS_Vertex& theV,
const TopoDS_Face& theF,
const Handle(Geom_Surface)& theS,
const TopoDS_Edge& theE1,
const TopoDS_Edge& theE2,
NCollection_DataMap<TopoDS_Shape, Standard_Real>& theMapEdgeLen);
//=======================================================================
//class : BOPTools_CPC
//purpose :
@@ -469,43 +477,55 @@ void CheckEdge (const TopoDS_Edge& Ed,
const Standard_Real aMaxTol,
const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
TopoDS_Edge aE = Ed;
Standard_Real aTolE, aTol, aD2, aNewTolerance, dd;
gp_Pnt aPC;
TopLoc_Location L;
TopoDS_Edge aE;
TopoDS_Vertex aV;
TopoDS_Iterator aItS;
//
TopAbs_Orientation aOrV;
BRep_ListIteratorOfListOfPointRepresentation aItPR;
BRep_ListIteratorOfListOfCurveRepresentation aItCR;
//
aE=Ed;
aE.Orientation(TopAbs_FORWARD);
Standard_Real aTolE = BRep_Tool::Tolerance(aE);
aTolE=BRep_Tool::Tolerance(aE);
//
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*)&aE.TShape());
//
const TopLoc_Location& Eloc = aE.Location();
TopoDS_Iterator aItS(aE);
aItS.Initialize(aE);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Vertex& aV= TopoDS::Vertex(aItS.Value());
aV= TopoDS::Vertex(aItS.Value());
//
Handle(BRep_TVertex)& TV=*((Handle(BRep_TVertex)*)&aV.TShape());
const gp_Pnt& aPV = TV->Pnt();
//
Standard_Real aTol=BRep_Tool::Tolerance(aV);
aTol=BRep_Tool::Tolerance(aV);
aTol=Max(aTol, aTolE);
Standard_Real dd=0.1*aTol;
dd=0.1*aTol;
aTol*=aTol;
//
BRep_ListIteratorOfListOfCurveRepresentation aItCR(TE->Curves());
const TopLoc_Location& Eloc = aE.Location();
//
aItCR.Initialize(TE->Curves());
while (aItCR.More()) {
const Handle(BRep_CurveRepresentation)& aCR = aItCR.Value();
const TopLoc_Location& loc = aCR->Location();
L = (Eloc * loc).Predivided(aV.Location());
//
if (aCR->IsCurve3D()) {
const Handle(Geom_Curve)& aC = aCR->Curve3D();
if (!aC.IsNull()) {
TopLoc_Location L = (Eloc * aCR->Location()).Predivided(aV.Location());
BRep_ListIteratorOfListOfPointRepresentation aItPR(TV->Points());
aItPR.Initialize(TV->Points());
while (aItPR.More()) {
const Handle(BRep_PointRepresentation)& aPR=aItPR.Value();
if (aPR->IsPointOnCurve(aC, L)) {
gp_Pnt aPC = aC->Value(aPR->Parameter());
aPC = aC->Value(aPR->Parameter());
aPC.Transform(L.Transformation());
Standard_Real aD2=aPV.SquareDistance(aPC);
aD2=aPV.SquareDistance(aPC);
if (aD2 > aTol) {
Standard_Real aNewTolerance=sqrt(aD2)+dd;
aNewTolerance=sqrt(aD2)+dd;
if (aNewTolerance<aMaxTol)
UpdateShape(aV, aNewTolerance, aMapToAvoid);
}
@@ -513,10 +533,10 @@ void CheckEdge (const TopoDS_Edge& Ed,
aItPR.Next();
}
//
TopAbs_Orientation aOrV=aV.Orientation();
aOrV=aV.Orientation();
if (aOrV==TopAbs_FORWARD || aOrV==TopAbs_REVERSED) {
Handle(BRep_GCurve) aGC (Handle(BRep_GCurve)::DownCast (aCR));
gp_Pnt aPC;
if (aOrV==TopAbs_FORWARD) {
aPC=aC->Value(aGC->First());
}
@@ -525,9 +545,9 @@ void CheckEdge (const TopoDS_Edge& Ed,
}
aPC.Transform(L.Transformation());
//
Standard_Real aD2=aPV.SquareDistance(aPC);
aD2=aPV.SquareDistance(aPC);
if (aD2 > aTol) {
Standard_Real aNewTolerance=sqrt(aD2)+dd;
aNewTolerance=sqrt(aD2)+dd;
if (aNewTolerance<aMaxTol)
UpdateShape(aV, aNewTolerance, aMapToAvoid);
}
@@ -538,6 +558,80 @@ void CheckEdge (const TopoDS_Edge& Ed,
}// while (itcr.More()) {
} // for (; aVExp.More(); aVExp.Next()) {
}
//=======================================================================
// Function : CorrectWires
// purpose :
//=======================================================================
void CorrectWires(const TopoDS_Face& aFx,
const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
Standard_Integer i, aNbV;
Standard_Real aTol, aTol2, aD2, aD2max, aT1, aT2, aT;
gp_Pnt aP, aPV;
gp_Pnt2d aP2D;
TopoDS_Face aF;
TopTools_IndexedDataMapOfShapeListOfShape aMVE;
TopTools_ListIteratorOfListOfShape aIt, aIt1;
//
aF=aFx;
aF.Orientation(TopAbs_FORWARD);
const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aFx);
//
TopExp::MapShapesAndAncestors(aF,
TopAbs_VERTEX,
TopAbs_EDGE,
aMVE);
NCollection_DataMap<TopoDS_Shape, Standard_Real> aMapEdgeLen;
aNbV=aMVE.Extent();
for (i=1; i<=aNbV; ++i) {
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMVE.FindKey(i));
aPV=BRep_Tool::Pnt(aV);
aTol=BRep_Tool::Tolerance(aV);
aTol2=aTol*aTol;
//
aD2max=-1.;
const TopTools_ListOfShape& aLE=aMVE.FindFromIndex(i);
aIt.Initialize(aLE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Edge& aE=*(TopoDS_Edge*)(&aIt.Value());
const Handle(Geom2d_Curve)& aC2D=
BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2);
aT=BRep_Tool::Parameter(aV, aE);
//
aC2D->D0(aT, aP2D);
aS->D0(aP2D.X(), aP2D.Y(), aP);
aD2=aPV.SquareDistance(aP);
if (aD2>aD2max) {
aD2max=aD2;
}
}
//
//check wires on self interference by intersecting 2d curves of the edges
aIt.Initialize(aLE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Edge& aE1 = *(TopoDS_Edge*)&aIt.Value();
//
aIt1 = aIt;
for (aIt1.Next(); aIt1.More(); aIt1.Next()) {
const TopoDS_Edge& aE2 = *(TopoDS_Edge*)&aIt1.Value();
//
if (aE1.IsSame(aE2)) {
continue;
}
//
aD2 = IntersectCurves2d(aV, aF, aS, aE1, aE2, aMapEdgeLen);
if (aD2 > aD2max) {
aD2max = aD2;
}
}
}
//
if (aD2max>aTol2) {
aTol = 1.01 * sqrt(aD2max);
UpdateShape(aV, aTol, aMapToAvoid);
}
}// for (i=1; i<=aNbV; ++i) {
}
//=======================================================================
// Function : MapEdgeLength
@@ -559,48 +653,35 @@ static Standard_Real MapEdgeLength(const TopoDS_Edge& theEdge,
}
return *pLen;
}
//=======================================================================
// Function : EdgeData
// purpose : Structure to store edge data
//=======================================================================
namespace {
struct EdgeData {
const TopoDS_Edge* Edge; // Edge
Standard_Real VParameter; // Parameter of the vertex on the edge
Geom2dAdaptor_Curve GAdaptor; // 2D adaptor for PCurve of the edge on the face
Standard_Real First; // First parameter in the range
Standard_Real Last; // Last parameter in the rage
};
}
//=======================================================================
// Function : IntersectCurves2d
// purpose : Intersect 2d curves of edges
//=======================================================================
static
Standard_Real IntersectCurves2d(const TopoDS_Vertex& theV,
const Handle(Geom_Surface)& theS,
const EdgeData& theEData1,
const EdgeData& theEData2,
NCollection_DataMap<TopoDS_Shape, Standard_Real>& theMapEdgeLen)
Standard_Real IntersectCurves2d(const TopoDS_Vertex& theV,
const TopoDS_Face& theF,
const Handle(Geom_Surface)& theS,
const TopoDS_Edge& theE1,
const TopoDS_Edge& theE2,
NCollection_DataMap<TopoDS_Shape, Standard_Real>& theMapEdgeLen)
{
Standard_Real aT11, aT12, aT21, aT22, aTol2d, aMaxDist;
Geom2dInt_GInter anInter;
// Range of the first edge
Standard_Real aT11 = theEData1.First;
Standard_Real aT12 = theEData1.Last;
// Range of the second edge
Standard_Real aT21 = theEData2.First;
Standard_Real aT22 = theEData2.Last;
Standard_Real aMaxDist = 0.;
Standard_Real aTol2d = 1.e-10;
//
IntRes2d_Domain aDom1(theEData1.GAdaptor.Value(aT11), aT11, aTol2d,
theEData1.GAdaptor.Value(aT12), aT12, aTol2d);
IntRes2d_Domain aDom2(theEData2.GAdaptor.Value(aT21), aT21, aTol2d,
theEData2.GAdaptor.Value(aT22), aT22, aTol2d);
aMaxDist = 0.;
aTol2d = 1.e-10;
//
anInter.Perform(theEData1.GAdaptor, aDom1, theEData2.GAdaptor, aDom2, aTol2d, aTol2d);
const Handle(Geom2d_Curve)& aC2D1=
BRep_Tool::CurveOnSurface(theE1, theF, aT11, aT12);
const Handle(Geom2d_Curve)& aC2D2=
BRep_Tool::CurveOnSurface(theE2, theF, aT21, aT22);
//
Geom2dAdaptor_Curve aGAC1(aC2D1), aGAC2(aC2D2);
IntRes2d_Domain aDom1(aC2D1->Value(aT11), aT11, aTol2d,
aC2D1->Value(aT12), aT12, aTol2d);
IntRes2d_Domain aDom2(aC2D2->Value(aT21), aT21, aTol2d,
aC2D2->Value(aT22), aT22, aTol2d);
//
anInter.Perform(aGAC1, aDom1, aGAC2, aDom2, aTol2d, aTol2d);
if (!anInter.IsDone() || (!anInter.NbSegments() && !anInter.NbPoints())) {
return aMaxDist;
}
@@ -613,8 +694,8 @@ static
NCollection_List<IntRes2d_IntersectionPoint>::Iterator aItLP;
//
aPV = BRep_Tool::Pnt(theV);
aT1 = theEData1.VParameter;
aT2 = theEData2.VParameter;
aT1 = BRep_Tool::Parameter(theV, theE1);
aT2 = BRep_Tool::Parameter(theV, theE2);
//
aHalfR1 = (aT12 - aT11) / 2.;
aHalfR2 = (aT22 - aT21) / 2.;
@@ -635,8 +716,8 @@ static
}
//
// evaluate the length of the smallest edge, so that not to return too large distance
Standard_Real aLen1 = MapEdgeLength(*theEData1.Edge, theMapEdgeLen);
Standard_Real aLen2 = MapEdgeLength(*theEData1.Edge, theMapEdgeLen);
Standard_Real aLen1 = MapEdgeLength(theE1, theMapEdgeLen);
Standard_Real aLen2 = MapEdgeLength(theE2, theMapEdgeLen);
const Standard_Real MaxEdgePartCoveredByVertex = 0.3;
Standard_Real aMaxThresDist = Min(aLen1, aLen2) * MaxEdgePartCoveredByVertex;
aMaxThresDist *= aMaxThresDist;
@@ -669,86 +750,6 @@ static
//
return aMaxDist;
}
//=======================================================================
// Function : CorrectWires
// purpose :
//=======================================================================
void CorrectWires(const TopoDS_Face& aFx,
const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
Standard_Integer i, aNbV;
Standard_Real aTol, aTol2, aD2, aD2max, aT1, aT2, aT;
gp_Pnt aP, aPV;
gp_Pnt2d aP2D;
TopoDS_Face aF;
TopTools_IndexedDataMapOfShapeListOfShape aMVE;
TopTools_ListIteratorOfListOfShape aIt;
//
aF=aFx;
aF.Orientation(TopAbs_FORWARD);
const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aFx);
//
TopExp::MapShapesAndAncestors(aF,
TopAbs_VERTEX,
TopAbs_EDGE,
aMVE);
NCollection_DataMap<TopoDS_Shape, Standard_Real> aMapEdgeLen;
aNbV=aMVE.Extent();
for (i=1; i<=aNbV; ++i) {
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMVE.FindKey(i));
aPV=BRep_Tool::Pnt(aV);
aTol=BRep_Tool::Tolerance(aV);
aTol2=aTol*aTol;
//
aD2max=-1.;
// Save edge's data to avoid its recalculation during intersection of 2d curves
NCollection_List<EdgeData> aLEPars;
const TopTools_ListOfShape& aLE=aMVE.FindFromIndex(i);
aIt.Initialize(aLE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Edge& aE=*(TopoDS_Edge*)(&aIt.Value());
const Handle(Geom2d_Curve)& aC2D=
BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2);
aT=BRep_Tool::Parameter(aV, aE);
//
aC2D->D0(aT, aP2D);
aS->D0(aP2D.X(), aP2D.Y(), aP);
aD2=aPV.SquareDistance(aP);
if (aD2>aD2max) {
aD2max=aD2;
}
EdgeData anEData = {&aE, aT, Geom2dAdaptor_Curve(aC2D), aT1, aT2};
aLEPars.Append(anEData);
}
//
//check wires on self interference by intersecting 2d curves of the edges
NCollection_List<EdgeData>::Iterator aItE1(aLEPars);
for (; aItE1.More(); aItE1.Next()) {
const EdgeData& aEData1 = aItE1.Value();
const TopoDS_Shape& aE1 = *aEData1.Edge;
NCollection_List<EdgeData>::Iterator aItE2 = aItE1;
for (aItE2.Next(); aItE2.More(); aItE2.Next()) {
const EdgeData& aEData2 = aItE2.Value();
const TopoDS_Shape& aE2 = *aEData2.Edge;
if (aE1.IsSame(aE2))
continue;
aD2 = IntersectCurves2d(aV, aS, aEData1, aEData2, aMapEdgeLen);
if (aD2 > aD2max) {
aD2max = aD2;
}
}
}
//
if (aD2max>aTol2) {
aTol = 1.01 * sqrt(aD2max);
UpdateShape(aV, aTol, aMapToAvoid);
}
}// for (i=1; i<=aNbV; ++i) {
}
//=======================================================================
// Function : CorrectEdgeTolerance
// purpose : Correct tolerances for Edge

View File

@@ -132,20 +132,6 @@ void BOPTools_AlgoTools::MakeSectEdge(const IntTools_Curve& aIC,
}
//=======================================================================
// function: CopyEdge
// purpose:
//=======================================================================
TopoDS_Edge BOPTools_AlgoTools::CopyEdge(const TopoDS_Edge& theEdge)
{
TopoDS_Edge aNewEdge = TopoDS::Edge(theEdge.Oriented(TopAbs_FORWARD));
aNewEdge.EmptyCopy();
for (TopoDS_Iterator it(theEdge, Standard_False); it.More(); it.Next())
BRep_Builder().Add(aNewEdge, it.Value());
aNewEdge.Orientation(theEdge.Orientation());
return aNewEdge;
}
//=======================================================================
// function: MakeSplitEdge
// purpose:
@@ -157,6 +143,9 @@ void BOPTools_AlgoTools::MakeSplitEdge(const TopoDS_Edge& aE,
const Standard_Real aP2,
TopoDS_Edge& aNewEdge)
{
Standard_Real aTol;//f, l,
aTol=BRep_Tool::Tolerance(aE);
//
TopoDS_Edge E = TopoDS::Edge(aE.Oriented(TopAbs_FORWARD));
E.EmptyCopy();
//
@@ -168,6 +157,7 @@ void BOPTools_AlgoTools::MakeSplitEdge(const TopoDS_Edge& aE,
BB.Add (E, aV2);
}
BB.Range(E, aP1, aP2);
BB.UpdateEdge(E, aTol);
aNewEdge=E;
aNewEdge.Orientation(aE.Orientation());
}

View File

@@ -55,7 +55,6 @@ public:
using BOPAlgo_Options::ClearWarnings;
using BOPAlgo_Options::GetReport;
using BOPAlgo_Options::SetProgressIndicator;
using BOPAlgo_Options::SetCheckInverted;
protected:

View File

@@ -353,7 +353,6 @@ void BRepAlgoAPI_BooleanOperation::Build()
//
myBuilder->SetRunParallel(myRunParallel);
myBuilder->SetProgressIndicator(myProgressIndicator);
myBuilder->SetCheckInverted(myCheckInverted);
//
myBuilder->PerformWithFiller(*myDSFiller);
//

View File

@@ -163,7 +163,6 @@ void BRepAlgoAPI_BuilderAlgo::Build()
//
myBuilder->SetRunParallel(myRunParallel);
myBuilder->SetProgressIndicator(myProgressIndicator);
myBuilder->SetCheckInverted(myCheckInverted);
//
myBuilder->PerformWithFiller(*myDSFiller);
//

View File

@@ -121,7 +121,6 @@ void BRepAlgoAPI_Splitter::Build()
//
myBuilder->SetRunParallel(myRunParallel);
myBuilder->SetProgressIndicator(myProgressIndicator);
myBuilder->SetCheckInverted(myCheckInverted);
//
myBuilder->PerformWithFiller(*myDSFiller);
//

View File

@@ -185,6 +185,8 @@ private:
Standard_Boolean myCopyMesh;
};
DEFINE_STANDARD_HANDLE(BRepBuilderAPI_Copy_Modification, BRepTools_Modification)
} // anonymous namespace
//=======================================================================

View File

@@ -51,7 +51,6 @@
#include <BRep_ListOfPointRepresentation.hxx>
#include <BRep_PointOnCurve.hxx>
#include <BRep_Tool.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_TVertex.hxx>
#include <BRepBuilderAPI_BndBoxTreeSelector.hxx>
#include <BRepBuilderAPI_CellFilter.hxx>
@@ -962,22 +961,11 @@ TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirs
if (dist > dist2)
dist2 = dist;
}
maxTol = Max(sqrt(dist2) * (1. + 1e-7), Precision::Confusion());
}
}
if (maxTol >= 0. && maxTol < tolReached)
{
if (tolReached > MaxTolerance())
{
// Set tolerance directly to overwrite too large tolerance
static_cast<BRep_TEdge*>(edge.TShape().get())->Tolerance(maxTol);
}
else
{
// just update tolerance with computed distance
aBuilder.UpdateEdge(edge, maxTol);
maxTol = Max(sqrt(dist2), Precision::Confusion());
}
}
if(maxTol >= 0. && maxTol < tolReached)
aBuilder.UpdateEdge(edge, maxTol);
aBuilder.SameParameter(edge,Standard_True);
}
}

View File

@@ -47,9 +47,9 @@ static
Standard_Real GetAddToParam(const gp_Lin& L,const Standard_Real P,const Bnd_Box& B);
//gets transition of line <L> passing through/near the edge <e> of faces <f1>, <f2>. <param> is
// a parameter on the edge where the minimum distance between <l> and <e> was found
static Standard_Integer GetTransi(const TopoDS_Face& f1, const TopoDS_Face& f2, const TopoDS_Edge e,
Standard_Real param, const gp_Lin& L, IntCurveSurface_TransitionOnCurve& trans);
// a parameter on the edge where the minimum distance between <l> and <e> was found
static Standard_Integer GetTransi(const TopoDS_Face& f1, const TopoDS_Face& f2, const TopoDS_Edge e,
Standard_Real param, const Geom_Line& L, IntCurveSurface_TransitionOnCurve& trans);
static Standard_Boolean GetNormalOnFaceBound(const TopoDS_Edge& E, const TopoDS_Face& F, Standard_Real param, gp_Dir& OutDir);
@@ -560,7 +560,7 @@ static Standard_Integer GetTransi(const TopoDS_Face& f1,
const TopoDS_Face& f2,
const TopoDS_Edge e,
const Standard_Real param,
const gp_Lin& L,
const Geom_Line& L,
IntCurveSurface_TransitionOnCurve& trans)
{
//return statuses:
@@ -573,7 +573,7 @@ static Standard_Integer GetTransi(const TopoDS_Face& f1,
if (!GetNormalOnFaceBound(e, f2, param, nf2))
return -1;
const gp_Dir& LDir = L.Direction();
const gp_Dir& LDir = L.Lin().Direction();
if(Abs(LDir.Dot(nf1)) < Precision::Angular() || Abs(LDir.Dot(nf2)) < Precision::Angular())
{
@@ -627,4 +627,4 @@ static void Trans(const Standard_Real parmin,
state = 3; // IN
else
state = 4; // OUT
}
}

View File

@@ -61,9 +61,6 @@ public:
//! Changes the constraints of the approximation.
Standard_EXPORT void SetConstraints (const AppParCurves_Constraint FirstC, const AppParCurves_Constraint LastC);
//! Changes the max number of segments, which is allowed for cutting.
Standard_EXPORT void SetMaxSegments (const Standard_Integer theMaxSegments);
//! returns False if at a moment of the approximation,
//! the status NoApproximation has been sent by the user
//! when more points were needed.
@@ -117,7 +114,7 @@ private:
Standard_Boolean mycut;
AppParCurves_Constraint myfirstC;
AppParCurves_Constraint mylastC;
Standard_Integer myMaxSegments;
};

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