1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

Compare commits

..

44 Commits

Author SHA1 Message Date
jgv
728c380e48 Next version. 2017-10-03 14:25:12 +03:00
jgv
57fe037f72 Next version 2017-10-03 14:25:11 +03:00
jgv
93177d3925 Next version. 2017-10-03 14:25:10 +03:00
jgv
b5d7966899 Fix of exceptions 2017-10-03 14:25:09 +03:00
jgv
96a70b3f8f Creation of the test cases for new functionality. 2017-10-03 14:25:08 +03:00
jgv
43f72b89dd 0029003: Implementation of the algorithm for replacing faces in shape with new faces based on other surfaces
Implementation of the algorithm for replacing faces in shape with new faces based on other surfaces - BRepOffsetAPI_PatchFaces.

The algorithm runs the steps similar to 3d Offset algorithm for Join type Intersection (intersection of the faces with neighbors for trimming of the faces by the adjacent faces).
2017-10-03 14:25:06 +03:00
kgv
e2b4dea253 0029156: Coding Rules - eliminate deprecation compiler warnings when targeting macOS 10.12 2017-09-29 09:42:14 +03:00
kgv
b1c235dfce 0029062: Visualization, SelectMgr_ViewerSelector - add NULL-check within ::checkOverlap() method 2017-09-29 09:42:13 +03:00
anv
08b183fe0b 0028188: Improving layer color storage mechanism for DXF Import/Export
Attribute ColorByLayer was added for shapes that should be colored by the color of their layer or, if it's absent, by the parent component's layer color.

Fixing inconsistency of iterating through the map of Styles

Improving ColorByLayer mechanism

Fix for Map/IndexedMad differences.

Renaming according to convention of naming collection typedefs
2017-09-29 09:42:12 +03:00
ski
7fbc3bc5a4 0029118: Incorrect generation of reference documentation for modules
Generation of reference documentation for modules was corrected.
2017-09-29 09:42:11 +03:00
snn
a8a3b37c0d 0029119: Documentation for PMI in XCAF
Documentation is added to the XDE part of the User Guide for GD&T, Clipping planes and Saved view components.
2017-09-29 09:42:09 +03:00
nbv
6fd0eb0c1e 0028764: [Regression to 7.0] Intersection of faces gives exception in debug mode
Some point were incorrectly removed from the Walking-line.

In the current fix, new method IntWalk_PWalking::RemoveAPoint(...) has been added and implemented in order to provide safe removing.

So, now methods AddAPoint(...) and RemoveAPoint(...) are recommended to use for work with the Walking-line.
2017-09-29 09:42:08 +03:00
kgv
b5cce1ab23 0028987: Visualization, SelectMgr_SelectableObject - move out iterator from object
Added method SelectMgr_SelectableObject::Selections() and depreacted methods
Init(), More(), Next() and CurrentSelection().

Added method SelectMgr_Selection::Entities() and depreacted methods
Init(), More(), Next() and Sensitivity().

SelectMgr_SelectableObject::myAssemblyOwner has been moved to AIS_MultipleConnectedInteractive.
SelectMgr_SelectableObject::Selection() now returns NULL handle for not found selection.
SelectMgr_SelectableObject::HasSelection() is no more virtual and just retuns !Selection().IsNull().

SelectMgr_SelectionManager::mySelectors map is now declared using proper
key type Handle(SelectMgr_ViewerSelector) instead of Handle(Standard_Transient).
2017-09-29 09:42:01 +03:00
abv
746f3d7ab2 0029112: Visualization - compilation fails on Ubuntu with libavutil 54.x (FFmpeg 2.7.6)
Offending macro is undefined to allow compilation with libavutil 54.x
2017-09-28 10:47:48 +03:00
emv
ad8b073e19 0029073: Regression: General Cut produces invalid shape
Boolean Operations:
1. Face/Face intersection post treatment - Unify vertices put on the section curves, which were rejected as existing ones, with the vertices of edges by which these section curves have been rejected.

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

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

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

3. Print messages for the Warnings/Errors met during checking of the shape on self-intersection ("bopcheck" command).
2017-09-28 10:46:50 +03:00
kgv
c7ba457824 0027869: Visualization - AIS_ConnectedInteractive does not support exact HLR mode
AIS_ConnectedInteractive now shares HLR computation code with AIS_Shape.

BRepTools_WireExplorer::Orientation() now returns TopAbs_FORWARD
instead of throwing exception in case of infinite Edge without vertices.

StdSelect_BRepSelectionTool::GetSensitiveForFace() now creates Select3D_SensitiveCurve
from 2 points in case of infinite Edge instead of Select3D_SensitiveFace.
2017-09-28 10:44:24 +03:00
abv
a966092904 0028452: VIS - MSVC 14 compiler warnings
Includes of VTK headers are wrapped in #pragmas to ensure that MSVC warning messages disabled by VTK headers are still enabled for OCCT code
2017-09-28 10:42:43 +03:00
kgv
c8fe0e2db4 0029127: Visualization - V3d_View::ToPixMap() crashes on tiled rendering without FBO
Fixed out-of-memory writing within fallback View dump mode.
2017-09-28 10:41:44 +03:00
kgv
e4f0cc46a0 0029122: Visualization - improve Font_BRepFont to handle one-line-fonts
Font_SystemFont - added a new property SingleStrokeFont().
Font_BRepFont::renderGlyph() has been extended to not close contours
when flag SingleStrokeFont() has been set.
2017-09-28 10:40:29 +03:00
abv
1a6726dabb 0029107: Visualization - SelectMgr_FrustumBuilder constructor without arguments is not exported
Standard_EXPORT is added
2017-09-28 10:39:01 +03:00
kgv
8c3237d451 0028069: Visualization, TKOpenGl - handle flat shading model within GLSL programs 2017-09-28 10:36:05 +03:00
kgv
048e1b3b03 0029125: Visualization, OpenGl_Text - fix access violation within OpenGL1.1 context
OpenGl_Context::DiagnosticInformation() - added OpenGL version check before retrieving GL_SHADING_LANGUAGE_VERSION string.
2017-09-22 11:52:07 +03:00
nbv
8444aedb1d 0028150: Exception is raised during Boolean operation
ProjLib_ComputeApproxOnPolarSurface::BuildInitialCurve2d - Using the correct number of points (computed in GCPnts_QuasiUniformAbscissa class) for creation of the initial curve.
2017-09-22 11:52:05 +03:00
nbv
cd803dcd59 0029103: No intersection curve between faces if starting points are given
Sometimes the algorithm of Walking-line creation finds points out of the domain. Some such places have been detected and fixed in frame of this issue.
2017-09-22 11:52:02 +03:00
oan
71c810df61 0028824: Possibility to build OCCT 7.1.0 and above using Visual Studio 2008
Possibility to build OCCT using Visual Studio 2008 (VC9) is restored.
For that:

- template functions and classes from namespace std or tr1 (for VC9) are imported to namespace opencascade which is then used instead of std in relevant places
- templates not provided by compiler (VC9) but required for OCCT are defined in this namespace (in Standard_Handle.hxx)
- methods implementing move semantics are excluded for VC9 compiler (which does not support && syntax)
- support of vc9 compiler is restored in build procedures and environment scripts
- check of type of the current class in macros DEFINE_STANDARD_RTTI* is refactored

VS 2008 is restored in the list of supported platforms on Overview / System Requirements.
2017-09-22 11:52:00 +03:00
oan
a4ab454c0f 0027356: BRepTools::Clean() does not clean free edges from Poly_Polygon3D
Added code to clean 3D polygons on edges in BRepTools::Clean().
2017-09-22 11:51:58 +03:00
msv
28c08a7d40 0029038: Modeling - IntTools_EdgeEdge::FindParameters() hangs on bad curve
Make possibility to dramatically increase the step during iteration on the curve when the global resolution of the curve is too small.
Correct the functions FindParameters, FindBestSolution, FindDistPC.

The change caused improvement of the test case "boolean bfuse_complex E4", so the bug #27697 has been fixed.

The change caused dramatic improvement of the performance of the test "bugs modalg_7 bug27160", and the bug #29080 has been fixed.
2017-09-22 11:51:56 +03:00
szy
4621622641 0026256: FSD_File and FSD_CmpFile are almost twins. 2017-09-22 11:51:53 +03:00
msv
bfd69b5f7b 0029102: Missing points using GCPnts_QuasiUniformDeflection
Correct the method PerformCurve of GCPnts_QuasiUniformDeflection to get the proper derivative at the end of the current curve.

Improve the Draw commands "crvpoints" and "crvtpoints" so that to work with wires as composite curves.
2017-09-22 11:51:51 +03:00
emv
ca685e63ef 0026795: Unable to perform General Fuse operation on the attached faces
The problem is not reproduced in current version of OCCT.
Correction of the test case into OK state.
2017-09-22 11:51:49 +03:00
emv
d68b195fb6 0029099: Extra shapes in result of General Cut (box by ellipsoid)
Boolean Operations - when looking for the splitting parameters on the degenerated edges try not only the intersection of the 2D curve of degenerated edge with 2D curves of other edges bounded by the vertex of degenerated edge, but also the projection of the end points of the edges corresponding to the vertex on the 2d curve of degenerated edge.
2017-09-22 11:51:47 +03:00
kgv
a2560cc90c 0029096: Coding Rules - eliminate several compiler warnings in Training Samples 2017-09-22 11:51:45 +03:00
kgv
1136702b93 0029075: Configuration - fix TKService linkage errors due to usage of GLX functions while using EGL
Xw_Window, fixed usage of GLX functions for choosing Visual
when building with HAVE_EGL/HAVE_GLES2 options.
2017-09-22 11:51:42 +03:00
kgv
be7fc29e2a 0029086: Visualization, SelectMgr_ViewerSelector - drop Owners detected only by part of Entities within Box selection 2017-09-22 11:51:40 +03:00
kgv
780ee4e25c 0022048: Visualization, AIS_InteractiveContext - single object selection should always clear multiple selection
AIS_InteractiveContext::Select() now clears multiple selection when selecting a single object.
2017-09-22 11:51:38 +03:00
kgv
8e0a2b19ab 0029074: Visualization, TKOpenGl - support Geometry Shader definition
Graphic3d_TypeOfShaderObject enumeration has been extended by Geometry shader object type.
OpenGl_ShaderProgram::Initialize() processes new shader object types when supported by OpenGL version.
Declarations.glsl has been fixed so that occFragColor is defined only for
Fragment Shader object only (by handling new FRAGMENT_SHADER macros).

Improved documentation of Graphic3d_ArrayOfPrimitives class.

vshader Draw Harness command has been extended to support definition
of Shader Object types other than Vertex and Fragment shader.
2017-09-22 11:51:36 +03:00
kgv
3ed88facdb 0029084: Visualization, AIS_Manipulator - broken transformation is applied at Rotation angles near to Pi
AIS_Manipulator::ObjectTransformation() - fixed using of manipulator axes
with temporarily applied transformation (when BehaviorOnTransform::FollowRotation is TRUE).
Start axes orientation (at the beginning of Rotation) is now used instead.
2017-09-22 11:51:33 +03:00
abv
3ba79772a0 0028660: Documentation - describe how to fulfill LGPL terms in OCCT-based applications
Points considered as necessary to fulfill requirements of LGPL when OCCT is used in proprietary applications are described in Overview.
2017-09-22 11:51:31 +03:00
Benjamin Bihler
fe21f79693 0029014: Managing Binary Format Version Is Not Possible for Own TDF_Attributes
CDM_Application has been extended to provide application name and version.

Application name and version is stored by BinLDrivers_DocumentStorageDriver.

BinLDrivers_DocumentStorageDriver propagates application name and version
by passing it to BinMDataStd.

Made BinObjMgt_RRelocationTable store a handle to the header data of the file
begin read in to make it accessible by binary attribute drivers.

Undone storing application name and version as static fields in BinMDataStd
which is bad style and not thread-safe.

Moved method implementations to .cxx files.

Clearing a BinObjMgt_RRelocationTable now nullifies the reference to the
file header data and BinLDrivers_DocumentRetrievalDriver therefore sets
the reference after the relocation table has been cleared before reading
in the document subtree.
2017-09-22 11:51:29 +03:00
mkv
bcb8fa43ea 0028157: Setting the tolerance of a face to a small value and then fixing it leads to a face with vertex-vertex intersections
Problem is not reproduced on current master. Issue must be closed on 7.2.0.
Test case was added only
2017-09-22 11:51:27 +03:00
abv
4eb6e8f464 0029077: Tests - improve command testfile
Command testfile is improved to be more usable by developers for checking data files used by the new test cases before their integration to the test data base:

1. Do not check and do not report problems found in the repo when checking new files -- this check is done only when argument is "-check"

2. Can check a file located in a directory listed in CSF_TestDataPath as new one without it being considered as already in the data base

3. For new BREP files, reports warning if the file contains triangulation, suggesting that it can be removed to minimize the size

4. Can identify the same (by content) file in the data base for the new files in DOS encoding (less than 1 MB)

5. Can detect duplicates among the input files

6. Outputs result in more clear form

7. When loading STL files, uses option "triangulation" to be efficient

Automated Testing System guide is updated to describe command testfile.

Added test demo testsystem testfile
2017-09-22 11:51:25 +03:00
kgv
e3368235ea 0029083: Samples - specify multiple Make jobs within make.sh for Qt sample 2017-09-22 11:51:22 +03:00
bugmaster
4514dc74e4 0029050: SKIPPED test cases are no listed in header of summary.html
Adding list of SKIPPED test cases in header of summary.html under header Skipped:, and in the end of text log file
2017-09-22 11:51:20 +03:00
bugmaster
30017a480e Incitement OCCT version to 7.2.1 dev 2017-09-22 11:51:18 +03:00
506 changed files with 11579 additions and 15612 deletions

View File

@@ -79,7 +79,7 @@ if (WIN32)
set (CSF_OpenGlLibs "opengl32.lib")
endif()
else()
else()
if (APPLE)
set (CSF_objc "objc")
@@ -112,6 +112,5 @@ else()
set (CSF_OpenGlLibs "GL")
set (CSF_XwLibs "X11 Xext Xmu Xi")
set (CSF_dl "dl")
set (CSF_fontconfig "fontconfig")
endif()
endif()

View File

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

View File

@@ -655,6 +655,8 @@ 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
@@ -725,6 +727,16 @@ proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMod
set name OCCT
}
OCCDoc_LoadData "${productsPath}"
# Add all dependencies of modules to the graph
set additional_modules {}
foreach module $modules {
set additional_modules [list {*}$additional_modules {*}$module_dependency($module)]
}
set modules [list {*}$modules {*}$additional_modules]
set modules [lsort -unique $modules]
# Get list of header files in the specified modules
set filelist {}
foreach module $modules {

View File

@@ -1375,7 +1375,6 @@ 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"

View File

@@ -82,6 +82,8 @@ 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" (
@@ -101,12 +103,22 @@ if not "%DevEnvDir%" == "" (
) else if /I "%VCFMT%" == "gcc" (
rem MinGW
) else (
echo Error: wrong VS identifier
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
exit /B
)
rem ----- Parsing vcvarsall for qt samples and define PlatformToolset -----
if /I "%VCFMT%" == "vc10" (
if /I "%VCFMT%" == "vc9" (
set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
set "VCPlatformToolSet=v90"
) else if /I "%VCFMT%" == "vc10" (
set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
set "VCPlatformToolSet=v100"
) else if /I "%VCFMT%" == "vc11" (
@@ -126,9 +138,8 @@ if /I "%VCFMT%" == "vc10" (
) else if /I "%VCFMT%" == "gcc" (
rem MinGW
) else (
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
echo Error: wrong VS identifier
exit /B
)
set "CSF_OPT_LIB32D=%CSF_OPT_LIB32%"

View File

@@ -52,6 +52,8 @@ 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" (
@@ -76,7 +78,10 @@ if not "%DevEnvDir%" == "" (
)
rem ----- Parsing vcvarsall for qt samples and define PlatformToolset -----
if /I "%VCFMT%" == "vc10" (
if /I "%VCFMT%" == "vc9" (
set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
set "VCPlatformToolSet=v90"
) else if /I "%VCFMT%" == "vc10" (
set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
set "VCPlatformToolSet=v100"
) else if /I "%VCFMT%" == "vc11" (

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -192,7 +192,11 @@ 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. 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.
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.
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:
@@ -218,6 +222,33 @@ fixshape result a 0.01 0.01
checkshape result
~~~~~
DRAW command testfile should be used to check the data files being used by the test for possible duplication of content or names.
The command accepts list of paths to files being checked as single argument, and will give conclusion on each of the files, for instance:
~~~~~
Draw[1]> testfile [glob /my/data/path/bug12345*]
Collecting info on test data files repository...
Checking new file(s)...
* /my/data/path/bug12345.brep: duplicate
already present under name bug28773_1.brep
--> //server/occt_tests_data/public/brep/bug28773_1.brep
* /my/data/path/cadso.brep: new file
Warning: DOS encoding detected, consider converting to
UNIX unless DOS line ends are needed for the test
Warning: shape contains triangulation (946 triangles),
consider removing them unless they are needed for the test!
BREP size=201 KiB, nbfaces=33, nbedges=94 -> private
* /my/data/path/case_8_wire3.brep: already present
--> //server/occt_tests_data/public/brep/case_8_wire3.brep
* /my/data/path/case_8_wire4.brep: error
name is already used by existing file
--> //server/occt_tests_data/public/brep/case_8_wire4.brep
~~~~~
@section testmanual_2 Organization of Test Scripts
@subsection testmanual_2_1 General Layout

View File

@@ -1437,10 +1437,3 @@ 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.

View File

@@ -28,13 +28,22 @@ 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".
Alternatively, Open CASCADE Technology may be used under the terms of Open
CASCADE commercial license or contractual agreement.
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.
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
@@ -196,9 +205,9 @@ for which OCCT is certified to work.
| OS | Compiler |
| --------- | ----------- |
| 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)|
| 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)|
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
| OS X | XCode 6 or newer |
| OS X / macOS | XCode 6 or newer |
| Android | NDK r10, GNU gcc 4.8 or newer |
1) VC++ 10 64-bit is used for regular testing and for building

View File

@@ -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="http://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="https://www.cax-if.org/documents/rec_pracs_pmi_v40.pdf">Recommended practices for the Representation and Presentation of Product Manufacturing</a> for AP242.
The general restriction is that OCCT STEP Reader imports GD&T assigned only to shapes (faces, edges, vertices, etc) or to shape groups from general shape model i.e. any constructive geometries are not translated as referenced shapes.
#### Dimensions

View File

@@ -91,26 +91,59 @@ 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 Custom notes
@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
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.
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.
Notes API provides the following functionality:
* Returns total number of notes and annotated items
* Returns labels for all notes and annotated items
* Returns the 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
* 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
- 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.
@section occt_xde_2 Working with XDE
@@ -504,7 +537,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*. 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*.
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*.
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.
@@ -627,29 +660,274 @@ To remove a Color and all the references to it (so that the related shapes will
myColors->RemoveColor(ColLabel);
~~~~~
@subsection occt_xde_2_7 Custom notes
@subsection occt_xde_2_7 Geometric Dimensions & Tolerances (GD&T)
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.
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.
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.
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.
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_7_1 Initialization
@subsubsection occt_xde_2_10_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 the following notes calls and will not be repeated for these.
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.
@subsubsection occt_xde_2_7_2 Creating Notes
@subsubsection occt_xde_2_10_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.
~~~~~
@@ -658,13 +936,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_7_3 Editing a Note
@subsubsection occt_xde_2_10_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 need to down cast *myNote* handle to the appropriate sub-class:
To change specific data one needs to down cast *myNote* handle to the appropriate sub-class:
~~~~~
Handle(XCAFDoc_NoteComment) myCommentNote = Handle(XCAFDoc_NoteComment)::DownCast(myNote);
if (!myCommentNote.IsNull()) {
@@ -672,12 +950,12 @@ if (!myCommentNote.IsNull()) {
}
~~~~~
@subsubsection occt_xde_2_7_4 Adding Notes
@subsubsection occt_xde_2_10_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.
~~~~~
@@ -690,14 +968,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 to label 0.1.9.2 with *XCAFDoc_AssemblyItemRef* attribute with *XCAFDoc_GraphNode* attributes added to this and note labels.
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.
@subsubsection occt_xde_2_7_5 Finding Notes
@subsubsection occt_xde_2_10_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 = ...
@@ -711,9 +989,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.
~~~~~
@@ -729,12 +1007,12 @@ TDF_LabelSequence theNotesSubshape;
myNotes->GetAttrSubshape(theLabel, theSubshape, theNotesSubshape);
~~~~~
@subsubsection occt_xde_2_7_6 Removing Notes
@subsubsection occt_xde_2_10_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 = ...
@@ -746,30 +1024,31 @@ 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_7_7 Deleting Notes
@subsubsection occt_xde_2_10_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 excepting the last one break all links with Document items as well.
All these methods except for the last one break all links with Document items as well.
@subsection occt_xde_2_8 Reading and Writing STEP or IGES
@subsection occt_xde_2_11 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, Validation Properties (Centroid, Volume, Area), and Assembly Structure are hierarchic with rigid motion.
* XDE provides mapping with data other than Shapes. Names, Colors, Layers, GD&T, Clipping planes, Views, Validation Properties (Centroid, Volume, Area), and Assembly Structure are hierarchic with rigid motion. Currently, Clipping planes and Views writing supported for XBF format only.
* XDE mapping is relevant for use within the Advanced level of Data Exchanges, rather than Standard ones, because a higher level of information is better suited to a higher quality of shapes. In addition, this allows to avoid the multiplicity of combinations between various options. Note that this choice is not one of architecture but of practical usage and packaging.
* Reader and Writer classes for XDE are generally used like those for Shapes. However, their use is adapted to manage a Document rather than a Shape.
The packages to manage this are *IGESCAFControl* for IGES, and *STEPCAFControl* for STEP.
@subsubsection occt_xde_2_8_1 Reading a STEP file
@subsubsection occt_xde_2_11_1 Reading a STEP file
To read a STEP file by itself, use:
~~~~~
@@ -790,7 +1069,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_8_2 Writing a STEP file
@subsubsection occt_xde_2_11_2 Writing a STEP file
To write a STEP file by itself, use:
~~~~~
@@ -811,18 +1090,19 @@ if ( ! writer.Transfer ( Doc, mode ) ) {
IFSelect_ReturnStatus stat = writer.Write(file-name);
~~~~~
@subsubsection occt_xde_2_8_3 Reading an IGES File
@subsubsection occt_xde_2_11_3 Reading an IGES File
Use the same procedure as for a STEP file but with IGESCAFControl instead of STEPCAFControl.
@subsubsection occt_xde_2_8_4 Writing an IGES File
@subsubsection occt_xde_2_11_4 Writing an IGES File
Use the same procedure as for a STEP file but with IGESCAFControl instead of STEPCAFControl.
@subsection occt_xde_2_9 Using an XDE Document
@subsection occt_xde_2_12 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_91 XDE Data inside an Application Document
@subsubsection occt_xde_2_12_1 XDE Data inside an Application Document
To have XCAF data elsewhere than under label 0.1, you use the DocLabel of XDE. The method DocLabel from XCAFDoc_DocumentTool determines the relevant Label for XCAF. However, note that the default is 0.1.
In addition, as XDE data is defined and managed in a modular way, you can consider exclusively Assembly Structure, only Colors, and so on.

View File

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

View File

@@ -3,19 +3,24 @@
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 test "${QTDIR}" == ""; then
echo "Environment variable \"QTDIR\" not defined. Define it in \"custom.sh\" script."
exit 1
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
fi
host=`uname -s`
export STATION=$host
export PATH=${QTDIR}/bin:${PATH}

View File

@@ -1,13 +1,14 @@
#!/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 debug
make -j $aNbJobs debug
else
make release
make -j $aNbJobs release
fi
fi

View File

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

View File

@@ -3,20 +3,25 @@
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 test "${QTDIR}" == ""; then
echo "Environment variable \"QTDIR\" not defined. Define it in \"custom.sh\" script."
exit 1
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
fi
host=`uname -s`
export STATION=$host
export RES_DIR=${aSamplePath}/${STATION}/res
export PATH=${QTDIR}/bin:${PATH}

View File

@@ -1,13 +1,14 @@
#!/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 debug
make -j $aNbJobs debug
else
make release
make -j $aNbJobs release
fi
fi

View File

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

View File

@@ -3,20 +3,25 @@
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 test "${QTDIR}" == ""; then
echo "Environment variable \"QTDIR\" not defined. Define it in \"custom.sh\" script."
exit 1
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
fi
host=`uname -s`
export STATION=$host
export RES_DIR=${aSamplePath}/${STATION}/res
export PATH=${QTDIR}/bin:${PATH}

View File

@@ -1,13 +1,14 @@
#!/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 debug
make -j $aNbJobs debug
else
make release
make -j $aNbJobs release
fi
fi

View File

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

View File

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

View File

@@ -9,8 +9,6 @@ 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
@@ -25,12 +23,11 @@ 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
eval vdisplay -dispMode 1 $slist
vsetdispmode 1
eval vdisplay $slist
vfit
# measure FPS
@@ -38,14 +35,16 @@ puts [set fps_separate [vfps]]
vclear
puts "Measuring FPS of display of spheres as single object..."
vdisplay -dispMode 1 c
eval compound $slist c
vdisplay c
# measure FPS
puts [set fps_compound [vfps]]
vclear
# redisplay individual spheres, trying to avoid unnecessary internal updates
eval vdisplay -dispMode 1 $slist
#vfrustumculling 0 ;# try to disable updates of frustum culling structures
eval vdisplay -mutable $slist
# auxiliary procedure to make random update of variable
proc upd {theValueName theDeltaName theTime theToRand} {
@@ -70,10 +69,8 @@ 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
uplevel #0 vaspects -noupdate s$i$j$k -setcolor red
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
@@ -145,4 +142,4 @@ puts "Animation FPS: $fps_animation"
puts ""
puts "Scene contains [lindex [trinfo c] 3] triangles"
puts ""
puts "Print 'animateSpheres 10.0' to restart animation"
puts "Print 'animateSpheres 10.0' to restart animation"

View File

@@ -783,7 +783,6 @@ 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)
{
@@ -802,6 +801,7 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
{
aPlane = surf2->Plane();
aSurfType = AIS_KOS_Plane;
Offset = 0.;
Result = Standard_True;
}
@@ -817,6 +817,7 @@ 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;
}
}
@@ -825,6 +826,7 @@ 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)
{
@@ -837,6 +839,7 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
TheType == STANDARD_TYPE(Geom_ToroidalSurface))
{
aSurf = (Handle( Geom_OffsetSurface )::DownCast( aSurf ))->Surface();
Offset = 0.0e0;
}
else
{
@@ -896,18 +899,20 @@ gp_Pnt AIS::ProjectPointOnLine( const gp_Pnt & aPoint, const gp_Lin & aLine )
//function : InitFaceLength
//purpose :
//=======================================================================
void AIS::InitFaceLength (const TopoDS_Face& theFace,
gp_Pln& thePlane,
Handle(Geom_Surface)& theSurface,
AIS_KindOfSurface& theSurfaceType,
Standard_Real& theOffset)
void AIS::InitFaceLength (const TopoDS_Face& aFace,
gp_Pln & aPlane,
Handle(Geom_Surface) & aSurface,
AIS_KindOfSurface & aSurfaceType,
Standard_Real & anOffset)
{
if (AIS::GetPlaneFromFace (theFace, thePlane, theSurface, theSurfaceType, theOffset)
&& Abs (theOffset) > Precision::Confusion())
{
theSurface = new Geom_OffsetSurface (theSurface, theOffset);
theOffset = 0.0e0;
}
AIS::GetPlaneFromFace( aFace, aPlane, aSurface, aSurfaceType, anOffset );
if (Abs( anOffset ) > Precision::Confusion())
{
aSurface = new Geom_OffsetSurface( aSurface, anOffset );
anOffset = 0.0e0;
}
}
//=======================================================================

View File

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

View File

@@ -164,54 +164,10 @@ void AIS_ConnectedInteractive::Compute(const Handle(Prs3d_Projector)& aProjector
//purpose :
//=======================================================================
void AIS_ConnectedInteractive::Compute (const Handle(Prs3d_Projector)& theProjector,
const Handle(Prs3d_Presentation)& thePresentation,
const Handle(Prs3d_Presentation)& thePrs,
const TopoDS_Shape& theShape)
{
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);
}
}
AIS_Shape::computeHlrPresentation (theProjector, thePrs, theShape, myDrawer);
}
//=======================================================================
@@ -277,9 +233,9 @@ void AIS_ConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selectio
myReference->RecomputePrimitives (theMode);
}
for (TheRefSel->Init(); TheRefSel->More(); TheRefSel->Next())
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (TheRefSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{
aSensitive = Handle(Select3D_SensitiveEntity)::DownCast (TheRefSel->Sensitive()->BaseSensitive());
aSensitive = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive());
if (!aSensitive.IsNull())
{
// Get the copy of SE3D
@@ -304,38 +260,28 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
Shapes2EntitiesMap;
if (!myReference->HasSelection (theMode))
{
myReference->RecomputePrimitives (theMode);
const Handle(SelectMgr_Selection)& aRefSel = myReference->Selection (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;
Handle(Select3D_SensitiveEntity) aSE, aNewSE;
// Fill in the map of subshapes and corresponding sensitive entities associated with aMode
Shapes2EntitiesMap aShapes2EntitiesMap;
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())
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aRefSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{
aSE = Handle(Select3D_SensitiveEntity)::DownCast (aRefSel->Sensitive()->BaseSensitive());
if(!aSE.IsNull())
if (Handle(Select3D_SensitiveEntity) aSE = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
{
anOwner = Handle(StdSelect_BRepOwner)::DownCast (aSE->OwnerId());
if(!anOwner.IsNull())
if (Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast (aSE->OwnerId()))
{
aSubShape = anOwner->Shape();
const TopoDS_Shape& aSubShape = anOwner->Shape();
if(!aShapes2EntitiesMap.IsBound (aSubShape))
{
aShapes2EntitiesMap.Bind (aSubShape, aSEList);
aShapes2EntitiesMap.Bind (aSubShape, SensitiveList());
}
aShapes2EntitiesMap (aSubShape).Append (aSE);
}
@@ -345,20 +291,14 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
// Fill in selection from aShapes2EntitiesMap
for (Shapes2EntitiesMap::Iterator aMapIt (aShapes2EntitiesMap); aMapIt.More(); aMapIt.Next())
{
aSEList = aMapIt.Value();
anOwner = new StdSelect_BRepOwner (aMapIt.Key(),
this,
aSEList.First()->OwnerId()->Priority(),
Standard_True);
const SensitiveList& aSEList = aMapIt.Value();
Handle(StdSelect_BRepOwner) 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())
{
aSE = aListIt.Value();
aNewSE = aSE->GetConnected();
Handle(Select3D_SensitiveEntity) aSE = aListIt.Value();
Handle(Select3D_SensitiveEntity) aNewSE = aSE->GetConnected();
aNewSE->Set (anOwner);
theSelection->Add (aNewSE);
}
}

View File

@@ -335,31 +335,31 @@ TCollection_ExtendedString AIS_Dimension::GetValueString (Standard_Real& theWidt
if (myDrawer->DimensionAspect()->IsText3d())
{
// text width produced by BRepFont
Font_BRepFont aFont;
if (aFont.FindAndInit (aTextAspect->Aspect()->Font(), aTextAspect->Aspect()->GetTextFontAspect(), aTextAspect->Height(), Font_StrictLevel_Any))
Font_BRepFont aFont (aTextAspect->Aspect()->Font().ToCString(),
aTextAspect->Aspect()->GetTextFontAspect(),
aTextAspect->Height());
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
{
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
{
Standard_Utf32Char aCurrChar = *anIter;
Standard_Utf32Char aNextChar = *(++anIter);
theWidth += aFont.AdvanceX (aCurrChar, aNextChar);
}
Standard_Utf32Char aCurrChar = *anIter;
Standard_Utf32Char aNextChar = *(++anIter);
theWidth += aFont.AdvanceX (aCurrChar, aNextChar);
}
}
else
{
// Text width for 1:1 scale 2D case
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))
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; )
{
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
{
Standard_Utf32Char aCurrChar = *anIter;
Standard_Utf32Char aNextChar = *(++anIter);
theWidth += (Standard_Real) aFont->AdvanceX (aCurrChar, aNextChar);
}
Standard_Utf32Char aCurrChar = *anIter;
Standard_Utf32Char aNextChar = *(++anIter);
theWidth += (Standard_Real) aFont->AdvanceX (aCurrChar, aNextChar);
}
}

View File

@@ -186,11 +186,11 @@ AIS_InteractiveContext::~AIS_InteractiveContext()
Handle(AIS_InteractiveContext) aNullContext;
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
Handle(AIS_InteractiveObject) anObj = anObjIter.Key();
const Handle(AIS_InteractiveObject)& anObj = anObjIter.Key();
anObj->SetContext (aNullContext);
for (anObj->Init(); anObj->More(); anObj->Next())
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
{
anObj->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Renew);
aSelIter.Value()->UpdateBVHStatus (SelectMgr_TBU_Renew);
}
}
}
@@ -692,15 +692,13 @@ void AIS_InteractiveContext::DisplaySelected (const Standard_Boolean theToUpdate
return;
}
Standard_Boolean isFound = Standard_False;
for (mySelection->Init(); mySelection->More(); mySelection->Next())
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (mySelection->Value()->Selectable());
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
Display (anObj, Standard_False);
isFound = Standard_True;
}
if (isFound && theToUpdateViewer)
if (theToUpdateViewer && !mySelection->Objects().IsEmpty())
{
myMainVwr->Update();
}
@@ -717,17 +715,12 @@ void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateVi
return;
}
Standard_Boolean isFound = Standard_False;
mySelection->Init();
while (mySelection->More())
Standard_Boolean isFound = Standard_False;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Init (mySelection->Objects()))
{
Handle(SelectMgr_EntityOwner) anOwner = mySelection->Value();
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
Erase (anObj, Standard_False);
isFound = Standard_True;
mySelection->Init();
}
if (isFound && theToUpdateViewer)
@@ -2858,15 +2851,14 @@ 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 (aSelection->Init(); aSelection->More(); aSelection->Next())
for (AIS_NListOfEntityOwner::Iterator aSelIter (aSelection->Objects()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner)& anOwner = aSelection->Value();
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
if (anObj->IsInfinite())
{

View File

@@ -1386,7 +1386,14 @@ protected: //! @name internal methods
if (myLastinMain.IsNull())
return;
myLastinMain->Selectable()->ClearDynamicHighlight (myMainPM);
if (myLastinMain->IsAutoHilight())
{
myMainPM->ClearImmediateDraw();
}
else
{
myLastinMain->Selectable()->ClearDynamicHighlight (myMainPM);
}
}
protected: //! @name internal fields

View File

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

View File

@@ -202,9 +202,8 @@ Load(const Handle(AIS_InteractiveObject)& anInteractive,
{
if (myActiveObjects.IsBound (anInteractive))
{
if (anInteractive->HasSelection (ActivationMode))
if (const Handle(SelectMgr_Selection)& aSel = anInteractive->Selection (ActivationMode))
{
const Handle(SelectMgr_Selection)& aSel = anInteractive->Selection (ActivationMode);
if (aSel->GetSelectionState() != SelectMgr_SOS_Activated)
{
if (!myMainVS->Contains (anInteractive))
@@ -864,24 +863,26 @@ const Handle(AIS_LocalStatus)& AIS_LocalContext::Status(const Handle(AIS_Interac
void AIS_LocalContext::LoadContextObjects()
{
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);
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);
}
myActiveObjects.Bind(anObj,Att);
}
}

View File

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

View File

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

View File

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

View File

@@ -43,6 +43,22 @@ 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 :
@@ -384,22 +400,19 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
// Initialize start reference data
if (!myHasStartedTransformation)
{
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
myStartTrsfs.Clear();
for (Standard_Integer anIt = anObjects->Lower(); anIt <= anObjects->Upper(); ++anIt)
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
for (AIS_ManipulatorObjectSequence::Iterator anObjIter (*anObjects); anObjIter.More(); anObjIter.Next())
{
myStartTrsfs.Append (anObjects->Value (anIt)->LocalTransformation());
myStartTrsfs.Append (anObjIter.Value()->LocalTransformation());
}
myStartPosition = myPosition;
}
// Get 3d point with projection vector
Graphic3d_Vec3d anInputPoint;
Graphic3d_Vec3d aProj;
Graphic3d_Vec3d anInputPoint, aProj;
theView->ConvertWithProj (theMaxX, theMaxY, anInputPoint.x(), anInputPoint.y(), anInputPoint.z(), 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();
const gp_Lin anInputLine (gp_Pnt (anInputPoint.x(), anInputPoint.y(), anInputPoint.z()), gp_Dir (aProj.x(), aProj.y(), aProj.z()));
switch (myCurrentMode)
{
case AIS_MM_Translation:
@@ -410,7 +423,7 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
GeomAPI_ExtremaCurveCurve anExtrema (anInputCurve, aCurve);
gp_Pnt aP1, aP2;
anExtrema.NearestPoints (aP1, aP2);
aNewPosition = aP2;
const gp_Pnt aNewPosition = aP2;
if (!myHasStartedTransformation)
{
@@ -427,26 +440,28 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
gp_Trsf aNewTrsf;
aNewTrsf.SetTranslation (gp_Vec(myStartPick, aNewPosition));
theTrsf *= aNewTrsf;
break;
return Standard_True;
}
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 (myPosition.Location(), myAxes[myCurrentIndex].Position().Direction());
Handle(Geom_Surface) aSurface = new Geom_Plane (aPosLoc, aCurrAxis.Direction());
GeomAPI_IntCS aIntersector (anInputCurve, aSurface);
if (!aIntersector.IsDone() || aIntersector.NbPoints() < 1)
{
return Standard_False;
}
aNewPosition = aIntersector.Point (1);
const gp_Pnt aNewPosition = aIntersector.Point (1);
if (!myHasStartedTransformation)
{
myStartPick = aNewPosition;
myHasStartedTransformation = Standard_True;
gp_Dir aStartAxis = gce_MakeDir (myPosition.Location(), myStartPick);
myPrevState = aStartAxis.AngleWithRef (gce_MakeDir(myPosition.Location(), aNewPosition), myAxes[myCurrentIndex].Position().Direction());
gp_Dir aStartAxis = gce_MakeDir (aPosLoc, myStartPick);
myPrevState = aStartAxis.AngleWithRef (gce_MakeDir(aPosLoc, aNewPosition), aCurrAxis.Direction());
return Standard_True;
}
@@ -455,17 +470,17 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
return Standard_False;
}
gp_Dir aStartAxis = myPosition.Location().IsEqual (myStartPick, Precision::Confusion())
? myAxes[(myCurrentIndex + 1) % 3].Position().Direction()
: gce_MakeDir (myPosition.Location(), myStartPick);
gp_Dir aStartAxis = aPosLoc.IsEqual (myStartPick, Precision::Confusion())
? getAx1FromAx2Dir (myStartPosition, (myCurrentIndex + 1) % 3).Direction()
: gce_MakeDir (aPosLoc, myStartPick);
gp_Dir aCurrentAxis = gce_MakeDir (myPosition.Location(), aNewPosition);
Standard_Real anAngle = aStartAxis.AngleWithRef (aCurrentAxis, myAxes[myCurrentIndex].Position().Direction());
gp_Dir aCurrentAxis = gce_MakeDir (aPosLoc, aNewPosition);
Standard_Real anAngle = aStartAxis.AngleWithRef (aCurrentAxis, aCurrAxis.Direction());
// Change value of an angle if it should have different sign.
if (anAngle * myPrevState < 0 && Abs (anAngle) < M_PI_2)
{
Standard_ShortReal aSign = myPrevState > 0 ? -1.0f : 1.0f;
Standard_Real aSign = myPrevState > 0 ? -1.0 : 1.0;
anAngle = aSign * (M_PI * 2 - anAngle);
}
@@ -475,10 +490,10 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
}
gp_Trsf aNewTrsf;
aNewTrsf.SetRotation (myAxes[myCurrentIndex].Position(), anAngle);
aNewTrsf.SetRotation (aCurrAxis, anAngle);
theTrsf *= aNewTrsf;
myPrevState = anAngle;
break;
return Standard_True;
}
case AIS_MM_Scaling:
{
@@ -486,7 +501,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 aTmp;
gp_Pnt aNewPosition, aTmp;
anExtrema.NearestPoints (aTmp, aNewPosition);
if (!myHasStartedTransformation)
@@ -508,13 +523,14 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
aNewTrsf.SetScale (myPosition.Location(), aCoeff);
theTrsf = aNewTrsf;
break;
return Standard_True;
}
case AIS_MM_None:
{
return Standard_False;
}
}
return Standard_True;
return Standard_False;
}
//=======================================================================
@@ -544,18 +560,19 @@ void AIS_Manipulator::StopTransform (const Standard_Boolean theToApply)
}
myHasStartedTransformation = Standard_False;
if (!theToApply)
if (theToApply)
{
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
for (Standard_Integer anIt = anObjects->Lower(); anIt <= anObjects->Upper(); ++anIt)
{
anObjects->Value (anIt)->SetLocalTransformation (myStartTrsfs(anIt));
}
SetPosition (myStartPosition);
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())
{
anObjIter.ChangeValue()->SetLocalTransformation (aTrsfIter.Value());
}
SetPosition (myStartPosition);
}
//=======================================================================
@@ -569,11 +586,14 @@ void AIS_Manipulator::Transform (const gp_Trsf& theTrsf)
return;
}
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
for (Standard_Integer anIt = anObjects->Lower(); anIt <= anObjects->Upper(); ++anIt)
{
anObjects->Value (anIt)->SetLocalTransformation (theTrsf * myStartTrsfs(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());
}
}
if ((myCurrentMode == AIS_MM_Translation && myBehaviorOnTransform.FollowTranslation)
@@ -613,10 +633,9 @@ void AIS_Manipulator::SetPosition (const gp_Ax2& thePosition)
|| !myPosition.XDirection().IsEqual (thePosition.XDirection(), Precision::Angular()))
{
myPosition = thePosition;
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()));
myAxes[0].SetPosition (getAx1FromAx2Dir (thePosition, 0));
myAxes[1].SetPosition (getAx1FromAx2Dir (thePosition, 1));
myAxes[2].SetPosition (getAx1FromAx2Dir (thePosition, 2));
updateTransformation();
}
}
@@ -1005,8 +1024,7 @@ void AIS_Manipulator::Disk::Init (const Standard_ShortReal theInnerRadius,
gp_Ax3 aSystem (myPosition.Location(), myPosition.Direction());
gp_Trsf aTrsf;
aTrsf.SetTransformation (aSystem, gp_Ax3());
myArray = aTool.CreateTriangulation (aTrsf);
myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
aTool.FillArray (myArray, myTriangulation, aTrsf);
}
//=======================================================================
@@ -1025,8 +1043,7 @@ 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));
myArray = aTool.CreateTriangulation (aTrsf);
myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
aTool.FillArray (myArray, myTriangulation, aTrsf);
}
//=======================================================================
@@ -1062,24 +1079,24 @@ void AIS_Manipulator::Cube::Init (const gp_Ax1& thePosition, const Standard_Shor
addTriangle (1, aBottomLeft, aV3, aV4, -thePosition.Direction());
// Front
addTriangle (2, aV3, aV5, aV4, -aFront);
addTriangle (3, aV3, aTopRight, aV5, -aFront);
addTriangle (2, aV3, aV4, aV5, aFront);
addTriangle (3, aV3, aV5, aTopRight, aFront);
// Back
addTriangle (4, aBottomLeft, aV7, aV2, aFront);
addTriangle (5, aBottomLeft, aV6, aV7, aFront);
addTriangle (4, aBottomLeft, aV2, aV7, -aFront);
addTriangle (5, aBottomLeft, aV7, aV6, -aFront);
// aTop
addTriangle (6, aV7, aV6, aV5, thePosition.Direction());
addTriangle (7, aTopRight, aV7, aV5, thePosition.Direction());
// Left
addTriangle (8, aV6, aV4, aV5, aRight);
addTriangle (9, aBottomLeft, aV4, aV6, aRight);
//Left
addTriangle (8, aV6, aV5, aV4, -aRight);
addTriangle (9, aBottomLeft, aV6, aV4, -aRight);
// Right
addTriangle (10, aV3, aV7, aTopRight, -aRight);
addTriangle (11, aV3, aV2, aV7, -aRight);
addTriangle (10, aV3, aTopRight, aV7, aRight);
addTriangle (11, aV3, aV7, aV2, aRight);
}
//=======================================================================
@@ -1150,7 +1167,6 @@ 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);
@@ -1172,7 +1188,6 @@ 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());

View File

@@ -215,18 +215,18 @@ public:
//! @return true if manipulator is attached to some interactive object (has owning object).
Standard_Boolean IsAttached() const { return HasOwner(); }
//! @return true if some part of manipulator is selected (tranformation mode is active, and owning object can be rtansformated).
//! @return true if some part of manipulator is selected (transformation mode is active, and owning object can be transformed).
Standard_Boolean HasActiveMode() const { return IsAttached() && myCurrentMode != AIS_MM_None; }
Standard_Boolean HasActiveTransformation() { return myHasStartedTransformation; }
gp_Trsf StartTransformation() const { return myStartTrsfs.Size() < 1 ? gp_Trsf() : myStartTrsfs(1); }
gp_Trsf StartTransformation() const { return !myStartTrsfs.IsEmpty() ? myStartTrsfs.First() : gp_Trsf(); }
gp_Trsf StartTransformation (const Standard_Integer theIndex) const
gp_Trsf StartTransformation (Standard_Integer theIndex) const
{
Standard_ProgramError_Raise_if (theIndex < 1 || theIndex > Objects()->Upper(),
"AIS_Manipulator::StartTransformation(): theIndex is out of bounds");
return myStartTrsfs.Size() < 1 ? gp_Trsf() : myStartTrsfs (theIndex);
return !myStartTrsfs.IsEmpty() ? myStartTrsfs (theIndex) : gp_Trsf();
}
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 overriden by this class.
//! presentations are overridden 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 presenatation.
//! @note Manipulator presentation does not use display mode and for all modes has the same presentation.
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] Seldction mode that is treated as transformation mode.
//! @param theNode [in] Selection 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() overriden methods.
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden 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 Auxilliary classes to fill presentation with proper primitives
protected: //! @name Auxiliary 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 manipualtor object. it displayes its location and position of its axes.
gp_Ax2 myPosition; //!< Position of the manipulator object. it displays its location and position of its axes.
Standard_Integer myCurrentIndex; //!< Index of active axis.
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipualtion mode.
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipulation 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 trnasformation. Fields only for internal needs. They do not have public interface.
protected: //! @name Fields for interactive transformation. 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 trnasformation. 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 colour current detected part and current selected part.
//! Aspect used to color current detected part and current selected part.
Handle(Prs3d_ShadingAspect) myHighlightAspect;
public:

View File

@@ -30,14 +30,13 @@ 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;
}
//=======================================================================
@@ -213,53 +212,27 @@ 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)
{
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;
}
}
//=======================================================================
//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))
return Standard_False;
}
{
aChild->RecomputePrimitives (theMode);
}
return Standard_True;
Handle(SelectMgr_Selection) aSelection = new SelectMgr_Selection (theMode);
aChild->ComputeSelection (aSelection, theMode);
}
}
//=======================================================================

View File

@@ -72,12 +72,11 @@ public:
//! may be decomposed into sub-shapes for dynamic selection.
Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE;
//! Returns the owner of mode for selection of object as a whole
Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() 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 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;
//! Returns the owner of mode for selection of object as a whole
virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE { return myAssemblyOwner; }
//! Assigns interactive context.
Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& theCtx) Standard_OVERRIDE;
@@ -142,6 +141,10 @@ private:
//! Computes the selection for whole subtree in scene hierarchy.
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
protected:
Handle(SelectMgr_EntityOwner) myAssemblyOwner;
};
DEFINE_STANDARD_HANDLE(AIS_MultipleConnectedInteractive, AIS_InteractiveObject)

View File

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

View File

@@ -35,6 +35,8 @@
#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>
@@ -157,14 +159,11 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
OCC_CATCH_SIGNALS
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
}
catch (Standard_Failure)
catch (Standard_Failure const& anException)
{
#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);
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::Compute() wireframe presentation builder has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
}
break;
}
@@ -191,11 +190,11 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
&& !myDrawer->ShadingAspect()->Aspect()->TextureMap().IsNull(),
myUVOrigin, myUVRepeat, myUVScale);
}
catch (Standard_Failure)
catch (Standard_Failure const& anException)
{
#ifdef OCCT_DEBUG
cout << "AIS_Shape::Compute() in ShadingMode failed" << endl;
#endif
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::Compute() shaded presentation builder has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
}
}
@@ -227,150 +226,88 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
}
//=======================================================================
//function : Compute
//purpose : Hidden Line Removal
//function : computeHlrPresentation
//purpose :
//=======================================================================
void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation)
void AIS_Shape::computeHlrPresentation (const Handle(Prs3d_Projector)& theProjector,
const Handle(Prs3d_Presentation)& thePrs,
const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer)
{
Compute(aProjector,aPresentation,myshape);
}
//=======================================================================
//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;
if (theShape.IsNull())
{
return;
}
Handle (Prs3d_Drawer) defdrawer = GetContext()->DefaultDrawer();
if (defdrawer->DrawHiddenLine())
{myDrawer->EnableDrawHiddenLine();}
else {myDrawer->DisableDrawHiddenLine();}
Aspect_TypeOfDeflection prevdef = defdrawer->TypeOfDeflection();
defdrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
if (myDrawer->IsAutoTriangulation())
switch (theShape.ShapeType())
{
// 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))
case TopAbs_VERTEX:
case TopAbs_EDGE:
case TopAbs_WIRE:
{
BRepTools::Clean(SH);
thePrs->SetDisplayPriority (4);
StdPrs_WFShape::Add (thePrs, theShape, theDrawer);
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())
{
try {
theDrawer->EnableDrawHiddenLine();
}
else
{
theDrawer->DisableDrawHiddenLine();
}
const Aspect_TypeOfDeflection aPrevDef = aDefDrawer->TypeOfDeflection();
aDefDrawer->SetTypeOfDeflection (Aspect_TOD_RELATIVE);
if (theDrawer->IsAutoTriangulation())
{
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (theShape, theDrawer, Standard_True);
}
{
try
{
OCC_CATCH_SIGNALS
switch (TypeOfHLR()) {
switch (theDrawer->TypeOfHLR())
{
case Prs3d_TOH_Algo:
StdPrs_HLRShape::Add (aPresentation, SH, myDrawer, aProjector);
StdPrs_HLRShape::Add (thePrs, theShape, theDrawer, theProjector);
break;
case Prs3d_TOH_PolyAlgo:
default:
StdPrs_HLRPolyShape::Add (aPresentation, SH, myDrawer, aProjector);
StdPrs_HLRPolyShape::Add (thePrs, theShape, theDrawer, theProjector);
break;
}
}
catch (Standard_Failure) {
#ifdef OCCT_DEBUG
cout <<"AIS_Shape::Compute(Proj) HLR Algorithm failed" << endl;
#endif
StdPrs_WFShape::Add(aPresentation,SH,myDrawer);
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);
}
}
defdrawer->SetTypeOfDeflection (prevdef);
aDefDrawer->SetTypeOfDeflection (aPrevDef);
}
//=======================================================================
//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 :
@@ -393,7 +330,8 @@ 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,
@@ -402,9 +340,14 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
aDeflection,
myDrawer->HLRAngle(),
myDrawer->IsAutoTriangulation());
} catch ( Standard_Failure ) {
// cout << "a Shape should be incorrect : A Selection on the Bnd is activated "<<endl;
if ( aMode == 0 ) {
}
catch (Standard_Failure const& anException)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::ComputeSelection(" + aMode + ") has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
if (aMode == 0)
{
aSelection->Clear();
Bnd_Box B = BoundingBox();
Handle(StdSelect_BRepOwner) aOwner = new StdSelect_BRepOwner(shape,this);

View File

@@ -211,23 +211,42 @@ public:
//! Returns the transparency attributes of the shape accordingly to
//! the current facing model;
Standard_EXPORT virtual Standard_Real Transparency() const Standard_OVERRIDE;
//! 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);
//! 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;
}
public: //! @name methods to alter texture mapping properties
@@ -256,13 +275,31 @@ public: //! @name methods to alter texture mapping properties
protected:
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;
//! 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 void LoadRecomputable (const Standard_Integer TheMode);
@@ -274,9 +311,13 @@ protected:
Standard_EXPORT void setMaterial (const Handle(Prs3d_Drawer)& theDrawer, const Graphic3d_MaterialAspect& theMaterial, const Standard_Boolean theToKeepColor, const Standard_Boolean theToKeepTransp) const;
private:
public:
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation, const TopoDS_Shape& ashape);
//! 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);
protected:

View File

@@ -261,14 +261,14 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
if (myHasFlipping)
{
// Get width and height of text
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))
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))
{
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;

View File

@@ -458,7 +458,7 @@ GeomAbs_CurveType Adaptor2d_OffsetCurve::GetType() const {
return GeomAbs_Circle;
default:
return GeomAbs_OffsetCurve;
return GeomAbs_OtherCurve;
}
}
@@ -650,27 +650,3 @@ 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);
}

View File

@@ -174,8 +174,6 @@ public:
Standard_EXPORT Handle(Geom2d_BSplineCurve) BSpline() const Standard_OVERRIDE;
Standard_EXPORT Standard_Integer NbSamples() const Standard_OVERRIDE;;

View File

@@ -68,5 +68,11 @@ Warning: Removal of internal boundaries among Faces has failed
.BOPAlgo_AlertRemovalOfIBForEdgesFailed
Warning: Removal of internal boundaries among Edges has failed
.BOPAlgo_AlertSolidBuilderUnusedFaces
Warning: Some of the faces passed to the Solid Builder algorithm have not been classified and not used for solids creation
.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

View File

@@ -78,7 +78,14 @@ DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertShellSplitterFailed)
//! Some edges are too small and have no valid range
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertTooSmallEdge)
//! 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)
//! 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)
#endif // _BOPAlgo_Alerts_HeaderFile

View File

@@ -71,5 +71,11 @@ static const char BOPAlgo_BOPAlgo_msg[] =
".BOPAlgo_AlertRemovalOfIBForEdgesFailed\n"
"Warning: Removal of internal boundaries among Edges has failed\n"
"\n"
".BOPAlgo_AlertSolidBuilderUnusedFaces\n"
"Warning: Some of the faces passed to the Solid Builder algorithm have not been classified and not used for solids creation\n";
".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";

View File

@@ -18,7 +18,6 @@
#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>
@@ -128,7 +127,127 @@ 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;
//
//=======================================================================
//=======================================================================
@@ -647,29 +766,49 @@ 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);
//
Standard_Integer aNbA = myAreas.Extent();
aNbA=myAreas.Extent();
//
// Fill Tree with boxes
// 1. aVFP
aItLS.Initialize(myLoopsInternal);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aShell=aItLS.Value();
TopoDS_Iterator aIt(aShell);
aIt.Initialize(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;
@@ -687,81 +826,146 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes()
return; // =>
}//if (!aNbA) {
//
// 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())
// 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::Add(aF, aBox);
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) {
continue;
TopTools_IndexedMapOfShape aMF;
}
//
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();
aItLS.Initialize(aLF);
for (; aItLS.More(); aItLS.Next())
{
const TopoDS_Shape& aF = aItLS.Value();
aMF.Add(aF);
aMFDone.Add(aF);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aF=aItLS.Value();
aMFs.Add(aF);
aMFProcessed.Add(aF);
}
//
aLSI.Clear();
MakeInternalShells(aMF, aLSI);
MakeInternalShells(aMFs, 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);
}
}
// 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);
//
// 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);
}
}
if (aMFUnUsed.Extent())
{
//
aNbFI=aMFs.Extent();
if (aNbFI) {
TopoDS_Solid aSolid;
aBB.MakeSolid(aSolid);
//
aLSI.Clear();
MakeInternalShells(aMFs, aLSI);
//TopoDS_Solid aShape;
//aBB.MakeSolid (aShape);
TopoDS_Compound aShape;
aBB.MakeCompound (aShape);
aItLS.Initialize (aLSI);
for (; aItLS.More(); aItLS.Next())
{
//
aItLS.Initialize(aLSI);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSI=aItLS.Value();
aBB.Add (aShape, aSI);
aBB.Add (aSolid, aSI);
}
//myAreas.Append (aShape);
AddWarning (new BOPAlgo_AlertSolidBuilderUnusedFaces (aShape));
myAreas.Append(aSolid);
}
}
//=======================================================================

View File

@@ -19,7 +19,6 @@
//
#include <Precision.hxx>
//
#include <NCollection_IncAllocator.hxx>
#include <NCollection_UBTreeFiller.hxx>
//
#include <Bnd_Box.hxx>
@@ -44,13 +43,9 @@
#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>
@@ -136,6 +131,367 @@ 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
//
//=======================================================================
@@ -184,123 +540,156 @@ void BOPAlgo_Builder::FillIn3DParts
BOPCol_DataMapOfShapeShape& theDraftSolids,
const BOPCol_BaseAllocator& )
{
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)
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) {
continue;
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);
}
//
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::Add(aSx, aBox);
aBox.SetGap(aBox.GetGap() + Precision::Confusion());
//
BOPAlgo_ShapeBox& aSB=aVSB.Append1();
aSB.SetShape(aSx);
aSB.SetBox(aBox);
}
}
else
{
aLFaces.Append(aS);
aShapeBoxMap.Add(aS, aSI.Box());
else {
const Bnd_Box& aBox=aSI.Box();
//
BOPAlgo_ShapeBox& aSB=aVSB.Append1();
aSB.SetShape(aS);
aSB.SetBox(aBox);
}
}
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));
}//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) {
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;
//
// 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);
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;
//
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);
}
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());
//
if (aNbFIN || bHasImage) {
theDraftSolids.Bind(aSolid, aSDraft);
}
}
}

View File

@@ -54,8 +54,7 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Algo(theAllocator),
myFPBDone(1, theAllocator)
BOPAlgo_Algo(theAllocator)
{
myDS = NULL;
myIterator = NULL;
@@ -287,13 +286,6 @@ 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()) {

View File

@@ -87,13 +87,19 @@ class TopoDS_Face;
//! - *Gluing options* - allows to speed up the calculation on the special
//! cases, in which some sub-shapes are coincide.<br>
//!
//! The algorithm returns the following Warning statuses:<br>
//! - *BOPAlgo_AlertSelfInterferingShape* - in case some of the argument shapes are self-interfering shapes;<br>
//! - *BOPAlgo_AlertTooSmallEdge* - in case some edges of the input shapes have no valid range;<br>
//! The algorithm returns the following Warning statuses:
//! - *BOPAlgo_AlertSelfInterferingShape* - in case some of the argument shapes are self-interfering shapes;
//! - *BOPAlgo_AlertTooSmallEdge* - in case some edges of the input shapes have no valid range;
//! - *BOPAlgo_AlertNotSplittableEdge* - in case some edges of the input shapes has such a small
//! valid range so it cannot be split;<br>
//! valid range so it cannot be split;
//! - *BOPAlgo_AlertBadPositioning* - in case the positioning of the input shapes leads to creation
//! of small edges.<br>
//! of small edges;
//! - *BOPAlgo_AlertIntersectionOfPairOfShapesFailed* - in case intersection of some of the
//! sub-shapes has failed;
//! - *BOPAlgo_AlertAcquiredSelfIntersection* - in case some sub-shapes of the argument become connected
//! through other shapes;
//! - *BOPAlgo_AlertBuildingPCurveFailed* - in case building 2D curve for some of the edges
//! on the faces has failed.
//!
//! The algorithm returns the following Error alerts:
//! - *BOPAlgo_AlertTooFewArguments* - in case there are no enough arguments to
@@ -167,9 +173,6 @@ 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()).
@@ -293,6 +296,7 @@ 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);
@@ -477,19 +481,8 @@ protected:
//! In case self-interference is found the warning is added.
Standard_EXPORT void CheckSelfInterference();
//! 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);
//! Adds the warning about failed intersection of pair of sub-shapes
Standard_EXPORT void AddIntersectionFailedWarning(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2);
BOPCol_ListOfShape myArguments;
BOPDS_PDS myDS;
@@ -501,8 +494,6 @@ protected:
Standard_Boolean myAvoidBuildPCurve;
BOPAlgo_GlueEnum myGlue;
BOPAlgo_DataMapOfIntegerMapOfPaveBlock myFPBDone; //!< Fence map of intersected faces and pave blocks
private:

View File

@@ -112,7 +112,8 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
}
//
if (aLE.Extent() > 1) {
// Add warning
// Add the acquired self-interference warning:
// The same common block contains several edges from one argument
TopoDS_Compound aWC;
aBB.MakeCompound(aWC);
//
@@ -122,7 +123,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
aBB.Add(aWC, aE1);
}
//
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
AddWarning (new BOPAlgo_AlertAcquiredSelfIntersection (aWC));
}
}
}
@@ -168,7 +169,8 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
for (j = 1; j <= aNbC; ++j) {
const BOPCol_IndexedMapOfShape& aMCS = aMCSI(j);
if (aMCS.Extent() > 1) {
// Add self-interference warning
// Add acquired self-interference warning:
// Several faces from one argument contain the same vertex or edge
TopoDS_Compound aWC;
aBB.MakeCompound(aWC);
//
@@ -177,7 +179,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
const TopoDS_Shape& aSx = aMCS(iS);
aBB.Add(aWC, aSx);
}
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
AddWarning (new BOPAlgo_AlertAcquiredSelfIntersection (aWC));
}
}
}

View File

@@ -17,6 +17,7 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
@@ -27,6 +28,7 @@
#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>
@@ -110,7 +112,16 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew, myFuzzyValue);
try
{
OCC_CATCH_SIGNALS
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew, myFuzzyValue);
}
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertIntersectionFailed);
}
};
//
protected:
@@ -267,6 +278,11 @@ 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;
}
//
@@ -491,3 +507,19 @@ void BOPAlgo_PaveFiller::SplitPaveBlocks(const BOPCol_MapOfInteger& theMEdges,
}
}
}
//=======================================================================
// function: AddIntersectionFailedWarning
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::AddIntersectionFailedWarning(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2)
{
// Create the warn shape
TopoDS_Compound aWC;
BRep_Builder().MakeCompound(aWC);
BRep_Builder().Add(aWC, theS1);
BRep_Builder().Add(aWC, theS2);
// Add the warning
AddWarning(new BOPAlgo_AlertIntersectionOfPairOfShapesFailed(aWC));
}

View File

@@ -93,7 +93,16 @@ class BOPAlgo_EdgeEdge :
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
IntTools_EdgeEdge::Perform();
try
{
OCC_CATCH_SIGNALS
IntTools_EdgeEdge::Perform();
}
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertIntersectionFailed);
}
}
//
protected:
@@ -229,7 +238,11 @@ void BOPAlgo_PaveFiller::PerformEE()
Bnd_Box aBB1, aBB2;
//
BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge(k);
if (!anEdgeEdge.IsDone()) {
if (!anEdgeEdge.IsDone() || anEdgeEdge.HasErrors()) {
// Warn about failed intersection of sub-shapes
const TopoDS_Shape& aE1 = myDS->Shape(anEdgeEdge.PaveBlock1()->OriginalEdge());
const TopoDS_Shape& aE2 = myDS->Shape(anEdgeEdge.PaveBlock2()->OriginalEdge());
AddIntersectionFailedWarning(aE1, aE2);
continue;
}
//
@@ -768,278 +781,3 @@ 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);
}

View File

@@ -17,6 +17,7 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
@@ -107,7 +108,16 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew, myFuzzyValue);
try
{
OCC_CATCH_SIGNALS
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew, myFuzzyValue);
}
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertIntersectionFailed);
}
}
//
protected:
@@ -212,7 +222,12 @@ void BOPAlgo_PaveFiller::PerformVF()
const BOPAlgo_VertexFace& aVertexFace=aVVF(k);
//
iFlag=aVertexFace.Flag();
if (iFlag) {
if (iFlag != 0) {
if (aVertexFace.HasErrors())
{
// Warn about failed intersection of sub-shapes
AddIntersectionFailedWarning(aVertexFace.Vertex(), aVertexFace.Face());
}
continue;
}
//

View File

@@ -20,7 +20,6 @@
#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>
@@ -34,11 +33,9 @@
#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>
@@ -46,15 +43,12 @@
#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 :
@@ -109,7 +103,16 @@ class BOPAlgo_EdgeFace :
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
IntTools_EdgeFace::Perform();
try
{
OCC_CATCH_SIGNALS
IntTools_EdgeFace::Perform();
}
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertIntersectionFailed);
}
}
//
protected:
@@ -253,12 +256,7 @@ 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()) {
//
@@ -269,7 +267,9 @@ void BOPAlgo_PaveFiller::PerformEF()
//
for (k=0; k < aNbEdgeFace; ++k) {
BOPAlgo_EdgeFace& aEdgeFace=aVEdgeFace(k);
if (!aEdgeFace.IsDone()) {
if (!aEdgeFace.IsDone() || aEdgeFace.HasErrors()) {
// Warn about failed intersection of sub-shapes
AddIntersectionFailedWarning(aEdgeFace.Edge(), aEdgeFace.Face());
continue;
}
//
@@ -667,351 +667,3 @@ 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);
}

View File

@@ -144,7 +144,16 @@ class BOPAlgo_FaceFace :
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
IntTools_FaceFace::Perform(myF1, myF2);
try
{
OCC_CATCH_SIGNALS
IntTools_FaceFace::Perform(myF1, myF2);
}
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertIntersectionFailed);
}
}
//
protected:
@@ -263,10 +272,12 @@ void BOPAlgo_PaveFiller::PerformFF()
for (k = 0; k < aNbFaceFace; ++k) {
BOPAlgo_FaceFace& aFaceFace = aVFaceFace(k);
aFaceFace.Indices(nF1, nF2);
if (!aFaceFace.IsDone()) {
if (!aFaceFace.IsDone() || aFaceFace.HasErrors()) {
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;
}
//
@@ -373,6 +384,7 @@ 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) {
//
@@ -557,6 +569,19 @@ 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;
@@ -639,7 +664,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
//
// post treatment
MakeSDVerticesFF(aDMVLV, aDMNewSD);
PostTreatFF(aMSCPB, aDMExEdges, aDMNewSD, aMicroEdges, aAllocator);
PostTreatFF(aMSCPB, aDMExEdges, aDMNewSD, aMicroEdges, aVertsOnRejectedPB, aAllocator);
if (HasErrors()) {
return;
}
@@ -697,6 +722,7 @@ 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();
@@ -724,8 +750,9 @@ 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)) {
if (aNbS==1 && (aNbME == 0) && (aNbVOnRPB == 0)) {
const TopoDS_Shape& aS=theMSCPB.FindKey(1);
const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromIndex(1);
//
@@ -824,6 +851,20 @@ 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);

View File

@@ -16,6 +16,7 @@
// 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>
@@ -241,28 +242,37 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
}
//
virtual void Perform() {
Standard_Integer iErr;
//
iErr=1;
if (!myEz.IsNull()) {
TopoDS_Edge aSpz;
try
{
OCC_CATCH_SIGNALS
Standard_Integer iErr;
//
BOPTools_AlgoTools::MakeSplitEdge(myEz,myV1, myT1,
myV2, myT2, 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);
}
//
iErr=
BOPTools_AlgoTools2D::AttachExistingPCurve(aSpz,
myE,
myF,
myContext);
if (iErr) {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF, myContext);
}
//
if (myFlag) {
UpdateVertices(myE, myF);
}
}
//
if (iErr) {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF, myContext);
}
//
if (myFlag) {
UpdateVertices(myE, myF);
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertBuildingPCurveFailed(TopoDS_Shape()));
}
}
//
@@ -676,6 +686,20 @@ 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

View File

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

View File

@@ -29,7 +29,6 @@
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Solid.hxx>
#include <BOPCol_BoxBndTree.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
@@ -39,8 +38,6 @@
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <BRepBndLib.hxx>
#include <TopExp_Explorer.hxx>
#include <BRepAdaptor_Curve.hxx>
@@ -67,13 +64,10 @@
#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
@@ -1094,537 +1088,3 @@ 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);
}
}

View File

@@ -21,9 +21,6 @@
#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>
@@ -158,27 +155,6 @@ 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

View File

@@ -235,6 +235,8 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
//
aTimer.Stop();
//
BOPTest::ReportAlerts(aChecker);
//
iErr=aChecker.HasErrors();
//
const BOPDS_DS& aDS=*(aChecker.PDS());

View File

@@ -994,61 +994,46 @@ Standard_Boolean BOPTools_AlgoTools::AreFacesSameDomain
Handle(IntTools_Context)& theContext,
const Standard_Real theFuzz)
{
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;
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;
}
}
if (aTolEMax > aTolF1) aTolF1 = aTolEMax;
if (aTolEMax > aTolF2) aTolF2 = aTolEMax;
}
// 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;
// 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;
}
//=======================================================================
@@ -1903,6 +1888,8 @@ Standard_Boolean GetFaceDir(const TopoDS_Edge& aE,
bFound = BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge
(aE, aF, aT, aDt, aPx, aDN, theContext);
aProjPL.Perform(aPx);
Standard_ASSERT_RETURN(aProjPL.IsDone(),
"GetFaceDir: Project point on plane is failed", Standard_False);
aPx = aProjPL.NearestPoint();
gp_Vec aVec(aP, aPx);
aDB.SetXYZ(aVec.XYZ());

View File

@@ -144,6 +144,13 @@ 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,
@@ -193,6 +200,15 @@ 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;
@@ -292,13 +308,13 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
Standard_Boolean BRepAdaptor_CompCurve::IsPeriodic() const
{
return Standard_False;
return Periodic;
}
Standard_Real BRepAdaptor_CompCurve::Period() const
{
return (TLast - TFirst);
return myPeriod;
}
gp_Pnt BRepAdaptor_CompCurve::Value(const Standard_Real U) const
@@ -459,6 +475,12 @@ 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;

View File

@@ -52,13 +52,7 @@ 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 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.
//! are not assumed. So be carful with some algorithm!
class BRepAdaptor_CompCurve : public Adaptor3d_Curve
{
public:
@@ -81,6 +75,10 @@ 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;

View File

@@ -115,9 +115,8 @@ void BRepBndLib::Add(const TopoDS_Shape& S, Bnd_Box& B, Standard_Boolean useTria
}
else {
for (;ex2.More();ex2.Next()) {
const TopoDS_Edge& anEdge = TopoDS::Edge(ex2.Current());
BC.Initialize(anEdge);
BndLib_Add3dCurve::Add(BC, BRep_Tool::Tolerance(anEdge), B);
BC.Initialize(TopoDS::Edge(ex2.Current()));
BndLib_Add3dCurve::Add(BC, BRep_Tool::Tolerance(F), B);
}
B.Enlarge(BRep_Tool::Tolerance(F));
}

View File

@@ -27,7 +27,6 @@
#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;
@@ -42,28 +41,27 @@ 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;
}
@@ -73,14 +71,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);
@@ -126,7 +124,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;
@@ -139,7 +137,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) {
@@ -148,29 +146,27 @@ 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)
@@ -178,10 +174,8 @@ 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
@@ -191,62 +185,28 @@ 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);
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);
// Check if ends of a curve lie on a line.
aC2d->D0(aFPar, aPOnC);
if (isSmallAngle)
{
//Try to find minimal distance between curve and line
if (L.SquareDistance(aPOnC) > aTolParConf2) {
aC2d->D0(aLPar, aPOnC);
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 (L.SquareDistance(aPOnC) > aTolParConf2) {
myCurEdgePar += Probing_Step;
Par = Sqrt(Par);
return Standard_True;
}
}
}
}
if (myCurEdgePar >= Probing_End) {
myCurEdgeInd++;
myCurEdgePar = Probing_Start;
}
Par = Sqrt(Par);
return Standard_True;
}
}
}
}
} // if (!aC2d.IsNull()) {
} // if (anOrientation == TopAbs_FORWARD ...
@@ -257,7 +217,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;
}

View File

@@ -135,10 +135,10 @@ void BRepClass_Intersector::Perform(const gp_Lin2d& L,
IntRes2d_Domain DL;
//
if(P!=RealLast()) {
DL.SetValues(L.Location(),0.,Precision::PConfusion(),ElCLib::Value(P,L),P,Precision::PConfusion());
DL.SetValues(L.Location(),0.,aTolZ,ElCLib::Value(P,L),P,aTolZ);
}
else {
DL.SetValues(L.Location(),0.,Precision::PConfusion(),Standard_True);
DL.SetValues(L.Location(),0.,aTolZ,Standard_True);
}
IntRes2d_Domain DE(pdeb,deb,toldeb,pfin,fin,tolfin);

View File

@@ -385,8 +385,10 @@ BRepFill_PipeShell::BRepFill_PipeShell(const TopoDS_Wire& Spine)
if (Affich)
DBRep::Set("theguide", TheGuide);
#endif
// transform the guide in a single curve
Handle(BRepAdaptor_HCompCurve) Guide = new (BRepAdaptor_HCompCurve) (TheGuide);
// transform the guide in a single curve (periodic if posssible)
Handle(BRepAdaptor_HCompCurve) Guide =
new (BRepAdaptor_HCompCurve) (TheGuide);
Guide->ChangeCurve().SetPeriodic(Standard_True);
if (CurvilinearEquivalence) { // trihedron by curvilinear reduced abscissa
if (KeepContact == BRepFill_Contact ||

View File

@@ -131,10 +131,10 @@ BRepLib_MakeWire::BRepLib_MakeWire(const TopoDS_Wire& W,
void BRepLib_MakeWire::Add(const TopoDS_Wire& W)
{
for (TopoDS_Iterator it(W); it.More(); it.Next()) {
Add(TopoDS::Edge(it.Value()));
if (myError != BRepLib_WireDone)
break;
TopExp_Explorer ex(W,TopAbs_EDGE);
while (ex.More()) {
Add(TopoDS::Edge(ex.Current()));
ex.Next();
}
}

View File

@@ -24,7 +24,6 @@
#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>
@@ -173,14 +172,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,
TopTools_DataMapOfShapeShape& theO2NV);
NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex>& theO2NV);
void CreateNewListOfEdges(const TopTools_ListOfShape& theL,
const TopTools_DataMapOfShapeShape& theO2NV,
TopTools_ListOfShape& theNewEList);
const NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex>& theO2NV,
TopTools_ListOfShape& theNewEList);
void Add(const TopoDS_Edge& E, Standard_Boolean IsCheckGeometryProximity);

View File

@@ -58,7 +58,7 @@ void BRepLib_MakeWire::Add(const TopTools_ListOfShape& L)
CollectCoincidentVertices(L, aGrVL);
TopTools_DataMapOfShapeShape anO2NV;
NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex> anO2NV;
CreateNewVertices(aGrVL, anO2NV);
@@ -155,10 +155,8 @@ 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 <= aTol)
if (aL < Max(aTolV*aTolV, mySTol))
{
myResultInd.Append(theObj);
return Standard_True;
@@ -178,7 +176,7 @@ void BRepLib_MakeWire::BRepLib_BndBoxVertexSelector::
myP = theP;
myVBox.Add(myP);
myVBox.Enlarge(theTol);
mySTol = theTol;
mySTol = theTol*theTol;
myVInd = theVInd;
}
@@ -190,13 +188,17 @@ 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::MapShapes(myShape, TopAbs_VERTEX, anAllV);
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);
TopTools_ListIteratorOfListOfShape anItL(theL);
for (; anItL.More(); anItL.Next())
TopExp::MapShapes(anItL.Value(), TopAbs_VERTEX, anAllV);
for (int i = 1; i <= aMV2EL.Extent(); i++)
if (aMV2EL(i).Extent() == 1)
anAllV.Add(aMV2EL.FindKey(i));
//aV2CV : vertex <-> its coincident vertices
NCollection_DataMap<TopoDS_Vertex, NCollection_Map<TopoDS_Vertex>> aV2CV;
@@ -301,8 +303,8 @@ void BRepLib_MakeWire::CollectCoincidentVertices(const TopTools_ListOfShape& the
//function : CreateNewVertices
//purpose :
//=======================================================================
void BRepLib_MakeWire::CreateNewVertices(const NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL,
TopTools_DataMapOfShapeShape& theO2NV)
void BRepLib_MakeWire::CreateNewVertices(const NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL,
NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex>& theO2NV)
{
//map [old vertex => new vertex]
//note that already existing shape (i.e. the original ones)
@@ -354,7 +356,7 @@ void BRepLib_MakeWire::CreateNewVertices(const NCollection_List<NCollection_List
//purpose :
//=======================================================================
void BRepLib_MakeWire::CreateNewListOfEdges(const TopTools_ListOfShape& theL,
const TopTools_DataMapOfShapeShape& theO2NV,
const NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex>& theO2NV,
TopTools_ListOfShape& theNewEList)
{
///create the new list (theNewEList) from the input list L

View File

@@ -31,7 +31,6 @@
#include <BRepMesh_Vertex.hxx>
#include <BRepMesh_Triangle.hxx>
#include <Message_ProgressSentry.hxx>
#include <NCollection_Vector.hxx>
#include <algorithm>
@@ -305,17 +304,6 @@ 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();
@@ -323,10 +311,6 @@ 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 );
@@ -424,10 +408,6 @@ 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 )
{
@@ -445,17 +425,6 @@ 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);
@@ -471,11 +440,6 @@ 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);
@@ -519,11 +483,6 @@ 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() )
@@ -544,25 +503,13 @@ 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, theProgressEntry );
createTriangles( aVertexIdx, aLoopEdges );
}
}
if (theProgressEntry != NULL && !theProgressEntry->More())
{
return;
}
insertInternalEdges (theProgressEntry);
if (theProgressEntry != NULL && !theProgressEntry->More())
{
return;
}
insertInternalEdges();
// Adjustment of meshes to boundary edges
frontierAdjust();
@@ -573,15 +520,6 @@ 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();
@@ -592,11 +530,6 @@ void BRepMesh_Delaun::insertInternalEdges (Message_ProgressSentry* theProgressEn
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);
@@ -2161,21 +2094,12 @@ 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)
void BRepMesh_Delaun::AddVertices(BRepMesh::Array1OfVertexOfDelaun& theVertices)
{
std::make_heap(theVertices.begin(), theVertices.end(), ComparatorOfVertexOfDelaun());
std::sort_heap(theVertices.begin(), theVertices.end(), ComparatorOfVertexOfDelaun());
@@ -2187,7 +2111,7 @@ void BRepMesh_Delaun::AddVertices(BRepMesh::Array1OfVertexOfDelaun& theVertices,
for ( Standard_Integer i = aLower; i <= anUpper; ++i )
aVertexIndexes(i) = myMeshData->AddNode( theVertices(i) );
createTrianglesOnNewVertices( aVertexIndexes, theProgressEntry );
createTrianglesOnNewVertices( aVertexIndexes );
}
//=======================================================================

View File

@@ -33,7 +33,6 @@
class Bnd_B2d;
class Bnd_Box2d;
class BRepMesh_Vertex;
class Message_ProgressSentry;
//! Compute the Delaunay's triangulation with the algorithm of Watson.
class BRepMesh_Delaun
@@ -62,10 +61,6 @@ public:
//! Adds some vertices into the triangulation.
Standard_EXPORT void AddVertices (BRepMesh::Array1OfVertexOfDelaun& theVertices);
//! Adds some vertices into the triangulation.
Standard_EXPORT void AddVertices (BRepMesh::Array1OfVertexOfDelaun& theVertices,
Message_ProgressSentry* theProgressEntry);
//! Modify mesh to use the edge.
//! @return True if done
Standard_EXPORT Standard_Boolean UseEdge (const Standard_Integer theEdge);
@@ -227,10 +222,6 @@ private:
void createTriangles (const Standard_Integer theVertexIndex,
BRepMesh::MapOfIntegerInteger& thePoly);
void createTriangles (const Standard_Integer theVertexIndex,
BRepMesh::MapOfIntegerInteger& thePoly,
Message_ProgressSentry* theProgressEntry);
//! Add a triangle based on the given oriented edges into mesh
void addTriangle (const Standard_Integer (&theEdgesId)[3],
const Standard_Boolean (&theEdgesOri)[3],
@@ -261,10 +252,6 @@ private:
BRepMesh::SequenceOfInteger& thePolygon,
BRepMesh::SequenceOfBndB2d& thePolyBoxes);
//! Creates the triangles on new nodes.
void createTrianglesOnNewVertices (BRepMesh::Array1OfInteger& theVertexIndices,
Message_ProgressSentry* theProgressEntry);
//! Creates the triangles on new nodes.
void createTrianglesOnNewVertices (BRepMesh::Array1OfInteger& theVertexIndices);
@@ -336,9 +323,6 @@ private:
//! Performs insertion of internal edges into mesh.
void insertInternalEdges();
//! Performs insertion of internal edges into mesh.
void insertInternalEdges (Message_ProgressSentry* theProgressEntry);
private:
Handle(BRepMesh_DataStructureOfDelaun) myMeshData;

View File

@@ -45,10 +45,10 @@ public:
return myIsDone;
}
//! Compute triangulation for set shape.
Standard_EXPORT virtual void Perform () =0;
//! Compute triangulation for set shape.
Standard_EXPORT virtual void Perform() = 0;
DEFINE_STANDARD_RTTIEXT(BRepMesh_DiscretRoot,Standard_Transient)
protected:

View File

@@ -68,7 +68,6 @@
#include <Standard_Failure.hxx>
#include <NCollection_IncAllocator.hxx>
#include <Message_ProgressSentry.hxx>
#include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
#include <BRep_PointRepresentation.hxx>
@@ -124,25 +123,15 @@ void BRepMesh_FastDiscret::Perform(const TopoDS_Shape& theShape)
OSD_Parallel::ForEach(aFaces.begin(), aFaces.end(), *this, !myParameters.InParallel);
}
//=======================================================================
//function : Process
//purpose :
//=======================================================================
void BRepMesh_FastDiscret::Process(const TopoDS_Face& theFace) const
{
Process (theFace, NULL);
}
//=======================================================================
//function : Process
//purpose :
//=======================================================================
void BRepMesh_FastDiscret::Process (const TopoDS_Face& theFace,
Message_ProgressSentry* theProgrEntry) const
{
Handle(BRepMesh_FaceAttribute) anAttribute;
if (GetFaceAttribute(theFace, anAttribute)
&& (theProgrEntry == NULL || theProgrEntry->More()))
if (GetFaceAttribute(theFace, anAttribute))
{
try
{
@@ -150,7 +139,7 @@ void BRepMesh_FastDiscret::Process (const TopoDS_Face& theFace,
BRepMesh_FastDiscretFace aTool(myParameters.Angle, myParameters.MinSize,
myParameters.InternalVerticesMode, myParameters.ControlSurfaceDeflection);
aTool.Perform (anAttribute, theProgrEntry);
aTool.Perform(anAttribute);
}
catch (Standard_Failure)
{

View File

@@ -46,7 +46,6 @@ class BRepMesh_Edge;
class BRepMesh_Vertex;
class gp_Pnt;
class BRepMesh_FaceAttribute;
class Message_ProgressSentry;
//! Algorithm to mesh a shape with respect of the <br>
//! frontier the deflection and by option the shared <br>
@@ -130,12 +129,6 @@ public:
//! parallel threads.
Standard_EXPORT void Process(const TopoDS_Face& face) const;
//! Triangulate a face previously recorded for
//! processing by call to Add(). Can be executed in
//! parallel threads.
Standard_EXPORT void Process (const TopoDS_Face& theFace,
Message_ProgressSentry* theProgrEntry) const;
void operator () (const TopoDS_Face& face) const
{
Process(face);

View File

@@ -51,7 +51,6 @@
#include <TopoDS_Vertex.hxx>
#include <TopExp.hxx>
#include <Message_ProgressSentry.hxx>
#include <NCollection_Map.hxx>
#include <Bnd_Box2d.hxx>
@@ -188,21 +187,7 @@ BRepMesh_FastDiscretFace::BRepMesh_FastDiscretFace(
//=======================================================================
void BRepMesh_FastDiscretFace::Perform(const Handle(BRepMesh_FaceAttribute)& theAttribute)
{
Perform (theAttribute, NULL);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepMesh_FastDiscretFace::Perform (const Handle(BRepMesh_FaceAttribute)& theAttribute,
Message_ProgressSentry* theProgressEntry)
{
add(theAttribute, theProgressEntry);
if (theProgressEntry != NULL && !theProgressEntry->More())
{
return;
}
add(theAttribute);
commitSurfaceTriangulation();
}
@@ -360,8 +345,7 @@ void BRepMesh_FastDiscretFace::addLinkToMesh(
//function : Add
//purpose :
//=======================================================================
void BRepMesh_FastDiscretFace::add (const Handle(BRepMesh_FaceAttribute)& theAttribute,
Message_ProgressSentry* theProgressEntry)
void BRepMesh_FastDiscretFace::add(const Handle(BRepMesh_FaceAttribute)& theAttribute)
{
if (!theAttribute->IsValid() || theAttribute->ChangeMeshNodes()->IsEmpty())
return;
@@ -413,22 +397,12 @@ void BRepMesh_FastDiscretFace::add (const Handle(BRepMesh_FaceAttribute)& theAtt
(vmax - vmin) < Precision::PConfusion());
Standard_Real aDef = -1;
if (theProgressEntry != NULL && !theProgressEntry->More())
{
return;
}
if ( !isaline && myStructure->ElementsOfDomain().Extent() > 0 )
{
if (!rajout)
{
// compute maximal deflection
aDef = control(trigu, Standard_True, theProgressEntry);
if (theProgressEntry != NULL && !theProgressEntry->More())
{
return;
}
aDef = control(trigu, Standard_True);
rajout = (aDef > myAttribute->GetDefFace() || aDef < 0.);
}
if (thetype != GeomAbs_Plane)
@@ -441,21 +415,11 @@ void BRepMesh_FastDiscretFace::add (const Handle(BRepMesh_FaceAttribute)& theAtt
if (rajout)
{
insertInternalVertices(trigu, theProgressEntry);
if (theProgressEntry != NULL && !theProgressEntry->More())
{
return;
}
insertInternalVertices(trigu);
//control internal points
if (myIsControlSurfaceDeflection)
{
aDef = control(trigu, Standard_False, theProgressEntry);
if (theProgressEntry != NULL && !theProgressEntry->More())
{
return;
}
}
aDef = control(trigu, Standard_False);
}
}
}
@@ -483,8 +447,7 @@ void BRepMesh_FastDiscretFace::add (const Handle(BRepMesh_FaceAttribute)& theAtt
//=======================================================================
Standard_Boolean BRepMesh_FastDiscretFace::addVerticesToMesh(
const BRepMesh::ListOfVertex& theVertices,
BRepMesh_Delaun& theMeshBuilder,
Message_ProgressSentry* theProgressEntry)
BRepMesh_Delaun& theMeshBuilder)
{
if (theVertices.IsEmpty())
return Standard_False;
@@ -494,8 +457,8 @@ Standard_Boolean BRepMesh_FastDiscretFace::addVerticesToMesh(
for (Standard_Integer aVertexId = 0; aVertexIt.More(); aVertexIt.Next())
aArrayOfNewVertices(++aVertexId) = aVertexIt.Value();
theMeshBuilder.AddVertices(aArrayOfNewVertices, theProgressEntry);
return theProgressEntry == NULL || theProgressEntry->More();
theMeshBuilder.AddVertices(aArrayOfNewVertices);
return Standard_True;
}
//=======================================================================
@@ -564,8 +527,7 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
//function : insertInternalVertices
//purpose :
//=======================================================================
void BRepMesh_FastDiscretFace::insertInternalVertices (BRepMesh_Delaun& theMeshBuilder,
Message_ProgressSentry* theProgressEntry)
void BRepMesh_FastDiscretFace::insertInternalVertices(BRepMesh_Delaun& theMeshBuilder)
{
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
BRepMesh::ListOfVertex aNewVertices(anAlloc);
@@ -593,7 +555,7 @@ void BRepMesh_FastDiscretFace::insertInternalVertices (BRepMesh_Delaun& theMeshB
break;
}
addVerticesToMesh(aNewVertices, theMeshBuilder, theProgressEntry);
addVerticesToMesh(aNewVertices, theMeshBuilder);
}
//=======================================================================
@@ -1220,8 +1182,7 @@ Standard_Boolean BRepMesh_FastDiscretFace::checkDeflectionAndInsert(
//=======================================================================
Standard_Real BRepMesh_FastDiscretFace::control(
BRepMesh_Delaun& theTrigu,
const Standard_Boolean theIsFirst,
Message_ProgressSentry* theProgressEntry)
const Standard_Boolean theIsFirst)
{
Standard_Integer aTrianglesNb = myStructure->ElementsOfDomain().Extent();
if (aTrianglesNb < 1)
@@ -1258,11 +1219,6 @@ Standard_Real BRepMesh_FastDiscretFace::control(
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
for (; aPass <= aPassesNb && aInsertedNb && !isAllDegenerated; ++aPass)
{
if (theProgressEntry != NULL && !theProgressEntry->More())
{
return 0;
}
aTempAlloc->Reset(Standard_False);
BRepMesh::ListOfVertex aNewVertices(aTempAlloc);
@@ -1280,11 +1236,6 @@ Standard_Real BRepMesh_FastDiscretFace::control(
BRepMesh::MapOfInteger::Iterator aTriangleIt(aTriangles);
for (; aTriangleIt.More(); aTriangleIt.Next())
{
if (theProgressEntry != NULL && !theProgressEntry->More())
{
return 0;
}
const Standard_Integer aTriangleId = aTriangleIt.Key();
const BRepMesh_Triangle& aCurrentTriangle = myStructure->GetElement(aTriangleId);
@@ -1447,12 +1398,8 @@ Standard_Real BRepMesh_FastDiscretFace::control(
<< aP.X() << " " << aP.Y() << " " << aP.Z() << endl;
}
#endif
if (theProgressEntry != NULL && !theProgressEntry->More())
{
return 0;
}
if (addVerticesToMesh(aNewVertices, theTrigu, theProgressEntry))
if (addVerticesToMesh(aNewVertices, theTrigu))
++aInsertedNb;
}

View File

@@ -41,7 +41,6 @@ class gp_Pnt2d;
class BRepMesh_Edge;
class BRepMesh_Vertex;
class gp_Pnt;
class Message_ProgressSentry;
//! Algorithm to mesh a face with respect of the frontier
//! the deflection and by option the shared components.
@@ -63,19 +62,15 @@ public:
Standard_EXPORT void Perform(const Handle(BRepMesh_FaceAttribute)& theAttribute);
Standard_EXPORT void Perform (const Handle(BRepMesh_FaceAttribute)& theAttribute,
Message_ProgressSentry* theProgressEntry);
DEFINE_STANDARD_RTTIEXT(BRepMesh_FastDiscretFace,Standard_Transient)
private:
void add(const Handle(BRepMesh_FaceAttribute)& theAttribute, Message_ProgressSentry* theProgressEntry);
void add(const Handle(BRepMesh_FaceAttribute)& theAttribute);
void add(const TopoDS_Vertex& theVertex);
Standard_Real control(BRepMesh_Delaun& theMeshBuilder,
const Standard_Boolean theIsFirst,
Message_ProgressSentry* theProgressEntry);
const Standard_Boolean theIsFirst);
//! Registers the given nodes in mesh data structure and
//! performs refinement of existing mesh.
@@ -85,14 +80,12 @@ private:
//! @return TRUE if vertices were been inserted, FALSE elewhere.
Standard_Boolean addVerticesToMesh(
const BRepMesh::ListOfVertex& theVertices,
BRepMesh_Delaun& theMeshBuilder,
Message_ProgressSentry* theProgressEntry);
BRepMesh_Delaun& theMeshBuilder);
//! Calculates nodes lying on face's surface and inserts them to a mesh.
//! @param theMeshBuilder initialized tool refining mesh
//! in respect to inserting nodes.
void insertInternalVertices(BRepMesh_Delaun& theMeshBuilder,
Message_ProgressSentry* theProgressEntry);
void insertInternalVertices(BRepMesh_Delaun& theMeshBuilder);
//! Calculates nodes lying on spherical surface.
//! @param theNewVertices list of vertices to be extended and added to mesh.

View File

@@ -54,8 +54,6 @@
#include <GCPnts_TangentialDeflection.hxx>
#include <Message_ProgressSentry.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_IncrementalMesh,BRepMesh_DiscretRoot)
namespace
@@ -65,51 +63,6 @@ namespace
static Standard_Boolean IS_IN_PARALLEL = Standard_False;
}
class BRepMesh_IncrementalMesh::FaceListFunctor
{
public:
FaceListFunctor (BRepMesh_IncrementalMesh* theAlgo,
const Handle(Message_ProgressIndicator)& theProgress,
Standard_Boolean theParallel)
: myAlgo (theAlgo),
mySentry (theProgress, "Mesh faces", 0, theAlgo->myFaces.Size(), 1),
myThreadId (OSD_Thread::Current()),
myIsParallel (theParallel),
myHasProgress (!theProgress.IsNull())
{
}
void operator() (const Standard_Integer theFaceIndex) const
{
if (!mySentry.More())
{
return;
}
TopoDS_Face& aFace = myAlgo->myFaces.ChangeValue (theFaceIndex);
myAlgo->myMesh->Process (aFace, &mySentry);
if (myIsParallel)
{
// use a trick to avoid mutex locks - increment the progress only within main thread
if (myHasProgress && myThreadId == OSD_Thread::Current())
{
mySentry.Next (OSD_Parallel::NbLogicalProcessors());
}
}
else
{
mySentry.Next();
}
}
private:
mutable BRepMesh_IncrementalMesh* myAlgo;
mutable Message_ProgressSentry mySentry;
Standard_ThreadId myThreadId;
Standard_Boolean myIsParallel;
Standard_Boolean myHasProgress;
};
//=======================================================================
//function : Default constructor
@@ -249,94 +202,41 @@ void BRepMesh_IncrementalMesh::collectFaces()
//purpose :
//=======================================================================
void BRepMesh_IncrementalMesh::Perform()
{
Perform (Handle(Message_ProgressIndicator)());
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepMesh_IncrementalMesh::Perform (const Handle(Message_ProgressIndicator)& theProgress)
{
init();
if (myMesh.IsNull())
return;
update (theProgress);
update();
}
//=======================================================================
//function : update()
//purpose :
//=======================================================================
void BRepMesh_IncrementalMesh::update (const Handle(Message_ProgressIndicator)& theProgress)
void BRepMesh_IncrementalMesh::update()
{
Message_ProgressSentry anOuterSentry (theProgress, "Updating", 0, 100, 1);
// Update edges data
anOuterSentry.Next(9);
TopExp_Explorer aExplorer(myShape, TopAbs_EDGE);
for (; aExplorer.More(); aExplorer.Next())
{
int aNbEdges = 0;
for (TopExp_Explorer aExplorer (myShape, TopAbs_EDGE); aExplorer.More(); aExplorer.Next())
{
++aNbEdges;
}
const TopoDS_Edge& aEdge = TopoDS::Edge(aExplorer.Current());
if(!BRep_Tool::IsGeometric(aEdge))
continue;
Message_ProgressSentry anEdgeSentry (theProgress, "Update edges data", 0, aNbEdges, 1);
for (TopExp_Explorer aExplorer (myShape, TopAbs_EDGE);
aExplorer.More() && anEdgeSentry.More(); aExplorer.Next(), anEdgeSentry.Next())
{
const TopoDS_Edge& aEdge = TopoDS::Edge(aExplorer.Current());
if(!BRep_Tool::IsGeometric(aEdge))
continue;
update(aEdge);
}
update(aEdge);
}
if (!anOuterSentry.More())
{
myStatus = BRepMesh_UserBreak;
return;
}
anOuterSentry.Next(5);
// Update faces data
NCollection_Vector<TopoDS_Face>::Iterator aFaceIt(myFaces);
for (Message_ProgressSentry aFacesSentry (theProgress, "Update faces data", 0, myFaces.Size(), 1);
aFaceIt.More() && aFacesSentry.More(); aFaceIt.Next(), aFacesSentry.Next())
{
for (; aFaceIt.More(); aFaceIt.Next())
update(aFaceIt.Value());
}
if (!anOuterSentry.More())
{
myStatus = BRepMesh_UserBreak;
return;
}
// Mesh faces
OSD_Parallel::ForEach(myFaces.begin(), myFaces.end(), *myMesh, !myParameters.InParallel);
anOuterSentry.Next(80);
{
// Mesh faces
FaceListFunctor aFacesFunctor (this, theProgress, myParameters.InParallel);
OSD_Parallel::For (0, myFaces.Size(), aFacesFunctor, !myParameters.InParallel);
}
if (!anOuterSentry.More())
{
myStatus = BRepMesh_UserBreak;
return;
}
anOuterSentry.Next(5);
{
Message_ProgressSentry aSentry (theProgress, "Commit", 0, myFaces.Size(), 1);
commit (aSentry);
}
anOuterSentry.Next();
commit();
clear();
}
@@ -593,10 +493,10 @@ void BRepMesh_IncrementalMesh::update(const TopoDS_Face& theFace)
//function : commit
//purpose :
//=======================================================================
void BRepMesh_IncrementalMesh::commit (Message_ProgressSentry& theSentry)
void BRepMesh_IncrementalMesh::commit()
{
NCollection_Vector<TopoDS_Face>::Iterator aFaceIt(myFaces);
for (; aFaceIt.More() && theSentry.More(); aFaceIt.Next(), theSentry.Next())
for (; aFaceIt.More(); aFaceIt.Next())
commitEdges(aFaceIt.Value());
discretizeFreeEdges();

View File

@@ -25,7 +25,6 @@
#include <vector>
class Message_ProgressIndicator;
class Poly_Triangulation;
class TopoDS_Shape;
class TopoDS_Edge;
@@ -69,10 +68,7 @@ public: //! @name mesher API
//! Performs meshing ot the shape.
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
//! Performs meshing ot the shape.
Standard_EXPORT void Perform(const Handle(Message_ProgressIndicator)& theProgress);
public: //! @name accessing to parameters.
//! Returns meshing parameters
@@ -130,7 +126,7 @@ protected:
private:
//! Builds the incremental mesh for the shape.
void update(const Handle(Message_ProgressIndicator)& theProgress);
void update();
//! Checks triangulation of the given face for consistency
//! with the chosen tolerance. If some edge of face has no
@@ -171,7 +167,7 @@ private:
const Standard_Boolean isWithCheck);
//! Stores mesh to the shape.
void commit(Message_ProgressSentry& theSentry);
void commit();
//! Stores mesh of internal edges to the face.
void commitEdges(const TopoDS_Face& theFace);
@@ -179,9 +175,6 @@ private:
//! Clears internal data structures.
void clear();
private:
class FaceListFunctor;
protected:
BRepMesh::DMapOfEdgeListOfTriangulationBool myEdges;

View File

@@ -23,8 +23,7 @@ enum BRepMesh_Status
BRepMesh_OpenWire = 0x1,
BRepMesh_SelfIntersectingWire = 0x2,
BRepMesh_Failure = 0x4,
BRepMesh_ReMesh = 0x8,
BRepMesh_UserBreak = 0x16
BRepMesh_ReMesh = 0x8
};
#endif

View File

@@ -2865,7 +2865,7 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S,
const Standard_Boolean GlobalEnlargeVfirst,
const Standard_Boolean GlobalEnlargeVlast)
{
const Standard_Real coeff = 4.;
const Standard_Real coeff = 2.; //4.;
const Standard_Real TolApex = 1.e-5;
Standard_Boolean SurfaceChange = Standard_False;
@@ -3248,7 +3248,8 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
const Standard_Boolean UpdatePCurve,
const Standard_Boolean enlargeU,
const Standard_Boolean enlargeVfirst,
const Standard_Boolean enlargeVlast)
const Standard_Boolean enlargeVlast,
const Standard_Boolean UseInfini)
{
//---------------------------
// extension de la geometrie.
@@ -3270,8 +3271,20 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
}
S->Bounds (US1,US2,VS1,VS2);
UU1 = VV1 = - TheInfini;
UU2 = VV2 = TheInfini;
if (UseInfini)
{
UU1 = VV1 = - TheInfini;
UU2 = VV2 = TheInfini;
}
else
{
Standard_Real FaceDU = UF2 - UF1;
Standard_Real FaceDV = VF2 - VF1;
UU1 = UF1 - FaceDU;
UU2 = UF2 + FaceDU;
VV1 = VF1 - FaceDV;
VV2 = VF2 + FaceDV;
}
if (CanExtentSurface) {
SurfaceChange = EnlargeGeometry( S, UU1, UU2, VV1, VV2, isVV1degen, isVV2degen, UF1, UF2, VF1, VF2,
@@ -4148,4 +4161,4 @@ void PerformPlanes(const TopoDS_Face& theFace1,
Standard_Boolean IsInf(const Standard_Real theVal)
{
return (theVal > TheInfini*0.9);
}
}

View File

@@ -104,7 +104,14 @@ public:
//! if <UpdatePCurve> is TRUE, update the pcurves of the
//! edges of <F> on the new surface.if the surface has been changed,
//! Returns True if The Surface of <NF> has changed.
Standard_EXPORT static Standard_Boolean EnLargeFace (const TopoDS_Face& F, TopoDS_Face& NF, const Standard_Boolean ChangeGeom, const Standard_Boolean UpDatePCurve = Standard_False, const Standard_Boolean enlargeU = Standard_True, const Standard_Boolean enlargeVfirst = Standard_True, const Standard_Boolean enlargeVlast = Standard_True);
Standard_EXPORT static Standard_Boolean EnLargeFace (const TopoDS_Face& F,
TopoDS_Face& NF,
const Standard_Boolean ChangeGeom,
const Standard_Boolean UpDatePCurve = Standard_False,
const Standard_Boolean enlargeU = Standard_True,
const Standard_Boolean enlargeVfirst = Standard_True,
const Standard_Boolean enlargeVlast = Standard_True,
const Standard_Boolean UseInfini = Standard_True);
Standard_EXPORT static void ExtentFace (const TopoDS_Face& F, TopTools_DataMapOfShapeShape& ConstShapes, TopTools_DataMapOfShapeShape& ToBuild, const TopAbs_State Side, const Standard_Real TolConf, TopoDS_Face& NF);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,122 @@
// Created on: 2012-08-06
// Created by: jgv@ROLEX
// Copyright (c) 2012-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BRepOffsetAPI_PatchFaces_HeaderFile
#define _BRepOffsetAPI_PatchFaces_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <Standard_Boolean.hxx>
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_DataMapOfOrientedShapeShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <BRepBuilderAPI_MakeShape.hxx>
class TopoDS_Shape;
//! Describes functions to replace some faces in a shape
//! by patches
class BRepOffsetAPI_PatchFaces : public BRepBuilderAPI_MakeShape
{
public:
DEFINE_STANDARD_ALLOC
//! General constructor.
Standard_EXPORT BRepOffsetAPI_PatchFaces(const TopoDS_Shape& aShape);
//! Adds the patch face for the face in the shape.
Standard_EXPORT void AddPatchFace (const TopoDS_Face& theFace, const TopoDS_Face& thePatchFace);
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
protected:
private:
Standard_EXPORT void UpdateEdgesAndVertex(const TopoDS_Edge& thePrevEdge,
TopoDS_Edge& thePrevNewEdge,
const TopoDS_Edge& theCurEdge,
TopoDS_Edge& theCurNewEdge,
TopoDS_Vertex& theCurVertex,
const TopoDS_Face& theFace,
const TopoDS_Face& theNewFace,
TopoDS_Face& theBoundedNewFace);
Standard_EXPORT void PutVertexToEdge(const TopoDS_Vertex& theVertex,
//const TopoDS_Vertex& theProVertex,
const TopAbs_Orientation theProVertexOrientation,
TopoDS_Edge& theEdge,
const TopoDS_Edge& theProEdge,
const TopoDS_Face& theFace,
const gp_Pnt2d& Pnt2dOnConstEdge,
const Standard_Real theParamOnEdge);
Standard_EXPORT void ProjectVertexOnNewEdge_2d(const TopoDS_Vertex& theVertex,
const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace,
const TopoDS_Edge& theNewEdge,
const TopoDS_Face& theNewFace,
Standard_Real& theParamOnConst,
Standard_Real& theParam,
gp_Pnt& thePntOnConst,
gp_Pnt& thePnt,
gp_Pnt& thePntSol,
gp_Pnt2d& thePnt2d,
Standard_Real& theTolReached);
Standard_EXPORT Standard_Boolean IsMoreThan3Edges(const TopoDS_Vertex& theVertex);
TopoDS_Shape myInitialShape;
TopTools_IndexedDataMapOfShapeShape myFacePatchFace;
TopTools_IndexedDataMapOfShapeShape myFaceNewFace;
TopTools_DataMapOfShapeShape myNewFaceBoundedFace;
TopTools_DataMapOfShapeShape myEdgeNewEdge;
//TopTools_DataMapOfOrientedShapeShape myOrientedEdgeNewEdge;
TopTools_DataMapOfShapeShape myVertexNewVertex;
TopTools_MapOfShape myTangentEdges;
TopTools_IndexedDataMapOfShapeListOfShape myEFmap;
TopTools_DataMapOfShapeListOfShape myVFmap;
};
#endif // _BRepOffsetAPI_PatchFaces_HeaderFile

View File

@@ -27,3 +27,5 @@ BRepOffsetAPI_SequenceOfSequenceOfShape.hxx
BRepOffsetAPI_Sewing.hxx
BRepOffsetAPI_ThruSections.cxx
BRepOffsetAPI_ThruSections.hxx
BRepOffsetAPI_PatchFaces.cxx
BRepOffsetAPI_PatchFaces.hxx

View File

@@ -62,6 +62,8 @@
#include <DBRep_DrawableShape.hxx>
#include <BRepTest.hxx>
#include <BRepOffsetAPI_PatchFaces.hxx>
#include <BRepFilletAPI_MakeFillet.hxx>
#include <ChFi3d_FilletShape.hxx>
@@ -2287,6 +2289,36 @@ static Standard_Integer ComputeSimpleOffset(Draw_Interpretor& theCommands,
return 0;
}
//=======================================================================
//function : patchfaces
//purpose :
//=======================================================================
static Standard_Integer patchfaces(Draw_Interpretor& /*di*/,
Standard_Integer n, const char** a)
{
if (n < 5) return 1;
TopoDS_Shape aShape = DBRep::Get(a[2]);
if (aShape.IsNull()) return 1;
TopoDS_Shape aLocalFace = DBRep::Get(a[3], TopAbs_FACE);
if (aLocalFace.IsNull()) return 1;
TopoDS_Face aFace = TopoDS::Face(aLocalFace);
TopoDS_Shape aLocalNewFace = DBRep::Get(a[4], TopAbs_FACE);
if (aLocalNewFace.IsNull()) return 1;
TopoDS_Face aNewFace = TopoDS::Face(aLocalNewFace);
BRepOffsetAPI_PatchFaces Builder(aShape);
Builder.AddPatchFace(aFace, aNewFace);
Builder.Build();
TopoDS_Shape Result = Builder.Shape();
DBRep::Set(a[1], Result);
return 0;
}
//=======================================================================
//function : FeatureCommands
//purpose :
@@ -2435,4 +2467,7 @@ void BRepTest::FeatureCommands (Draw_Interpretor& theCommands)
theCommands.Add("offsetshapesimple",
"offsetshapesimple result shape offsetvalue [solid] [tolerance=1e-7]",
__FILE__, ComputeSimpleOffset);
theCommands.Add("patchfaces", "patchfaces res shape face newface",
__FILE__,patchfaces,g);
}

View File

@@ -874,6 +874,21 @@ void BRepTools::Clean(const TopoDS_Shape& theShape)
aBuilder.UpdateFace(aFace, aNullTriangulation);
}
// Iterate over all edges seeking for 3d polygons
Handle (Poly_Polygon3D) aNullPoly3d;
TopExp_Explorer aEdgeIt (theShape, TopAbs_EDGE);
for (; aEdgeIt.More (); aEdgeIt.Next ())
{
const TopoDS_Edge& aEdge = TopoDS::Edge (aEdgeIt.Current ());
TopLoc_Location aLoc;
Handle (Poly_Polygon3D) aPoly3d = BRep_Tool::Polygon3D (aEdge, aLoc);
if (aPoly3d.IsNull ())
continue;
aBuilder.UpdateEdge (aEdge, aNullPoly3d);
}
}
//=======================================================================

View File

@@ -598,6 +598,13 @@ const TopoDS_Edge& BRepTools_WireExplorer::Current()const
//=======================================================================
TopAbs_Orientation BRepTools_WireExplorer::Orientation() const
{
if (myVertex.IsNull()
&& !myEdge.IsNull())
{
// infinite edge
return TopAbs_FORWARD;
}
TopoDS_Iterator it(myEdge,Standard_False);
while (it.More()) {
if (myVertex.IsSame(it.Value()))

View File

@@ -215,21 +215,21 @@ BVH_Tree<T, N, BVH_QuadTree>* BVH_Tree<T, N, BVH_BinaryTree>::CollapseToQuadTree
{
const std::pair<int, int> aNode = aQueue.front();
BVH::Array<T, N>::Append (aQBVH->myMinPointBuffer, BVH::Array<T, N>::Value (this->myMinPointBuffer, std::get<0> (aNode)));
BVH::Array<T, N>::Append (aQBVH->myMaxPointBuffer, BVH::Array<T, N>::Value (this->myMaxPointBuffer, std::get<0> (aNode)));
BVH::Array<T, N>::Append (aQBVH->myMinPointBuffer, BVH::Array<T, N>::Value (this->myMinPointBuffer, opencascade::std::get<0> (aNode)));
BVH::Array<T, N>::Append (aQBVH->myMaxPointBuffer, BVH::Array<T, N>::Value (this->myMaxPointBuffer, opencascade::std::get<0> (aNode)));
BVH_Vec4i aNodeInfo;
if (this->IsOuter (std::get<0> (aNode))) // is leaf node
if (this->IsOuter (opencascade::std::get<0> (aNode))) // is leaf node
{
aNodeInfo = BVH_Vec4i (1 /* leaf flag */,
this->BegPrimitive (std::get<0> (aNode)), this->EndPrimitive (std::get<0> (aNode)), std::get<1> (aNode) /* level */);
this->BegPrimitive (opencascade::std::get<0> (aNode)), this->EndPrimitive (opencascade::std::get<0> (aNode)), opencascade::std::get<1> (aNode) /* level */);
}
else
{
NCollection_Vector<int> aGrandChildNodes;
const int aLftChild = Child<0> (std::get<0> (aNode));
const int aRghChild = Child<1> (std::get<0> (aNode));
const int aLftChild = Child<0> (opencascade::std::get<0> (aNode));
const int aRghChild = Child<1> (opencascade::std::get<0> (aNode));
if (this->IsOuter (aLftChild)) // is leaf node
{
aGrandChildNodes.Append (aLftChild);
@@ -252,13 +252,13 @@ BVH_Tree<T, N, BVH_QuadTree>* BVH_Tree<T, N, BVH_BinaryTree>::CollapseToQuadTree
for (int aNodeIdx = 0; aNodeIdx < aGrandChildNodes.Size(); ++aNodeIdx)
{
aQueue.push_back (std::make_pair (aGrandChildNodes (aNodeIdx), std::get<1> (aNode) + 1));
aQueue.push_back (std::make_pair (aGrandChildNodes (aNodeIdx), opencascade::std::get<1> (aNode) + 1));
}
aNodeInfo = BVH_Vec4i (0 /* inner flag */,
aNbNodes, aGrandChildNodes.Size() - 1, std::get<1> (aNode) /* level */);
aNbNodes, aGrandChildNodes.Size() - 1, opencascade::std::get<1> (aNode) /* level */);
aQBVH->myDepth = Max (aQBVH->myDepth, std::get<1> (aNode) + 1);
aQBVH->myDepth = Max (aQBVH->myDepth, opencascade::std::get<1> (aNode) + 1);
aNbNodes += aGrandChildNodes.Size();
}

View File

@@ -247,7 +247,14 @@ namespace BVH
if (Size (theArray) == theCount)
{
#ifdef _STD_VECTOR_SHRINK
#if(defined(_MSC_VER) && (_MSC_VER < 1600))
BVH_ArrayNt aTmpArray(theArray);
theArray.swap(aTmpArray);
#else
theArray.shrink_to_fit();
#endif
#endif
}
else

View File

@@ -222,6 +222,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
// 2a. Retrieve data from the stream:
myRelocTable.Clear();
myRelocTable.SetHeaderData(aHeaderData);
mySections.Clear();
myPAtt.Init();
Handle(TDF_Data) aData = new TDF_Data();
@@ -248,7 +249,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
for (; anIterS.More(); anIterS.Next()) {
BinLDrivers_DocumentSection& aCurSection = anIterS.ChangeValue();
if (aCurSection.IsPostRead() == Standard_False) {
theIStream.seekg ((streampos) aCurSection.Offset());
theIStream.seekg ((std::streamsize)aCurSection.Offset());
if (aCurSection.Name().IsEqual ((Standard_CString)SHAPESECTION_POS))
ReadShapeSection (aCurSection, theIStream);
else
@@ -320,7 +321,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
for (; aSectIter.More(); aSectIter.Next()) {
BinLDrivers_DocumentSection& aCurSection = aSectIter.ChangeValue();
if (aCurSection.IsPostRead()) {
theIStream.seekg ((streampos) aCurSection.Offset());
theIStream.seekg ((std::streamsize)aCurSection.Offset());
ReadSection (aCurSection, theDoc, theIStream);
}
}
@@ -531,4 +532,3 @@ Standard_Boolean BinLDrivers_DocumentRetrievalDriver::CheckDocumentVersion(
}
return Standard_True;
}

View File

@@ -160,7 +160,7 @@ void BinLDrivers_DocumentSection::Write (Standard_OStream& theStream,
const uint64_t theOffset)
{
const uint64_t aSectionEnd = (uint64_t) theStream.tellp();
theStream.seekp(myValue[0]);
theStream.seekp((std::streamsize)myValue[0]);
myValue[0] = theOffset;
myValue[1] = aSectionEnd - theOffset;
uint64_t aVal[3] = {
@@ -175,7 +175,7 @@ void BinLDrivers_DocumentSection::Write (Standard_OStream& theStream,
#endif
theStream.write((char *)&aVal[0], 3*sizeof(uint64_t));
theStream.seekp(aSectionEnd);
theStream.seekp((std::streamsize)aSectionEnd);
}
//=======================================================================

View File

@@ -429,6 +429,11 @@ void BinLDrivers_DocumentStorageDriver::WriteInfoSection
Standard_Integer aObjNb = 1;
Standard_Integer aShemaVer = 1;
// Store the name and version of the application that has created the
// document.
theData->SetApplicationVersion(theDoc->Application()->Version());
theData->SetApplicationName(theDoc->Application()->Name());
aHeader.einfo += FSD_BinaryFile::WriteInfo (theOStream,
aObjNb,
BinLDrivers::StorageVersion(),

View File

@@ -0,0 +1,49 @@
// Created on: 2017-08-22
// Created by: Benjamin BIHLER
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BinObjMgt_RRelocationTable.hxx>
//=======================================================================
//function : GetHeaderData
//purpose : getter for the file header data
//=======================================================================
const Handle(Storage_HeaderData)& BinObjMgt_RRelocationTable::GetHeaderData() const
{
return myHeaderData;
}
//=======================================================================
//function : SetHeaderData
//purpose : setter for the file header data
//=======================================================================
void BinObjMgt_RRelocationTable::SetHeaderData(
const Handle(Storage_HeaderData)& theHeaderData)
{
myHeaderData = theHeaderData;
}
//=======================================================================
//function : Clear
//purpose : The relocation table is cleared before/after reading in a document.
// : In this case the reference to the file header data should also be
// : cleared, because it is specific to the document.
//=======================================================================
void BinObjMgt_RRelocationTable::Clear(const Standard_Boolean doReleaseMemory)
{
myHeaderData.Nullify();
TColStd_DataMapOfIntegerTransient::Clear(doReleaseMemory);
}

View File

@@ -17,8 +17,36 @@
#define _BinObjMgt_RRelocationTable_HeaderFile
#include <TColStd_DataMapOfIntegerTransient.hxx>
#include <Storage_HeaderData.hxx>
typedef TColStd_DataMapOfIntegerTransient BinObjMgt_RRelocationTable;
//! Retrieval relocation table is modeled as a child class of
//! TColStd_DataMapOfIntegerTransient that stores a handle to the file
//! header section. With that attribute drivers have access to the file header
//! section.
class BinObjMgt_RRelocationTable : public TColStd_DataMapOfIntegerTransient
{
public:
//! Returns a handle to the header data of the file that is begin read
Standard_EXPORT const Handle(Storage_HeaderData)& GetHeaderData() const;
//! Sets the storage header data.
//!
//! @param theHeaderData header data of the file that is begin read
Standard_EXPORT void SetHeaderData(
const Handle(Storage_HeaderData)& theHeaderData);
Standard_EXPORT void Clear(const Standard_Boolean doReleaseMemory = Standard_True);
protected:
private:
Handle(Storage_HeaderData) myHeaderData;
};
#endif // _BinObjMgt_RRelocationTable_HeaderFile

View File

@@ -7,5 +7,6 @@ BinObjMgt_PExtChar.hxx
BinObjMgt_PInteger.hxx
BinObjMgt_PReal.hxx
BinObjMgt_PShortReal.hxx
BinObjMgt_RRelocationTable.cxx
BinObjMgt_RRelocationTable.hxx
BinObjMgt_SRelocationTable.hxx

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