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

Compare commits

..

53 Commits

Author SHA1 Message Date
akaftasev
2ab2295cec 0025113: Added progress indicator to BRepMesh_IncrementalMesh [backport for OCCT 7.2.0] 2020-09-23 22:10:49 +03:00
gka
84dd587638 Issue #322 Fix 2020-09-23 20:18:08 +03:00
osa
28c0c6b155 0031773: Visualization - add Prs3d_ToolTorus
Added Prs3d_ToolTorus tool to create a torus
2020-09-23 20:18:08 +03:00
osa
47b0f294be 0031758: Visualization, AIS_InteractiveContext - unify clearDynamicHighlight() method 2020-09-23 20:18:08 +03:00
mzernova
7d6be4672b 0031733: Visualization, Prs3d_ToolQuadric - create indexed arrays
Prs3d_ToolQuadric has been modified to return an indexed triangulation.
Added methods Prs3d_ToolQuadric::CreateTriangulation() and Prs3d_ToolQuadric::CreateTriangulation()
as more straightforward API returning generated triangulation.
Added missing const to constant methods.

Confusing method Prs3d_ToolQuadric::FillArray() filling both
Graphic3d_ArrayOfTriangles and Poly_Triangulation at once has been marked deprecated.

V3d_Trihedron and AIS_Manipulator
now set Closed flag to groups with shaded sphere and arrows.
2020-09-23 20:18:08 +03:00
osa
b453701e1f Visualization, PrsMgr_Presentation - remove graphic structure before nullify [OCCT 7.2.0 backport] 2020-09-23 20:18:08 +03:00
osa
c23d6ec61f 0031715: Visualization, OpenGl_ShaderProgram - add access to proxy shader program.
Back porting of setting unique ID for shader program used to manage resource in graphic driver.
2020-09-23 20:18:08 +03:00
gka
b05ff75a60 0031718: Large tolerance of vertex of the result after split attached shape with an attached contour
Corrected computation of tolerance of vertex for periodic surfaces LocOpe_WiresOnShape in the method Project
2020-09-23 20:18:07 +03:00
emv
e49dc1e054 0031662: Modeling Algorithms - Incomplete result of section operation
BOPAlgo_PaveFiller: Add method for forced Edge/Face intersection to look for additional cases of coincidence.
BOPAlgo_BuilderSolid: Avoid creating solids from unclassified faces as such solids will be useless. Just warn user about unclassified faces.
2020-09-23 20:18:07 +03:00
ifv
abca9f3eb8 0031697: Foundation Classes - Expr_GeneralExpression::Derivative does not seem to work (691 & 720) 2020-09-23 20:18:07 +03:00
kgv
68556f75f9 0031698: Visualization, Graphic3d_Aspects - provide stipple line factor parameter [OCCT 7.2.0 backport]
Added Graphic3d_AspectLine3d::LineStippleFactor() property.
Added -stippleFactor argument to vaspects command.
2020-08-06 13:31:03 +03:00
kgv
3d607bc062 0029346: Visualization, TKOpenGl - collect frame statistics [backported,
partially disabled; fixed frustum culling bug].

Graphic3d_RenderingParams::ToShowStats - new option displaying rendering statistics.

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

OpenGl_Layer::UpdateCulling() - simplified resetting of culling state for cullable structures.

# Conflicts:
#	src/OpenGl/OpenGl_FrameBuffer.cxx
2020-07-15 16:09:42 +03:00
kgv
365585ddfb 0028760: Visualization, TKOpenGl - avoid excessive frustum culling traverse within extra OIT rendering pass
Culling traverse is no more called implicitly within OpenGl_Layer::Render().
Instead, all layers are traversed at onces within OpenGl_View::render() beforehand.

OpenGl_BVHTreeSelector methods have been renamed to better reflect their meaning.
Non-persistent culling options has been moved to dedicated structure OpenGl_BVHTreeSelector::CullingContext
so that OpenGl_BVHTreeSelector instance can be used for different Layers without modifying its state.
2020-07-15 16:09:42 +03:00
kgv
c89ab82e4c 0029300: Visualization, TKOpenGl - provide depth pre-pass option
OpenGl_LayerList::Render() now handles new option Graphic3d_RenderingParams::ToEnableDepthPrepass
which prepends additional pass to rendering pipeline filling Depth Buffer in advance.
2020-07-15 16:09:42 +03:00
kgv
cc964ef4d3 0029295: Visualization, TKOpenGl - provide distance culling option
Graphic3d_ZLayerSettings::CullingDistance() and ::CullingSize() - added
new properties configuring culling of small and distant objects, disabled by default.
OpenGl_BVHTreeSelector now handles size culling and distance culling in addition to frustom culling.
2020-07-15 16:09:41 +03:00
ifv
cb127824b2 0031616: Modeling algorithm - Section between two shells returns wire with gaps (720) 2020-07-15 16:09:41 +03:00
ifv
fbebf6078c 0031611: BRepOffsetAPI_NormalProjection - can't build wire in 720 but it was possible in 691 2020-07-15 16:09:41 +03:00
jgv
762fa70875 Fix the case SENR-22-003 "HLR - Different result between 691 and 720" 2020-02-17 14:32:57 +03:00
gka
4dd6fb9a80 # 257 Error in D1 calculation using BRepAdaptor_CompCurve using the last parameter. In OCCT7
Modifications from archive "patch_720_new.7z"
2020-02-17 13:15:35 +03:00
kgv
70608ec03d 0030706: Visualization - fetch font folder list from fontconfig library on Linux [backport occt720]
vfont command now prints fonts in alphabetical order.

# Conflicts:
#	adm/qmake/OccToolkit.pri
2020-02-17 12:40:48 +03:00
kgv
0842e31d95 0030782: Visualization, Font_FTFont - use predefined fallback fonts for extended Unicode subsets [backported to occt720]
Font_FTFont now uses fallback fonts for characters from unsupported Unicode subsets,
managed by Font_FTFont::ToUseUnicodeSubsetFallback()
and Font_FontMgr::ToUseUnicodeSubsetFallback() option, enabled by default.
The fallback list includes common font families for Chinese, Korean and Japanese languages.

Font_FTFont::RenderGlyph() now supports FT_PIXEL_MODE_MONO input format used by some CJK fonts.
OpenGl_Font::createTexture() now limits single texture size to circa 4096 glyphs.

test/testgrid now expects test scripts being in UTF-8 encoding in sync with "DRAWEXE -f script.tcl".

AIS::InitFaceLength() - fixed usage of uninitialized result.

Font_FTFont::RenderGlyph() backport bitmap
2020-02-17 12:40:48 +03:00
kgv
51204152b9 0030663: Visualization - synthesize italic style for a font having no italic style [backport OCCT720]
Font_FTFont now defines shear transformation to synthesize italic style for fonts having no such style.
Font_FontMgr::FindFont() and command "vfont -find" have been extended with -strict option
to check whether the given font is actually registered or not.
Font_FTFont::Init() - added constructor from memory buffer.
Second Font_FTFont::Init() override has been renamed to Font_FTFont::FindAndInit()
to avoid ambiguity between two similar methods taking full font path and font name as string.

# Conflicts:
#	src/AIS/AIS_Dimension.cxx
#	src/OpenGl/OpenGl_Text.cxx
2020-02-17 12:40:48 +03:00
kgv
d517575214 0030474: Visualization - fallback font is ignored for missing font alias within Font_FontMgr::FindFont() 2020-02-17 12:40:47 +03:00
kgv
99d9eb3933 0030439: Visualization - extend fonts search within Font_FontMgr::FindFont() on Linux
Font_FontMgr has been redesigned to:
- Store fonts in a map instead a list.
- Allow mapping multiple fonts to a single alias.
- Log informative message about usage of non-requested font (fallback).
- Register all font files within standard folders on Linux when "fonts.dir" is not found.
- Prefer specific alias ("serif") as default fallback font instead of arbitrary one in a system.

A couple of obsolete and broken font aliases have been removed;
instead, new aliases of fonts popular on Linux platform have been added.

Font_NameOfFont.hxx has been extended with more neutral aliases
"monospace", "serif", "sans-serif", "cjk" and "korean".

Font_FontAspect enumeration values have been renamed Font_FA_ -> Font_FontAspect_
with old values preserved as alias.

Font_SystemFont has been extended with a list of paths to Font_FontAspect styles,
so that entire Font Family is now defined within a single Font_SystemFont instance.
Non-resizable fonts are now ignored by Font Manager.
2020-02-17 12:40:47 +03:00
skl
a3430df1d4 0025852: Visualization - Font_BRepFont produces bad faces for circled symbols [backported to occt720]
Font_BRepFont now uses a dedicated algorithm for text-to-BRep transformation instead of relying on ShapeFix.
It orders wires based on wire classification, analyzes internal zones and creates a few faces (if needed).
TKService dependency from TKShHealing has been dropped.

Font_BRepFont::buildFaces() backport.
2020-02-17 12:40:47 +03:00
kgv
9f9ac0fb5a 0029225: Visualization - Font_FTFont::AdvanceX() retrieves kerning value for incorrect characters pair
Fixed FT_Get_Kerning misuse within Font_FTFont::AdvanceX()/Font_FTFont::AdvanceY().
Font_FTFont::loadGlyph() has been corrected to not return TRUE
in case if method called with 0 argument second+ time.
2020-02-17 12:40:47 +03:00
anv
e0fd0b8797 0029117: Adding translation of Multileader entity
Scaling of width of glyphs is added om Font_FTFont class.
Font "SimSan" is specified as fallback alias for font "NSimSan" (contains Chinese hieroglyphs).
2020-02-17 12:40:47 +03:00
kgv
09aae06737 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.
2020-02-17 12:40:46 +03:00
kgv
eea07c2f60 0030278: Foundation Classes - make IndexedMapNode as protected inside of NCollection_IndexedMap
# Conflicts:
#	src/NCollection/NCollection_IndexedMap.hxx
2020-02-17 12:40:46 +03:00
kgv
9cee51b43b 0031174: Visualization - support user-provided stipple line patterns [occt720 backport] 2020-02-17 12:40:46 +03:00
emv
760a94d050 0031306: Modeling Algorithms - Incomplete result of Cut operation
The problem is fixed by #0029323. Integrating test case only.
2020-01-20 09:32:52 +03:00
nbv
a8375ceaf0 0029323: Intersection algorithm produces the curve with oscillation
Sometimes the algorithm of purging of extra points in the walking line makes enormous difference in distance between two neighbor segments of the line. This badly impacts the quality of approximation result. This patch balances the difference in distances by forbidding deletion of some points.

1. tests/bugs/modalg_6/bug27615

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

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

The reason of the correction is explained in the message ~0072583 (see issue #28984).
2020-01-20 09:30:08 +03:00
ifv
55374b512e 0031260: Geom2dGcc_Circ2d2TanRad fails in this case (720) 2020-01-17 11:30:50 +03:00
ifv
52a5d7a61d 0031203: SENR-21-037 SenerAlgo_ProjectWire fails when projecting wire to face (691 and 720) 2019-12-03 12:37:36 +03:00
gka
77676f1b6d * 0031140: Draw command "cirtang" raises exception on the parallel curves
To avoid exception for parallel curves because the number of solutions exceeds the size of the reserved array a check has been added that the number of solutions does not exceed the size of the reserved array.
2019-11-07 19:49:16 +03:00
emv
515991ffef 0030869: Modeling Data - BRepAdaptor_CompCurve incorrectly evaluates the boundary points
Problem is solved by #0029430. Integrating test case only.
2019-08-09 07:54:09 +03:00
Benjamin Bihler
3d5d9d2b5e 0029775: Modeling Data - BRepAdaptor_CompCurve Parameterization Is Incorrect
Added wire connectivity requirement to class documentation of
BRepAdaptor_CompCurve.
2019-08-07 08:26:57 +03:00
nbv
51e75dba6c 0029430: [Regression] Curve evaluation at boundary point.
Before the fix, BRepAdaptor_CompCurve considered the input wire to be periodic with period LastParameter()-FirstParameter().
Now, method IsPeriodic will always return FALSE because it is impossible to obtain correspondence between the members of BRepAdaptor_CompCurve class and its periodicity status.
New behavior has been documented in upgrade-guide.
2019-08-07 08:26:55 +03:00
emv
b008680dc0 0030708: Modeling Data - Exception is raised while initializing TopoDS_Iterator with null shape
Added protection from null shapes to TopoDS_Iterator::Initialize method.
2019-05-15 14:09:13 +03:00
ifv
2b5ced28c3 0030647: Geom2dGcc_Circ2d2TanRad not giving all the solutions
Correct choice od number of sampling points is added for Adaptor2d_OffsetCurve
2019-04-16 10:49:26 +03:00
emv
1c4b27600f 0030522: Modeling Algorithms - BRepBuilderAPI_MakeWire produces different wires depending on the order of parameters
The following improvements have been implemented in BRepLib_MakeWire class to make it more reliable:
1. Quit adding edges of a wire into result if the current edges have not been added. Return NotDone status.
2. Allow merging not only bounding vertices (connected to only one edge) but also the middle ones, so the multi-connected vertices may appear in the result.

Test case for the issue.
2019-03-15 12:58:13 +03:00
nbv
214171ff60 0029887: Wrong result of CUT operation due to incorrect point-face classification
Using of input tolerance has been eliminated in Geom2dInt_GInter algorithm called from BRepClass_Intersector::Perform(...) method. Now, the input tolerance is used only for check ON-status of classification.

(cherry picked from commit 748c9dc6ae0d6018018fca585b6d8cf511c0dd0b)
(cherry picked from commit 204e98c0b1)
2018-06-25 10:15:52 +03:00
nbv
22f9125e1e Correction of test cases. 2018-02-15 15:15:29 +03:00
nbv
1a196a871d 0029510: IntWalk_PWalking:: PutToBoundary(...) method results in appearing several coincident points in Walking-line
Places have been detected where coincident points are created. The problem has been fixed.

(cherry picked from commit 7c7cda9f73f8762d4999657a925f65cd02bc6864)
2018-02-15 14:47:12 +03:00
nbv
5eba99e74b 0029494: Intersection line between two parametric surfaces is restricted incorrectly if it matches the surface boundary
Creation of IntPatch_Points is forbidden in tangent-zones exceptionally domain boundaries of intersected surface.

(cherry picked from commit 2123a44c2595633288e208a352050592710782f5)
2018-02-15 10:48:00 +03:00
nbv
1560ac5528 # Correction in test cases and documentation.
(cherry picked from commit b244aa455edc4b973457be365ef95bb475523654)
2018-02-14 14:59:37 +03:00
nbv
4b46072ae9 # Correction of test case
(cherry picked from commit 663b5da04a351f0ba1ffc8b26c7df818ad56545b)
2018-02-14 14:57:29 +03:00
nbv
eed77ff55c 0029496: No intersection curve between faces if starting points are given
Now, bounded IntPatch_Points are found in case when starting points are used in intersection algorithm. Before the fix, these points were not looked for (even).

(cherry picked from commit e6a1e86e7b926937f6773d45ed75a2c36d0e7c27)
2018-02-14 14:55:55 +03:00
emv
118e720920 0029488: Regression: boolean operation " general fuse" creates solid containing 5 not connected shells lying on the one level.
Boolean Operations - when checking two faces with the same bounds on Same Domain, take into account possible deviation of the edges from the faces surfaces.

Test cases for the issue.

(cherry picked from commit 8a7476a622)
2018-02-14 11:47:31 +03:00
gka
80f77ed256 # Modified scripts 2018-02-05 17:27:12 +03:00
emv
8f87d4a954 0029465: Regression relation to 691 version: Extrema_ExtCC returns IsParallel equal to true for not parallel curves
Strengthening of the criteria of the parallel status of the curves by additional checking if the ends of the curves do not diverge.

Test cases for the issue.
2018-02-05 11:20:31 +03:00
gka
eeccb2515d 0029473: DRAW command "splitshape" produces invalid result on the cylindrical face.
Fix for porting SenerAlgo on the OCCT 720.

Test case for the issue.
2018-02-05 11:20:30 +03:00
msv
b1ee6d0e4b 0029463: Regression relation to 691 version: Method BndBox::IsOut() returns true for point lying on the planar face
Correct the method BRepBndLib::Add so that to enlarge the bounding box on the tolerance of edges which curves participate in calculation of the box.
2018-02-05 11:20:08 +03:00
1949 changed files with 38620 additions and 62164 deletions

2
.gitignore vendored
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1366,7 +1366,7 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
set aLibsMap(CSF_dl) "dl"
if { "$theOS" == "mac" } {
set aLibsMap(CSF_objc) "objc"
set aFrmsMap(CSF_Appkit) "AppKit"
set aFrmsMap(CSF_Appkit) "Appkit"
set aFrmsMap(CSF_IOKit) "IOKit"
set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
set aFrmsMap(CSF_TclLibs) "Tcl"
@@ -1375,6 +1375,7 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
set aLibsMap(CSF_TclTkLibs) ""
set aLibsMap(CSF_QT) "QtCore QtGui"
} else {
set aLibsMap(CSF_fontconfig) "fontconfig"
if { "$theOS" == "qnx" } {
# CSF_ThreadLibs - pthread API is part of libc on QNX
set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"

View File

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

View File

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

View File

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

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

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

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

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

View File

@@ -1438,116 +1438,9 @@ The methods returning the status of errors and warnings of the algorithms (Error
Instead use methods HasErrors() and HasWarnings() to check for presence of errors and warnings, respectively.
The full list of errors and warnings, with associated data such as problematic sub-shapes, can be obtained by method GetReport().
@section upgrade_occt721 Upgrade to OCCT 7.2.1
@subsection upgrade_721_Changes_In_USD Changes in ShapeUpgrade_UnifySameDomain
The following public methods in the class ShapeUpgrade_UnifySameDomain became protected:
* *UnifyFaces*
* *UnifyEdges*
The following public method has been removed:
* *UnifyFacesAndEdges*
@subsection upgrade_721_Move_BuildPCurveForEdgeOnPlane Moving BuildPCurveForEdgeOnPlane from BOPTools_AlgoTools2D to BRepLib
The methods BuildPCurveForEdgeOnPlane and BuildPCurveForEdgesOnPlane have been moved from the class BOPTools_AlgoTools2D
to the more lower level class BRepLib.
@subsection upgrade_721_removed Removed features
The following obsolete features have been removed:
* The package BOPCol has been fully removed:
- *BOPCol_BaseAllocator* is replaced with *Handle(NCollection_BaseAllocator)*;
- *BOPCol_BoxBndTree* is replaced with *BOPTools_BoxBndTree*;
- *BOPCol_Box2DBndTree* is removed as unused;
- *BOPCol_DataMapOfIntegerInteger* is replaced with *TColStd_DataMapOfIntegerInteger*;
- *BOPCol_DataMapOfIntegerListOfInteger* is replaced with *TColStd_DataMapOfIntegerListOfInteger*;
- *BOPCol_DataMapOfIntegerListOfShape* is replaced with *TopTools_DataMapOfIntegerListOfShape*;
- *BOPCol_DataMapOfIntegerMapOfInteger.hxx* is removed as unused;
- *BOPCol_DataMapOfIntegerReal* is replaced with *TColStd_DataMapOfIntegerReal*;
- *BOPCol_DataMapOfIntegerShape* is replaced with *TopTools_DataMapOfIntegerShape*;
- *BOPCol_DataMapOfShapeBox* is replaced with *TopTools_DataMapOfShapeBox*;
- *BOPCol_DataMapOfShapeInteger* is replaced with *TopTools_DataMapOfShapeInteger*;
- *BOPCol_DataMapOfShapeListOfShape* is replaced with *TopTools_DataMapOfShapeListOfShape*;
- *BOPCol_DataMapOfShapeReal* is replaced with *TopTools_DataMapOfShapeReal*;
- *BOPCol_DataMapOfShapeShape* is replaced with *TopTools_DataMapOfShapeShape*;
- *BOPCol_DataMapOfTransientAddress* is removed as unused;
- *BOPCol_IndexedDataMapOfIntegerListOfInteger* is removed as unused;
- *BOPCol_IndexedDataMapOfShapeBox* is removed as unused;
- *BOPCol_IndexedDataMapOfShapeInteger* is removed as unused;
- *BOPCol_IndexedDataMapOfShapeListOfShape* is replaced with *TopTools_IndexedDataMapOfShapeListOfShape*;
- *BOPCol_IndexedDataMapOfShapeReal* is removed as unused;
- *BOPCol_IndexedDataMapOfShapeShape* is replaced with *TopTools_IndexedDataMapOfShapeShape*;
- *BOPCol_IndexedMapOfInteger* is replaced with *TColStd_IndexedMapOfInteger*;
- *BOPCol_IndexedMapOfOrientedShape* is replaced with *TopTools_IndexedMapOfOrientedShape*;
- *BOPCol_IndexedMapOfShape* is replaced with *TopTools_IndexedMapOfShape*;
- *BOPCol_ListOfInteger* is replaced with *TColStd_ListOfInteger*;
- *BOPCol_ListOfListOfShape* is replaced with *TopTools_ListOfListOfShape*;
- *BOPCol_ListOfShape* is replaced with *TopTools_ListOfShape*;
- *BOPCol_MapOfInteger* is replaced with *TColStd_MapOfInteger*;
- *BOPCol_MapOfOrientedShape* is replaced with *TopTools_MapOfOrientedShape*;
- *BOPCol_MapOfShape* is replaced with *TopTools_MapOfShape*;
- *BOPCol_PListOfInteger* is removed as unused;
- *BOPCol_PInteger* is removed as unused
- *BOPCol_SequenceOfPnt2d* is replaced with *TColgp_SequenceOfPnt2d*;
- *BOPCol_SequenceOfReal* is replaced with *TColStd_SequenceOfReal*;
- *BOPCol_SequenceOfShape* is replaced with *TopTools_SequenceOfShape*;
- *BOPCol_Parallel* is replaced with *BOPTools_Parallel*;
- *BOPCol_NCVector* is replaced with *NCollection_Vector*;
* The class *BOPDS_PassKey* and containers for it have been removed as unused.
* The unused containers from *IntTools* package have been removed:
- *IntTools_DataMapOfShapeAddress* is removed as unused;
- *IntTools_IndexedDataMapOfTransientAddress* is removed as unused;
* The container *BiTgte_DataMapOfShapeBox* is replaced with *TopTools_DataMapOfShapeBox*;
* The class *BOPTools* has been removed as duplicate of the class *TopExp*;
* The method *BOPAlgo_Builder::Splits()* has been removed as excessive. The method *BOPAlgo_Builder::Images()* can be used instead.
@section upgrade_occt730 Upgrade to OCCT 7.3.0
@subsection upgrade_730_lights Light sources
Multiple changes have been applied to lights management within TKV3d and TKOpenGl:
* V3d_Light class is now an alias to Graphic3d_CLight.
Graphic3d_CLight is now a Handle class with refactored methods for managing light source parameters
(preserving most methods of V3d_Light sub-classes to simplify porting).
* Obsolete debugging functionality for drawing lights source has been removed from V3d_Light.
Methods and constructors taking parameters for this drawing and not affecting light definition itself has been also removed.
* Light constructors taking V3d_Viewer has been marked deprecated.
Application may call V3d_Viewer::AddLight() explicitly to register new light sources created by new constructors within V3d_Viewer, but this step is now optional.
* The upper limit of 8 light sources has been removed.
* Dedicated classes per light source type V3d_AmbientLight, V3d_DirectionalLight, V3d_PositionalLight and V3d_SpotLight have been preserved,
but it is now possible defining light of any type by creating base class Graphic3d_CLight directly.
Dedicated classes only hides visibility of unrelated light properties depending on its type.
* Calling V3d_Viewer::UpdateLights() is no more required after modifying light sources properties (color, position, etc.).
@subsection upgrade_730_shadingmodels Shading Models
*Graphic3d_AspectFillArea3d* has been extended by a new property ::ShadingModel(), which previously has been defined globally for entire View.
Previously, triangle array without normal vertex attributes was implicitly considered as unshaded,
but now such array will be shaded using *Graphic3d_TOSM_FACET* model (e.g. by computing per-triangle normals).
Therefore, *Graphic3d_TOSM_UNLIT* should be explicitly specified for disabling shading or triangles array.
Alternatively, material without reflectance properties can be used for disabling shading as before.
@subsection upgrade_730_tkopengl Custom low-level OpenGL elements
The following API changes should be considered while porting custom OpenGl_Element objects:
* OpenGl_ShaderManager::BindFaceProgram(), ::BindLineProgram(), ::BindMarkerProgram() now takes enumeration arguments instead of Boolean flags.
@subsection upgrade_730_BOPAlgo_Section Changes in BOPAlgo_Section
The public method *BuildSection()* in the class *BOPAlgo_Section* has became protected. The methods *Perform()* or *PerformWithFiller()* should be called for construction of the result of SECTION operation.
@subsection upgrade_730_BRepAdaptor_CompCurve Changes in BRepAdaptor_CompCurve
The method BRepAdaptor_CompCurve::SetPeriodic has been eliminated.
Since new version, the method BRepAdaptor_CompCurve::IsPeriodic() will always return FALSE. Earlier, it could return TRUE in case if the wire contained only one edge based on periodic curve.
@subsection upgrade_730_removed Removed features
* The methods *SetDeflection*, *SetEpsilonT*, *SetDiscretize* of the class *IntTools_EdgeFace* have been removed as excessive.
@subsection upgrade_730_IntersectionAPI Changes in classes responsible for intersection algorithm
Interfaces of the following methods have been changed: IntPatch_WLineTool::ComputePurgedWLine(...), IntPatch_PrmPrmIntersection::Perform(...), IntPatch_Intersection::Perform(...), IntPatch_Intersection::ParamParamPerfom(...), IntPatch_Intersection::GeomGeomPerfom(...). Please see documentation about corresponding methods.

View File

@@ -28,22 +28,13 @@ https://www.opencascade.com
License
--------
Open CASCADE Technology is free software; you can redistribute it and / or modify it under the terms of the
@ref license_lgpl_21 "GNU Lesser General Public License (LGPL) version 2.1", with additional @ref occt_lgpl_exception "exception".
Open CASCADE Technology is free software; you can redistribute it and / or
modify it under the terms of the
@ref license_lgpl_21 "GNU Lesser General Public License (LGPL) version 2.1",
with additional @ref occt_lgpl_exception "exception".
Note that LGPL imposes some obligations on the application linked with Open CASCADE Technology.
If you wish to use OCCT in a proprietary application, please, pay special attention to address the requirements of LGPL section 6.
At minimum the following should be considered:
1. Add the notice visible to the users of your application clearly stating that Open CASCADE Technology is used in this application, and that they have rights in this regard according to LGPL.
Such notice can be added in About dialog box (this is mandatory if this box contains copyright statements) or a similar place and/or in the documentation.
The text of LGPL license should be accessible to the user.
2. Make the copy of OCCT sources used by the application available to its users, and if necessary provide instructions on how to build it in a way compatible with the application.
3. Ensure that the user actually can exercise the right to run your application with a modified version of OCCT.
If the application is distributed in a form that does not allow the user to modify OCCT part (e.g. the application is linked to OCCT statically or is distributed via AppStore on iOS, GooglePlay on Android, Windows Store, etc.),
the application should be provided separately in a modifiable form, with all materials needed for the user to be able to run the application with a modified version of OCCT.
If you want to use Open CASCADE Technology without being bound by LGPL requirements,
please <a href="https://www.opencascade.com/contact">contact Open CASCADE company</a> for a commercial license.
Alternatively, Open CASCADE Technology may be used under the terms of Open
CASCADE commercial license or contractual agreement.
Note that Open CASCADE Technology is provided on an "AS IS" basis, WITHOUT
WARRANTY OF ANY KIND. The entire risk related to any use of the OCCT code and
@@ -136,9 +127,6 @@ FreeImage is easy to use, fast, multithreading safe, compatible with all 32-bit
and cross-platform (works both with Linux and Mac OS X). FreeImage is optionally used by OCCT to work
with images, on conditions of the FreeImage Public License (FIPL) (http://freeimage.sourceforge.net/freeimage-license.txt).
**David M. Gay's floating point routines** (dtoa.c) are used for fast reading of floating point values from text strings.
These routines are available under MIT-like license (see http://www.netlib.org/fp/).
**CMake** is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice.
OCCT uses CMake as a build system. CMake is available under BSD 3-Clause license. See more at https://cmake.org/
@@ -208,9 +196,9 @@ for which OCCT is certified to work.
| OS | Compiler |
| --------- | ----------- |
| Windows | Microsoft Visual Studio: 2008 SP1, 2010 SP1<sup>1</sup>, 2012 Update 4, 2013 Update 5, 2015, 2017 <br> GCC 4.3+ (Mingw-w64)|
| Windows | Microsoft Visual Studio: 2010 SP1<sup>1</sup>, 2012 Update 4, 2013 Update 5, 2015, 2017 <br> Intel C++ Composer XE 2013 SP1 <br> GCC 4.3+ (Mingw-w64)|
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
| OS X / macOS | XCode 6 or newer |
| OS X | XCode 6 or newer |
| Android | NDK r10, GNU gcc 4.8 or newer |
1) VC++ 10 64-bit is used for regular testing and for building

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -548,8 +548,7 @@ The class *BOPAlgo_Options* provides the following options for the algorithms:
* Check the presence of the Errors and Warnings;
* Turn on/off the parallel processing;
* Set the additional tolerance for the operation;
* Break the operations by user request;
* Usage of Oriented Bounding boxes in the operation.
* Break the operations by user request.
@subsection occt_algorithms_root_classes_2 Class BOPAlgo_Algo
@@ -786,118 +785,6 @@ The types of resulting shapes depend on the type of the corresponding argument p
| 7 | EDGE | Set of split EDGEs | |
| 8 | VERTEX | VERTEX | |
@subsection occt_algorithms_7_3a Options
The General Fuse algorithm has a set of options, which allow speeding-up the operation and improving the quality of the result:
* Parallel processing option allows running the algorithm in parallel mode;
* Fuzzy option allows setting the additional tolerance for the operation;
* Safe input shapes option allows preventing modification of the input shapes;
* Gluing option allows speeding-up the intersection of the arguments;
* Possibility to disable the check for the inverted solids among input shapes;
* Usage of Oriented Bounding Boxes in the operation;
* History support.
For more detailed information on these options please see the @ref occt_algorithms_11a "Advanced options" section.
@subsection occt_algorithms_7_3b Usage
The following example illustrates how to use the GF algorithm:
#### Usage of the GF algorithm on C++ level
~~~~
BOPAlgo_Builder aBuilder;
// Setting arguments
TopTools_ListOfShape aLSObjects = …; // Objects
aBuilder.SetArguments(aLSObjects);
// Setting options for GF
// Set parallel processing mode (default is false)
Standard_Boolean bRunParallel = Standard_True;
aBuilder.SetRunParallel(bRunParallel);
// Set Fuzzy value (default is Precision::Confusion())
Standard_Real aFuzzyValue = 1.e-5;
aBuilder.SetFuzzyValue(aFuzzyValue);
// Set safe processing mode (default is false)
Standard_Boolean bSafeMode = Standard_True;
aBuilder.SetNonDestructive(bSafeMode);
// Set Gluing mode for coinciding arguments (default is off)
BOPAlgo_GlueEnum aGlue = BOPAlgo_GlueShift;
aBuilder.SetGlue(aGlue);
// Disabling/Enabling the check for inverted solids (default is true)
Standard Boolean bCheckInverted = Standard_False;
aBuilder.SetCheckInverted(bCheckInverted);
// Set OBB usage (default is false)
Standard_Boolean bUseOBB = Standard_True;
aBuilder.SetUseOBB(buseobb);
// Perform the operation
aBuilder.Perform();
// Check for the errors
if (aBuilder.HasErrors())
{
return;
}
// Check for the warnings
if (aBuilder.HasWarnings())
{
// treatment of the warnings
...
}
// result of the operation
const TopoDS_Shape& aResult = aBuilder.Shape();
~~~~
#### Usage of the GF algorithm on Tcl level
~~~~
# prepare the arguments
box b1 10 10 10
box b2 3 4 5 10 10 10
box b3 5 6 7 10 10 10
# clear inner contents
bclearobjects; bcleartools;
# set the arguments
baddobjects b1 b2 b3
# setting options for GF
# set parallel processing mode (default is 0)
brunparallel 1
# set Fuzzy value
bfuzzyvalue 1.e-5
# set safe processing mode (default is 0)
bnondestructive 1
# set gluing mode (default is 0)
bglue 1
# set check for inverted (default is 1)
bcheckinverted 0
# set obb usage (default is 0)
buseobb 1
# perform intersection
bfillds
# perform GF operaton
bbuild result
~~~~
@subsection occt_algorithms_7_3 Examples
Please, have a look at the examples, which can help to better understand the definitions.
@@ -1174,7 +1061,7 @@ The input data for this step is a *BOPAlgo_Builder* object after building result
@section occt_algorithms_8 Splitter Algorithm
The Splitter algorithm allows splitting a group of arbitrary shapes by another group of arbitrary shapes.<br>
It is based on the General Fuse algorithm, thus all options of the General Fuse (see @ref occt_algorithms_7_3a "GF Options") are also available in this algorithm.
It is based on the General Fuse algorithm, thus all options of the General Fuse such as Fuzzy mode, safe processing mode, parallel mode, gluing mode and history support are also available in this algorithm.
@subsection occt_algorithms_8_1 Arguments
@@ -1195,18 +1082,22 @@ It is based on the General Fuse algorithm, thus all options of the General Fuse
On the low level the Splitter algorithm is implemented in class *BOPAlgo_Splitter*. The usage of this algorithm looks as follows:
~~~~~
BOPAlgo_Splitter aSplitter;
// Setting arguments and tools
TopTools_ListOfShape aLSObjects = …; // Objects
TopTools_ListOfShape aLSTools = …; // Tools
BOPCol_ListOfShape aLSObjects = …; // Objects
BOPCol_ListOfShape aLSTools = …; // Tools
Standard_Boolean bRunParallel = Standard_False; /* parallel or single mode (the default value is FALSE)*/
Standard_Real aTol = 0.0; /* fuzzy option (default value is 0)*/
Standard_Boolean bSafeMode = Standard_False; /* protect or not the arguments from modification*/
BOPAlgo_Glue aGlue = BOPAlgo_GlueOff; /* Glue option to speed up intersection of the arguments*/
// setting arguments
aSplitter.SetArguments(aLSObjects);
aSplitter.SetTools(aLSTools);
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
// Perform the operation
aSplitter.Perform();
// setting options
aSplitter.SetRunParallel(bRunParallel);
aSplitter.SetFuzzyValue(aTol);
aSplitter.SetNonDestructive(bSafeMode);
aSplitter.SetGlue(aGlue);
//
aSplitter.Perform(); //perform the operation
if (aSplitter.HasErrors()) { //check error status
return;
}
@@ -2150,7 +2041,7 @@ The algorithm creates only closed solids. In general case the result solids are
But the algorithm allows preventing the addition of the internal for solids parts into result. In this case the result solids will be manifold and not contain any internal parts. However, this option does not prevent from the occurrence of the internal edges or vertices in the faces.<br>
Non-closed faces, free wires etc. located outside of any solid are always excluded from the result.
The Volume Maker algorithm is implemented in the class BOPAlgo_MakerVolume. It is based on the General Fuse (GF) algorithm. All the options of the GF algorithm (see @ref occt_algorithms_7_3a "GF Options") are also available in this algorithm.
The Volume Maker algorithm is implemented in the class BOPAlgo_MakerVolume. It is based on the General Fuse (GF) algorithm. All the options of the GF algorithm such as possibility to run algorithm in parallel mode, fuzzy option, safe mode, glue options and history support are also available in this algorithm.
The requirements for the arguments are the same as for the arguments of GF algorithm - they could be of any type, but each argument should be valid and not self-interfered.
@@ -2163,19 +2054,23 @@ This option is useful e.g. for building a solid from the faces of one shell or f
The usage of the algorithm on the API level:
~~~~
BOPAlgo_MakerVolume aMV;
// Set the arguments
TopTools_ListOfShape aLS = …; // arguments
aMV.SetArguments(aLS);
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
// Additional option of the algorithm
BOPCol_ListOfShape aLS = …; // arguments
Standard_Boolean bRunParallel = Standard_False; /* parallel or single mode (the default value is FALSE)*/
Standard_Boolean bIntersect = Standard_True; /* intersect or not the arguments (the default value is TRUE)*/
Standard_Real aTol = 0.0; /* fuzzy option (default value is 0)*/
Standard_Boolean bSafeMode = Standard_False; /* protect or not the arguments from modification*/
BOPAlgo_Glue aGlue = BOPAlgo_GlueOff; /* Glue option to speed up intersection of the arguments*/
Standard_Boolean bAvoidInternalShapes = Standard_False; /* Avoid or not the internal for solids shapes in the result*/
//
aMV.SetArguments(aLS);
aMV.SetRunParallel(bRunParallel);
aMV.SetIntersect(bIntersect);
aMV.SetFuzzyValue(aTol);
aMV.SetNonDestructive(bSafeMode);
aMV.SetGlue(aGlue);
aMV.SetAvoidInternalShapes(bAvoidInternalShapes);
// Perform the operation
aMV.Perform();
//
aMV.Perform(); //perform the operation
if (aMV.HasErrors()) { //check error status
return;
}
@@ -2233,7 +2128,7 @@ The algorithm can also create containers from the connected Cells added into res
The algorithm has been implemented in the *BOPAlgo_CellsBuilder* class.
Cells Builder is based on the General Fuse algorithm. Thus all options of the General Fuse algorithm (see @ref occt_algorithms_7_3a "GF Options") are also available in this algorithm.
Cells Builder is based on the General Fuse algorithm. Thus all options of the General Fuse algorithm, such as parallel processing mode, fuzzy mode, safe processing mode, gluing mode and history support are also available in this algorithm.
The requirements for the input shapes are the same as for General Fuse - each argument should be valid in terms of *BRepCheck_Analyzer* and *BOPAlgo_ArgumentAnalyzer*.
@@ -2253,14 +2148,18 @@ It is possible to create typed Containers from the parts added into result by us
Here is the example of the algorithm use on the API level:
~~~~
BOPAlgo_CellsBuilder aCBuilder;
// Set the arguments
TopTools_ListOfShape aLS = …; // arguments
BOPCol_ListOfShape aLS = …; // arguments
Standard_Boolean bRunParallel = Standard_False; /* parallel or single mode (the default value is FALSE)*/
Standard_Real aTol = 0.0; /* fuzzy option (the default value is 0)*/
Standard_Boolean bSafeMode = Standard_False; /* protect or not the arguments from modification*/
BOPAlgo_Glue aGlue = BOPAlgo_GlueOff; /* Glue option to speed up the intersection of arguments*/
//
aCBuilder.SetArguments(aLS);
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
aCBuilder.SetRunParallel(bRunParallel);
aCBuilder.SetFuzzyValue(aTol);
aCBuilder.SetNonDestructive(bSafeMode);
aCBuilder.SetGlue(aGlue);
//
aCBuilder.Perform(); // build splits of all arguments (GF)
if (aCBuilder.HasErrors()) { // check error status
return;
@@ -2270,8 +2169,8 @@ if (aCBuilder.HasErrors()) { // check error status
const TopoDS_Shape& anEmptyRes = aCBuilder.Shape(); // empty result, as nothing has been added yet
const TopoDS_Shape& anAllCells = aCBuilder.GetAllParts(); //all split parts
//
TopTools_ListOfShape aLSToTake = ...; // parts of these arguments will be taken into result
TopTools_ListOfShape aLSToAvoid = ...; // parts of these arguments will not be taken into result
BOPCol_ListOfShape aLSToTake = ...; // parts of these arguments will be taken into result
BOPCol_ListOfShape aLSToAvoid = ...; // parts of these arguments will not be taken into result
//
Standard_Integer iMaterial = 1; // defines the material for the cells
Standard_Boolean bUpdate = Standard_False; // defines whether to update the result right now or not
@@ -2819,63 +2718,6 @@ To enable the safe processing mode for the operation in DRAW, it is necessary to
bnondestructive 1
~~~~
@subsection occt_algorithms_11a_4 Disabling check of the input solids for inverted status
By default, all input solids are checked for inverted status, i.e. the solids are classified to understand if they are holes in the space (negative volumes) or normal solids (positive volumes). The possibility to disable the check of the input solids for inverted status is the advanced option in Boolean Operation component. This option can be applied to all Basic operations such as General Fuse, Splitting, Boolean, Section, Maker Volume, Cells building.
This option allows avoiding time-consuming classification of the input solids and operate with them as with positive volumes, saving up to 10 percent of time on the cases with big number of input solids.
The classification should be disabled only if the user is sure that there are no negative volumes among the input solids, otherwise the result may be invalid.
@subsubsection occt_algorithms_11a_4_1 Usage
#### API level
To enable/disable the classification of the input solids it is necessary to call *SetCheckInverted()* method with the appropriate value:
~~~~
BOPAlgo_Builder aGF;
//
....
// disabling the classification of the input solid
aGF.SetCheckInverted(Standard_False);
//
....
~~~~
#### TCL level
To enable/disable the classification of the solids in DRAW, it is necessary to call the *bcheckinverted* command with appropriate value:
* 0 - disabling the classification;
* 1 - default value, enabling the classification.
~~~~
bcheckinverted 0
~~~~
@subsection occt_algorithms_11a_5_obb Usage of Oriented Bounding Boxes
Since Oriented Bounding Boxes are usually much tighter than Axes Aligned Bounding Boxes (for more information on OBB please see the @ref occt_modat_6 "Bounding boxes" chapter of Modeling data User guide) its usage can significantly speed-up the intersection stage of the operation by reducing the number of interfering objects.
@subsubsection occt_algorithms_11a_5_obb_1 Usage
#### API level
To enable/disable the usage of OBB in the operation it is necessary to call the *SetUseOBB()* method with the approriate value:
~~~~
BOPAlgo_Builder aGF;
//
....
// Enabling the usage of OBB in the operation
aGF.SetUseOBB(Standard_True);
//
....
~~~~
#### TCL level
To enable/disable the usage of OBB in the operation in DRAW it is necessary to call the *buseobb* command with the approriate value:
* 0 - disabling the usage of OBB;
* 1 - enabling the usage of OBB.
~~~~
buseobb 1
~~~~
@section occt_algorithms_ers Errors and warnings reporting system
The chapter describes the Error/Warning reporting system of the algorithms in the Boolean Component.
@@ -2929,159 +2771,6 @@ Warning: The positioning of the shapes leads to creation of small edges without
~~~~
@section occt_algorithms_history History Information
The chapter describes the rules for filling the History Information (or just History) for the arguments of the operations in Boolean Component.
The History is available only for the VERTICES, EDGES, FACES and SOLIDS from the input arguments.
The History allows tracking the modification of the input shapes during the operation. It consists of the following information:
* Information about Deleted shapes;
* Information about Modified shapes;
* Information about Generated shapes;
All History information is filled basing on the result of current operation. History cannot return any shapes not contained in the result.
Thus if the result of the operation is empty shape, all input shapes will be considered as Deleted and none will have Modified and Generated shapes.
@subsection occt_algorithms_history_del Deleted shapes
The shape is considered as Deleted if the result shape do not contain the shape itself and none of its splits.
For example, the result of CUT operation of two overlapping planar faces (see the example below) does not contain any parts from the tool face. Thus, the tool faces is considered as Deleted.
If the faces are not fully coinciding, the result must contain some parts of the object face. In this case object face will be considered as not deleted.
But if the faces are fully coinciding, the result must be empty, and both faces will be considered as Deleted.
To get the information about Deleted shapes it is necessary to use the method *Standard_Boolean IsDeleted(const TopoDS_Shape& theS)*.
To get the information about Deleted shapes in DRAW it is necessary to use the command *bisdeleted shape*.
Example of the overlapping faces:
~~~~
plane p 0 0 0 0 0 1
mkface f1 p -10 10 -10 10
mkface f2 p 0 20 -10 10
bclearobjects
bcleartools
baddobjects f1
baddtools f2
bfillds
bbop r 2
bisdeleted f1
# Not deleted
bisdeleted f2
# Deleted
~~~~
@subsection occt_algorithms_history_modif Modified shapes
The shape is considered as Modified if the result shape contains any of the splits of the shape, not the shape itself. The shape can be modified only into the shapes with same dimension.
The splits of the shape contained in the result shape are Modified from the shape.
For example, in the FUSE operation of two edges intersecting in one point (see the example below), both edges will be split by the intersection point. All these splits will be contained in the result.
Thus, each of the input edges will be Modified into its two splits.
But in the CUT operation on the same edges, the tool edge will be Deleted from the result and, thus, will not have any Modified shapes.
To get the information about Modified shapes it is necessary to use the method *const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS)*.
The list of Modified elements will contain only those which are contained in the result of the operation. If the list is empty the shape has not been modified and it is necessary to check if it has been Deleted.
To get the information about Modified shapes in DRAW it is necessary to use the command *bmodified modif shape*.
Example of the intersecting edges:
~~~~
line l1 0 0 0 1 0 0
mkedge e1 l1 -10 10
line l2 0 0 0 0 1 0
mkedge e2 l2 -10 10
bclearobjects
bcleartools
baddobjects e1
baddtools e2
bfillds
# fuse operation
bbop r 1
bmodified m1 e1
nbshapes m1
# EDGES: 2
bmodified m2 e2
nbshapes m2
# EDGES: 2
# cut operation
bbop r 2
bmodified m1 e1
nbshapes m1
# EDGES: 2
bmodified m2 e2
# The shape has not been modified
~~~~
@subsection occt_algorithms_history_gen Generated shapes
In terms of the algorithms in Boolean Component the shape from the arguments can have Generated shapes only if these new shapes have been obtained as a result of pure intersection (not overlapping)
of this shape with any other shapes from arguments. Thus, the Generated shapes are always:
* VERTICES created from the intersection points and may be Generated from edges and faces only;
* EDGES created from the intersection edges and may be Generated from faces only.
So, only EDGES and FACES could have information about Generated shapes. For all other types of shapes the list of Generated shapes will be empty.
For example, the two intersecting edges will both have the intersection vertices Generated from them.
To get the information about Generated shapes it is necessary to use the method *const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS)*.
The list of Generated elements will contain only those which are contained in the result of the operation. If the list is empty no new shapes have been Generated from the shape.
To get the information about Generated shapes in DRAW it is necessary to use the command *bgenerated gen shape*.
Example of interfering faces
~~~~
plane p1 0 0 0 0 0 1
mkface f1 p1 -10 10 -10 10
plane p2 0 0 0 1 0 0
mkface f2 p2 -10 10 -10 10
bclearobjects
bcleartools
baddobjects f1
baddtools f2
bfillds
# fuse operation
bbop r 1
bgenerated gf1 f1
nbshapes gf1
# EDGES: 1
bgenerated gf2 f2
nbshapes gf2
# EDGES: 1
# common operation - result is empty
bbop r 0
bgenerated gf1 f1
# No shapes were generated from the shape
bgenerated gf2 f2
# No shapes were generated from the shape
~~~~
@section occt_algorithms_11b Usage
The chapter contains some examples of the OCCT Boolean Component usage. The usage is possible on two levels: C++ and Tcl.
@@ -3124,18 +2813,41 @@ The following example illustrates how to use General Fuse operator:
#include <TopTools_ListOfShape.hxx>
#include <BRepAlgoAPI_BuilderAlgo.hxx>
{…
Standard_Boolean bRunParallel;
Standard_Real aFuzzyValue;
BRepAlgoAPI_BuilderAlgo aBuilder;
//
// prepare the arguments
TopTools_ListOfShape& aLS=…;
//
bRunParallel=Standard_True;
aFuzzyValue=2.1e-5;
//
// set the arguments
aBuilder.SetArguments(aLS);
// Set options for the algorithm
// setting options on this level is similar to setting options to GF algorithm on low level (see "GF Usage" chapter)
...
// set parallel processing mode
// if bRunParallel= Standard_True : the parallel processing is switched on
// if bRunParallel= Standard_False : the parallel processing is switched off
aBuilder.SetRunParallel(bRunParallel);
//
// set Fuzzy value
// if aFuzzyValue=0.: the Fuzzy option is off
// if aFuzzyValue>0.: the Fuzzy option is on
aBuilder.SetFuzzyValue(aFuzzyValue);
//
// safe mode - avoid modification of the arguments
Standard_Boolean bSafeMode = Standard_True;
// if bSafeMode == Standard_True - the safe mode is switched on
// if bSafeMode == Standard_False - the safe mode is switched off
aBuilder.SetNonDestructive(bSafeMode);
//
// gluing options - for coinciding arguments
BOPAlgo_GlueEnum aGlueOpt = BOPAlgo_GlueFull;
// if aGlueOpt == BOPAlgo_GlueOff - the gluing mode is switched off
// if aGlueOpt == BOPAlgo_GlueShift - the gluing mode is switched on
// if aGlueOpt == BOPAlgo_GlueFull - the gluing mode is switched on
aBuilder.SetGlue(aGlueOpt);
//
// run the algorithm
aBuilder.Build();
if (aBuilder.HasErrors()) {
@@ -3162,10 +2874,28 @@ bclearobjects; bcleartools;
#
# set the arguments
baddobjects b1 b2 b3
# set options for the algorithm (see "GF Usage" chapter)
...
# set parallel processing mode
# 1: the parallel processing is switched on
# 0: the parallel processing is switched off
brunparallel 1
#
# set Fuzzy value
# 0. : the Fuzzy option is off
# >0. : the Fuzzy option is on
bfuzzyvalue 0.
#
# set safe processing mode
bnondestructive 1
# set safe mode
# 1 - the safe processing mode is switched on
# 0 - the safe processing mode is switched off
#
# set gluing mode
bglue 1
# set the gluing mode
# 1 or 2 - the gluing mode is switched on
# 0 - the gluing mode is switched off
#
# run the algorithm
# r is the result of the operation
bapibuild r
@@ -3194,9 +2924,31 @@ TopTools_ListOfShape& aLSTools = … ;
aSplitter.SetArguments(aLSObjects);
aSplitter.SetTools(aLSTools);
//
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
// set options
// parallel processing mode
Standard_Boolean bRunParallel = Standard_True;
// bRunParallel == Standard_True - the parallel processing is switched on
// bRunParallel == Standard_False - the parallel processing is switched off
aSplitter.SetRunParallel();
//
// fuzzy value - additional tolerance for the operation
Standard_Real aFuzzyValue = 1.e-5;
// if aFuzzyValue == 0. - the Fuzzy option is off
// if aFuzzyValue > 0. - the Fuzzy option is on
aSplitter.SetFuzzyValue(aFuzzyValue);
//
// safe mode - avoid modification of the arguments
Standard_Boolean bSafeMode = Standard_True;
// if bSafeMode == Standard_True - the safe mode is switched on
// if bSafeMode == Standard_False - the safe mode is switched off
aSplitter.SetNonDestructive(bSafeMode);
//
// gluing options - for coinciding arguments
BOPAlgo_GlueEnum aGlueOpt = BOPAlgo_GlueFull;
// if aGlueOpt == BOPAlgo_GlueOff - the gluing mode is switched off
// if aGlueOpt == BOPAlgo_GlueShift - the gluing mode is switched on
// if aGlueOpt == BOPAlgo_GlueFull - the gluing mode is switched on
aSplitter.SetGlue(aGlueOpt);
//
// run the algorithm
aSplitter.Build();
@@ -3229,8 +2981,27 @@ baddobjects b1 b2
# set the tools
baddtools f
#
# set options for the algorithm (see "GF Usage" chapter)
...
# set parallel processing mode
# 1: the parallel processing is switched on
# 0: the parallel processing is switched off
brunparallel 1
#
# set Fuzzy value
# 0. : the Fuzzy option is off
# >0. : the Fuzzy option is on
bfuzzyvalue 0.
#
# set safe processing mode
bnondestructive 1
# set safe mode
# 1 - the safe processing mode is switched on
# 0 - the safe processing mode is switched off
#
# set gluing mode
bglue 1
# set the gluing mode
# 1 or 2 - the gluing mode is switched on
# 0 - the gluing mode is switched off
#
# run the algorithm
# r is the result of the operation
@@ -3263,9 +3034,28 @@ The following example illustrates how to use Common operation:
aBuilder.SetArguments(aLS);
aBuilder.SetTools(aLT);
//
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
// set parallel processing mode
// if bRunParallel= Standard_True : the parallel processing is switched on
// if bRunParallel= Standard_False : the parallel processing is switched off
aBuilder.SetRunParallel(bRunParallel);
//
// set Fuzzy value
// if aFuzzyValue=0.: the Fuzzy option is off
// if aFuzzyValue>0.: the Fuzzy option is on
aBuilder.SetFuzzyValue(aFuzzyValue);
//
// safe mode - avoid modification of the arguments
Standard_Boolean bSafeMode = Standard_True;
// if bSafeMode == Standard_True - the safe mode is switched on
// if bSafeMode == Standard_False - the safe mode is switched off
aBuilder.SetNonDestructive(bSafeMode);
//
// gluing options - for coinciding arguments
BOPAlgo_GlueEnum aGlueOpt = BOPAlgo_GlueFull;
// if aGlueOpt == BOPAlgo_GlueOff - the gluing mode is switched off
// if aGlueOpt == BOPAlgo_GlueShift - the gluing mode is switched on
// if aGlueOpt == BOPAlgo_GlueFull - the gluing mode is switched on
aBuilder.SetGlue(aGlueOpt);
//
// run the algorithm
aBuilder.Build();
@@ -3295,8 +3085,27 @@ bclearobjects; bcleartools;
baddobjects b1 b3
baddtools b2
#
# set options for the algorithm (see "GF Usage" chapter)
...
# set parallel processing mode
# 1: the parallel processing is switched on
# 0: the parallel processing is switched off
brunparallel 1
#
# set Fuzzy value
# 0. : the Fuzzy option is off
# >0. : the Fuzzy option is on
bfuzzyvalue 0.
#
# set safe processing mode
bnondestructive 1
# set safe mode
# 1 - the safe processing mode is switched on
# 0 - the safe processing mode is switched off
#
# set gluing mode
bglue 1
# set the gluing mode
# 1 or 2 - the gluing mode is switched on
# 0 - the gluing mode is switched off
#
# run the algorithm
# r is the result of the operation
@@ -3330,9 +3139,28 @@ The following example illustrates how to use Fuse operation:
aBuilder.SetArguments(aLS);
aBuilder.SetTools(aLT);
//
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
// set parallel processing mode
// if bRunParallel= Standard_True : the parallel processing is switched on
// if bRunParallel= Standard_False : the parallel processing is switched off
aBuilder.SetRunParallel(bRunParallel);
//
// set Fuzzy value
// if aFuzzyValue=0.: the Fuzzy option is off
// if aFuzzyValue>0.: the Fuzzy option is on
aBuilder.SetFuzzyValue(aFuzzyValue);
//
// safe mode - avoid modification of the arguments
Standard_Boolean bSafeMode = Standard_True;
// if bSafeMode == Standard_True - the safe mode is switched on
// if bSafeMode == Standard_False - the safe mode is switched off
aBuilder.SetNonDestructive(bSafeMode);
//
// gluing options - for coinciding arguments
BOPAlgo_GlueEnum aGlueOpt = BOPAlgo_GlueFull;
// if aGlueOpt == BOPAlgo_GlueOff - the gluing mode is switched off
// if aGlueOpt == BOPAlgo_GlueShift - the gluing mode is switched on
// if aGlueOpt == BOPAlgo_GlueFull - the gluing mode is switched on
aBuilder.SetGlue(aGlueOpt);
//
// run the algorithm
aBuilder.Build();
@@ -3362,8 +3190,27 @@ bclearobjects; bcleartools;
baddobjects b1 b3
baddtools b2
#
# set options for the algorithm (see "GF Usage" chapter)
...
# set parallel processing mode
# 1: the parallel processing is switched on
# 0: the parallel processing is switched off
brunparallel 1
#
# set Fuzzy value
# 0. : the Fuzzy option is off
# >0. : the Fuzzy option is on
bfuzzyvalue 0.
#
# set safe processing mode
bnondestructive 1
# set safe mode
# 1 - the safe processing mode is switched on
# 0 - the safe processing mode is switched off
#
# set gluing mode
bglue 1
# set the gluing mode
# 1 or 2 - the gluing mode is switched on
# 0 - the gluing mode is switched off
#
# run the algorithm
# r is the result of the operation
@@ -3397,9 +3244,28 @@ The following example illustrates how to use Cut operation:
aBuilder.SetArguments(aLS);
aBuilder.SetTools(aLT);
//
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
// set parallel processing mode
// if bRunParallel= Standard_True : the parallel processing is switched on
// if bRunParallel= Standard_False : the parallel processing is switched off
aBuilder.SetRunParallel(bRunParallel);
//
// set Fuzzy value
// if aFuzzyValue=0.: the Fuzzy option is off
// if aFuzzyValue>0.: the Fuzzy option is on
aBuilder.SetFuzzyValue(aFuzzyValue);
//
// safe mode - avoid modification of the arguments
Standard_Boolean bSafeMode = Standard_True;
// if bSafeMode == Standard_True - the safe mode is switched on
// if bSafeMode == Standard_False - the safe mode is switched off
aBuilder.SetNonDestructive(bSafeMode);
//
// gluing options - for coinciding arguments
BOPAlgo_GlueEnum aGlueOpt = BOPAlgo_GlueFull;
// if aGlueOpt == BOPAlgo_GlueOff - the gluing mode is switched off
// if aGlueOpt == BOPAlgo_GlueShift - the gluing mode is switched on
// if aGlueOpt == BOPAlgo_GlueFull - the gluing mode is switched on
aBuilder.SetGlue(aGlueOpt);
//
// run the algorithm
aBuilder.Build();
@@ -3429,8 +3295,27 @@ bclearobjects; bcleartools;
baddobjects b1 b3
baddtools b2
#
# set options for the algorithm (see "GF Usage" chapter)
...
# set parallel processing mode
# 1: the parallel processing is switched on
# 0: the parallel processing is switched off
brunparallel 1
#
# set Fuzzy value
# 0. : the Fuzzy option is off
# >0. : the Fuzzy option is on
bfuzzyvalue 0.
#
# set safe processing mode
bnondestructive 1
# set safe mode
# 1 - the safe processing mode is switched on
# 0 - the safe processing mode is switched off
# set gluing mode
#
bglue 1
# set the gluing mode
# 1 or 2 - the gluing mode is switched on
# 0 - the gluing mode is switched off
#
# run the algorithm
# r is the result of the operation
@@ -3465,9 +3350,28 @@ The following example illustrates how to use Section operation:
aBuilder.SetArguments(aLS);
aBuilder.SetTools(aLT);
//
// Set options for the algorithm
// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
...
// set parallel processing mode
// if bRunParallel= Standard_True : the parallel processing is switched on
// if bRunParallel= Standard_False : the parallel processing is switched off
aBuilder.SetRunParallel(bRunParallel);
//
// set Fuzzy value
// if aFuzzyValue=0.: the Fuzzy option is off
// if aFuzzyValue>0.: the Fuzzy option is on
aBuilder.SetFuzzyValue(aFuzzyValue);
//
// safe mode - avoid modification of the arguments
Standard_Boolean bSafeMode = Standard_True;
// if bSafeMode == Standard_True - the safe mode is switched on
// if bSafeMode == Standard_False - the safe mode is switched off
aBuilder.SetNonDestructive(bSafeMode);
//
// gluing options - for coinciding arguments
BOPAlgo_GlueEnum aGlueOpt = BOPAlgo_GlueFull;
// if aGlueOpt == BOPAlgo_GlueOff - the gluing mode is switched off
// if aGlueOpt == BOPAlgo_GlueShift - the gluing mode is switched on
// if aGlueOpt == BOPAlgo_GlueFull - the gluing mode is switched on
aBuilder.SetGlue(aGlueOpt);
//
// run the algorithm
aBuilder.Build();
@@ -3497,8 +3401,27 @@ bclearobjects; bcleartools;
baddobjects b1 b3
baddtools b2
#
# set options for the algorithm (see "GF Usage" chapter)
...
# set parallel processing mode
# 1: the parallel processing is switched on
# 0: the parallel processing is switched off
brunparallel 1
#
# set Fuzzy value
# 0. : the Fuzzy option is off
# >0. : the Fuzzy option is on
bfuzzyvalue 0.
#
# set safe processing mode
bnondestructive 1
# set safe mode
# 1 - the safe processing mode is switched on
# 0 - the safe processing mode is switched off
#
# set gluing mode
bglue 1
# set the gluing mode
# 1 or 2 - the gluing mode is switched on
# 0 - the gluing mode is switched off
#
# run the algorithm
# r is the result of the operation

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 641 KiB

View File

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

View File

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

View File

@@ -91,59 +91,26 @@ XDE can read and write colors and layers assigned to shapes or their subparts (d
@figure{/user_guides/xde/images/xde_image006.png,"Colors and Layers",240}
@subsection occt_xde_1_7 Geometric Dimensions & Tolerances (GD\&T)
GD\&T are a type of Product and Manufacturing Information (PMI) that can be either computed automatically by a CAD system,
or entered manually by the user. For detailed information use <a href="https://www.cax-if.org/documents/rec_pracs_pmi_v40.pdf">CAx-IF Recommended Practices
for the Representation and Presentation of Product Manufacturing Information (PMI) (AP242)</a>
XDE can read and write GD\&T data of the following types:
* dimensions, such as distance, length, radius and so on;
* geometric tolerances;
* datums, i.e a theoretically exact geometric references, such as point, line or plane, to which toleranced features are related.
XDE supports two presentations of GD\&T data:
* semantic presentation, i.e. data is stored in a machine-consumable way and includes all information required to understand the
specification without the aid of any presentation elements;
* tessellated presentation, i.e. data is displayed in a human-readable way.
@subsection occt_xde_1_8 Clipping planes
XDE supports reading from STEP and storing named planes used for clipping.
Currently, XDE supports saving of clipping planes in XBF format only.
XDE provides capabilities for adding, editing and removing clipping planes.
@subsection occt_xde_1_9 Saved views
XDE supports reading from STEP views. Views allow to save information about camera parameters (position, direction, zoom factor, etc.)
and visible shapes, PMIs, used clipping planes and notes. Currently, XDE supports saving of clipping planes in XBF format only.
XDE provides the following view management capabilities:
* add/remove views;
* set view camera parameters;
* set visible shapes, PMIs, used clipping planes and notes.
@subsection occt_xde_1_10 Custom notes
@subsection occt_xde_1_7 Custom notes
Custom notes is a kind of application-specific data attached to assembly items, their attributes and sub-shapes. Basically, there are simple textual comments, binary data and other application-specific data. Each note is provided with a timestamp and the user who created it.
Custom notes is a kind of application specific data attached to assembly items, their attributes and sub-shapes. Basically, there are simple textual comments, binary data and other application specific data. Each note is provided with a timestamp and the user created it.
Notes API provides the following functionality:
* Returns the total number of notes and annotated items;
* Returns labels for all notes and annotated items;
* Returns total number of notes and annotated items
* Returns labels for all notes and annotated items
* Creates notes:
- Comment note from a text string;
- Binary data note from a file or byte array;
* Checks if an assembly item is annotated;
* Finds a label for the annotated item;
* Returns all note labels for the annotated item;
* Adds a note to item(s):
- Assembly item;
- Assembly item attribute;
- Assembly item subshape index;
* Removes note(s) from an annotated assembly item; orphan note(s) might be deleted optionally (items without linked notes will be deleted automatically);
* Deletes note(s) and removes them from annotated items;
* Gets / deletes orphan notes.
- Comment note from a text string
- Binary data note from a file or byte array
* Checks if an assembly item is annotated
* Finds a label for the annotated item
* Returns all note labels for the annotated item
* Add a note to item(s):
- Assembly item
- Assembly item attribute
- Assembly item subshape index
* Remove note(s) from an annotated assembly item; orphan note(s) might be deleted optionally (items without linked notes will be deleted automatically)
* Delete note(s) and removes them from annotated items
* Get / delete orphan notes
@section occt_xde_2 Working with XDE
@@ -537,7 +504,7 @@ XDE can read and write colors and layers assigned to shapes or their subparts (d
@figure{/user_guides/xde/images/239_xde_12_400.png,"Motor Head",240}
In an XDE document, colors are managed by the class *XCAFDoc_ColorTool*. It works basing on the same principles as ShapeTool works with Shapes. This tool can be provided on the Main Label or on any sub-label. The Property itself is defined as an *XCAFDoc_Color*, sub-class of *TDF_Attribute*.
In an XDE document, colors are managed by the class *XCAFDoc_ColorTool*. This is done with the same principles as for ShapeTool with Shapes, and with the same capability of having a tool on the Main Label, or on any sub-label. The Property itself is defined as an *XCAFDoc_Color*, sub-class of *TDF_Attribute*.
Colors are stored in a child of the starting document label: it is the second level (0.1.2), while Shapes are at the first level. Each color then corresponds to a dedicated label, the property itself is a Quantity_Color, which has a name and value for Red, Green, Blue. A Color may be attached to Surfaces (flat colors) or to Curves (wireframe colors), or to both. A Color may be attached to a sub-shape. In such a case, the sub-shape (and its own sub-shapes) takes its own Color as a priority.
@@ -660,277 +627,29 @@ To remove a Color and all the references to it (so that the related shapes will
myColors->RemoveColor(ColLabel);
~~~~~
@subsection occt_xde_2_7 Geometric Dimensions & Tolerances (GD\&T)
@subsection occt_xde_2_7 Custom notes
XDE can read and write GD\&T assigned to shapes or their subparts (down to the level of faces and edges) to and from STEP formats.
In an XDE document, custom notes are managed by the class *XCAFDoc_NotesTool*. This is done with the same principles as for ShapeTool with Shapes, and with the same capability of having a tool on the Main Label, or on any sub-label. The Property itself is defined as sub-classes of an *XCAFDoc_Note* abstract class, which is a sub-class of *TDF_Attribute* one.
In an XDE document, GD\&T are managed by the class *XCAFDoc_DimTolTool*. It works basing on the same principles as ShapeTool works with Shapes. This tool can be provided on the Main Label or on any sub-label. The GD\&T entities themselves are defined as the following sub-classes of *TDF_Attribute*:
* *XCAFDoc_Dimension* - for dimensions;
* *XCAFDoc_GeomTolerance* - for geometric tolerances;
* *XCAFDoc_Datum* - for geometric tolerance Datums.
A GD\&T type is identified by the attributes listed above, i.e. *XCAFDoc_DimTolTool* methods working with particular entity types check
for presence of the corresponding attributes in passed labels. One can use methods of *XCAFDoc_DimTolTool* beginning with 'Is' for this purpose.
GD\&T entities are stored in a child of the starting document label 0.1.4.
Each GD\&T entity then corresponds to the dedicated label, the property itself is one of access classes:
* *XCAFDimTolObject_DimensionObject* - for dimensions;
* *XCAFDimTolObject_GeomToleranceObject* - for geometric tolerances;
* *XCAFDimTolObject_DatumObject* - for geometric tolerance Datums.
GD\&Ts and Shapes are related to by Graph Nodes.
These definitions are common to various exchange formats, at least for STEP.
@subsubsection occt_xde_2_7_1 Initialization
To query, edit, or initialize a Document to handle GD\&Ts of XCAF, use:
~~~~~
Handle(XCAFDoc_DimTolTool) myDimTolTool =
XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
~~~~~
This call can be used at any time. When it is used for the first time, a relevant structure is added to the document. This definition is used for all later GD\&T calls and is not repeated for them.
@subsubsection occt_xde_2_7_2 Adding a GD\&T
*XCAFDoc_DimTolTool* provides methods to create GD\&T 'empty' entities:
* *AddDimension* - for a new dimension;
* *AddGeomTolerance* - for a new geometric tolerance;
* *AddDatum* - for a new geometric tolerance datum.
All methods create a sub-label for the corresponding GD\&T entity of the tool master label and attach an attribute specific for the
created entity.
Here is an example of adding a new dimension:
~~~~~
TDF_Label aDimLabel = myDimTolTool->AddDimension();
if (!aDimLabel.IsNull())
{
// error processing
}
~~~~~
A similar approach can be used for other GD\&T types.
@subsubsection occt_xde_2_7_3 Editing a GD\&T
A newly added GD\&T entity is empty. To set its data a corresponding access object should be used as it is demonstrated
below, where the dimension becomes the linear distance between two points.
~~~~~
Handle(XCAFDoc_Dimension) aDimAttr;
aDimLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimAttr);
if (!aDimAttr.IsNull())
{
Handle(XCAFDimTolObjects_DimensionObject) aDimObject = aDimAttr->GetObject();
// set dimension data
aDimObject->SetType(XCAFDimTolObjects_DimensionType_Location_LinearDistance);
aDimObject->SetPoint(thePnt1); // the first reference point
aDimObject->SetPoint2(thePnt2); // the second reference point
aDimObject->SetValue(theValue); // the distance value
//...
aDimAttr->SetObject(aDimObject);
}
~~~~~
A similar approach can be used for other GD\&T types.
@subsubsection occt_xde_2_7_4 Linking GD\&Ts
To link a GD\&T entity with other OCAF labels (e.g. representing shapes) one should use the following methods:
* *SetDimension* - for dimensions;
* *SetGeomTolerance* - for geometric tolerances;
* SetDatum - for geometric tolerance datums.
These methods can take a single label or a sequence of labels. All previous links will be removed.
The example below demonstrates linking of a dimension to sequences of shape labels:
~~~~~
TDF_LabelSequence aShapes1, aShapes2;
aShapes1.Append(aShape11);
//...
aShapes2.Append(aShape21);
//...
aDGTTool->SetDimension(aShapes1, aShapes2, aDimLabel);
~~~~~
In addition, a special method *SetDatumToGeomTol* should be used to link a datum with a geometric tolerance.
@subsubsection occt_xde_2_7_5 Finding GD\&Ts and reference shapes
*XCAFDimTolObjects_Tool* class provides basic capabilities for searching GD\&Ts linked to shapes.
Using the tool one can get sequences of dimensions, geometric tolerances and datums linked with a shape. A series of related datums is also returned for geometric tolerances.
To get reference shapes for a GD\&T entity one can use *GetRefShapeLabel* from *XCAFDoc_DimTolTool*.
*XCAFDoc_DimTolTool* provides methods to get lists of all dimensions, geometric tolerances and datums.
@subsubsection occt_xde_2_7_6 Storing custom data
Every GD\&T entity in XDE is represented as a label with attached attribute identifying entity type. All specific data is
stored in sub-labels in standard OCAF attributes, such as *TDataStd_Integer*, *TDataStd_IntegerArray*, *TDataStd_RealArray* and so on.
Sub-label tags are reserved for internal use and cannot be used for storing custom data. The following tag ranges are reserved for
GD\&T entities:
* 1 - 17 - for dimensions;
* 1 - 17 - for geometric tolerances;
* 1 - 19 - for datums.
Custom data can be stored in labels with tags beyond the ranges listed above.
@subsection occt_xde_2_8 Clipping planes
In an XDE document, Clipping planes are managed by the class *XCAFDoc_ClippingPlaneTool*. It works basing on the same principles as ShapeTool works with Shapes. This tool can be provided on the Main Label or on any sub-label. Clipping planes are stored in a child of the starting document label 0.1.8, where planes themselves are defined as *TDataXtd_Plane* attribute. *TDataStd_Name* attribute is used for naming.
To query, edit, or initialize a Document to handle clipping planes of XCAF, use:
~~~~~
Handle(XCAFDoc_ClippingPlaneTool) myClipPlaneTool =
XCAFDoc_DocumentTool::ClippingPlaneTool(Doc->Main());
~~~~~
This call can be used at any time. When it is used for the first time, a relevant structure is added to the document.
To add a clipping plane use one of overloaded methods *AddClippingPlane*, e.g.:
~~~~~
gp_Pln aPln = ...
Standard_Boolean aCapping = ...
TDF_Label aClipPlnLbl = myClipPlaneTool->AddClippingPlane(aPln, "Name of plane", aCapping);
if (aClipPlnLbl.IsNull())
{
// error processing
}
~~~~~
To remove a plane use *RemoveClippingPlane* method, e.g.:
~~~~~
if (!myClipPlaneTool->RemoveClippingPlane(aClipPlnLbl))
{
// not removed
}
~~~~~
The plane will not be removed if it is referenced in at least one view.
To change clipping plane and its name use *UpdateClippingPlane* method, e.g.:
~~~~~
gp_Pln aPln = ...
myClipPlaneTool->UpdateClippingPlane(aClipPlnLbl, aPln, "New name of plane");
~~~~~
Capping property can be changed using *SetCapping* method, e.g.:
~~~~~
Standard_Boolean aCapping = ...
myClipPlaneTool->SetCapping(aClipPlnLbl, aCapping);
~~~~~
*XCAFDoc_ClippingPlaneTool* can be used to get all clipping plane labels and to check if a label belongs to the ClippingPlane table, e.g.:
~~~~~
TDF_LabelSequence aClipPlaneLbls;
myClipPlaneTool->GetClippingPlanes(aClipPlaneLbls);
...
for (TDF_LabelSequence::Iterator anIt(aClipPlaneLbls); anIt.More(); anIt.Next())
{
if (myClipPlaneTool->IsClippingPlane(anIt.Value()))
{
// the label is a clipping plane
gp_Pln aPln;
TCollection_ExtendedString aName;
Standard_Boolean aCapping;
if (!myClipPlaneTool->GetClippingPlane(anIt.Value(), aPln, aName, aCapping))
{
// error processing
}
...
}
}
~~~~~
@subsection occt_xde_2_9 Saved views
In an XDE document, Views are managed by the class *XCAFDoc_ViewTool*. It works basing on the same principles as ShapeTool works with Shapes. This tool can be provided on the Main Label or on any sub-label. Views are stored in a child of the starting document label 0.1.7, where a view itself is defined as *XCAFDoc_View* sub-class of *TDF_Attribute*. Views and selected shapes, clipping planes, GD\&Ts and notes are related to by Graph Nodes.
To query, edit, or initialize a Document to handle views of XCAF, use:
~~~~~
Handle(XCAFDoc_ViewTool) myViewTool =
XCAFDoc_DocumentTool::ViewTool(Doc->Main());
~~~~~
This call can be used at any time. When it is used for the first time, a relevant structure is added to the document.
To add a view use *AddView* method and an access *XCAFView_Object* object to set camera parameters, e.g.:
~~~~~
TDF_Label aViewLbl = myViewTool->AddView();
if (aViewLbl.IsNull())
{
// error processing
}
Handle(XCAFDoc_View) aViewAttr;
aViewLbl.FindAttribute(XCAFDoc_View::GetID(), aViewAttr);
if (!aViewAttr.IsNull())
{
Handle(XCAFView_Object) aViewObject = aViewAttr->GetObject();
// set view data
aViewObject->SetType(XCAFView_ProjectionType_Parallel);
aViewObject->SetViewDirection(theViewDir);
aViewObject->SetZoomFactor(2.0);
...
aViewAttr->SetObject(aViewObject);
}
~~~~~
To set shapes, clipping planes, GD\&Ts and notes selected for the view use one of overloaded *SetView* methods of *XCAFDoc_ViewTool*.
To set only clipping planes one should use *SetClippingPlanes* method.
~~~~~
TDF_LabelSequence aShapes; ...
TDF_LabelSequence aGDTs; ...
myViewTool->SetView(aShapes, aGDTs, aViewLbl);
TDF_LabelSequence aClippingPlanes; ...
myViewTool->SetClippingPlanes(aClippingPlanes, aViewLbl);
~~~~~
To remove a view use *RemoveView* method.
To get all view labels and check if a label belongs to the View table use:
~~~~~
TDF_LabelSequence aViewLbls;
myViewTool->GetViewLabels(aViewLbls);
...
for (TDF_LabelSequence::Iterator anIt(aViewLbls); anIt.More(); anIt.Next())
{
if (myViewTool->IsView(anIt.Value()))
{
// the label is a view
...
}
}
~~~~~
To get shapes, clipping planes, GD\&Ts or notes associated with a particular view use the following methods:
* *GetRefShapeLabel* - returns a sequence of associated shape labels;
* *GetRefGDTLabel* - returns a sequence of associated GDT labels;
* *GetRefClippingPlaneLabel* - returns a sequence of associated clipping plane labels;
* *GetRefNoteLabel* - returns a sequence of associated note labels;
* *GetRefAnnotationLabel* - returns a sequence of associated annotated labels.
And vice versa, to get views that display a particular clipping plane, GD\&T or note use the following methods:
* *GetViewLabelsForShape* - returns a sequence of associated view labels for a shape;
* *GetViewLabelsForGDT* - returns a sequence of associated view labels for a GD\&T;
* *GetViewLabelsForClippingPlane* - returns a sequence of associated view labels for a clipping plane;
* *GetViewLabelsForNote* - returns a sequence of associated view labels for a note;
* *GetViewLabelsForAnnotation* - returns a sequence of associated view labels for an annotated label.
@subsection occt_xde_2_10 Custom notes
In an XDE document, custom notes are managed by the class *XCAFDoc_NotesTool*.
It works basing on the same principles as ShapeTool works with Shapes.
This tool can be provided on the Main Label or on any sub-label.
The Property itself is defined as sub-class of *XCAFDoc_Note* abstract class, which is a sub-class of *TDF_Attribute* one.
Custom notes are stored in a child of the *XCAFDoc_NotesTool* label, at label 0.1.9.1. Each note then corresponds to a dedicated label. A note may be attached to a document item identified by a label, a sub-shape identified by integer index or an attribute identified by GUID. Annotations are stored in a child of the *XCAFDoc_NotesTool* label, at label 0.1.9.2.
Custom notes are stored in a child of the *XCAFDoc_NotesTool* label: it is at label 0.1.9.1. Each note then corresponds to a dedicated label. A note may be attached to a document item identified by a label, a sub-shape identified by integer index or an attribute identified by GUID. Annotations are stored in a child of the *XCAFDoc_NotesTool* label: it is at label 0.1.9.2.
Notes binding is done through *XCAFDoc_GraphNode* attribute.
@figure{/user_guides/xde/images/xde_notes001.png,"Structure of notes part of XCAF document",240}
@subsubsection occt_xde_2_10_1 Initialization
@subsubsection occt_xde_2_7_1 Initialization
To query, edit, or initialize a Document to handle custom notes of XCAF, use:
~~~~~
Handle(XCAFDoc_NotesTool) myNotes =
XCAFDoc_DocumentTool::NotesTool(Doc->Main ());
~~~~~
This call can be used at any time. The first time it is used, a relevant structure is added to the document. This definition is used for all later notes calls and will not be repeated for them.
This call can be used at any time. The first time it is used, a relevant structure is added to the document. This definition is used for all the following notes calls and will not be repeated for these.
@subsubsection occt_xde_2_10_2 Creating Notes
@subsubsection occt_xde_2_7_2 Creating Notes
Before annotating a Document item a note must be created using one of the following methods of *XCAFDoc_NotesTool* class:
- *CreateComment* : creates a note with a textual comment;
- *CreateBinData* : creates a note with arbitrary binary data, e.g. contents of a file.
- CreateComment : creates a note with a textual comment
- CreateBinData : creates a note with arbitrary binary data, e.g. contents of a file
Both methods return an instance of *XCAFDoc_Note* class.
~~~~~
@@ -939,13 +658,13 @@ Handle(XCAFDoc_Note) myNote = myNotes->CreateComment("User", "Timestamp", "Hello
~~~~~
This code adds a child label to label 0.1.9.1 with *XCAFDoc_NoteComment* attribute.
@subsubsection occt_xde_2_10_3 Editing a Note
@subsubsection occt_xde_2_7_3 Editing a Note
An instance of *XCAFDoc_Note* class can be used for note editing.
One may change common note data.
~~~~~
myNote->Set("New User", "New Timestamp");
~~~~~
To change specific data one needs to down cast *myNote* handle to the appropriate sub-class:
To change specific data one need to down cast *myNote* handle to the appropriate sub-class:
~~~~~
Handle(XCAFDoc_NoteComment) myCommentNote = Handle(XCAFDoc_NoteComment)::DownCast(myNote);
if (!myCommentNote.IsNull()) {
@@ -953,12 +672,12 @@ if (!myCommentNote.IsNull()) {
}
~~~~~
@subsubsection occt_xde_2_10_4 Adding Notes
@subsubsection occt_xde_2_7_4 Adding Notes
Once a note has been created it can be bound to a Document item using the following *XCAFDoc_NotesTool* methods:
- *AddNote* : binds a note to a label;
- *AddNoteToAttr* : binds a note to a label's attribute;
- *AddNoteToSubshape* : binds a note to a sub-shape.
- AddNote : binds a note to a label
- AddNoteToAttr : binds a note to a label's attribute
- AddNoteToSubshape : binds a note to a sub-shape
All methods return a pointer to *XCAFDoc_AssemblyItemRef* attribute identifying the annotated item.
~~~~~
@@ -971,14 +690,14 @@ Handle(XCAFDoc_AssemblyItemRef) myRefAttr = myNotes->AddNoteToAttr(myNote->Label
Standard_Integer theSubshape = 1;
Handle(XCAFDoc_AssemblyItemRef) myRefSubshape = myNotes->AddNoteToSubshape(myNote->Label(), theSubshape);
~~~~~
This code adds three child labels with *XCAFDoc_AssemblyItemRef* attribute to label 0.1.9.2. *XCAFDoc_GraphNode* attributes are added to the child labels and note labels.
This code adds three child labels to label 0.1.9.2 with *XCAFDoc_AssemblyItemRef* attribute with *XCAFDoc_GraphNode* attributes added to this and note labels.
@subsubsection occt_xde_2_10_5 Finding Notes
@subsubsection occt_xde_2_7_5 Finding Notes
To find annotation labels under label 0.1.9.2 use the following *XCAFDoc_NotesTool* methods:
- *FindAnnotatedItem* : returns an annotation label for a label;
- *FindAnnotatedItemAttr* : returns an annotation label for a label's attribute;
- *FindAnnotatedItemSubshape* : returns an annotation label for a sub-shape.
- FindAnnotatedItem : returns an annotation label for a label
- FindAnnotatedItemAttr : returns an annotation label for a label's attribute
- FindAnnotatedItemSubshape : returns an annotation label for a sub-shape
~~~~~
Handle(XCAFDoc_NotesTool) myNotes = ...
@@ -992,9 +711,9 @@ TDF_Label myLabelSubshape = myNotes->FindAnnotatedItemSubshape(theLabel, theSubs
Null label will be returned if there is no corresponding annotation.
To get all notes of the Document item use the following *XCAFDoc_NotesTool* methods:
- *GetNotes* : outputs a sequence of note labels bound to a label;
- *GetAttrNotes* : outputs a sequence of note labels bound to a label's attribute;
- *GetAttrSubshape* : outputs a sequence of note labels bound to a sub-shape.
- GetNotes : outputs a sequence of note labels bound to a label
- GetAttrNotes : outputs a sequence of note labels bound to a label's attribute
- GetAttrSubshape : outputs a sequence of note labels bound to a sub-shape
All these methods return the number of notes.
~~~~~
@@ -1010,12 +729,12 @@ TDF_LabelSequence theNotesSubshape;
myNotes->GetAttrSubshape(theLabel, theSubshape, theNotesSubshape);
~~~~~
@subsubsection occt_xde_2_10_6 Removing Notes
@subsubsection occt_xde_2_7_6 Removing Notes
To remove a note use one of the following *XCAFDoc_NotesTool* methods:
- *RemoveNote* : unbinds a note from a label;
- *RemoveAttrNote* : unbinds a note from a label's attribute;
- *RemoveSubshapeNote* : unbinds a note from a sub-shape.
- RemoveNote : unbinds a note from a label
- RemoveAttrNote : unbinds a note from a label's attribute
- RemoveSubshapeNote : unbinds a note from a sub-shape
~~~~~
Handle(XCAFDoc_Note) myNote = ...
@@ -1027,31 +746,30 @@ Standard_Integer theSubshape = 1;
myNotes->RemoveSubshapeNote(myNote->Label(), theSubshape);
~~~~~
A note will not be deleted automatically.
Counterpart methods to remove all notes are available, too.
Counterpart methods to remove all notes are available too.
@subsubsection occt_xde_2_10_7 Deleting Notes
@subsubsection occt_xde_2_7_7 Deleting Notes
To delete note(s) use the following *XCAFDoc_NotesTool* methods:
- *DeleteNote* : deletes a single note;
- *DeleteNotes* : deletes a sequence of notes;
- *DeleteAllNotes* : deletes all Document notes;
- *DeleteOrphanNotes* : deletes notes not bound to Document items.
- DeleteNote : deletes a single note
- DeleteNotes : deletes a sequence of notes
- DeleteAllNotes : deletes all Document notes
- DeleteOrphanNotes : deletes notes not bound to Document items
All these methods except for the last one break all links with Document items as well.
All these methods excepting the last one break all links with Document items as well.
@subsection occt_xde_2_11 Reading and Writing STEP or IGES
@subsection occt_xde_2_8 Reading and Writing STEP or IGES
Note that saving and restoring the document itself are standard OCAF operations. As the various previously described definitions enter into this frame, they will not be explained any further.
The same can be said for Viewing: presentations can be defined from Shapes and Colors.
There are several important points to consider:
* Previously defined Readers and Writers for dealing with Shapes only, whether Standard or Advanced, remain unchanged in their form and in their dependencies. In addition, functions other than mapping are also unchanged.
* XDE provides mapping with data other than Shapes. Names, Colors, Layers, GD\&T, Clipping planes, Views, Validation Properties (Centroid, Volume, Area), and Assembly Structure are hierarchic with rigid motion. Currently, Clipping planes and Views writing supported for XBF format only.
* XDE provides mapping with data other than Shapes. Names, Colors, Layers, Validation Properties (Centroid, Volume, Area), and Assembly Structure are hierarchic with rigid motion.
* XDE mapping is relevant for use within the Advanced level of Data Exchanges, rather than Standard ones, because a higher level of information is better suited to a higher quality of shapes. In addition, this allows to avoid the multiplicity of combinations between various options. Note that this choice is not one of architecture but of practical usage and packaging.
* Reader and Writer classes for XDE are generally used like those for Shapes. However, their use is adapted to manage a Document rather than a Shape.
The packages to manage this are *IGESCAFControl* for IGES, and *STEPCAFControl* for STEP.
@subsubsection occt_xde_2_11_1 Reading a STEP file
@subsubsection occt_xde_2_8_1 Reading a STEP file
To read a STEP file by itself, use:
~~~~~
@@ -1072,7 +790,7 @@ if ( !reader.Transfer ( doc ) ) {
~~~~~
In addition, the reader provides methods that are applicable to document transfers and for directly querying of the data produced.
@subsubsection occt_xde_2_11_2 Writing a STEP file
@subsubsection occt_xde_2_8_2 Writing a STEP file
To write a STEP file by itself, use:
~~~~~
@@ -1093,19 +811,18 @@ if ( ! writer.Transfer ( Doc, mode ) ) {
IFSelect_ReturnStatus stat = writer.Write(file-name);
~~~~~
@subsubsection occt_xde_2_11_3 Reading an IGES File
@subsubsection occt_xde_2_8_3 Reading an IGES File
Use the same procedure as for a STEP file but with IGESCAFControl instead of STEPCAFControl.
@subsubsection occt_xde_2_11_4 Writing an IGES File
@subsubsection occt_xde_2_8_4 Writing an IGES File
Use the same procedure as for a STEP file but with IGESCAFControl instead of STEPCAFControl.
@subsection occt_xde_2_12 Using an XDE Document
@subsection occt_xde_2_9 Using an XDE Document
There are several ways of exploiting XDE data from an application, you can:
1. Get the data relevant for the application by mapping XDE/Appli, then discard the XDE data once it has been used.
2. Create a reference from the Application Document to the XDE Document, to have its data available as external data.
3. Embed XDE data inside the Application Document (see the following section for details).
4. Directly exploit XDE data such as when using file checkers.
@subsubsection occt_xde_2_12_1 XDE Data inside an Application Document
@subsubsection occt_xde_2_91 XDE Data inside an Application Document
To have XCAF data elsewhere than under label 0.1, you use the DocLabel of XDE. The method DocLabel from XCAFDoc_DocumentTool determines the relevant Label for XCAF. However, note that the default is 0.1.
In addition, as XDE data is defined and managed in a modular way, you can consider exclusively Assembly Structure, only Colors, and so on.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -345,7 +345,7 @@ void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
//function : Compute
//purpose :
//=======================================================================
void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
@@ -359,46 +359,32 @@ void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& theP
thePrs->SetInfiniteState (Standard_True);
}
switch (theMode)
if (theMode == AIS_Shaded)
{
case AIS_WireFrame:
if (myDrawer->IsAutoTriangulation())
{
// compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
// After this call if type of deflection is relative
// computed deflection coefficient is stored as absolute.
Prs3d::GetDeflection (myshape, myDrawer);
break;
}
case AIS_Shaded:
{
if (myDrawer->IsAutoTriangulation())
Standard_Boolean wasRecomputed = StdPrs_ToolTriangulatedShape::Tessellate (myshape, myDrawer);
// Set to update wireframe presentation on triangulation.
if (myDrawer->IsoOnTriangulation() && wasRecomputed)
{
// compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
// After this call if type of deflection is relative
// computed deflection coefficient is stored as absolute.
Standard_Boolean wasRecomputed = StdPrs_ToolTriangulatedShape::Tessellate (myshape, myDrawer);
// Set to update wireframe presentation on triangulation.
if (myDrawer->IsoOnTriangulation() && wasRecomputed)
{
SetToUpdate (AIS_WireFrame);
}
SetToUpdate (AIS_WireFrame);
}
break;
}
case 2:
{
AIS_Shape::Compute (thePrsMgr, thePrs, theMode);
return;
}
default:
{
return;
}
}
else // WireFrame mode
{
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
// After this call if type of deflection is relative
// computed deflection coefficient is stored as absolute.
Prs3d::GetDeflection (myshape, myDrawer);
}
// Extract myShapeColors map (KeyshapeColored -> Color) to subshapes map (Subshape -> Color).
// This needed when colored shape is not part of BaseShape (but subshapes are) and actually container for subshapes.
@@ -509,9 +495,9 @@ void AIS_ColoredShape::ComputeSelection (const Handle(SelectMgr_Selection)& theS
aTypOfSel, aPriority, aDeflection, aDeviationAngle);
Handle(SelectMgr_SelectableObject) aThis (this);
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
for (theSelection->Init(); theSelection->More(); theSelection->Next())
{
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelEntIter.Value()->BaseSensitive()->OwnerId());
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (theSelection->Sensitive()->BaseSensitive()->OwnerId());
anOwner->Set (aThis);
}

View File

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

View File

@@ -335,31 +335,31 @@ TCollection_ExtendedString AIS_Dimension::GetValueString (Standard_Real& theWidt
if (myDrawer->DimensionAspect()->IsText3d())
{
// text width produced by BRepFont
Font_BRepFont aFont (aTextAspect->Aspect()->Font().ToCString(),
aTextAspect->Aspect()->GetTextFontAspect(),
aTextAspect->Height());
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
Font_BRepFont aFont;
if (aFont.FindAndInit (aTextAspect->Aspect()->Font(), aTextAspect->Aspect()->GetTextFontAspect(), aTextAspect->Height(), Font_StrictLevel_Any))
{
Standard_Utf32Char aCurrChar = *anIter;
Standard_Utf32Char aNextChar = *(++anIter);
theWidth += aFont.AdvanceX (aCurrChar, aNextChar);
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
{
Standard_Utf32Char aCurrChar = *anIter;
Standard_Utf32Char aNextChar = *(++anIter);
theWidth += aFont.AdvanceX (aCurrChar, aNextChar);
}
}
}
else
{
// Text width for 1:1 scale 2D case
Handle(Font_FTFont) aFont = new Font_FTFont();
aFont->Init (aTextAspect->Aspect()->Font().ToCString(),
aTextAspect->Aspect()->GetTextFontAspect(),
(const unsigned int)aTextAspect->Height(),
THE_2D_TEXT_RESOLUTION);
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
Font_FTFontParams aFontParams;
aFontParams.PointSize = (unsigned int )aTextAspect->Height();
aFontParams.Resolution = THE_2D_TEXT_RESOLUTION;
if (Handle(Font_FTFont) aFont = Font_FTFont::FindAndCreate (aTextAspect->Aspect()->Font(), aTextAspect->Aspect()->GetTextFontAspect(), aFontParams, Font_StrictLevel_Any))
{
Standard_Utf32Char aCurrChar = *anIter;
Standard_Utf32Char aNextChar = *(++anIter);
theWidth += (Standard_Real) aFont->AdvanceX (aCurrChar, aNextChar);
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
{
Standard_Utf32Char aCurrChar = *anIter;
Standard_Utf32Char aNextChar = *(++anIter);
theWidth += (Standard_Real) aFont->AdvanceX (aCurrChar, aNextChar);
}
}
}

View File

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

View File

@@ -186,11 +186,11 @@ AIS_InteractiveContext::~AIS_InteractiveContext()
Handle(AIS_InteractiveContext) aNullContext;
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
const Handle(AIS_InteractiveObject)& anObj = anObjIter.Key();
Handle(AIS_InteractiveObject) anObj = anObjIter.Key();
anObj->SetContext (aNullContext);
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
for (anObj->Init(); anObj->More(); anObj->Next())
{
aSelIter.Value()->UpdateBVHStatus (SelectMgr_TBU_Renew);
anObj->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Renew);
}
}
}
@@ -457,10 +457,6 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
{
Erase (theIObj, theToUpdateViewer);
Load (theIObj, theSelectionMode, theToAllowDecomposition);
if (Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (theIObj))
{
(*aStatusPtr)->SetDisplayMode (theDispMode);
}
return;
}
@@ -488,7 +484,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
{
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
myObjects.Bind (theIObj, aStatus);
myMainVwr->StructureManager()->RegisterObject (theIObj);
Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->StructureManager()->RegisterObject (theIObj);
myMainPM->Display(theIObj, theDispMode);
if (theSelectionMode != -1)
{
@@ -571,20 +567,23 @@ void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
return;
}
if (!myObjects.IsBound (theIObj))
if (theSelMode == -1
&& !theToAllowDecomposition)
{
Standard_Integer aDispMode, aHiMod, aSelModeDef;
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
myObjects.Bind (theIObj, aStatus);
myMainVwr->StructureManager()->RegisterObject (theIObj);
}
if (!myObjects.IsBound (theIObj))
{
Standard_Integer aDispMode, aHiMod, aSelModeDef;
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, aSelModeDef);
myObjects.Bind (theIObj, aStatus);
}
// Register theIObj in the selection manager to prepare further activation of selection
const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity
if (!mgrSelector->Contains (anObj))
{
mgrSelector->Load (theIObj);
// Register theIObj in the selection manager to prepare further activation of selection
const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity
if (!mgrSelector->Contains (anObj))
{
mgrSelector->Load (theIObj);
}
}
}
@@ -693,13 +692,15 @@ void AIS_InteractiveContext::DisplaySelected (const Standard_Boolean theToUpdate
return;
}
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
Standard_Boolean isFound = Standard_False;
for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (mySelection->Value()->Selectable());
Display (anObj, Standard_False);
isFound = Standard_True;
}
if (theToUpdateViewer && !mySelection->Objects().IsEmpty())
if (isFound && theToUpdateViewer)
{
myMainVwr->Update();
}
@@ -716,12 +717,17 @@ void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateVi
return;
}
Standard_Boolean isFound = Standard_False;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Init (mySelection->Objects()))
Standard_Boolean isFound = Standard_False;
mySelection->Init();
while (mySelection->More())
{
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
Handle(SelectMgr_EntityOwner) anOwner = mySelection->Value();
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
Erase (anObj, Standard_False);
isFound = Standard_True;
mySelection->Init();
}
if (isFound && theToUpdateViewer)
@@ -786,7 +792,6 @@ Standard_Boolean AIS_InteractiveContext::KeepTemporary(const Handle(AIS_Interact
Standard_False);
// GS->SubIntensityOn();
myObjects.Bind(anIObj,GS);
myMainVwr->StructureManager()->RegisterObject (anIObj);
mgrSelector->Load(anIObj);
mgrSelector->Activate(anIObj,SM,myMainSel);
@@ -2853,14 +2858,15 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
const Standard_Real theMargin,
const Standard_Boolean theToUpdate)
{
const Handle(AIS_Selection)& aSelection = HasOpenedContext()
? myLocalContexts(myCurLocalIndex)->Selection()
: mySelection;
const Handle(AIS_Selection)& aSelection = HasOpenedContext() ?
myLocalContexts(myCurLocalIndex)->Selection() : mySelection;
Bnd_Box aBndSelected;
AIS_MapOfObjectOwners anObjectOwnerMap;
for (AIS_NListOfEntityOwner::Iterator aSelIter (aSelection->Objects()); aSelIter.More(); aSelIter.Next())
for (aSelection->Init(); aSelection->More(); aSelection->Next())
{
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
const Handle(SelectMgr_EntityOwner)& anOwner = aSelection->Value();
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
if (anObj->IsInfinite())
{

View File

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

View File

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

View File

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

View File

@@ -202,8 +202,9 @@ Load(const Handle(AIS_InteractiveObject)& anInteractive,
{
if (myActiveObjects.IsBound (anInteractive))
{
if (const Handle(SelectMgr_Selection)& aSel = anInteractive->Selection (ActivationMode))
if (anInteractive->HasSelection (ActivationMode))
{
const Handle(SelectMgr_Selection)& aSel = anInteractive->Selection (ActivationMode);
if (aSel->GetSelectionState() != SelectMgr_SOS_Activated)
{
if (!myMainVS->Contains (anInteractive))
@@ -376,95 +377,48 @@ void AIS_LocalContext::Clear(const AIS_ClearMode aType)
ClearDetected();
}
}
//=======================================================================
//function : ActivateMode
//purpose :
//=======================================================================
//=======================================================================
//function : SetSelectionModeActive
//purpose :
//=======================================================================
void AIS_LocalContext::SetSelectionModeActive (const Handle(AIS_InteractiveObject)& theObj,
const Standard_Integer theMode,
const Standard_Boolean theIsActive,
const AIS_SelectionModesConcurrency theActiveFilter)
void AIS_LocalContext::ActivateMode(const Handle(AIS_InteractiveObject)& aSelectable,
const Standard_Integer aMode)
{
const Handle(AIS_LocalStatus)* aStat = myActiveObjects.Seek (theObj);
if (aStat == NULL)
{
return;
if(!myActiveObjects.IsBound(aSelectable)) return;
// if(myActiveObjects(aSelectable)->SelectionMode()!=aMode)
// mySM->Deactivate(aSelectable,aMode,myMainVS);
if(aMode != -1){
myActiveObjects(aSelectable)->AddSelectionMode(aMode);
mySM->Activate(aSelectable,aMode,myMainVS);
}
}
//=======================================================================
//function : ActivateMode
//purpose :
//=======================================================================
if (!theIsActive
|| (theMode == -1
&& theActiveFilter == AIS_SelectionModesConcurrency_Single))
{
if (theMode == -1)
{
for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
{
mySM->Deactivate (theObj, aModeIter.Value(), myMainVS);
}
(*aStat)->ClearSelectionModes();
}
else
{
mySM->Deactivate (theObj, theMode, myMainVS);
(*aStat)->RemoveSelectionMode (theMode);
}
return;
}
else if (theMode == -1)
{
return;
}
else if ((*aStat)->SelectionModes().Size() == 1
&& (*aStat)->SelectionModes().First() == theMode)
{
return;
}
void AIS_LocalContext::DeactivateMode(const Handle(AIS_InteractiveObject)& aSelectable,
const Standard_Integer aMode)
{
if(!myActiveObjects.IsBound(aSelectable)) return;
if(aMode==-1) return;
myActiveObjects(aSelectable)->RemoveSelectionMode(aMode);
mySM->Deactivate(aSelectable,aMode,myMainVS);
}
//=======================================================================
//function : ActivateMode
//purpose :
//=======================================================================
switch (theActiveFilter)
{
case AIS_SelectionModesConcurrency_Single:
{
for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
{
mySM->Deactivate (theObj, aModeIter.Value(), myMainVS);
}
(*aStat)->ClearSelectionModes();
break;
}
case AIS_SelectionModesConcurrency_GlobalOrLocal:
{
const Standard_Integer aGlobSelMode = theObj->GlobalSelectionMode();
TColStd_ListOfInteger aRemovedModes;
for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
{
if ((theMode == aGlobSelMode && aModeIter.Value() != aGlobSelMode)
|| (theMode != aGlobSelMode && aModeIter.Value() == aGlobSelMode))
{
mySM->Deactivate (theObj, aModeIter.Value(), myMainVS);
aRemovedModes.Append (aModeIter.Value());
}
}
if (aRemovedModes.Size() == (*aStat)->SelectionModes().Size())
{
(*aStat)->ClearSelectionModes();
}
else
{
for (TColStd_ListIteratorOfListOfInteger aModeIter (aRemovedModes); aModeIter.More(); aModeIter.Next())
{
(*aStat)->RemoveSelectionMode (aModeIter.Value());
}
}
break;
}
case AIS_SelectionModesConcurrency_Multiple:
{
break;
}
}
mySM->Activate (theObj, theMode, myMainVS);
(*aStat)->AddSelectionMode (theMode);
void AIS_LocalContext::Deactivate(const Handle(AIS_InteractiveObject)& aSelectable)
{
if(!myActiveObjects.IsBound(aSelectable)) return;
mySM->Deactivate(aSelectable, -1, myMainVS);
myActiveObjects(aSelectable)->ClearSelectionModes();
}
//=======================================================================
@@ -910,26 +864,24 @@ const Handle(AIS_LocalStatus)& AIS_LocalContext::Status(const Handle(AIS_Interac
void AIS_LocalContext::LoadContextObjects()
{
if (!myLoadDisplayed)
{
return;
}
AIS_ListOfInteractive LL;
myCTX->DisplayedObjects(LL,Standard_True);
for (AIS_ListIteratorOfListOfInteractive It (LL); It.More(); It.Next())
{
const Handle(AIS_InteractiveObject)& anObj = It.Value();
Handle(AIS_LocalStatus) Att = new AIS_LocalStatus();
Att->SetDecomposition((anObj->AcceptShapeDecomposition() && myAcceptStdMode));
Att->SetTemporary(Standard_False);
Att->SetHilightMode(anObj->HasHilightMode()? anObj->HilightMode(): 0);
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
aSel->SetSelectionState (SelectMgr_SOS_Deactivated);
AIS_ListIteratorOfListOfInteractive It;
if(myLoadDisplayed) {
AIS_ListOfInteractive LL;
myCTX->DisplayedObjects(LL,Standard_True);
Handle(AIS_LocalStatus) Att;
for (It.Initialize(LL);It.More();It.Next()){
const Handle(AIS_InteractiveObject)& anObj = It.Value();
Att= new AIS_LocalStatus();
Att->SetDecomposition((anObj->AcceptShapeDecomposition() && myAcceptStdMode));
Att->SetTemporary(Standard_False);
Att->SetHilightMode(anObj->HasHilightMode()? anObj->HilightMode(): 0);
for (anObj->Init(); anObj->More(); anObj->Next())
{
const Handle(SelectMgr_Selection)& aSel = anObj->CurrentSelection();
aSel->SetSelectionState (SelectMgr_SOS_Deactivated);
}
myActiveObjects.Bind(anObj,Att);
}
myActiveObjects.Bind(anObj,Att);
}
}

View File

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

View File

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

View File

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

View File

@@ -43,22 +43,6 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_Manipulator, AIS_InteractiveObject)
IMPLEMENT_HSEQUENCE(AIS_ManipulatorObjectSequence)
namespace
{
//! Return Ax1 for specified direction of Ax2.
static gp_Ax1 getAx1FromAx2Dir (const gp_Ax2& theAx2,
int theIndex)
{
switch (theIndex)
{
case 0: return gp_Ax1 (theAx2.Location(), theAx2.XDirection());
case 1: return gp_Ax1 (theAx2.Location(), theAx2.YDirection());
case 2: return theAx2.Axis();
}
throw Standard_ProgramError ("AIS_Manipulator - Invalid axis index");
}
}
//=======================================================================
//function : init
//purpose :
@@ -400,19 +384,22 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
// Initialize start reference data
if (!myHasStartedTransformation)
{
myStartTrsfs.Clear();
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
for (AIS_ManipulatorObjectSequence::Iterator anObjIter (*anObjects); anObjIter.More(); anObjIter.Next())
myStartTrsfs.Clear();
for (Standard_Integer anIt = anObjects->Lower(); anIt <= anObjects->Upper(); ++anIt)
{
myStartTrsfs.Append (anObjIter.Value()->LocalTransformation());
myStartTrsfs.Append (anObjects->Value (anIt)->LocalTransformation());
}
myStartPosition = myPosition;
}
// Get 3d point with projection vector
Graphic3d_Vec3d anInputPoint, aProj;
Graphic3d_Vec3d anInputPoint;
Graphic3d_Vec3d aProj;
theView->ConvertWithProj (theMaxX, theMaxY, anInputPoint.x(), anInputPoint.y(), anInputPoint.z(), aProj.x(), aProj.y(), aProj.z());
const gp_Lin anInputLine (gp_Pnt (anInputPoint.x(), anInputPoint.y(), anInputPoint.z()), gp_Dir (aProj.x(), aProj.y(), aProj.z()));
gp_Lin anInputLine (gp_Pnt (anInputPoint.x(), anInputPoint.y(), anInputPoint.z()), gp_Dir (aProj.x(), aProj.y(), aProj.z()));
gp_Pnt aNewPosition = gp::Origin();
switch (myCurrentMode)
{
case AIS_MM_Translation:
@@ -423,7 +410,7 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
GeomAPI_ExtremaCurveCurve anExtrema (anInputCurve, aCurve);
gp_Pnt aP1, aP2;
anExtrema.NearestPoints (aP1, aP2);
const gp_Pnt aNewPosition = aP2;
aNewPosition = aP2;
if (!myHasStartedTransformation)
{
@@ -440,28 +427,26 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
gp_Trsf aNewTrsf;
aNewTrsf.SetTranslation (gp_Vec(myStartPick, aNewPosition));
theTrsf *= aNewTrsf;
return Standard_True;
break;
}
case AIS_MM_Rotation:
{
const gp_Pnt aPosLoc = myStartPosition.Location();
const gp_Ax1 aCurrAxis = getAx1FromAx2Dir (myStartPosition, myCurrentIndex);
Handle(Geom_Curve) anInputCurve = new Geom_Line (anInputLine);
Handle(Geom_Surface) aSurface = new Geom_Plane (aPosLoc, aCurrAxis.Direction());
Handle(Geom_Surface) aSurface = new Geom_Plane (myPosition.Location(), myAxes[myCurrentIndex].Position().Direction());
GeomAPI_IntCS aIntersector (anInputCurve, aSurface);
if (!aIntersector.IsDone() || aIntersector.NbPoints() < 1)
{
return Standard_False;
}
const gp_Pnt aNewPosition = aIntersector.Point (1);
aNewPosition = aIntersector.Point (1);
if (!myHasStartedTransformation)
{
myStartPick = aNewPosition;
myHasStartedTransformation = Standard_True;
gp_Dir aStartAxis = gce_MakeDir (aPosLoc, myStartPick);
myPrevState = aStartAxis.AngleWithRef (gce_MakeDir(aPosLoc, aNewPosition), aCurrAxis.Direction());
gp_Dir aStartAxis = gce_MakeDir (myPosition.Location(), myStartPick);
myPrevState = aStartAxis.AngleWithRef (gce_MakeDir(myPosition.Location(), aNewPosition), myAxes[myCurrentIndex].Position().Direction());
return Standard_True;
}
@@ -470,17 +455,17 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
return Standard_False;
}
gp_Dir aStartAxis = aPosLoc.IsEqual (myStartPick, Precision::Confusion())
? getAx1FromAx2Dir (myStartPosition, (myCurrentIndex + 1) % 3).Direction()
: gce_MakeDir (aPosLoc, myStartPick);
gp_Dir aStartAxis = myPosition.Location().IsEqual (myStartPick, Precision::Confusion())
? myAxes[(myCurrentIndex + 1) % 3].Position().Direction()
: gce_MakeDir (myPosition.Location(), myStartPick);
gp_Dir aCurrentAxis = gce_MakeDir (aPosLoc, aNewPosition);
Standard_Real anAngle = aStartAxis.AngleWithRef (aCurrentAxis, aCurrAxis.Direction());
gp_Dir aCurrentAxis = gce_MakeDir (myPosition.Location(), aNewPosition);
Standard_Real anAngle = aStartAxis.AngleWithRef (aCurrentAxis, myAxes[myCurrentIndex].Position().Direction());
// Change value of an angle if it should have different sign.
if (anAngle * myPrevState < 0 && Abs (anAngle) < M_PI_2)
{
Standard_Real aSign = myPrevState > 0 ? -1.0 : 1.0;
Standard_ShortReal aSign = myPrevState > 0 ? -1.0f : 1.0f;
anAngle = aSign * (M_PI * 2 - anAngle);
}
@@ -490,10 +475,10 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
}
gp_Trsf aNewTrsf;
aNewTrsf.SetRotation (aCurrAxis, anAngle);
aNewTrsf.SetRotation (myAxes[myCurrentIndex].Position(), anAngle);
theTrsf *= aNewTrsf;
myPrevState = anAngle;
return Standard_True;
break;
}
case AIS_MM_Scaling:
{
@@ -501,7 +486,7 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
Handle(Geom_Curve) anInputCurve = new Geom_Line (anInputLine);
Handle(Geom_Curve) aCurve = new Geom_Line (aLine);
GeomAPI_ExtremaCurveCurve anExtrema (anInputCurve, aCurve);
gp_Pnt aNewPosition, aTmp;
gp_Pnt aTmp;
anExtrema.NearestPoints (aTmp, aNewPosition);
if (!myHasStartedTransformation)
@@ -523,14 +508,13 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
aNewTrsf.SetScale (myPosition.Location(), aCoeff);
theTrsf = aNewTrsf;
return Standard_True;
break;
}
case AIS_MM_None:
{
return Standard_False;
}
}
return Standard_False;
return Standard_True;
}
//=======================================================================
@@ -560,19 +544,18 @@ void AIS_Manipulator::StopTransform (const Standard_Boolean theToApply)
}
myHasStartedTransformation = Standard_False;
if (theToApply)
{
return;
}
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
AIS_ManipulatorObjectSequence::Iterator anObjIter (*anObjects);
NCollection_Sequence<gp_Trsf>::Iterator aTrsfIter (myStartTrsfs);
for (; anObjIter.More(); anObjIter.Next(), aTrsfIter.Next())
if (!theToApply)
{
anObjIter.ChangeValue()->SetLocalTransformation (aTrsfIter.Value());
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
for (Standard_Integer anIt = anObjects->Lower(); anIt <= anObjects->Upper(); ++anIt)
{
anObjects->Value (anIt)->SetLocalTransformation (myStartTrsfs(anIt));
}
SetPosition (myStartPosition);
}
SetPosition (myStartPosition);
}
//=======================================================================
@@ -586,14 +569,11 @@ void AIS_Manipulator::Transform (const gp_Trsf& theTrsf)
return;
}
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
for (Standard_Integer anIt = anObjects->Lower(); anIt <= anObjects->Upper(); ++anIt)
{
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
AIS_ManipulatorObjectSequence::Iterator anObjIter (*anObjects);
NCollection_Sequence<gp_Trsf>::Iterator aTrsfIter (myStartTrsfs);
for (; anObjIter.More(); anObjIter.Next(), aTrsfIter.Next())
{
anObjIter.ChangeValue()->SetLocalTransformation (theTrsf * aTrsfIter.Value());
}
anObjects->Value (anIt)->SetLocalTransformation (theTrsf * myStartTrsfs(anIt));
}
if ((myCurrentMode == AIS_MM_Translation && myBehaviorOnTransform.FollowTranslation)
@@ -633,9 +613,10 @@ void AIS_Manipulator::SetPosition (const gp_Ax2& thePosition)
|| !myPosition.XDirection().IsEqual (thePosition.XDirection(), Precision::Angular()))
{
myPosition = thePosition;
myAxes[0].SetPosition (getAx1FromAx2Dir (thePosition, 0));
myAxes[1].SetPosition (getAx1FromAx2Dir (thePosition, 1));
myAxes[2].SetPosition (getAx1FromAx2Dir (thePosition, 2));
myAxes[0].SetPosition (gp_Ax1 (myPosition.Location(), myPosition.XDirection()));
myAxes[1].SetPosition (gp_Ax1 (myPosition.Location(), myPosition.YDirection()));
myAxes[2].SetPosition (gp_Ax1 (myPosition.Location(), myPosition.Direction()));
updateTransformation();
}
}
@@ -1024,7 +1005,8 @@ void AIS_Manipulator::Disk::Init (const Standard_ShortReal theInnerRadius,
gp_Ax3 aSystem (myPosition.Location(), myPosition.Direction());
gp_Trsf aTrsf;
aTrsf.SetTransformation (aSystem, gp_Ax3());
aTool.FillArray (myArray, myTriangulation, aTrsf);
myArray = aTool.CreateTriangulation (aTrsf);
myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
}
//=======================================================================
@@ -1043,7 +1025,8 @@ void AIS_Manipulator::Sphere::Init (const Standard_ShortReal theRadius,
Prs3d_ToolSphere aTool (theRadius, theSlicesNb, theStacksNb);
gp_Trsf aTrsf;
aTrsf.SetTranslation (gp_Vec(gp::Origin(), thePosition));
aTool.FillArray (myArray, myTriangulation, aTrsf);
myArray = aTool.CreateTriangulation (aTrsf);
myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
}
//=======================================================================
@@ -1079,24 +1062,24 @@ void AIS_Manipulator::Cube::Init (const gp_Ax1& thePosition, const Standard_Shor
addTriangle (1, aBottomLeft, aV3, aV4, -thePosition.Direction());
// Front
addTriangle (2, aV3, aV4, aV5, aFront);
addTriangle (3, aV3, aV5, aTopRight, aFront);
addTriangle (2, aV3, aV5, aV4, -aFront);
addTriangle (3, aV3, aTopRight, aV5, -aFront);
// Back
addTriangle (4, aBottomLeft, aV2, aV7, -aFront);
addTriangle (5, aBottomLeft, aV7, aV6, -aFront);
addTriangle (4, aBottomLeft, aV7, aV2, aFront);
addTriangle (5, aBottomLeft, aV6, aV7, aFront);
// aTop
addTriangle (6, aV7, aV6, aV5, thePosition.Direction());
addTriangle (7, aTopRight, aV7, aV5, thePosition.Direction());
//Left
addTriangle (8, aV6, aV5, aV4, -aRight);
addTriangle (9, aBottomLeft, aV6, aV4, -aRight);
// Left
addTriangle (8, aV6, aV4, aV5, aRight);
addTriangle (9, aBottomLeft, aV4, aV6, aRight);
// Right
addTriangle (10, aV3, aTopRight, aV7, aRight);
addTriangle (11, aV3, aV7, aV2, aRight);
addTriangle (10, aV3, aV7, aTopRight, -aRight);
addTriangle (11, aV3, aV2, aV7, -aRight);
}
//=======================================================================
@@ -1167,6 +1150,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
anArrowLength,
myFacettesNumber);
myTranslatorGroup = Prs3d_Root::NewGroup (thePrs);
myTranslatorGroup->SetClosed (true);
myTranslatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
myTranslatorGroup->AddPrimitiveArray (myTriangleArray);
@@ -1178,11 +1162,8 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
{
myHighlightTranslator->Clear();
}
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightTranslator);
aGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
aGroup->AddPrimitiveArray (myTriangleArray);
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightTranslator);
aGroup->AddPrimitiveArray (myTriangleArray);
}
if (myHasScaling)
@@ -1191,6 +1172,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), myBoxSize);
myScalerGroup = Prs3d_Root::NewGroup (thePrs);
myScalerGroup->SetClosed (true);
myScalerGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
myScalerGroup->AddPrimitiveArray (myCube.Array());
@@ -1202,11 +1184,8 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
{
myHighlightScaler->Clear();
}
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightScaler);
aGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
aGroup->AddPrimitiveArray (myCube.Array());
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightScaler);
aGroup->AddPrimitiveArray (myCube.Array());
}
if (myHasRotation)
@@ -1225,10 +1204,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
{
myHighlightRotator->Clear();
}
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightRotator);
aGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
aGroup->AddPrimitiveArray (myCircle.Array());
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightRotator);
Prs3d_Root::CurrentGroup (myHighlightRotator)->AddPrimitiveArray (myCircle.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 (transformation mode is active, and owning object can be transformed).
//! @return true if some part of manipulator is selected (tranformation mode is active, and owning object can be rtansformated).
Standard_Boolean HasActiveMode() const { return IsAttached() && myCurrentMode != AIS_MM_None; }
Standard_Boolean HasActiveTransformation() { return myHasStartedTransformation; }
gp_Trsf StartTransformation() const { return !myStartTrsfs.IsEmpty() ? myStartTrsfs.First() : gp_Trsf(); }
gp_Trsf StartTransformation() const { return myStartTrsfs.Size() < 1 ? gp_Trsf() : myStartTrsfs(1); }
gp_Trsf StartTransformation (Standard_Integer theIndex) const
gp_Trsf StartTransformation (const Standard_Integer theIndex) const
{
Standard_ProgramError_Raise_if (theIndex < 1 || theIndex > Objects()->Upper(),
"AIS_Manipulator::StartTransformation(): theIndex is out of bounds");
return !myStartTrsfs.IsEmpty() ? myStartTrsfs (theIndex) : gp_Trsf();
return myStartTrsfs.Size() < 1 ? gp_Trsf() : myStartTrsfs (theIndex);
}
public: //! @name Configuration of graphical transformations
@@ -245,7 +245,7 @@ public: //! @name Configuration of graphical transformations
//! Redefines transform persistence management to setup transformation for sub-presentation of axes.
//! @warning this interactive object does not support custom transformation persistence when
//! using \sa ZoomPersistence mode. In this mode the transformation persistence flags for
//! presentations are overridden by this class.
//! presentations are overriden by this class.
//! @warning Invokes debug assertion to catch incompatible usage of the method with \sa ZoomPersistence mode,
//! silently does nothing in release mode.
//! @warning revise use of AdjustSize argument of of \sa AttachToObjects method
@@ -298,17 +298,17 @@ public:
public: //! @name Presentation computation
//! Fills presentation.
//! @note Manipulator presentation does not use display mode and for all modes has the same presentation.
//! @note Manipulator presentation does not use display mode and for all modes has the same presenatation.
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode = 0) Standard_OVERRIDE;
//! Computes selection sensitive zones (triangulation) for manipulator.
//! @param theNode [in] Selection mode that is treated as transformation mode.
//! @param theNode [in] Seldction mode that is treated as transformation mode.
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden methods.
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overriden methods.
Standard_EXPORT virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE
{
return Standard_False;
@@ -352,7 +352,7 @@ protected:
Standard_EXPORT virtual void setLocalTransformation (const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE;
using AIS_InteractiveObject::SetLocalTransformation; // hide visibility
protected: //! @name Auxiliary classes to fill presentation with proper primitives
protected: //! @name Auxilliary classes to fill presentation with proper primitives
class Quadric
{
@@ -616,16 +616,16 @@ protected:
Axis myAxes[3]; //!< Tree axes of the manipulator.
Sphere myCenter; //!< Visual part displaying the center sphere of the manipulator.
gp_Ax2 myPosition; //!< Position of the manipulator object. it displays its location and position of its axes.
gp_Ax2 myPosition; //!< Position of the manipualtor object. it displayes its location and position of its axes.
Standard_Integer myCurrentIndex; //!< Index of active axis.
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipulation mode.
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipualtion mode.
Standard_Boolean myIsActivationOnDetection; //!< Manual activation of modes (not on parts selection).
Standard_Boolean myIsZoomPersistentMode; //!< Zoom persistence mode activation.
BehaviorOnTransform myBehaviorOnTransform; //!< Behavior settings applied on manipulator when transforming an object.
protected: //! @name Fields for interactive transformation. Fields only for internal needs. They do not have public interface.
protected: //! @name Fields for interactive trnasformation. Fields only for internal needs. They do not have public interface.
NCollection_Sequence<gp_Trsf> myStartTrsfs; //!< Owning object transformation for start. It is used internally.
Standard_Boolean myHasStartedTransformation; //!< Shows if transformation is processed (sequential calls of Transform()).
@@ -633,7 +633,7 @@ protected: //! @name Fields for interactive transformation. Fields only for inte
gp_Pnt myStartPick; //! 3d point corresponding to start mouse pick.
Standard_Real myPrevState; //! Previous value of angle during rotation.
//! Aspect used to color current detected part and current selected part.
//! Aspect used to colour current detected part and current selected part.
Handle(Prs3d_ShadingAspect) myHighlightAspect;
public:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,25 +0,0 @@
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_SelectionModesConcurrency_HeaderFile
#define _AIS_SelectionModesConcurrency_HeaderFile
//! The mode specifying how multiple active Selection Modes should be treated during activation of new one.
enum AIS_SelectionModesConcurrency
{
AIS_SelectionModesConcurrency_Single, //!< only one selection mode can be activated at the same moment - previously activated should be deactivated
AIS_SelectionModesConcurrency_GlobalOrLocal, //!< either Global (AIS_InteractiveObject::GlobalSelectionMode() or Local (multiple) selection modes can be active at the same moment
AIS_SelectionModesConcurrency_Multiple, //!< any combination of selection modes can be activated
};
#endif // _AIS_SelectionModesConcurrency_HeaderFile

View File

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

View File

@@ -19,10 +19,14 @@
#include <AIS_InteractiveObject.hxx>
#include <Bnd_Box.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS_Shape.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_TypeOfHLR.hxx>
class TopoDS_Shape;
class Bnd_Box;
//! A framework to manage presentation and selection of shapes.
//! AIS_Shape is the interactive object which is used the
//! most by applications. There are standard functions
@@ -64,31 +68,25 @@ public:
//! Initializes construction of the shape shap from wires,
//! edges and vertices.
Standard_EXPORT AIS_Shape(const TopoDS_Shape& shap);
//! Returns index 0. This value refers to SHAPE from TopAbs_ShapeEnum
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 0; }
Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
//! Returns Object as the type of Interactive Object.
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Shape; }
Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
//! Returns true if the Interactive Object accepts shape decomposition.
virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE { return Standard_True; }
//! Return true if specified display mode is supported.
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode >= 0 && theMode <= 2; }
//! Returns this shape object.
const TopoDS_Shape& Shape() const { return myshape; }
Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE;
//! Constructs an instance of the shape object theShape.
void SetShape (const TopoDS_Shape& theShape)
void Set (const TopoDS_Shape& theShape)
{
myshape = theShape;
myCompBB = Standard_True;
}
//! Alias for ::SetShape().
void Set (const TopoDS_Shape& theShape) { SetShape (theShape); }
//! Returns this shape object.
const TopoDS_Shape& Shape() const { return myshape; }
//! Sets a local value for deviation coefficient for this specific shape.
Standard_EXPORT Standard_Boolean SetOwnDeviationCoefficient();
@@ -213,42 +211,23 @@ public:
//! Returns the transparency attributes of the shape accordingly to
//! the current facing model;
Standard_EXPORT virtual Standard_Real Transparency() const Standard_OVERRIDE;
//! Return shape type for specified selection mode.
static TopAbs_ShapeEnum SelectionType (const Standard_Integer theSelMode)
{
switch (theSelMode)
{
case 1: return TopAbs_VERTEX;
case 2: return TopAbs_EDGE;
case 3: return TopAbs_WIRE;
case 4: return TopAbs_FACE;
case 5: return TopAbs_SHELL;
case 6: return TopAbs_SOLID;
case 7: return TopAbs_COMPSOLID;
case 8: return TopAbs_COMPOUND;
case 0: return TopAbs_SHAPE;
}
return TopAbs_SHAPE;
}
//! Return selection mode for specified shape type.
static Standard_Integer SelectionMode (const TopAbs_ShapeEnum theShapeType)
{
switch (theShapeType)
{
case TopAbs_VERTEX: return 1;
case TopAbs_EDGE: return 2;
case TopAbs_WIRE: return 3;
case TopAbs_FACE: return 4;
case TopAbs_SHELL: return 5;
case TopAbs_SOLID: return 6;
case TopAbs_COMPSOLID: return 7;
case TopAbs_COMPOUND: return 8;
case TopAbs_SHAPE: return 0;
}
return 0;
}
//! Activates the same TopAbs shape enumerations as
//! those used by SelectionMode assigning a type to the mode aDecompositionMode.
Standard_EXPORT static TopAbs_ShapeEnum SelectionType (const Standard_Integer aDecompositionMode);
//! Establishes an equivalence between a mode and the
//! type, aShapeType, of selection. The correspondences are as follows:
//! - mode 0 - Shape
//! - mode 1 - Vertex
//! - mode 2 - Edge
//! - mode 3 - Wire
//! - mode 4 - Face
//! - mode 5 - Shell
//! - mode 6 - Solid
//! - mode 7 - Compsolid
//! - mode 8 - Compound
Standard_EXPORT static Standard_Integer SelectionMode (const TopAbs_ShapeEnum aShapeType);
public: //! @name methods to alter texture mapping properties
@@ -277,31 +256,13 @@ public: //! @name methods to alter texture mapping properties
protected:
//! Compute normal presentation.
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Compute projected presentation.
virtual void Compute (const Handle(Prs3d_Projector)& theProjector,
const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE
{
computeHlrPresentation (theProjector, thePrs, myshape, myDrawer);
}
//! Compute projected presentation with transformation.
virtual void Compute (const Handle(Prs3d_Projector)& theProjector,
const Handle(Geom_Transformation)& theTrsf,
const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE
{
const TopLoc_Location& aLoc = myshape.Location();
const TopoDS_Shape aShape = myshape.Located (TopLoc_Location (theTrsf->Trsf()) * aLoc);
computeHlrPresentation (theProjector, thePrs, aShape, myDrawer);
}
//! Compute selection.
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
Standard_EXPORT void LoadRecomputable (const Standard_Integer TheMode);
@@ -313,13 +274,9 @@ protected:
Standard_EXPORT void setMaterial (const Handle(Prs3d_Drawer)& theDrawer, const Graphic3d_MaterialAspect& theMaterial, const Standard_Boolean theToKeepColor, const Standard_Boolean theToKeepTransp) const;
public:
private:
//! Compute HLR presentation for specified shape.
Standard_EXPORT static void computeHlrPresentation (const Handle(Prs3d_Projector)& theProjector,
const Handle(Prs3d_Presentation)& thePrs,
const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer);
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation, const TopoDS_Shape& ashape);
protected:

View File

@@ -261,14 +261,14 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
if (myHasFlipping)
{
// Get width and height of text
Font_FTFont aFont;
unsigned int aResolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
if (aFont.Init (anAsp->Aspect()->Font().ToCString(),
anAsp->Aspect()->GetTextFontAspect(), (unsigned int)anAsp->Height(), aResolution))
Font_FTFontParams aFontParams;
aFontParams.PointSize = (unsigned int )anAsp->Height();
aFontParams.Resolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
if (Handle(Font_FTFont) aFont = Font_FTFont::FindAndCreate (anAsp->Aspect()->Font(), anAsp->Aspect()->GetTextFontAspect(), aFontParams))
{
isInit = Standard_True;
const NCollection_String aText (myText.ToExtString());
Font_Rect aBndBox = aFont.BoundingBox (aText, anAsp->HorizontalJustification(), anAsp->VerticalJustification());
Font_Rect aBndBox = aFont->BoundingBox (aText, anAsp->HorizontalJustification(), anAsp->VerticalJustification());
Standard_Real aWidth = Abs (aBndBox.Width());
Standard_Real aHeight = Abs (aBndBox.Height());
gp_Pnt aCenterOfLabel = aPosition;

View File

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

View File

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

View File

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

View File

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

View File

@@ -458,7 +458,7 @@ GeomAbs_CurveType Adaptor2d_OffsetCurve::GetType() const {
return GeomAbs_Circle;
default:
return GeomAbs_OtherCurve;
return GeomAbs_OffsetCurve;
}
}
@@ -650,3 +650,27 @@ Handle(Geom2d_BSplineCurve) Adaptor2d_OffsetCurve::BSpline() const
"Adaptor2d_OffsetCurve::BSpline() - wrong curve type");
return myCurve->BSpline();
}
static Standard_Integer nbPoints(const Handle(Adaptor2d_HCurve2d)& theCurve)
{
Standard_Integer nbs = 20;
if (theCurve->GetType() == GeomAbs_BezierCurve)
{
nbs = Max(nbs, 3 + theCurve->NbPoles());
}
else if (theCurve->GetType() == GeomAbs_BSplineCurve) {
nbs = Max(nbs, theCurve->NbKnots() * theCurve->Degree());
}
if (nbs > 300)
nbs = 300;
return nbs;
}
Standard_Integer Adaptor2d_OffsetCurve::NbSamples() const
{
return nbPoints(myCurve);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -17,14 +17,19 @@
#define _Aspect_TypeOfDisplayText_HeaderFile
//! Define the display type of the text.
//!
//! TODT_NORMAL Default display. Text only.
//! TODT_SUBTITLE There is a subtitle under the text.
//! TODT_DEKALE The text is displayed with a 3D style.
//! TODT_BLEND The text is displayed in XOR.
//! TODT_DIMENSION Dimension line under text will be invisible.
enum Aspect_TypeOfDisplayText
{
Aspect_TODT_NORMAL, //!< default display, text only
Aspect_TODT_SUBTITLE, //!< there is a subtitle under the text
Aspect_TODT_DEKALE, //!< the text is displayed with a 3D style
Aspect_TODT_BLEND, //!< the text is displayed in XOR
Aspect_TODT_DIMENSION, //!< dimension line under text will be invisible
Aspect_TODT_SHADOW //!< the text will have a shadow at the right-bottom corner
Aspect_TODT_NORMAL,
Aspect_TODT_SUBTITLE,
Aspect_TODT_DEKALE,
Aspect_TODT_BLEND,
Aspect_TODT_DIMENSION
};
#endif // _Aspect_TypeOfDisplayText_HeaderFile

View File

@@ -68,11 +68,5 @@ Warning: Removal of internal boundaries among Faces has failed
.BOPAlgo_AlertRemovalOfIBForEdgesFailed
Warning: Removal of internal boundaries among Edges has failed
.BOPAlgo_AlertIntersectionOfPairOfShapesFailed
Warning: Intersection of pair of shapes has failed
.BOPAlgo_AlertBuildingPCurveFailed
Warning: Building 2D curve of edge on face has failed
.BOPAlgo_AlertAcquiredSelfIntersection
Warning: Some sub-shapes of some of the argument become connected through other shapes and the argument became self-interfered
.BOPAlgo_AlertSolidBuilderUnusedFaces
Warning: Some of the faces passed to the Solid Builder algorithm have not been classified and not used for solids creation

View File

@@ -78,14 +78,7 @@ DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertShellSplitterFailed)
//! Some edges are too small and have no valid range
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertTooSmallEdge)
//! Intersection of pair of shapes has failed
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertIntersectionOfPairOfShapesFailed)
//! Building 2D curve of edge on face has failed
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertBuildingPCurveFailed)
//! Some sub-shapes of some of the argument become connected through
//! other shapes and the argument became self-interfered
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertAcquiredSelfIntersection)
//! Some of the faces passed to the Solid Builder algorithm have not been classified
//! and not used for solids creation
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertSolidBuilderUnusedFaces)
#endif // _BOPAlgo_Alerts_HeaderFile

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -71,11 +71,5 @@ static const char BOPAlgo_BOPAlgo_msg[] =
".BOPAlgo_AlertRemovalOfIBForEdgesFailed\n"
"Warning: Removal of internal boundaries among Edges has failed\n"
"\n"
".BOPAlgo_AlertIntersectionOfPairOfShapesFailed\n"
"Warning: Intersection of pair of shapes has failed\n"
"\n"
".BOPAlgo_AlertBuildingPCurveFailed\n"
"Warning: Building 2D curve of edge on face has failed\n"
"\n"
".BOPAlgo_AlertAcquiredSelfIntersection\n"
"Warning: Some sub-shapes of some of the argument become connected through other shapes and the argument became self-interfered\n";
".BOPAlgo_AlertSolidBuilderUnusedFaces\n"
"Warning: Some of the faces passed to the Solid Builder algorithm have not been classified and not used for solids creation\n";

View File

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

View File

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

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