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

Compare commits

..

1 Commits

Author SHA1 Message Date
kgv
cdc3736aa6 0030120: Draw Harness - fixshape command does not heal missing 3D curves 2018-09-10 16:13:42 +03:00
368 changed files with 6484 additions and 10861 deletions

View File

@@ -63,7 +63,7 @@ set (BUILD_RESOURCES OFF CACHE BOOL "${BUILD_RESOURCES_DESCR}")
# single-configuration generator
set (SINGLE_GENERATOR OFF)
if (DEFINED CMAKE_BUILD_TYPE)
if (CMAKE_BUILD_TYPE)
set (SINGLE_GENERATOR ON)
endif()
@@ -899,19 +899,11 @@ if (BUILD_SAMPLES_MFC OR BUILD_SAMPLES_QT)
OCCT_COPY_FILE_OR_DIR ("adm/templates/sample.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}")
endif()
if (WIN32)
# env script for draw in building environment
OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}")
# install env script
install (FILES "${CMAKE_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SCRIPT}")
else()
set (SUB_ENV_NAME "env.${SCRIPT_EXT}")
set (SUB_ENV_BUILD_NAME "env.install.${SCRIPT_EXT}")
# install env script
OCCT_CONFIGURE_AND_INSTALL ("adm/templates/env.install.${SCRIPT_EXT}.in" "${SUB_ENV_BUILD_NAME}" "${SUB_ENV_NAME}" "${INSTALL_DIR_SCRIPT}")
# env script for draw in building environment
OCCT_CONFIGURE ("adm/templates/env.build.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}")
endif()
# env script for draw in building environment
OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}")
# install env script
install (FILES "${CMAKE_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SCRIPT}")
# copy DrawAppliInit from OCCT source to build directory
if (NOT EXISTS "${CMAKE_BINARY_DIR}/DrawAppliInit")

View File

@@ -37,10 +37,6 @@ foreach (LIBRARY_NAME ${CSF_FFmpeg})
set (3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME} "" CACHE PATH "The directory containing FFmpeg framework (${LIBRARY_NAME})")
endif()
if (NOT DEFINED 3RDPARTY_FFMPEG_LIBRARY_DIR)
set (3RDPARTY_FFMPEG_LIBRARY_DIR "" CACHE PATH "The directory containing FFmpeg libraries")
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME} OR NOT 3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME} OR NOT EXISTS "${3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME}}")
set (3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME} "" CACHE FILEPATH "FFmpeg shared libraries (${LIBRARY_NAME})" FORCE)
@@ -51,9 +47,6 @@ foreach (LIBRARY_NAME ${CSF_FFmpeg})
if (NOT DEFINED 3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME})
set (3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME} "" CACHE PATH "The directory containing FFmpeg shared libraries (${LIBRARY_NAME})")
endif()
if (NOT DEFINED 3RDPARTY_FFMPEG_DLL_DIR)
set (3RDPARTY_FFMPEG_DLL_DIR "" CACHE PATH "The directory containing FFmpeg shared libraries")
endif()
endif()
# check 3RDPARTY_${PRODUCT_NAME}_ paths for consistency with specified 3RDPARTY_${PRODUCT_NAME}_DIR
@@ -63,7 +56,6 @@ foreach (LIBRARY_NAME ${CSF_FFmpeg})
if (3RDPARTY_FFMPEG_LIBRARY_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_FFMPEG_LIBRARY_${LIBRARY_NAME}}")
get_filename_component (3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME} "${3RDPARTY_FFMPEG_LIBRARY_${LIBRARY_NAME}}" PATH)
set (3RDPARTY_FFMPEG_LIBRARY_DIR "${3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME}}" CACHE PATH "The directory containing FFmpeg libraries" FORCE)
set (3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME} "${3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME}}" CACHE PATH "The directory containing FFmpeg library (${LIBRARY_NAME})" FORCE)
else()
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FFMPEG_DIR 3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME} PATH "The directory containing FFmpeg library (${LIBRARY_NAME})")
@@ -74,7 +66,6 @@ foreach (LIBRARY_NAME ${CSF_FFmpeg})
if (3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME}}")
get_filename_component (3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME} "${3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME}}" PATH)
set (3RDPARTY_FFMPEG_DLL_DIR "${3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME}}" CACHE PATH "The directory containing FFmpeg shared libraries" FORCE)
set (3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME} "${3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME}}" CACHE PATH "The directory containing FFmpeg shared library (${LIBRARY_NAME})" FORCE)
else()
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FFMPEG_DIR 3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME} PATH "The directory containing FFmpeg shared library (${LIBRARY_NAME})")

View File

@@ -61,8 +61,8 @@ endif()
# check 3RDPARTY_FREETYPE_ paths for consistency with specified 3RDPARTY_FREETYPE_DIR
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build FILEPATH "The directory containing ft2build.h header")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "The directory containing ftheader.h header")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build FILEPATH "the path to ft2build.h")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "the path to ftheader.h")
if (BUILD_SHARED_LIBS)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY FILEPATH "the path to freetype library")
@@ -119,8 +119,8 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
# check the found paths for consistency with specified 3RDPARTY_FREETYPE_DIR
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_ft2build FILEPATH "The directory containing ft2build.h header")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "The directory containing ftheader.h header")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_ft2build FILEPATH "the path to ft2build.h")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "the path to ftheader.h")
if (BUILD_SHARED_LIBS)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library")
endif()
@@ -129,13 +129,13 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
# assign the found paths to corresponding 3RDPARTY_FREETYPE_ variables
if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build OR NOT EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build}")
if (FREETYPE_INCLUDE_DIR_ft2build AND EXISTS "${FREETYPE_INCLUDE_DIR_ft2build}")
set (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build "${FREETYPE_INCLUDE_DIR_ft2build}" CACHE FILEPATH "The directory containing ft2build.h header" FORCE)
set (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build "${FREETYPE_INCLUDE_DIR_ft2build}" CACHE FILEPATH "the path to ft2build.h" FORCE)
endif()
endif()
if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 OR NOT EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2}")
if (FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}")
set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "${FREETYPE_INCLUDE_DIR_freetype2}" CACHE FILEPATH "The directory containing ftheader.h header" FORCE)
set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "${FREETYPE_INCLUDE_DIR_freetype2}" CACHE FILEPATH "the path to ftheader.h" FORCE)
endif()
endif()
@@ -162,7 +162,7 @@ if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build OR NOT EXISTS "${3RDPARTY_FREETYP
set (FT2BUILD_NAMES ft2build.h config/ft2build.h freetype/config/ft2build.h)
# set 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build
set (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build "3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build-NOTFOUND" CACHE FILEPATH "The directory containing ft2build.h header" FORCE)
set (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build "3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build-NOTFOUND" CACHE FILEPATH "the path to ft2build.h" FORCE)
# cmake (version < 3.0) doesn't find ft2build.h of freetype (version is >= 2.5.1)
# do search taking into account freetype structure of 2.5.1 version
@@ -185,7 +185,7 @@ if (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build AND EXISTS "${3RDPARTY_FREETYPE_INCLU
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build)
set (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build "" CACHE FILEPATH "The directory containing ft2build.h header" FORCE)
set (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build "" CACHE FILEPATH "the path to ft2build.h" FORCE)
endif()
# ftheader.h
@@ -193,7 +193,7 @@ if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 OR NOT EXISTS "${3RDPARTY_FREETY
set (FTHEADER_NAMES ftheader.h config/ftheader.h freetype/config/ftheader.h)
# set 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2
set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2-NOTFOUND" CACHE FILEPATH "The directory containing ftheader.h header" FORCE)
set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2-NOTFOUND" CACHE FILEPATH "the path to ftheader.h" FORCE)
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
find_path (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 NAMES ${FTHEADER_NAMES}
@@ -214,7 +214,7 @@ if (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${3RDPARTY_FREETYPE_INCL
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "" CACHE FILEPATH "The directory containing ftheader.h header" FORCE)
set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "" CACHE FILEPATH "the path to ftheader.h" FORCE)
endif()
# freetype library

View File

@@ -63,7 +63,7 @@ if (WIN32)
set (CSF_gdi32 "gdi32.lib")
set (CSF_user32 "user32.lib")
set (CSF_wsock32 "wsock32.lib")
set (CSF_psapi "psapi.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")

View File

@@ -1,137 +0,0 @@
#!/bin/bash
aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
# ----- For compatability with external application using CASROOT -----
if [ "${CASROOT}" == "" ]; then
export CASROOT="${aScriptPath}"
fi
# ----- Define path to 3rdparty products -----
export THIRDPARTY_DIR="@3RDPARTY_DIR@"
# ----- Read script arguments -----
shopt -s nocasematch
export CASDEB="";
if [[ "$1" == "debug" ]]; then export CASDEB="d"; fi
if [[ "$1" == "d" ]]; then export CASDEB="d"; fi
if [[ "$1" == "relwithdeb" ]]; then export CASDEB="i"; fi
if [[ "$1" == "i" ]]; then export CASDEB="i"; fi
shopt -u nocasematch
# ----- Set path to 3rd party and OCCT libraries -----
anArch=`uname -m`
if [ "$anArch" != "x86_64" ] && [ "$anArch" != "ia64" ]; then
export ARCH="32";
else
export ARCH="64";
fi
aSystem=`uname -s`
if [ "$aSystem" == "Darwin" ]; then
export WOKSTATION="mac";
export ARCH="64";
else
export WOKSTATION="lin";
fi
# ----- Set local settings -----
if [ -e "${CASROOT}/custom.sh" ]; then
source "${CASROOT}/custom.sh" "${CASDEB}" "${ARCH}"
fi
THRDPARTY_PATH=""
if [ "$TCL_DIR" != "" ]; then
THRDPARTY_PATH="${TCL_DIR}:${THRDPARTY_PATH}"
fi
if [ "$TK_DIR" != "" ]; then
THRDPARTY_PATH="${TK_DIR}:${THRDPARTY_PATH}"
fi
if [ "$FREETYPE_DIR" != "" ]; then
THRDPARTY_PATH="${FREETYPE_DIR}:${THRDPARTY_PATH}"
fi
if [ "$FREEIMAGE_DIR" != "" ]; then
THRDPARTY_PATH="${FREEIMAGE_DIR}:${THRDPARTY_PATH}"
fi
if [ "$TBB_DIR" != "" ]; then
THRDPARTY_PATH="${TBB_DIR}:${THRDPARTY_PATH}"
fi
if [ "$VTK_DIR" != "" ]; then
THRDPARTY_PATH="${VTK_DIR}:${THRDPARTY_PATH}"
fi
if [ "$FFMPEG_DIR" != "" ]; then
THRDPARTY_PATH="${FFMPEG_DIR}:${THRDPARTY_PATH}"
fi
if [ "$QTDIR" != "" ]; then
THRDPARTY_PATH="${QTDIR}/lib:${THRDPARTY_PATH}"
fi
if [ "$TK_DIR" != "$TCL_DIR" ]; then
if [ "$TK_DIR" != "" ]; then
export TK_LIBRARY="${TK_DIR}/../lib/tk${TK_VERSION_WITH_DOT}"
fi
if [ "$TCL_DIR" != "" ]; then
export TCL_LIBRARY="${TCL_DIR}/../lib/tcl${TCL_VERSION_WITH_DOT}"
fi
fi
if [ "$LD_LIBRARY_PATH" != "" ]; then
export LD_LIBRARY_PATH="${THRDPARTY_PATH}:${LD_LIBRARY_PATH}"
else
export LD_LIBRARY_PATH="${THRDPARTY_PATH}"
fi
if [ "$CSF_OCCTBinPath" != "" ]; then
export PATH="${CSF_OCCTBinPath}:${PATH}"
fi
if [ "$CSF_OCCTLibPath" != "" ]; then
if [ "$LD_LIBRARY_PATH" != "" ]; then
export LD_LIBRARY_PATH="${CSF_OCCTLibPath}:${LD_LIBRARY_PATH}"
else
export LD_LIBRARY_PATH="${CSF_OCCTLibPath}"
fi
fi
if [ "$WOKSTATION" == "mac" ]; then
if [ "$DYLD_LIBRARY_PATH" != "" ]; then
export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${DYLD_LIBRARY_PATH}"
else
export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}"
fi
fi
# ----- Set envoronment variables used by OCCT -----
export CSF_LANGUAGE=us
export MMGT_CLEAR=1
export CSF_SHMessage="${CSF_OCCTResourcePath}/SHMessage"
export CSF_MDTVTexturesDirectory="${CSF_OCCTResourcePath}/Textures"
export CSF_ShadersDirectory="${CSF_OCCTResourcePath}/Shaders"
export CSF_XSMessage="${CSF_OCCTResourcePath}/XSMessage"
export CSF_TObjMessage="${CSF_OCCTResourcePath}/TObj"
export CSF_StandardDefaults="${CSF_OCCTResourcePath}/StdResource"
export CSF_PluginDefaults="${CSF_OCCTResourcePath}/StdResource"
export CSF_XCAFDefaults="${CSF_OCCTResourcePath}/StdResource"
export CSF_TObjDefaults="${CSF_OCCTResourcePath}/StdResource"
export CSF_StandardLiteDefaults="${CSF_OCCTResourcePath}/StdResource"
export CSF_IGESDefaults="${CSF_OCCTResourcePath}/XSTEPResource"
export CSF_STEPDefaults="${CSF_OCCTResourcePath}/XSTEPResource"
export CSF_XmlOcafResource="${CSF_OCCTResourcePath}/XmlOcafResource"
export CSF_MIGRATION_TYPES="${CSF_OCCTResourcePath}/StdResource/MigrationSheet.txt"
# ----- Draw Harness special stuff -----
if [ -e "${CSF_OCCTResourcePath}/DrawResources" ]; then
export DRAWHOME="${CSF_OCCTResourcePath}/DrawResources"
export CSF_DrawPluginDefaults="${CSF_OCCTResourcePath}/DrawResources"
if [ -e "${CSF_OCCTResourcePath}/DrawResources/DrawDefault" ]; then
export DRAWDEFAULT="${CSF_OCCTResourcePath}/DrawResources/DrawDefault"
fi
fi

View File

@@ -1596,11 +1596,6 @@ Since OCCT 7.4.0 exception is thrown on the attempt of taking points in case of
* The method *ImagesResult* of the class *BOPAlgo_BuilderShape* has been removed as unused. The functionality of this method can be completely replaced by the history methods *Modified* and *IsDeleted*.
* The method *TrackHistory* of the classes *BOPAlgo_RemoveFeatures* and *BRepAlgoAPI_Defeaturing* has been renamed to *SetToFillHistory*.
* The method *GetHistory* of the class *BRepAlgoAPI_Defeaturing* has been renamed to *History*.
* The classes *BRepAlgo_BooleanOperations* and *BRepAlgo_DSAccess* have been removed as obsolete. Please use the BRepAlgoAPI_* classes to perform Boolean operations.
* *BRepAlgo_DataMapOfShapeBoolean* has been removed as unused.
* *BRepAlgo_DataMapOfShapeInterference* has been removed as unused.
* *BRepAlgo_EdgeConnector* has been removed as unused.
* *BRepAlgo_SequenceOfSequenceOfInteger* has been removed as unused.
@subsection upgrade_740_localcontext Local Context removal
@@ -1621,9 +1616,3 @@ Now methods *GeomConvert::ConcatG1*, *GeomConvert::ConcatC1*, *Geom2dConvert::Co
*SelectBasics_PickResult* structure has been extended, so that it now defines 3D point on detected entity in addition to Depth value along picking ray.
*SelectMgr_SelectingVolumeManager::Overlap()* methods have been corrected to fill in *SelectBasics_PickResult* structure (depth and 3D point) instead of only depth value, so that custom *Select3D_SensitiveEntity* implementation should be updated accordingly (including *Select3D_SensitiveSet* subclasses).
@subsection upgrade_740_ocafpersistence Document format version management improvement.
Previously Document format version after restoring by DocumentRetrievalDriver was propagated using static methods of corresponding units (like MDataStd or MNaming) to static variables of these units and after that became accessible to Drivers of these units.
Now Document format version is available to drivers via RelocationTable. The Relocation table now keeps HeaderData of the document and a format version can be extracted in next way: theRelocTable.GetHeaderData()->StorageVersion().
Obsolete methods: *static void SetDocumentVersion (const Standard_Integer DocVersion)* and *static Standard_Integer DocumentVersion()* of *BinMDataStd*, *BinMNaming*, *XmlMDataStd* and *XmlMNaming* are removed.

View File

@@ -1891,21 +1891,6 @@ The input data for this step is as follows:
| 2.3 | Build solids <i>(SDi)</i> from *SFS*. | *BOPAlgo_BuilderSolid* |
| 2.4 | Add the solids <i>(SDi)</i> to the result | |
@subsection occt_algorithms_bop_on_opensolids Boolean operations on open solids
The Boolean operations on open solids are tricky enough that the standard approach of Boolean operations for building the result, based on the splits of solids does not work.
It happens because the algorithm for splitting solids (*BOPAlgo_BuilderSolid*) always tries to create the closed loops (shells) and make solids from them. But if the input solid is not closed, what can be expected from its splits?
For performing Boolean Operations on open solids another approach is used, which does not rely on the splits of the solids to be correct, but tries to select the splits of faces, which are necessary for the given type of operation.
The point here is that the type of Boolean operation clearly defines the states for the faces to be taken into result:
- For **COMMON** operation all the faces from the arguments located inside any solid of the opposite group must be taken;
- For **FUSE** operation all the faces from the arguments located outside of all solids of the opposite group must be taken;
- For **CUT** operation all the faces from the Objects located outside of all solids of the Tools and all faces from the Tools located inside any solid of the Objects must be taken;
- For **CUT21** operation all the faces from the Objects located inside any solid of the Tools and all faces from the Tools located outside of all solids of the Objects must be taken.
From the selected faces the result solids are built. Please note, that the result may contain as normal (closed) solids as the open ones.
Even with this approach, the correct result of Boolean operation on open solids cannot be always guaranteed.
This is explained by non-manifold nature of open solids: in some cases classification of a face depends on the point of the face chosen for classification.
@section occt_algorithms_10a Section Algorithm
@subsection occt_algorithms_10a_1 Arguments

View File

@@ -8370,62 +8370,6 @@ bfillds
bsplit result
~~~~
@subsubsection occt_draw_bop_build_BOP_opensolids Alternative command for BOP
There is an alternative way to build the result of Boolean operation using the **buildbop** command, which should be run after any other building command, such as **bbuild** or **bbop** or **bsplit**.
The command has the following features:
* It is designed to work on open solids and thus uses the alternative approach for building the results (see @ref occt_algorithms_bop_on_opensolids "BOP on open solids" chapter of Boolean operations user guide).
* It allows changing the groups of Objects and Tools of the operation (even excluding some of the arguments is possible).
* History information for solids will be lost.
Syntax:
~~~~
buildbop result -o s1 [s2 ...] -t s3 [s4 ...] -op operation (common/fuse/cut/tuc)
Where:
result - result shape of the operation
s1 s2 s3 s4 - arguments (solids) of the GF operation
operation - type of boolean operation
~~~~
**Example**
~~~~
box b1 10 10 10
box b2 5 5 5 10 10 10
box b3 -5 -5 -5 10 10 10
bclearobjects
bcleartools
baddobjects b1 b2 b3
bfillds
bbuild r
# bbop command will not be available as the tools are not set
# but buildbop is available
# fuse of two
buildbop r1 -o b1 -t b2 -op fuse
buildbop r2 -o b2 -t b3 -op fuse
# fuse of all - it does not matter how the groups are formed
buildbop r3 -o b1 b2 -t b3 -op fuse
buildbop r4 -o b2 -t b1 b3 -op fuse
buildbop r5 -o b1 b2 b3 -op fuse
buildbop r6 -t b1 b2 b3 -op fuse
# common of two
buildbop r7 -o b2 -t b1 -op common
buildbop r8 -o b1 -t b3 -op common
# common
buildbop r9 -o b1 -t b2 b3 -op common
# cut
buildbop r10 -o b1 -t b2 b3 -op cut
# opposite cut
buildbop r11 -o b1 -t b2 b3 -op tuc
~~~~
@subsubsection occt_draw_bop_build_CB Cells Builder
See the @ref occt_algorithms_10c_Cells_1 "Cells Builder Usage" for the Draw usage of Cells Builder algorithm.

View File

@@ -46,7 +46,6 @@
#pragma comment(lib, "TKSTEP.lib")
#pragma comment(lib, "TKStl.lib")
#pragma comment(lib, "TKVrml.lib")
#pragma comment(lib, "TKLCAF.lib")
//! Auxiliary tool for converting C# string into UTF-8 string.
static TCollection_AsciiString toAsciiString (String^ theString)

View File

@@ -54,7 +54,6 @@
#pragma comment(lib, "TKSTEP.lib")
#pragma comment(lib, "TKStl.lib")
#pragma comment(lib, "TKVrml.lib")
#pragma comment(lib, "TKLCAF.lib")
#pragma comment(lib, "D3D9.lib")

View File

@@ -116,7 +116,7 @@
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>../../../../win32\$(VCFMT)\bin/ImportExport.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\..\win32\$(VCFMT)\lib;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
@@ -158,7 +158,7 @@
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>../../../../win64\$(VCFMT)\bin/ImportExport.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\..\win64\$(VCFMT)\lib;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
@@ -199,7 +199,7 @@
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>../../../../win32\$(VCFMT)\bind/ImportExport.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\..\win32\$(VCFMT)\libd;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
@@ -241,7 +241,7 @@
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>../../../../win64\$(VCFMT)\bind/ImportExport.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\..\win64\$(VCFMT)\libd;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>

View File

@@ -115,7 +115,7 @@
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>../../../../win32\$(VCFMT)\bind/mfcsample.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
@@ -158,7 +158,7 @@
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>../../../../win64\$(VCFMT)\bind/mfcsample.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
@@ -202,7 +202,7 @@
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>../../../../win32\$(VCFMT)\bin/mfcsample.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
@@ -246,7 +246,7 @@
<ResourceOutputFileName>$(IntDir)%(Filename).res</ResourceOutputFileName>
</ResourceCompile>
<Link>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>../../../../win64\$(VCFMT)\bin/mfcsample.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>

View File

@@ -75,7 +75,7 @@ LIBS += -lTKernel -lTKMath -lTKService -lTKV3d -lTKOpenGl \
-lTKBRep -lTKIGES -lTKSTL -lTKVRML -lTKSTEP -lTKSTEPAttr -lTKSTEP209 \
-lTKSTEPBase -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d \
-lTKXSBase -lTKShHealing -lTKHLR -lTKTopAlgo -lTKMesh -lTKPrim \
-lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset -lTKLCAF \
-lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset \
!exists($${RES_DIR}) {
win32 {

View File

@@ -78,7 +78,7 @@ LIBS += -lTKernel -lTKMath -lTKService -lTKV3d -lTKOpenGl \
-lTKBRep -lTKIGES -lTKSTL -lTKVRML -lTKSTEP -lTKSTEPAttr -lTKSTEP209 \
-lTKSTEPBase -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d \
-lTKXSBase -lTKShHealing -lTKHLR -lTKTopAlgo -lTKMesh -lTKPrim \
-lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset -lTKLCAF \
-lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset \
!exists($${RES_DIR}) {
win32 {

View File

@@ -77,7 +77,6 @@ AIS_ColoredShape::AIS_ColoredShape (const TopoDS_Shape& theShape)
myDrawer->SetFreeBoundaryAspect (myDrawer->LineAspect());
myDrawer->SetUnFreeBoundaryAspect(myDrawer->LineAspect());
myDrawer->SetSeenLineAspect (myDrawer->LineAspect());
myDrawer->SetFaceBoundaryAspect (myDrawer->LineAspect());
}
//=======================================================================
@@ -91,7 +90,6 @@ AIS_ColoredShape::AIS_ColoredShape (const Handle(AIS_Shape)& theShape)
myDrawer->SetFreeBoundaryAspect (myDrawer->LineAspect());
myDrawer->SetUnFreeBoundaryAspect(myDrawer->LineAspect());
myDrawer->SetSeenLineAspect (myDrawer->LineAspect());
myDrawer->SetFaceBoundaryAspect (myDrawer->LineAspect());
if (theShape->HasMaterial())
{
SetMaterial (theShape->Material());
@@ -238,10 +236,6 @@ void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
{
aDrawer->WireAspect()->SetColor (theColor);
}
if (aDrawer->HasOwnFaceBoundaryAspect())
{
aDrawer->FaceBoundaryAspect()->SetColor (theColor);
}
}
}
@@ -272,10 +266,6 @@ void AIS_ColoredShape::SetWidth (const Standard_Real theLineWidth)
{
aDrawer->WireAspect()->SetWidth (theLineWidth);
}
if (aDrawer->HasOwnFaceBoundaryAspect())
{
aDrawer->FaceBoundaryAspect()->SetWidth (theLineWidth);
}
}
}

View File

@@ -31,34 +31,43 @@
static Handle(Prs3d_LineAspect) GetLineAspect(const Handle(Prs3d_Drawer)& Dr,
const AIS_TypeOfAttribute Att)
{
switch(Att)
{
switch(Att){
case AIS_TOA_Line:
return Dr->LineAspect();
break;
case AIS_TOA_Dimension:
return Dr->DimensionAspect()->LineAspect();
break;
case AIS_TOA_Wire:
return Dr->WireAspect();
break;
case AIS_TOA_Plane:
return Dr->PlaneAspect()->EdgesAspect();
break;
case AIS_TOA_Vector:
return Dr->VectorAspect();
break;
case AIS_TOA_UIso:
return Handle(Prs3d_LineAspect) (Dr->UIsoAspect());
break;
case AIS_TOA_VIso:
return Handle(Prs3d_LineAspect) (Dr->VIsoAspect());
break;
case AIS_TOA_Free:
return Dr->FreeBoundaryAspect();
break;
case AIS_TOA_UnFree:
return Dr->UnFreeBoundaryAspect();
break;
case AIS_TOA_Section:
return Dr->SectionAspect();
break;
case AIS_TOA_Hidden:
return Dr->HiddenLineAspect();
break;
case AIS_TOA_Seen:
return Dr->SeenLineAspect();
case AIS_TOA_FaceBoundary:
return Dr->FaceBoundaryAspect();
break;
case AIS_TOA_FirstAxis:
return Dr->DatumAspect()->LineAspect(Prs3d_DP_XAxis);
case AIS_TOA_SecondAxis:

View File

@@ -615,9 +615,31 @@ void AIS_InteractiveObject::SynchronizeAspects()
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPrs3d->Presentation()->Groups()); aGroupIter.More(); aGroupIter.Next())
{
if (!aGroupIter.Value().IsNull())
Handle(Graphic3d_Group)& aGrp = aGroupIter.ChangeValue();
if (aGrp.IsNull())
{
aGroupIter.ChangeValue()->SynchronizeAspects();
continue;
}
Handle(Graphic3d_AspectLine3d) aLineAspect = aGrp->LineAspect();
Handle(Graphic3d_AspectFillArea3d) aFaceAspect = aGrp->FillAreaAspect();
Handle(Graphic3d_AspectMarker3d) aMarkerAspect = aGrp->MarkerAspect();
Handle(Graphic3d_AspectText3d) aTextAspect = aGrp->TextAspect();
if (!aLineAspect.IsNull())
{
aGrp->SetGroupPrimitivesAspect (aLineAspect);
}
if (!aFaceAspect.IsNull())
{
aGrp->SetGroupPrimitivesAspect (aFaceAspect);
}
if (!aMarkerAspect.IsNull())
{
aGrp->SetGroupPrimitivesAspect (aMarkerAspect);
}
if (!aTextAspect.IsNull())
{
aGrp->SetGroupPrimitivesAspect (aTextAspect);
}
}
}

View File

@@ -346,13 +346,11 @@ Standard_Real AIS_Shape::Transparency() const {
//purpose :
//=======================================================================
bool AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
const Quantity_Color& theColor) const
{
bool toRecompute = false;
if (!theDrawer->HasOwnShadingAspect())
{
toRecompute = true;
theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
if (theDrawer->HasLink())
{
@@ -361,7 +359,6 @@ bool AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
}
if (!theDrawer->HasOwnLineAspect())
{
toRecompute = true;
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
@@ -370,7 +367,6 @@ bool AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
}
if (!theDrawer->HasOwnWireAspect())
{
toRecompute = true;
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
@@ -379,7 +375,6 @@ bool AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
}
if (!theDrawer->HasOwnPointAspect())
{
toRecompute = true;
theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_BLACK, 1.0));
if (theDrawer->HasLink())
{
@@ -388,7 +383,6 @@ bool AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
}
if (!theDrawer->HasOwnFreeBoundaryAspect())
{
toRecompute = true;
theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
@@ -397,7 +391,6 @@ bool AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
}
if (!theDrawer->HasOwnUnFreeBoundaryAspect())
{
toRecompute = true;
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
@@ -406,22 +399,12 @@ bool AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
}
if (!theDrawer->HasOwnSeenLineAspect())
{
toRecompute = true;
theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect();
}
}
if (!theDrawer->HasOwnFaceBoundaryAspect())
{
toRecompute = true;
theDrawer->SetFaceBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->FaceBoundaryAspect()->Aspect() = *theDrawer->Link()->FaceBoundaryAspect()->Aspect();
}
}
// override color
theDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
@@ -431,8 +414,6 @@ bool AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
theDrawer->FreeBoundaryAspect()->SetColor (theColor);
theDrawer->UnFreeBoundaryAspect()->SetColor (theColor);
theDrawer->SeenLineAspect()->SetColor (theColor);
theDrawer->FaceBoundaryAspect()->SetColor (theColor);
return toRecompute;
}
//=======================================================================
@@ -442,16 +423,9 @@ bool AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
void AIS_Shape::SetColor (const Quantity_Color& theColor)
{
const bool toRecompute = setColor (myDrawer, theColor);
setColor (myDrawer, theColor);
myDrawer->SetColor (theColor);
hasOwnColor = Standard_True;
if (!toRecompute)
{
myToRecomputeModes.Clear();
myRecomputeEveryPrs = false;
SynchronizeAspects();
return;
}
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
@@ -503,10 +477,8 @@ void AIS_Shape::UnsetColor()
if (!HasColor())
{
myToRecomputeModes.Clear();
myRecomputeEveryPrs = false;
return;
}
hasOwnColor = Standard_False;
myDrawer->SetColor (myDrawer->HasLink() ? myDrawer->Link()->Color() : Quantity_Color (Quantity_NOC_WHITE));
@@ -518,7 +490,6 @@ void AIS_Shape::UnsetColor()
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
myDrawer->SetSeenLineAspect (anEmptyAsp);
myDrawer->SetFaceBoundaryAspect (anEmptyAsp);
}
else
{
@@ -551,12 +522,6 @@ void AIS_Shape::UnsetColor()
AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Seen, aColor);
}
myDrawer->SeenLineAspect()->SetColor (aColor);
aColor = Quantity_NOC_BLACK;
if (myDrawer->HasLink())
{
AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_FaceBoundary, aColor);
}
myDrawer->FaceBoundaryAspect()->SetColor (aColor);
}
if (!myDrawer->HasOwnShadingAspect())
@@ -603,7 +568,40 @@ void AIS_Shape::UnsetColor()
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
}
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
myRecomputeEveryPrs = true;
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
Handle(Graphic3d_AspectLine3d) aLineAsp = myDrawer->LineAspect()->Aspect();
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
{
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
if (aPrsModed.Mode() != AIS_Shaded)
{
continue;
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
// Check if aspect of given type is set for the group,
// because setting aspect for group with no already set aspect
// can lead to loss of presentation data
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
{
aGroup->SetGroupPrimitivesAspect (aLineAsp);
}
}
}
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (2);
}
//=======================================================================
@@ -611,13 +609,11 @@ void AIS_Shape::UnsetColor()
//purpose :
//=======================================================================
bool AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
void AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Real theLineWidth) const
{
bool toRecompute = false;
if (!theDrawer->HasOwnLineAspect())
{
toRecompute = true;
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
@@ -626,7 +622,6 @@ bool AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
}
if (!theDrawer->HasOwnWireAspect())
{
toRecompute = true;
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
@@ -635,7 +630,6 @@ bool AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
}
if (!theDrawer->HasOwnFreeBoundaryAspect())
{
toRecompute = true;
theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
@@ -644,7 +638,6 @@ bool AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
}
if (!theDrawer->HasOwnUnFreeBoundaryAspect())
{
toRecompute = true;
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
@@ -653,22 +646,12 @@ bool AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
}
if (!theDrawer->HasOwnSeenLineAspect())
{
toRecompute = true;
theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect();
}
}
if (!theDrawer->HasOwnFaceBoundaryAspect())
{
toRecompute = true;
theDrawer->SetFaceBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->FaceBoundaryAspect()->Aspect() = *theDrawer->Link()->FaceBoundaryAspect()->Aspect();
}
}
// override width
theDrawer->LineAspect()->SetWidth (theLineWidth);
@@ -676,8 +659,6 @@ bool AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
theDrawer->FreeBoundaryAspect()->SetWidth (theLineWidth);
theDrawer->UnFreeBoundaryAspect()->SetWidth (theLineWidth);
theDrawer->SeenLineAspect()->SetWidth (theLineWidth);
theDrawer->FaceBoundaryAspect()->SetWidth (theLineWidth);
return toRecompute;
}
//=======================================================================
@@ -687,17 +668,10 @@ bool AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
{
setWidth (myDrawer, theLineWidth);
myOwnWidth = theLineWidth;
if (setWidth (myDrawer, theLineWidth))
{
myRecomputeEveryPrs = true;
}
else
{
myRecomputeEveryPrs = false;
myToRecomputeModes.Clear();
SynchronizeAspects();
}
LoadRecomputable (AIS_WireFrame); // means that it is necessary to recompute only the wireframe....
LoadRecomputable (2); // and the bounding box...
}
//=======================================================================
@@ -710,21 +684,20 @@ void AIS_Shape::UnsetWidth()
if (myOwnWidth == 0.0)
{
myToRecomputeModes.Clear();
myRecomputeEveryPrs = false;
return;
}
myOwnWidth = 0.0;
Handle(Prs3d_LineAspect) anEmptyAsp;
if (!HasColor())
{
const Handle(Prs3d_LineAspect) anEmptyAsp;
myDrawer->SetLineAspect (anEmptyAsp);
myDrawer->SetWireAspect (anEmptyAsp);
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
myDrawer->SetSeenLineAspect (anEmptyAsp);
myDrawer->SetFaceBoundaryAspect (anEmptyAsp);
myRecomputeEveryPrs = true;
}
else
{
@@ -738,12 +711,8 @@ void AIS_Shape::UnsetWidth()
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_UnFree) : 1.);
myDrawer->SeenLineAspect() ->SetWidth (myDrawer->HasLink() ?
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Seen) : 1.);
myDrawer->FaceBoundaryAspect() ->SetWidth (myDrawer->HasLink() ?
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_FaceBoundary) : 1.);
SynchronizeAspects();
myToRecomputeModes.Clear();
myRecomputeEveryPrs = false;
}
LoadRecomputable (AIS_WireFrame);
}
//=======================================================================

View File

@@ -174,7 +174,8 @@ public:
Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
//! Sets the value aValue for line width in the reconstructed compound shape.
//! Changes line aspects for lines presentation.
//! Changes line aspects for lines-only presentation modes like Wireframe and Bounding Box.
//! Doesn't change face boundary line aspect.
Standard_EXPORT virtual void SetWidth (const Standard_Real aValue) Standard_OVERRIDE;
//! Removes the setting for line width in the reconstructed compound shape.
@@ -304,13 +305,9 @@ protected:
Standard_EXPORT void LoadRecomputable (const Standard_Integer TheMode);
//! Create own aspects (if they do not exist) and set color to them.
//! @return TRUE if new aspects have been created
Standard_EXPORT bool setColor (const Handle(Prs3d_Drawer)& theDrawer, const Quantity_Color& theColor) const;
Standard_EXPORT void setColor (const Handle(Prs3d_Drawer)& theDrawer, const Quantity_Color& theColor) const;
//! Create own aspects (if they do not exist) and set width to them.
//! @return TRUE if new aspects have been created
Standard_EXPORT bool setWidth (const Handle(Prs3d_Drawer)& theDrawer, const Standard_Real theWidth) const;
Standard_EXPORT void setWidth (const Handle(Prs3d_Drawer)& theDrawer, const Standard_Real theWidth) const;
Standard_EXPORT void setTransparency (const Handle(Prs3d_Drawer)& theDrawer, const Standard_Real theValue) const;

View File

@@ -32,7 +32,6 @@ AIS_TOA_UnFree,
AIS_TOA_Section,
AIS_TOA_Hidden,
AIS_TOA_Seen,
AIS_TOA_FaceBoundary,
AIS_TOA_FirstAxis,
AIS_TOA_SecondAxis,
AIS_TOA_ThirdAxis

View File

@@ -1,4 +1,7 @@
// Copyright (c) 2018 OPEN CASCADE SAS
// Created on: 1992-10-08
// Created by: Isabelle GRIGNON
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -11,11 +14,10 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Graphic3d_Buffer.hxx>
#include <Graphic3d_BoundBuffer.hxx>
#include <Graphic3d_MutableIndexBuffer.hxx>
#ifndef _Adaptor2d_Curve2dPtr_HeaderFile
#define _Adaptor2d_Curve2dPtr_HeaderFile
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Buffer, NCollection_Buffer)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_IndexBuffer, Graphic3d_Buffer)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_BoundBuffer, NCollection_Buffer)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_MutableIndexBuffer, Graphic3d_IndexBuffer)
class Adaptor2d_Curve2d;
typedef Adaptor2d_Curve2d* Adaptor2d_Curve2dPtr;
#endif // _Adaptor2d_Curve2dPtr_HeaderFile

View File

@@ -1,5 +1,6 @@
Adaptor2d_Curve2d.cxx
Adaptor2d_Curve2d.hxx
Adaptor2d_Curve2dPtr.hxx
Adaptor2d_GenHCurve2d.gxx
Adaptor2d_GenHCurve2d.lxx
Adaptor2d_HCurve2d.cxx

View File

@@ -303,28 +303,14 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
sprintf(name, "bc2d_%d_%d", indc, nbbc);
DrawTrSurf::Set(name, theBezier2d);
#endif
const Standard_Real aSqNormToler = Epsilon(1.0)*Epsilon(1.0);
gp_Vec2d FirstVec(aPoles2d(1), aPoles2d(2)), SecondVec;
Standard_Real aVecSqNorm = FirstVec.SquareMagnitude();
if (aVecSqNorm < aSqNormToler)
{
theIndbad = theIndfirst + 1;
return Standard_False;
}
FirstVec /= Sqrt(aSqNormToler);
gp_Vec2d FirstVec, SecondVec;
FirstVec = gp_Vec2d(aPoles2d(1), aPoles2d(2));
FirstVec.Normalize();
gp_Pnt2d MidPnt = aPoles2d(2);
for (Standard_Integer k = 3; k <= aPoles2d.Upper(); k++)
{
SecondVec.SetXY(aPoles2d(k).XY() - MidPnt.XY());
aVecSqNorm = SecondVec.SquareMagnitude();
if (aVecSqNorm < aSqNormToler)
{
theIndbad = theIndfirst + k - 1;
return Standard_False;
}
SecondVec /= Sqrt(aVecSqNorm);
SecondVec = gp_Vec2d(MidPnt, aPoles2d(k));
SecondVec.Normalize();
Standard_Real ScalProd = FirstVec * SecondVec;
if (ScalProd < MinScalProd)
{

View File

@@ -6,97 +6,94 @@
N/A
.BOPAlgo_AlertBOPIsNotSet
The type of Boolean Operation is not set
Error: The type of Boolean Operation is not set
.BOPAlgo_AlertBOPNotAllowed
Boolean operation of the given type is not allowed on the given inputs
Error: Boolean operation of the given type is not allowed on the given inputs
.BOPAlgo_AlertSolidBuilderFailed
Building Fused solid has failed
Error: Building Fused solid has failed
.BOPAlgo_AlertTooFewArguments
There are no enough arguments to perform the operation
Error: There are no enough arguments to perform the operation
.BOPAlgo_AlertMultipleArguments
More than one argument is provided
Error: More than one argument is provided
.BOPAlgo_AlertNoFiller
The Pave Filler (the intersection tool) has not been created
Error: The Pave Filler (the intersection tool) has not been created
.BOPAlgo_AlertIntersectionFailed
The intersection of the arguments has failed
Error: The intersection of the arguments has failed
.BOPAlgo_AlertBuilderFailed
Building of the result shape has failed
Error: Building of the result shape has failed
.BOPAlgo_AlertNullFace
The face given to be split is a null shape
Error: The face given to be split is a null shape
.BOPAlgo_AlertNullInputShapes
No or null input shapes
Error: No or null input shapes
.BOPAlgo_AlertPostTreatFF
Cannot connect face intersection curves
Error: Cannot connect face intersection curves
.BOPAlgo_AlertEmptyShape
Some of the arguments are empty shapes
Warning: Some of the arguments are empty shapes
.BOPAlgo_AlertSelfInterferingShape
Some of the arguments are self-interfering shapes
Warning: Some of the arguments are self-interfering shapes
.BOPAlgo_AlertTooSmallEdge
Some edges are too small and have no valid range
Warning: Some edges are too small and have no valid range
.BOPAlgo_AlertNotSplittableEdge
Some edges are very small and have such a small valid range, that they cannot be split
Warning: Some edges are very small and have such a small valid range, that they cannot be split
.BOPAlgo_AlertBadPositioning
The positioning of the shapes leads to creation of the small edges without valid range
Warning: The positioning of the shapes leads to creation of the small edges without valid range
.BOPAlgo_AlertShellSplitterFailed
Unable to build loops from the given faces
Warning: Unable to build loops from the given faces
.BOPAlgo_AlertRemovalOfIBForMDimShapes
Removal of internal boundaries among the multi-dimensional shapes is not supported yet
Warning: Removal of internal boundaries among the multi-dimensional shapes is not supported yet
.BOPAlgo_AlertRemovalOfIBForSolidsFailed
Removal of internal boundaries among Solids has failed
Warning: Removal of internal boundaries among Solids has failed
.BOPAlgo_AlertRemovalOfIBForFacesFailed
Removal of internal boundaries among Faces has failed
Warning: Removal of internal boundaries among Faces has failed
.BOPAlgo_AlertRemovalOfIBForEdgesFailed
Removal of internal boundaries among Edges has failed
Warning: Removal of internal boundaries among Edges has failed
.BOPAlgo_AlertIntersectionOfPairOfShapesFailed
Intersection of pair of shapes has failed
Warning: Intersection of pair of shapes has failed
.BOPAlgo_AlertBuildingPCurveFailed
Building 2D curve of edge on face has failed
Warning: Building 2D curve of edge on face has failed
.BOPAlgo_AlertAcquiredSelfIntersection
Some sub-shapes of some of the argument become connected through other shapes and the argument became self-interfered
Warning: Some sub-shapes of some of the argument become connected through other shapes and the argument became self-interfered
.BOPAlgo_AlertUnsupportedType
Unsupported type of input shape
Warning: Unsupported type of input shape
.BOPAlgo_AlertUnableToRemoveTheFeature
Unable to remove the feature
Warning: Unable to remove the feature
.BOPAlgo_AlertNoFacesToRemove
No faces have been found for removal
Error: No faces have been found for removal
.BOPAlgo_AlertRemoveFeaturesFailed
The Feature Removal algorithm has failed
Error: The Feature Removal algorithm has failed
.BOPAlgo_AlertSolidBuilderUnusedFaces
Some of the faces passed to the Solid Builder algorithm have not been classified and not used for solids creation
Warning: Some of the faces passed to the Solid Builder algorithm have not been classified and not used for solids creation
.BOPAlgo_AlertFaceBuilderUnusedEdges
Some of the edges passed to the Face Builder algorithm have not been classified and not used for faces creation
Warning: Some of the edges passed to the Face Builder algorithm have not been classified and not used for faces creation
.BOPAlgo_AlertUnableToOrientTheShape
Unable to orient the shape correctly
.BOPAlgo_AlertUnknownShape
Shape is unknown for operation
Warning: Unable to orient the shape correctly

View File

@@ -111,7 +111,4 @@ DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertFaceBuilderUnusedEdges)
//! Unable to orient the shape correctly
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertUnableToOrientTheShape)
//! Shape is unknown for operation
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertUnknownShape)
#endif // _BOPAlgo_Alerts_HeaderFile

View File

@@ -30,7 +30,6 @@
#include <TopAbs_ShapeEnum.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
@@ -773,32 +772,6 @@ void BOPAlgo_BOP::BuildRC()
//=======================================================================
void BOPAlgo_BOP::BuildShape()
{
if (myDims[0] == 3 && myDims[1] == 3)
{
// For the Boolean operation on solids we need to check first
// if we are dealing with closed solids, because for open solids
// we cannot expect the BuilderSolid algorithm to produce good
// splits for them and have to try the alternative approach for
// building the result shape.
// This approach is not used by default as it will loose the
// modification history for solids, because the result solid
// will be built from scratch using the splits of faces.
Standard_Boolean hasNotClosedSolids = CheckArgsForOpenSolid();
if (hasNotClosedSolids)
{
Handle(Message_Report) aReport = new Message_Report();
BuildBOP(myArguments, myTools, myOperation, aReport);
if (aReport->GetAlerts(Message_Fail).IsEmpty())
{
// Success. Merge the report into the main report.
myReport->Merge(aReport);
return;
}
}
}
// Build the result using splits of arguments.
BuildRC();
//
if ((myOperation == BOPAlgo_FUSE) && (myDims[0] == 3)) {
@@ -1196,157 +1169,6 @@ void BOPAlgo_BOP::BuildSolid()
//
myShape = aResult;
}
//=======================================================================
//function : CheckArgsForOpenSolid
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_BOP::CheckArgsForOpenSolid()
{
// Analyze the report to find if BuilderSolid has generated warnings
// for any of the solids and collect these solids to check if they are open.
TopTools_MapOfShape aFailedSolids;
{
const Message_ListOfAlert& aList = myReport->GetAlerts(Message_Warning);
for (Message_ListOfAlert::Iterator aIt(aList); aIt.More(); aIt.Next())
{
const Handle(Standard_Type)& aType = aIt.Value()->DynamicType();
if (aType != STANDARD_TYPE(BOPAlgo_AlertSolidBuilderUnusedFaces))
continue;
Handle(TopoDS_AlertWithShape) aShapeAlert = Handle(TopoDS_AlertWithShape)::DownCast(aIt.Value());
if (!aShapeAlert.IsNull())
{
const TopoDS_Shape& aWarnShape = aShapeAlert->GetShape();
if (!aWarnShape.IsNull())
{
TopExp_Explorer expS(aWarnShape, TopAbs_SOLID);
for (; expS.More(); expS.Next())
aFailedSolids.Add(expS.Current());
}
}
}
}
// Iterate on all solids from the arguments and check if any
// of them are not closed.
// At the same time, collect all internal faces of the input solids
// to check if the splits of open solids did not acquire any new
// internal faces.
const Standard_Integer aNbS = myDS->NbSourceShapes();
for (Standard_Integer i = 0; i < aNbS; ++i)
{
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
if (aSI.ShapeType() != TopAbs_SOLID)
continue;
const TopoDS_Shape& aSolid = aSI.Shape();
// Check that not INTERNAL faces create closed loops
TopTools_IndexedDataMapOfShapeListOfShape aMEF;
// Collect all splits of internal faces
TopTools_MapOfShape aMFInternal;
for (TopoDS_Iterator itSh(aSolid); itSh.More(); itSh.Next())
{
const TopoDS_Shape& aSh = itSh.Value();
if (aSh.ShapeType() != TopAbs_SHELL)
continue;
for (TopoDS_Iterator itF(aSh); itF.More(); itF.Next())
{
const TopoDS_Shape& aF = itF.Value();
if (aF.Orientation() == TopAbs_INTERNAL)
{
const TopTools_ListOfShape* pLFIm = myImages.Seek(aF);
if (pLFIm)
{
TopTools_ListOfShape::Iterator itLFIm(*pLFIm);
for (; itLFIm.More(); itLFIm.Next())
aMFInternal.Add(itLFIm.Value());
}
else
aMFInternal.Add(aF);
}
else
TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF);
}
}
// Analyze the Edge-Face connection map on free edges
Standard_Boolean isClosed = Standard_True;
const Standard_Integer aNbE = aMEF.Extent();
for (Standard_Integer j = 1; j <= aNbE && isClosed; ++j)
{
const TopoDS_Edge& aE = TopoDS::Edge(aMEF.FindKey(j));
if (BRep_Tool::Degenerated(aE))
// Skip degenerated edges
continue;
isClosed = (aMEF(j).Extent() > 1);
if (!isClosed)
{
const TopoDS_Face& aF = TopoDS::Face(aMEF(j).First());
isClosed = BRep_Tool::IsClosed(aE, aF); // Check for seam edges
if (!isClosed)
{
// Check if the edge is not internal in the face
TopExp_Explorer expE(aF, TopAbs_EDGE);
for (; expE.More(); expE.Next())
{
if (expE.Current().IsSame(aE))
{
isClosed = (expE.Current().Orientation() == TopAbs_INTERNAL);
break;
}
}
}
}
}
if (isClosed)
continue;
// Not closed solid is found
if (aFailedSolids.Contains(aSolid))
// Warning has been generated for this solid, return positive result right away.
return Standard_True;
// Check the splits not to acquire new INTERNAL faces
const TopTools_ListOfShape *pLSIm = myImages.Seek(aSolid);
if (!pLSIm)
continue;
TopTools_ListOfShape::Iterator itLSIm(*pLSIm);
for (; itLSIm.More(); itLSIm.Next())
{
const TopoDS_Shape& aSIm = itLSIm.Value();
for (TopoDS_Iterator itSh(aSIm); itSh.More(); itSh.Next())
{
const TopoDS_Shape& aSh = itSh.Value();
if (aSh.ShapeType() != TopAbs_SHELL)
continue;
for (TopoDS_Iterator itF(aSh); itF.More(); itF.Next())
{
const TopoDS_Shape& aF = itF.Value();
if (aF.Orientation() == TopAbs_INTERNAL)
{
if (!aMFInternal.Contains(aF))
// New internal face is found
return Standard_True;
}
}
}
}
}
return Standard_False;
}
//=======================================================================
//function : TypeToExplore
//purpose :

View File

@@ -107,12 +107,6 @@ protected:
//! all shapes in one of the groups are empty shapes.
Standard_EXPORT Standard_Boolean TreatEmptyShape();
//! Checks if the arguments of Boolean Operation on solids
//! contain any open solids, for which the building of the splits
//! has failed. In case of positive check, run different procedure
//! for building the result shape.
Standard_EXPORT virtual Standard_Boolean CheckArgsForOpenSolid();
protected:
BOPAlgo_Operation myOperation;

View File

@@ -9,97 +9,94 @@ static const char BOPAlgo_BOPAlgo_msg[] =
"N/A\n"
"\n"
".BOPAlgo_AlertBOPIsNotSet\n"
"The type of Boolean Operation is not set\n"
"Error: The type of Boolean Operation is not set\n"
"\n"
".BOPAlgo_AlertBOPNotAllowed\n"
"Boolean operation of the given type is not allowed on the given inputs\n"
"Error: Boolean operation of the given type is not allowed on the given inputs\n"
"\n"
".BOPAlgo_AlertSolidBuilderFailed\n"
"Building Fused solid has failed\n"
"Error: Building Fused solid has failed\n"
"\n"
".BOPAlgo_AlertTooFewArguments\n"
"There are no enough arguments to perform the operation\n"
"Error: There are no enough arguments to perform the operation\n"
"\n"
".BOPAlgo_AlertMultipleArguments\n"
"More than one argument is provided\n"
"Error: More than one argument is provided\n"
"\n"
".BOPAlgo_AlertNoFiller\n"
"The Pave Filler (the intersection tool) has not been created\n"
"Error: The Pave Filler (the intersection tool) has not been created\n"
"\n"
".BOPAlgo_AlertIntersectionFailed\n"
"The intersection of the arguments has failed\n"
"Error: The intersection of the arguments has failed\n"
"\n"
".BOPAlgo_AlertBuilderFailed\n"
"Building of the result shape has failed\n"
"Error: Building of the result shape has failed\n"
"\n"
".BOPAlgo_AlertNullFace\n"
"The face given to be split is a null shape\n"
"Error: The face given to be split is a null shape\n"
"\n"
".BOPAlgo_AlertNullInputShapes\n"
"No or null input shapes\n"
"Error: No or null input shapes\n"
"\n"
".BOPAlgo_AlertPostTreatFF\n"
"Cannot connect face intersection curves\n"
"Error: Cannot connect face intersection curves\n"
"\n"
".BOPAlgo_AlertEmptyShape\n"
"Some of the arguments are empty shapes\n"
"Warning: Some of the arguments are empty shapes\n"
"\n"
".BOPAlgo_AlertSelfInterferingShape\n"
"Some of the arguments are self-interfering shapes\n"
"Warning: Some of the arguments are self-interfering shapes\n"
"\n"
".BOPAlgo_AlertTooSmallEdge\n"
"Some edges are too small and have no valid range\n"
"Warning: Some edges are too small and have no valid range\n"
"\n"
".BOPAlgo_AlertNotSplittableEdge\n"
"Some edges are very small and have such a small valid range, that they cannot be split\n"
"Warning: Some edges are very small and have such a small valid range, that they cannot be split\n"
"\n"
".BOPAlgo_AlertBadPositioning\n"
"The positioning of the shapes leads to creation of the small edges without valid range\n"
"Warning: The positioning of the shapes leads to creation of the small edges without valid range\n"
"\n"
".BOPAlgo_AlertShellSplitterFailed\n"
"Unable to build loops from the given faces\n"
"Warning: Unable to build loops from the given faces\n"
"\n"
".BOPAlgo_AlertRemovalOfIBForMDimShapes\n"
"Removal of internal boundaries among the multi-dimensional shapes is not supported yet\n"
"Warning: Removal of internal boundaries among the multi-dimensional shapes is not supported yet\n"
"\n"
".BOPAlgo_AlertRemovalOfIBForSolidsFailed\n"
"Removal of internal boundaries among Solids has failed\n"
"Warning: Removal of internal boundaries among Solids has failed\n"
"\n"
".BOPAlgo_AlertRemovalOfIBForFacesFailed\n"
"Removal of internal boundaries among Faces has failed\n"
"Warning: Removal of internal boundaries among Faces has failed\n"
"\n"
".BOPAlgo_AlertRemovalOfIBForEdgesFailed\n"
"Removal of internal boundaries among Edges has failed\n"
"Warning: Removal of internal boundaries among Edges has failed\n"
"\n"
".BOPAlgo_AlertIntersectionOfPairOfShapesFailed\n"
"Intersection of pair of shapes has failed\n"
"Warning: Intersection of pair of shapes has failed\n"
"\n"
".BOPAlgo_AlertBuildingPCurveFailed\n"
"Building 2D curve of edge on face has failed\n"
"Warning: Building 2D curve of edge on face has failed\n"
"\n"
".BOPAlgo_AlertAcquiredSelfIntersection\n"
"Some sub-shapes of some of the argument become connected through other shapes and the argument became self-interfered\n"
"Warning: Some sub-shapes of some of the argument become connected through other shapes and the argument became self-interfered\n"
"\n"
".BOPAlgo_AlertUnsupportedType\n"
"Unsupported type of input shape\n"
"Warning: Unsupported type of input shape\n"
"\n"
".BOPAlgo_AlertUnableToRemoveTheFeature\n"
"Unable to remove the feature\n"
"Warning: Unable to remove the feature\n"
"\n"
".BOPAlgo_AlertNoFacesToRemove\n"
"No faces have been found for removal\n"
"Error: No faces have been found for removal\n"
"\n"
".BOPAlgo_AlertRemoveFeaturesFailed\n"
"The Feature Removal algorithm has failed\n"
"Error: The Feature Removal algorithm has failed\n"
"\n"
".BOPAlgo_AlertSolidBuilderUnusedFaces\n"
"Some of the faces passed to the Solid Builder algorithm have not been classified and not used for solids creation\n"
"Warning: Some of the faces passed to the Solid Builder algorithm have not been classified and not used for solids creation\n"
"\n"
".BOPAlgo_AlertFaceBuilderUnusedEdges\n"
"Some of the edges passed to the Face Builder algorithm have not been classified and not used for faces creation\n"
"Warning: Some of the edges passed to the Face Builder algorithm have not been classified and not used for faces creation\n"
"\n"
".BOPAlgo_AlertUnableToOrientTheShape\n"
"Unable to orient the shape correctly\n"
"\n"
".BOPAlgo_AlertUnknownShape\n"
"Shape is unknown for operation\n";
"Warning: Unable to orient the shape correctly\n";

View File

@@ -17,24 +17,22 @@
#include <BOPAlgo_Builder.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_ShapeInfo.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BRep_Builder.hxx>
#include <IntTools_Context.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Solid.hxx>
#include <BRep_Builder.hxx>
#include <BOPDS_ShapeInfo.hxx>
#include <BOPDS_DS.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_MapOfOrientedShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
//=======================================================================
@@ -52,7 +50,6 @@ BOPAlgo_Builder::BOPAlgo_Builder()
myImages(100, myAllocator),
myShapesSD(100, myAllocator),
myOrigins(100, myAllocator),
myInParts(100, myAllocator),
myNonDestructive(Standard_False),
myGlue(BOPAlgo_GlueOff),
myCheckInverted(Standard_True)
@@ -74,7 +71,6 @@ BOPAlgo_Builder::BOPAlgo_Builder
myImages(100, myAllocator),
myShapesSD(100, myAllocator),
myOrigins(100, myAllocator),
myInParts(100, myAllocator),
myNonDestructive(Standard_False),
myGlue(BOPAlgo_GlueOff),
myCheckInverted(Standard_True)
@@ -105,7 +101,6 @@ void BOPAlgo_Builder::Clear()
myImages.Clear();
myShapesSD.Clear();
myOrigins.Clear();
myInParts.Clear();
}
//=======================================================================
//function : AddArgument
@@ -381,366 +376,3 @@ void BOPAlgo_Builder::PostTreat()
BOPTools_AlgoTools::CorrectTolerances(myShape, aMA, 0.05, myRunParallel);
BOPTools_AlgoTools::CorrectShapeTolerances(myShape, aMA, myRunParallel);
}
//=======================================================================
//function : BuildBOP
//purpose :
//=======================================================================
void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects,
const TopAbs_State theObjState,
const TopTools_ListOfShape& theTools,
const TopAbs_State theToolsState,
Handle(Message_Report) theReport)
{
if (HasErrors())
return;
// Report for the method
Handle(Message_Report) aReport = theReport.IsNull() ? myReport : theReport;
if (myArguments.IsEmpty() || myShape.IsNull())
{
aReport->AddAlert(Message_Fail, new BOPAlgo_AlertBuilderFailed());
return;
}
// Check the input data
if ((theObjState != TopAbs_IN && theObjState != TopAbs_OUT) ||
(theToolsState != TopAbs_IN && theToolsState != TopAbs_OUT))
{
aReport->AddAlert(Message_Fail, new BOPAlgo_AlertBOPNotSet());
return;
}
// Check input shapes
Standard_Boolean hasObjects = !theObjects.IsEmpty();
Standard_Boolean hasTools = !theTools .IsEmpty();
if (!hasObjects && !hasTools)
{
aReport->AddAlert(Message_Fail, new BOPAlgo_AlertTooFewArguments());
return;
}
// Check that all input solids are from the arguments
for (Standard_Integer i = 0; i < 2; ++i)
{
const TopTools_ListOfShape& aList = !i ? theObjects : theTools;
TopTools_ListOfShape::Iterator itLS(aList);
for (; itLS.More(); itLS.Next())
{
const TopoDS_Shape& aS = itLS.Value();
// Check if the shape belongs to the arguments of operation
if (myDS->Index(aS) < 0)
{
aReport->AddAlert(Message_Fail, new BOPAlgo_AlertUnknownShape(aS));
return;
}
// Check if the shape is a solid or collection of them
if (aS.ShapeType() != TopAbs_SOLID)
{
TopTools_ListOfShape aLS;
TopTools_MapOfShape aMFence;
BOPAlgo_Tools::TreatCompound(aS, aMFence, aLS);
TopTools_ListOfShape::Iterator it(aLS);
for (; it.More(); it.Next())
{
const TopoDS_Shape& aSx = it.Value();
if (aSx.ShapeType() != TopAbs_SOLID &&
aSx.ShapeType() != TopAbs_COMPSOLID)
{
aReport->AddAlert(Message_Fail, new BOPAlgo_AlertUnsupportedType(aS));
return;
}
}
}
}
}
// Classification of the faces relatively solids has been made
// on the stage of Solids splitting. All results are saved into
// myInParts map, which connects the solids with its IN faces from
// other arguments. All faces not contained in the list of IN faces
// will be considered as OUT.
// Prepare the maps of splits of solids faces with orientations
TopTools_IndexedMapOfOrientedShape aMObjFacesOri, aMToolFacesOri;
// Prepare the maps of splits of solids faces
TopTools_IndexedMapOfShape aMObjFaces, aMToolFaces;
// Copy the list of IN faces of the solids into map
TopTools_MapOfShape anINObjects, anINTools;
for (Standard_Integer i = 0; i < 2; ++i)
{
const TopTools_ListOfShape& aList = !i ? theObjects : theTools;
TopTools_IndexedMapOfOrientedShape& aMapOri = !i ? aMObjFacesOri : aMToolFacesOri;
TopTools_IndexedMapOfShape& aMap = !i ? aMObjFaces : aMToolFaces;
TopTools_ListOfShape::Iterator itLS(aList);
for (; itLS.More(); itLS.Next())
{
const TopoDS_Shape& aShape = itLS.Value();
TopExp_Explorer expS(aShape, TopAbs_SOLID);
for (; expS.More(); expS.Next())
{
const TopoDS_Shape& aS = expS.Current();
TopExp_Explorer expF(aS, TopAbs_FACE);
for (; expF.More(); expF.Next())
{
const TopoDS_Shape& aF = expF.Current();
if (aF.Orientation() != TopAbs_FORWARD &&
aF.Orientation() != TopAbs_REVERSED)
continue;
const TopTools_ListOfShape* pLFIm = myImages.Seek(aF);
if (pLFIm)
{
TopTools_ListOfShape::Iterator itLFIm(*pLFIm);
for (; itLFIm.More(); itLFIm.Next())
{
TopoDS_Face aFIm = TopoDS::Face(itLFIm.Value());
if (BOPTools_AlgoTools::IsSplitToReverse(aFIm, aF, myContext))
aFIm.Reverse();
aMapOri.Add(aFIm);
aMap.Add(aFIm);
}
}
else
{
aMapOri.Add(aF);
aMap.Add(aF);
}
}
// Copy the list of IN faces into a map
const TopTools_ListOfShape* pLFIN = myInParts.Seek(aS);
if (pLFIN)
{
TopTools_MapOfShape& anINMap = !i ? anINObjects : anINTools;
TopTools_ListOfShape::Iterator itLFIn(*pLFIN);
for (; itLFIn.More(); itLFIn.Next())
anINMap.Add(itLFIn.Value());
}
}
}
}
// Now we need to select all faces which will participate in
// building of the resulting solids. The final set of faces
// depends on the given states for the groups.
Standard_Boolean isObjectsIN = (theObjState == TopAbs_IN),
isToolsIN = (theToolsState == TopAbs_IN);
// Shortcuts
Standard_Boolean bAvoidIN = (!isObjectsIN && !isToolsIN), // avoid all in faces
bAvoidINforBoth = (isObjectsIN != isToolsIN); // avoid faces IN for both groups
// Choose which SD faces are needed to be taken - equally or differently oriented faces
Standard_Boolean isSameOriNeeded = (theObjState == theToolsState);
// Resulting faces
TopTools_IndexedMapOfOrientedShape aMResFacesOri;
TopTools_MapOfShape aMResFacesFence;
// Fence map
TopTools_MapOfShape aMFence, aMFToAvoid;
// Oriented fence map
TopTools_MapOfOrientedShape aMFenceOri;
for (Standard_Integer i = 0; i < 2; ++i)
{
const TopTools_IndexedMapOfOrientedShape& aMap = !i ? aMObjFacesOri : aMToolFacesOri;
const TopTools_IndexedMapOfShape& anOppositeMap = !i ? aMToolFaces : aMObjFaces;
const TopTools_MapOfShape& anINMap = !i ? anINObjects : anINTools;
const TopTools_MapOfShape& anOppositeINMap = !i ? anINTools : anINObjects;
const Standard_Boolean bTakeIN = !i ? isObjectsIN : isToolsIN;
const Standard_Integer aNbF = aMap.Extent();
for (Standard_Integer j = 1; j <= aNbF; ++j)
{
TopoDS_Shape aFIm = aMap(j);
Standard_Boolean isIN = anINMap.Contains(aFIm);
Standard_Boolean isINOpposite = anOppositeINMap.Contains(aFIm);
// Filtering for FUSE - avoid any IN faces
if (bAvoidIN && (isIN || isINOpposite))
continue;
// Filtering for CUT - avoid faces IN for both groups
if (bAvoidINforBoth && isIN && isINOpposite)
continue;
// Treatment of SD faces
if (!aMFence.Add(aFIm))
{
if (!anOppositeMap.Contains(aFIm))
{
// The face belongs to only one group
if (bTakeIN != isSameOriNeeded)
aMFToAvoid.Add(aFIm);
}
else
{
// The face belongs to both groups.
// Using its orientation decide if it is needed in the result or not.
Standard_Boolean isSameOri = !aMFenceOri.Add(aFIm);
if (isSameOriNeeded == isSameOri)
{
// Take the shape without classification
if (aMResFacesFence.Add(aFIm))
aMResFacesOri.Add(aFIm);
}
else
// Remove the face
aMFToAvoid.Add(aFIm);
continue;
}
}
if (!aMFenceOri.Add(aFIm))
continue;
if (bTakeIN == isINOpposite)
{
if (isIN)
{
aMResFacesOri.Add(aFIm);
aMResFacesOri.Add(aFIm.Reversed());
}
else if (bTakeIN && !isSameOriNeeded)
aMResFacesOri.Add(aFIm.Reversed());
else
aMResFacesOri.Add(aFIm);
aMResFacesFence.Add(aFIm);
}
}
}
// Remove the faces which has to be avoided
TopTools_ListOfShape aResFaces;
const Standard_Integer aNbRF = aMResFacesOri.Extent();
for (Standard_Integer i = 1; i <= aNbRF; ++i)
{
const TopoDS_Shape& aRF = aMResFacesOri(i);
if (!aMFToAvoid.Contains(aRF))
aResFaces.Append(aRF);
}
BRep_Builder aBB;
// Try to build closed solids from the faces
BOPAlgo_BuilderSolid aBS;
aBS.SetShapes(aResFaces);
aBS.SetRunParallel(myRunParallel);
aBS.SetContext(myContext);
aBS.SetFuzzyValue(myFuzzyValue);
aBS.SetProgressIndicator(myProgressIndicator);
aBS.Perform();
// Resulting solids
TopTools_ListOfShape aResSolids;
aMFence.Clear();
if (!aBS.HasErrors())
{
// If any, add solids into resulting compound
TopTools_ListIteratorOfListOfShape itA(aBS.Areas());
for (; itA.More(); itA.Next())
{
const TopoDS_Shape& aSolid = itA.Value();
// The solid must contain at least one face
// from either of objects or tools
TopExp_Explorer expF(aSolid, TopAbs_FACE);
for (; expF.More(); expF.Next())
{
const TopoDS_Shape& aF = expF.Current();
if (aMObjFacesOri.Contains(aF) || aMToolFacesOri.Contains(aF))
break;
}
if (expF.More())
{
aResSolids.Append(aSolid);
TopExp::MapShapes(aSolid, aMFence);
}
}
}
// Collect unused faces
TopoDS_Compound anUnUsedFaces;
aBB.MakeCompound(anUnUsedFaces);
TopTools_ListOfShape::Iterator itLF(aResFaces);
for (; itLF.More(); itLF.Next())
{
if (aMFence.Add(itLF.Value()))
aBB.Add(anUnUsedFaces, itLF.Value());
}
// Build blocks from the unused faces
TopTools_ListOfShape aLCB;
BOPTools_AlgoTools::MakeConnexityBlocks(anUnUsedFaces, TopAbs_EDGE, TopAbs_FACE, aLCB);
// Build solid from each block
TopTools_ListIteratorOfListOfShape itCB(aLCB);
for (; itCB.More(); itCB.Next())
{
const TopoDS_Shape& aCB = itCB.Value();
TopoDS_Shell aShell;
aBB.MakeShell(aShell);
// Add faces of the block to the shell
TopExp_Explorer anExpF(aCB, TopAbs_FACE);
for (; anExpF.More(); anExpF.Next())
aBB.Add(aShell, TopoDS::Face(anExpF.Current()));
BOPTools_AlgoTools::OrientFacesOnShell(aShell);
// Make solid out of the shell
TopoDS_Solid aSolid;
aBB.MakeSolid(aSolid);
aBB.Add(aSolid, aShell);
// Add new solid to result
aResSolids.Append(aSolid);
}
if (!bAvoidIN)
{
// Fill solids with internal parts coming with the solids
TopTools_ListOfShape anInParts;
for (Standard_Integer i = 0; i < 2; ++i)
{
const TopTools_ListOfShape& aList = !i ? theObjects : theTools;
TopTools_ListOfShape::Iterator itLS(aList);
for (; itLS.More(); itLS.Next())
{
TopExp_Explorer expS(itLS.Value(), TopAbs_SOLID);
for (; expS.More(); expS.Next())
{
const TopoDS_Shape& aS = expS.Current(); // Solid
for (TopoDS_Iterator it(aS); it.More(); it.Next())
{
const TopoDS_Shape& aSInt = it.Value();
if (aSInt.Orientation() == TopAbs_INTERNAL)
anInParts.Append(aSInt); // vertex or edge
else
{
// shell treatment
TopoDS_Iterator itInt(aSInt);
if (itInt.More() && itInt.Value().Orientation() == TopAbs_INTERNAL)
anInParts.Append(aSInt);
}
}
}
}
}
BOPAlgo_Tools::FillInternals(aResSolids, anInParts, myImages, myContext);
}
// Combine solids into compound
TopoDS_Shape aResult;
aBB.MakeCompound(TopoDS::Compound(aResult));
TopTools_ListOfShape::Iterator itLS(aResSolids);
for (; itLS.More(); itLS.Next())
aBB.Add(aResult, itLS.Value());
myShape = aResult;
PrepareHistory();
}

View File

@@ -25,7 +25,6 @@
#include <BOPAlgo_PPaveFiller.hxx>
#include <BOPAlgo_BuilderShape.hxx>
#include <BOPAlgo_GlueEnum.hxx>
#include <BOPAlgo_Operation.hxx>
#include <BOPDS_PDS.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <Standard_Integer.hxx>
@@ -39,7 +38,6 @@
class IntTools_Context;
class TopoDS_Shape;
class BOPAlgo_PaveFiller;
class TopoDS_Solid;
//!
//! The class is a General Fuse algorithm - base algorithm for the
@@ -176,114 +174,6 @@ public: //! @name Performing the operation
Standard_EXPORT virtual void PerformWithFiller (const BOPAlgo_PaveFiller& theFiller);
public: //! @name BOPs on open solids
//! Builds the result shape according to the given states for the objects
//! and tools. These states can be unambiguously converted into the Boolean operation type.
//! Thus, it performs the Boolean operation on the given groups of shapes.
//!
//! The result is built basing on the result of Builder operation (GF or any other).
//! The only condition for the Builder is that the splits of faces should be created
//! and classified relatively solids.
//!
//! The method uses classification approach for choosing the faces which will
//! participate in building the result shape:
//! - All faces from each group having the given state for the opposite group
//! will be taken into result.
//!
//! Such approach shows better results (in comparison with BOPAlgo_BuilderSolid approach)
//! when working with open solids. However, the result may not be always
//! correct on such data (at least, not as expected) as the correct classification
//! of the faces relatively open solids is not always possible and may vary
//! depending on the chosen classification point on the face.
//!
//! History is not created for the solids in this method.
//!
//! To avoid pollution of the report of Builder algorithm, there is a possibility to pass
//! the different report to collect the alerts of the method only. But, if the new report
//! is not given, the Builder report will be used.
//! So, even if Builder passed without any errors, but some error has been stored into its report
//! in this method, for the following calls the Builder report must be cleared.
//!
//! The method may set the following errors:
//! - BOPAlgo_AlertBuilderFailed - Building operation has not been performed yet or failed;
//! - BOPAlgo_AlertBOPNotSet - invalid BOP type is given (COMMON/FUSE/CUT/CUT21 are supported);
//! - BOPAlgo_AlertTooFewArguments - arguments are not given;
//! - BOPAlgo_AlertUnknownShape - the shape is unknown for the operation.
//!
//! Parameters:
//! @param theObjects - The group of Objects for BOP;
//! @param theObjState - State for objects faces to pass into result;
//! @param theTools - The group of Tools for BOP;
//! @param theObjState - State for tools faces to pass into result;
//! @param theReport - The alternative report to avoid pollution of the main one.
Standard_EXPORT virtual void BuildBOP(const TopTools_ListOfShape& theObjects,
const TopAbs_State theObjState,
const TopTools_ListOfShape& theTools,
const TopAbs_State theToolsState,
Handle(Message_Report) theReport = NULL);
//! Builds the result of Boolean operation of given type
//! basing on the result of Builder operation (GF or any other).
//!
//! The method converts the given type of operation into the states
//! for the objects and tools required for their face to pass into result
//! and performs the call to the same method, but with states instead
//! of operation type.
//!
//! The conversion looks as follows:
//! - COMMON is built from the faces of objects located IN any of the tools
//! and vice versa.
//! - FUSE is built from the faces OUT of all given shapes;
//! - CUT is built from the faces of the objects OUT of the tools and
//! faces of the tools located IN solids of the objects.
//!
//! @param theObjects - The group of Objects for BOP;
//! @param theTools - The group of Tools for BOP;
//! @param theOperation - The BOP type;
//! @param theReport - The alternative report to avoid pollution of the global one.
void BuildBOP(const TopTools_ListOfShape& theObjects,
const TopTools_ListOfShape& theTools,
const BOPAlgo_Operation theOperation,
Handle(Message_Report) theReport = NULL)
{
TopAbs_State anObjState, aToolsState;
switch (theOperation)
{
case BOPAlgo_COMMON:
{
anObjState = TopAbs_IN;
aToolsState = TopAbs_IN;
break;
}
case BOPAlgo_FUSE:
{
anObjState = TopAbs_OUT;
aToolsState = TopAbs_OUT;
break;
}
case BOPAlgo_CUT:
{
anObjState = TopAbs_OUT;
aToolsState = TopAbs_IN;
break;
}
case BOPAlgo_CUT21:
{
anObjState = TopAbs_IN;
aToolsState = TopAbs_OUT;
break;
}
default:
{
anObjState = TopAbs_UNKNOWN;
aToolsState = TopAbs_UNKNOWN;
break;
}
}
BuildBOP(theObjects, anObjState, theTools, aToolsState, theReport);
}
protected: //! @name History methods
//! Prepare information for history support.
@@ -425,11 +315,15 @@ protected: //! @name Fill Images of SOLIDS
TopTools_ListOfShape& theLIF);
//! Finds faces located inside each solid.
Standard_EXPORT virtual void FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids);
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_DataMapOfShapeShape& theDraftSolids);
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.
@@ -464,7 +358,6 @@ protected: //! @name Fields
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
TopTools_DataMapOfShapeListOfShape myInParts; //!< InParts - map of own and acquired IN faces of the arguments solids
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

View File

@@ -23,7 +23,6 @@
#include <TopAbs_State.hxx>
//
#include <TopoDS.hxx>
#include <TopoDS_AlertWithShape.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Shape.hxx>
@@ -91,21 +90,29 @@ void BOPAlgo_Builder::FillImagesSolids()
if (!bHasSolids) {
return;
}
// Draft solids
TopTools_DataMapOfShapeShape aDraftSolids;
// Find all IN faces for all IN faces
FillIn3DParts(aDraftSolids);
// Build split of the solids
BuildSplitSolids(aDraftSolids);
// Fill solids with internal parts
//
Handle(NCollection_BaseAllocator) aAlr;
//
aAlr=NCollection_BaseAllocator::CommonBaseAllocator();
//
TopTools_DataMapOfShapeListOfShape theInParts(100, aAlr);
TopTools_DataMapOfShapeShape theDraftSolids(100, aAlr);
//
FillIn3DParts(theInParts, theDraftSolids, aAlr);
BuildSplitSolids(theInParts, theDraftSolids, aAlr);
FillInternalShapes();
//
theInParts.Clear();
theDraftSolids.Clear();
}
//=======================================================================
//function : FillIn3DParts
//purpose :
//=======================================================================
void BOPAlgo_Builder::FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids)
void BOPAlgo_Builder::FillIn3DParts
(TopTools_DataMapOfShapeListOfShape& theInParts,
TopTools_DataMapOfShapeShape& theDraftSolids,
const Handle(NCollection_BaseAllocator)& )
{
Handle(NCollection_BaseAllocator) anAlloc = new NCollection_IncAllocator;
@@ -217,7 +224,7 @@ void BOPAlgo_Builder::FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids
if (aNbInt || aNbIN)
{
// Combine the lists
TopTools_ListOfShape *pLIN = myInParts.Bound(aSolid, TopTools_ListOfShape());
TopTools_ListOfShape *pLIN = theInParts.Bound(aSolid, TopTools_ListOfShape());
TopTools_ListIteratorOfListOfShape aItLS(aLInFaces);
for (; aItLS.More(); aItLS.Next())
@@ -353,7 +360,10 @@ typedef BOPTools_Cnt<BOPAlgo_BuilderSolidFunctor,
//function : BuildSplitSolids
//purpose :
//=======================================================================
void BOPAlgo_Builder::BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSolids)
void BOPAlgo_Builder::BuildSplitSolids
(TopTools_DataMapOfShapeListOfShape& theInParts,
TopTools_DataMapOfShapeShape& theDraftSolids,
const Handle(NCollection_BaseAllocator)& )
{
Standard_Boolean bFlagSD;
Standard_Integer i, aNbS;
@@ -407,7 +417,7 @@ void BOPAlgo_Builder::BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSol
continue;
const TopoDS_Shape& aSD = theDraftSolids.Find(aS);
const TopTools_ListOfShape* pLFIN = myInParts.Seek(aS);
const TopTools_ListOfShape* pLFIN = theInParts.Seek(aS);
if (!pLFIN || pLFIN->IsEmpty())
{
aSolidsIm(aSolidsIm.Add(aS, TopTools_ListOfShape())).Append(aSD);
@@ -454,35 +464,7 @@ void BOPAlgo_Builder::BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSol
{
BOPAlgo_SplitSolid& aBS = aVBS(k);
aSolidsIm.Add(aBS.Solid(), aBS.Areas());
// Merge BuilderSolid's report into main report,
// assigning the solid with the warnings/errors which
// have been generated for it.
// Convert all errors of BuilderSolid into warnings for main report.
const Handle(Message_Report)& aBSReport = aBS.GetReport();
Message_Gravity anAlertTypes[2] = { Message_Warning, Message_Fail };
for (Standard_Integer iGravity = 0; iGravity < 2; iGravity++)
{
const Message_ListOfAlert& anLAlerts = aBSReport->GetAlerts(anAlertTypes[iGravity]);
for (Message_ListOfAlert::Iterator itA(anLAlerts); itA.More(); itA.Next())
{
Handle(Message_Alert) anAlert = itA.Value();
Handle(TopoDS_AlertWithShape) anAlertWithShape = Handle(TopoDS_AlertWithShape)::DownCast(itA.Value());
if (!anAlertWithShape.IsNull())
{
TopoDS_Shape aWarnShape;
BRep_Builder().MakeCompound(TopoDS::Compound(aWarnShape));
BRep_Builder().Add(aWarnShape, aBS.Solid());
BRep_Builder().Add(aWarnShape, anAlertWithShape->GetShape());
anAlertWithShape->SetShape(aWarnShape);
AddWarning(anAlertWithShape);
}
else
AddWarning(anAlert);
}
}
myReport->Merge(aBS.GetReport());
}
//
// Add new solids to images map

View File

@@ -332,40 +332,97 @@ void BOPAlgo_MakerVolume::FillInternalShapes(const TopTools_ListOfShape& theLSR)
if (myAvoidInternalShapes) {
return;
}
//
UserBreak();
// Get all non-compound shapes
TopTools_ListOfShape aLSC;
// Fence map
//
Standard_Integer aNbSI;
TopAbs_ShapeEnum aType;
TopAbs_State aState;
TopoDS_Iterator aItS;
BRep_Builder aBB;
TopTools_MapOfShape aMFence;
TopTools_ListOfShape::Iterator itLA(myDS->Arguments());
for (; itLA.More(); itLA.Next())
BOPAlgo_Tools::TreatCompound(itLA.Value(), aMFence, aLSC);
// Get only edges and vertices from arguments
TopTools_ListOfShape aLVE;
itLA.Initialize(aLSC);
for (; itLA.More(); itLA.Next())
{
const TopoDS_Shape& aS = itLA.Value();
TopAbs_ShapeEnum aType = aS.ShapeType();
if (aType == TopAbs_WIRE)
{
for (TopoDS_Iterator it(aS); it.More(); it.Next())
{
const TopoDS_Shape& aSS = it.Value();
if (aMFence.Add(aSS))
aLVE.Append(aSS);
TopTools_IndexedMapOfShape aMSS;
TopTools_ListOfShape aLVE, aLSC, aLSIn;
TopTools_ListIteratorOfListOfShape aIt, aIt1;
//
// 1. Collect shapes to process: vertices, edges, wires
const TopTools_ListOfShape& anArguments = myDS->Arguments();
aIt.Initialize(anArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
BOPAlgo_Tools::TreatCompound(aS, aMFence, aLSC);
}
//
aIt.Initialize(aLSC);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
aType = aS.ShapeType();
if (aType == TopAbs_WIRE) {
aItS.Initialize(aS);
for(; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aE = aItS.Value();
if (aMFence.Add(aE)) {
aLVE.Append(aE);
}
}
}
else if (aType == TopAbs_VERTEX || aType == TopAbs_EDGE)
else if (aType == TopAbs_VERTEX || aType == TopAbs_EDGE) {
aLVE.Append(aS);
}
}
//
aIt.Initialize(theLSR);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
TopExp::MapShapes(aS, TopAbs_EDGE, aMSS);
TopExp::MapShapes(aS, TopAbs_VERTEX, aMSS);
}
//
aIt.Initialize(aLVE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
if (myImages.IsBound(aS)) {
const TopTools_ListOfShape &aLSp = myImages.Find(aS);
aIt1.Initialize(aLSp);
for (; aIt1.More(); aIt1.Next()) {
const TopoDS_Shape& aSp = aIt1.Value();
if (aMSS.Add(aSp)) {
aLSIn.Append(aSp);
}
}
}
else {
if (aMSS.Add(aS)) {
aLSIn.Append(aS);
}
}
}
//
aNbSI = aLSIn.Extent();
if (!aNbSI) {
return;
}
//
// 2. Settle internal vertices and edges into solids
aIt.Initialize(theLSR);
for (; aIt.More(); aIt.Next()) {
TopoDS_Solid aSd = *(TopoDS_Solid*)&aIt.Value();
//
aIt1.Initialize(aLSIn);
for (; aIt1.More(); ) {
TopoDS_Shape aSI = aIt1.Value();
aSI.Orientation(TopAbs_INTERNAL);
//
aState = BOPTools_AlgoTools::ComputeStateByOnePoint(aSI, aSd, 1.e-11, myContext);
if (aState == TopAbs_IN) {
aBB.Add(aSd, aSI);
aLSIn.Remove(aIt1);
}
else {
aIt1.Next();
}
}
}
BOPAlgo_Tools::FillInternals(theLSR, aLVE, myImages, myContext);
}
//=======================================================================

View File

@@ -328,8 +328,6 @@ void BOPAlgo_PaveFiller::PerformInternal()
myDS->ReleasePaveBlocks();
myDS->RefineFaceInfoOn();
//
RemoveMicroEdges();
//
MakePCurves();
if (HasErrors()) {
return;

View File

@@ -548,8 +548,6 @@ protected:
Standard_EXPORT void RemoveMicroSectionEdges(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
BOPDS_IndexedMapOfPaveBlock& theMicroPB);
//! Check all edges on the micro status and remove the positive ones
Standard_EXPORT void RemoveMicroEdges();
TopTools_ListOfShape myArguments;
BOPDS_PDS myDS;

View File

@@ -368,9 +368,6 @@ void BOPAlgo_PaveFiller::SplitPaveBlocks(const TColStd_MapOfInteger& theMEdges,
BOPDS_ListOfPaveBlock,
TColStd_MapTransientHasher> aMCBNewPB;
//
// Map of vertices to init the pave blocks for them
TColStd_MapOfInteger aMVerticesToInitPB;
TColStd_MapIteratorOfMapOfInteger aItM(theMEdges);
for (; aItM.More(); aItM.Next()) {
Standard_Integer nE = aItM.Value();
@@ -432,10 +429,6 @@ void BOPAlgo_PaveFiller::SplitPaveBlocks(const TColStd_MapOfInteger& theMEdges,
aLV.Append(nV1);
aLV.Append(nV2);
MakeSDVertices(aLV, theAddInterfs);
// Save vertices to init pave blocks
aMVerticesToInitPB.Add(nV1);
aMVerticesToInitPB.Add(nV2);
}
continue;
}
@@ -538,11 +531,6 @@ void BOPAlgo_PaveFiller::SplitPaveBlocks(const TColStd_MapOfInteger& theMEdges,
}
}
}
// Init pave blocks for vertices which have acquired SD vertex
aItM.Initialize(aMVerticesToInitPB);
for (; aItM.More(); aItM.Next())
myDS->InitPaveBlocksForVertex(aItM.Value());
}
//=======================================================================
@@ -559,4 +547,4 @@ void BOPAlgo_PaveFiller::AddIntersectionFailedWarning(const TopoDS_Shape& theS1,
BRep_Builder().Add(aWC, theS2);
// Add the warning
AddWarning(new BOPAlgo_AlertIntersectionOfPairOfShapesFailed(aWC));
}
}

View File

@@ -629,13 +629,9 @@ void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB)
const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
// Get the edge
Standard_Integer nE = -1;
if (!thePB->HasEdge(nE))
{
nE = thePB->OriginalEdge();
if (nE < 0)
return;
}
Standard_Integer nE = thePB->OriginalEdge();
if (nE < 0 && !thePB->HasEdge(nE))
return;
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
// Range

View File

@@ -900,7 +900,7 @@ void BOPAlgo_PaveFiller::PostTreatFF
//
// 1 prepare arguments
TopTools_MapOfShape anAddedSD;
for (k = aNbS; k > 0; --k) {
for (k=1; k<=aNbS; ++k) {
const TopoDS_Shape& aS=theMSCPB.FindKey(k);
aLS.Append(aS);
// add vertices-candidates for SD from the map aDMNewSD,
@@ -1025,11 +1025,8 @@ void BOPAlgo_PaveFiller::PostTreatFF
if (!bIntersectionPoint) {
// save SD connection
nSx = myDS->Index(aSx);
if (nSx != iV)
{
aDMNewSD.Bind(nSx, iV);
myDS->AddShapeSD(nSx, iV);
}
aDMNewSD.Bind(nSx, iV);
myDS->AddShapeSD(nSx, iV);
}
else {
// update FF interference
@@ -1078,7 +1075,8 @@ void BOPAlgo_PaveFiller::PostTreatFF
// note we check not the edge aSx itself, but its image in aPDS
const BOPDS_ListOfPaveBlock& aLPBx = aPDS->PaveBlocks(nSx);
aNbLPBx = aLPBx.Extent();
if (aNbLPBx == 0 || (aNbLPBx == 1 && !aLPBx.First()->HasShrunkData())) {
if (aPDS->HasPaveBlocks(nSx) &&
(aNbLPBx == 0 || (aNbLPBx == 1 && !aLPBx.First()->HasShrunkData()))) {
BOPDS_ListIteratorOfListOfPaveBlock it(aLPBC);
for (; it.More(); it.Next()) {
if (it.Value() == aPB1) {
@@ -1086,12 +1084,6 @@ void BOPAlgo_PaveFiller::PostTreatFF
break;
}
}
// The edge became micro edge, check vertices for SD
TopoDS_Iterator itV(aSx);
for (; itV.More(); itV.Next())
aLS.Append(itV.Value());
continue;
}
//
@@ -2310,21 +2302,21 @@ void BOPAlgo_PaveFiller::GetFullShapeMap(const Standard_Integer nF,
void BOPAlgo_PaveFiller::RemoveUsedVertices(const BOPDS_Curve& aNC,
TColStd_MapOfInteger& aMV)
{
if (aMV.IsEmpty())
if (!aMV.Extent()) {
return;
}
const BOPDS_ListOfPaveBlock& aLPBC = aNC.PaveBlocks();
BOPDS_ListIteratorOfListOfPaveBlock itPB(aLPBC);
for (; itPB.More(); itPB.Next())
{
const Handle(BOPDS_PaveBlock)& aPB = itPB.Value();
const BOPDS_ListOfPave& aLP = aPB->ExtPaves();
BOPDS_ListIteratorOfListOfPave itLP(aLP);
for (; itLP.More(); itLP.Next())
aMV.Remove(itLP.Value().Index());
aMV.Remove(aPB->Pave1().Index());
aMV.Remove(aPB->Pave2().Index());
const BOPDS_ListOfPave& aLP = itPB.Value()->ExtPaves();
BOPDS_ListIteratorOfListOfPave aItLP(aLP);
for (;aItLP.More();aItLP.Next()) {
BOPDS_Pave aPave = aItLP.Value();
Standard_Integer nV = aPave.Index();
aMV.Remove(nV);
}
}
}
@@ -2927,46 +2919,79 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
bRebuild = Standard_False;
aPB->Indices(nV[0], nV[1]);
aPB->Range(aT[0], aT[1]);
Standard_Integer nE = aPB->OriginalEdge();
if (nE < 0)
// new edge
nE = aPB->Edge();
// remember the fact if the edge had different vertices before substitution
Standard_Boolean wasRegularEdge = (nV[0] != nV[1]);
const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(nE));
TopoDS_Vertex aVE1, aVE2;
TopExp::Vertices(aE, aVE1, aVE2);
Standard_Boolean isClosedE = !aVE1.IsNull() && !aVE2.IsNull() && aVE1.IsSame(aVE2);
Standard_Boolean isDegEdge = myDS->ShapeInfo(nE).HasFlag();
//
BOPDS_Pave aPave[2] = {aPB->Pave1(), aPB->Pave2()};
for (j = 0; j < 2; ++j) {
if (aDMNewSD.IsBound(nV[j])) {
BOPDS_Pave aPave;
//
nV[j] = aDMNewSD.Find(nV[j]);
aPave.SetIndex(nV[j]);
aPave.SetParameter(aT[j]);
// recompute the parameter
if (!isDegEdge)
{
const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV[j]));
if (!isClosedE ||
BRep_Tool::Pnt(aV).Distance(BRep_Tool::Pnt(aVE1)) > BRep_Tool::Tolerance(aV) + myFuzzyValue)
{
Standard_Real aDummy, aTnew;
Standard_Integer iErr = myContext->ComputeVE(aV, aE, aTnew, aDummy, myFuzzyValue);
if (!iErr)
aT[j] = aTnew;
}
else
{
// choose the correct boundary parameter
Standard_Real f, l;
BRep_Tool::Range(aE, f, l);
aT[j] = Abs(aT[j] - f) < Abs(aT[j] - l) ? f : l;
}
}
aPave[j].SetIndex(nV[j]);
//
bRebuild = Standard_True;
if (!j) {
aPB->SetPave1(aPave);
}
else {
aPB->SetPave2(aPave);
}
}
}
//
if (bRebuild) {
Standard_Integer nE = aPB->Edge();
// Check if the Pave Block has the edge set
if (nE < 0) {
// untouched edge
nE = aPB->OriginalEdge();
if (aT[0] < aT[1])
{
// It seems the parameters have been recomputed successfully
aPave[0].SetParameter(aT[0]);
aPave[1].SetParameter(aT[1]);
}
Standard_Boolean isDegEdge = myDS->ShapeInfo(nE).HasFlag();
aPB->SetPave1(aPave[0]);
aPB->SetPave2(aPave[1]);
if (wasRegularEdge && !isDegEdge && nV[0] == nV[1]) {
// now edge has the same vertex on both ends;
// check if it is not a regular closed curve.
FillShrunkData(aPB);
if (!aPB->HasShrunkData())
{
Standard_Integer nEMicro = aPB->Edge();
if (nEMicro < 0)
nEMicro = aPB->OriginalEdge();
// micro edge, so mark it for removal
aMicroEdges.Add(nE);
aMicroEdges.Add(nEMicro);
continue;
}
}
aPB->Range(aT[0], aT[1]);
nSp = SplitEdge(nE, nV[0], aT[0], nV[1], aT[1]);
if (bCB)
aCB->SetEdge(nSp);
@@ -3004,12 +3029,41 @@ void BOPAlgo_PaveFiller::RemovePaveBlocks(const TColStd_MapOfInteger theEdges)
}
}
// 2. from section curves
// 2. from Face Info and section curves
TColStd_MapOfInteger aMPassed;
BOPDS_VectorOfInterfFF& aFFs = myDS->InterfFF();
Standard_Integer aNbFF = aFFs.Length(), j;
for (i = 0; i < aNbFF; ++i) {
BOPDS_InterfFF& aFF = aFFs(i);
Standard_Integer nF1, nF2;
aFF.Indices(nF1, nF2);
//
// rebuild pave block maps of face info
for (j = 0; j < 2; j++) {
Standard_Integer nF = (j == 0 ? nF1 : nF2);
if (!aMPassed.Add(nF))
continue;
BOPDS_FaceInfo& aFI = myDS->ChangeFaceInfo(nF);
BOPDS_IndexedMapOfPaveBlock* aIMPB[] = { &aFI.ChangePaveBlocksIn(),
&aFI.ChangePaveBlocksOn(), &aFI.ChangePaveBlocksSc() };
for (Standard_Integer k = 0; k < 3; k++) {
Standard_Integer aNbPB = aIMPB[k]->Extent(), m;
for (m = 1; m <= aNbPB; ++m) {
const Handle(BOPDS_PaveBlock)& aPB = aIMPB[k]->FindKey(m);
if (theEdges.Contains(aPB->Edge()))
break;
}
if (m <= aNbPB) {
BOPDS_IndexedMapOfPaveBlock aMPBCopy = *aIMPB[k];
aIMPB[k]->Clear();
for (m = 1; m <= aNbPB; ++m) {
const Handle(BOPDS_PaveBlock)& aPB = aMPBCopy(m);
if (!theEdges.Contains(aPB->Edge()))
aIMPB[k]->Add(aPB);
}
}
}
}
// remove from Section pave blocks
BOPDS_VectorOfCurve& aVNC = aFF.ChangeCurves();
Standard_Integer aNbC = aVNC.Length();
@@ -3026,44 +3080,7 @@ void BOPAlgo_PaveFiller::RemovePaveBlocks(const TColStd_MapOfInteger theEdges)
}
}
}
// 3. From Face Info
for (i = 0; i < myDS->NbSourceShapes(); ++i)
{
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
if (aSI.ShapeType() != TopAbs_FACE)
continue;
if (!aSI.HasReference())
continue;
BOPDS_FaceInfo& aFI = myDS->ChangeFaceInfo(i);
BOPDS_IndexedMapOfPaveBlock* aIMPB[] = { &aFI.ChangePaveBlocksIn(),
&aFI.ChangePaveBlocksOn(),
&aFI.ChangePaveBlocksSc() };
for (Standard_Integer k = 0; k < 3; k++)
{
Standard_Integer aNbPB = aIMPB[k]->Extent(), m;
for (m = 1; m <= aNbPB; ++m)
{
const Handle(BOPDS_PaveBlock)& aPB = aIMPB[k]->FindKey(m);
if (theEdges.Contains(aPB->Edge()))
break;
}
if (m <= aNbPB)
{
BOPDS_IndexedMapOfPaveBlock aMPBCopy = *aIMPB[k];
aIMPB[k]->Clear();
for (m = 1; m <= aNbPB; ++m)
{
const Handle(BOPDS_PaveBlock)& aPB = aMPBCopy(m);
if (!theEdges.Contains(aPB->Edge()))
aIMPB[k]->Add(aPB);
}
}
}
}
}
//=======================================================================
//function : ToleranceFF
//purpose : Computes the TolFF according to the tolerance value and
@@ -3490,49 +3507,3 @@ void BOPAlgo_PaveFiller::RemoveMicroSectionEdges
if (aSEPBMap.Extent() != theMSCPB.Extent())
theMSCPB = aSEPBMap;
}
//=======================================================================
//function : RemoveMicroEdges
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::RemoveMicroEdges()
{
// Fence map
BOPDS_MapOfPaveBlock aMPBFence;
// Resulting map of micro edges
TColStd_MapOfInteger aMicroEdges;
// Check all pave blocks from the pool to find the micro edges
BOPDS_VectorOfListOfPaveBlock& aPBP = myDS->ChangePaveBlocksPool();
Standard_Integer aNbPBP = aPBP.Length();
for (Standard_Integer i = 0; i < aNbPBP; ++i)
{
BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
if (aLPB.Extent() < 2)
// No splits
continue;
if (myDS->ShapeInfo(aLPB.First()->OriginalEdge()).HasFlag())
continue;
BOPDS_ListOfPaveBlock::Iterator it(aLPB);
for (; it.More(); it.Next())
{
const Handle(BOPDS_PaveBlock)& aPB = it.Value();
Handle(BOPDS_PaveBlock) aPBR = myDS->RealPaveBlock(aPB);
if (aMPBFence.Add(aPBR))
{
Standard_Integer nV1, nV2;
aPBR->Indices(nV1, nV2);
if (nV1 == nV2)
{
// Check if it has the valid range
FillShrunkData(aPBR);
if (!aPBR->HasShrunkData())
aMicroEdges.Add(aPBR->Edge());
}
}
}
}
RemovePaveBlocks(aMicroEdges);
}

View File

@@ -1643,148 +1643,3 @@ void BOPAlgo_Tools::ClassifyFaces(const TopTools_ListOfShape& theFaces,
theInParts.Add(aS, aLFIn);
}
}
//=======================================================================
//function : FillInternals
//purpose :
//=======================================================================
void BOPAlgo_Tools::FillInternals(const TopTools_ListOfShape& theSolids,
const TopTools_ListOfShape& theParts,
const TopTools_DataMapOfShapeListOfShape& theImages,
const Handle(IntTools_Context)& theContext)
{
if (theSolids.IsEmpty() || theParts.IsEmpty())
return;
// Map the solids to avoid classification of the own shapes of the solids
TopTools_IndexedMapOfShape aMSSolids;
TopTools_ListOfShape::Iterator itLS(theSolids);
for (; itLS.More(); itLS.Next())
{
const TopoDS_Shape& aSolid = itLS.Value();
if (aSolid.ShapeType() == TopAbs_SOLID)
{
TopExp::MapShapes(aSolid, TopAbs_VERTEX, aMSSolids);
TopExp::MapShapes(aSolid, TopAbs_EDGE, aMSSolids);
TopExp::MapShapes(aSolid, TopAbs_FACE, aMSSolids);
}
}
// Extract BRep elements from the given parts and
// check them for possible splits
TopTools_ListOfShape aLPartsInput = theParts, aLParts;
TopTools_ListOfShape::Iterator itLP(aLPartsInput);
for (; itLP.More(); itLP.Next())
{
const TopoDS_Shape& aPart = itLP.Value();
switch (aPart.ShapeType())
{
case TopAbs_VERTEX:
case TopAbs_EDGE:
case TopAbs_FACE:
{
const TopTools_ListOfShape* pIm = theImages.Seek(aPart);
if (pIm)
{
TopTools_ListOfShape::Iterator itIm(*pIm);
for (; itIm.More(); itIm.Next())
{
const TopoDS_Shape& aPartIm = itIm.Value();
if (!aMSSolids.Contains(aPartIm))
aLParts.Append(aPartIm);
}
}
else if (!aMSSolids.Contains(aPart))
aLParts.Append(aPart);
break;
}
default:
{
for (TopoDS_Iterator it(aPart); it.More(); it.Next())
aLPartsInput.Append(it.Value());
break;
}
}
}
// Classify the given parts relatively solids.
// Add edges and vertices classified as IN into solids instantly,
// and collect faces classified as IN into a list for further shell creation
TopTools_DataMapOfShapeListOfShape anINFaces;
itLS.Initialize(theSolids);
for (; itLS.More(); itLS.Next())
{
const TopoDS_Shape& aSolid = itLS.Value();
if (aSolid.ShapeType() != TopAbs_SOLID)
continue;
TopoDS_Solid aSd = *(TopoDS_Solid*)&aSolid;
itLP.Initialize(aLParts);
for (; itLP.More();)
{
TopoDS_Shape aPart = itLP.Value();
TopAbs_State aState =
BOPTools_AlgoTools::ComputeStateByOnePoint(aPart, aSd, Precision::Confusion(), theContext);
if (aState == TopAbs_IN)
{
if (aPart.ShapeType() == TopAbs_FACE)
{
TopTools_ListOfShape *pFaces = anINFaces.ChangeSeek(aSd);
if (!pFaces)
pFaces = anINFaces.Bound(aSd, TopTools_ListOfShape());
pFaces->Append(aPart);
}
else
{
aPart.Orientation(TopAbs_INTERNAL);
BRep_Builder().Add(aSd, aPart);
}
aLParts.Remove(itLP);
}
else
itLP.Next();
}
}
// Make shells from faces and put them into solids
TopTools_DataMapOfShapeListOfShape::Iterator itM(anINFaces);
for (; itM.More(); itM.Next())
{
TopoDS_Solid aSd = *(TopoDS_Solid*)&itM.Key();
const TopTools_ListOfShape& aFaces = itM.Value();
TopoDS_Compound aCF;
BRep_Builder().MakeCompound(aCF);
TopTools_ListOfShape::Iterator itLF(aFaces);
for (; itLF.More(); itLF.Next())
BRep_Builder().Add(aCF, itLF.Value());
// Build blocks from the faces
TopTools_ListOfShape aLCB;
BOPTools_AlgoTools::MakeConnexityBlocks(aCF, TopAbs_EDGE, TopAbs_FACE, aLCB);
// Build shell from each block
TopTools_ListOfShape::Iterator itCB(aLCB);
for (; itCB.More(); itCB.Next())
{
const TopoDS_Shape& aCB = itCB.Value();
TopoDS_Shell aShell;
BRep_Builder().MakeShell(aShell);
// Add faces of the block to the shell
TopExp_Explorer expF(aCB, TopAbs_FACE);
for (; expF.More(); expF.Next())
{
TopoDS_Face aFInt = TopoDS::Face(expF.Current());
aFInt.Orientation(TopAbs_INTERNAL);
BRep_Builder().Add(aShell, aFInt);
}
BRep_Builder().Add(aSd, aShell);
}
}
}

View File

@@ -194,18 +194,6 @@ public:
const TopTools_DataMapOfShapeBox& theShapeBoxMap = TopTools_DataMapOfShapeBox(),
const TopTools_DataMapOfShapeListOfShape& theSolidsIF = TopTools_DataMapOfShapeListOfShape());
//! Classifies the given parts relatively the given solids and
//! fills the solids with the parts classified as INTERNAL.
//!
//! @param theSolids - The solids to put internals to
//! @param theParts - The parts to classify relatively solids
//! @param theImages - Possible images of the parts that has to be classified
//! @param theContext - Cashed geometrical tools to speed-up classifications
Standard_EXPORT static void FillInternals(const TopTools_ListOfShape& theSolids,
const TopTools_ListOfShape& theParts,
const TopTools_DataMapOfShapeListOfShape& theImages,
const Handle(IntTools_Context)& theContext);
};
#endif // _BOPAlgo_Tools_HeaderFile

View File

@@ -90,7 +90,6 @@ void BOPTest::ReportAlerts(const Handle(Message_Report)& theReport)
{
// first report warnings, then errors
Message_Gravity anAlertTypes[2] = { Message_Warning, Message_Fail };
TCollection_ExtendedString aMsgType[2] = { "Warning: ", "Error: " };
for (int iGravity = 0; iGravity < 2; iGravity++)
{
// report shapes for the same type of alert together
@@ -105,7 +104,7 @@ void BOPTest::ReportAlerts(const Handle(Message_Report)& theReport)
// get alert message
Message_Msg aMsg (aIt.Value()->GetMessageKey());
TCollection_ExtendedString aText = aMsgType[iGravity] + aMsg.Get();
TCollection_ExtendedString aText = aMsg.Get();
// collect all shapes if any attached to this alert
if (BOPTest_Objects::DrawWarnShapes())

View File

@@ -19,7 +19,6 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Section.hxx>
#include <BOPAlgo_Splitter.hxx>
#include <BOPDS_DS.hxx>
#include <BOPTest.hxx>
#include <BOPTest_DrawableShape.hxx>
#include <BOPTest_Objects.hxx>
@@ -30,7 +29,6 @@
#include <DrawTrSurf.hxx>
#include <OSD_Timer.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS.hxx>
#include <stdio.h>
#include <string.h>
@@ -40,7 +38,6 @@ static Standard_Integer bfillds (Draw_Interpretor&, Standard_Integer, const cha
static Standard_Integer bbuild (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bbop (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bsplit (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer buildbop (Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//function : PartitionCommands
@@ -58,20 +55,6 @@ void BOPTest::PartitionCommands(Draw_Interpretor& theCommands)
theCommands.Add("bbuild" , "use bbuild r [-t]" , __FILE__, bbuild, g);
theCommands.Add("bbop" , "use bbop r op [-t]", __FILE__, bbop, g);
theCommands.Add("bsplit" , "use bsplit r [-t]" , __FILE__, bsplit, g);
theCommands.Add("buildbop", "Builds the result of BOP basing on the GF.\n"
" The command uses classification approach for building the result of BOP\n"
" (thus it operates on solids only and can be used on open solids):\n"
" - FUSE is built from the faces OUT of all arguments\n"
" - COMMON is built from the faces IN any of the object/tools\n"
" - CUT is built from the objects faces OUT of the tools and tools faces IN the objects.\n"
" Please note that history for solids will not be available.\n\n"
" Usage: buildbop result -o s1 [s2 ...] -t s3 [s4 ...] -op operation (common/fuse/cut/tuc)\n"
" Where:\n"
" result - result shape of the operation\n"
" s1 s2 s3 s4 - arguments (solids) of the GF operation\n"
" operation - type of boolean operation",
__FILE__, buildbop, g);
}
//=======================================================================
//function : bfillds
@@ -436,157 +419,3 @@ Standard_Integer bsplit(Draw_Interpretor& di,
DBRep::Set(a[1], aR);
return 0;
}
//=======================================================================
//function : buildbop
//purpose :
//=======================================================================
Standard_Integer buildbop(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n < 3)
{
di.PrintHelp(a[0]);
return 1;
}
BOPDS_PDS pDS = BOPTest_Objects::PDS();
if (!pDS)
{
di << "Error: perform intersection of arguments first";
return 1;
}
BOPAlgo_Builder *pBuilder = &BOPTest_Objects::Builder();
if (pBuilder->HasErrors())
{
di << "Error: there were problems during GF";
return 0;
}
if (pBuilder->Arguments().IsEmpty() ||
pBuilder->Shape().IsNull())
{
di << "Error: it seems the GF has not been yet performed";
return 1;
}
// Get arguments and operation
TopTools_ListOfShape aLObjects, aLTools;
BOPAlgo_Operation anOp = BOPAlgo_UNKNOWN;
for (Standard_Integer i = 2; i < n; ++i)
{
if (!strcmp(a[i], "-o") || !strcmp(a[i], "-t"))
{
if (i == (n - 1))
{
di << "Error: shapes are expected after the key " << a[i];
return 1;
}
TopTools_ListOfShape& aList = !strcmp(a[i], "-o") ? aLObjects : aLTools;
Standard_Integer j = i + 1;
for (; j < n; ++j)
{
if (a[j][0] == '-')
{
// reached the following key
i = j - 1;
break;
}
else
{
// Get the shape
TopoDS_Shape aS = DBRep::Get(a[j]);
if (aS.IsNull())
{
di << "Error: " << a[j] << " is a null shape";
return 1;
}
if (aS.ShapeType() != TopAbs_SOLID)
{
di << "Error: " << a[j] << " is not a solid";
return 1;
}
if (pDS->Index(aS) < 0)
{
di << "Error: " << a[j] << " is not an argument of GF";
return 1;
}
aList.Append(aS);
}
}
// End of arguments is reached
if (j == n) break;
}
else if (!strcmp(a[i], "-op"))
{
if (i == (n - 1))
{
di << "Error: operation type is expected after the key " << a[i];
return 1;
}
++i;
if (!strcasecmp(a[i], "common"))
anOp = BOPAlgo_COMMON;
else if (!strcasecmp(a[i], "fuse"))
anOp = BOPAlgo_FUSE;
else if (!strcasecmp(a[i], "cut"))
anOp = BOPAlgo_CUT;
else if (!strcasecmp(a[i], "tuc"))
anOp = BOPAlgo_CUT21;
else
{
di << "Error: unknown operation type";
return 1;
}
}
else
{
di << "Error: " << a[i] << " invalid key";
return 1;
}
}
if (anOp == BOPAlgo_UNKNOWN)
{
di << "Error: operation has not been specified";
return 1;
}
Standard_Boolean hasObjects = !aLObjects.IsEmpty();
Standard_Boolean hasTools = !aLTools.IsEmpty();
if (!hasObjects && !hasTools)
{
di << "Error: no shapes are given";
return 1;
}
// Create new report for the operation
Handle(Message_Report) aReport = new Message_Report;
// Build specific operation
pBuilder->BuildBOP(aLObjects, aLTools, anOp, aReport);
// Report alerts of the operation
BOPTest::ReportAlerts(aReport);
if (!aReport->GetAlerts(Message_Fail).IsEmpty())
{
return 0;
}
// Set history of Split operation into the session
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(pDS->Arguments(), *pBuilder);
// Result shape
const TopoDS_Shape& aR = pBuilder->Shape();
// Draw result shape
DBRep::Set(a[1], aR);
return 0;
}

View File

@@ -593,31 +593,18 @@ TopAbs_State BOPTools_AlgoTools::ComputeStateByOnePoint
const Standard_Real theTol,
const Handle(IntTools_Context)& theContext)
{
TopAbs_State aState = TopAbs_UNKNOWN;
TopAbs_ShapeEnum aType = theS.ShapeType();
switch (aType)
{
case TopAbs_VERTEX:
aState = ComputeState(TopoDS::Vertex(theS), theRef, theTol, theContext);
break;
case TopAbs_EDGE:
aState = ComputeState(TopoDS::Edge(theS), theRef, theTol, theContext);
break;
case TopAbs_FACE:
{
TopTools_IndexedMapOfShape aBounds;
TopExp::MapShapes(theRef, TopAbs_EDGE, aBounds);
aState = ComputeState(TopoDS::Face(theS), theRef, theTol, aBounds, theContext);
break;
}
default:
{
TopoDS_Iterator it(theS);
if (it.More())
ComputeStateByOnePoint(it.Value(), theRef, theTol, theContext);
break;
}
TopAbs_State aState;
TopAbs_ShapeEnum aType;
//
aState=TopAbs_UNKNOWN;
aType=theS.ShapeType();
if (aType==TopAbs_VERTEX) {
const TopoDS_Vertex& aV=(*(TopoDS_Vertex*)(&theS));
aState=BOPTools_AlgoTools::ComputeState(aV, theRef, theTol, theContext);
}
else if (aType==TopAbs_EDGE) {
const TopoDS_Edge& aE=(*(TopoDS_Edge*)(&theS));
aState=BOPTools_AlgoTools::ComputeState(aE, theRef, theTol, theContext);
}
return aState;
}
@@ -630,50 +617,46 @@ TopAbs_State BOPTools_AlgoTools::ComputeState
(const TopoDS_Face& theF,
const TopoDS_Solid& theRef,
const Standard_Real theTol,
const TopTools_IndexedMapOfShape& theBounds,
TopTools_IndexedMapOfShape& theBounds,
const Handle(IntTools_Context)& theContext)
{
TopAbs_State aState = TopAbs_UNKNOWN;
// Try to find the edge on the face which does not
// belong to the solid and classify the middle point of that
// edge relatively solid.
TopExp_Explorer aExp(theF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next())
{
const TopoDS_Edge& aSE = (*(TopoDS_Edge*)(&aExp.Current()));
if (BRep_Tool::Degenerated(aSE))
TopAbs_State aState;
TopExp_Explorer aExp;
TopoDS_Edge aE1;
gp_Pnt2d aP2D;
gp_Pnt aP3D;
//
aState=TopAbs_UNKNOWN;
//
aExp.Init(theF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aSE=(*(TopoDS_Edge*)(&aExp.Current()));
if (BRep_Tool::Degenerated(aSE)) {
continue;
if (!theBounds.Contains(aSE))
{
aState = BOPTools_AlgoTools::ComputeState(aSE, theRef, theTol, theContext);
}
//
if (!theBounds.Contains(aSE)) {
const TopoDS_Edge& aE=(*(TopoDS_Edge*)(&aSE));
aState=BOPTools_AlgoTools::ComputeState(aE, theRef, theTol,
theContext);
return aState;
}
}
// All edges of the face are on the solid.
// Get point inside the face and classify it relatively solid.
gp_Pnt aP3D;
gp_Pnt2d aP2D;
Standard_Integer iErr = BOPTools_AlgoTools3D::PointInFace(theF, aP3D, aP2D, theContext);
if (iErr != 0)
{
// Hatcher fails to find the point -> get point near some edge
aExp.Init(theF, TopAbs_EDGE);
for (; aExp.More() && iErr != 0; aExp.Next())
{
const TopoDS_Edge& aSE = TopoDS::Edge(aExp.Current());
if (BRep_Tool::Degenerated(aSE))
continue;
iErr = BOPTools_AlgoTools3D::PointNearEdge(aSE, theF, aP2D, aP3D, theContext);
if (aE1.IsNull()) {
aE1=(*(TopoDS_Edge*)(&aSE));
}
}
if (iErr == 0)
aState = BOPTools_AlgoTools::ComputeState(aP3D, theRef, theTol, theContext);
// !!<- process edges that are all on theRef
if (!aE1.IsNull()) {
const Standard_Integer anErrID = BOPTools_AlgoTools3D::PointNearEdge(aE1, theF,
aP2D, aP3D,
theContext);
if(anErrID == 0)
{
aState = BOPTools_AlgoTools::ComputeState(aP3D, theRef, theTol,
theContext);
}
}
//
return aState;
}
//=======================================================================

View File

@@ -202,13 +202,13 @@ public: //! @name Point/Edge/Face classification relatively solid
//! Computes the 3-D state of the face theFace
//! toward solid theSolid.
//! theTol - value of precision of computation
//! theBounds - set of edges of <theSolid> to avoid
//! theBounds - set of edges of theFace to avoid
//! theContext- cahed geometrical tools
//! Returns 3-D state.
Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Face& theFace,
const TopoDS_Solid& theSolid,
const Standard_Real theTol,
const TopTools_IndexedMapOfShape& theBounds,
TopTools_IndexedMapOfShape& theBounds,
const Handle(IntTools_Context)& theContext);
//! Computes the 3-D state of the shape theShape

View File

@@ -74,18 +74,6 @@ BRepAdaptor_Curve::BRepAdaptor_Curve(const TopoDS_Edge& E,
Initialize(E,F);
}
//=======================================================================
//function : Reset
//purpose :
//=======================================================================
void BRepAdaptor_Curve::Reset()
{
myCurve.Reset();
myConSurf.Nullify();
myEdge.Nullify();
myTrsf = gp_Trsf();
}
//=======================================================================
//function : Initialize
//purpose :

View File

@@ -86,10 +86,7 @@ public:
//! is raised if the edge does not have a pcurve on
//! the face.
Standard_EXPORT BRepAdaptor_Curve(const TopoDS_Edge& E, const TopoDS_Face& F);
//! Reset currently loaded curve (undone Load()).
Standard_EXPORT void Reset();
//! Sets the Curve <me> to acces to the geometry of
//! edge <E>.
Standard_EXPORT void Initialize (const TopoDS_Edge& E);

View File

@@ -38,6 +38,9 @@ class BRepAlgo_Tool;
class BRepAlgo_Image;
class BRepAlgo_AsDes;
class BRepAlgo_FaceRestrictor;
class BRepAlgo_BooleanOperations;
class BRepAlgo_DSAccess;
class BRepAlgo_EdgeConnector;
class BRepAlgo_NormalProjection;
@@ -111,6 +114,9 @@ friend class BRepAlgo_Tool;
friend class BRepAlgo_Image;
friend class BRepAlgo_AsDes;
friend class BRepAlgo_FaceRestrictor;
friend class BRepAlgo_BooleanOperations;
friend class BRepAlgo_DSAccess;
friend class BRepAlgo_EdgeConnector;
friend class BRepAlgo_NormalProjection;
};

View File

@@ -0,0 +1,395 @@
// Created on: 1997-11-20
// Created by: Prestataire Mary FABIEN
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Bnd_Box.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepAlgo_BooleanOperations.hxx>
#include <BRepAlgo_DSAccess.hxx>
#include <BRepBndLib.hxx>
#include <BRepTools_Substitution.hxx>
#include <Geom_Surface.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Shape.hxx>
#include <TopOpeBRep_DSFiller.hxx>
#include <TopOpeBRepBuild_HBuilder.hxx>
#include <TopOpeBRepDS_BuildTool.hxx>
#include <TopOpeBRepDS_HDataStructure.hxx>
#include <TopOpeBRepTool_GeomTool.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
//=======================================================================
//function : Create
//purpose :
//=======================================================================
BRepAlgo_BooleanOperations::BRepAlgo_BooleanOperations() :
myApproxNbPntMax (30) ,
myApproxTol3D (1.e-7) ,
myApproxTol2D (1.e-7)
{
}
//=======================================================================
//function : Shapes2d
//purpose :
//=======================================================================
void BRepAlgo_BooleanOperations::Shapes2d (const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
{
// S1 doit etre une face ou un ensemble de faces
// S2 doit etre une edge.
if (S2.ShapeType() != TopAbs_EDGE) return;
BRep_Builder Builder ;
TopoDS_Wire Wire ;
Builder.MakeWire (Wire);
Builder.Add (Wire, S2);
TopExp_Explorer Exp (S1, TopAbs_FACE) ;
if (!Exp.More()) return ;
const TopoDS_Face& FirstFace = TopoDS::Face (Exp.Current()) ;
TopLoc_Location Loc;
const Handle(Geom_Surface)& Surf = BRep_Tool::Surface (FirstFace, Loc) ;
TopoDS_Face Face ;
Builder.MakeFace (Face, Surf, Loc, BRep_Tool::Tolerance (FirstFace)) ;
Builder.Add (Face, Wire) ;
Face.Orientation (FirstFace.Orientation()) ;
myS1 = S1 ;
myS2 = Face ;
myDSA.Init() ;
myDSA.Load (myS1, myS2) ;
Handle (TopOpeBRepDS_HDataStructure)& HDS = myDSA.ChangeDS() ;
myDSA.myDSFiller.Insert2d (myS1, myS2, HDS) ;
}
//=======================================================================
//function : Shapes
//purpose : Defines the arguments.
//=======================================================================
void BRepAlgo_BooleanOperations::Shapes (const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
{
myS1 = S1;
myS2 = S2;
myDSA.Init();
myDSA.Load(myS1, myS2);
Handle(TopOpeBRepDS_HDataStructure)& HDS = myDSA.ChangeDS();
myDSA.myDSFiller.Insert(myS1,myS2,HDS);
// const Standard_Boolean CheckShapes = Standard_True;
// Standard_Boolean esp = HDS->EdgesSameParameter();
// Standard_Boolean localcheck = CheckShapes;
}
//=======================================================================
//function : SetApproxParameters
//purpose : Sets the parameters for the approximations.
//=======================================================================
void BRepAlgo_BooleanOperations::SetApproxParameters (const Standard_Integer NbPntMax,
const Standard_Real Tol3D,
const Standard_Real Tol2D)
{
myApproxNbPntMax = NbPntMax ;
myApproxTol3D = Tol3D ;
myApproxTol2D = Tol2D ;
}
//=======================================================================
//function : Define
//purpose :
//=======================================================================
void BRepAlgo_BooleanOperations::Define (const TopoDS_Shape& S1,
const TopoDS_Shape& S2,
Handle(TopOpeBRepDS_HDataStructure)& HDS)
{
ChangeDataStructure() = HDS;
myS1 = S1;
myS2 = S2;
}
//=======================================================================
//function : Perform
//purpose : Performs the global boolean operation.
//=======================================================================
void BRepAlgo_BooleanOperations::Perform ()
{
TopOpeBRepDS_BuildTool& BTofBuilder = myDSA.myHB->ChangeBuildTool();
TopOpeBRepTool_GeomTool& GTofBTofBuilder = BTofBuilder.ChangeGeomTool();
GTofBTofBuilder.SetNbPntMax(myApproxNbPntMax);
GTofBTofBuilder.SetTolerances (myApproxTol3D, myApproxTol2D) ;
Handle(TopOpeBRepBuild_HBuilder)& HB = myDSA.myHB;
Handle(TopOpeBRepDS_HDataStructure)& HDS = myDSA.ChangeDS();
HB->Perform(HDS,myS1,myS2);
}
//=======================================================================
//function : Perform
//purpose : Performs the global boolean operation in regards of the
// given states.
//=======================================================================
void BRepAlgo_BooleanOperations::Perform (const TopAbs_State State1,
const TopAbs_State State2)
{
Perform() ;
myShape.Nullify() ;
myResult.Nullify() ;
myMapShape.Clear() ;
Handle(TopOpeBRepBuild_HBuilder)& HBuilder = ChangeBuilder() ;
HBuilder->MergeShapes (myS1, State1, myS2, State2) ;
const TopTools_ListOfShape& ListResults = HBuilder->Merged (myS1, State1) ;
Standard_Integer NbResults = ListResults.Extent() ;
if (NbResults > 0) {
if (NbResults == 1) {
myShape = ListResults.First() ;
} else {
BRep_Builder Builder ;
Builder.MakeCompound (TopoDS::Compound (myShape)) ;
TopTools_ListIteratorOfListOfShape Iter ;
for (Iter.Initialize (ListResults) ; Iter.More() ; Iter.Next())
Builder.Add (myShape, Iter.Value()) ;
}
TopExp_Explorer Explorer ;
for (Explorer.Init (myShape, TopAbs_FACE) ; Explorer.More() ; Explorer.Next()) {
myMapShape.Add (Explorer.Current()) ;
}
for (Explorer.Init (myShape, TopAbs_EDGE) ; Explorer.More() ; Explorer.Next()) {
myMapShape.Add (Explorer.Current()) ;
}
}
}
//=======================================================================
//function : Common
//purpose :
//=======================================================================
const TopoDS_Shape& BRepAlgo_BooleanOperations::Common()
{
Perform (TopAbs_IN, TopAbs_IN) ;
return myShape ;
}
//=======================================================================
//function : fus
//purpose :
//=======================================================================
const TopoDS_Shape& BRepAlgo_BooleanOperations::Fus()
{
Perform (TopAbs_OUT, TopAbs_OUT) ;
return myShape ;
}
//=======================================================================
//function : cut
//purpose :
//=======================================================================
const TopoDS_Shape& BRepAlgo_BooleanOperations::Cut()
{
Perform (TopAbs_OUT, TopAbs_IN) ;
return myShape ;
}
//=======================================================================
//function : Section
//purpose :
//=======================================================================
const TopoDS_Shape& BRepAlgo_BooleanOperations::Section()
{
// Standard_Boolean bcw = BuilderCanWork();
// if ( ! bcw || myshapeisnull) return;
Perform () ;
myShape.Nullify() ;
myResult.Nullify() ;
myMapShape.Clear() ;
Handle(TopOpeBRepBuild_HBuilder)& HBuilder = myDSA.myHB ;
const TopTools_ListOfShape& ListResults = HBuilder->Section() ;
Standard_Integer NbResults = ListResults.Extent() ;
if (NbResults > 0) {
if (NbResults == 1) {
myShape = ListResults.First() ;
} else {
BRep_Builder Builder ;
Builder.MakeCompound (TopoDS::Compound (myShape)) ;
TopTools_ListIteratorOfListOfShape Iter ;
for (Iter.Initialize (ListResults) ; Iter.More() ; Iter.Next())
Builder.Add (myShape, Iter.Value()) ;
}
TopExp_Explorer Explorer ;
for (Explorer.Init (myShape, TopAbs_EDGE) ; Explorer.More() ; Explorer.Next()) {
myMapShape.Add (Explorer.Current()) ;
}
}
return myShape ;
}
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
const TopoDS_Shape& BRepAlgo_BooleanOperations::Shape()
{
return myShape;
}
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
const TopoDS_Shape& BRepAlgo_BooleanOperations::ShapeFrom (const TopoDS_Shape& Shape)
{
myResult.Nullify() ;
if (!myShape.IsNull()) {
TopoDS_Shape ShapeToDel ;
if (Shape.IsSame (myS1)) {
ShapeToDel = myS2 ;
} else {
ShapeToDel = myS1 ;
}
BRepTools_Substitution Substitute ;
TopTools_ListOfShape NullFaces ;
NullFaces.Clear() ;
TopExp_Explorer ExpFac ;
for (ExpFac.Init (ShapeToDel, TopAbs_FACE) ; ExpFac.More() ; ExpFac.Next()) {
const TopoDS_Face& Face = TopoDS::Face (ExpFac.Current()) ;
const TopTools_ListOfShape& ListResults = Modified (Face) ;
if (ListResults.Extent() == 0) {
if (myMapShape.Contains (Face)) Substitute.Substitute (Face, NullFaces) ;
} else {
TopTools_ListIteratorOfListOfShape ItrFace ;
for (ItrFace.Initialize (ListResults) ; ItrFace.More() ; ItrFace.Next()) {
Substitute.Substitute (TopoDS::Face (ItrFace.Value()), NullFaces) ;
}
}
}
Substitute.Build (myShape) ;
if (Substitute.IsCopied (myShape)) {
const TopTools_ListOfShape& ListResults = Substitute.Copy (myShape) ;
Standard_Integer NbResults = ListResults.Extent() ;
if (NbResults == 1) {
myResult = ListResults.First() ;
} else if (NbResults > 1) {
BRep_Builder Builder ;
Builder.MakeCompound (TopoDS::Compound (myResult)) ;
TopTools_ListIteratorOfListOfShape ItrResult ;
for (ItrResult.Initialize (ListResults) ; ItrResult.More() ; ItrResult.Next()) {
Builder.Add (myResult, ItrResult.Value()) ;
}
}
} else {
myResult = myShape ;
}
}
return myResult ;
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgo_BooleanOperations::Modified (const TopoDS_Shape& Shape)
{
return myDSA.Modified(Shape);
}
//=======================================================================
//function : IsDeleted
//purpose :
//=======================================================================
Standard_Boolean BRepAlgo_BooleanOperations::IsDeleted (const TopoDS_Shape& Shape)
{
Standard_Boolean Deleted = Standard_True ;
Handle(TopOpeBRepBuild_HBuilder)& HBuilder = myDSA.myHB ;
if ( myMapShape.Contains (Shape)
|| HBuilder->IsMerged (Shape, TopAbs_OUT)
|| HBuilder->IsMerged (Shape, TopAbs_IN)
|| HBuilder->IsMerged (Shape, TopAbs_ON)
|| HBuilder->IsSplit (Shape, TopAbs_OUT)
|| HBuilder->IsSplit (Shape, TopAbs_IN)
|| HBuilder->IsSplit (Shape, TopAbs_ON))
Deleted = Standard_False ;
return Deleted ;
}
//=======================================================================
//function : DataStructure
//purpose :
//=======================================================================
const Handle(TopOpeBRepDS_HDataStructure)& BRepAlgo_BooleanOperations::DataStructure() const
{
return myDSA.DS();
}
//=======================================================================
//function : DataStructure
//purpose :
//=======================================================================
Handle(TopOpeBRepDS_HDataStructure)& BRepAlgo_BooleanOperations::ChangeDataStructure()
{
return myDSA.ChangeDS();
}
//=======================================================================
//function : Builder
//purpose :
//=======================================================================
const Handle(TopOpeBRepBuild_HBuilder)& BRepAlgo_BooleanOperations::Builder() const
{
return myDSA.Builder();
}
//=======================================================================
//function : Builder
//purpose :
//=======================================================================
Handle(TopOpeBRepBuild_HBuilder)& BRepAlgo_BooleanOperations::ChangeBuilder()
{
return myDSA.ChangeBuilder();
}
//=======================================================================
//function : DataStructureAccess
//purpose : returns the member myDSA.
//=======================================================================
BRepAlgo_DSAccess& BRepAlgo_BooleanOperations::DataStructureAccess()
{
return myDSA;
}

View File

@@ -0,0 +1,140 @@
// Created on: 1993-10-14
// Created by: Prestataire Mary FABIEN
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BRepAlgo_BooleanOperations_HeaderFile
#define _BRepAlgo_BooleanOperations_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BRepAlgo_DSAccess.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <TopAbs_State.hxx>
#include <TopTools_ListOfShape.hxx>
class TopoDS_Shape;
class TopOpeBRepDS_HDataStructure;
class TopOpeBRepBuild_HBuilder;
class BRepAlgo_DSAccess;
class BRepAlgo_BooleanOperations
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT BRepAlgo_BooleanOperations();
//! S1 is a Shell with ALL faces supported by the SAME S2 is
//! an Edge INCLUDED in that surface with pcurve.
//! this avoids a time-consuming 3D operation, compared to Shapes.
Standard_EXPORT void Shapes2d (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
//! Defines the arguments.
Standard_EXPORT void Shapes (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
//! Sets different parameters for the curve approximations :
//! NbPntMax : Maximum number of points to be approximated at
//! the same time in one curve.
//! Tol3D, Tol2D : Tolerances to be reached by the approximation.
//! RelativeTol : The given tolerances are relative.
Standard_EXPORT void SetApproxParameters (const Standard_Integer NbPntMax, const Standard_Real Tol3D, const Standard_Real Tol2D);
Standard_EXPORT void Define (const TopoDS_Shape& S1, const TopoDS_Shape& S2, Handle(TopOpeBRepDS_HDataStructure)& HDS);
//! returns the common part of the shapes.
Standard_EXPORT const TopoDS_Shape& Common();
//! returns the fuse part of the shapes.
Standard_EXPORT const TopoDS_Shape& Fus();
//! returns the cut part of the shapes.
Standard_EXPORT const TopoDS_Shape& Cut();
//! returns the intersection of the shapes.
Standard_EXPORT const TopoDS_Shape& Section();
//! returns the result of the boolean operation.
Standard_EXPORT const TopoDS_Shape& Shape();
//! Returns the shape(s) resulting of the boolean operation
//! issued from the shape <S>.
Standard_EXPORT const TopoDS_Shape& ShapeFrom (const TopoDS_Shape& S);
//! Returns the list of the descendant shapes of the shape <S>.
Standard_EXPORT const TopTools_ListOfShape& Modified (const TopoDS_Shape& S);
//! Returns the fact that the shape <S> has been deleted or not
//! by the boolean operation.
Standard_EXPORT Standard_Boolean IsDeleted (const TopoDS_Shape& S);
Standard_EXPORT const Handle(TopOpeBRepDS_HDataStructure)& DataStructure() const;
Standard_EXPORT Handle(TopOpeBRepDS_HDataStructure)& ChangeDataStructure();
Standard_EXPORT const Handle(TopOpeBRepBuild_HBuilder)& Builder() const;
Standard_EXPORT Handle(TopOpeBRepBuild_HBuilder)& ChangeBuilder();
//! returns the member myDSA. It is useful to then access
//! the method GetSectionEdgeSet (wich is a member of DSAccess)
Standard_EXPORT BRepAlgo_DSAccess& DataStructureAccess();
protected:
private:
//! Performs the global boolean operation.
Standard_EXPORT void Perform();
//! Performs the global boolean operation and build the
//! result in regards of the given states.
Standard_EXPORT void Perform (const TopAbs_State State1, const TopAbs_State State2);
BRepAlgo_DSAccess myDSA;
TopoDS_Shape myS1;
TopoDS_Shape myS2;
TopoDS_Shape myShape;
TopTools_MapOfShape myMapShape;
TopoDS_Shape myResult;
Standard_Integer myApproxNbPntMax;
Standard_Real myApproxTol3D;
Standard_Real myApproxTol2D;
};
#endif // _BRepAlgo_BooleanOperations_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,237 @@
// Created on: 1997-08-13
// Created by: Prestataire Mary FABIEN
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BRepAlgo_DSAccess_HeaderFile
#define _BRepAlgo_DSAccess_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopOpeBRep_DSFiller.hxx>
#include <TopoDS_Shape.hxx>
#include <TopAbs_State.hxx>
#include <TopTools_ListOfShape.hxx>
#include <Standard_Boolean.hxx>
#include <TopoDS_Wire.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TColStd_PackedMapOfInteger.hxx>
#include <BRepAlgo_CheckStatus.hxx>
#include <Standard_Integer.hxx>
#include <TopOpeBRepDS_Kind.hxx>
class TopOpeBRepDS_HDataStructure;
class TopOpeBRepBuild_HBuilder;
class BRepAlgo_EdgeConnector;
class BRepAlgo_BooleanOperations;
class TopoDS_Shape;
class TopoDS_Vertex;
class BRepAlgo_DSAccess
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT BRepAlgo_DSAccess();
//! Clears the internal data structure, including the
Standard_EXPORT void Init();
//! Loads the shape in DS.
Standard_EXPORT void Load (const TopoDS_Shape& S);
//! Loads two shapes in the DS without intersecting them.
Standard_EXPORT void Load (TopoDS_Shape& S1, TopoDS_Shape& S2);
//! Intersects two shapes at input and loads the DS with
//! their intersection. Clears the TopOpeBRepBuild_HBuilder if
//! necessary
Standard_EXPORT void Intersect();
//! Intersects the faces contained in two given shapes
//! and loads them in the DS. Clears the TopOpeBRepBuild_HBuilder
//! if necessary
Standard_EXPORT void Intersect (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
//! This method does the same thing as the previous,
//! but faster. There is no intersection face/face 3D.
//! The faces have the same support(surface). No test of
//! tangency (that is why it is faster). Intersects in 2d
//! the faces tangent F1 anf F2.
Standard_EXPORT void SameDomain (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
//! returns compounds of Edge connected with section, which
//! contains sections between faces contained in S1 and S2.
//! returns an empty list of Shape if S1 or S2 do not contain
//! face.
//! calls GetSectionEdgeSet() if it has not already been done
Standard_EXPORT const TopTools_ListOfShape& GetSectionEdgeSet (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
//! returns all compounds of edges connected with section
//! contained in the DS
Standard_EXPORT const TopTools_ListOfShape& GetSectionEdgeSet();
//! NYI
Standard_EXPORT Standard_Boolean IsWire (const TopoDS_Shape& Compound);
//! NYI
Standard_EXPORT const TopoDS_Shape& Wire (const TopoDS_Shape& Compound);
//! NYI
//! returns the vertex of section, which contains the section
//! between face S1 and edge S2 (returns an empty Shape
//! if S1 is not a face or if S2 is not an edge)
Standard_EXPORT const TopTools_ListOfShape& SectionVertex (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
//! Invalidates a complete line of section. All
//! Edges connected by Vertex or a Wire. Can be
//! a group of connected Edges, which do not form a
//! standard Wire.
Standard_EXPORT void SuppressEdgeSet (const TopoDS_Shape& Compound);
//! Modifies a line of section. <New> -- should be a
//! Group of Edges connected by Vertex. -- Can be a
//! Wire. Can be a group of connected Edges that do not
//! form a standard Wire. <New> should be sub-groupn of <Old>
Standard_EXPORT void ChangeEdgeSet (const TopoDS_Shape& Old, const TopoDS_Shape& New);
//! NYI
//! Make invalid a Vertex of section. The Vertex shoud be
//! reconstructed from a point.
Standard_EXPORT void SuppressSectionVertex (const TopoDS_Vertex& V);
Standard_EXPORT const TopoDS_Shape& Merge (const TopAbs_State state1, const TopAbs_State state2);
Standard_EXPORT const TopoDS_Shape& Merge (const TopAbs_State state1);
//! NYI Propagation of a state starting from the shape
//! FromShape = edge or vertex of section, face or
//! Coumpound de section. LoadShape is either S1,
//! or S2 (see the method Load). Propagation from
//! FromShape, on the states <what> of LoadShape.
//! Return a Wire in 2d, a Shell in 3d.
//! Specifications are incomplete, to be redefined for the typologies
//! correpsonding to <FromShape> and the result :
//! exemple : FromShape resultat
//! vertex wire (or edge)
//! edge of section face (or shell)
//! compound of section shell
//! ... ...
Standard_EXPORT const TopoDS_Shape& Propagate (const TopAbs_State what, const TopoDS_Shape& FromShape, const TopoDS_Shape& LoadShape);
//! SectionShape est soit un Vertex de section(NYI), soit
//! une Edge de section. Propagation des shapes
//! de section en partant de SectionShape.
//! return un Compound de section.
Standard_EXPORT const TopoDS_Shape& PropagateFromSection (const TopoDS_Shape& SectionShape);
//! Returns the list of the descendant shapes of the shape <S>.
Standard_EXPORT const TopTools_ListOfShape& Modified (const TopoDS_Shape& S);
//! Returns the fact that the shape <S> has been deleted or not
//! by the boolean operation.
Standard_EXPORT Standard_Boolean IsDeleted (const TopoDS_Shape& S);
//! NYI
//! coherence of the internal Data Structure.
Standard_EXPORT BRepAlgo_CheckStatus Check();
Standard_EXPORT const Handle(TopOpeBRepDS_HDataStructure)& DS() const;
Standard_EXPORT Handle(TopOpeBRepDS_HDataStructure)& ChangeDS();
Standard_EXPORT const Handle(TopOpeBRepBuild_HBuilder)& Builder() const;
Standard_EXPORT Handle(TopOpeBRepBuild_HBuilder)& ChangeBuilder();
friend class BRepAlgo_BooleanOperations;
protected:
private:
Standard_EXPORT void Suppress (const TopoDS_Shape& Compound, const TopoDS_Shape& KeepComp);
Standard_EXPORT void RemoveEdgeInterferences (const Standard_Integer iF1, const Standard_Integer iF2, const Standard_Integer iCurve);
Standard_EXPORT void RemoveEdgeInterferences (const Standard_Integer iE1, const Standard_Integer iE2, const TopoDS_Shape& SectEdge);
Standard_EXPORT void RemoveFaceInterferences (const Standard_Integer iF1, const Standard_Integer iF2, const Standard_Integer iE1, const Standard_Integer iE2);
Standard_EXPORT void RemoveFaceInterferences (const Standard_Integer iF1, const Standard_Integer iF2, const Standard_Integer iCurve);
Standard_EXPORT void RemoveEdgeInterferencesFromFace (const Standard_Integer iF1, const Standard_Integer iF2, const Standard_Integer ipv1, const TopOpeBRepDS_Kind kind1, const Standard_Integer ipv2, const TopOpeBRepDS_Kind kind2);
Standard_EXPORT void RemoveEdgeFromFace (const Standard_Integer iF, const Standard_Integer iV);
Standard_EXPORT void PntVtxOnCurve (const Standard_Integer iCurve, Standard_Integer& ipv1, TopOpeBRepDS_Kind& ik1, Standard_Integer& ipv2, TopOpeBRepDS_Kind& ik2);
Standard_EXPORT void PntVtxOnSectEdge (const TopoDS_Shape& SectEdge, Standard_Integer& ipv1, TopOpeBRepDS_Kind& ik1, Standard_Integer& ipv2, TopOpeBRepDS_Kind& ik2);
Standard_EXPORT void RemoveEdgeSameDomain (const Standard_Integer iE1, const Standard_Integer iE2);
Standard_EXPORT void RemoveFaceSameDomain (const TopoDS_Shape& C);
Standard_EXPORT TColStd_ListOfInteger& FindGoodFace (const Standard_Integer iE, Standard_Integer& iF1, Standard_Boolean& b);
Standard_EXPORT void RemoveFaceSameDomain (const Standard_Integer iF1, const Standard_Integer iF2);
Standard_EXPORT Standard_Boolean GoodInterf (const TopoDS_Shape& SectEdge, const TopOpeBRepDS_Kind kind, const Standard_Integer iPointVertex);
Handle(TopOpeBRepDS_HDataStructure) myHDS;
TopOpeBRep_DSFiller myDSFiller;
Handle(TopOpeBRepBuild_HBuilder) myHB;
Handle(BRepAlgo_EdgeConnector) myEC;
TopoDS_Shape myS1;
TopoDS_Shape myS2;
TopAbs_State myState1;
TopAbs_State myState2;
TopTools_ListOfShape myListOfCompoundOfEdgeConnected;
TopTools_ListOfShape myCurrentList;
Standard_Boolean myRecomputeBuilderIsDone;
Standard_Boolean myGetSectionIsDone;
TopoDS_Shape myResultShape;
TopoDS_Wire myWire;
TopTools_ListOfShape myListOfVertex;
TopTools_ListOfShape myModified;
TopoDS_Shape myEmptyShape;
TopTools_ListOfShape myEmptyListOfShape;
TColStd_ListOfInteger myEmptyListOfInteger;
TopTools_DataMapOfShapeShape myCompoundWireMap;
TColStd_PackedMapOfInteger mySetOfKeepPoint;
};
#endif // _BRepAlgo_DSAccess_HeaderFile

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018 OPEN CASCADE SAS
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -11,18 +11,10 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_FrameStatsTimer_HeaderFile
#define _Graphic3d_FrameStatsTimer_HeaderFile
//! Timers for collecting frame performance statistics.
enum Graphic3d_FrameStatsTimer
{
Graphic3d_FrameStatsTimer_ElapsedFrame,
Graphic3d_FrameStatsTimer_CpuFrame,
Graphic3d_FrameStatsTimer_CpuCulling,
Graphic3d_FrameStatsTimer_CpuPicking,
Graphic3d_FrameStatsTimer_CpuDynamics,
};
enum { Graphic3d_FrameStatsTimer_NB = Graphic3d_FrameStatsTimer_CpuDynamics + 1 };
#ifndef BRepAlgo_DataMapIteratorOfDataMapOfShapeBoolean_HeaderFile
#define BRepAlgo_DataMapIteratorOfDataMapOfShapeBoolean_HeaderFile
#endif // _Graphic3d_FrameStatsTimer_HeaderFile
#include <BRepAlgo_DataMapOfShapeBoolean.hxx>
#endif

View File

@@ -0,0 +1,20 @@
// Copyright (c) 2015 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 BRepAlgo_DataMapIteratorOfDataMapOfShapeInterference_HeaderFile
#define BRepAlgo_DataMapIteratorOfDataMapOfShapeInterference_HeaderFile
#include <BRepAlgo_DataMapOfShapeInterference.hxx>
#endif

View File

@@ -0,0 +1,29 @@
// Created on: 1997-01-17
// Created by: Didier PIFFAULT
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef BRepAlgo_DataMapOfShapeBoolean_HeaderFile
#define BRepAlgo_DataMapOfShapeBoolean_HeaderFile
#include <TopoDS_Shape.hxx>
#include <Standard_Boolean.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<TopoDS_Shape,Standard_Boolean,TopTools_ShapeMapHasher> BRepAlgo_DataMapOfShapeBoolean;
typedef NCollection_DataMap<TopoDS_Shape,Standard_Boolean,TopTools_ShapeMapHasher>::Iterator BRepAlgo_DataMapIteratorOfDataMapOfShapeBoolean;
#endif

View File

@@ -0,0 +1,29 @@
// Created on: 1997-01-17
// Created by: Didier PIFFAULT
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef BRepAlgo_DataMapOfShapeInterference_HeaderFile
#define BRepAlgo_DataMapOfShapeInterference_HeaderFile
#include <TopoDS_Shape.hxx>
#include <TopOpeBRepDS_Interference.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<TopoDS_Shape,Handle(TopOpeBRepDS_Interference),TopTools_ShapeMapHasher> BRepAlgo_DataMapOfShapeInterference;
typedef NCollection_DataMap<TopoDS_Shape,Handle(TopOpeBRepDS_Interference),TopTools_ShapeMapHasher>::Iterator BRepAlgo_DataMapIteratorOfDataMapOfShapeInterference;
#endif

View File

@@ -0,0 +1,184 @@
// Created on: 1997-08-22
// Created by: Prestataire Mary FABIEN
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRep_Builder.hxx>
#include <BRepAlgo_DataMapOfShapeBoolean.hxx>
#include <BRepAlgo_EdgeConnector.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
#include <TopOpeBRepBuild_BlockBuilder.hxx>
#include <TopOpeBRepBuild_BlockIterator.hxx>
#include <TopOpeBRepBuild_ShapeSet.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRepAlgo_EdgeConnector,Standard_Transient)
//=======================================================================
//function : Create
//purpose :
//=======================================================================
BRepAlgo_EdgeConnector::BRepAlgo_EdgeConnector()
:myIsDone(Standard_False)
{
myListeOfEdge.Clear();
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
void BRepAlgo_EdgeConnector::Add(const TopoDS_Edge& e)
{
if(e.IsNull()) return;
myListeOfEdge.Append(e);
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
void BRepAlgo_EdgeConnector::Add(TopTools_ListOfShape& LOEdge)
{
if(LOEdge.IsEmpty()) return;
myListeOfEdge.Append(LOEdge);
}
//=======================================================================
//function : AddStart
//purpose :
//=======================================================================
void BRepAlgo_EdgeConnector::AddStart(const TopoDS_Shape& e)
{
if(e.IsNull()) return;
myListeOfStartEdge.Append(e);
}
//=======================================================================
//function : AddStart
//purpose :
//=======================================================================
void BRepAlgo_EdgeConnector::AddStart(TopTools_ListOfShape& LOEdge)
{
if(LOEdge.IsEmpty()) return;
myListeOfStartEdge.Append(LOEdge);
}
//=======================================================================
//function : ClearStartElement
//purpose :
//=======================================================================
void BRepAlgo_EdgeConnector::ClearStartElement()
{
myListeOfStartEdge.Clear();
}
//=======================================================================
//function : MakeBlock
//purpose :
//=======================================================================
TopTools_ListOfShape& BRepAlgo_EdgeConnector::MakeBlock()
{
Standard_Boolean b;
if(myListeOfStartEdge.IsEmpty()) return myListeOfStartEdge;
TopOpeBRepBuild_ShapeSet SS(TopAbs_VERTEX);
myResultMap.Clear();
myResultList.Clear();
TopTools_ListIteratorOfListOfShape it(myListeOfEdge);
for(;it.More();it.Next()) {
const TopoDS_Shape& edge = it.Value();
SS.AddElement(edge);
}
it.Initialize(myListeOfStartEdge);
for(;it.More();it.Next()) {
const TopoDS_Shape& edge = it.Value();
SS.AddStartElement(edge);
}
myBlockB.MakeBlock(SS);
BRep_Builder WireB;
for(myBlockB.InitBlock();myBlockB.MoreBlock();myBlockB.NextBlock()) {
//#ifndef OCCT_DEBUG
TopOpeBRepBuild_BlockIterator BI = myBlockB.BlockIterator();
//#else
// TopOpeBRepBuild_BlockIterator& BI = myBlockB.BlockIterator();
//#endif
TopoDS_Wire W;
WireB.MakeWire(W);
for(BI.Initialize();BI.More();BI.Next()) {
const TopoDS_Shape& CurrentE = myBlockB.Element(BI);
WireB.Add(W, CurrentE);
}
b = myBlockB.CurrentBlockIsRegular();
myResultMap.Bind(W, b);
myResultList.Append(W);
}
Done();
return myResultList;
}
//=======================================================================
//function : IsWire
//purpose :
//=======================================================================
Standard_Boolean BRepAlgo_EdgeConnector::IsWire(const TopoDS_Shape& S)
{
if(!myResultMap.IsBound(S)) {
return Standard_False;
}
Standard_Boolean b = Standard_False;
myBlockB.InitBlock();
TopTools_ListIteratorOfListOfShape LI(myResultList);
for(;myBlockB.MoreBlock();myBlockB.NextBlock(),LI.Next()) {
if(S == LI.Value()) {
b = myBlockB.CurrentBlockIsRegular();
break;
}
}
return b;
}
//=======================================================================
//function : IsDone
//purpose :
//=======================================================================
Standard_Boolean BRepAlgo_EdgeConnector::IsDone() const
{
return myIsDone;
}
//=======================================================================
//function : Done
//purpose :
//=======================================================================
void BRepAlgo_EdgeConnector::Done()
{
myIsDone = Standard_True;
}

View File

@@ -0,0 +1,101 @@
// Created on: 1997-08-22
// Created by: Prestataire Mary FABIEN
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BRepAlgo_EdgeConnector_HeaderFile
#define _BRepAlgo_EdgeConnector_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BRepAlgo_DataMapOfShapeBoolean.hxx>
#include <TopOpeBRepBuild_BlockBuilder.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Transient.hxx>
class TopoDS_Edge;
class TopoDS_Shape;
class BRepAlgo_EdgeConnector;
DEFINE_STANDARD_HANDLE(BRepAlgo_EdgeConnector, Standard_Transient)
//! Used by DSAccess to reconstruct an EdgeSet of connected edges. The result produced by
//! MakeBlock is a list of non-standard TopoDS_wire,
//! which can present connexions of edge of order > 2
//! in certain vertex. The method IsWire
//! indicates standard/non-standard character of all wire produced.
class BRepAlgo_EdgeConnector : public Standard_Transient
{
public:
Standard_EXPORT BRepAlgo_EdgeConnector();
Standard_EXPORT void Add (const TopoDS_Edge& e);
Standard_EXPORT void Add (TopTools_ListOfShape& LOEdge);
Standard_EXPORT void AddStart (const TopoDS_Shape& e);
Standard_EXPORT void AddStart (TopTools_ListOfShape& LOEdge);
Standard_EXPORT void ClearStartElement();
//! returns a list of wire non standard
Standard_EXPORT TopTools_ListOfShape& MakeBlock();
Standard_EXPORT void Done();
//! NYI
//! returns true if proceeded to MakeBlock()
Standard_EXPORT Standard_Boolean IsDone() const;
//! NYI
//! returns true if W is a Wire standard.
//! W must belong to the list returned by MakeBlock.
Standard_EXPORT Standard_Boolean IsWire (const TopoDS_Shape& W);
DEFINE_STANDARD_RTTIEXT(BRepAlgo_EdgeConnector,Standard_Transient)
protected:
private:
TopTools_ListOfShape myListeOfEdge;
TopTools_ListOfShape myListeOfStartEdge;
BRepAlgo_DataMapOfShapeBoolean myResultMap;
TopTools_ListOfShape myResultList;
TopOpeBRepBuild_BlockBuilder myBlockB;
Standard_Boolean myIsDone;
};
#endif // _BRepAlgo_EdgeConnector_HeaderFile

View File

@@ -23,6 +23,7 @@
#include <BRepAdaptor_HSurface.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepAlgo_NormalProjection.hxx>
#include <BRepAlgo_SequenceOfSequenceOfInteger.hxx>
#include <BRepAlgoAPI_Section.hxx>
#include <BRepLib_MakeEdge.hxx>
#include <BRepLib_MakeVertex.hxx>

View File

@@ -0,0 +1,26 @@
// Created on: 1997-01-17
// Created by: Didier PIFFAULT
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef BRepAlgo_SequenceOfSequenceOfInteger_HeaderFile
#define BRepAlgo_SequenceOfSequenceOfInteger_HeaderFile
#include <TColStd_SequenceOfInteger.hxx>
#include <NCollection_Sequence.hxx>
typedef NCollection_Sequence<TColStd_SequenceOfInteger> BRepAlgo_SequenceOfSequenceOfInteger;
#endif

View File

@@ -5,11 +5,21 @@ BRepAlgo_AsDes.cxx
BRepAlgo_AsDes.hxx
BRepAlgo_BooleanOperation.cxx
BRepAlgo_BooleanOperation.hxx
BRepAlgo_BooleanOperations.cxx
BRepAlgo_BooleanOperations.hxx
BRepAlgo_CheckStatus.hxx
BRepAlgo_Common.cxx
BRepAlgo_Common.hxx
BRepAlgo_Cut.cxx
BRepAlgo_Cut.hxx
BRepAlgo_DataMapIteratorOfDataMapOfShapeBoolean.hxx
BRepAlgo_DataMapIteratorOfDataMapOfShapeInterference.hxx
BRepAlgo_DataMapOfShapeBoolean.hxx
BRepAlgo_DataMapOfShapeInterference.hxx
BRepAlgo_DSAccess.cxx
BRepAlgo_DSAccess.hxx
BRepAlgo_EdgeConnector.cxx
BRepAlgo_EdgeConnector.hxx
BRepAlgo_FaceRestrictor.cxx
BRepAlgo_FaceRestrictor.hxx
BRepAlgo_Fuse.cxx
@@ -22,5 +32,6 @@ BRepAlgo_NormalProjection.cxx
BRepAlgo_NormalProjection.hxx
BRepAlgo_Section.cxx
BRepAlgo_Section.hxx
BRepAlgo_SequenceOfSequenceOfInteger.hxx
BRepAlgo_Tool.cxx
BRepAlgo_Tool.hxx

View File

@@ -41,9 +41,7 @@ public:
Standard_EXPORT BRepApprox_ApproxLine(const Handle(Geom_BSplineCurve)& CurveXYZ, const Handle(Geom2d_BSplineCurve)& CurveUV1, const Handle(Geom2d_BSplineCurve)& CurveUV2);
//! theTang variable has been entered only for compatibility with
//! the alias IntPatch_WLine. They are not used in this class.
Standard_EXPORT BRepApprox_ApproxLine(const Handle(IntSurf_LineOn2S)& lin, const Standard_Boolean theTang = Standard_False);
Standard_EXPORT BRepApprox_ApproxLine(const Handle(IntSurf_LineOn2S)& lin, const Standard_Boolean Tang);
Standard_EXPORT Standard_Integer NbPnts() const;

View File

@@ -671,7 +671,7 @@ Standard_Boolean IsModifySize(const BRepAdaptor_Surface& theBS,
//
gp_Pnt2d aP2d(uextr, vextr);
TopAbs_State aSt = theFClass.Perform(aP2d);
if(aSt != TopAbs_IN)
if(aSt == TopAbs_OUT)
{
return Standard_True;
}

View File

@@ -732,24 +732,236 @@
//function : FillIn3DParts
//purpose :
//=======================================================================
void BRepFeat_Builder::FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids)
void BRepFeat_Builder::FillIn3DParts(TopTools_DataMapOfShapeListOfShape& theInParts,
TopTools_DataMapOfShapeShape& theDraftSolids,
const Handle(NCollection_BaseAllocator)& theAllocator)
{
GetReport()->Clear();
BOPAlgo_Builder::FillIn3DParts(theDraftSolids);
// Clear the IN parts of the solids from the removed faces
TopTools_DataMapOfShapeListOfShape::Iterator itM(myInParts);
for (; itM.More(); itM.Next())
{
TopTools_ListOfShape& aList = itM.ChangeValue();
TopTools_ListOfShape::Iterator itL(aList);
for (; itL.More();)
{
if (myRemoved.Contains(itL.Value()))
aList.Remove(itL);
else
itL.Next();
//
Standard_Boolean bIsIN, bHasImage;
Standard_Integer aNbS, i, j, aNbFP, aNbFPx, aNbFIN, aNbLIF, aNbEFP;
TopAbs_ShapeEnum aType;
TopAbs_State aState;
TopoDS_Iterator aIt, aItF;
BRep_Builder aBB;
TopoDS_Solid aSolidSp;
TopoDS_Face aFP;
TopTools_ListIteratorOfListOfShape aItS, aItFP, aItEx;
TopTools_MapIteratorOfMapOfShape aItMS, aItMS1;
//
TopTools_ListOfShape aLIF(theAllocator);
TopTools_MapOfShape aMFDone(100, theAllocator);
TopTools_MapOfShape aMSolids(100, theAllocator);
TopTools_MapOfShape aMFaces(100, theAllocator);
TopTools_MapOfShape aMFIN(100, theAllocator);
TopTools_IndexedMapOfShape aMS(100, theAllocator);
TopTools_IndexedDataMapOfShapeListOfShape aMEF(100, theAllocator);
//
theDraftSolids.Clear();
//
aNbS=myDS->NbSourceShapes();
for (i=0; i<aNbS; ++i) {
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
const TopoDS_Shape& aS=aSI.Shape();
//
aType=aSI.ShapeType();
switch(aType) {
case TopAbs_SOLID: {
aMSolids.Add(aS);
break;
}
//
case TopAbs_FACE: {
// all faces (originals or images)
if (myImages.IsBound(aS)) {
const TopTools_ListOfShape& aLS=myImages.Find(aS);
aItS.Initialize(aLS);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aFx=aItS.Value();
if (!myRemoved.Contains(aFx)) {
aMFaces.Add(aFx);
}
}
}
else {
if (!myRemoved.Contains(aS)) {
aMFaces.Add(aS);
}
}
break;
}
//
default:
break;
}
}
//
aItMS.Initialize(aMSolids);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Solid& aSolid=(*(TopoDS_Solid*)(&aItMS.Value()));
//
aMFDone.Clear();
aMFIN.Clear();
aMEF.Clear();
//
aBB.MakeSolid(aSolidSp);
//
// Draft solid and its pure internal faces => aSolidSp, aLIF
aLIF.Clear();
BuildDraftSolid(aSolid, aSolidSp, aLIF);
aNbLIF=aLIF.Extent();
//
// 1 all faces/edges from aSolid [ aMS ]
bHasImage=Standard_False;
aMS.Clear();
aIt.Initialize(aSolid);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aShell=aIt.Value();
//
if (myImages.IsBound(aShell)) {
bHasImage=Standard_True;
//
const TopTools_ListOfShape& aLS=myImages.Find(aShell);
aItS.Initialize(aLS);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aSx=aItS.Value();
aMS.Add(aSx);
TopExp::MapShapes(aSx, TopAbs_FACE, aMS);
TopExp::MapShapes(aSx, TopAbs_EDGE, aMS);
TopExp::MapShapesAndAncestors(aSx, TopAbs_EDGE, TopAbs_FACE, aMEF);
}
}
else {
//aMS.Add(aShell);
TopExp::MapShapes(aShell, TopAbs_FACE, aMS);
TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEF);
}
}
//
// 2 all faces that are not from aSolid [ aLFP1 ]
TopTools_IndexedDataMapOfShapeListOfShape aMEFP(100, theAllocator);
TopTools_ListOfShape aLFP1(theAllocator);
TopTools_ListOfShape aLFP(theAllocator);
TopTools_ListOfShape aLCBF(theAllocator);
TopTools_ListOfShape aLFIN(theAllocator);
TopTools_ListOfShape aLEx(theAllocator);
//
// for all non-solid faces build EF map [ aMEFP ]
aItMS1.Initialize(aMFaces);
for (; aItMS1.More(); aItMS1.Next()) {
const TopoDS_Shape& aFace=aItMS1.Value();
if (!aMS.Contains(aFace)) {
TopExp::MapShapesAndAncestors(aFace, TopAbs_EDGE, TopAbs_FACE, aMEFP);
}
}
//
// among all faces from aMEFP select these that have same edges
// with the solid (i.e aMEF). These faces will be treated first
// to prevent the usage of 3D classifier.
// The full list of faces to process is aLFP1.
aNbEFP=aMEFP.Extent();
for (j=1; j<=aNbEFP; ++j) {
const TopoDS_Shape& aE=aMEFP.FindKey(j);
//
if (aMEF.Contains(aE)) { // !!
const TopTools_ListOfShape& aLF=aMEFP(j);
aItFP.Initialize(aLF);
for (; aItFP.More(); aItFP.Next()) {
const TopoDS_Shape& aF=aItFP.Value();
if (aMFDone.Add(aF)) {
aLFP1.Append(aF);
}
}
}
else {
aLEx.Append(aE);
}
}
//
aItEx.Initialize(aLEx);
for (; aItEx.More(); aItEx.Next()) {
const TopoDS_Shape& aE=aItEx.Value();
const TopTools_ListOfShape& aLF=aMEFP.FindFromKey(aE);
aItFP.Initialize(aLF);
for (; aItFP.More(); aItFP.Next()) {
const TopoDS_Shape& aF=aItFP.Value();
if (aMFDone.Add(aF)) {
//aLFP2.Append(aF);
aLFP1.Append(aF);
}
}
}
//
//==========
//
// 3 Process faces aLFP1
aMFDone.Clear();
aNbFP=aLFP1.Extent();
aItFP.Initialize(aLFP1);
for (; aItFP.More(); aItFP.Next()) {
const TopoDS_Shape& aSP=aItFP.Value();
if (!aMFDone.Add(aSP)) {
continue;
}
//
// first face to process
aFP=(*(TopoDS_Face*)(&aSP));
bIsIN=BOPTools_AlgoTools::IsInternalFace(aFP, aSolidSp, aMEF, 1.e-14, myContext);
aState=(bIsIN) ? TopAbs_IN : TopAbs_OUT;
//
// collect faces to process [ aFP is the first ]
aLFP.Clear();
aLFP.Append(aFP);
aItS.Initialize(aLFP1);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aSk=aItS.Value();
if (!aMFDone.Contains(aSk)) {
aLFP.Append(aSk);
}
}
//
// Connexity Block that spreads from aFP the Bound
// or till the end of the block itself
aLCBF.Clear();
BOPTools_AlgoTools::MakeConnexityBlock(aLFP, aMS, aLCBF, theAllocator);
//
// fill states for the Connexity Block
aItS.Initialize(aLCBF);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aSx=aItS.Value();
aMFDone.Add(aSx);
if (aState==TopAbs_IN) {
aMFIN.Add(aSx);
}
}
//
aNbFPx=aMFDone.Extent();
if (aNbFPx==aNbFP) {
break;
}
}//for (; aItFP.More(); aItFP.Next())
//
// faces Inside aSolid
aLFIN.Clear();
aNbFIN=aMFIN.Extent();
if (aNbFIN || aNbLIF) {
aItMS1.Initialize(aMFIN);
for (; aItMS1.More(); aItMS1.Next()) {
const TopoDS_Shape& aFIn=aItMS1.Value();
aLFIN.Append(aFIn);
}
//
aItS.Initialize(aLIF);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aFIN=aItS.Value();
aLFIN.Append(aFIN);
}
//
theInParts.Bind(aSolid, aLFIN);
}
if (aNbFIN || bHasImage) {
theDraftSolids.Bind(aSolid, aSolidSp);
}
}// for (; aItMS.More(); aItMS.Next()) {
}

View File

@@ -117,14 +117,7 @@ protected:
Standard_EXPORT virtual void Prepare() Standard_OVERRIDE;
//! Function is redefined to avoid the usage of removed faces.
Standard_EXPORT virtual void FillIn3DParts (TopTools_DataMapOfShapeShape& theDraftSolids) Standard_OVERRIDE;
//! Avoid the check for open solids and always use the splits
//! of solids for building the result shape.
virtual Standard_Boolean CheckArgsForOpenSolid() Standard_OVERRIDE
{
return Standard_False;
}
Standard_EXPORT virtual void FillIn3DParts (TopTools_DataMapOfShapeListOfShape& theInParts, TopTools_DataMapOfShapeShape& theDraftSolids, const Handle(NCollection_BaseAllocator)& theAllocator) Standard_OVERRIDE;
TopTools_MapOfShape myShapes;

View File

@@ -20,13 +20,11 @@
#include <Bnd_Box.hxx>
#include <BndLib_Add3dCurve.hxx>
#include <BndLib_AddSurface.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepAlgoAPI_Section.hxx>
#include <BRepAlgo_DSAccess.hxx>
#include <BRepBuilderAPI_Sewing.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
@@ -620,84 +618,99 @@ static Standard_Boolean GoodOrientation(const Bnd_Box& B,
return Standard_False; // Impossible to do
}
}
BRepAlgo_DSAccess DSA;
DSA.Load(Sol1, Sol2);
DSA.Intersect(Sol1, Sol2); // intersection of 2 solids
// removal of edges corresponding to "unused" intersections
Standard_Integer NbPaquet;
// gp_Pnt P1,P2;
TopoDS_Vertex V,V1;
TopTools_ListOfShape List;
List = DSA.GetSectionEdgeSet();// list of edges
NbPaquet = List.Extent();
// Perform intersection of solids
BOPAlgo_PaveFiller aPF;
TopTools_ListOfShape anArgs;
anArgs.Append(Sol1);
anArgs.Append(Sol2);
aPF.SetArguments(anArgs);
aPF.Perform();
if (aPF.HasErrors())
if (NbPaquet == 0) {
#if DRAW
cout << "No fusion" << endl;
DBRep::Set("DepPart", Sol1);
DBRep::Set("StopPart", Sol2);
#endif
return Standard_False;
}
BRepAlgoAPI_Section aSec(Sol1, Sol2, aPF);
const TopoDS_Shape& aSection = aSec.Shape();
if (NbPaquet > 1) {
// It is required to select packs.
TColStd_Array1OfReal Dist(1, NbPaquet);
TopTools_ListIteratorOfListOfShape it(List);
Standard_Real D, Dmin = 1.e10;
Standard_Integer ii;
//Classify the packs by distance.
BRepExtrema_DistShapeShape Dist2;
Dist2.LoadS1( myWire );
for (ii=1; it.More();it.Next(),ii++){
Dist2.LoadS2( it.Value() );
Dist2.Perform();
if (Dist2.IsDone()) {
D = Dist2.Value();
Dist(ii) = D;
if (D < Dmin) Dmin = D;
}
else
Dist(ii) = 1.e10;
}
TopExp_Explorer exp(aSection, TopAbs_EDGE);
if (!exp.More())
// No section edges produced
return Standard_False;
// remove edges "farther" than Dmin
for (ii=1, it.Initialize(List); it.More();it.Next(), ii++){
if (Dist(ii) > Dmin) {
DSA.SuppressEdgeSet(it.Value());
}
#if DRAW
else if (Affich) {
DBRep::Set("KeepEdges", it.Value());
}
#endif
}
}
if (StopShape.ShapeType() != TopAbs_SOLID)
{
if (StopShape.ShapeType() != TopAbs_SOLID) {
// It is required to choose the state by the geometry
// We need to find the section edge, closest to myWire
TopoDS_Edge aSEMin;
Standard_Real Dmin = Precision::Infinite();
BRepExtrema_DistShapeShape DistTool;
DistTool.LoadS1(myWire);
//(1) Return an edge of section
List = DSA.GetSectionEdgeSet();// list of edges
TopTools_ListIteratorOfListOfShape it(List);
TopoDS_Iterator iter(it.Value());
TopoDS_Edge E = TopoDS::Edge(iter.Value());
for (; exp.More(); exp.Next())
{
const TopoDS_Shape& aSE = exp.Current();
DistTool.LoadS2(aSE);
DistTool.Perform();
if (DistTool.IsDone())
{
Standard_Real D = DistTool.Value();
if (D < Dmin)
{
Dmin = D;
aSEMin = TopoDS::Edge(aSE);
if (Dmin < Precision::Confusion())
break;
}
//(2) Return geometry on StopShape
// Class BRep_Tool without fields and without Constructor :
// BRep_Tool BT;
Handle(Geom_Surface) S;
Handle(Geom2d_Curve) C2d;
gp_Pnt2d P2d;
Standard_Real f,l;
TopLoc_Location L;
// BT.CurveOnSurface(E, C2d, S, L, f, l, 2);
BRep_Tool::CurveOnSurface(E, C2d, S, L, f, l, 2);
// Find a normal.
C2d->D0((f+l)/2,P2d);
GeomLProp_SLProps SP(S, P2d.X(), P2d.Y(), 1, 1.e-12);
if (! SP.IsNormalDefined()) {
C2d->D0((3*f+l)/4,P2d);
SP.SetParameters(P2d.X(), P2d.Y());
if ( !SP.IsNormalDefined()) {
C2d->D0((f+3*l)/4,P2d);
SP.SetParameters(P2d.X(), P2d.Y());
}
}
if (!aSEMin.IsNull())
{
// Get geometry of StopShape
Handle(Geom_Surface) S;
Handle(Geom2d_Curve) C2d;
gp_Pnt2d P2d;
Standard_Real f, l;
TopLoc_Location L;
BRep_Tool::CurveOnSurface(aSEMin, C2d, S, L, f, l, 2);
// Find a normal.
C2d->D0((f + l) / 2, P2d);
GeomLProp_SLProps SP(S, P2d.X(), P2d.Y(), 1, 1.e-12);
if (!SP.IsNormalDefined())
{
C2d->D0((3 * f + l) / 4, P2d);
SP.SetParameters(P2d.X(), P2d.Y());
if (!SP.IsNormalDefined())
{
C2d->D0((f + 3 * l) / 4, P2d);
SP.SetParameters(P2d.X(), P2d.Y());
}
}
if (SP.IsNormalDefined())
{
// Subtract State1
if (myDir.Angle(SP.Normal()) < M_PI / 2) State1 = TopAbs_IN;
else State1 = TopAbs_OUT;
}
}
// Subtract State1
if (myDir.Angle(SP.Normal()) < M_PI/2) State1 = TopAbs_IN;
else State1 = TopAbs_OUT;
}
if (! KeepOutSide) { // Invert State2;
@@ -705,100 +718,8 @@ static Standard_Boolean GoodOrientation(const Bnd_Box& B,
else State2 = TopAbs_IN;
}
// Perform Boolean operation
BOPAlgo_Builder aBuilder;
aBuilder.AddArgument(Sol1);
aBuilder.AddArgument(Sol2);
aBuilder.PerformWithFiller(aPF);
if (aBuilder.HasErrors())
return Standard_False;
TopoDS_Shape result;
Handle(BRepTools_History) aHistory = new BRepTools_History;
Standard_Boolean isSingleOpNeeded = Standard_True;
// To get rid of the unnecessary parts of first solid make the cutting first
if (State1 == TopAbs_OUT)
{
TopTools_ListOfShape aLO, aLT;
aLO.Append(Sol1);
aLT.Append(Sol2);
aBuilder.BuildBOP(aLO, aLT, BOPAlgo_CUT);
if (!aBuilder.HasErrors())
{
TopoDS_Solid aCutMin;
TopExp_Explorer anExpS(aBuilder.Shape(), TopAbs_SOLID);
if (anExpS.More())
{
aCutMin = TopoDS::Solid(anExpS.Current());
anExpS.Next();
if (anExpS.More())
{
Standard_Real aDMin = Precision::Infinite();
BRepExtrema_DistShapeShape DistTool;
DistTool.LoadS1(myWire);
for (anExpS.ReInit(); anExpS.More(); anExpS.Next())
{
const TopoDS_Shape& aCut = anExpS.Current();
DistTool.LoadS2(aCut);
DistTool.Perform();
if (DistTool.IsDone())
{
Standard_Real D = DistTool.Value();
if (D < aDMin)
{
aDMin = D;
aCutMin = TopoDS::Solid(aCut);
}
}
}
}
}
if (!aCutMin.IsNull())
{
// Save history for first argument only
aHistory->Merge(aLO, aBuilder);
// Perform needed operation with result of Cut
BOPAlgo_Builder aGluer;
aGluer.AddArgument(aCutMin);
aGluer.AddArgument(Sol2);
aGluer.SetGlue(BOPAlgo_GlueShift);
aGluer.Perform();
aLO.Clear();
aLO.Append(aCutMin);
aGluer.BuildBOP(aLO, State1, aLT, State2);
if (!aGluer.HasErrors())
{
aHistory->Merge(aGluer.History());
result = aGluer.Shape();
anExpS.Init(result, TopAbs_SOLID);
isSingleOpNeeded = !anExpS.More();
}
}
}
}
if (isSingleOpNeeded)
{
aHistory->Clear();
TopTools_ListOfShape aLO, aLT;
aLO.Append(Sol1);
aLT.Append(Sol2);
aBuilder.BuildBOP(aLO, State1, aLT, State2);
if (aBuilder.HasErrors())
return Standard_False;
aHistory->Merge(aBuilder.History());
result = aBuilder.Shape();
}
//recalculate the final shape
TopoDS_Shape result = DSA.Merge(State1, State2);
if (issolid) myShape = result;
else {
@@ -807,15 +728,15 @@ static Standard_Boolean GoodOrientation(const Bnd_Box& B,
if (Exp.More()) myShape = Exp.Current();
}
// Update the History
// Update the History
Standard_Integer ii;
for (ii=1; ii<=myLoc->NbLaw(); ii++) {
const TopTools_ListOfShape& L = aHistory->Modified(myFaces->Value(1,ii));
const TopTools_ListOfShape& L = DSA.Modified(myFaces->Value(1,ii));
if (L.Extent()>0)
myFaces->SetValue(1, ii, L.First());
}
for (ii=1; ii<=myLoc->NbLaw()+1; ii++) {
const TopTools_ListOfShape& L = aHistory->Modified(mySections->Value(1,ii));
const TopTools_ListOfShape& L = DSA.Modified(mySections->Value(1,ii));
if (L.Extent()>0)
mySections->SetValue(1, ii, L.First());
}

View File

@@ -1409,73 +1409,6 @@ void BRepFill_PipeShell::BuildHistory(const BRepFill_Sweep& theSweep)
inde++;
}
}
//For subshapes of spine
const Handle(TopTools_HArray2OfShape)& aFaces = theSweep.SubShape();
const Handle(TopTools_HArray2OfShape)& aVEdges = theSweep.Sections();
BRepTools_WireExplorer wexp(mySpine);
inde = 0;
Standard_Boolean ToExit = Standard_False;
for (;;)
{
if (!wexp.More())
ToExit = Standard_True;
inde++;
if (!ToExit)
{
const TopoDS_Edge& anEdgeOfSpine = wexp.Current();
TopoDS_Shell aShell;
BB.MakeShell(aShell);
for (Standard_Integer i = 1; i <= aFaces->UpperRow(); i++)
{
const TopoDS_Shape& aFace = aFaces->Value(i, inde);
if (aFace.ShapeType() == TopAbs_FACE)
BB.Add(aShell, aFace);
}
TopTools_ListOfShape ListShell;
ListShell.Append(aShell);
myGenMap.Bind(anEdgeOfSpine, ListShell);
}
const TopoDS_Vertex& aVertexOfSpine = wexp.CurrentVertex();
TopTools_ListOfShape ListVshapes;
for (Standard_Integer i = 1; i <= aVEdges->UpperRow(); i++)
{
const TopoDS_Shape& aVshape = aVEdges->Value(i, inde);
if (aVshape.ShapeType() == TopAbs_EDGE ||
aVshape.ShapeType() == TopAbs_FACE)
ListVshapes.Append(aVshape);
else
{
TopoDS_Iterator itvshape(aVshape);
for (; itvshape.More(); itvshape.Next())
{
const TopoDS_Shape& aSubshape = itvshape.Value();
if (aSubshape.ShapeType() == TopAbs_EDGE ||
aSubshape.ShapeType() == TopAbs_FACE)
ListVshapes.Append(aSubshape);
else
{
//it is wire
for (itw.Initialize(aSubshape); itw.More(); itw.Next())
ListVshapes.Append(itw.Value());
}
}
}
}
myGenMap.Bind(aVertexOfSpine, ListVshapes);
if (ToExit)
break;
if (wexp.More())
wexp.Next();
}
}

View File

@@ -192,12 +192,6 @@ public:
theProfiles.Append(mySeq(i).OriginalShape());
}
//! Returns the spine
const TopoDS_Wire& Spine()
{
return mySpine;
}
//! Returns the list of shapes generated from the
//! shape <S>.
Standard_EXPORT void Generated (const TopoDS_Shape& S, TopTools_ListOfShape& L);

View File

@@ -2941,10 +2941,9 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
// Management of looping ends
if ( (NbTrous>0) && (myLoc->IsClosed()) &&
(Trous->Value(NbTrous) == NbPath+1) ) {
Translate(myVEdges, NbPath+1, Bounds, 1);
Translate(myVEdges, 1, Bounds, 2);
Translate(myVEdges, NbPath+1, Bounds, 1);
Translate(myVEdges, 1, Bounds, 2);
PerformCorner(1, Transition, Bounds);
Translate(myVEdges, 1, myVEdges, NbPath+1);
}
// Construction of the shell
@@ -3042,8 +3041,7 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
for (jj = myUEdges->LowerCol(); jj <= myUEdges->UpperCol(); jj++)
{
TopoDS_Edge anEdge = TopoDS::Edge(myUEdges->Value(ii, jj));
if (anEdge.IsNull() ||
BRep_Tool::Degenerated(anEdge))
if (anEdge.IsNull())
continue;
TopoDS_Face Face1, Face2;
Standard_Integer i1 = ii-1, i2 = ii;
@@ -3052,19 +3050,10 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
if (i2 > myFaces->UpperRow())
i2 = 0;
if (i1 != 0)
{
const TopoDS_Shape& aShape1 = myFaces->Value(i1, jj);
if (aShape1.ShapeType() == TopAbs_FACE)
Face1 = TopoDS::Face(aShape1);
}
Face1 = TopoDS::Face(myFaces->Value(i1, jj));
if (i2 != 0)
{
const TopoDS_Shape& aShape2 = myFaces->Value(i2, jj);
if (aShape2.ShapeType() == TopAbs_FACE)
Face2 = TopoDS::Face(aShape2);
}
if (!Face1.IsNull() && !Face2.IsNull())
CorrectSameParameter(anEdge, Face1, Face2);
Face2 = TopoDS::Face(myFaces->Value(i2, jj));
CorrectSameParameter(anEdge, Face1, Face2);
}
}
@@ -3277,27 +3266,10 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
BRepFill_TrimShellCorner aTrim(aFaces, Transition, AxeOfBisPlane);
aTrim.AddBounds(Bounds);
aTrim.AddUEdges(aUEdges);
aTrim.AddVEdges(myVEdges, Index);
aTrim.Perform();
if (aTrim.IsDone()) {
TopTools_ListOfShape listmodif;
for (ii = 1; ii <= mySec->NbLaw(); ii++)
{
listmodif.Clear();
aTrim.Modified(myVEdges->Value(ii, Index), listmodif);
if (listmodif.IsEmpty())
{
TopoDS_Edge NullEdge;
myVEdges->SetValue(ii, Index, NullEdge);
}
else
myVEdges->SetValue(ii, Index, listmodif.First());
}
listmodif.Clear();
Standard_Integer iit = 0;
for(iit = 0; iit < 2; iit++) {
@@ -3384,15 +3356,8 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
if (B) {
myAuxShape.Append(FF);
myVEdges->ChangeValue(ii, I2) = FF;
BRep_Builder BB;
TopoDS_Shape aVshape = myVEdges->Value(ii, I2);
TopoDS_Compound aCompound;
BB.MakeCompound(aCompound);
if (!aVshape.IsNull())
BB.Add(aCompound, aVshape);
BB.Add(aCompound, FF);
myVEdges->ChangeValue(ii, I2) = aCompound;
BB.Add(myTapes->ChangeValue(ii), FF);
HasFilling = Standard_True;
}

View File

@@ -91,11 +91,6 @@ static Standard_Boolean SplitUEdges(const Handle(TopTools_HArray2OfShape)& t
const BOPDS_PDS& theDS,
TopTools_DataMapOfShapeListOfShape& theHistMap);
static void StoreVedgeInHistMap(const Handle(TopTools_HArray1OfShape)& theVEdges,
const Standard_Integer theIndex,
const TopoDS_Shape& theNewVedge,
TopTools_DataMapOfShapeListOfShape& theHistMap);
static void FindFreeVertices(const TopoDS_Shape& theShape,
const TopTools_MapOfShape& theVerticesToAvoid,
TopTools_ListOfShape& theListOfVertex);
@@ -234,19 +229,6 @@ void BRepFill_TrimShellCorner::AddUEdges(const Handle(TopTools_HArray2OfShape)&
myUEdges->ChangeArray2() = theUEdges->Array2();
}
// ===========================================================================================
// function: AddVEdges
// purpose:
// ===========================================================================================
void BRepFill_TrimShellCorner::AddVEdges(const Handle(TopTools_HArray2OfShape)& theVEdges,
const Standard_Integer theIndex)
{
myVEdges = new TopTools_HArray1OfShape(theVEdges->LowerRow(), theVEdges->UpperRow());
for (Standard_Integer i = theVEdges->LowerRow(); i <= theVEdges->UpperRow(); i++)
myVEdges->SetValue(i, theVEdges->Value(i, theIndex));
}
// ===========================================================================================
// function: Perform
// purpose:
@@ -497,12 +479,9 @@ BRepFill_TrimShellCorner::MakeFacesNonSec(const Standard_Integer
aMapV.Add(aV);
aBB.Add(aComp, aUE);
}
if(bHasNewEdge) {
aBB.Add(aComp, aNewEdge);
StoreVedgeInHistMap(myVEdges, theIndex, aNewEdge, myHistMap);
}
TopTools_ListOfShape alonevertices;
FindFreeVertices(aComp, aMapV, alonevertices);
@@ -707,8 +686,6 @@ BRepFill_TrimShellCorner::MakeFacesSec(const Standard_Integer
for (; explo.More(); explo.Next())
BB.Add( aComp, explo.Current() );
aSecEdges = aComp;
StoreVedgeInHistMap(myVEdges, theIndex, SecWire, myHistMap);
}
TopTools_ListOfShape aCommonVertices;
@@ -1146,22 +1123,6 @@ Standard_Boolean SplitUEdges(const Handle(TopTools_HArray2OfShape)& theUEdge
return Standard_True;
}
// ------------------------------------------------------------------------------------------
// static function: StoreVedgeInHistMap
// purpose:
// ------------------------------------------------------------------------------------------
void StoreVedgeInHistMap(const Handle(TopTools_HArray1OfShape)& theVEdges,
const Standard_Integer theIndex,
const TopoDS_Shape& theNewVshape,
TopTools_DataMapOfShapeListOfShape& theHistMap)
{
//Replace default value in the map (v-iso edge of face)
//by intersection of two consecutive faces
const TopoDS_Shape& aVEdge = theVEdges->Value(theIndex);
theHistMap.Bound(aVEdge, TopTools_ListOfShape())->Append(theNewVshape);
}
// ------------------------------------------------------------------------------------------
// static function: FindFreeVertices
// purpose:

View File

@@ -26,7 +26,6 @@
#include <TopoDS_Wire.hxx>
#include <TopoDS_Face.hxx>
#include <TopTools_HArray2OfShape.hxx>
#include <TopTools_HArray1OfShape.hxx>
#include <Standard_Boolean.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
@@ -56,9 +55,6 @@ public:
Standard_EXPORT void AddUEdges (const Handle(TopTools_HArray2OfShape)& theUEdges);
Standard_EXPORT void AddVEdges (const Handle(TopTools_HArray2OfShape)& theVEdges,
const Standard_Integer theIndex);
Standard_EXPORT void Perform();
Standard_EXPORT Standard_Boolean IsDone() const;
@@ -103,7 +99,6 @@ private:
TopoDS_Shape myShape2;
Handle(TopTools_HArray2OfShape) myBounds;
Handle(TopTools_HArray2OfShape) myUEdges;
Handle(TopTools_HArray1OfShape) myVEdges;
Handle(TopTools_HArray2OfShape) myFaces;
Standard_Boolean myDone;
Standard_Boolean myHasSection;

View File

@@ -2706,23 +2706,18 @@ void BRepLib::ExtendFace(const TopoDS_Face& theF,
Standard_Real aSUMin, aSUMax, aSVMin, aSVMax;
aSurf->Bounds(aSUMin, aSUMax, aSVMin, aSVMax);
Standard_Boolean isUPeriodic = aBAS.IsUPeriodic();
Standard_Real anUPeriod = isUPeriodic ? aBAS.UPeriod() : 0.0;
if (isUPeriodic)
if (aBAS.IsUPeriodic())
{
// Adjust face bounds to first period
Standard_Real aDelta = aFUMax - aFUMin;
aFUMin = Max(aSUMin, aFUMin + anUPeriod*Ceiling((aSUMin - aFUMin) / anUPeriod));
aFUMin = Max(aSUMin, aFUMin + aBAS.UPeriod()*Ceiling((aSUMin - aFUMin)/aBAS.UPeriod()));
aFUMax = aFUMin + aDelta;
}
Standard_Boolean isVPeriodic = aBAS.IsVPeriodic();
Standard_Real aVPeriod = isVPeriodic ? aBAS.VPeriod() : 0.0;
if (isVPeriodic)
if (aBAS.IsVPeriodic())
{
// Adjust face bounds to first period
Standard_Real aDelta = aFVMax - aFVMin;
aFVMin = Max(aSVMin, aFVMin + aVPeriod*Ceiling((aSVMin - aFVMin) / aVPeriod));
aFVMin = Max(aSVMin, aFVMin + aBAS.VPeriod()*Ceiling((aSVMin - aFVMin)/aBAS.VPeriod()));
aFVMax = aFVMin + aDelta;
}
@@ -2734,23 +2729,9 @@ void BRepLib::ExtendFace(const TopoDS_Face& theF,
aVRes = aBAS.VResolution(theExtVal);
if (theExtUMin) aFUMin = Max(aSUMin, aFUMin - anURes);
if (theExtUMax) aFUMax = Min(isUPeriodic ? aFUMin + anUPeriod : aSUMax, aFUMax + anURes);
if (theExtUMax) aFUMax = Min(aSUMax, aFUMax + anURes);
if (theExtVMin) aFVMin = Max(aSVMin, aFVMin - aVRes);
if (theExtVMax) aFVMax = Min(isVPeriodic ? aFVMin + aVPeriod : aSVMax, aFVMax + aVRes);
// Check if the periodic surface should become closed.
// In this case, use the basis surface with basis bounds.
const Standard_Real anEps = Precision::PConfusion();
if (isUPeriodic && Abs(aFUMax - aFUMin - anUPeriod) < anEps)
{
aFUMin = aSUMin;
aFUMax = aSUMax;
}
if (isVPeriodic && Abs(aFVMax - aFVMin - aVPeriod) < anEps)
{
aFVMin = aSVMin;
aFVMax = aSVMax;
}
if (theExtVMax) aFVMax = Min(aSVMax, aFVMax + aVRes);
aS = aSurf;
}

View File

@@ -101,8 +101,7 @@ static Standard_Boolean findNearestValidPoint(
// cycle to go out of local singularity
gp_Vec aD1;
theCurve.D1(anUOut, aP, aD1);
isOut = (aP.SquareDistance(theVertPnt) > aSqTol);
if (!isOut && aD1.SquareMagnitude() < aD1Mag)
if (aD1.SquareMagnitude() < aD1Mag)
{
aStepLocal *= 2.;
anUOut += aStepLocal;
@@ -158,10 +157,8 @@ Standard_Boolean BRepLib::FindValidRange
{
if (theParV2 - theParV1 < Precision::PConfusion())
return Standard_False;
Standard_Real anEps = Max(Max(theCurve.Resolution(theTolE) * 0.1,
Epsilon(Max(Abs(theParV1), Abs(theParV2)))),
Precision::PConfusion());
Standard_Real anEps = Max(theCurve.Resolution(theTolE) * 0.1, Precision::PConfusion());
if (Precision::IsInfinite(theParV1))
theFirst = theParV1;

View File

@@ -267,11 +267,7 @@ public:
myPipe->Profiles(theProfiles);
}
//! Returns the spine
const TopoDS_Wire& Spine()
{
return myPipe->Spine();
}
protected:

View File

@@ -779,11 +779,9 @@ static Standard_Integer buildsweep(Draw_Interpretor& di,
// Save history of sweep
if (BRepTest_Objects::IsHistoryNeeded())
{
TopTools_ListOfShape aList;
Sweep->Profiles(aList);
TopoDS_Shape aSpine = Sweep->Spine();
aList.Append(aSpine);
BRepTest_Objects::SetHistory(aList, *Sweep);
TopTools_ListOfShape aProfiles;
Sweep->Profiles(aProfiles);
BRepTest_Objects::SetHistory(aProfiles, *Sweep);
}
}

View File

@@ -105,19 +105,15 @@ template class BVH_QuickSorter<Standard_Real, 4>;
template class BVH_QuickSorter<Standard_ShortReal, 3>;
template class BVH_QuickSorter<Standard_ShortReal, 4>;
template class BVH_RadixSorter<Standard_Real, 2>;
template class BVH_RadixSorter<Standard_Real, 3>;
template class BVH_RadixSorter<Standard_Real, 4>;
template class BVH_RadixSorter<Standard_ShortReal, 2>;
template class BVH_RadixSorter<Standard_ShortReal, 3>;
template class BVH_RadixSorter<Standard_ShortReal, 4>;
template class BVH_LinearBuilder<Standard_Real, 2>;
template class BVH_LinearBuilder<Standard_Real, 3>;
template class BVH_LinearBuilder<Standard_Real, 4>;
template class BVH_LinearBuilder<Standard_ShortReal, 2>;
template class BVH_LinearBuilder<Standard_ShortReal, 3>;
template class BVH_LinearBuilder<Standard_ShortReal, 4>;

View File

@@ -308,7 +308,7 @@ void BVH_LinearBuilder<T, N>::Build (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
const BVH_Box<T, N>& theBox) const
{
Standard_STATIC_ASSERT (N == 2 || N == 3 || N == 4);
Standard_STATIC_ASSERT (N == 3 || N == 4);
const Standard_Integer aSetSize = theSet->Size();
if (theBVH == NULL || aSetSize == 0)
{

View File

@@ -173,18 +173,18 @@ namespace BVH
template<class T, int N>
void BVH_RadixSorter<T, N>::Perform (BVH_Set<T, N>* theSet, const Standard_Integer theStart, const Standard_Integer theFinal)
{
Standard_STATIC_ASSERT (N == 2 || N == 3 || N == 4);
Standard_STATIC_ASSERT (N == 3 || N == 4);
const Standard_Integer aDimension = 1024;
const Standard_Integer aNbEffComp = N == 2 ? 2 : 3; // 4th component is ignored
const Standard_Integer aDimensionX = 1024;
const Standard_Integer aDimensionY = 1024;
const Standard_Integer aDimensionZ = 1024;
const BVH_VecNt aSceneMin = myBox.CornerMin();
const BVH_VecNt aSceneMax = myBox.CornerMax();
BVH_VecNt aNodeMinSizeVecT (static_cast<T>(BVH::THE_NODE_MIN_SIZE));
BVH::BoxMinMax<T, N>::CwiseMax (aNodeMinSizeVecT, aSceneMax - aSceneMin);
const BVH_VecNt aReverseSize = BVH_VecNt (static_cast<T>(aDimension)) / aNodeMinSizeVecT;
const T aReverseSizeX = static_cast<T> (aDimensionX) / Max (static_cast<T> (BVH::THE_NODE_MIN_SIZE), aSceneMax.x() - aSceneMin.x());
const T aReverseSizeY = static_cast<T> (aDimensionY) / Max (static_cast<T> (BVH::THE_NODE_MIN_SIZE), aSceneMax.y() - aSceneMin.y());
const T aReverseSizeZ = static_cast<T> (aDimensionZ) / Max (static_cast<T> (BVH::THE_NODE_MIN_SIZE), aSceneMax.z() - aSceneMin.z());
myEncodedLinks = new NCollection_Shared<NCollection_Array1<BVH_EncodedLink> >(theStart, theFinal);
@@ -192,24 +192,32 @@ void BVH_RadixSorter<T, N>::Perform (BVH_Set<T, N>* theSet, const Standard_Integ
for (Standard_Integer aPrimIdx = theStart; aPrimIdx <= theFinal; ++aPrimIdx)
{
const BVH_VecNt aCenter = theSet->Box (aPrimIdx).Center();
const BVH_VecNt aVoxelF = (aCenter - aSceneMin) * aReverseSize;
Standard_Integer aMortonCode = 0;
for (Standard_Integer aCompIter = 0; aCompIter < aNbEffComp; ++aCompIter)
{
Standard_Integer aVoxel = BVH::IntFloor (BVH::VecComp<T, N>::Get (aVoxelF, aCompIter));
Standard_Integer aVoxelX = BVH::IntFloor ((aCenter.x() - aSceneMin.x()) * aReverseSizeX);
Standard_Integer aVoxelY = BVH::IntFloor ((aCenter.y() - aSceneMin.y()) * aReverseSizeY);
Standard_Integer aVoxelZ = BVH::IntFloor ((aCenter.z() - aSceneMin.z()) * aReverseSizeZ);
aVoxel = Max (0, Min (aVoxel, aDimension - 1));
aVoxelX = Max (0, Min (aVoxelX, aDimensionX - 1));
aVoxelY = Max (0, Min (aVoxelY, aDimensionY - 1));
aVoxelZ = Max (0, Min (aVoxelZ, aDimensionZ - 1));
aVoxel = (aVoxel | (aVoxel << 16)) & 0x030000FF;
aVoxel = (aVoxel | (aVoxel << 8)) & 0x0300F00F;
aVoxel = (aVoxel | (aVoxel << 4)) & 0x030C30C3;
aVoxel = (aVoxel | (aVoxel << 2)) & 0x09249249;
aVoxelX = (aVoxelX | (aVoxelX << 16)) & 0x030000FF;
aVoxelX = (aVoxelX | (aVoxelX << 8)) & 0x0300F00F;
aVoxelX = (aVoxelX | (aVoxelX << 4)) & 0x030C30C3;
aVoxelX = (aVoxelX | (aVoxelX << 2)) & 0x09249249;
aMortonCode |= (aVoxel << aCompIter);
}
aVoxelY = (aVoxelY | (aVoxelY << 16)) & 0x030000FF;
aVoxelY = (aVoxelY | (aVoxelY << 8)) & 0x0300F00F;
aVoxelY = (aVoxelY | (aVoxelY << 4)) & 0x030C30C3;
aVoxelY = (aVoxelY | (aVoxelY << 2)) & 0x09249249;
myEncodedLinks->ChangeValue (aPrimIdx) = BVH_EncodedLink (aMortonCode, aPrimIdx);
aVoxelZ = (aVoxelZ | (aVoxelZ << 16)) & 0x030000FF;
aVoxelZ = (aVoxelZ | (aVoxelZ << 8)) & 0x0300F00F;
aVoxelZ = (aVoxelZ | (aVoxelZ << 4)) & 0x030C30C3;
aVoxelZ = (aVoxelZ | (aVoxelZ << 2)) & 0x09249249;
myEncodedLinks->ChangeValue (aPrimIdx) = BVH_EncodedLink (
aVoxelX | (aVoxelY << 1) | (aVoxelZ << 2), aPrimIdx);
}
// Step 2 -- Sort primitives by their Morton codes using radix sort

View File

@@ -106,4 +106,14 @@ void BinDrivers_DocumentRetrievalDriver::Clear()
BinLDrivers_DocumentRetrievalDriver::Clear();
}
//=======================================================================
//function : PropagateDocumentVersion
//purpose :
//=======================================================================
void BinDrivers_DocumentRetrievalDriver::PropagateDocumentVersion(
const Standard_Integer theDocVersion )
{
BinMDataStd::SetDocumentVersion(theDocVersion);
BinMNaming::SetDocumentVersion(theDocVersion);
}

View File

@@ -50,6 +50,10 @@ public:
//! Clears the NamedShape driver
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
Standard_EXPORT virtual void PropagateDocumentVersion (const Standard_Integer theVersion) Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinDrivers_DocumentRetrievalDriver,BinLDrivers_DocumentRetrievalDriver)

View File

@@ -215,7 +215,11 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
myMsgDriver->Send (aTypeNames(i), Message_Warning);
}
// propagate the opened document version to data drivers
PropagateDocumentVersion(aFileVer);
// 2. Read document contents
// 2a. Retrieve data from the stream:
myRelocTable.Clear();
myRelocTable.SetHeaderData(aHeaderData);
@@ -228,7 +232,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
if (aFileVer >= 3) {
BinLDrivers_DocumentSection aSection;
do {
BinLDrivers_DocumentSection::ReadTOC (aSection, theIStream, aFileVer);
BinLDrivers_DocumentSection::ReadTOC (aSection, theIStream);
mySections.Append(aSection);
} while(!aSection.Name().IsEqual((Standard_CString)SHAPESECTION_POS) && !theIStream.eof());
@@ -334,7 +338,7 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
const TDF_Label& theLabel)
{
Standard_Integer nbRead = 0;
TCollection_ExtendedString aMethStr
static TCollection_ExtendedString aMethStr
("BinLDrivers_DocumentRetrievalDriver: ");
// Read attributes:
@@ -507,6 +511,15 @@ void BinLDrivers_DocumentRetrievalDriver::Clear()
myMapUnsupported.Clear();
}
//=======================================================================
//function : PropagateDocumentVersion
//purpose :
//=======================================================================
void BinLDrivers_DocumentRetrievalDriver::PropagateDocumentVersion(const Standard_Integer theDocVersion )
{
BinMDataStd::SetDocumentVersion(theDocVersion);
}
//=======================================================================
//function : CheckDocumentVersion
//purpose :

View File

@@ -91,6 +91,9 @@ protected:
//! clears the reading-cash data in drivers if any.
Standard_EXPORT virtual void Clear();
//! provides the version of document to all drivers
Standard_EXPORT virtual void PropagateDocumentVersion (const Standard_Integer theVersion);
//! Check a file version(in which file was written) with a current version.
//! Redefining this method is a chance for application to read files

View File

@@ -185,8 +185,7 @@ void BinLDrivers_DocumentSection::Write (Standard_OStream& theStream,
void BinLDrivers_DocumentSection::ReadTOC
(BinLDrivers_DocumentSection& theSection,
Standard_IStream& theStream,
const Standard_Integer theDocFormatVersion)
Standard_IStream& theStream)
{
char aBuf[512];
Standard_Integer aNameBufferSize;
@@ -199,7 +198,7 @@ void BinLDrivers_DocumentSection::ReadTOC
theSection.myName = (Standard_CString)&aBuf[0];
uint64_t aValue[3];
if (theDocFormatVersion <= 9)
if (BinMDataStd::DocumentVersion() <= 9)
{
// Old documents stored file position as 4-bytes values.
Standard_Integer aValInt[3];

View File

@@ -72,8 +72,7 @@ public:
//! Fill a DocumentSection instance from the data that are read
//! from TOC.
Standard_EXPORT static void ReadTOC (BinLDrivers_DocumentSection& theSection, Standard_IStream& theIS,
const Standard_Integer theDocFormatVersion);
Standard_EXPORT static void ReadTOC (BinLDrivers_DocumentSection& theSection, Standard_IStream& theIS);

View File

@@ -187,7 +187,7 @@ void BinLDrivers_DocumentStorageDriver::UnsupportedAttrMsg
(const Handle(Standard_Type)& theType)
{
#ifdef OCCT_DEBUG
TCollection_ExtendedString aMsg
static TCollection_ExtendedString aMsg
("BinDrivers_DocumentStorageDriver: warning: attribute driver for type ");
#endif
if (!myMapUnsupported.Contains(theType)) {

View File

@@ -44,6 +44,7 @@
#include <BinMDF_ADriverTable.hxx>
#include <Message_Messenger.hxx>
static Standard_Integer myDocumentVersion = -1;
//=======================================================================
//function : AddDrivers
//purpose :
@@ -80,3 +81,20 @@ void BinMDataStd::AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable,
theDriverTable->AddDriver (new BinMDataStd_AsciiStringDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntPackedMapDriver (theMsgDriver) );
}
//=======================================================================
//function : SetDocumentVersion
//purpose : Sets current document version
//=======================================================================
void BinMDataStd::SetDocumentVersion(const Standard_Integer theVersion)
{
myDocumentVersion = theVersion;
}
//=======================================================================
//function : DocumentVersion
//purpose : Retrieved document version
//=======================================================================
Standard_Integer BinMDataStd::DocumentVersion()
{
return myDocumentVersion;
}

View File

@@ -25,6 +25,32 @@
class BinMDF_ADriverTable;
class Message_Messenger;
class BinMDataStd_NameDriver;
class BinMDataStd_IntegerDriver;
class BinMDataStd_RealDriver;
class BinMDataStd_IntegerArrayDriver;
class BinMDataStd_RealArrayDriver;
class BinMDataStd_UAttributeDriver;
class BinMDataStd_DirectoryDriver;
class BinMDataStd_CommentDriver;
class BinMDataStd_VariableDriver;
class BinMDataStd_ExpressionDriver;
class BinMDataStd_RelationDriver;
class BinMDataStd_NoteBookDriver;
class BinMDataStd_TreeNodeDriver;
class BinMDataStd_ExtStringArrayDriver;
class BinMDataStd_TickDriver;
class BinMDataStd_AsciiStringDriver;
class BinMDataStd_IntPackedMapDriver;
class BinMDataStd_IntegerListDriver;
class BinMDataStd_RealListDriver;
class BinMDataStd_ExtStringListDriver;
class BinMDataStd_BooleanListDriver;
class BinMDataStd_ReferenceListDriver;
class BinMDataStd_BooleanArrayDriver;
class BinMDataStd_ReferenceArrayDriver;
class BinMDataStd_ByteArrayDriver;
class BinMDataStd_NamedDataDriver;
//! Storage and Retrieval drivers for modelling attributes.
class BinMDataStd
@@ -36,12 +62,16 @@ public:
//! Adds the attribute drivers to <theDriverTable>.
Standard_EXPORT static void AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable, const Handle(Message_Messenger)& aMsgDrv);
Standard_EXPORT static void SetDocumentVersion (const Standard_Integer DocVersion);
Standard_EXPORT static Standard_Integer DocumentVersion();
template<class T>
static void SetAttributeID(const BinObjMgt_Persistent& theSource, const Handle(T)& anAtt, const Standard_Integer aDocFormatVersion)
static void SetAttributeID(const BinObjMgt_Persistent& theSource, const Handle(T)& anAtt)
{
Standard_Boolean ok = Standard_True;
if(aDocFormatVersion > 9) { // process user defined guid
if(BinMDataStd::DocumentVersion() > 9) { // process user defined guid
const Standard_Integer& aPos = theSource.Position();
Standard_GUID aGuid;
ok = theSource >> aGuid;

View File

@@ -55,14 +55,14 @@ Handle(TDF_Attribute) BinMDataStd_AsciiStringDriver::NewEmpty() const
Standard_Boolean BinMDataStd_AsciiStringDriver::Paste
(const BinObjMgt_Persistent& Source,
const Handle(TDF_Attribute)& Target,
BinObjMgt_RRelocationTable& RelocTable) const
BinObjMgt_RRelocationTable& /*RelocTable*/) const
{
Handle(TDataStd_AsciiString) aStrAtt = Handle(TDataStd_AsciiString)::DownCast(Target);
TCollection_AsciiString aString;
Standard_Boolean ok = Source >> aString;
if (ok)
aStrAtt->Set( aString );
if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
if(BinMDataStd::DocumentVersion() > 8) { // process user defined guid
const Standard_Integer& aPos = Source.Position();
Standard_GUID aGuid;
ok = Source >> aGuid;

View File

@@ -51,7 +51,7 @@ Handle(TDF_Attribute) BinMDataStd_BooleanArrayDriver::NewEmpty() const
//=======================================================================
Standard_Boolean BinMDataStd_BooleanArrayDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
@@ -71,7 +71,7 @@ Standard_Boolean BinMDataStd_BooleanArrayDriver::Paste(const BinObjMgt_Persisten
bytes->SetValue(i, aTargetArray.Value(i));
}
anAtt->SetInternalArray(bytes);
BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}

View File

@@ -51,7 +51,7 @@ Handle(TDF_Attribute) BinMDataStd_BooleanListDriver::NewEmpty() const
//=======================================================================
Standard_Boolean BinMDataStd_BooleanListDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aIndex, aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
@@ -71,7 +71,7 @@ Standard_Boolean BinMDataStd_BooleanListDriver::Paste(const BinObjMgt_Persistent
}
}
BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}
@@ -101,4 +101,4 @@ void BinMDataStd_BooleanListDriver::Paste(const Handle(TDF_Attribute)& theSource
// process user defined guid
if(anAtt->ID() != TDataStd_BooleanList::GetID())
theTarget << anAtt->ID();
}
}

View File

@@ -51,7 +51,7 @@ Handle(TDF_Attribute) BinMDataStd_ByteArrayDriver::NewEmpty() const
//=======================================================================
Standard_Boolean BinMDataStd_ByteArrayDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
@@ -71,7 +71,7 @@ Standard_Boolean BinMDataStd_ByteArrayDriver::Paste(const BinObjMgt_Persistent&
anAtt->ChangeArray(bytes);
Standard_Boolean aDelta(Standard_False);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(BinMDataStd::DocumentVersion() > 2) {
Standard_Byte aDeltaValue;
if (! (theSource >> aDeltaValue))
return Standard_False;
@@ -80,7 +80,7 @@ Standard_Boolean BinMDataStd_ByteArrayDriver::Paste(const BinObjMgt_Persistent&
}
anAtt->SetDelta(aDelta);
BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}

View File

@@ -54,7 +54,7 @@ Handle(TDF_Attribute) BinMDataStd_ExtStringArrayDriver::NewEmpty() const
Standard_Boolean BinMDataStd_ExtStringArrayDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
@@ -81,7 +81,7 @@ Standard_Boolean BinMDataStd_ExtStringArrayDriver::Paste
if(ok) {
Standard_Boolean aDelta(Standard_False);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(BinMDataStd::DocumentVersion() > 2) {
Standard_Byte aDeltaValue;
if (! (theSource >> aDeltaValue)) {
return Standard_False;
@@ -92,7 +92,7 @@ Standard_Boolean BinMDataStd_ExtStringArrayDriver::Paste
anAtt->SetDelta(aDelta);
}
BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
BinMDataStd::SetAttributeID(theSource, anAtt);
return ok;
}

View File

@@ -52,7 +52,7 @@ Handle(TDF_Attribute) BinMDataStd_ExtStringListDriver::NewEmpty() const
Standard_Boolean BinMDataStd_ExtStringListDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
@@ -74,7 +74,7 @@ Standard_Boolean BinMDataStd_ExtStringListDriver::Paste
}
}
BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}

View File

@@ -59,7 +59,7 @@ Handle(TDF_Attribute) BinMDataStd_IntPackedMapDriver::NewEmpty() const
Standard_Boolean BinMDataStd_IntPackedMapDriver::Paste
(const BinObjMgt_Persistent& Source,
const Handle(TDF_Attribute)& Target,
BinObjMgt_RRelocationTable& RelocTable) const
BinObjMgt_RRelocationTable& /*RelocTable*/) const
{
Handle(TDataStd_IntPackedMap) aTagAtt = Handle(TDataStd_IntPackedMap)::DownCast(Target);
if(aTagAtt.IsNull()) {
@@ -87,7 +87,7 @@ Standard_Boolean BinMDataStd_IntPackedMapDriver::Paste
}
Standard_Boolean aDelta(Standard_False);
if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(BinMDataStd::DocumentVersion() > 2) {
Standard_Byte aDeltaValue;
if (! (Source >> aDeltaValue))
return Standard_False;

View File

@@ -53,7 +53,7 @@ Handle(TDF_Attribute) BinMDataStd_IntegerArrayDriver::NewEmpty() const
Standard_Boolean BinMDataStd_IntegerArrayDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
@@ -69,7 +69,7 @@ Standard_Boolean BinMDataStd_IntegerArrayDriver::Paste
if(!theSource.GetIntArray (&aTargetArray(aFirstInd), aLength))
return Standard_False;
Standard_Boolean aDelta(Standard_False);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(BinMDataStd::DocumentVersion() > 2) {
Standard_Byte aDeltaValue;
if (! (theSource >> aDeltaValue))
return Standard_False;
@@ -77,11 +77,12 @@ Standard_Boolean BinMDataStd_IntegerArrayDriver::Paste
aDelta = (aDeltaValue != 0);
}
#ifdef OCCT_DEBUG
//cout << "Current Document Format Version = " << theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() <<endl;
else if(BinMDataStd::DocumentVersion() == -1)
cout << "Current DocVersion field is not initialized. " <<endl;
#endif
anAtt->SetDelta(aDelta);
BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}

View File

@@ -52,14 +52,14 @@ Handle(TDF_Attribute) BinMDataStd_IntegerDriver::NewEmpty() const
Standard_Boolean BinMDataStd_IntegerDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRT) const
BinObjMgt_RRelocationTable& ) const
{
Handle(TDataStd_Integer) anAtt = Handle(TDataStd_Integer)::DownCast(theTarget);
Standard_Integer aValue;
Standard_Boolean ok = theSource >> aValue;
if (ok)
anAtt->Set(aValue);
if(theRT.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
if(BinMDataStd::DocumentVersion() > 8) { // process user defined guid
const Standard_Integer& aPos = theSource.Position();
Standard_GUID aGuid;
ok = theSource >> aGuid;

View File

@@ -51,7 +51,7 @@ Handle(TDF_Attribute) BinMDataStd_IntegerListDriver::NewEmpty() const
//=======================================================================
Standard_Boolean BinMDataStd_IntegerListDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aIndex, aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
@@ -67,7 +67,7 @@ Standard_Boolean BinMDataStd_IntegerListDriver::Paste(const BinObjMgt_Persistent
}
}
BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}

View File

@@ -52,14 +52,14 @@ Handle(TDF_Attribute) BinMDataStd_NameDriver::NewEmpty() const
Standard_Boolean BinMDataStd_NameDriver::Paste
(const BinObjMgt_Persistent& Source,
const Handle(TDF_Attribute)& Target,
BinObjMgt_RRelocationTable& RelocTable) const
BinObjMgt_RRelocationTable& /*RelocTable*/) const
{
Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(Target);
TCollection_ExtendedString aStr;
Standard_Boolean ok = Source >> aStr;
if (ok)
aName->Set( aStr );
if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
if(BinMDataStd::DocumentVersion() > 8) { // process user defined guid
const Standard_Integer& aPos = Source.Position();
Standard_GUID aGuid;
ok = Source >> aGuid;

View File

@@ -53,7 +53,7 @@ Handle(TDF_Attribute) BinMDataStd_RealArrayDriver::NewEmpty() const
Standard_Boolean BinMDataStd_RealArrayDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
@@ -70,7 +70,7 @@ Standard_Boolean BinMDataStd_RealArrayDriver::Paste
return Standard_False;
Standard_Boolean aDelta(Standard_False);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(BinMDataStd::DocumentVersion() > 2) {
Standard_Byte aDeltaValue;
if (! (theSource >> aDeltaValue))
return Standard_False;
@@ -79,7 +79,7 @@ Standard_Boolean BinMDataStd_RealArrayDriver::Paste
}
anAtt->SetDelta(aDelta);
BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}

View File

@@ -52,14 +52,14 @@ Handle(TDF_Attribute) BinMDataStd_RealDriver::NewEmpty() const
Standard_Boolean BinMDataStd_RealDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
BinObjMgt_RRelocationTable& ) const
{
Handle(TDataStd_Real) anAtt= Handle(TDataStd_Real)::DownCast(theTarget);
Standard_Real aValue;
Standard_Boolean ok = theSource >> aValue;
if (ok)
anAtt->Set(aValue);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
if(BinMDataStd::DocumentVersion() > 8) { // process user defined guid
const Standard_Integer& aPos = theSource.Position();
Standard_GUID aGuid;
ok = theSource >> aGuid;

View File

@@ -51,7 +51,7 @@ Handle(TDF_Attribute) BinMDataStd_RealListDriver::NewEmpty() const
//=======================================================================
Standard_Boolean BinMDataStd_RealListDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aIndex, aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
@@ -68,7 +68,7 @@ Standard_Boolean BinMDataStd_RealListDriver::Paste(const BinObjMgt_Persistent&
}
}
BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}

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