mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Compare commits
53 Commits
CR29144_1
...
CR0_720_Fi
Author | SHA1 | Date | |
---|---|---|---|
|
2ab2295cec | ||
|
84dd587638 | ||
|
28c0c6b155 | ||
|
47b0f294be | ||
|
7d6be4672b | ||
|
b453701e1f | ||
|
c23d6ec61f | ||
|
b05ff75a60 | ||
|
e49dc1e054 | ||
|
abca9f3eb8 | ||
|
68556f75f9 | ||
|
3d607bc062 | ||
|
365585ddfb | ||
|
c89ab82e4c | ||
|
cc964ef4d3 | ||
|
cb127824b2 | ||
|
fbebf6078c | ||
|
762fa70875 | ||
|
4dd6fb9a80 | ||
|
70608ec03d | ||
|
0842e31d95 | ||
|
51204152b9 | ||
|
d517575214 | ||
|
99d9eb3933 | ||
|
a3430df1d4 | ||
|
9f9ac0fb5a | ||
|
e0fd0b8797 | ||
|
09aae06737 | ||
|
eea07c2f60 | ||
|
9cee51b43b | ||
|
760a94d050 | ||
|
a8375ceaf0 | ||
|
55374b512e | ||
|
52a5d7a61d | ||
|
77676f1b6d | ||
|
515991ffef | ||
|
3d5d9d2b5e | ||
|
51e75dba6c | ||
|
b008680dc0 | ||
|
2b5ced28c3 | ||
|
1c4b27600f | ||
|
214171ff60 | ||
|
22f9125e1e | ||
|
1a196a871d | ||
|
5eba99e74b | ||
|
1560ac5528 | ||
|
4b46072ae9 | ||
|
eed77ff55c | ||
|
118e720920 | ||
|
80f77ed256 | ||
|
8f87d4a954 | ||
|
eeccb2515d | ||
|
b1ee6d0e4b |
@@ -79,7 +79,7 @@ if (WIN32)
|
||||
set (CSF_OpenGlLibs "opengl32.lib")
|
||||
endif()
|
||||
|
||||
else()
|
||||
else()
|
||||
|
||||
if (APPLE)
|
||||
set (CSF_objc "objc")
|
||||
@@ -112,5 +112,6 @@ if (WIN32)
|
||||
set (CSF_OpenGlLibs "GL")
|
||||
set (CSF_XwLibs "X11 Xext Xmu Xi")
|
||||
set (CSF_dl "dl")
|
||||
set (CSF_fontconfig "fontconfig")
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -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")
|
||||
|
@@ -68,7 +68,6 @@ FILE_TO_LIST ("adm/RESOURCES" RESOURCES)
|
||||
foreach (CurrentResource ${RESOURCES})
|
||||
get_filename_component (CurrentResource_FileName "${CurrentResource}" NAME)
|
||||
if ("${CurrentResource_FileName}" STREQUAL TObj.msg OR
|
||||
"${CurrentResource_FileName}" STREQUAL BOPAlgo.msg OR
|
||||
"${CurrentResource_FileName}" STREQUAL Units.dat OR
|
||||
"${CurrentResource}" STREQUAL XSMessage OR
|
||||
"${CurrentResource}" STREQUAL SHMessage OR
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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 {
|
||||
|
@@ -1375,6 +1375,7 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
|
||||
set aLibsMap(CSF_TclTkLibs) ""
|
||||
set aLibsMap(CSF_QT) "QtCore QtGui"
|
||||
} else {
|
||||
set aLibsMap(CSF_fontconfig) "fontconfig"
|
||||
if { "$theOS" == "qnx" } {
|
||||
# CSF_ThreadLibs - pthread API is part of libc on QNX
|
||||
set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
|
||||
|
@@ -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%"
|
||||
|
@@ -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" (
|
||||
|
@@ -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
282
data/occ/Box.brep
Normal 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
|
2562
data/occ/hammer.brep
2562
data/occ/hammer.brep
File diff suppressed because one or more lines are too long
@@ -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
|
||||
|
@@ -1437,3 +1437,10 @@ The Error/Warning reporting system of the algorithms in Boolean Component (in al
|
||||
The methods returning the status of errors and warnings of the algorithms (ErrorStatus() and WarningStatus()) have been removed.
|
||||
Instead use methods HasErrors() and HasWarnings() to check for presence of errors and warnings, respectively.
|
||||
The full list of errors and warnings, with associated data such as problematic sub-shapes, can be obtained by method GetReport().
|
||||
|
||||
@section upgrade_occt730 Upgrade to OCCT 7.3.0
|
||||
|
||||
@subsection upgrade_730_BRepAdaptor_CompCurve Changes in BRepAdaptor_CompCurve
|
||||
|
||||
The method BRepAdaptor_CompCurve::SetPeriodic has been eliminated.
|
||||
Since new version, the method BRepAdaptor_CompCurve::IsPeriodic() will always return FALSE. Earlier, it could return TRUE in case if the wire contained only one edge based on periodic curve.
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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,274 +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.
|
||||
~~~~~
|
||||
@@ -936,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()) {
|
||||
@@ -950,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.
|
||||
~~~~~
|
||||
@@ -968,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 = ...
|
||||
@@ -989,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.
|
||||
~~~~~
|
||||
@@ -1007,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 = ...
|
||||
@@ -1024,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:
|
||||
|
||||
~~~~~
|
||||
@@ -1069,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:
|
||||
|
||||
~~~~~
|
||||
@@ -1090,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.
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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}
|
||||
|
@@ -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
|
||||
|
@@ -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`
|
||||
|
@@ -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}
|
||||
|
@@ -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
|
||||
|
@@ -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`
|
||||
|
@@ -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}
|
||||
|
@@ -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
|
||||
|
@@ -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`
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -9,6 +9,8 @@ pload VISUALIZATION
|
||||
|
||||
vinit View1 w=1024 h=1024
|
||||
vclear
|
||||
vdefaults -autoTriang 0
|
||||
vrenderparams -stats basic
|
||||
|
||||
# parameter NB defines number of spheres by each coordinate
|
||||
set NB 10
|
||||
@@ -23,11 +25,12 @@ for {set i 0} {$i < $NB} {incr i} {
|
||||
}
|
||||
}
|
||||
}
|
||||
eval compound $slist c
|
||||
incmesh c 0.006
|
||||
|
||||
puts "Measuring FPS of display of spheres as separate objects..."
|
||||
vaxo
|
||||
vsetdispmode 1
|
||||
eval vdisplay $slist
|
||||
eval vdisplay -dispMode 1 $slist
|
||||
vfit
|
||||
|
||||
# measure FPS
|
||||
@@ -35,16 +38,14 @@ puts [set fps_separate [vfps]]
|
||||
vclear
|
||||
|
||||
puts "Measuring FPS of display of spheres as single object..."
|
||||
eval compound $slist c
|
||||
vdisplay c
|
||||
vdisplay -dispMode 1 c
|
||||
|
||||
# measure FPS
|
||||
puts [set fps_compound [vfps]]
|
||||
vclear
|
||||
|
||||
# redisplay individual spheres, trying to avoid unnecessary internal updates
|
||||
#vfrustumculling 0 ;# try to disable updates of frustum culling structures
|
||||
eval vdisplay -mutable $slist
|
||||
eval vdisplay -dispMode 1 $slist
|
||||
|
||||
# auxiliary procedure to make random update of variable
|
||||
proc upd {theValueName theDeltaName theTime theToRand} {
|
||||
@@ -69,8 +70,10 @@ proc animateSpheres {{theDuration 10.0}} {
|
||||
for {set i 0} {$i < $::NB} {incr i $nb} {
|
||||
for {set j 0} {$j < $::NB} {incr j $nb} {
|
||||
for {set k 0} {$k < $::NB} {incr k $nb} {
|
||||
# mark animated spheres mutable for faster updates
|
||||
uplevel #0 vdisplay -dispMode 1 -mutable s$i$j$k
|
||||
# vaspects -noupdate s$i$j$k -setcolor red -setmaterial plastic
|
||||
vaspects -noupdate s$i$j$k -setcolor red
|
||||
uplevel #0 vaspects -noupdate s$i$j$k -setcolor red
|
||||
set x$i$j$k 0.0
|
||||
set y$i$j$k 0.0
|
||||
set z$i$j$k 0.0
|
||||
@@ -142,4 +145,4 @@ puts "Animation FPS: $fps_animation"
|
||||
puts ""
|
||||
puts "Scene contains [lindex [trinfo c] 3] triangles"
|
||||
puts ""
|
||||
puts "Print 'animateSpheres 10.0' to restart animation"
|
||||
puts "Print 'animateSpheres 10.0' to restart animation"
|
||||
|
@@ -783,6 +783,7 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
BRepAdaptor_Surface surf1( aFace );
|
||||
Handle( Adaptor3d_HSurface ) surf2;
|
||||
Standard_Boolean isOffset = Standard_False;
|
||||
Offset = 0.0;
|
||||
|
||||
if (surf1.GetType() == GeomAbs_OffsetSurface)
|
||||
{
|
||||
@@ -801,7 +802,6 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
{
|
||||
aPlane = surf2->Plane();
|
||||
aSurfType = AIS_KOS_Plane;
|
||||
Offset = 0.;
|
||||
Result = Standard_True;
|
||||
}
|
||||
|
||||
@@ -817,7 +817,6 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
gp_Pln thePlane( LinePos, LineDir ^ ExtrusionDir);
|
||||
aPlane = thePlane;
|
||||
aSurfType = AIS_KOS_Plane;
|
||||
Offset = 0.;
|
||||
Result = Standard_True;
|
||||
}
|
||||
}
|
||||
@@ -826,7 +825,6 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
{
|
||||
aSurf = (Handle( Geom_OffsetSurface )::DownCast( aSurf ))->Surface();
|
||||
aPlane = (Handle( Geom_Plane )::DownCast( aSurf ))->Pln();
|
||||
Offset = 0.0e0;
|
||||
}
|
||||
if (Result == Standard_False)
|
||||
{
|
||||
@@ -839,7 +837,6 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
TheType == STANDARD_TYPE(Geom_ToroidalSurface))
|
||||
{
|
||||
aSurf = (Handle( Geom_OffsetSurface )::DownCast( aSurf ))->Surface();
|
||||
Offset = 0.0e0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -899,20 +896,18 @@ gp_Pnt AIS::ProjectPointOnLine( const gp_Pnt & aPoint, const gp_Lin & aLine )
|
||||
//function : InitFaceLength
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS::InitFaceLength (const TopoDS_Face& aFace,
|
||||
gp_Pln & aPlane,
|
||||
Handle(Geom_Surface) & aSurface,
|
||||
AIS_KindOfSurface & aSurfaceType,
|
||||
Standard_Real & anOffset)
|
||||
void AIS::InitFaceLength (const TopoDS_Face& theFace,
|
||||
gp_Pln& thePlane,
|
||||
Handle(Geom_Surface)& theSurface,
|
||||
AIS_KindOfSurface& theSurfaceType,
|
||||
Standard_Real& theOffset)
|
||||
{
|
||||
AIS::GetPlaneFromFace( aFace, aPlane, aSurface, aSurfaceType, anOffset );
|
||||
|
||||
if (Abs( anOffset ) > Precision::Confusion())
|
||||
{
|
||||
aSurface = new Geom_OffsetSurface( aSurface, anOffset );
|
||||
anOffset = 0.0e0;
|
||||
}
|
||||
|
||||
if (AIS::GetPlaneFromFace (theFace, thePlane, theSurface, theSurfaceType, theOffset)
|
||||
&& Abs (theOffset) > Precision::Confusion())
|
||||
{
|
||||
theSurface = new Geom_OffsetSurface (theSurface, theOffset);
|
||||
theOffset = 0.0e0;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -335,31 +335,31 @@ TCollection_ExtendedString AIS_Dimension::GetValueString (Standard_Real& theWidt
|
||||
if (myDrawer->DimensionAspect()->IsText3d())
|
||||
{
|
||||
// text width produced by BRepFont
|
||||
Font_BRepFont aFont (aTextAspect->Aspect()->Font().ToCString(),
|
||||
aTextAspect->Aspect()->GetTextFontAspect(),
|
||||
aTextAspect->Height());
|
||||
|
||||
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
|
||||
Font_BRepFont aFont;
|
||||
if (aFont.FindAndInit (aTextAspect->Aspect()->Font(), aTextAspect->Aspect()->GetTextFontAspect(), aTextAspect->Height(), Font_StrictLevel_Any))
|
||||
{
|
||||
Standard_Utf32Char aCurrChar = *anIter;
|
||||
Standard_Utf32Char aNextChar = *(++anIter);
|
||||
theWidth += aFont.AdvanceX (aCurrChar, aNextChar);
|
||||
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
|
||||
{
|
||||
Standard_Utf32Char aCurrChar = *anIter;
|
||||
Standard_Utf32Char aNextChar = *(++anIter);
|
||||
theWidth += aFont.AdvanceX (aCurrChar, aNextChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Text width for 1:1 scale 2D case
|
||||
Handle(Font_FTFont) aFont = new Font_FTFont();
|
||||
aFont->Init (aTextAspect->Aspect()->Font().ToCString(),
|
||||
aTextAspect->Aspect()->GetTextFontAspect(),
|
||||
(const unsigned int)aTextAspect->Height(),
|
||||
THE_2D_TEXT_RESOLUTION);
|
||||
|
||||
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
|
||||
Font_FTFontParams aFontParams;
|
||||
aFontParams.PointSize = (unsigned int )aTextAspect->Height();
|
||||
aFontParams.Resolution = THE_2D_TEXT_RESOLUTION;
|
||||
if (Handle(Font_FTFont) aFont = Font_FTFont::FindAndCreate (aTextAspect->Aspect()->Font(), aTextAspect->Aspect()->GetTextFontAspect(), aFontParams, Font_StrictLevel_Any))
|
||||
{
|
||||
Standard_Utf32Char aCurrChar = *anIter;
|
||||
Standard_Utf32Char aNextChar = *(++anIter);
|
||||
theWidth += (Standard_Real) aFont->AdvanceX (aCurrChar, aNextChar);
|
||||
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
|
||||
{
|
||||
Standard_Utf32Char aCurrChar = *anIter;
|
||||
Standard_Utf32Char aNextChar = *(++anIter);
|
||||
theWidth += (Standard_Real) aFont->AdvanceX (aCurrChar, aNextChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -692,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();
|
||||
}
|
||||
@@ -715,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)
|
||||
@@ -2851,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())
|
||||
{
|
||||
|
@@ -1386,14 +1386,7 @@ protected: //! @name internal methods
|
||||
if (myLastinMain.IsNull())
|
||||
return;
|
||||
|
||||
if (myLastinMain->IsAutoHilight())
|
||||
{
|
||||
myMainPM->ClearImmediateDraw();
|
||||
}
|
||||
else
|
||||
{
|
||||
myLastinMain->Selectable()->ClearDynamicHighlight (myMainPM);
|
||||
}
|
||||
myLastinMain->Selectable()->ClearDynamicHighlight (myMainPM);
|
||||
}
|
||||
|
||||
protected: //! @name internal fields
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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;}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -1024,7 +1005,8 @@ void AIS_Manipulator::Disk::Init (const Standard_ShortReal theInnerRadius,
|
||||
gp_Ax3 aSystem (myPosition.Location(), myPosition.Direction());
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aSystem, gp_Ax3());
|
||||
aTool.FillArray (myArray, myTriangulation, aTrsf);
|
||||
myArray = aTool.CreateTriangulation (aTrsf);
|
||||
myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1043,7 +1025,8 @@ void AIS_Manipulator::Sphere::Init (const Standard_ShortReal theRadius,
|
||||
Prs3d_ToolSphere aTool (theRadius, theSlicesNb, theStacksNb);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTranslation (gp_Vec(gp::Origin(), thePosition));
|
||||
aTool.FillArray (myArray, myTriangulation, aTrsf);
|
||||
myArray = aTool.CreateTriangulation (aTrsf);
|
||||
myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1079,24 +1062,24 @@ void AIS_Manipulator::Cube::Init (const gp_Ax1& thePosition, const Standard_Shor
|
||||
addTriangle (1, aBottomLeft, aV3, aV4, -thePosition.Direction());
|
||||
|
||||
// Front
|
||||
addTriangle (2, aV3, aV4, aV5, aFront);
|
||||
addTriangle (3, aV3, aV5, aTopRight, aFront);
|
||||
addTriangle (2, aV3, aV5, aV4, -aFront);
|
||||
addTriangle (3, aV3, aTopRight, aV5, -aFront);
|
||||
|
||||
// Back
|
||||
addTriangle (4, aBottomLeft, aV2, aV7, -aFront);
|
||||
addTriangle (5, aBottomLeft, aV7, aV6, -aFront);
|
||||
addTriangle (4, aBottomLeft, aV7, aV2, aFront);
|
||||
addTriangle (5, aBottomLeft, aV6, aV7, aFront);
|
||||
|
||||
// aTop
|
||||
addTriangle (6, aV7, aV6, aV5, thePosition.Direction());
|
||||
addTriangle (7, aTopRight, aV7, aV5, thePosition.Direction());
|
||||
|
||||
//Left
|
||||
addTriangle (8, aV6, aV5, aV4, -aRight);
|
||||
addTriangle (9, aBottomLeft, aV6, aV4, -aRight);
|
||||
// Left
|
||||
addTriangle (8, aV6, aV4, aV5, aRight);
|
||||
addTriangle (9, aBottomLeft, aV4, aV6, aRight);
|
||||
|
||||
// Right
|
||||
addTriangle (10, aV3, aTopRight, aV7, aRight);
|
||||
addTriangle (11, aV3, aV7, aV2, aRight);
|
||||
addTriangle (10, aV3, aV7, aTopRight, -aRight);
|
||||
addTriangle (11, aV3, aV2, aV7, -aRight);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1167,6 +1150,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
anArrowLength,
|
||||
myFacettesNumber);
|
||||
myTranslatorGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
myTranslatorGroup->SetClosed (true);
|
||||
myTranslatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
|
||||
myTranslatorGroup->AddPrimitiveArray (myTriangleArray);
|
||||
|
||||
@@ -1188,6 +1172,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), myBoxSize);
|
||||
|
||||
myScalerGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
myScalerGroup->SetClosed (true);
|
||||
myScalerGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
|
||||
myScalerGroup->AddPrimitiveArray (myCube.Array());
|
||||
|
||||
|
@@ -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:
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -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)
|
||||
|
@@ -41,7 +41,6 @@ void AIS_Selection::Clear()
|
||||
{
|
||||
myresult.Clear();
|
||||
myResultMap.Clear();
|
||||
myIterator = AIS_NListOfEntityOwner::Iterator();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -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);
|
||||
|
@@ -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:
|
||||
|
||||
|
@@ -261,14 +261,14 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
|
||||
if (myHasFlipping)
|
||||
{
|
||||
// Get width and height of text
|
||||
Font_FTFont aFont;
|
||||
unsigned int aResolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
|
||||
if (aFont.Init (anAsp->Aspect()->Font().ToCString(),
|
||||
anAsp->Aspect()->GetTextFontAspect(), (unsigned int)anAsp->Height(), aResolution))
|
||||
Font_FTFontParams aFontParams;
|
||||
aFontParams.PointSize = (unsigned int )anAsp->Height();
|
||||
aFontParams.Resolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
|
||||
if (Handle(Font_FTFont) aFont = Font_FTFont::FindAndCreate (anAsp->Aspect()->Font(), anAsp->Aspect()->GetTextFontAspect(), aFontParams))
|
||||
{
|
||||
isInit = Standard_True;
|
||||
const NCollection_String aText (myText.ToExtString());
|
||||
Font_Rect aBndBox = aFont.BoundingBox (aText, anAsp->HorizontalJustification(), anAsp->VerticalJustification());
|
||||
Font_Rect aBndBox = aFont->BoundingBox (aText, anAsp->HorizontalJustification(), anAsp->VerticalJustification());
|
||||
Standard_Real aWidth = Abs (aBndBox.Width());
|
||||
Standard_Real aHeight = Abs (aBndBox.Height());
|
||||
gp_Pnt aCenterOfLabel = aPosition;
|
||||
|
@@ -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 :
|
||||
|
@@ -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)
|
||||
|
@@ -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;
|
||||
|
@@ -458,7 +458,7 @@ GeomAbs_CurveType Adaptor2d_OffsetCurve::GetType() const {
|
||||
return GeomAbs_Circle;
|
||||
|
||||
default:
|
||||
return GeomAbs_OtherCurve;
|
||||
return GeomAbs_OffsetCurve;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -650,3 +650,27 @@ Handle(Geom2d_BSplineCurve) Adaptor2d_OffsetCurve::BSpline() const
|
||||
"Adaptor2d_OffsetCurve::BSpline() - wrong curve type");
|
||||
return myCurve->BSpline();
|
||||
}
|
||||
|
||||
static Standard_Integer nbPoints(const Handle(Adaptor2d_HCurve2d)& theCurve)
|
||||
{
|
||||
|
||||
Standard_Integer nbs = 20;
|
||||
|
||||
if (theCurve->GetType() == GeomAbs_BezierCurve)
|
||||
{
|
||||
nbs = Max(nbs, 3 + theCurve->NbPoles());
|
||||
}
|
||||
else if (theCurve->GetType() == GeomAbs_BSplineCurve) {
|
||||
nbs = Max(nbs, theCurve->NbKnots() * theCurve->Degree());
|
||||
}
|
||||
|
||||
if (nbs > 300)
|
||||
nbs = 300;
|
||||
return nbs;
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Adaptor2d_OffsetCurve::NbSamples() const
|
||||
{
|
||||
return nbPoints(myCurve);
|
||||
}
|
||||
|
@@ -174,6 +174,8 @@ public:
|
||||
|
||||
Standard_EXPORT Handle(Geom2d_BSplineCurve) BSpline() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Integer NbSamples() const Standard_OVERRIDE;;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -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& ,
|
||||
|
@@ -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
|
||||
|
@@ -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,
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -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;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -68,11 +68,5 @@ Warning: Removal of internal boundaries among Faces has failed
|
||||
.BOPAlgo_AlertRemovalOfIBForEdgesFailed
|
||||
Warning: Removal of internal boundaries among Edges has failed
|
||||
|
||||
.BOPAlgo_AlertIntersectionOfPairOfShapesFailed
|
||||
Warning: Intersection of pair of shapes has failed
|
||||
|
||||
.BOPAlgo_AlertBuildingPCurveFailed
|
||||
Warning: Building 2D curve of edge on face has failed
|
||||
|
||||
.BOPAlgo_AlertAcquiredSelfIntersection
|
||||
Warning: Some sub-shapes of some of the argument become connected through other shapes and the argument became self-interfered
|
||||
.BOPAlgo_AlertSolidBuilderUnusedFaces
|
||||
Warning: Some of the faces passed to the Solid Builder algorithm have not been classified and not used for solids creation
|
||||
|
@@ -78,14 +78,7 @@ DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertShellSplitterFailed)
|
||||
//! Some edges are too small and have no valid range
|
||||
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertTooSmallEdge)
|
||||
|
||||
//! Intersection of pair of shapes has failed
|
||||
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertIntersectionOfPairOfShapesFailed)
|
||||
|
||||
//! Building 2D curve of edge on face has failed
|
||||
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertBuildingPCurveFailed)
|
||||
|
||||
//! Some sub-shapes of some of the argument become connected through
|
||||
//! other shapes and the argument became self-interfered
|
||||
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertAcquiredSelfIntersection)
|
||||
|
||||
//! Some of the faces passed to the Solid Builder algorithm have not been classified
|
||||
//! and not used for solids creation
|
||||
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertSolidBuilderUnusedFaces)
|
||||
#endif // _BOPAlgo_Alerts_HeaderFile
|
||||
|
@@ -71,11 +71,5 @@ static const char BOPAlgo_BOPAlgo_msg[] =
|
||||
".BOPAlgo_AlertRemovalOfIBForEdgesFailed\n"
|
||||
"Warning: Removal of internal boundaries among Edges has failed\n"
|
||||
"\n"
|
||||
".BOPAlgo_AlertIntersectionOfPairOfShapesFailed\n"
|
||||
"Warning: Intersection of pair of shapes has failed\n"
|
||||
"\n"
|
||||
".BOPAlgo_AlertBuildingPCurveFailed\n"
|
||||
"Warning: Building 2D curve of edge on face has failed\n"
|
||||
"\n"
|
||||
".BOPAlgo_AlertAcquiredSelfIntersection\n"
|
||||
"Warning: Some sub-shapes of some of the argument become connected through other shapes and the argument became self-interfered\n";
|
||||
".BOPAlgo_AlertSolidBuilderUnusedFaces\n"
|
||||
"Warning: Some of the faces passed to the Solid Builder algorithm have not been classified and not used for solids creation\n";
|
||||
|
@@ -593,7 +593,7 @@ void BOPAlgo_BuilderFace::PerformAreas()
|
||||
// 5.2. Add unused holes to the original face
|
||||
if (aNbHoles != aNbInOutMap) {
|
||||
Bnd_Box aBoxF;
|
||||
BRepBndLib::AddOptimal(myFace, aBoxF, Standard_True, Standard_True);
|
||||
BRepBndLib::Add(myFace, aBoxF);
|
||||
if (aBoxF.IsOpenXmin() || aBoxF.IsOpenXmax() ||
|
||||
aBoxF.IsOpenYmin() || aBoxF.IsOpenYmax() ||
|
||||
aBoxF.IsOpenZmin() || aBoxF.IsOpenZmax()) {
|
||||
@@ -810,6 +810,7 @@ Standard_Boolean IsInside(const TopoDS_Shape& theHole,
|
||||
Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Real aT, aU, aV;
|
||||
|
||||
TopAbs_State aState;
|
||||
TopExp_Explorer aExp;
|
||||
@@ -823,19 +824,20 @@ Standard_Boolean IsInside(const TopoDS_Shape& theHole,
|
||||
BOPTools::MapShapes(aF2, TopAbs_EDGE, aME2);//AA
|
||||
//
|
||||
aExp.Init(theHole, TopAbs_EDGE);
|
||||
if (aExp.More())
|
||||
{
|
||||
const TopoDS_Edge& aE = (*(TopoDS_Edge *) (&aExp.Current()));
|
||||
if (aME2.Contains(aE))
|
||||
{
|
||||
if (aExp.More()) {
|
||||
const TopoDS_Edge& aE =(*(TopoDS_Edge *)(&aExp.Current()));
|
||||
if (aME2.Contains(aE)) {
|
||||
return bRet;
|
||||
}
|
||||
if (!BRep_Tool::Degenerated(aE))
|
||||
{
|
||||
if (!BRep_Tool::Degenerated(aE)) {
|
||||
//
|
||||
gp_Pnt aP3D;
|
||||
BOPTools_AlgoTools::PointOnEdge(aE, BOPTools_AlgoTools2D::IntermediatePoint(aE), aP3D);
|
||||
bRet = theContext->IsPointInFace(aP3D, aF2, BRep_Tool::Tolerance(aE));
|
||||
aT=BOPTools_AlgoTools2D::IntermediatePoint(aE);
|
||||
BOPTools_AlgoTools2D::PointOnSurface(aE, aF2, aT, aU, aV, theContext);
|
||||
aP2D.SetCoord(aU, aV);
|
||||
//
|
||||
IntTools_FClass2d& aClsf=theContext->FClass2d(aF2);
|
||||
aState=aClsf.Perform(aP2D);
|
||||
bRet=(aState==TopAbs_IN);
|
||||
}
|
||||
}
|
||||
//
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <BOPAlgo_BuilderSolid.hxx>
|
||||
#include <BOPAlgo_ShellSplitter.hxx>
|
||||
#include <BOPAlgo_Alerts.hxx>
|
||||
#include <BOPAlgo_Tools.hxx>
|
||||
#include <BOPCol_BoxBndTree.hxx>
|
||||
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
|
||||
#include <BOPCol_DataMapOfShapeShape.hxx>
|
||||
@@ -127,127 +128,7 @@ typedef NCollection_DataMap
|
||||
//
|
||||
typedef BOPAlgo_DataMapOfIntegerBSSB::Iterator
|
||||
BOPAlgo_DataMapIteratorOfDataMapOfIntegerBSSB;
|
||||
//
|
||||
//=======================================================================
|
||||
//function : BOPAlgo_FacePnt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_FacePnt {
|
||||
public:
|
||||
BOPAlgo_FacePnt() {
|
||||
}
|
||||
//
|
||||
virtual ~BOPAlgo_FacePnt() {
|
||||
}
|
||||
//
|
||||
void SetFace(const TopoDS_Face& aFace) {
|
||||
myFace=aFace;
|
||||
}
|
||||
//
|
||||
const TopoDS_Face& Face()const {
|
||||
return myFace;
|
||||
}
|
||||
//
|
||||
void SetPnt(const gp_Pnt& aPnt) {
|
||||
myPnt=aPnt;
|
||||
}
|
||||
//
|
||||
const gp_Pnt& Pnt()const {
|
||||
return myPnt;
|
||||
}
|
||||
//
|
||||
protected:
|
||||
gp_Pnt myPnt;
|
||||
TopoDS_Face myFace;
|
||||
};
|
||||
//
|
||||
typedef BOPCol_NCVector
|
||||
<BOPAlgo_FacePnt> BOPAlgo_VectorOfFacePnt;
|
||||
//
|
||||
//=======================================================================
|
||||
//function : BOPAlgo_FaceSolid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_FaceSolid : public BOPAlgo_Algo {
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
BOPAlgo_FaceSolid() :
|
||||
myIsInternalFace(Standard_False) {
|
||||
}
|
||||
//
|
||||
virtual ~BOPAlgo_FaceSolid() {
|
||||
}
|
||||
//
|
||||
void SetFace(const TopoDS_Face& aFace) {
|
||||
myFace=aFace;
|
||||
}
|
||||
//
|
||||
const TopoDS_Face& Face()const {
|
||||
return myFace;
|
||||
}
|
||||
//
|
||||
void SetSolid(const TopoDS_Solid& aSolid) {
|
||||
mySolid=aSolid;
|
||||
}
|
||||
//
|
||||
const TopoDS_Solid& Solid()const {
|
||||
return mySolid;
|
||||
}
|
||||
//
|
||||
void SetPnt(const gp_Pnt& aPnt) {
|
||||
myPnt=aPnt;
|
||||
}
|
||||
//
|
||||
const gp_Pnt& Pnt()const {
|
||||
return myPnt;
|
||||
}
|
||||
void SetContext(const Handle(IntTools_Context)& aContext) {
|
||||
myContext=aContext;
|
||||
}
|
||||
//
|
||||
const Handle(IntTools_Context)& Context()const {
|
||||
return myContext;
|
||||
}
|
||||
//
|
||||
Standard_Boolean IsInternalFace() const {
|
||||
return myIsInternalFace;
|
||||
}
|
||||
//
|
||||
virtual void Perform () {
|
||||
TopAbs_State aState;
|
||||
//
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
//
|
||||
aState=BOPTools_AlgoTools::ComputeState(myPnt, mySolid,
|
||||
Precision::Confusion(),
|
||||
myContext);
|
||||
//
|
||||
myIsInternalFace=(aState==TopAbs_IN);
|
||||
}
|
||||
//
|
||||
protected:
|
||||
Standard_Boolean myIsInternalFace;
|
||||
gp_Pnt myPnt;
|
||||
TopoDS_Face myFace;
|
||||
TopoDS_Solid mySolid;
|
||||
Handle(IntTools_Context) myContext;
|
||||
};
|
||||
//=======================================================================
|
||||
typedef BOPCol_NCVector
|
||||
<BOPAlgo_FaceSolid> BOPAlgo_VectorOfFaceSolid;
|
||||
//
|
||||
typedef BOPCol_ContextFunctor
|
||||
<BOPAlgo_FaceSolid,
|
||||
BOPAlgo_VectorOfFaceSolid,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_FaceSolidFunctor;
|
||||
//
|
||||
typedef BOPCol_ContextCnt
|
||||
<BOPAlgo_FaceSolidFunctor,
|
||||
BOPAlgo_VectorOfFaceSolid,
|
||||
Handle(IntTools_Context)> BOPAlgo_FaceSolidCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
|
||||
//=======================================================================
|
||||
@@ -600,7 +481,7 @@ void BOPAlgo_BuilderSolid::PerformAreas()
|
||||
const TopoDS_Shape& aShell = aItLS.Value();
|
||||
aSB.SetShape(aShell);
|
||||
//
|
||||
BRepBndLib::AddOptimal(aShell, aBox, Standard_True, Standard_True);
|
||||
BRepBndLib::Add(aShell, aBox);
|
||||
bIsHole=Standard_False;
|
||||
//
|
||||
bIsGrowth=IsGrowthShell(aShell, aMHF);
|
||||
@@ -766,49 +647,29 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes()
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bIsInternalFace;
|
||||
Standard_Integer k, aNbVFS, aNbSLF, aNbVFP, aNbA;
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Iterator aIt;
|
||||
TopExp_Explorer aExp;
|
||||
BOPCol_ListIteratorOfListOfShape aItLS;
|
||||
BOPCol_IndexedMapOfShape aMFs;
|
||||
BOPCol_ListOfShape aLSI;
|
||||
BOPAlgo_VectorOfFaceSolid aVFS;
|
||||
BOPAlgo_VectorOfFacePnt aVFP;
|
||||
BOPCol_ListIteratorOfListOfInteger aItLI;
|
||||
BOPCol_BoxBndTreeSelector aSelector;
|
||||
BOPCol_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller
|
||||
<Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
//
|
||||
aNbA=myAreas.Extent();
|
||||
Standard_Integer aNbA = myAreas.Extent();
|
||||
//
|
||||
// 1. aVFP
|
||||
// Fill Tree with boxes
|
||||
aItLS.Initialize(myLoopsInternal);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aShell=aItLS.Value();
|
||||
aIt.Initialize(aShell);
|
||||
TopoDS_Iterator aIt(aShell);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Face& aF=*((TopoDS_Face*)&aIt.Value());
|
||||
//
|
||||
if (!aMFs.Contains(aF)) {
|
||||
if (!aMFs.Contains(aF))
|
||||
{
|
||||
aMFs.Add(aF);
|
||||
//
|
||||
gp_Pnt aP;
|
||||
gp_Pnt2d aP2D;
|
||||
//
|
||||
if (aNbA) {
|
||||
BOPTools_AlgoTools3D::PointInFace(aF, aP, aP2D, myContext);
|
||||
}
|
||||
//
|
||||
BOPAlgo_FacePnt& aFP=aVFP.Append1();
|
||||
aFP.SetFace(aF);
|
||||
aFP.SetPnt(aP);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
if (!aNbA) {
|
||||
// 7b. "Rest" faces treatment
|
||||
TopoDS_Solid aSolid;
|
||||
@@ -826,146 +687,81 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes()
|
||||
return; // =>
|
||||
}//if (!aNbA) {
|
||||
//
|
||||
// 2. Prepare TreeFiller
|
||||
aNbVFP=aVFP.Extent();
|
||||
for(k=0; k<aNbVFP; ++k) {
|
||||
Bnd_Box aBox;
|
||||
//
|
||||
const BOPAlgo_FacePnt& aFP=aVFP(k);
|
||||
const TopoDS_Face& aF=aFP.Face();
|
||||
//
|
||||
BRepBndLib::AddOptimal(aF, aBox, Standard_True, Standard_True);
|
||||
aTreeFiller.Add(k, aBox);
|
||||
}
|
||||
//
|
||||
aTreeFiller.Fill();
|
||||
//
|
||||
// 3. Face/Solid candidates: aVFS
|
||||
aItLS.Initialize(myAreas);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
Bnd_Box aBox;
|
||||
//
|
||||
TopoDS_Solid& aSolid=(*(TopoDS_Solid*)(&aItLS.Value()));
|
||||
BRepBndLib::Add(aSolid, aBox);
|
||||
//
|
||||
aMFs.Clear();
|
||||
aExp.Init(aSolid, TopAbs_FACE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Shape& aFs=aExp.Current();
|
||||
aMFs.Add(aFs);
|
||||
}
|
||||
//
|
||||
aSelector.Clear();
|
||||
aSelector.SetBox(aBox);
|
||||
//
|
||||
aBBTree.Select(aSelector);
|
||||
//
|
||||
const BOPCol_ListOfInteger& aLI=aSelector.Indices();
|
||||
aItLI.Initialize(aLI);
|
||||
for (; aItLI.More(); aItLI.Next()) {
|
||||
k=aItLI.Value();
|
||||
const BOPAlgo_FacePnt& aFP=aVFP(k);
|
||||
const TopoDS_Face& aF=aFP.Face();
|
||||
if (aMFs.Contains(aF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const gp_Pnt& aP=aFP.Pnt();
|
||||
//
|
||||
BOPAlgo_FaceSolid& aFS=aVFS.Append1();
|
||||
aFS.SetPnt(aP);
|
||||
aFS.SetFace(aF);
|
||||
aFS.SetSolid(aSolid);
|
||||
}
|
||||
}
|
||||
//
|
||||
aNbVFS=aVFS.Extent();
|
||||
if (!aNbVFS) {
|
||||
return;
|
||||
}
|
||||
// 4. Refine candidates
|
||||
//=============================================================
|
||||
BOPAlgo_FaceSolidCnt::Perform(myRunParallel, aVFS, myContext);
|
||||
//=============================================================
|
||||
//
|
||||
// 5. Solid/Faces: aMSLF
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aMSLF;
|
||||
BOPCol_MapOfShape aMFProcessed;
|
||||
//
|
||||
for (k=0; k < aNbVFS; ++k) {
|
||||
const BOPAlgo_FaceSolid& aFS=aVFS(k);
|
||||
//
|
||||
const TopoDS_Solid& aSolid=aFS.Solid();
|
||||
const TopoDS_Face& aF=aFS.Face();
|
||||
//
|
||||
bIsInternalFace=aFS.IsInternalFace();
|
||||
if (!bIsInternalFace) {
|
||||
|
||||
// Prepare list of faces to classify
|
||||
TopTools_ListOfShape aLFaces;
|
||||
Standard_Integer i, aNbF = aMFs.Extent();
|
||||
for (i = 1; i <= aNbF; ++i)
|
||||
aLFaces.Append(aMFs(i));
|
||||
|
||||
// Map of solids with IN faces
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMSLF;
|
||||
|
||||
// Perform classification
|
||||
BOPAlgo_Tools::ClassifyFaces(aLFaces, myAreas, myRunParallel, myContext, aMSLF);
|
||||
|
||||
// Update Solids by internal Faces
|
||||
|
||||
BOPCol_MapOfShape aMFDone;
|
||||
|
||||
Standard_Integer aNbS = aMSLF.Extent();
|
||||
for (i = 1; i <= aNbS; ++i)
|
||||
{
|
||||
const TopoDS_Shape& aSolid = aMSLF.FindKey(i);
|
||||
TopoDS_Shape *pSolid = (TopoDS_Shape*)&aSolid;
|
||||
|
||||
const TopTools_ListOfShape& aLF = aMSLF(i);
|
||||
if (aLF.IsEmpty())
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (aMSLF.Contains(aSolid)) {
|
||||
BOPCol_ListOfShape& aLF=aMSLF.ChangeFromKey(aSolid);
|
||||
aLF.Append(aF);
|
||||
}
|
||||
else {
|
||||
BOPCol_ListOfShape aLF;
|
||||
//
|
||||
aLF.Append(aF);
|
||||
aMSLF.Add(aSolid, aLF);
|
||||
}
|
||||
}// for (k=0; k < aNbVE; ++k) {
|
||||
//
|
||||
// 6. Update Solids by internal Faces
|
||||
aNbSLF=aMSLF.Extent();
|
||||
for (k=1; k <= aNbSLF; ++k) {
|
||||
const TopoDS_Shape& aSolid=aMSLF.FindKey(k);
|
||||
TopoDS_Shape *pSolid=(TopoDS_Shape*)&aSolid;
|
||||
//
|
||||
const BOPCol_ListOfShape& aLF=aMSLF(k);
|
||||
//
|
||||
aMFs.Clear();
|
||||
|
||||
TopTools_IndexedMapOfShape aMF;
|
||||
aItLS.Initialize(aLF);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aF=aItLS.Value();
|
||||
aMFs.Add(aF);
|
||||
aMFProcessed.Add(aF);
|
||||
for (; aItLS.More(); aItLS.Next())
|
||||
{
|
||||
const TopoDS_Shape& aF = aItLS.Value();
|
||||
aMF.Add(aF);
|
||||
aMFDone.Add(aF);
|
||||
}
|
||||
//
|
||||
aLSI.Clear();
|
||||
MakeInternalShells(aMFs, aLSI);
|
||||
MakeInternalShells(aMF, aLSI);
|
||||
//
|
||||
aItLS.Initialize(aLSI);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aSI=aItLS.Value();
|
||||
for (; aItLS.More(); aItLS.Next())
|
||||
{
|
||||
const TopoDS_Shape& aSI = aItLS.Value();
|
||||
aBB.Add (*pSolid, aSI);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 7. "Rest" faces treatment (if there are)
|
||||
aMFs.Clear();
|
||||
for (k=0; k < aNbVFS; ++k) {
|
||||
const BOPAlgo_FaceSolid& aFS=aVFS(k);
|
||||
//
|
||||
const TopoDS_Face& aF=aFS.Face();
|
||||
if (!aMFProcessed.Contains(aF)) {
|
||||
aMFs.Add(aF);
|
||||
}
|
||||
|
||||
// Find all unclassified faces and warn the user about them.
|
||||
TopTools_IndexedMapOfShape aMFUnUsed;
|
||||
|
||||
for (i = 1; i <= aNbF; ++i)
|
||||
{
|
||||
const TopoDS_Shape& aF = aMFs(i);
|
||||
if (!aMFDone.Contains(aF))
|
||||
aMFUnUsed.Add(aF);
|
||||
}
|
||||
//
|
||||
aNbFI=aMFs.Extent();
|
||||
if (aNbFI) {
|
||||
TopoDS_Solid aSolid;
|
||||
aBB.MakeSolid(aSolid);
|
||||
//
|
||||
|
||||
if (aMFUnUsed.Extent())
|
||||
{
|
||||
aLSI.Clear();
|
||||
MakeInternalShells(aMFs, aLSI);
|
||||
//
|
||||
aItLS.Initialize(aLSI);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
|
||||
//TopoDS_Solid aShape;
|
||||
//aBB.MakeSolid (aShape);
|
||||
TopoDS_Compound aShape;
|
||||
aBB.MakeCompound (aShape);
|
||||
|
||||
aItLS.Initialize (aLSI);
|
||||
for (; aItLS.More(); aItLS.Next())
|
||||
{
|
||||
const TopoDS_Shape& aSI=aItLS.Value();
|
||||
aBB.Add (aSolid, aSI);
|
||||
aBB.Add (aShape, aSI);
|
||||
}
|
||||
myAreas.Append(aSolid);
|
||||
//myAreas.Append (aShape);
|
||||
AddWarning (new BOPAlgo_AlertSolidBuilderUnusedFaces (aShape));
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
|
@@ -19,6 +19,7 @@
|
||||
//
|
||||
#include <Precision.hxx>
|
||||
//
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
//
|
||||
#include <Bnd_Box.hxx>
|
||||
@@ -43,9 +44,13 @@
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
//
|
||||
#include <BOPAlgo_Tools.hxx>
|
||||
//
|
||||
#include <BOPCol_IndexedMapOfShape.hxx>
|
||||
#include <BOPCol_MapOfShape.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeShape.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPCol_BoxBndTree.hxx>
|
||||
#include <BOPCol_ListOfInteger.hxx>
|
||||
@@ -131,367 +136,6 @@ class BOPAlgo_ShapeBox {
|
||||
typedef BOPCol_NCVector<BOPAlgo_ShapeBox> BOPAlgo_VectorOfShapeBox;
|
||||
//
|
||||
//=======================================================================
|
||||
// class: BOPAlgo_FillIn3DParts
|
||||
//
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_FillIn3DParts
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_FillIn3DParts : public BOPAlgo_Algo {
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
BOPAlgo_FillIn3DParts(){
|
||||
myHasImage=Standard_False;
|
||||
myBBTree=NULL;
|
||||
myVSB=NULL;
|
||||
};
|
||||
//
|
||||
virtual ~BOPAlgo_FillIn3DParts(){
|
||||
};
|
||||
//
|
||||
void SetSolid(const TopoDS_Solid& aS) {
|
||||
mySolid=aS;
|
||||
};
|
||||
//
|
||||
const TopoDS_Solid& Solid()const {
|
||||
return mySolid;
|
||||
};
|
||||
//
|
||||
void SetDraftSolid(const TopoDS_Solid& aS) {
|
||||
myDraftSolid=aS;
|
||||
};
|
||||
//
|
||||
const TopoDS_Solid& DraftSolid()const {
|
||||
return myDraftSolid;
|
||||
};
|
||||
//
|
||||
void SetHasImage(const Standard_Boolean bFlag) {
|
||||
myHasImage=bFlag;
|
||||
};
|
||||
//
|
||||
Standard_Boolean HasImage()const {
|
||||
return myHasImage;
|
||||
};
|
||||
//
|
||||
void SetBoxS(const Bnd_Box& aBox) {
|
||||
myBoxS=aBox;
|
||||
};
|
||||
//
|
||||
const Bnd_Box& BoxS()const {
|
||||
return myBoxS;
|
||||
};
|
||||
//
|
||||
void SetLIF(const BOPCol_ListOfShape& aLIF) {
|
||||
myLIF=aLIF;
|
||||
};
|
||||
//
|
||||
const BOPCol_ListOfShape& LIF()const {
|
||||
return myLIF;
|
||||
};
|
||||
//
|
||||
void SetBBTree(const BOPCol_BoxBndTree& aBBTree) {
|
||||
myBBTree=(BOPCol_BoxBndTree*)&aBBTree;
|
||||
};
|
||||
//
|
||||
void SetVSB(const BOPAlgo_VectorOfShapeBox& aVSB) {
|
||||
myVSB=(BOPAlgo_VectorOfShapeBox*)&aVSB;
|
||||
};
|
||||
//
|
||||
//
|
||||
void SetContext(const Handle(IntTools_Context)& aContext) {
|
||||
myContext=aContext;
|
||||
}
|
||||
//
|
||||
const Handle(IntTools_Context)& Context()const {
|
||||
return myContext;
|
||||
}
|
||||
//
|
||||
virtual void Perform();
|
||||
//
|
||||
|
||||
//
|
||||
const BOPCol_ListOfShape& LFIN()const {
|
||||
return myLFIN;
|
||||
};
|
||||
|
||||
protected:
|
||||
void MapEdgesAndFaces
|
||||
(const TopoDS_Shape& ,
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape& ,
|
||||
const Handle(NCollection_BaseAllocator)& );
|
||||
|
||||
void MakeConnexityBlock
|
||||
(const BOPCol_ListOfShape& ,
|
||||
const BOPCol_IndexedMapOfShape& ,
|
||||
const BOPCol_MapOfShape& ,
|
||||
const BOPCol_IndexedDataMapOfShapeListOfShape& ,
|
||||
BOPCol_ListOfShape& ,
|
||||
const Handle(NCollection_BaseAllocator)& );
|
||||
//
|
||||
protected:
|
||||
TopoDS_Solid mySolid;
|
||||
TopoDS_Solid myDraftSolid;
|
||||
Standard_Boolean myHasImage;
|
||||
Bnd_Box myBoxS;
|
||||
BOPCol_ListOfShape myLIF;
|
||||
BOPCol_ListOfShape myLFIN;
|
||||
//
|
||||
BOPCol_BoxBndTree* myBBTree;
|
||||
BOPAlgo_VectorOfShapeBox* myVSB;
|
||||
//
|
||||
TopoDS_Iterator myItF;
|
||||
TopoDS_Iterator myItW;
|
||||
|
||||
Handle(IntTools_Context) myContext;
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : BOPAlgo_FillIn3DParts::Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_FillIn3DParts::Perform()
|
||||
{
|
||||
Handle(NCollection_BaseAllocator) aAlr1;
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
//
|
||||
Standard_Integer aNbFP, k, nFP, iIsIN;
|
||||
Standard_Real aTolPC;
|
||||
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);
|
||||
BOPCol_IndexedMapOfShape aMF(100, aAlr1);
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aMEFP(100, aAlr1);
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aMEF(100, aAlr1);
|
||||
//
|
||||
aTolPC=Precision::Confusion();
|
||||
myLFIN.Clear();
|
||||
BOPAlgo_VectorOfShapeBox& aVSB=*myVSB;
|
||||
//
|
||||
// 1. aMEF - EF map for myDraftSolid
|
||||
BOPTools::MapShapesAndAncestors(myDraftSolid,
|
||||
TopAbs_EDGE,
|
||||
TopAbs_FACE,
|
||||
aMEF);
|
||||
|
||||
//
|
||||
// 2. Faces from myDraftSolid and its own internal faces => aMF
|
||||
BOPTools::MapShapes(myDraftSolid, TopAbs_FACE, aMF);
|
||||
aItLS.Initialize(myLIF);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aFI=aItLS.Value();
|
||||
aMF.Add(aFI);
|
||||
}
|
||||
// aME - Edges from DraftSolid [i.e. edges to stop]
|
||||
BOPTools::MapShapes(myDraftSolid, TopAbs_EDGE, aME);
|
||||
//
|
||||
// 3. Select boxes of faces that are not out of aBoxS
|
||||
aSelector.Clear();
|
||||
aSelector.SetBox(myBoxS);
|
||||
//
|
||||
aNbFP=myBBTree->Select(aSelector);
|
||||
const BOPCol_ListOfInteger& aLIFPx=aSelector.Indices();
|
||||
//
|
||||
// 4. aIVec, aLIFP - faces to process
|
||||
BOPCol_ListOfInteger aLIFP(aAlr1);
|
||||
BOPCol_NCVector<Standard_Integer> aIVec(256, aAlr1);
|
||||
//
|
||||
k=0;
|
||||
aItLI.Initialize(aLIFPx);
|
||||
for (; aItLI.More(); aItLI.Next()) {
|
||||
nFP=aItLI.Value();
|
||||
const TopoDS_Shape& aFP=aVSB(nFP).Shape();
|
||||
if (!aMF.Contains(aFP)) {
|
||||
MapEdgesAndFaces(aFP, aMEFP, aAlr1);
|
||||
aLIFP.Append(nFP);
|
||||
aIVec.Append1()=nFP;
|
||||
++k;
|
||||
}
|
||||
}
|
||||
aNbFP=k;
|
||||
//
|
||||
// sort indices
|
||||
std::sort(aIVec.begin(), aIVec.end());
|
||||
//
|
||||
// 5. Collect faces that are IN mySolid [ myLFIN ]
|
||||
for (k=0; k<aNbFP; ++k) {
|
||||
nFP = aIVec(k);
|
||||
const BOPAlgo_ShapeBox& aSBF=aVSB(nFP);
|
||||
const TopoDS_Face& aFP=(*(TopoDS_Face*)&aSBF.Shape());
|
||||
//
|
||||
if (!aMFDone.Add(aFP)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
iIsIN=BOPTools_AlgoTools::IsInternalFace
|
||||
(aFP, myDraftSolid, aMEF, aTolPC, myContext);
|
||||
//
|
||||
aLFP.Clear();
|
||||
aLFP.Append(aFP);
|
||||
//
|
||||
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) {
|
||||
}
|
||||
//=======================================================================
|
||||
// function: MapEdgesAndFaces
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_FillIn3DParts::MapEdgesAndFaces
|
||||
(const TopoDS_Shape& aF,
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape& aMEF,
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
{
|
||||
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 (aMEF.Contains(aE)) {
|
||||
BOPCol_ListOfShape& aLF=aMEF.ChangeFromKey(aE);
|
||||
aLF.Append(aF);
|
||||
}
|
||||
else {
|
||||
BOPCol_ListOfShape aLS(theAllocator);
|
||||
//
|
||||
aLS.Append(aF);
|
||||
aMEF.Add(aE, aLS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// function: MakeConnexityBlock
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_FillIn3DParts::MakeConnexityBlock
|
||||
(const BOPCol_ListOfShape& theLFIn,
|
||||
const BOPCol_IndexedMapOfShape& theMEAvoid,
|
||||
const BOPCol_MapOfShape& aMFDone,
|
||||
const BOPCol_IndexedDataMapOfShapeListOfShape& aMEF,
|
||||
BOPCol_ListOfShape& theLCB,
|
||||
const Handle(NCollection_BaseAllocator)& theAlr)
|
||||
{
|
||||
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;
|
||||
}
|
||||
//
|
||||
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);
|
||||
}
|
||||
}
|
||||
//
|
||||
typedef BOPCol_NCVector<BOPAlgo_FillIn3DParts> \
|
||||
BOPAlgo_VectorOfFillIn3DParts;
|
||||
//
|
||||
typedef BOPCol_ContextFunctor
|
||||
<BOPAlgo_FillIn3DParts,
|
||||
BOPAlgo_VectorOfFillIn3DParts,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPCol_FillIn3DPartsFunctor;
|
||||
//
|
||||
typedef BOPCol_ContextCnt
|
||||
<BOPCol_FillIn3DPartsFunctor,
|
||||
BOPAlgo_VectorOfFillIn3DParts,
|
||||
Handle(IntTools_Context)> BOPAlgo_FillIn3DPartsCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
// class: BOPAlgo_Builder
|
||||
//
|
||||
//=======================================================================
|
||||
@@ -540,156 +184,123 @@ void BOPAlgo_Builder::FillIn3DParts
|
||||
BOPCol_DataMapOfShapeShape& theDraftSolids,
|
||||
const BOPCol_BaseAllocator& )
|
||||
{
|
||||
Standard_Boolean bHasImage;
|
||||
Standard_Integer i, k, aNbS, aNbLIF, aNbFIN, aNbVSB, aNbVFIP;
|
||||
Handle(NCollection_BaseAllocator) aAlr0;
|
||||
TopoDS_Solid aSD;
|
||||
TopoDS_Iterator aIt;
|
||||
BRep_Builder aBB;
|
||||
//
|
||||
BOPCol_ListIteratorOfListOfInteger aItLI, aItLI1;
|
||||
BOPCol_ListIteratorOfListOfShape aItLS;
|
||||
//
|
||||
aAlr0=
|
||||
NCollection_BaseAllocator::CommonBaseAllocator();
|
||||
//
|
||||
BOPCol_MapOfShape aMFence(100, aAlr0);
|
||||
BOPAlgo_VectorOfShapeBox aVSB(256, aAlr0);
|
||||
//
|
||||
theDraftSolids.Clear();
|
||||
//
|
||||
// 1. aVSB vector Index/FaceBox
|
||||
aNbS=myDS->NbSourceShapes();
|
||||
for (i=0; i<aNbS; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
if (aSI.ShapeType()!=TopAbs_FACE) {
|
||||
Handle(NCollection_BaseAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
|
||||
// Find all faces that are IN solids
|
||||
|
||||
// Store boxes of the shapes into a map
|
||||
BOPCol_IndexedDataMapOfShapeBox aShapeBoxMap(1, anAlloc);
|
||||
|
||||
// Fence map
|
||||
BOPCol_MapOfShape aMFence(1, anAlloc);
|
||||
|
||||
// Get all faces
|
||||
TopTools_ListOfShape aLFaces(anAlloc);
|
||||
|
||||
Standard_Integer i, aNbS = myDS->NbSourceShapes();
|
||||
for (i = 0; i < aNbS; ++i)
|
||||
{
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
|
||||
if (aSI.ShapeType() != TopAbs_FACE)
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aS=aSI.Shape();
|
||||
//
|
||||
if (myImages.IsBound(aS)) {
|
||||
const BOPCol_ListOfShape& aLS=myImages.Find(aS);
|
||||
aItLS.Initialize(aLS);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aSx=aItLS.Value();
|
||||
if (!aMFence.Add(aSx)) {
|
||||
continue;
|
||||
}
|
||||
Bnd_Box aBox;
|
||||
BRepBndLib::AddOptimal(aSx, aBox, Standard_True, Standard_True);
|
||||
aBox.SetGap(aBox.GetGap() + Precision::Confusion());
|
||||
//
|
||||
BOPAlgo_ShapeBox& aSB=aVSB.Append1();
|
||||
aSB.SetShape(aSx);
|
||||
aSB.SetBox(aBox);
|
||||
|
||||
const TopoDS_Shape& aS = aSI.Shape();
|
||||
const TopTools_ListOfShape* pLSIm = myImages.Seek(aS);
|
||||
|
||||
if (pLSIm)
|
||||
{
|
||||
TopTools_ListIteratorOfListOfShape aItLSIm(*pLSIm);
|
||||
for (; aItLSIm.More(); aItLSIm.Next())
|
||||
{
|
||||
const TopoDS_Shape& aSIm = aItLSIm.Value();
|
||||
if (aMFence.Add(aSIm))
|
||||
aLFaces.Append(aSIm);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const Bnd_Box& aBox=aSI.Box();
|
||||
//
|
||||
BOPAlgo_ShapeBox& aSB=aVSB.Append1();
|
||||
aSB.SetShape(aS);
|
||||
aSB.SetBox(aBox);
|
||||
else
|
||||
{
|
||||
aLFaces.Append(aS);
|
||||
aShapeBoxMap.Add(aS, aSI.Box());
|
||||
}
|
||||
}//for (i=0; i<aNbS; ++i) {
|
||||
aMFence.Clear();
|
||||
//
|
||||
// 1.2. Prepare TreeFiller
|
||||
BOPCol_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box>
|
||||
aTreeFiller(aBBTree);
|
||||
//
|
||||
aNbVSB=aVSB.Extent();
|
||||
for (k=0; k<aNbVSB; ++k) {
|
||||
const BOPAlgo_ShapeBox& aSBk=aVSB(k);
|
||||
const Bnd_Box& aBk=aSBk.Box();
|
||||
//
|
||||
aTreeFiller.Add(k, aBk);
|
||||
}
|
||||
//
|
||||
// 1.3. Shake TreeFiller
|
||||
aTreeFiller.Fill();
|
||||
//
|
||||
//---------------------------------------------
|
||||
// 2. Solids
|
||||
BOPAlgo_VectorOfFillIn3DParts aVFIP;
|
||||
//
|
||||
for (i=0; i<aNbS; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
if (aSI.ShapeType()!=TopAbs_SOLID) {
|
||||
|
||||
BRep_Builder aBB;
|
||||
|
||||
// Get all solids
|
||||
TopTools_ListOfShape aLSolids(anAlloc);
|
||||
// Keep INTERNAL faces of the solids
|
||||
BOPCol_DataMapOfShapeListOfShape aSolidsIF(1, anAlloc);
|
||||
// Draft solids
|
||||
BOPCol_IndexedDataMapOfShapeShape aDraftSolid(1, anAlloc);
|
||||
|
||||
for (i = 0; i < aNbS; ++i)
|
||||
{
|
||||
BOPDS_ShapeInfo& aSI = myDS->ChangeShapeInfo(i);
|
||||
if (aSI.ShapeType() != TopAbs_SOLID)
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aS=aSI.Shape();
|
||||
const TopoDS_Solid& aSolid=(*(TopoDS_Solid*)(&aS));
|
||||
//
|
||||
// 2.0 Flag bHasImage
|
||||
bHasImage=Standard_False;
|
||||
aIt.Initialize(aS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aShell=aIt.Value();
|
||||
bHasImage=myImages.IsBound(aShell);
|
||||
if (bHasImage){
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
// 2.1 Bounding box for the solid aS [ aBoxS ]
|
||||
Bnd_Box aBoxS;
|
||||
aBoxS=aSI.Box();
|
||||
//
|
||||
// 2.2 Build Draft Solid [aSD]
|
||||
BOPCol_ListOfShape aLIF;
|
||||
|
||||
const TopoDS_Shape& aS = aSI.Shape();
|
||||
const TopoDS_Solid& aSolid = (*(TopoDS_Solid*)(&aS));
|
||||
//
|
||||
// Bounding box for the solid aS
|
||||
const Bnd_Box& aBoxS = aSI.Box();
|
||||
|
||||
// Build Draft Solid
|
||||
TopTools_ListOfShape aLIF;
|
||||
TopoDS_Solid aSD;
|
||||
aBB.MakeSolid(aSD);
|
||||
BuildDraftSolid(aSolid, aSD, aLIF);
|
||||
//
|
||||
BOPAlgo_FillIn3DParts& aFIP=aVFIP.Append1();
|
||||
//
|
||||
aFIP.SetSolid(aSolid);
|
||||
aFIP.SetDraftSolid(aSD);
|
||||
aFIP.SetHasImage(bHasImage);
|
||||
aFIP.SetBoxS(aBoxS);
|
||||
aFIP.SetLIF(aLIF);
|
||||
aFIP.SetBBTree(aBBTree);
|
||||
aFIP.SetVSB(aVSB);
|
||||
}//for (i=0; i<aNbS; ++i) {
|
||||
//
|
||||
aNbVFIP=aVFIP.Extent();
|
||||
//================================================================
|
||||
BOPAlgo_FillIn3DPartsCnt::Perform(myRunParallel, aVFIP, myContext);
|
||||
//================================================================
|
||||
for (k=0; k<aNbVFIP; ++k) {
|
||||
BOPAlgo_FillIn3DParts& aFIP=aVFIP(k);
|
||||
bHasImage=aFIP.HasImage();
|
||||
const TopoDS_Solid& aSolid=aFIP.Solid();
|
||||
const TopoDS_Solid& aSDraft =aFIP.DraftSolid();
|
||||
const BOPCol_ListOfShape& aLFIN=aFIP.LFIN();
|
||||
const BOPCol_ListOfShape& aLIF=aFIP.LIF();
|
||||
//
|
||||
aNbLIF=aLIF.Extent();
|
||||
//
|
||||
// Store the results in theInParts, theDraftSolids
|
||||
BOPCol_ListOfShape aLFINx;
|
||||
//
|
||||
aNbFIN=aLFIN.Extent();
|
||||
if (aNbFIN || aNbLIF) {
|
||||
aItLS.Initialize(aLFIN);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aFI=aItLS.Value();
|
||||
aLFINx.Append(aFI);
|
||||
}
|
||||
aItLS.Initialize(aLIF);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aFI=aItLS.Value();
|
||||
aLFINx.Append(aFI);
|
||||
}
|
||||
theInParts.Bind(aSolid, aLFINx);
|
||||
|
||||
aLSolids.Append(aSD);
|
||||
aSolidsIF.Bind(aSD, aLIF);
|
||||
aShapeBoxMap.Add(aSD, aBoxS);
|
||||
aDraftSolid.Add(aS, aSD);
|
||||
}
|
||||
|
||||
// Perform classification of the faces
|
||||
TopTools_IndexedDataMapOfShapeListOfShape anInParts;
|
||||
|
||||
BOPAlgo_Tools::ClassifyFaces(aLFaces, aLSolids, myRunParallel,
|
||||
myContext, anInParts, &aShapeBoxMap, &aSolidsIF);
|
||||
|
||||
// Analyze the results of classification
|
||||
Standard_Integer aNbSol = aDraftSolid.Extent();
|
||||
for (i = 1; i <= aNbSol; ++i)
|
||||
{
|
||||
const TopoDS_Solid& aSolid = TopoDS::Solid(aDraftSolid.FindKey(i));
|
||||
const TopoDS_Solid& aSDraft = TopoDS::Solid(aDraftSolid(i));
|
||||
const TopTools_ListOfShape& aLInFaces = anInParts.FindFromKey(aSDraft);
|
||||
const TopTools_ListOfShape& aLInternal = aSolidsIF.Find(aSDraft);
|
||||
|
||||
Standard_Integer aNbIN = aLInFaces.Extent();
|
||||
|
||||
if (!aNbIN)
|
||||
{
|
||||
Standard_Boolean bHasImage = Standard_False;
|
||||
// Check if the shells of the solid have image
|
||||
for (TopoDS_Iterator it(aSolid); it.More() && !bHasImage; it.Next())
|
||||
bHasImage = myImages.IsBound(it.Value());
|
||||
|
||||
if (!bHasImage)
|
||||
// no need to split the solid
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (aNbFIN || bHasImage) {
|
||||
theDraftSolids.Bind(aSolid, aSDraft);
|
||||
|
||||
theDraftSolids.Bind(aSolid, aSDraft);
|
||||
|
||||
Standard_Integer aNbInt = aLInternal.Extent();
|
||||
if (aNbInt || aNbIN)
|
||||
{
|
||||
// Combine the lists
|
||||
TopTools_ListOfShape *pLIN = theInParts.Bound(aSolid, TopTools_ListOfShape());
|
||||
|
||||
TopTools_ListIteratorOfListOfShape aItLS(aLInFaces);
|
||||
for (; aItLS.More(); aItLS.Next())
|
||||
pLIN->Append(aItLS.Value());
|
||||
|
||||
aItLS.Initialize(aLInternal);
|
||||
for (; aItLS.More(); aItLS.Next())
|
||||
pLIN->Append(aItLS.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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 :
|
||||
|
@@ -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
|
||||
|
@@ -54,7 +54,8 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
|
||||
BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
|
||||
(const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
:
|
||||
BOPAlgo_Algo(theAllocator)
|
||||
BOPAlgo_Algo(theAllocator),
|
||||
myFPBDone(1, theAllocator)
|
||||
{
|
||||
myDS = NULL;
|
||||
myIterator = NULL;
|
||||
@@ -286,6 +287,13 @@ void BOPAlgo_PaveFiller::PerformInternal()
|
||||
UpdatePaveBlocksWithSDVertices();
|
||||
UpdateInterfsWithSDVertices();
|
||||
//
|
||||
// Force intersection of edges after increase
|
||||
// of the tolerance values of their vertices
|
||||
//ForceInterfEE();
|
||||
// Force Edge/Face intersection after increase
|
||||
// of the tolerance values of their vertices
|
||||
ForceInterfEF();
|
||||
//
|
||||
// 22
|
||||
PerformFF();
|
||||
if (HasErrors()) {
|
||||
|
@@ -87,19 +87,13 @@ class TopoDS_Face;
|
||||
//! - *Gluing options* - allows to speed up the calculation on the special
|
||||
//! cases, in which some sub-shapes are coincide.<br>
|
||||
//!
|
||||
//! The algorithm returns the following Warning statuses:
|
||||
//! - *BOPAlgo_AlertSelfInterferingShape* - in case some of the argument shapes are self-interfering shapes;
|
||||
//! - *BOPAlgo_AlertTooSmallEdge* - in case some edges of the input shapes have no valid range;
|
||||
//! The algorithm returns the following Warning statuses:<br>
|
||||
//! - *BOPAlgo_AlertSelfInterferingShape* - in case some of the argument shapes are self-interfering shapes;<br>
|
||||
//! - *BOPAlgo_AlertTooSmallEdge* - in case some edges of the input shapes have no valid range;<br>
|
||||
//! - *BOPAlgo_AlertNotSplittableEdge* - in case some edges of the input shapes has such a small
|
||||
//! valid range so it cannot be split;
|
||||
//! valid range so it cannot be split;<br>
|
||||
//! - *BOPAlgo_AlertBadPositioning* - in case the positioning of the input shapes leads to creation
|
||||
//! of small edges;
|
||||
//! - *BOPAlgo_AlertIntersectionOfPairOfShapesFailed* - in case intersection of some of the
|
||||
//! sub-shapes has failed;
|
||||
//! - *BOPAlgo_AlertAcquiredSelfIntersection* - in case some sub-shapes of the argument become connected
|
||||
//! through other shapes;
|
||||
//! - *BOPAlgo_AlertBuildingPCurveFailed* - in case building 2D curve for some of the edges
|
||||
//! on the faces has failed.
|
||||
//! of small edges.<br>
|
||||
//!
|
||||
//! The algorithm returns the following Error alerts:
|
||||
//! - *BOPAlgo_AlertTooFewArguments* - in case there are no enough arguments to
|
||||
@@ -173,6 +167,9 @@ protected:
|
||||
Bnd_Box,
|
||||
TColStd_MapTransientHasher> BOPAlgo_DataMapOfPaveBlockBndBox;
|
||||
|
||||
typedef NCollection_DataMap
|
||||
<Standard_Integer,
|
||||
BOPDS_MapOfPaveBlock> BOPAlgo_DataMapOfIntegerMapOfPaveBlock;
|
||||
|
||||
//! Sets non-destructive mode automatically if an argument
|
||||
//! contains a locked sub-shape (see TopoDS_Shape::Locked()).
|
||||
@@ -296,7 +293,6 @@ protected:
|
||||
BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDMExEdges,
|
||||
BOPCol_DataMapOfIntegerInteger& theDMNewSD,
|
||||
const BOPCol_IndexedMapOfShape& theMicroEdges,
|
||||
const BOPCol_IndexedMapOfShape& theVertsOnRejectedPB,
|
||||
const BOPCol_BaseAllocator& theAllocator);
|
||||
|
||||
Standard_EXPORT void FindPaveBlocks (const Standard_Integer theV, const Standard_Integer theF, BOPDS_ListOfPaveBlock& theLPB);
|
||||
@@ -481,8 +477,19 @@ protected:
|
||||
//! In case self-interference is found the warning is added.
|
||||
Standard_EXPORT void CheckSelfInterference();
|
||||
|
||||
//! Adds the warning about failed intersection of pair of sub-shapes
|
||||
Standard_EXPORT void AddIntersectionFailedWarning(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2);
|
||||
//! The method looks for the additional common blocks among pairs of edges
|
||||
//! with the same bounding vertices.
|
||||
Standard_EXPORT void ForceInterfEE();
|
||||
|
||||
//! The method looks for the additional edge/face common blocks
|
||||
//! among pairs of edge/face having the same vertices.
|
||||
Standard_EXPORT void ForceInterfEF();
|
||||
|
||||
//! Performs intersection of given pave blocks
|
||||
//! with all faces from arguments.
|
||||
Standard_EXPORT void ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB,
|
||||
const Standard_Boolean theAddInterf);
|
||||
|
||||
|
||||
BOPCol_ListOfShape myArguments;
|
||||
BOPDS_PDS myDS;
|
||||
@@ -494,6 +501,8 @@ protected:
|
||||
Standard_Boolean myAvoidBuildPCurve;
|
||||
BOPAlgo_GlueEnum myGlue;
|
||||
|
||||
BOPAlgo_DataMapOfIntegerMapOfPaveBlock myFPBDone; //!< Fence map of intersected faces and pave blocks
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -97,7 +97,7 @@ void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
|
||||
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
|
||||
aBB.UpdateEdge(aE, aTol);
|
||||
Bnd_Box& aBoxE=aSIE.ChangeBox();
|
||||
BRepBndLib::AddOptimal(aE, aBoxE, Standard_True, Standard_True);
|
||||
BRepBndLib::Add(aE, aBoxE);
|
||||
aBoxE.SetGap(aBoxE.GetGap() + Precision::Confusion());
|
||||
//
|
||||
aIt.Initialize(aLI);
|
||||
@@ -113,7 +113,7 @@ void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
|
||||
aBB.UpdateVertex(aV, aTol);
|
||||
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nV);
|
||||
Bnd_Box& aBoxV = aSIV.ChangeBox();
|
||||
BRepBndLib::AddOptimal(aV, aBoxV, Standard_True, Standard_True);
|
||||
BRepBndLib::Add(aV, aBoxV);
|
||||
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
|
||||
aBB.UpdateVertex(aVSD, aTolNew);
|
||||
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVNew);
|
||||
Bnd_Box& aBoxV = aSIV.ChangeBox();
|
||||
BRepBndLib::AddOptimal(aVSD, aBoxV, Standard_True, Standard_True);
|
||||
BRepBndLib::Add(aVSD, aBoxV);
|
||||
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
|
||||
}
|
||||
return nVNew;
|
||||
@@ -165,7 +165,7 @@ Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
|
||||
// bounding box for the new vertex
|
||||
BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nVNew);
|
||||
Bnd_Box& aBoxDS = aSIDS.ChangeBox();
|
||||
BRepBndLib::AddOptimal(aVNew, aBoxDS, Standard_True, Standard_True);
|
||||
BRepBndLib::Add(aVNew, aBoxDS);
|
||||
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
|
||||
//
|
||||
// add vertex to SD map
|
||||
|
@@ -112,8 +112,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
|
||||
}
|
||||
//
|
||||
if (aLE.Extent() > 1) {
|
||||
// Add the acquired self-interference warning:
|
||||
// The same common block contains several edges from one argument
|
||||
// Add warning
|
||||
TopoDS_Compound aWC;
|
||||
aBB.MakeCompound(aWC);
|
||||
//
|
||||
@@ -123,7 +122,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
|
||||
aBB.Add(aWC, aE1);
|
||||
}
|
||||
//
|
||||
AddWarning (new BOPAlgo_AlertAcquiredSelfIntersection (aWC));
|
||||
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,8 +168,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
|
||||
for (j = 1; j <= aNbC; ++j) {
|
||||
const BOPCol_IndexedMapOfShape& aMCS = aMCSI(j);
|
||||
if (aMCS.Extent() > 1) {
|
||||
// Add acquired self-interference warning:
|
||||
// Several faces from one argument contain the same vertex or edge
|
||||
// Add self-interference warning
|
||||
TopoDS_Compound aWC;
|
||||
aBB.MakeCompound(aWC);
|
||||
//
|
||||
@@ -179,7 +177,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
|
||||
const TopoDS_Shape& aSx = aMCS(iS);
|
||||
aBB.Add(aWC, aSx);
|
||||
}
|
||||
AddWarning (new BOPAlgo_AlertAcquiredSelfIntersection (aWC));
|
||||
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_Alerts.hxx>
|
||||
#include <BOPAlgo_Tools.hxx>
|
||||
#include <BOPCol_NCVector.hxx>
|
||||
#include <BOPCol_Parallel.hxx>
|
||||
@@ -28,7 +27,6 @@
|
||||
#include <BOPDS_PaveBlock.hxx>
|
||||
#include <BOPDS_VectorOfInterfVE.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
@@ -112,16 +110,7 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew, myFuzzyValue);
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew, myFuzzyValue);
|
||||
};
|
||||
//
|
||||
protected:
|
||||
@@ -278,11 +267,6 @@ void BOPAlgo_PaveFiller::IntersectVE
|
||||
for (i = 0; i < aNbVE; ++i) {
|
||||
const BOPAlgo_VertexEdge& aVESolver = aVVE(i);
|
||||
if (aVESolver.Flag() != 0) {
|
||||
if (aVESolver.HasErrors())
|
||||
{
|
||||
// Warn about failed intersection of sub-shapes
|
||||
AddIntersectionFailedWarning(aVESolver.Vertex(), aVESolver.Edge());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
//
|
||||
@@ -507,19 +491,3 @@ void BOPAlgo_PaveFiller::SplitPaveBlocks(const BOPCol_MapOfInteger& theMEdges,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: AddIntersectionFailedWarning
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::AddIntersectionFailedWarning(const TopoDS_Shape& theS1,
|
||||
const TopoDS_Shape& theS2)
|
||||
{
|
||||
// Create the warn shape
|
||||
TopoDS_Compound aWC;
|
||||
BRep_Builder().MakeCompound(aWC);
|
||||
BRep_Builder().Add(aWC, theS1);
|
||||
BRep_Builder().Add(aWC, theS2);
|
||||
// Add the warning
|
||||
AddWarning(new BOPAlgo_AlertIntersectionOfPairOfShapesFailed(aWC));
|
||||
}
|
@@ -93,16 +93,7 @@ class BOPAlgo_EdgeEdge :
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
IntTools_EdgeEdge::Perform();
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
IntTools_EdgeEdge::Perform();
|
||||
}
|
||||
//
|
||||
protected:
|
||||
@@ -238,11 +229,7 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
Bnd_Box aBB1, aBB2;
|
||||
//
|
||||
BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge(k);
|
||||
if (!anEdgeEdge.IsDone() || anEdgeEdge.HasErrors()) {
|
||||
// Warn about failed intersection of sub-shapes
|
||||
const TopoDS_Shape& aE1 = myDS->Shape(anEdgeEdge.PaveBlock1()->OriginalEdge());
|
||||
const TopoDS_Shape& aE2 = myDS->Shape(anEdgeEdge.PaveBlock2()->OriginalEdge());
|
||||
AddIntersectionFailedWarning(aE1, aE2);
|
||||
if (!anEdgeEdge.IsDone()) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
@@ -781,3 +768,278 @@ Standard_Boolean BOPAlgo_PaveFiller::GetPBBox(const TopoDS_Edge& theE,
|
||||
}
|
||||
return bValid;
|
||||
}
|
||||
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : ForceInterfEE
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::ForceInterfEE()
|
||||
{
|
||||
// Now that we have vertices increased and unified, try to find additional
|
||||
// common blocks among the pairs of edges.
|
||||
// Since all real intersections should have already happened, here we
|
||||
// are interested in common blocks only, thus we need to check only
|
||||
// those pairs of pave blocks with the same bounding vertices.
|
||||
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
|
||||
// Initialize pave blocks for all vertices which participated in intersections
|
||||
const Standard_Integer aNbS = myDS->NbSourceShapes();
|
||||
for (Standard_Integer i = 0; i < aNbS; ++i)
|
||||
{
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
|
||||
if (aSI.ShapeType() == TopAbs_VERTEX)
|
||||
{
|
||||
if (myDS->HasInterf(i))
|
||||
myDS->InitPaveBlocksForVertex(i);
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the connection map from bounding vertices to pave blocks
|
||||
// having those bounding vertices
|
||||
NCollection_IndexedDataMap<BOPDS_Pair,
|
||||
BOPDS_ListOfPaveBlock,
|
||||
BOPDS_PairMapHasher> aPBMap(1, anAlloc);
|
||||
// Fence map of pave blocks
|
||||
BOPDS_MapOfPaveBlock aMPBFence(1, anAlloc);
|
||||
|
||||
for (Standard_Integer i = 0; i < aNbS; ++i)
|
||||
{
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
|
||||
if (aSI.ShapeType() != TopAbs_EDGE)
|
||||
// Not an edge
|
||||
continue;
|
||||
|
||||
if (!aSI.HasReference())
|
||||
// Edge has no pave blocks
|
||||
continue;
|
||||
|
||||
if (aSI.HasFlag())
|
||||
// Degenerated edge
|
||||
continue;
|
||||
|
||||
const BOPDS_ListOfPaveBlock& aLPB = myDS->PaveBlocks(i);
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB);
|
||||
for (; aItLPB.More(); aItLPB.Next())
|
||||
{
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
|
||||
const Handle(BOPDS_PaveBlock)& aPBR = myDS->RealPaveBlock(aPB);
|
||||
if (!aMPBFence.Add(aPBR))
|
||||
continue;
|
||||
|
||||
// Get indices
|
||||
Standard_Integer nV1, nV2;
|
||||
aPBR->Indices(nV1, nV2);
|
||||
|
||||
// Add pave block to a map
|
||||
BOPDS_Pair aPair(nV1, nV2);
|
||||
BOPDS_ListOfPaveBlock *pList = aPBMap.ChangeSeek(aPair);
|
||||
if (!pList)
|
||||
pList = &aPBMap(aPBMap.Add(aPair, BOPDS_ListOfPaveBlock(anAlloc)));
|
||||
pList->Append(aPBR);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer aNbPB = aPBMap.Extent();
|
||||
if (!aNbPB)
|
||||
return;
|
||||
|
||||
const Standard_Boolean bSICheckMode = (myArguments.Extent() == 1);
|
||||
|
||||
// Prepare pave blocks with the same vertices for intersection.
|
||||
BOPAlgo_VectorOfEdgeEdge aVEdgeEdge;
|
||||
|
||||
for (Standard_Integer i = 1; i <= aNbPB; ++i)
|
||||
{
|
||||
const BOPDS_ListOfPaveBlock& aLPB = aPBMap(i);
|
||||
if (aLPB.Extent() < 2)
|
||||
continue;
|
||||
|
||||
const BOPDS_Pair& aPair = aPBMap.FindKey(i);
|
||||
Standard_Integer nV1, nV2;
|
||||
aPair.Indices(nV1, nV2);
|
||||
|
||||
const TopoDS_Vertex& aV1 = TopoDS::Vertex(myDS->Shape(nV1));
|
||||
const TopoDS_Vertex& aV2 = TopoDS::Vertex(myDS->Shape(nV2));
|
||||
|
||||
// Use the max tolerance of vertices as Fuzzy value for intersection of edges.
|
||||
// In the Self-Interference check mode we are interested in real
|
||||
// intersections only, so use only the real tolerance of edges,
|
||||
// no need to use the extended tolerance.
|
||||
Standard_Real aTolAdd = (bSICheckMode ? myFuzzyValue :
|
||||
2 * Max(BRep_Tool::Tolerance(aV1), BRep_Tool::Tolerance(aV2)));
|
||||
|
||||
// All possible pairs combined from the list <aLPB> should be checked
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB1(aLPB);
|
||||
for (; aItLPB1.More(); aItLPB1.Next())
|
||||
{
|
||||
const Handle(BOPDS_PaveBlock)& aPB1 = aItLPB1.Value();
|
||||
const Handle(BOPDS_CommonBlock)& aCB1 = myDS->CommonBlock(aPB1);
|
||||
const Standard_Integer nE1 = aPB1->OriginalEdge();
|
||||
const Standard_Integer iR1 = myDS->Rank(nE1);
|
||||
const TopoDS_Edge& aE1 = TopoDS::Edge(myDS->Shape(nE1));
|
||||
Standard_Real aT11, aT12;
|
||||
aPB1->Range(aT11, aT12);
|
||||
BRepAdaptor_Curve aBAC1(aE1);
|
||||
gp_Pnt aPm;
|
||||
gp_Vec aVTgt1;
|
||||
aBAC1.D1((aT11 + aT12) * 0.5, aPm, aVTgt1);
|
||||
if (aVTgt1.SquareMagnitude() < gp::Resolution())
|
||||
continue;
|
||||
aVTgt1.Normalize();
|
||||
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB2 = aItLPB1;
|
||||
for (aItLPB2.Next(); aItLPB2.More(); aItLPB2.Next())
|
||||
{
|
||||
const Handle(BOPDS_PaveBlock)& aPB2 = aItLPB2.Value();
|
||||
const Handle(BOPDS_CommonBlock)& aCB2 = myDS->CommonBlock(aPB2);
|
||||
const Standard_Integer nE2 = aPB2->OriginalEdge();
|
||||
const Standard_Integer iR2 = myDS->Rank(nE2);
|
||||
|
||||
// Check that the edges came from different arguments
|
||||
if (iR1 == iR2)
|
||||
{
|
||||
// If the sharing of the vertices is not original, but has been acquired
|
||||
// during the operation, check the coincidence of the edges even if
|
||||
// they came from the same argument
|
||||
if ((!myDS->IsNewShape(nV1) && (myDS->Rank(nV1) == iR1)) ||
|
||||
(!myDS->IsNewShape(nV2) && (myDS->Rank(nV2) == iR2)))
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check that the Pave blocks do not form the Common block already
|
||||
if (!aCB1.IsNull() && !aCB2.IsNull())
|
||||
{
|
||||
if (aCB1 == aCB2)
|
||||
continue;
|
||||
}
|
||||
|
||||
const TopoDS_Edge& aE2 = TopoDS::Edge(myDS->Shape(nE2));
|
||||
Standard_Real aT21, aT22;
|
||||
aPB2->Range(aT21, aT22);
|
||||
|
||||
// Check the angle between edges in the middle point.
|
||||
// If the angle is more than 10 degrees, do not use the additional
|
||||
// tolerance, as it may lead to undesired unification of edges
|
||||
Standard_Boolean bUseAddTol = Standard_True;
|
||||
{
|
||||
BRepAdaptor_Curve aBAC2(aE2);
|
||||
if (aBAC1.GetType() != GeomAbs_Line ||
|
||||
aBAC2.GetType() != GeomAbs_Line)
|
||||
{
|
||||
GeomAPI_ProjectPointOnCurve& aProjPC = myContext->ProjPC(aE2);
|
||||
aProjPC.Perform(aPm);
|
||||
if (!aProjPC.NbPoints())
|
||||
continue;
|
||||
|
||||
gp_Pnt aPm2;
|
||||
gp_Vec aVTgt2;
|
||||
aBAC2.D1(aProjPC.LowerDistanceParameter(), aPm2, aVTgt2);
|
||||
if (aVTgt2.SquareMagnitude() < gp::Resolution())
|
||||
continue;
|
||||
|
||||
// The angle should be close to zero
|
||||
Standard_Real aCos = aVTgt1.Dot (aVTgt2.Normalized());
|
||||
if (Abs(aCos) < 0.9848)
|
||||
bUseAddTol = Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
// Add pair for intersection
|
||||
BOPAlgo_EdgeEdge& anEdgeEdge = aVEdgeEdge.Append1();
|
||||
anEdgeEdge.UseQuickCoincidenceCheck(Standard_True);
|
||||
anEdgeEdge.SetPaveBlock1(aPB1);
|
||||
anEdgeEdge.SetPaveBlock2(aPB2);
|
||||
anEdgeEdge.SetEdge1(aE1, aT11, aT12);
|
||||
anEdgeEdge.SetEdge2(aE2, aT21, aT22);
|
||||
//anEdgeEdge.SetBoxes (myDS->ShapeInfo(nE1).Box(), myDS->ShapeInfo (nE2).Box());
|
||||
if (bUseAddTol)
|
||||
anEdgeEdge.SetFuzzyValue(myFuzzyValue + aTolAdd);
|
||||
else
|
||||
anEdgeEdge.SetFuzzyValue(myFuzzyValue);
|
||||
anEdgeEdge.SetProgressIndicator(myProgressIndicator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer aNbPairs = aVEdgeEdge.Length();
|
||||
if (!aNbPairs)
|
||||
return;
|
||||
|
||||
aPBMap.Clear();
|
||||
aMPBFence.Clear();
|
||||
anAlloc->Reset();
|
||||
|
||||
// Perform intersection of the found pairs
|
||||
BOPAlgo_EdgeEdgeCnt::Perform (myRunParallel, aVEdgeEdge);
|
||||
|
||||
BOPDS_VectorOfInterfEE& aEEs = myDS->InterfEE();
|
||||
if (aEEs.IsEmpty())
|
||||
aEEs.SetIncrement(10);
|
||||
|
||||
// Analyze the results of intersection looking for TopAbs_EDGE
|
||||
// intersection type only.
|
||||
|
||||
BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock aMPBLPB(1, anAlloc);
|
||||
|
||||
for (Standard_Integer i = 0; i < aNbPairs; ++i)
|
||||
{
|
||||
BOPAlgo_EdgeEdge& anEdgeEdge = aVEdgeEdge(i);
|
||||
if (!anEdgeEdge.IsDone() || anEdgeEdge.HasErrors())
|
||||
{
|
||||
// Warn about failed intersection of sub-shapes
|
||||
//const TopoDS_Shape& aE1 = myDS->Shape(anEdgeEdge.PaveBlock1()->OriginalEdge());
|
||||
//const TopoDS_Shape& aE2 = myDS->Shape(anEdgeEdge.PaveBlock2()->OriginalEdge());
|
||||
//AddIntersectionFailedWarning(aE1, aE2);
|
||||
continue;
|
||||
}
|
||||
|
||||
const IntTools_SequenceOfCommonPrts& aCParts = anEdgeEdge.CommonParts();
|
||||
if (aCParts.Length() != 1)
|
||||
continue;
|
||||
|
||||
const IntTools_CommonPrt& aCP = aCParts(1);
|
||||
if (aCP.Type() != TopAbs_EDGE)
|
||||
continue;
|
||||
|
||||
Handle(BOPDS_PaveBlock) aPB[] = {anEdgeEdge.PaveBlock1(), anEdgeEdge.PaveBlock2()};
|
||||
const Standard_Integer nE1 = aPB[0]->OriginalEdge();
|
||||
const Standard_Integer nE2 = aPB[1]->OriginalEdge();
|
||||
|
||||
if (myDS->Rank(nE1) == myDS->Rank(nE2))
|
||||
{
|
||||
// Add acquired self-interference warning
|
||||
//TopoDS_Compound aWC;
|
||||
//BRep_Builder().MakeCompound(aWC);
|
||||
//BRep_Builder().Add(aWC, myDS->Shape(nE1));
|
||||
//BRep_Builder().Add(aWC, myDS->Shape(nE2));
|
||||
//AddWarning(new BOPAlgo_AlertAcquiredSelfIntersection(aWC));
|
||||
}
|
||||
|
||||
BOPDS_InterfEE& aEE = aEEs.Append1();
|
||||
aEE.SetIndices(nE1, nE2);
|
||||
aEE.SetCommonPart(aCP);
|
||||
myDS->AddInterf(nE1, nE2);
|
||||
|
||||
// Fill map for common blocks creation
|
||||
for (Standard_Integer j = 0; j < 2; ++j)
|
||||
{
|
||||
if (myDS->IsCommonBlock(aPB[j]))
|
||||
{
|
||||
const BOPDS_ListOfPaveBlock& aLPBCB = myDS->CommonBlock(aPB[j])->PaveBlocks();
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPBCB);
|
||||
for (; aItLPB.More(); aItLPB.Next())
|
||||
BOPAlgo_Tools::FillMap<Handle(BOPDS_PaveBlock),
|
||||
TColStd_MapTransientHasher>(aPB[j], aItLPB.Value(), aMPBLPB, anAlloc);
|
||||
}
|
||||
}
|
||||
BOPAlgo_Tools::FillMap<Handle(BOPDS_PaveBlock),
|
||||
TColStd_MapTransientHasher>(aPB[0], aPB[1], aMPBLPB, anAlloc);
|
||||
}
|
||||
|
||||
// Create new common blocks of coinciding pairs.
|
||||
BOPAlgo_Tools::PerformCommonBlocks(aMPBLPB, anAlloc, myDS);
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_Alerts.hxx>
|
||||
#include <BOPAlgo_SectionAttribute.hxx>
|
||||
#include <BOPCol_MapOfInteger.hxx>
|
||||
#include <BOPCol_NCVector.hxx>
|
||||
@@ -108,16 +107,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew, myFuzzyValue);
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew, myFuzzyValue);
|
||||
}
|
||||
//
|
||||
protected:
|
||||
@@ -222,12 +212,7 @@ void BOPAlgo_PaveFiller::PerformVF()
|
||||
const BOPAlgo_VertexFace& aVertexFace=aVVF(k);
|
||||
//
|
||||
iFlag=aVertexFace.Flag();
|
||||
if (iFlag != 0) {
|
||||
if (aVertexFace.HasErrors())
|
||||
{
|
||||
// Warn about failed intersection of sub-shapes
|
||||
AddIntersectionFailedWarning(aVertexFace.Vertex(), aVertexFace.Face());
|
||||
}
|
||||
if (iFlag) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_Alerts.hxx>
|
||||
#include <BOPAlgo_Tools.hxx>
|
||||
#include <BOPCol_BoxBndTree.hxx>
|
||||
#include <BOPCol_MapOfInteger.hxx>
|
||||
#include <BOPCol_NCVector.hxx>
|
||||
#include <BOPCol_Parallel.hxx>
|
||||
@@ -33,9 +34,11 @@
|
||||
#include <BOPDS_Pave.hxx>
|
||||
#include <BOPDS_PaveBlock.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools2D.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <IntTools_CommonPrt.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
@@ -43,12 +46,15 @@
|
||||
#include <IntTools_Range.hxx>
|
||||
#include <IntTools_SequenceOfCommonPrts.hxx>
|
||||
#include <IntTools_Tools.hxx>
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_EdgeFace
|
||||
//purpose :
|
||||
@@ -103,16 +109,7 @@ class BOPAlgo_EdgeFace :
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
IntTools_EdgeFace::Perform();
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
IntTools_EdgeFace::Perform();
|
||||
}
|
||||
//
|
||||
protected:
|
||||
@@ -256,7 +253,12 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
BOPTools_AlgoTools::CorrectRange(aE, aF, aSR, aPBRange);
|
||||
aEdgeFace.SetRange (aPBRange);
|
||||
aEdgeFace.SetProgressIndicator(myProgressIndicator);
|
||||
//
|
||||
|
||||
// Save the pair to avoid their forced intersection
|
||||
BOPDS_MapOfPaveBlock* pMPB = myFPBDone.ChangeSeek(nF);
|
||||
if (!pMPB)
|
||||
pMPB = myFPBDone.Bound(nF, BOPDS_MapOfPaveBlock());
|
||||
pMPB->Add(aPB);
|
||||
}//for (; aIt.More(); aIt.Next()) {
|
||||
}//for (; myIterator->More(); myIterator->Next()) {
|
||||
//
|
||||
@@ -267,9 +269,7 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
//
|
||||
for (k=0; k < aNbEdgeFace; ++k) {
|
||||
BOPAlgo_EdgeFace& aEdgeFace=aVEdgeFace(k);
|
||||
if (!aEdgeFace.IsDone() || aEdgeFace.HasErrors()) {
|
||||
// Warn about failed intersection of sub-shapes
|
||||
AddIntersectionFailedWarning(aEdgeFace.Edge(), aEdgeFace.Face());
|
||||
if (!aEdgeFace.IsDone()) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
@@ -667,3 +667,351 @@ void BOPAlgo_PaveFiller::ReduceIntersectionRange(const Standard_Integer theV1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ForceInterfEF
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::ForceInterfEF()
|
||||
{
|
||||
if (!myIsPrimary)
|
||||
return;
|
||||
|
||||
// Now that we have vertices increased and unified, try to find additional
|
||||
// edge/face common blocks among the pairs of edge/face.
|
||||
// Here, we are interested in common blocks only, as all real intersections
|
||||
// should have happened already. Thus, we need to check only those pairs
|
||||
// of edge/face which have the same vertices.
|
||||
|
||||
// Collect all pave blocks
|
||||
BOPDS_IndexedMapOfPaveBlock aMPB;
|
||||
const Standard_Integer aNbS = myDS->NbSourceShapes();
|
||||
for (Standard_Integer nE = 0; nE < aNbS; ++nE)
|
||||
{
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(nE);
|
||||
if (aSI.ShapeType() != TopAbs_EDGE)
|
||||
// Not an edge
|
||||
continue;
|
||||
|
||||
if (!aSI.HasReference())
|
||||
// Edge has no pave blocks
|
||||
continue;
|
||||
|
||||
if (aSI.HasFlag())
|
||||
// Degenerated edge
|
||||
continue;
|
||||
|
||||
const BOPDS_ListOfPaveBlock& aLPB = myDS->PaveBlocks(nE);
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB);
|
||||
for (; aItLPB.More(); aItLPB.Next())
|
||||
{
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
|
||||
const Handle(BOPDS_PaveBlock)& aPBR = myDS->RealPaveBlock(aPB);
|
||||
aMPB.Add(aPBR);
|
||||
}
|
||||
}
|
||||
|
||||
// Perform intersection of collected pave blocks with faces
|
||||
ForceInterfEF(aMPB, Standard_True);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ForceInterfEF
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB,
|
||||
const Standard_Boolean theAddInterf)
|
||||
{
|
||||
if (theMPB.IsEmpty())
|
||||
return;
|
||||
|
||||
// Fill the tree with bounding boxes of the pave blocks
|
||||
NCollection_UBTree<Standard_Integer, Bnd_Box> aBBTree;
|
||||
NCollection_UBTreeFiller<Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
BOPDS_IndexedMapOfPaveBlock aPBMap(1, anAlloc);
|
||||
|
||||
Standard_Integer aNbPB = theMPB.Extent();
|
||||
for (Standard_Integer iPB = 1; iPB <= aNbPB; ++iPB)
|
||||
{
|
||||
Handle(BOPDS_PaveBlock) aPB = theMPB(iPB);
|
||||
if (!aPB->HasShrunkData() || !myDS->IsValidShrunkData(aPB))
|
||||
{
|
||||
FillShrunkData(aPB);
|
||||
if (!aPB->HasShrunkData())
|
||||
continue;
|
||||
}
|
||||
|
||||
Standard_Real f, l;
|
||||
Bnd_Box aPBBox;
|
||||
Standard_Boolean isSplit;
|
||||
aPB->ShrunkData(f, l, aPBBox, isSplit);
|
||||
|
||||
aTreeFiller.Add(aPBMap.Add(aPB), aPBBox);
|
||||
}
|
||||
|
||||
// Shake the tree
|
||||
aTreeFiller.Fill();
|
||||
|
||||
const Standard_Boolean bSICheckMode = (myArguments.Extent() == 1);
|
||||
|
||||
// Find pairs of Face/PaveBlock containing the same vertices
|
||||
// and prepare those pairs for intersection.
|
||||
BOPAlgo_VectorOfEdgeFace aVEdgeFace;
|
||||
|
||||
const Standard_Integer aNbS = myDS->NbSourceShapes();
|
||||
for (Standard_Integer nF = 0; nF < aNbS; ++nF)
|
||||
{
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(nF);
|
||||
if (aSI.ShapeType() != TopAbs_FACE)
|
||||
// Not a face
|
||||
continue;
|
||||
|
||||
if (!aSI.HasReference())
|
||||
// Face has no face info
|
||||
continue;
|
||||
|
||||
const Bnd_Box& aBoxF = aSI.Box();
|
||||
BOPCol_BoxBndTreeSelector aSelector;
|
||||
aSelector.SetBox(aBoxF);
|
||||
|
||||
if (!aBBTree.Select(aSelector))
|
||||
continue;
|
||||
|
||||
const TopoDS_Face& aF = TopoDS::Face(aSI.Shape());
|
||||
const BOPDS_FaceInfo& aFI = myDS->FaceInfo(nF);
|
||||
// Vertices of the face
|
||||
BOPCol_MapOfInteger aMVF;
|
||||
const BOPCol_MapOfInteger* pMVF[] = { &aFI.VerticesOn(),
|
||||
&aFI.VerticesIn(),
|
||||
&aFI.VerticesSc() };
|
||||
for (Standard_Integer iM = 0; iM < 3; ++iM)
|
||||
{
|
||||
BOPCol_MapIteratorOfMapOfInteger itM(*pMVF[iM]);
|
||||
for (; itM.More(); itM.Next())
|
||||
aMVF.Add(itM.Value());
|
||||
}
|
||||
|
||||
// Pave Blocks of the face
|
||||
const BOPDS_IndexedMapOfPaveBlock* pMPBF[] = { &aFI.PaveBlocksOn(),
|
||||
&aFI.PaveBlocksIn(),
|
||||
&aFI.PaveBlocksSc() };
|
||||
for (Standard_Integer iM = 0; iM < 3; ++iM)
|
||||
{
|
||||
const Standard_Integer aNb = pMPBF[iM]->Extent();
|
||||
for (Standard_Integer iPB = 1; iPB <= aNb; ++iPB)
|
||||
{
|
||||
const Handle(BOPDS_PaveBlock)& aPB = pMPBF[iM]->FindKey(iPB);
|
||||
aMVF.Add(aPB->Pave1().Index());
|
||||
aMVF.Add(aPB->Pave2().Index());
|
||||
}
|
||||
}
|
||||
|
||||
// Projection tool
|
||||
GeomAPI_ProjectPointOnSurf& aProjPS = myContext->ProjPS(aF);
|
||||
BRepAdaptor_Surface& aSurfAdaptor = myContext->SurfaceAdaptor (aF);
|
||||
|
||||
// Iterate on pave blocks and combine pairs containing
|
||||
// the same vertices
|
||||
const BOPCol_ListOfInteger& aLIPB = aSelector.Indices();
|
||||
BOPCol_ListOfInteger::Iterator itLIPB(aLIPB);
|
||||
for (; itLIPB.More(); itLIPB.Next())
|
||||
{
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aPBMap(itLIPB.Value());
|
||||
if (pMPBF[0]->Contains(aPB) ||
|
||||
pMPBF[1]->Contains(aPB) ||
|
||||
pMPBF[2]->Contains(aPB))
|
||||
continue;
|
||||
|
||||
// Check if the face contains both vertices of the pave block
|
||||
Standard_Integer nV1, nV2;
|
||||
aPB->Indices(nV1, nV2);
|
||||
if (!aMVF.Contains(nV1) || !aMVF.Contains(nV2))
|
||||
// Face does not contain the vertices
|
||||
continue;
|
||||
|
||||
// Get the edge
|
||||
Standard_Integer nE;
|
||||
if (!aPB->HasEdge(nE))
|
||||
{
|
||||
nE = aPB->OriginalEdge();
|
||||
if (nE < 0)
|
||||
continue;
|
||||
|
||||
// Make sure that the edge and face came from different arguments
|
||||
if (myDS->Rank(nF) == myDS->Rank(nE))
|
||||
continue;
|
||||
}
|
||||
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(nE));
|
||||
BRepAdaptor_Curve aBAC(aE);
|
||||
|
||||
// Check directions coincidence at middle point on the edge
|
||||
// and projection of that point on the face.
|
||||
// If the angle between tangent vector to the curve and normal
|
||||
// of the face is not in the range of 65 - 115 degrees, do not use the additional
|
||||
// tolerance, as it may lead to undesired unification of edge with the face.
|
||||
Standard_Boolean bUseAddTol = Standard_True;
|
||||
|
||||
Standard_Real aTS[2];
|
||||
Bnd_Box aPBBox;
|
||||
Standard_Boolean isSplit;
|
||||
aPB->ShrunkData(aTS[0], aTS[1], aPBBox, isSplit);
|
||||
|
||||
// Middle point
|
||||
gp_Pnt aPOnE;
|
||||
// Tangent vector in the middle point
|
||||
gp_Vec aVETgt;
|
||||
aBAC.D1(BOPTools_AlgoTools2D::IntermediatePoint(aTS[0], aTS[1]), aPOnE, aVETgt);
|
||||
if (aVETgt.SquareMagnitude() < gp::Resolution())
|
||||
continue;
|
||||
|
||||
aProjPS.Perform(aPOnE);
|
||||
if (!aProjPS.NbPoints())
|
||||
continue;
|
||||
|
||||
// Check the distance in the middle point, using the max vertices
|
||||
// tolerance as the criteria.
|
||||
const TopoDS_Vertex& aV1 = TopoDS::Vertex(myDS->Shape(nV1));
|
||||
const TopoDS_Vertex& aV2 = TopoDS::Vertex(myDS->Shape(nV2));
|
||||
|
||||
// In the Self-Interference check mode we are interested in real
|
||||
// intersections only, so use only the real tolerance of edges,
|
||||
// no need to use the extended tolerance.
|
||||
Standard_Real aTolCheck = (bSICheckMode ? myFuzzyValue :
|
||||
2 * Max(BRep_Tool::Tolerance(aV1), BRep_Tool::Tolerance(aV2)));
|
||||
|
||||
if (aProjPS.LowerDistance() > aTolCheck + myFuzzyValue)
|
||||
continue;
|
||||
|
||||
Standard_Real U, V;
|
||||
aProjPS.LowerDistanceParameters(U, V);
|
||||
if (!myContext->IsPointInFace(aF, gp_Pnt2d(U, V)))
|
||||
continue;
|
||||
|
||||
if (aSurfAdaptor.GetType() != GeomAbs_Plane ||
|
||||
aBAC.GetType() != GeomAbs_Line)
|
||||
{
|
||||
gp_Pnt aPOnS = aProjPS.NearestPoint();
|
||||
gp_Vec aVFNorm(aPOnS, aPOnE);
|
||||
if (aVFNorm.SquareMagnitude() > gp::Resolution())
|
||||
{
|
||||
// Angle between vectors should be close to 90 degrees.
|
||||
// We allow deviation of 10 degrees.
|
||||
Standard_Real aCos = aVFNorm.Normalized().Dot (aVETgt.Normalized());
|
||||
if (Abs(aCos) > 0.17365)
|
||||
bUseAddTol = Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
// Compute an addition to Fuzzy value
|
||||
Standard_Real aTolAdd = 0.0;
|
||||
if (bUseAddTol)
|
||||
{
|
||||
// Compute the distance from the bounding points of the edge
|
||||
// to the face and use the maximal of these distances as a
|
||||
// fuzzy tolerance for the intersection.
|
||||
// Use the maximal tolerance of the pave block's vertices
|
||||
// as a max criteria for the computed distance.
|
||||
|
||||
for (Standard_Integer iP = 0; iP < 2; ++iP)
|
||||
{
|
||||
gp_Pnt aP = aBAC.Value(aTS[iP]);
|
||||
aProjPS.Perform(aP);
|
||||
if (aProjPS.NbPoints())
|
||||
{
|
||||
Standard_Real aDistEF = aProjPS.LowerDistance();
|
||||
if (aDistEF < aTolCheck && aDistEF > aTolAdd)
|
||||
aTolAdd = aDistEF;
|
||||
}
|
||||
}
|
||||
if (aTolAdd > 0.)
|
||||
{
|
||||
aTolAdd -= (BRep_Tool::Tolerance(aE) + BRep_Tool::Tolerance(aF));
|
||||
if (aTolAdd < 0.)
|
||||
aTolAdd = 0.;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean bIntersect = aTolAdd > 0;
|
||||
if (!bIntersect)
|
||||
{
|
||||
const BOPDS_MapOfPaveBlock* pMPB = myFPBDone.Seek(nF);
|
||||
bIntersect = !pMPB || !(pMPB->Contains(aPB));
|
||||
}
|
||||
|
||||
if (bIntersect)
|
||||
{
|
||||
// Prepare pair for intersection
|
||||
BOPAlgo_EdgeFace& aEdgeFace = aVEdgeFace.Append1();
|
||||
aEdgeFace.SetIndices(nE, nF);
|
||||
aEdgeFace.SetPaveBlock(aPB);
|
||||
aEdgeFace.SetEdge(aE);
|
||||
aEdgeFace.SetFace(aF);
|
||||
//aEdgeFace.SetBoxes (myDS->ShapeInfo(nE).Box(), myDS->ShapeInfo (nF).Box());
|
||||
aEdgeFace.SetFuzzyValue(myFuzzyValue + aTolAdd);
|
||||
aEdgeFace.UseQuickCoincidenceCheck(Standard_True);
|
||||
aEdgeFace.SetRange(IntTools_Range(aPB->Pave1().Parameter(), aPB->Pave2().Parameter()));
|
||||
aEdgeFace.SetProgressIndicator(myProgressIndicator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer aNbEFs = aVEdgeFace.Length();
|
||||
if (!aNbEFs)
|
||||
return;
|
||||
|
||||
aPBMap.Clear();
|
||||
anAlloc->Reset();
|
||||
|
||||
// Perform intersection of the found pairs
|
||||
BOPAlgo_EdgeFaceCnt::Perform (myRunParallel, aVEdgeFace, myContext);
|
||||
|
||||
BOPDS_VectorOfInterfEF& aEFs = myDS->InterfEF();
|
||||
if (theAddInterf && aEFs.IsEmpty())
|
||||
aEFs.SetIncrement(10);
|
||||
|
||||
// Analyze the results of intersection looking for TopAbs_EDGE
|
||||
// intersection type only.
|
||||
|
||||
// Collect all pairs for common block creation
|
||||
BOPDS_IndexedDataMapOfPaveBlockListOfInteger aMPBLI(1, anAlloc);
|
||||
|
||||
for (Standard_Integer i = 0; i < aNbEFs; ++i)
|
||||
{
|
||||
BOPAlgo_EdgeFace& anEdgeFace = aVEdgeFace(i);
|
||||
if (!anEdgeFace.IsDone() || anEdgeFace.HasErrors())
|
||||
continue;
|
||||
|
||||
const IntTools_SequenceOfCommonPrts& aCParts = anEdgeFace.CommonParts();
|
||||
if (aCParts.Length() != 1)
|
||||
continue;
|
||||
|
||||
const IntTools_CommonPrt& aCP = aCParts(1);
|
||||
if (aCP.Type() != TopAbs_EDGE)
|
||||
continue;
|
||||
|
||||
Standard_Integer nE, nF;
|
||||
anEdgeFace.Indices(nE, nF);
|
||||
if (theAddInterf)
|
||||
{
|
||||
// Add interference
|
||||
BOPDS_InterfEF& aEF = aEFs.Append1();
|
||||
aEF.SetIndices(nE, nF);
|
||||
aEF.SetCommonPart(aCP);
|
||||
myDS->AddInterf(nE, nF);
|
||||
}
|
||||
|
||||
const Handle(BOPDS_PaveBlock)& aPB = anEdgeFace.PaveBlock();
|
||||
// Update face information with new IN pave block
|
||||
myDS->ChangeFaceInfo(nF).ChangePaveBlocksIn().Add(aPB);
|
||||
if (theAddInterf)
|
||||
// Fill map for common blocks creation
|
||||
BOPAlgo_Tools::FillMap(aPB, nF, aMPBLI, anAlloc);
|
||||
}
|
||||
|
||||
if (aMPBLI.Extent())
|
||||
// Create new common blocks for coinciding pairs
|
||||
BOPAlgo_Tools::PerformCommonBlocks(aMPBLI, anAlloc, myDS);
|
||||
}
|
||||
|
@@ -144,16 +144,7 @@ class BOPAlgo_FaceFace :
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
IntTools_FaceFace::Perform(myF1, myF2);
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
IntTools_FaceFace::Perform(myF1, myF2);
|
||||
}
|
||||
//
|
||||
protected:
|
||||
@@ -272,12 +263,10 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
for (k = 0; k < aNbFaceFace; ++k) {
|
||||
BOPAlgo_FaceFace& aFaceFace = aVFaceFace(k);
|
||||
aFaceFace.Indices(nF1, nF2);
|
||||
if (!aFaceFace.IsDone() || aFaceFace.HasErrors()) {
|
||||
if (!aFaceFace.IsDone()) {
|
||||
BOPDS_InterfFF& aFF = aFFs.Append1();
|
||||
aFF.SetIndices(nF1, nF2);
|
||||
aFF.Init(0, 0);
|
||||
// Warn about failed intersection of faces
|
||||
AddIntersectionFailedWarning(aFaceFace.Face1(), aFaceFace.Face2());
|
||||
continue;
|
||||
}
|
||||
//
|
||||
@@ -384,7 +373,6 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
BOPCol_DataMapOfIntegerListOfInteger aDMBV(100, aAllocator);
|
||||
BOPCol_DataMapIteratorOfDataMapOfIntegerReal aItMV;
|
||||
BOPCol_IndexedMapOfShape aMicroEdges(100, aAllocator);
|
||||
BOPCol_IndexedMapOfShape aVertsOnRejectedPB;
|
||||
//
|
||||
for (i=0; i<aNbFF; ++i) {
|
||||
//
|
||||
@@ -569,19 +557,6 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
if (!bInBothFaces) {
|
||||
aMPBAdd.Add(aPBOut);
|
||||
PreparePostTreatFF(i, j, aPBOut, aMSCPB, aMVI, aLPBC);
|
||||
// Try fusing the vertices of the existing pave block
|
||||
// with the vertices put on the real section curve (except
|
||||
// for technological vertices, which will be removed)
|
||||
Standard_Integer nVOut1, nVOut2;
|
||||
aPBOut->Indices(nVOut1, nVOut2);
|
||||
if (nV1 != nVOut1 && nV1 != nVOut2 && !aMVBounds.Contains(nV1))
|
||||
{
|
||||
aVertsOnRejectedPB.Add(aV1);
|
||||
}
|
||||
if (nV2 != nVOut1 && nV2 != nVOut2 && !aMVBounds.Contains(nV2))
|
||||
{
|
||||
aVertsOnRejectedPB.Add(aV2);
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
@@ -630,7 +605,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV1);
|
||||
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
|
||||
aBoxDS = Bnd_Box();
|
||||
BRepBndLib::AddOptimal(aV, aBoxDS, Standard_True, Standard_True);
|
||||
BRepBndLib::Add(aV, aBoxDS);
|
||||
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
|
||||
//
|
||||
if (aDMVLV.IsBound(nV1))
|
||||
@@ -664,7 +639,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
//
|
||||
// post treatment
|
||||
MakeSDVerticesFF(aDMVLV, aDMNewSD);
|
||||
PostTreatFF(aMSCPB, aDMExEdges, aDMNewSD, aMicroEdges, aVertsOnRejectedPB, aAllocator);
|
||||
PostTreatFF(aMSCPB, aDMExEdges, aDMNewSD, aMicroEdges, aAllocator);
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
@@ -680,9 +655,6 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
// into all faces, not participated in creation of that edge, as IN edge
|
||||
PutSEInOtherFaces();
|
||||
//
|
||||
|
||||
myDS->FilterOfCommonBlocks();
|
||||
|
||||
//-----------------------------------------------------scope t
|
||||
aMVStick.Clear();
|
||||
aMPBOnIn.Clear();
|
||||
@@ -725,7 +697,6 @@ void BOPAlgo_PaveFiller::PostTreatFF
|
||||
BOPDS_DataMapOfPaveBlockListOfPaveBlock& aDMExEdges,
|
||||
BOPCol_DataMapOfIntegerInteger& aDMNewSD,
|
||||
const BOPCol_IndexedMapOfShape& theMicroEdges,
|
||||
const BOPCol_IndexedMapOfShape& theVertsOnRejectedPB,
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
{
|
||||
Standard_Integer aNbS = theMSCPB.Extent();
|
||||
@@ -753,9 +724,8 @@ void BOPAlgo_PaveFiller::PostTreatFF
|
||||
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
|
||||
//
|
||||
Standard_Integer aNbME = theMicroEdges.Extent();
|
||||
Standard_Integer aNbVOnRPB = theVertsOnRejectedPB.Extent();
|
||||
// 0
|
||||
if (aNbS==1 && (aNbME == 0) && (aNbVOnRPB == 0)) {
|
||||
if (aNbS==1 && (aNbME == 0)) {
|
||||
const TopoDS_Shape& aS=theMSCPB.FindKey(1);
|
||||
const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromIndex(1);
|
||||
//
|
||||
@@ -854,20 +824,6 @@ void BOPAlgo_PaveFiller::PostTreatFF
|
||||
aBB.UpdateVertex(aVerts[1], aTolV2 + aDist);
|
||||
}
|
||||
}
|
||||
|
||||
// Add vertices put on the real section curves to unify them with the
|
||||
// vertices of the edges, by which these sections curves have been rejected
|
||||
for (Standard_Integer i = 1; i <= aNbVOnRPB; ++i)
|
||||
{
|
||||
TopoDS_Shape aVer = theVertsOnRejectedPB(i);
|
||||
Standard_Integer iVer = myDS->Index(aVer);
|
||||
const Standard_Integer* pSD = aDMNewSD.Seek(iVer);
|
||||
if (pSD)
|
||||
aVer = myDS->Shape(*pSD);
|
||||
|
||||
if (anAddedSD.Add(aVer))
|
||||
aLS.Append(aVer);
|
||||
}
|
||||
//
|
||||
// 2 Fuse shapes
|
||||
aPF.SetProgressIndicator(myProgressIndicator);
|
||||
@@ -1536,7 +1492,7 @@ void BOPAlgo_PaveFiller::PutBoundPaveOnCurve(const TopoDS_Face& aF1,
|
||||
//
|
||||
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVn);
|
||||
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
|
||||
BRepBndLib::AddOptimal(aVn, aBoxDS, Standard_True, Standard_True);
|
||||
BRepBndLib::Add(aVn, aBoxDS);
|
||||
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
|
||||
//
|
||||
aLVB.Append(nVn);
|
||||
@@ -2154,7 +2110,7 @@ void BOPAlgo_PaveFiller::PutPaveOnCurve
|
||||
//
|
||||
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
|
||||
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
|
||||
BRepBndLib::AddOptimal(aV, aBoxDS, Standard_True, Standard_True);
|
||||
BRepBndLib::Add(aV, aBoxDS);
|
||||
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_Alerts.hxx>
|
||||
#include <BOPAlgo_SectionAttribute.hxx>
|
||||
#include <BOPAlgo_Tools.hxx>
|
||||
#include <BOPCol_IndexedMapOfShape.hxx>
|
||||
@@ -142,7 +141,7 @@ class BOPAlgo_SplitEdge : public BOPAlgo_Algo {
|
||||
myV1, myT1,
|
||||
myV2, myT2,
|
||||
myESp);
|
||||
BRepBndLib::AddOptimal(myESp, myBox, Standard_True, Standard_True);
|
||||
BRepBndLib::Add(myESp, myBox);
|
||||
myBox.SetGap(myBox.GetGap() + Precision::Confusion());
|
||||
}
|
||||
//
|
||||
@@ -242,37 +241,28 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
|
||||
}
|
||||
//
|
||||
virtual void Perform() {
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
Standard_Integer iErr;
|
||||
Standard_Integer iErr;
|
||||
//
|
||||
iErr=1;
|
||||
if (!myEz.IsNull()) {
|
||||
TopoDS_Edge aSpz;
|
||||
//
|
||||
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);
|
||||
}
|
||||
BOPTools_AlgoTools::MakeSplitEdge(myEz,myV1, myT1,
|
||||
myV2, myT2, aSpz);
|
||||
//
|
||||
if (iErr) {
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF, myContext);
|
||||
}
|
||||
//
|
||||
if (myFlag) {
|
||||
UpdateVertices(myE, myF);
|
||||
}
|
||||
iErr=
|
||||
BOPTools_AlgoTools2D::AttachExistingPCurve(aSpz,
|
||||
myE,
|
||||
myF,
|
||||
myContext);
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertBuildingPCurveFailed(TopoDS_Shape()));
|
||||
//
|
||||
if (iErr) {
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF, myContext);
|
||||
}
|
||||
//
|
||||
if (myFlag) {
|
||||
UpdateVertices(myE, myF);
|
||||
}
|
||||
}
|
||||
//
|
||||
@@ -525,7 +515,7 @@ Standard_Integer BOPAlgo_PaveFiller::SplitEdge(const Standard_Integer nE,
|
||||
aSI.SetShape(aSp);
|
||||
//
|
||||
Bnd_Box& aBox=aSI.ChangeBox();
|
||||
BRepBndLib::AddOptimal(aSp, aBox, Standard_True, Standard_True);
|
||||
BRepBndLib::Add(aSp, aBox);
|
||||
aBox.SetGap(aBox.GetGap() + Precision::Confusion());
|
||||
//
|
||||
nSp=myDS->Append(aSI);
|
||||
@@ -686,20 +676,6 @@ void BOPAlgo_PaveFiller::MakePCurves()
|
||||
//======================================================
|
||||
BOPAlgo_MPCCnt::Perform(myRunParallel, aVMPC, myContext);
|
||||
//======================================================
|
||||
|
||||
// Add warnings of the failed projections
|
||||
Standard_Integer aNb = aVMPC.Extent();
|
||||
for (i = 0; i < aNb; ++i)
|
||||
{
|
||||
if (aVMPC(i).HasErrors())
|
||||
{
|
||||
TopoDS_Compound aWC;
|
||||
BRep_Builder().MakeCompound(aWC);
|
||||
BRep_Builder().Add(aWC, aVMPC(i).Edge());
|
||||
BRep_Builder().Add(aWC, aVMPC(i).Face());
|
||||
AddWarning(new BOPAlgo_AlertBuildingPCurveFailed(aWC));
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : UpdateVertices
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Solid.hxx>
|
||||
|
||||
#include <BOPCol_BoxBndTree.hxx>
|
||||
#include <BOPCol_IndexedMapOfShape.hxx>
|
||||
@@ -38,6 +39,8 @@
|
||||
#include <BOPCol_NCVector.hxx>
|
||||
#include <BOPCol_Parallel.hxx>
|
||||
|
||||
#include <BRepBndLib.hxx>
|
||||
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
@@ -64,10 +67,13 @@
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools2D.hxx>
|
||||
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
|
||||
#include <IntTools_Context.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
typedef NCollection_IndexedDataMap
|
||||
<TopoDS_Shape, gp_Dir, TopTools_ShapeMapHasher> BOPAlgo_IndexedDataMapOfShapeDir;
|
||||
typedef NCollection_IndexedDataMap
|
||||
@@ -1088,3 +1094,537 @@ void BOPAlgo_Tools::IntersectVertices(const BOPCol_IndexedDataMapOfShapeReal& th
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// Classification of the faces relatively solids
|
||||
//=======================================================================
|
||||
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_ShapeBox
|
||||
//purpose : Auxiliary class defining ShapeBox structure
|
||||
//=======================================================================
|
||||
class BOPAlgo_ShapeBox
|
||||
{
|
||||
public:
|
||||
//! Empty constructor
|
||||
BOPAlgo_ShapeBox() {};
|
||||
//! Sets the shape
|
||||
void SetShape(const TopoDS_Shape& theS)
|
||||
{
|
||||
myShape = theS;
|
||||
};
|
||||
//! Returns the shape
|
||||
const TopoDS_Shape& Shape() const
|
||||
{
|
||||
return myShape;
|
||||
};
|
||||
//! Sets the bounding box
|
||||
void SetBox(const Bnd_Box& theBox)
|
||||
{
|
||||
myBox = theBox;
|
||||
};
|
||||
//! Returns the bounding box
|
||||
const Bnd_Box& Box() const
|
||||
{
|
||||
return myBox;
|
||||
};
|
||||
private:
|
||||
TopoDS_Shape myShape;
|
||||
Bnd_Box myBox;
|
||||
};
|
||||
// Vector of ShapeBox
|
||||
typedef BOPCol_NCVector<BOPAlgo_ShapeBox> BOPAlgo_VectorOfShapeBox;
|
||||
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_FillIn3DParts
|
||||
//purpose : Auxiliary class for faces classification in parallel mode
|
||||
//=======================================================================
|
||||
class BOPAlgo_FillIn3DParts : public BOPAlgo_Algo
|
||||
{
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructor
|
||||
BOPAlgo_FillIn3DParts()
|
||||
{
|
||||
myBBTree = NULL;
|
||||
myVShapeBox = NULL;
|
||||
};
|
||||
|
||||
//! Destructor
|
||||
virtual ~BOPAlgo_FillIn3DParts() {};
|
||||
|
||||
//! Sets the solid
|
||||
void SetSolid(const TopoDS_Solid& theSolid)
|
||||
{
|
||||
mySolid = theSolid;
|
||||
};
|
||||
|
||||
//! Returns the solid
|
||||
const TopoDS_Solid& Solid() const
|
||||
{
|
||||
return mySolid;
|
||||
};
|
||||
|
||||
//! Sets the box for the solid
|
||||
void SetBoxS(const Bnd_Box& theBox)
|
||||
{
|
||||
myBoxS = theBox;
|
||||
};
|
||||
|
||||
//! Returns the solid's box
|
||||
const Bnd_Box& BoxS() const
|
||||
{
|
||||
return myBoxS;
|
||||
};
|
||||
|
||||
//! Sets own INTERNAL faces of the solid
|
||||
void SetOwnIF(const BOPCol_ListOfShape& theLIF)
|
||||
{
|
||||
myOwnIF = theLIF;
|
||||
};
|
||||
|
||||
//! Returns own INTERNAL faces of the solid
|
||||
const BOPCol_ListOfShape& OwnIF() const
|
||||
{
|
||||
return myOwnIF;
|
||||
};
|
||||
|
||||
//! Sets the Bounding Box tree
|
||||
void SetBBTree(const BOPCol_BoxBndTree& theBBTree)
|
||||
{
|
||||
myBBTree = (BOPCol_BoxBndTree*)&theBBTree;
|
||||
};
|
||||
|
||||
//! Sets the ShapeBox structure
|
||||
void SetShapeBoxVector(const BOPAlgo_VectorOfShapeBox& theShapeBox)
|
||||
{
|
||||
myVShapeBox = (BOPAlgo_VectorOfShapeBox*)&theShapeBox;
|
||||
};
|
||||
|
||||
//! Sets the context
|
||||
void SetContext(const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
myContext = theContext;
|
||||
}
|
||||
|
||||
//! Returns the context
|
||||
const Handle(IntTools_Context)& Context() const
|
||||
{
|
||||
return myContext;
|
||||
}
|
||||
|
||||
//! Performs the classification
|
||||
virtual void Perform();
|
||||
|
||||
//! Returns the faces classified as IN for solid
|
||||
const BOPCol_ListOfShape& InFaces() const
|
||||
{
|
||||
return myInFaces;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
//! Prepares Edge-Face connection map of the given shape
|
||||
void MapEdgesAndFaces(const TopoDS_Shape& theF,
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape& theEFMap,
|
||||
const Handle(NCollection_BaseAllocator)& theAlloc);
|
||||
|
||||
//! Makes the connexity block of faces using the connection map
|
||||
void MakeConnexityBlock(const TopoDS_Face& theF,
|
||||
const BOPCol_IndexedMapOfShape& theMEToAvoid,
|
||||
const BOPCol_IndexedDataMapOfShapeListOfShape& theEFMap,
|
||||
BOPCol_MapOfShape& theMFDone,
|
||||
BOPCol_ListOfShape& theLCB,
|
||||
TopoDS_Face& theFaceToClassify);
|
||||
|
||||
TopoDS_Solid mySolid; //! Solid
|
||||
Bnd_Box myBoxS; // Bounding box of the solid
|
||||
BOPCol_ListOfShape myOwnIF; //! Own INTERNAL faces of the solid
|
||||
BOPCol_ListOfShape myInFaces; //! Faces classified as IN
|
||||
|
||||
BOPCol_BoxBndTree* myBBTree; //! UB tree of bounding boxes
|
||||
BOPAlgo_VectorOfShapeBox* myVShapeBox; //! ShapeBoxMap
|
||||
|
||||
TopoDS_Iterator myItF; //! Iterators
|
||||
TopoDS_Iterator myItW;
|
||||
|
||||
Handle(IntTools_Context) myContext; //! Context
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : BOPAlgo_FillIn3DParts::Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_FillIn3DParts::Perform()
|
||||
{
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
|
||||
myInFaces.Clear();
|
||||
|
||||
// 1. Select boxes of faces that are not out of aBoxS
|
||||
BOPCol_BoxBndTreeSelector aSelector;
|
||||
aSelector.SetBox(myBoxS);
|
||||
//
|
||||
if (!myBBTree->Select(aSelector))
|
||||
return;
|
||||
|
||||
const BOPCol_ListOfInteger& aLIFP = aSelector.Indices();
|
||||
|
||||
// 2. Fill maps of edges and faces of the solid
|
||||
|
||||
Handle(NCollection_BaseAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
|
||||
BOPAlgo_VectorOfShapeBox& aVShapeBox = *myVShapeBox;
|
||||
|
||||
BOPCol_IndexedMapOfShape aMSE(1, anAlloc), aMSF(1, anAlloc);
|
||||
BOPTools::MapShapes(mySolid, TopAbs_EDGE, aMSE);
|
||||
BOPTools::MapShapes(mySolid, TopAbs_FACE, aMSF);
|
||||
|
||||
// Check if the Solid contains any faces
|
||||
Standard_Boolean bIsEmpty = aMSF.IsEmpty();
|
||||
|
||||
// Add own internal faces of the solid into aMSF
|
||||
BOPCol_ListIteratorOfListOfShape aItLS(myOwnIF);
|
||||
for (; aItLS.More(); aItLS.Next())
|
||||
aMSF.Add(aItLS.Value());
|
||||
|
||||
// 3. aIVec - faces to process.
|
||||
// Filter the selected faces with faces of the solid.
|
||||
BOPCol_NCVector<Standard_Integer> aIVec(256, anAlloc);
|
||||
|
||||
BOPCol_ListIteratorOfListOfInteger aItLI(aLIFP);
|
||||
for (; aItLI.More(); aItLI.Next()) {
|
||||
Standard_Integer nFP = aItLI.Value();
|
||||
const TopoDS_Shape& aFP = aVShapeBox(nFP).Shape();
|
||||
if (!aMSF.Contains(aFP))
|
||||
aIVec.Append1() = nFP;
|
||||
}
|
||||
|
||||
// 4. Classify faces relatively solid.
|
||||
// Store faces that are IN mySolid into <myInFaces>
|
||||
|
||||
Standard_Integer k, aNbFP = aIVec.Length();
|
||||
// Sort indices if necessary
|
||||
if (aNbFP > 1)
|
||||
std::sort(aIVec.begin(), aIVec.end());
|
||||
|
||||
if (bIsEmpty)
|
||||
{
|
||||
// The solid is empty as it does not contain any faces.
|
||||
// It could happen when the input solid consists of INTERNAL faces only.
|
||||
// Classification of any point relatively empty solid would always give IN status.
|
||||
// Thus, we consider all selected faces as IN without real classification.
|
||||
for (k = 0; k < aNbFP; ++k)
|
||||
myInFaces.Append(aVShapeBox(aIVec(k)).Shape());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Prepare EF map of faces to process for building connexity blocks
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aMEFP(1, anAlloc);
|
||||
if (aNbFP > 1)
|
||||
{
|
||||
for (k = 0; k < aNbFP; ++k)
|
||||
MapEdgesAndFaces(aVShapeBox(aIVec(k)).Shape(), aMEFP, anAlloc);
|
||||
}
|
||||
|
||||
// Map of Edge-Face connection, necessary for solid classification.
|
||||
// It will be filled when first classification is performed.
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aMEFDS(1, anAlloc);
|
||||
|
||||
// Fence map to avoid processing of the same faces twice
|
||||
BOPCol_MapOfShape aMFDone(1, anAlloc);
|
||||
|
||||
for (k = 0; k < aNbFP; ++k)
|
||||
{
|
||||
Standard_Integer nFP = aIVec(k);
|
||||
const TopoDS_Face& aFP = (*(TopoDS_Face*)&aVShapeBox(nFP).Shape());
|
||||
if (!aMFDone.Add(aFP))
|
||||
continue;
|
||||
|
||||
// Make connexity blocks of faces, avoiding passing through the
|
||||
// borders of the solid. It helps to reduce significantly the
|
||||
// number of classified faces.
|
||||
BOPCol_ListOfShape aLCBF(anAlloc);
|
||||
// The most appropriate face for classification
|
||||
TopoDS_Face aFaceToClassify;
|
||||
MakeConnexityBlock(aFP, aMSE, aMEFP, aMFDone, aLCBF, aFaceToClassify);
|
||||
|
||||
if (!myBoxS.IsWhole())
|
||||
{
|
||||
// First, try fast classification of the whole block by additional
|
||||
// check on bounding boxes - check that bounding boxes of all vertices
|
||||
// of the block interfere with the box of the solid.
|
||||
// If not, the faces are out.
|
||||
Standard_Boolean bOut = Standard_False;
|
||||
aItLS.Initialize(aLCBF);
|
||||
for (; aItLS.More() && !bOut; aItLS.Next())
|
||||
{
|
||||
TopExp_Explorer anExpV(aItLS.Value(), TopAbs_VERTEX);
|
||||
for (; anExpV.More() && !bOut; anExpV.Next())
|
||||
{
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex(anExpV.Current());
|
||||
Bnd_Box aBBV;
|
||||
aBBV.Add(BRep_Tool::Pnt(aV));
|
||||
aBBV.SetGap(BRep_Tool::Tolerance(aV));
|
||||
bOut = myBoxS.IsOut(aBBV);
|
||||
}
|
||||
}
|
||||
if (bOut)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (aFaceToClassify.IsNull())
|
||||
aFaceToClassify = aFP;
|
||||
|
||||
if (aMEFDS.IsEmpty())
|
||||
// Fill EF map for Solid
|
||||
BOPTools::MapShapesAndAncestors(mySolid, TopAbs_EDGE, TopAbs_FACE, aMEFDS);
|
||||
|
||||
// All vertices are interfere with the solids box, run classification.
|
||||
Standard_Boolean bIsIN = BOPTools_AlgoTools::IsInternalFace
|
||||
(aFaceToClassify, mySolid, aMEFDS, Precision::Confusion(), myContext);
|
||||
if (bIsIN)
|
||||
{
|
||||
aItLS.Initialize(aLCBF);
|
||||
for (; aItLS.More(); aItLS.Next())
|
||||
myInFaces.Append(aItLS.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// function: MapEdgesAndFaces
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_FillIn3DParts::MapEdgesAndFaces(const TopoDS_Shape& theF,
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape& theEFMap,
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
{
|
||||
myItF.Initialize(theF);
|
||||
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();
|
||||
|
||||
BOPCol_ListOfShape* pLF = theEFMap.ChangeSeek(aE);
|
||||
if (!pLF)
|
||||
pLF = &theEFMap(theEFMap.Add(aE, BOPCol_ListOfShape(theAllocator)));
|
||||
pLF->Append(theF);
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// function: MakeConnexityBlock
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_FillIn3DParts::MakeConnexityBlock(const TopoDS_Face& theFStart,
|
||||
const BOPCol_IndexedMapOfShape& theMEAvoid,
|
||||
const BOPCol_IndexedDataMapOfShapeListOfShape& theEFMap,
|
||||
BOPCol_MapOfShape& theMFDone,
|
||||
BOPCol_ListOfShape& theLCB,
|
||||
TopoDS_Face& theFaceToClassify)
|
||||
{
|
||||
// Add start element
|
||||
theLCB.Append(theFStart);
|
||||
if (theEFMap.IsEmpty())
|
||||
return;
|
||||
|
||||
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))
|
||||
{
|
||||
if (theFaceToClassify.IsNull())
|
||||
theFaceToClassify = TopoDS::Face(aF);
|
||||
continue;
|
||||
}
|
||||
|
||||
const BOPCol_ListOfShape* pLF = theEFMap.Seek(aE);
|
||||
if (!pLF)
|
||||
continue;
|
||||
BOPCol_ListIteratorOfListOfShape aItLF(*pLF);
|
||||
for (; aItLF.More(); aItLF.Next())
|
||||
{
|
||||
const TopoDS_Shape& aFToAdd = aItLF.Value();
|
||||
if (theMFDone.Add(aFToAdd))
|
||||
theLCB.Append(aFToAdd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Vector of solid classifiers
|
||||
typedef BOPCol_NCVector<BOPAlgo_FillIn3DParts> BOPAlgo_VectorOfFillIn3DParts;
|
||||
|
||||
// Functors to perform classification
|
||||
typedef BOPCol_ContextFunctor<BOPAlgo_FillIn3DParts,
|
||||
BOPAlgo_VectorOfFillIn3DParts,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_FillIn3DPartsFunctor;
|
||||
|
||||
typedef BOPCol_ContextCnt<BOPAlgo_FillIn3DPartsFunctor,
|
||||
BOPAlgo_VectorOfFillIn3DParts,
|
||||
Handle(IntTools_Context)> BOPAlgo_FillIn3DPartsCnt;
|
||||
|
||||
namespace {
|
||||
static void buildBoxForSolid (const TopoDS_Solid& theSolid,
|
||||
Bnd_Box& theBox)
|
||||
{
|
||||
Standard_Boolean bIsOpenBox = Standard_False;
|
||||
for (TopoDS_Iterator itS (theSolid); itS.More() && !bIsOpenBox; itS.Next())
|
||||
{
|
||||
const TopoDS_Shell& aShell = TopoDS::Shell (itS.Value());
|
||||
bIsOpenBox = BOPTools_AlgoTools::IsOpenShell (aShell);
|
||||
|
||||
if (bIsOpenBox)
|
||||
break;
|
||||
|
||||
for (TopoDS_Iterator itF (aShell); itF.More(); itF.Next())
|
||||
{
|
||||
const TopoDS_Face& aF = TopoDS::Face (itF.Value());
|
||||
|
||||
Bnd_Box aBoxF;
|
||||
BRepBndLib::Add (aF, aBoxF);
|
||||
|
||||
bIsOpenBox = (aBoxF.IsOpenXmin() || aBoxF.IsOpenXmax() ||
|
||||
aBoxF.IsOpenYmin() || aBoxF.IsOpenYmax() ||
|
||||
aBoxF.IsOpenZmin() || aBoxF.IsOpenZmax());
|
||||
|
||||
if (bIsOpenBox)
|
||||
break;
|
||||
|
||||
theBox.Add (aBoxF);
|
||||
}
|
||||
}
|
||||
if (bIsOpenBox || BOPTools_AlgoTools::IsInvertedSolid (theSolid))
|
||||
theBox.SetWhole();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ClassifyFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_Tools::ClassifyFaces(const BOPCol_ListOfShape& theFaces,
|
||||
const BOPCol_ListOfShape& theSolids,
|
||||
const Standard_Boolean theRunParallel,
|
||||
Handle(IntTools_Context)& theContext,
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape& theInParts,
|
||||
const BOPCol_IndexedDataMapOfShapeBox* theBoxes,
|
||||
const BOPCol_DataMapOfShapeListOfShape* theSolidsIF)
|
||||
{
|
||||
Handle(NCollection_BaseAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
|
||||
// Fill the vector of shape box with faces and its bounding boxes
|
||||
BOPAlgo_VectorOfShapeBox aVSB(256, anAlloc);
|
||||
|
||||
BOPCol_ListIteratorOfListOfShape aItLF(theFaces);
|
||||
for (; aItLF.More(); aItLF.Next())
|
||||
{
|
||||
const TopoDS_Shape& aF = aItLF.Value();
|
||||
// Append face to the vector of shape box
|
||||
BOPAlgo_ShapeBox& aSB = aVSB.Append1();
|
||||
aSB.SetShape(aF);
|
||||
|
||||
Bnd_Box aBox;
|
||||
if (theBoxes)
|
||||
{
|
||||
const Bnd_Box* pBox = theBoxes->Seek (aF);
|
||||
if (pBox)
|
||||
aBox = *pBox;
|
||||
}
|
||||
|
||||
if (aBox.IsVoid())
|
||||
{
|
||||
// Build the bounding box
|
||||
BRepBndLib::Add(aF, aBox);
|
||||
}
|
||||
aSB.SetBox(aBox);
|
||||
}
|
||||
|
||||
// Prepare UB tree of bounding boxes of the faces to classify
|
||||
// taking the bounding boxes from the just prepared vector
|
||||
BOPCol_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
|
||||
Standard_Integer aNbF = aVSB.Length();
|
||||
for (Standard_Integer i = 0; i < aNbF; ++i)
|
||||
{
|
||||
aTreeFiller.Add(i, aVSB(i).Box());
|
||||
}
|
||||
|
||||
// Shake tree filler
|
||||
aTreeFiller.Fill();
|
||||
|
||||
// Prepare vector of solids to classify
|
||||
BOPAlgo_VectorOfFillIn3DParts aVFIP;
|
||||
|
||||
BOPCol_ListIteratorOfListOfShape aItLS(theSolids);
|
||||
for (; aItLS.More(); aItLS.Next())
|
||||
{
|
||||
const TopoDS_Solid& aSolid = TopoDS::Solid(aItLS.Value());
|
||||
|
||||
// Build the bounding box for the solid
|
||||
Bnd_Box aBox;
|
||||
if (theBoxes)
|
||||
{
|
||||
const Bnd_Box* pBox = theBoxes->Seek (aSolid);
|
||||
if (pBox)
|
||||
aBox = *pBox;
|
||||
}
|
||||
if (aBox.IsVoid())
|
||||
{
|
||||
buildBoxForSolid (aSolid, aBox);
|
||||
}
|
||||
|
||||
// Append solid to the vector
|
||||
BOPAlgo_FillIn3DParts& aFIP = aVFIP.Append1();
|
||||
aFIP.SetSolid(aSolid);
|
||||
aFIP.SetBoxS(aBox);
|
||||
|
||||
if (theSolidsIF)
|
||||
{
|
||||
const BOPCol_ListOfShape* pLIF = theSolidsIF->Seek(aSolid);
|
||||
if (pLIF)
|
||||
aFIP.SetOwnIF(*pLIF);
|
||||
}
|
||||
|
||||
aFIP.SetBBTree(aBBTree);
|
||||
aFIP.SetShapeBoxVector(aVSB);
|
||||
}
|
||||
|
||||
// Perform classification
|
||||
//================================================================
|
||||
BOPAlgo_FillIn3DPartsCnt::Perform(theRunParallel, aVFIP, theContext);
|
||||
//================================================================
|
||||
|
||||
// Analyze the results and fill the resulting map
|
||||
|
||||
Standard_Integer aNbS = aVFIP.Length();
|
||||
for (Standard_Integer i = 0; i < aNbS; ++i)
|
||||
{
|
||||
BOPAlgo_FillIn3DParts& aFIP = aVFIP(i);
|
||||
const TopoDS_Shape& aS = aFIP.Solid();
|
||||
const BOPCol_ListOfShape& aLFIn = aFIP.InFaces();
|
||||
theInParts.Add(aS, aLFIn);
|
||||
}
|
||||
}
|
||||
|
@@ -21,6 +21,9 @@
|
||||
|
||||
#include <BOPCol_BaseAllocator.hxx>
|
||||
#include <BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx>
|
||||
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeReal.hxx>
|
||||
#include <BOPCol_ListOfListOfShape.hxx>
|
||||
#include <BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock.hxx>
|
||||
@@ -155,6 +158,27 @@ public:
|
||||
const Standard_Real theFuzzyValue,
|
||||
BOPCol_ListOfListOfShape& theChains);
|
||||
|
||||
//! Classifies the faces <theFaces> relatively solids <theSolids>.
|
||||
//! The IN faces for solids are stored into output data map <theInParts>.
|
||||
//!
|
||||
//! The map <theSolidsIF> contains INTERNAL faces of the solids, to avoid
|
||||
//! their additional classification.
|
||||
//!
|
||||
//! Firstly, it checks the intersection of bounding boxes of the shapes.
|
||||
//! If the Box is not stored in the <theShapeBoxMap> map, it builds the box.
|
||||
//! If the bounding boxes of solid and face are interfering the classification is performed.
|
||||
//!
|
||||
//! It is assumed that all faces and solids are already intersected and
|
||||
//! do not have any geometrically coinciding parts without topological
|
||||
//! sharing of these parts
|
||||
Standard_EXPORT static void ClassifyFaces(const BOPCol_ListOfShape& theFaces,
|
||||
const BOPCol_ListOfShape& theSolids,
|
||||
const Standard_Boolean theRunParallel,
|
||||
Handle(IntTools_Context)& theContext,
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape& theInParts,
|
||||
const BOPCol_IndexedDataMapOfShapeBox* theBoxes = 0,
|
||||
const BOPCol_DataMapOfShapeListOfShape* theSolidsIF = 0);
|
||||
|
||||
};
|
||||
|
||||
#endif // _BOPAlgo_Tools_HeaderFile
|
||||
|
@@ -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
|
||||
|
@@ -463,7 +463,7 @@ void BOPDS_DS::Init(const Standard_Real theFuzz)
|
||||
}
|
||||
//
|
||||
Bnd_Box& aBox=aSI.ChangeBox();
|
||||
BRepBndLib::AddOptimal(aE, aBox, Standard_True, Standard_True);
|
||||
BRepBndLib::Add(aE, aBox);
|
||||
//
|
||||
const BOPCol_ListOfInteger& aLV=aSI.SubShapes();
|
||||
aIt1.Initialize(aLV);
|
||||
@@ -490,7 +490,7 @@ void BOPDS_DS::Init(const Standard_Real theFuzz)
|
||||
const TopoDS_Shape& aS=aSI.Shape();
|
||||
//
|
||||
Bnd_Box& aBox=aSI.ChangeBox();
|
||||
BRepBndLib::AddOptimal(aS, aBox, Standard_True, Standard_True);
|
||||
BRepBndLib::Add(aS, aBox);
|
||||
//
|
||||
BOPCol_ListOfInteger& aLW=aSI.ChangeSubShapes();
|
||||
aIt1.Initialize(aLW);
|
||||
@@ -1786,7 +1786,7 @@ void BOPDS_DS::UpdateEdgeTolerance(const Standard_Integer nE,
|
||||
aBB.UpdateEdge(aE, aTol);
|
||||
BOPDS_ShapeInfo& aSIE=ChangeShapeInfo(nE);
|
||||
Bnd_Box& aBoxE=aSIE.ChangeBox();
|
||||
BRepBndLib::AddOptimal(aE, aBoxE, Standard_True, Standard_True);
|
||||
BRepBndLib::Add(aE, aBoxE);
|
||||
aBoxE.SetGap(aBoxE.GetGap() + aTolAdd);
|
||||
//
|
||||
const BOPCol_ListOfInteger& aLI = aSIE.SubShapes();
|
||||
@@ -2106,43 +2106,4 @@ Standard_Boolean BOPDS_DS::IsValidShrunkData(const Handle(BOPDS_PaveBlock)& theP
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FilterOfCommonBlocks
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPDS_DS::FilterOfCommonBlocks()
|
||||
{
|
||||
NCollection_DataMap<TopoDS_Edge, Handle(BOPDS_CommonBlock)> aMapEC;
|
||||
BOPDS_VectorOfListOfPaveBlock& aPBP = ChangePaveBlocksPool();
|
||||
Standard_Integer aNbPBP = aPBP.Extent();
|
||||
//
|
||||
for (Standard_Integer i = 0; i < aNbPBP; ++i)
|
||||
{
|
||||
BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
|
||||
aItPB.Initialize(aLPB);
|
||||
for (; aItPB.More(); aItPB.Next())
|
||||
{
|
||||
const Handle(BOPDS_PaveBlock) &aPB = aItPB.Value();
|
||||
|
||||
if (!IsCommonBlock(aPB))
|
||||
continue;
|
||||
|
||||
const Standard_Integer anEIdx = aPB->Edge();
|
||||
const TopoDS_Edge &anE = TopoDS::Edge(Shape(anEIdx));
|
||||
|
||||
Handle(BOPDS_CommonBlock) *aCB = aMapEC.ChangeSeek(anE);
|
||||
if (!aCB)
|
||||
{
|
||||
aCB = aMapEC.Bound(anE, CommonBlock(aPB));
|
||||
continue;
|
||||
}
|
||||
|
||||
myMapPBCB.UnBind(aPB);
|
||||
(*aCB)->AddPaveBlock(aPB);
|
||||
SetCommonBlock(aPB, *aCB);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -468,9 +468,6 @@ Standard_EXPORT virtual ~BOPDS_DS();
|
||||
//! of the existing vertices have been increased.
|
||||
Standard_EXPORT Standard_Boolean IsValidShrunkData(const Handle(BOPDS_PaveBlock)& thePB);
|
||||
|
||||
//! Combines the common-blocks and removes excess common-blocks
|
||||
Standard_EXPORT void FilterOfCommonBlocks();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
@@ -235,8 +235,6 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
||||
//
|
||||
aTimer.Stop();
|
||||
//
|
||||
BOPTest::ReportAlerts(aChecker);
|
||||
//
|
||||
iErr=aChecker.HasErrors();
|
||||
//
|
||||
const BOPDS_DS& aDS=*(aChecker.PDS());
|
||||
|
@@ -994,46 +994,61 @@ Standard_Boolean BOPTools_AlgoTools::AreFacesSameDomain
|
||||
Handle(IntTools_Context)& theContext,
|
||||
const Standard_Real theFuzz)
|
||||
{
|
||||
Standard_Boolean bFlag;
|
||||
Standard_Integer iErr;
|
||||
Standard_Real aTolF1, aTolF2, aTol;
|
||||
gp_Pnt2d aP2D;
|
||||
gp_Pnt aP;
|
||||
TopoDS_Face aF1, aF2;
|
||||
TopoDS_Edge aE1;
|
||||
TopExp_Explorer aExp;
|
||||
Standard_Real aFuzz1 = (theFuzz > Precision::Confusion() ? theFuzz : Precision::Confusion());
|
||||
//
|
||||
bFlag=Standard_False;
|
||||
//
|
||||
aF1=theF1;
|
||||
aF1.Orientation(TopAbs_FORWARD);
|
||||
aF2=theF2;
|
||||
aF2.Orientation(TopAbs_FORWARD);
|
||||
//
|
||||
aTolF1=BRep_Tool::Tolerance(aF1);
|
||||
// 1
|
||||
aExp.Init(aF1, TopAbs_EDGE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
aE1=(*(TopoDS_Edge*)(&aExp.Current()));
|
||||
if (!BRep_Tool::Degenerated(aE1)) {
|
||||
Standard_Real aTolE = BRep_Tool::Tolerance(aE1);
|
||||
if (aTolE > aTolF1) {
|
||||
aTolF1 = aTolE;
|
||||
Standard_Boolean bFacesSD = Standard_False;
|
||||
|
||||
// The idea is to find a point inside the first face
|
||||
// and check its validity for the second face.
|
||||
// If valid - the faces are same domain.
|
||||
|
||||
gp_Pnt aP1;
|
||||
gp_Pnt2d aP2D1;
|
||||
// Find point inside the first face
|
||||
Standard_Integer iErr =
|
||||
BOPTools_AlgoTools3D::PointInFace(theF1, aP1, aP2D1, theContext);
|
||||
|
||||
if (iErr != 0)
|
||||
{
|
||||
// unable to find the point
|
||||
return bFacesSD;
|
||||
}
|
||||
|
||||
// Check validity of the point for second face
|
||||
|
||||
// Compute the tolerance to check the validity -
|
||||
// sum of tolerance of faces and fuzzy tolerance
|
||||
|
||||
// Compute the tolerance of the faces, taking into account the deviation
|
||||
// of the edges from the surfaces
|
||||
Standard_Real aTolF1 = BRep_Tool::Tolerance(theF1),
|
||||
aTolF2 = BRep_Tool::Tolerance(theF2);
|
||||
|
||||
// Find maximal tolerance of edges.
|
||||
// The faces should have the same boundaries, thus
|
||||
// it does not matter which face to explore.
|
||||
{
|
||||
Standard_Real aTolEMax = -1.;
|
||||
TopExp_Explorer anExpE(theF1, TopAbs_EDGE);
|
||||
for (; anExpE.More(); anExpE.Next())
|
||||
{
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(anExpE.Current());
|
||||
if (!BRep_Tool::Degenerated(aE))
|
||||
{
|
||||
Standard_Real aTolE = BRep_Tool::Tolerance(aE);
|
||||
if (aTolE > aTolEMax)
|
||||
aTolEMax = aTolE;
|
||||
}
|
||||
}
|
||||
if (aTolEMax > aTolF1) aTolF1 = aTolEMax;
|
||||
if (aTolEMax > aTolF2) aTolF2 = aTolEMax;
|
||||
}
|
||||
// 2
|
||||
aTolF2=BRep_Tool::Tolerance(aF2);
|
||||
aTol = aTolF1 + aTolF2 + aFuzz1;
|
||||
//
|
||||
iErr = BOPTools_AlgoTools3D::PointInFace(aF1, aP, aP2D,
|
||||
theContext);
|
||||
if (!iErr) {
|
||||
bFlag=theContext->IsValidPointForFace(aP, aF2, aTol);
|
||||
}
|
||||
//
|
||||
return bFlag;
|
||||
|
||||
// Checking criteria
|
||||
Standard_Real aTol = aTolF1 + aTolF2 + Max(theFuzz, Precision::Confusion());
|
||||
|
||||
// Project and classify the point on second face
|
||||
bFacesSD = theContext->IsValidPointForFace(aP1, theF2, aTol);
|
||||
|
||||
return bFacesSD;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1657,10 +1672,6 @@ Standard_Boolean FindFacePairs (const TopoDS_Edge& theE,
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
if(aLCEFx.IsEmpty())
|
||||
return Standard_False;
|
||||
|
||||
// F2
|
||||
BOPTools_AlgoTools::GetFaceOff(aE1, aF1, aLCEFx, aF2, theContext);
|
||||
//
|
||||
@@ -1892,8 +1903,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());
|
||||
|
@@ -629,13 +629,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;
|
||||
}
|
||||
@@ -644,44 +642,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)
|
||||
{
|
||||
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())
|
||||
|
@@ -144,13 +144,6 @@ BRepAdaptor_CompCurve::BRepAdaptor_CompCurve(const TopoDS_Wire& theWire,
|
||||
|
||||
TFirst = 0;
|
||||
TLast = myKnots->Value(myKnots->Length());
|
||||
myPeriod = TLast - TFirst;
|
||||
if (NbEdge == 1) {
|
||||
Periodic = myCurves->Value(1).IsPeriodic();
|
||||
}
|
||||
else {
|
||||
Periodic = Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::Initialize(const TopoDS_Wire& W,
|
||||
@@ -200,15 +193,6 @@ BRepAdaptor_CompCurve::BRepAdaptor_CompCurve(const TopoDS_Wire& theWire,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BRepAdaptor_CompCurve::SetPeriodic(const Standard_Boolean isPeriodic)
|
||||
{
|
||||
if (myWire.Closed()) {
|
||||
Periodic = isPeriodic;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
{
|
||||
return myWire;
|
||||
@@ -308,13 +292,13 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
|
||||
Standard_Boolean BRepAdaptor_CompCurve::IsPeriodic() const
|
||||
{
|
||||
return Periodic;
|
||||
return Standard_False;
|
||||
|
||||
}
|
||||
|
||||
Standard_Real BRepAdaptor_CompCurve::Period() const
|
||||
{
|
||||
return myPeriod;
|
||||
return (TLast - TFirst);
|
||||
}
|
||||
|
||||
gp_Pnt BRepAdaptor_CompCurve::Value(const Standard_Real U) const
|
||||
@@ -475,12 +459,6 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
|
||||
|
||||
Wtest = W+Eps; //Offset to discriminate the nodes
|
||||
if(Periodic){
|
||||
Wtest = ElCLib::InPeriod(Wtest,
|
||||
0,
|
||||
myPeriod);
|
||||
W = Wtest-Eps;
|
||||
}
|
||||
|
||||
// Find the index
|
||||
Standard_Boolean Trouve = Standard_False;
|
||||
|
@@ -52,7 +52,13 @@ class Geom_BSplineCurve;
|
||||
//! The Curve from BRepAdaptor allows to use a Wire
|
||||
//! of the BRep topology like a 3D curve.
|
||||
//! Warning: With this class of curve, C0 and C1 continuities
|
||||
//! are not assumed. So be carful with some algorithm!
|
||||
//! are not assumed. So be careful with some algorithm!
|
||||
//! Please note that BRepAdaptor_CompCurve cannot be
|
||||
//! periodic curve at all (even if it contains single
|
||||
//! periodic edge).
|
||||
//!
|
||||
//! BRepAdaptor_CompCurve can only work on valid wires where all edges are
|
||||
//! connected to each other to make a chain.
|
||||
class BRepAdaptor_CompCurve : public Adaptor3d_Curve
|
||||
{
|
||||
public:
|
||||
@@ -75,10 +81,6 @@ public:
|
||||
//! Sets wire <W> and trimmed parameter.
|
||||
Standard_EXPORT void Initialize (const TopoDS_Wire& W, const Standard_Boolean KnotByCurvilinearAbcissa, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol);
|
||||
|
||||
//! Set the flag Periodic.
|
||||
//! Warning: This method has no effect if the wire is not closed
|
||||
Standard_EXPORT void SetPeriodic (const Standard_Boolean Periodic);
|
||||
|
||||
//! Returns the wire.
|
||||
Standard_EXPORT const TopoDS_Wire& Wire() const;
|
||||
|
||||
|
@@ -115,8 +115,9 @@ void BRepBndLib::Add(const TopoDS_Shape& S, Bnd_Box& B, Standard_Boolean useTria
|
||||
}
|
||||
else {
|
||||
for (;ex2.More();ex2.Next()) {
|
||||
BC.Initialize(TopoDS::Edge(ex2.Current()));
|
||||
BndLib_Add3dCurve::Add(BC, BRep_Tool::Tolerance(F), B);
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(ex2.Current());
|
||||
BC.Initialize(anEdge);
|
||||
BndLib_Add3dCurve::Add(BC, BRep_Tool::Tolerance(anEdge), B);
|
||||
}
|
||||
B.Enlarge(BRep_Tool::Tolerance(F));
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include <Precision.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <Geom2dAPI_ProjectPointOnCurve.hxx>
|
||||
|
||||
static const Standard_Real Probing_Start = 0.123;
|
||||
static const Standard_Real Probing_End = 0.7;
|
||||
@@ -41,27 +42,28 @@ BRepClass_FaceExplorer::BRepClass_FaceExplorer(const TopoDS_Face& F) :
|
||||
myFace(F),
|
||||
myCurEdgeInd(1),
|
||||
myCurEdgePar(Probing_Start)
|
||||
{
|
||||
{
|
||||
myFace.Orientation(TopAbs_FORWARD);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepClass_FaceExplorer::CheckPoint(gp_Pnt2d& thePoint)
|
||||
Standard_Boolean BRepClass_FaceExplorer::CheckPoint(gp_Pnt2d& thePoint)
|
||||
{
|
||||
Standard_Real anUMin = 0.0, anUMax = 0.0, aVMin = 0.0, aVMax = 0.0;
|
||||
TopLoc_Location aLocation;
|
||||
const Handle(Geom_Surface)& aSurface = BRep_Tool::Surface(myFace, aLocation);
|
||||
aSurface->Bounds(anUMin, anUMax, aVMin, aVMax);
|
||||
if (Precision::IsInfinite(anUMin) || Precision::IsInfinite(anUMax) ||
|
||||
Precision::IsInfinite(aVMin) || Precision::IsInfinite(aVMax))
|
||||
Precision::IsInfinite(aVMin) || Precision::IsInfinite(aVMax))
|
||||
{
|
||||
BRepTools::UVBounds(myFace, anUMin, anUMax, aVMin, aVMax);
|
||||
if (Precision::IsInfinite(anUMin) || Precision::IsInfinite(anUMax) ||
|
||||
Precision::IsInfinite(aVMin) || Precision::IsInfinite(aVMax))
|
||||
Precision::IsInfinite(aVMin) || Precision::IsInfinite(aVMax))
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -71,14 +73,14 @@ Standard_Boolean BRepClass_FaceExplorer::CheckPoint(gp_Pnt2d& thePoint)
|
||||
Standard_Real aDistance = aCenterPnt.Distance(thePoint);
|
||||
if (Precision::IsInfinite(aDistance))
|
||||
{
|
||||
thePoint.SetCoord(anUMin - ( anUMax - anUMin ),
|
||||
aVMin - ( aVMax - aVMin ));
|
||||
thePoint.SetCoord (anUMin - (anUMax - anUMin ),
|
||||
aVMin - (aVMax - aVMin ));
|
||||
return Standard_False;
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real anEpsilon = Epsilon(aDistance);
|
||||
if (anEpsilon > Max(anUMax - anUMin, aVMax - aVMin))
|
||||
if (anEpsilon > Max (anUMax - anUMin, aVMax - aVMin))
|
||||
{
|
||||
gp_Vec2d aLinVec(aCenterPnt, thePoint);
|
||||
gp_Dir2d aLinDir(aLinVec);
|
||||
@@ -124,7 +126,7 @@ Standard_Boolean BRepClass_FaceExplorer::OtherSegment(const gp_Pnt2d& P,
|
||||
gp_Lin2d& L,
|
||||
Standard_Real& Par)
|
||||
{
|
||||
TopExp_Explorer anExpF(myFace,TopAbs_EDGE);
|
||||
TopExp_Explorer anExpF(myFace, TopAbs_EDGE);
|
||||
Standard_Integer i;
|
||||
Standard_Real aFPar;
|
||||
Standard_Real aLPar;
|
||||
@@ -137,7 +139,7 @@ Standard_Boolean BRepClass_FaceExplorer::OtherSegment(const gp_Pnt2d& P,
|
||||
if (i != myCurEdgeInd)
|
||||
continue;
|
||||
|
||||
const TopoDS_Shape &aLocalShape = anExpF.Current();
|
||||
const TopoDS_Shape &aLocalShape = anExpF.Current();
|
||||
const TopAbs_Orientation anOrientation = aLocalShape.Orientation();
|
||||
|
||||
if (anOrientation == TopAbs_FORWARD || anOrientation == TopAbs_REVERSED) {
|
||||
@@ -146,27 +148,29 @@ Standard_Boolean BRepClass_FaceExplorer::OtherSegment(const gp_Pnt2d& P,
|
||||
aC2d = BRep_Tool::CurveOnSurface(anEdge, myFace, aFPar, aLPar);
|
||||
|
||||
if (!aC2d.IsNull()) {
|
||||
// Treatment of infinite cases.
|
||||
if (Precision::IsNegativeInfinite(aFPar)) {
|
||||
if (Precision::IsPositiveInfinite(aLPar)) {
|
||||
aFPar = -1.;
|
||||
aLPar = 1.;
|
||||
} else {
|
||||
aFPar = aLPar - 1.;
|
||||
}
|
||||
} else if (Precision::IsPositiveInfinite(aLPar))
|
||||
aLPar = aFPar + 1.;
|
||||
// Treatment of infinite cases.
|
||||
if (Precision::IsNegativeInfinite(aFPar)) {
|
||||
if (Precision::IsPositiveInfinite(aLPar)) {
|
||||
aFPar = -1.;
|
||||
aLPar = 1.;
|
||||
}
|
||||
else {
|
||||
aFPar = aLPar - 1.;
|
||||
}
|
||||
}
|
||||
else if (Precision::IsPositiveInfinite(aLPar))
|
||||
aLPar = aFPar + 1.;
|
||||
|
||||
for (; myCurEdgePar < Probing_End ;myCurEdgePar += Probing_Step) {
|
||||
aParamIn = myCurEdgePar*aFPar + (1. - myCurEdgePar)*aLPar;
|
||||
for (; myCurEdgePar < Probing_End; myCurEdgePar += Probing_Step) {
|
||||
aParamIn = myCurEdgePar*aFPar + (1. - myCurEdgePar)*aLPar;
|
||||
|
||||
gp_Vec2d aTanVec;
|
||||
aC2d->D1(aParamIn, aPOnC, aTanVec);
|
||||
Par = aPOnC.SquareDistance(P);
|
||||
aC2d->D1(aParamIn, aPOnC, aTanVec);
|
||||
Par = aPOnC.SquareDistance(P);
|
||||
|
||||
if (Par > aTolParConf2) {
|
||||
gp_Vec2d aLinVec(P, aPOnC);
|
||||
gp_Dir2d aLinDir(aLinVec);
|
||||
if (Par > aTolParConf2) {
|
||||
gp_Vec2d aLinVec(P, aPOnC);
|
||||
gp_Dir2d aLinDir(aLinVec);
|
||||
|
||||
Standard_Real aTanMod = aTanVec.SquareMagnitude();
|
||||
if (aTanMod < aTolParConf2)
|
||||
@@ -174,8 +178,10 @@ Standard_Boolean BRepClass_FaceExplorer::OtherSegment(const gp_Pnt2d& P,
|
||||
aTanVec /= Sqrt(aTanMod);
|
||||
Standard_Real aSinA = aTanVec.Crossed(aLinDir.XY());
|
||||
const Standard_Real SmallAngle = 0.001;
|
||||
Standard_Boolean isSmallAngle = Standard_False;
|
||||
if (Abs(aSinA) < SmallAngle)
|
||||
{
|
||||
isSmallAngle = Standard_True;
|
||||
// The line from the input point P to the current point on edge
|
||||
// is tangent to the edge curve. This condition is bad for classification.
|
||||
// Therefore try to go to another point in the hope that there will be
|
||||
@@ -185,28 +191,62 @@ Standard_Boolean BRepClass_FaceExplorer::OtherSegment(const gp_Pnt2d& P,
|
||||
continue;
|
||||
}
|
||||
|
||||
L = gp_Lin2d(P, aLinDir);
|
||||
L = gp_Lin2d(P, aLinDir);
|
||||
|
||||
// Check if ends of a curve lie on a line.
|
||||
aC2d->D0(aFPar, aPOnC);
|
||||
// Check if ends of a curve lie on a line.
|
||||
aC2d->D0(aFPar, aPOnC);
|
||||
Standard_Real aFDist = P.SquareDistance(aPOnC);
|
||||
if (L.SquareDistance(aPOnC) > aTolParConf2) {
|
||||
aC2d->D0(aLPar, aPOnC);
|
||||
if (L.SquareDistance(aPOnC) > aTolParConf2) {
|
||||
Standard_Real aLDist = P.SquareDistance(aPOnC);
|
||||
|
||||
if (L.SquareDistance(aPOnC) > aTolParConf2) {
|
||||
aC2d->D0(aLPar, aPOnC);
|
||||
if (isSmallAngle)
|
||||
{
|
||||
//Try to find minimal distance between curve and line
|
||||
|
||||
if (L.SquareDistance(aPOnC) > aTolParConf2) {
|
||||
myCurEdgePar += Probing_Step;
|
||||
Geom2dAPI_ProjectPointOnCurve aProj;
|
||||
aProj.Init(P, aC2d, aFPar, aLPar);
|
||||
if (aProj.NbPoints() > 0)
|
||||
{
|
||||
Standard_Real aMinDist = aProj.LowerDistance();
|
||||
aMinDist *= aMinDist;
|
||||
Standard_Real aTMin = aProj.LowerDistanceParameter();
|
||||
if (aMinDist > aFDist)
|
||||
{
|
||||
aMinDist = aFDist;
|
||||
aTMin = aFPar;
|
||||
}
|
||||
if (aMinDist > aLDist)
|
||||
{
|
||||
aMinDist = aLDist;
|
||||
aTMin = aLPar;
|
||||
}
|
||||
if (aMinDist < Par)
|
||||
{
|
||||
Par = aMinDist;
|
||||
if (Par < aTolParConf2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
aC2d->D1(aTMin, aPOnC, aTanVec);
|
||||
aLinDir.SetXY(aTanVec.XY());
|
||||
L = gp_Lin2d(P, aLinDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
myCurEdgePar += Probing_Step;
|
||||
if (myCurEdgePar >= Probing_End) {
|
||||
myCurEdgeInd++;
|
||||
myCurEdgePar = Probing_Start;
|
||||
}
|
||||
|
||||
if (myCurEdgePar >= Probing_End) {
|
||||
myCurEdgeInd++;
|
||||
myCurEdgePar = Probing_Start;
|
||||
}
|
||||
|
||||
Par = Sqrt(Par);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Par = Sqrt(Par);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // if (!aC2d.IsNull()) {
|
||||
} // if (anOrientation == TopAbs_FORWARD ...
|
||||
|
||||
@@ -217,7 +257,7 @@ Standard_Boolean BRepClass_FaceExplorer::OtherSegment(const gp_Pnt2d& P,
|
||||
|
||||
// nothing found, return an horizontal line
|
||||
Par = RealLast();
|
||||
L = gp_Lin2d(P,gp_Dir2d(1,0));
|
||||
L = gp_Lin2d(P, gp_Dir2d(1, 0));
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -135,10 +135,10 @@ void BRepClass_Intersector::Perform(const gp_Lin2d& L,
|
||||
IntRes2d_Domain DL;
|
||||
//
|
||||
if(P!=RealLast()) {
|
||||
DL.SetValues(L.Location(),0.,aTolZ,ElCLib::Value(P,L),P,aTolZ);
|
||||
DL.SetValues(L.Location(),0.,Precision::PConfusion(),ElCLib::Value(P,L),P,Precision::PConfusion());
|
||||
}
|
||||
else {
|
||||
DL.SetValues(L.Location(),0.,aTolZ,Standard_True);
|
||||
DL.SetValues(L.Location(),0.,Precision::PConfusion(),Standard_True);
|
||||
}
|
||||
|
||||
IntRes2d_Domain DE(pdeb,deb,toldeb,pfin,fin,tolfin);
|
||||
|
@@ -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
|
||||
}
|
||||
}
|
@@ -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;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@@ -385,10 +385,8 @@ BRepFill_PipeShell::BRepFill_PipeShell(const TopoDS_Wire& Spine)
|
||||
if (Affich)
|
||||
DBRep::Set("theguide", TheGuide);
|
||||
#endif
|
||||
// transform the guide in a single curve (periodic if posssible)
|
||||
Handle(BRepAdaptor_HCompCurve) Guide =
|
||||
new (BRepAdaptor_HCompCurve) (TheGuide);
|
||||
Guide->ChangeCurve().SetPeriodic(Standard_True);
|
||||
// transform the guide in a single curve
|
||||
Handle(BRepAdaptor_HCompCurve) Guide = new (BRepAdaptor_HCompCurve) (TheGuide);
|
||||
|
||||
if (CurvilinearEquivalence) { // trihedron by curvilinear reduced abscissa
|
||||
if (KeepContact == BRepFill_Contact ||
|
||||
|
@@ -361,9 +361,12 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
|
||||
case GeomAbs_Ellipse:
|
||||
case GeomAbs_Hyperbola:
|
||||
case GeomAbs_Parabola:
|
||||
// Two points on straight segment, Four points on otheranalitical curves
|
||||
iNbPoints = (c.GetType() == GeomAbs_Line ? 2 : 4);
|
||||
Standard_FALLTHROUGH
|
||||
if (c.GetType() == GeomAbs_Line)
|
||||
// Two points on straight segment
|
||||
iNbPoints=2;
|
||||
else
|
||||
// Four points on otheranalitical curves
|
||||
iNbPoints=4;
|
||||
default:
|
||||
{
|
||||
// Put some points on other curves
|
||||
|
@@ -131,10 +131,10 @@ BRepLib_MakeWire::BRepLib_MakeWire(const TopoDS_Wire& W,
|
||||
|
||||
void BRepLib_MakeWire::Add(const TopoDS_Wire& W)
|
||||
{
|
||||
TopExp_Explorer ex(W,TopAbs_EDGE);
|
||||
while (ex.More()) {
|
||||
Add(TopoDS::Edge(ex.Current()));
|
||||
ex.Next();
|
||||
for (TopoDS_Iterator it(W); it.More(); it.Next()) {
|
||||
Add(TopoDS::Edge(it.Value()));
|
||||
if (myError != BRepLib_WireDone)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include <BRepLib_WireError.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <BRepLib_MakeShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
@@ -172,14 +173,14 @@ private:
|
||||
};
|
||||
|
||||
void CollectCoincidentVertices(const TopTools_ListOfShape& theL,
|
||||
NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL);
|
||||
NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL);
|
||||
|
||||
void CreateNewVertices(const NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL,
|
||||
NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex>& theO2NV);
|
||||
TopTools_DataMapOfShapeShape& theO2NV);
|
||||
|
||||
void CreateNewListOfEdges(const TopTools_ListOfShape& theL,
|
||||
const NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex>& theO2NV,
|
||||
TopTools_ListOfShape& theNewEList);
|
||||
const TopTools_DataMapOfShapeShape& theO2NV,
|
||||
TopTools_ListOfShape& theNewEList);
|
||||
|
||||
void Add(const TopoDS_Edge& E, Standard_Boolean IsCheckGeometryProximity);
|
||||
|
||||
|
@@ -58,7 +58,7 @@ void BRepLib_MakeWire::Add(const TopTools_ListOfShape& L)
|
||||
|
||||
CollectCoincidentVertices(L, aGrVL);
|
||||
|
||||
NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex> anO2NV;
|
||||
TopTools_DataMapOfShapeShape anO2NV;
|
||||
|
||||
CreateNewVertices(aGrVL, anO2NV);
|
||||
|
||||
@@ -155,8 +155,10 @@ Standard_Boolean BRepLib_MakeWire::BRepLib_BndBoxVertexSelector::
|
||||
Standard_Real aTolV = BRep_Tool::Tolerance(aV);
|
||||
|
||||
Standard_Real aL = myP.SquareDistance(aVPnt);
|
||||
Standard_Real aTol = aTolV + mySTol;
|
||||
aTol *= aTol;
|
||||
|
||||
if (aL < Max(aTolV*aTolV, mySTol))
|
||||
if (aL <= aTol)
|
||||
{
|
||||
myResultInd.Append(theObj);
|
||||
return Standard_True;
|
||||
@@ -176,7 +178,7 @@ void BRepLib_MakeWire::BRepLib_BndBoxVertexSelector::
|
||||
myP = theP;
|
||||
myVBox.Add(myP);
|
||||
myVBox.Enlarge(theTol);
|
||||
mySTol = theTol*theTol;
|
||||
mySTol = theTol;
|
||||
myVInd = theVInd;
|
||||
}
|
||||
|
||||
@@ -188,17 +190,13 @@ void BRepLib_MakeWire::CollectCoincidentVertices(const TopTools_ListOfShape& the
|
||||
NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL)
|
||||
{
|
||||
TopTools_IndexedMapOfShape anAllV;
|
||||
TopTools_ListIteratorOfListOfShape anItL;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMV2EL;
|
||||
|
||||
TopExp::MapShapesAndAncestors(myShape, TopAbs_VERTEX, TopAbs_EDGE, aMV2EL);
|
||||
TopExp_Explorer exp;
|
||||
for (anItL.Initialize(theL); anItL.More(); anItL.Next())
|
||||
TopExp::MapShapesAndAncestors(anItL.Value(), TopAbs_VERTEX, TopAbs_EDGE, aMV2EL);
|
||||
TopExp::MapShapes(myShape, TopAbs_VERTEX, anAllV);
|
||||
|
||||
for (int i = 1; i <= aMV2EL.Extent(); i++)
|
||||
if (aMV2EL(i).Extent() == 1)
|
||||
anAllV.Add(aMV2EL.FindKey(i));
|
||||
TopTools_ListIteratorOfListOfShape anItL(theL);
|
||||
for (; anItL.More(); anItL.Next())
|
||||
TopExp::MapShapes(anItL.Value(), TopAbs_VERTEX, anAllV);
|
||||
|
||||
//aV2CV : vertex <-> its coincident vertices
|
||||
NCollection_DataMap<TopoDS_Vertex, NCollection_Map<TopoDS_Vertex>> aV2CV;
|
||||
@@ -303,8 +301,8 @@ void BRepLib_MakeWire::CollectCoincidentVertices(const TopTools_ListOfShape& the
|
||||
//function : CreateNewVertices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepLib_MakeWire::CreateNewVertices(const NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL,
|
||||
NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex>& theO2NV)
|
||||
void BRepLib_MakeWire::CreateNewVertices(const NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL,
|
||||
TopTools_DataMapOfShapeShape& theO2NV)
|
||||
{
|
||||
//map [old vertex => new vertex]
|
||||
//note that already existing shape (i.e. the original ones)
|
||||
@@ -356,7 +354,7 @@ void BRepLib_MakeWire::CreateNewVertices(const NCollection_List<NCollection_List
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepLib_MakeWire::CreateNewListOfEdges(const TopTools_ListOfShape& theL,
|
||||
const NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex>& theO2NV,
|
||||
const TopTools_DataMapOfShapeShape& theO2NV,
|
||||
TopTools_ListOfShape& theNewEList)
|
||||
{
|
||||
///create the new list (theNewEList) from the input list L
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <BRepMesh_Vertex.hxx>
|
||||
#include <BRepMesh_Triangle.hxx>
|
||||
|
||||
#include <Message_ProgressSentry.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -304,6 +305,17 @@ void BRepMesh_Delaun::compute(BRepMesh::Array1OfInteger& theVertexIndexes)
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::createTriangles(const Standard_Integer theVertexIndex,
|
||||
BRepMesh::MapOfIntegerInteger& thePoly)
|
||||
{
|
||||
createTriangles (theVertexIndex, thePoly, NULL);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : createTriangles
|
||||
//purpose : Creates the triangles beetween the node and the polyline.
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::createTriangles(const Standard_Integer theVertexIndex,
|
||||
BRepMesh::MapOfIntegerInteger& thePoly,
|
||||
Message_ProgressSentry* theProgressEntry)
|
||||
{
|
||||
BRepMesh::ListOfInteger aLoopEdges, anExternalEdges;
|
||||
const gp_XY& aVertexCoord = myMeshData->GetNode( theVertexIndex ).Coord();
|
||||
@@ -311,6 +323,10 @@ void BRepMesh_Delaun::createTriangles(const Standard_Integer theVertexIn
|
||||
BRepMesh::MapOfIntegerInteger::Iterator anEdges( thePoly );
|
||||
for ( ; anEdges.More(); anEdges.Next() )
|
||||
{
|
||||
if (theProgressEntry != NULL && !theProgressEntry->More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
Standard_Integer anEdgeId = anEdges.Key();
|
||||
const BRepMesh_Edge& anEdge = GetEdge( anEdgeId );
|
||||
|
||||
@@ -408,6 +424,10 @@ void BRepMesh_Delaun::createTriangles(const Standard_Integer theVertexIn
|
||||
|
||||
while ( !aLoopEdges.IsEmpty() )
|
||||
{
|
||||
if (theProgressEntry != NULL && !theProgressEntry->More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
const BRepMesh_Edge& anEdge = GetEdge( Abs( aLoopEdges.First() ) );
|
||||
if ( anEdge.Movability() != BRepMesh_Deleted )
|
||||
{
|
||||
@@ -425,6 +445,17 @@ void BRepMesh_Delaun::createTriangles(const Standard_Integer theVertexIn
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
BRepMesh::Array1OfInteger& theVertexIndexes)
|
||||
{
|
||||
createTrianglesOnNewVertices (theVertexIndexes, NULL);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : createTrianglesOnNewVertices
|
||||
//purpose : Creation of triangles from the new nodes
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
BRepMesh::Array1OfInteger& theVertexIndexes,
|
||||
Message_ProgressSentry* theProgressEntry)
|
||||
{
|
||||
Handle(NCollection_IncAllocator) aAllocator =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
@@ -440,6 +471,11 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
Standard_Integer anUpper = theVertexIndexes.Upper();
|
||||
for( ; anIndex <= anUpper; ++anIndex )
|
||||
{
|
||||
if (theProgressEntry != NULL && !theProgressEntry->More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
aAllocator->Reset(Standard_False);
|
||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
|
||||
@@ -483,6 +519,11 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
isModify = Standard_True;
|
||||
while ( isModify && !aCirclesList.IsEmpty() )
|
||||
{
|
||||
if (theProgressEntry != NULL && !theProgressEntry->More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
isModify = Standard_False;
|
||||
BRepMesh::ListOfInteger::Iterator aCircleIt1( aCirclesList );
|
||||
for ( ; aCircleIt1.More(); aCircleIt1.Next() )
|
||||
@@ -503,13 +544,25 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
}
|
||||
}
|
||||
|
||||
if (theProgressEntry != NULL && !theProgressEntry->More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Creation of triangles with the current node and free edges
|
||||
// and removal of these edges from the list of free edges
|
||||
createTriangles( aVertexIdx, aLoopEdges );
|
||||
createTriangles( aVertexIdx, aLoopEdges, theProgressEntry );
|
||||
}
|
||||
}
|
||||
if (theProgressEntry != NULL && !theProgressEntry->More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
insertInternalEdges();
|
||||
insertInternalEdges (theProgressEntry);
|
||||
if (theProgressEntry != NULL && !theProgressEntry->More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Adjustment of meshes to boundary edges
|
||||
frontierAdjust();
|
||||
@@ -520,6 +573,15 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::insertInternalEdges()
|
||||
{
|
||||
insertInternalEdges (NULL);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : insertInternalEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::insertInternalEdges (Message_ProgressSentry* theProgressEntry)
|
||||
{
|
||||
BRepMesh::HMapOfInteger anInternalEdges = InternalEdges();
|
||||
|
||||
@@ -530,6 +592,11 @@ void BRepMesh_Delaun::insertInternalEdges()
|
||||
BRepMesh::MapOfInteger::Iterator anInernalEdgesIt( *anInternalEdges );
|
||||
for ( ; anInernalEdgesIt.More(); anInernalEdgesIt.Next() )
|
||||
{
|
||||
if (theProgressEntry != NULL && !theProgressEntry->More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Integer aLinkIndex = anInernalEdgesIt.Key();
|
||||
const BRepMesh_PairOfIndex& aPair = myMeshData->ElementsConnectedTo(aLinkIndex);
|
||||
|
||||
@@ -2094,12 +2161,21 @@ void BRepMesh_Delaun::RemoveVertex( const BRepMesh_Vertex& theVertex )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AddVertices
|
||||
//purpose : Adds some vertices in the triangulation.
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::AddVertices(BRepMesh::Array1OfVertexOfDelaun& theVertices)
|
||||
{
|
||||
AddVertices (theVertices, NULL);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddVertices
|
||||
//purpose : Adds some vertices in the triangulation.
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::AddVertices(BRepMesh::Array1OfVertexOfDelaun& theVertices,
|
||||
Message_ProgressSentry* theProgressEntry)
|
||||
{
|
||||
std::make_heap(theVertices.begin(), theVertices.end(), ComparatorOfVertexOfDelaun());
|
||||
std::sort_heap(theVertices.begin(), theVertices.end(), ComparatorOfVertexOfDelaun());
|
||||
@@ -2111,7 +2187,7 @@ void BRepMesh_Delaun::AddVertices(BRepMesh::Array1OfVertexOfDelaun& theVertices)
|
||||
for ( Standard_Integer i = aLower; i <= anUpper; ++i )
|
||||
aVertexIndexes(i) = myMeshData->AddNode( theVertices(i) );
|
||||
|
||||
createTrianglesOnNewVertices( aVertexIndexes );
|
||||
createTrianglesOnNewVertices( aVertexIndexes, theProgressEntry );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user