mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2a6b327cbb | ||
|
2eec394698 |
@@ -633,26 +633,6 @@ else()
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
|
||||
endif()
|
||||
|
||||
# RapidJSON
|
||||
# search for CSF_RapidJSON variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_RapidJSON CAN_USE_RAPIDJSON)
|
||||
if (CAN_USE_RAPIDJSON)
|
||||
set (USE_RAPIDJSON OFF CACHE BOOL "${USE_RAPIDJSON_DESCR}")
|
||||
|
||||
if (USE_RAPIDJSON)
|
||||
add_definitions (-DHAVE_RAPIDJSON)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/rapidjson")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_RAPIDJSON")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_RAPIDJSON")
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_RAPIDJSON")
|
||||
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_RAPIDJSON")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_RAPIDJSON")
|
||||
endif()
|
||||
|
||||
# EIGEN
|
||||
if (CAN_USE_EIGEN)
|
||||
set (USE_EIGEN OFF CACHE BOOL "${USE_EIGEN_DESCR}")
|
||||
|
@@ -3,5 +3,5 @@ ModelingData TKG2d TKG3d TKGeomBase TKBRep
|
||||
ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
|
||||
Visualization TKService TKV3d TKOpenGl TKMeshVS TKIVtk TKD3DHost
|
||||
ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF
|
||||
DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh
|
||||
DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF
|
||||
Draw TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
|
||||
|
@@ -439,7 +439,3 @@ n Geom2dEvaluator
|
||||
t TKVCAF
|
||||
n XCAFView
|
||||
n XCAFNoteObjects
|
||||
t TKRWMesh
|
||||
n RWGltf
|
||||
n RWMesh
|
||||
n RWObj
|
||||
|
@@ -133,7 +133,7 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
|
||||
# set 3RDPARTY_${PRODUCT_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_LIBRARY
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} "3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" FORCE)
|
||||
|
||||
if ((3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}") OR (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME}}"))
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
|
||||
find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} NAMES ${LIBRARY_NAME}
|
||||
PATHS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME}}" "${3RDPARTY_${PRODUCT_NAME}_DIR}"
|
||||
PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
|
||||
@@ -181,9 +181,9 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
|
||||
# set 3RDPARTY_${PRODUCT_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_DLL
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} "3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"" FORCE)
|
||||
|
||||
if ((3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}") OR (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME}}"))
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
|
||||
find_library (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} NAMES ${LIBRARY_NAME}
|
||||
PATHS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME}}" "${3RDPARTY_${PRODUCT_NAME}_DIR}"
|
||||
PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}"
|
||||
PATH_SUFFIXES bin win${COMPILER_BITNESS}/${COMPILER}/bin
|
||||
NO_DEFAULT_PATH)
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} STREQUAL "3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}-NOTFOUND")
|
||||
|
@@ -73,35 +73,28 @@ if (WIN32)
|
||||
set (CSF_OpenGlLibs "opengl32.lib")
|
||||
endif()
|
||||
|
||||
else()
|
||||
else()
|
||||
|
||||
if (APPLE)
|
||||
set (CSF_objc "objc")
|
||||
|
||||
# frameworks
|
||||
if (IOS)
|
||||
find_library (Appkit_LIB NAMES UIKit)
|
||||
set (CSF_Appkit ${Appkit_LIB})
|
||||
else()
|
||||
find_library (Appkit_LIB NAMES AppKit)
|
||||
set (CSF_Appkit ${Appkit_LIB})
|
||||
endif()
|
||||
OCCT_CHECK_AND_UNSET (Appkit_LIB)
|
||||
find_library (Appkit_LIB NAMES AppKit)
|
||||
set (CSF_Appkit ${Appkit_LIB})
|
||||
|
||||
find_library (IOKit_LIB NAMES IOKit)
|
||||
set (CSF_IOKit ${IOKit_LIB})
|
||||
|
||||
OCCT_CHECK_AND_UNSET (Appkit_LIB)
|
||||
OCCT_CHECK_AND_UNSET (IOKit_LIB)
|
||||
|
||||
if (IOS)
|
||||
find_library (OpenGlLibs_LIB NAMES OpenGLES)
|
||||
set (CSF_OpenGlLibs ${OpenGlLibs_LIB})
|
||||
OCCT_CHECK_AND_UNSET (OpenGlLibs_LIB)
|
||||
elseif (USE_GLX)
|
||||
if (USE_GLX)
|
||||
set (CSF_OpenGlLibs GL)
|
||||
set (CSF_XwLibs "X11 Xext Xmu Xi")
|
||||
else()
|
||||
find_library (OpenGlLibs_LIB NAMES OpenGL)
|
||||
set (CSF_OpenGlLibs ${OpenGlLibs_LIB})
|
||||
|
||||
OCCT_CHECK_AND_UNSET (OpenGlLibs_LIB)
|
||||
endif()
|
||||
|
||||
@@ -117,6 +110,5 @@ else()
|
||||
endif()
|
||||
set (CSF_XwLibs "X11 Xext Xmu Xi")
|
||||
set (CSF_dl "dl")
|
||||
set (CSF_fontconfig "fontconfig")
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -163,18 +163,13 @@ function (FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
|
||||
OCCT_MAKE_COMPILER_BITNESS()
|
||||
|
||||
string (TOLOWER "${PRODUCT_NAME}" lower_PRODUCT_NAME)
|
||||
if ("${lower_PRODUCT_NAME}" STREQUAL "egl")
|
||||
string (SUBSTRING "${lower_PRODUCT_NAME}" 1 -1 lower_PRODUCT_NAME)
|
||||
list (APPEND SEARCH_TEMPLATES "[^gl]+${lower_PRODUCT_NAME}.*")
|
||||
else()
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*${COMPILER}.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[a-zA-Z]*[0-9]*-${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*")
|
||||
endif()
|
||||
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*${COMPILER}.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*")
|
||||
|
||||
SUBDIRECTORY_NAMES ("${ROOT_DIR}" SUBDIR_NAME_LIST)
|
||||
|
||||
|
@@ -1,86 +0,0 @@
|
||||
# RapidJSON
|
||||
|
||||
if (NOT DEFINED INSTALL_RAPIDJSON)
|
||||
set (INSTALL_RAPIDJSON OFF CACHE BOOL "${INSTALL_RAPIDJSON_DESCR}")
|
||||
endif()
|
||||
|
||||
# RapidJSON directory
|
||||
if (NOT DEFINED 3RDPARTY_RAPIDJSON_DIR)
|
||||
set (3RDPARTY_RAPIDJSON_DIR "" CACHE PATH "The directory containing RapidJSON")
|
||||
endif()
|
||||
|
||||
# search for RapidJSON in user defined directory
|
||||
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
|
||||
if (NOT 3RDPARTY_RAPIDJSON_DIR OR NOT EXISTS "${3RDPARTY_RAPIDJSON_DIR}")
|
||||
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" RapidJSON RAPIDJSON_DIR_NAME)
|
||||
if (RAPIDJSON_DIR_NAME)
|
||||
set (3RDPARTY_RAPIDJSON_DIR "${3RDPARTY_DIR}/${RAPIDJSON_DIR_NAME}" CACHE PATH "The directory containing RapidJSON" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_RAPIDJSON_INCLUDE_DIR)
|
||||
set (3RDPARTY_RAPIDJSON_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of the RAPIDJSON")
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_RAPIDJSON_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_RAPIDJSON_INCLUDE_DIR}")
|
||||
|
||||
set (HEADER_NAMES rapidjson/rapidjson.h)
|
||||
|
||||
set (3RDPARTY_RAPIDJSON_INCLUDE_DIR "3RDPARTY_RAPIDJSON_INCLUDE_DIR-NOTFOUND" CACHE PATH "the path to RapidJSON header file" FORCE)
|
||||
|
||||
if (3RDPARTY_RAPIDJSON_DIR AND EXISTS "${3RDPARTY_RAPIDJSON_DIR}")
|
||||
find_path (3RDPARTY_RAPIDJSON_INCLUDE_DIR NAMES ${HEADER_NAMES}
|
||||
PATHS ${3RDPARTY_RAPIDJSON_DIR}
|
||||
PATH_SUFFIXES include rapidjson
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_path (3RDPARTY_RAPIDJSON_INCLUDE_DIR NAMES ${HEADER_NAMES}
|
||||
PATH_SUFFIXES include rapidjson
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
|
||||
# use default (CMake) RapidJSON search
|
||||
if (NOT 3RDPARTY_RAPIDJSON_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_RAPIDJSON_INCLUDE_DIR}")
|
||||
if (3RDPARTY_RAPIDJSON_DIR AND EXISTS "${3RDPARTY_RAPIDJSON_DIR}")
|
||||
set (CACHED_RAPIDJSON_DIR $ENV{RapidJSON_DIR})
|
||||
set (ENV{RapidJSON_DIR} "${3RDPARTY_RAPIDJSON_DIR}")
|
||||
endif()
|
||||
|
||||
find_package(RapidJSON QUIET)
|
||||
|
||||
# restore ENV{RapidJSON_DIR}
|
||||
if (3RDPARTY_RAPIDJSON_DIR AND EXISTS "${3RDPARTY_RAPIDJSON_DIR}")
|
||||
set (ENV{RapidJSON_DIR} ${CACHED_RAPIDJSON_DIR})
|
||||
endif()
|
||||
|
||||
if (${RAPIDJSON_FOUND})
|
||||
set (3RDPARTY_RAPIDJSON_INCLUDE_DIR "${RAPIDJSON_INCLUDE_DIR}" CACHE PATH "the path to RapidJSON header file" FORCE)
|
||||
set (3RDPARTY_RAPIDJSON_DIR "${RAPIDJSON_ROOT_DIR}" CACHE PATH "The directory containing RapidJSON" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_RAPIDJSON_INCLUDE_DIR AND EXISTS "${3RDPARTY_RAPIDJSON_INCLUDE_DIR}")
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_RAPIDJSON_INCLUDE_DIR}")
|
||||
|
||||
# Install header files
|
||||
if (INSTALL_RAPIDJSON)
|
||||
file(GLOB RAPIDJSON_SUBDIRS "${3RDPARTY_RAPIDJSON_INCLUDE_DIR}/*")
|
||||
foreach(SUBDIR ${RAPIDJSON_SUBDIRS})
|
||||
if(IS_DIRECTORY "${SUBDIR}")
|
||||
install (DIRECTORY "${SUBDIR}" DESTINATION "${INSTALL_DIR_INCLUDE}")
|
||||
else()
|
||||
install (FILES "${SUBDIR}" DESTINATION "${INSTALL_DIR_INCLUDE}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_RAPIDJSON_INCLUDE_DIR)
|
||||
|
||||
set (3RDPARTY_RAPIDJSON_INCLUDE_DIR "" CACHE PATH "the path to RapidJSON header file" FORCE)
|
||||
endif()
|
||||
|
||||
# unset all redundant variables
|
||||
OCCT_CHECK_AND_UNSET(RapidJSON_DIR)
|
@@ -94,7 +94,6 @@ INSTALL_MESSAGE (INSTALL_EGL "EGL binaries")
|
||||
INSTALL_MESSAGE (INSTALL_GLES2 "OpenGL ES 2.0 binaries")
|
||||
INSTALL_MESSAGE (INSTALL_FREETYPE "FreeType binaries")
|
||||
INSTALL_MESSAGE (INSTALL_TBB "TBB binaries")
|
||||
INSTALL_MESSAGE (INSTALL_RAPIDJSON "RapidJSON header files")
|
||||
INSTALL_MESSAGE (INSTALL_TCL "TCL binaries")
|
||||
INSTALL_MESSAGE (INSTALL_TK "TK binaries")
|
||||
INSTALL_MESSAGE (INSTALL_VTK "VTK binaries ")
|
||||
@@ -162,10 +161,6 @@ set (USE_FREEIMAGE_DESCR
|
||||
"Indicates whether Freeimage product should be used in OCCT visualization
|
||||
module for support of popular graphics image formats (PNG, BMP etc)")
|
||||
|
||||
set (USE_RAPIDJSON_DESCR
|
||||
"Indicates whether RapidJSON product should be used in OCCT DataExchange
|
||||
module for support of JSON-based formats like glTF")
|
||||
|
||||
set (USE_EGL_DESCR
|
||||
"Indicates whether EGL should be used in OCCT visualization
|
||||
module instead of conventional OpenGL context creation APIs")
|
||||
|
@@ -189,9 +189,6 @@ proc wokdep:gui:UpdateList {} {
|
||||
}
|
||||
wokdep:SearchStandardLibrary anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs "liblzma" "lzma.h" "$aCheckLib" {"lzma" "xz"}
|
||||
}
|
||||
if { "$::HAVE_RAPIDJSON" == "true" } {
|
||||
wokdep:SearchRapidJson anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
||||
}
|
||||
|
||||
if { "$::CHECK_QT4" == "true" } {
|
||||
wokdep:SearchQt4 anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
||||
@@ -459,9 +456,6 @@ ttk::label .myFrame.myChecks.myZLibLbl -text "Use zlib"
|
||||
checkbutton .myFrame.myChecks.myLzmaCheck -offvalue "false" -onvalue "true" -variable HAVE_LIBLZMA -command wokdep:gui:UpdateList
|
||||
ttk::label .myFrame.myChecks.myLzmaLbl -text "Use liblzma"
|
||||
|
||||
checkbutton .myFrame.myChecks.myRapidJsonCheck -offvalue "false" -onvalue "true" -variable HAVE_RAPIDJSON -command wokdep:gui:UpdateList
|
||||
ttk::label .myFrame.myChecks.myRapidJsonLbl -text "Use RapidJSON"
|
||||
|
||||
checkbutton .myFrame.myChecks.myQt4Check -offvalue "false" -onvalue "true" -variable CHECK_QT4 -command wokdep:gui:UpdateList
|
||||
ttk::label .myFrame.myChecks.myQt4Lbl -text "Search Qt4"
|
||||
checkbutton .myFrame.myChecks.myJDKCheck -offvalue "false" -onvalue "true" -variable CHECK_JDK -command wokdep:gui:UpdateList
|
||||
@@ -570,8 +564,8 @@ if { "$::tcl_platform(os)" != "Darwin" } {
|
||||
grid .myFrame.myChecks.myZLibCheck -row $aCheckRowIter -column 6 -sticky e
|
||||
grid .myFrame.myChecks.myZLibLbl -row $aCheckRowIter -column 7 -sticky w
|
||||
|
||||
grid .myFrame.myChecks.myQt4Check -row $aCheckRowIter -column 12 -sticky e
|
||||
grid .myFrame.myChecks.myQt4Lbl -row $aCheckRowIter -column 13 -sticky w
|
||||
grid .myFrame.myChecks.myQt4Check -row $aCheckRowIter -column 10 -sticky e
|
||||
grid .myFrame.myChecks.myQt4Lbl -row $aCheckRowIter -column 11 -sticky w
|
||||
|
||||
incr aCheckRowIter
|
||||
grid .myFrame.myChecks.myFFmpegCheck -row $aCheckRowIter -column 0 -sticky e
|
||||
@@ -584,8 +578,8 @@ if { "$::tcl_platform(platform)" == "windows" } {
|
||||
}
|
||||
grid .myFrame.myChecks.myLzmaCheck -row $aCheckRowIter -column 6 -sticky e
|
||||
grid .myFrame.myChecks.myLzmaLbl -row $aCheckRowIter -column 7 -sticky w
|
||||
grid .myFrame.myChecks.myJDKCheck -row $aCheckRowIter -column 12 -sticky e
|
||||
grid .myFrame.myChecks.myJDKLbl -row $aCheckRowIter -column 13 -sticky w
|
||||
grid .myFrame.myChecks.myJDKCheck -row $aCheckRowIter -column 10 -sticky e
|
||||
grid .myFrame.myChecks.myJDKLbl -row $aCheckRowIter -column 11 -sticky w
|
||||
|
||||
incr aCheckRowIter
|
||||
if { "$::tcl_platform(os)" == "Darwin" } {
|
||||
@@ -594,10 +588,6 @@ if { "$::tcl_platform(os)" == "Darwin" } {
|
||||
incr aCheckRowIter
|
||||
}
|
||||
|
||||
grid .myFrame.myChecks.myRapidJsonCheck -row $aCheckRowIter -column 6 -sticky e
|
||||
grid .myFrame.myChecks.myRapidJsonLbl -row $aCheckRowIter -column 7 -sticky w
|
||||
incr aCheckRowIter
|
||||
|
||||
# Additional headers search paths
|
||||
grid .myFrame.myIncLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
|
||||
incr aRowIter
|
||||
|
@@ -68,7 +68,7 @@ if { [info exists ::env(SHORTCUT_HEADERS)] } {
|
||||
}
|
||||
|
||||
# fetch environment variables (e.g. set by custom.sh or custom.bat) and set them as tcl variables with the same name
|
||||
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_RAPIDJSON HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo}
|
||||
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo}
|
||||
foreach anEnvIter $THE_ENV_VARIABLES {
|
||||
set ${anEnvIter} "false"
|
||||
if { [info exists ::env(${anEnvIter})] } {
|
||||
@@ -858,25 +858,6 @@ proc wokdep:SearchGLES {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin6
|
||||
return "$isFound"
|
||||
}
|
||||
|
||||
# Search RapidJSON headers
|
||||
proc wokdep:SearchRapidJson {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
|
||||
upvar $theErrInc anErrInc
|
||||
|
||||
set isFound "true"
|
||||
set aRJHPath [wokdep:SearchHeader "rapidjson/rapidjson.h"]
|
||||
if { "$aRJHPath" == "" } {
|
||||
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{rapidjson}*] "$::VCVER" "$::ARCH" ]
|
||||
if { "$aPath" != "" && [file exists "$aPath/include/rapidjson/rapidjson.h"] } {
|
||||
lappend ::CSF_OPT_INC "$aPath/include"
|
||||
} else {
|
||||
lappend anErrInc "Error: 'rapidjson/rapidjson.h' not found (RapidJSON)"
|
||||
set isFound "false"
|
||||
}
|
||||
}
|
||||
|
||||
return "$isFound"
|
||||
}
|
||||
|
||||
# Auxiliary function, gets VTK version to set default search directory
|
||||
proc wokdep:VtkVersion { thePath } {
|
||||
set aResult "6.1"
|
||||
|
@@ -1377,23 +1377,17 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
|
||||
set aLibsMap(CSF_TBB) ""
|
||||
} else {
|
||||
set aLibsMap(CSF_dl) "dl"
|
||||
if { "$theOS" == "mac" || "$theOS" == "ios" } {
|
||||
if { "$theOS" == "mac" } {
|
||||
set aLibsMap(CSF_objc) "objc"
|
||||
if { "$theOS" == "ios" } {
|
||||
set aFrmsMap(CSF_Appkit) "UIKit"
|
||||
set aFrmsMap(CSF_OpenGlLibs) "OpenGLES"
|
||||
} else {
|
||||
set aFrmsMap(CSF_Appkit) "AppKit"
|
||||
set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
|
||||
}
|
||||
set aFrmsMap(CSF_Appkit) "AppKit"
|
||||
set aFrmsMap(CSF_IOKit) "IOKit"
|
||||
set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
|
||||
set aFrmsMap(CSF_TclLibs) "Tcl"
|
||||
set aLibsMap(CSF_TclLibs) ""
|
||||
set aFrmsMap(CSF_TclTkLibs) "Tk"
|
||||
set aLibsMap(CSF_TclTkLibs) ""
|
||||
set aLibsMap(CSF_QT) "QtCore QtGui"
|
||||
} else {
|
||||
set aLibsMap(CSF_fontconfig) "fontconfig"
|
||||
if { "$theOS" == "qnx" } {
|
||||
# CSF_ThreadLibs - pthread API is part of libc on QNX
|
||||
set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
|
||||
@@ -2676,7 +2670,7 @@ proc OS:xcodeproj { theModules theOutDir theGuidsMap theLibType thePlatform} {
|
||||
}
|
||||
|
||||
# Generates dependencies section for Xcode project files.
|
||||
proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection theDepsGuids theDepsRefGuids thePlatform theIsStatic} {
|
||||
proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection theDepsGuids theDepsRefGuids theIsStatic} {
|
||||
upvar $theGuidsMap aGuidsMap
|
||||
upvar $theFileRefSection aFileRefSection
|
||||
upvar $theDepsGuids aDepsGuids
|
||||
@@ -2700,7 +2694,7 @@ proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection
|
||||
}
|
||||
}
|
||||
|
||||
osutils:usedOsLibs $theToolKit $thePlatform aLibs aFrameworks
|
||||
osutils:usedOsLibs $theToolKit "mac" aLibs aFrameworks
|
||||
set aUsedLibs [concat $aUsedLibs $aLibs]
|
||||
set aUsedLibs [concat $aUsedLibs $aFrameworks]
|
||||
foreach tkx $aUsedLibs {
|
||||
@@ -2915,7 +2909,7 @@ proc osutils:xcdtk { theOutDir theToolKit theGuidsMap theIsStatic thePlatform {t
|
||||
}
|
||||
|
||||
puts $aPbxprojFile [osutils:xcdtk:sources $theToolKit $theTargetType aSrcFileRefSection aGroupSection aPackagesGuids aSrcFileGuids aGuidsMap anIncPaths]
|
||||
puts $aPbxprojFile [osutils:xcdtk:deps $theToolKit $theTargetType aGuidsMap aDepsFileRefSection aDepsGuids aDepsRefGuids $thePlatform $theIsStatic]
|
||||
puts $aPbxprojFile [osutils:xcdtk:deps $theToolKit $theTargetType aGuidsMap aDepsFileRefSection aDepsGuids aDepsRefGuids $theIsStatic]
|
||||
# End PBXBuildFile section
|
||||
|
||||
# Begin PBXFileReference section
|
||||
|
@@ -46,14 +46,9 @@ win32 {
|
||||
} else:mac {
|
||||
CSF_dl = -ldl
|
||||
CSF_objc = -lobjc
|
||||
iphoneos {
|
||||
CSF_Appkit = -framework UIKit
|
||||
CSF_OpenGlLibs = -framework OpenGLES
|
||||
} else {
|
||||
CSF_Appkit = -framework AppKit
|
||||
CSF_OpenGlLibs = -framework OpenGL
|
||||
}
|
||||
CSF_Appkit = -framework AppKit
|
||||
CSF_IOKit = -framework IOKit
|
||||
CSF_OpenGlLibs = -framework OpenGL
|
||||
CSF_TclLibs = -framework Tcl
|
||||
CSF_TclTkLibs = -framework Tk
|
||||
} else {
|
||||
@@ -63,7 +58,6 @@ win32 {
|
||||
CSF_TclTkLibs = -lX11 -ltk8.6
|
||||
CSF_XwLibs = -lX11 -lXext -lXmu -lXi
|
||||
CSF_MotifLibs = -lX11
|
||||
CSF_fontconfig = -lfontconfig
|
||||
HAVE_GLES2 { CSF_OpenGlLibs = -lEGL -lGLESv2 }
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,6 @@ set "HAVE_GLES2=false"
|
||||
set "HAVE_D3D=false"
|
||||
set "HAVE_ZLIB=false"
|
||||
set "HAVE_LIBLZMA=false"
|
||||
set "HAVE_RAPIDJSON=false"
|
||||
set "CSF_OPT_INC="
|
||||
set "CSF_OPT_LIB32="
|
||||
set "CSF_OPT_LIB64="
|
||||
@@ -164,7 +163,6 @@ if ["%HAVE_GLES2%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DH
|
||||
if ["%HAVE_D3D%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_D3D" & set "CSF_DEFINES=HAVE_D3D;%CSF_DEFINES%"
|
||||
if ["%HAVE_ZLIB%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_ZLIB" & set "CSF_DEFINES=HAVE_ZLIB;%CSF_DEFINES%"
|
||||
if ["%HAVE_LIBLZMA%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_LIBLZMA" & set "CSF_DEFINES=HAVE_LIBLZMA;%CSF_DEFINES%"
|
||||
if ["%HAVE_RAPIDJSON%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_RAPIDJSON" & set "CSF_DEFINES=HAVE_RAPIDJSON;%CSF_DEFINES%"
|
||||
|
||||
rem Eliminate VS warning
|
||||
if ["%CSF_DEFINES%"] == [""] set "CSF_DEFINES=;"
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 5.6 KiB |
@@ -878,18 +878,7 @@ The test grid name is constructed depending on the type of the tested chamfers.
|
||||
| dist_angle_complex | | Distance from edge and given angle |
|
||||
| dist_angle_sequence | | Distance from edge and given angle |
|
||||
|
||||
@subsubsection testmanual_5_1_7 de
|
||||
|
||||
This group tests reading and writing of CAD data files (iges, step) to and from OCCT.
|
||||
|
||||
Test cases check transfer status, shape and attributes against expected reference values.
|
||||
|
||||
| Grid | Commands | Functionality |
|
||||
| :---- | :----- | :------- |
|
||||
| iges_1, iges_2, iges_3 | igesbrep, brepiges, ReadIges, WriteIges | IGES tests |
|
||||
| step_1, step_2, step_3, step_4, step_5 | stepread, stepwrite, ReadStep, WriteStep | STEP tests |
|
||||
|
||||
@subsubsection testmanual_5_1_8 demo
|
||||
@subsubsection testmanual_5_1_7 demo
|
||||
|
||||
This group allows demonstrating how testing cases are created, and testing DRAW commands and the test system as a whole.
|
||||
|
||||
@@ -900,7 +889,7 @@ This group allows demonstrating how testing cases are created, and testing DRAW
|
||||
| samples | | OCCT samples |
|
||||
|
||||
|
||||
@subsubsection testmanual_5_1_9 draft
|
||||
@subsubsection testmanual_5_1_8 draft
|
||||
|
||||
This group allows testing draft operations.
|
||||
|
||||
@@ -911,7 +900,7 @@ DRAW module: MODELING.
|
||||
| Angle | depouille | Drafts with angle (inclined walls) |
|
||||
|
||||
|
||||
@subsubsection testmanual_5_1_10 feat
|
||||
@subsubsection testmanual_5_1_9 feat
|
||||
|
||||
This group allows testing creation of features on a shape.
|
||||
|
||||
@@ -925,7 +914,7 @@ DRAW module: MODELING (package *BRepTest*).
|
||||
| featrevol | | |
|
||||
| featrf | | |
|
||||
|
||||
@subsubsection testmanual_5_1_11 heal
|
||||
@subsubsection testmanual_5_1_10 heal
|
||||
|
||||
This group allows testing the functionality provided by *ShapeHealing* toolkit.
|
||||
|
||||
@@ -954,7 +943,7 @@ DRAW module: XSDRAW
|
||||
| surface_to_revolution_standard | DT_ShapeConvertRev | Convert elementary surfaces to revolutions, simple cases |
|
||||
| update_tolerance_locked | updatetolerance | Update the tolerance of shape so that it satisfy the rule: toler(face)<=toler(edge)<=toler(vertex) |
|
||||
|
||||
@subsubsection testmanual_5_1_12 mesh
|
||||
@subsubsection testmanual_5_1_11 mesh
|
||||
|
||||
This group allows testing shape tessellation (*BRepMesh*) and shading.
|
||||
|
||||
@@ -971,7 +960,7 @@ DRAW modules: MODELING (package *MeshTest*), VISUALIZATION (package *ViewerTest*
|
||||
| advanced_incmesh_parallel | incmesh | Meshing of complex shapes, parallel mode |
|
||||
| standard_incmesh_parallel | incmesh | Meshing of simple shapes, parallel mode |
|
||||
|
||||
@subsubsection testmanual_5_1_13 mkface
|
||||
@subsubsection testmanual_5_1_12 mkface
|
||||
|
||||
This group allows testing creation of simple surfaces.
|
||||
|
||||
@@ -986,7 +975,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| after_revsurf_and_offset | mkface | |
|
||||
| mkplane | mkplane | |
|
||||
|
||||
@subsubsection testmanual_5_1_14 nproject
|
||||
@subsubsection testmanual_5_1_13 nproject
|
||||
|
||||
This group allows testing normal projection of edges and wires onto a face.
|
||||
|
||||
@@ -996,7 +985,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| :---- | :----- | :------- |
|
||||
| Base | nproject | |
|
||||
|
||||
@subsubsection testmanual_5_1_15 offset
|
||||
@subsubsection testmanual_5_1_14 offset
|
||||
|
||||
This group allows testing offset functionality for curves and surfaces.
|
||||
|
||||
@@ -1012,7 +1001,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| shape | offsetshape | |
|
||||
| wire_closed_outside_0_005, wire_closed_outside_0_025, wire_closed_outside_0_075, wire_closed_inside_0_005, wire_closed_inside_0_025, wire_closed_inside_0_075, wire_unclosed_outside_0_005, wire_unclosed_outside_0_025, wire_unclosed_outside_0_075 | mkoffset | 2d offset of closed and unclosed planar wires with different offset step and directions of offset ( inside / outside ) |
|
||||
|
||||
@subsubsection testmanual_5_1_16 pipe
|
||||
@subsubsection testmanual_5_1_15 pipe
|
||||
|
||||
This group allows testing construction of pipes (sweeping of a contour along profile).
|
||||
|
||||
@@ -1022,7 +1011,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| :---- | :----- | :------- |
|
||||
| Standard | pipe | |
|
||||
|
||||
@subsubsection testmanual_5_1_17 prism
|
||||
@subsubsection testmanual_5_1_16 prism
|
||||
|
||||
This group allows testing construction of prisms.
|
||||
|
||||
@@ -1032,7 +1021,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| :---- | :----- | :------- |
|
||||
| seminf | prism | |
|
||||
|
||||
@subsubsection testmanual_5_1_18 sewing
|
||||
@subsubsection testmanual_5_1_17 sewing
|
||||
|
||||
This group allows testing sewing of faces by connecting edges.
|
||||
|
||||
@@ -1044,7 +1033,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| tol_1 | sewing | Sewing faces with tolerance 1 |
|
||||
| tol_100 | sewing | Sewing faces with tolerance 100 |
|
||||
|
||||
@subsubsection testmanual_5_1_19 thrusection
|
||||
@subsubsection testmanual_5_1_18 thrusection
|
||||
|
||||
This group allows testing construction of shell or a solid passing through a set of sections in a given sequence (loft).
|
||||
|
||||
@@ -1053,7 +1042,7 @@ This group allows testing construction of shell or a solid passing through a set
|
||||
| solids | thrusection | Lofting with resulting solid |
|
||||
| not_solids | thrusection | Lofting with resulting shell or face |
|
||||
|
||||
@subsubsection testmanual_5_1_20 xcaf
|
||||
@subsubsection testmanual_5_1_19 xcaf
|
||||
|
||||
This group allows testing extended data exchange packages.
|
||||
|
||||
|
@@ -1738,26 +1738,14 @@ or updating presentation without recomputation (see *AIS_InteractiveObject::Sync
|
||||
* *Aspect_IS_HIDDENLINE* does not implicitly enables drawing mesh edges anymore.
|
||||
Specify Graphic3d_AspectFillArea3d::SetDrawEdges(true) with Graphic3d_AspectFillArea3d::SetInteriorStyle(Aspect_IS_HIDDENLINE) to get previous behavior of Aspect_IS_HIDDENLINE style.
|
||||
|
||||
@subsection upgrade_740_modedprs PrsMgr and SelectMgr hierarchy clean up
|
||||
@subsection upgrade_740_modedprs PrsMgr_ModedPresentation removal
|
||||
|
||||
Proxy classes *Prs3d_Presentation*, *PrsMgr_ModedPresentation* and *PrsMgr_Prs* have been removed.
|
||||
Code iterating through the list of low-level structures AIS_InteractiveObject::Presentations() should be updated to access PrsMgr_Presentation directly.
|
||||
Forward declarations of *Prs3d_Presentation* should be corrected, since it is now a typedef to *Graphic3d_Structure*.
|
||||
|
||||
Proxy classes *SelectBasics_SensitiveEntity* and *SelectBasics_EntityOwner* have been removed - *Select3D_SensitiveEntity* and *SelectMgr_EntityOwner* should be now used directly instead.
|
||||
|
||||
@subsection upgrade_740_geproj Custom defines within env.bat
|
||||
|
||||
*env.bat* produced by Visual Studio project generator *genproj.bat* has been modified so that *%CSF_DEFINES%* variable is reset to initial state.
|
||||
Custom building environment relying on old behavior and setting extra macros within *%CSF_DEFINES%* before env.bat should be updated
|
||||
to either modify custom.bat or setup new variable *%CSF_DEFINES_EXTRA%* instead.
|
||||
|
||||
@subsection upgrade_740_BVH_in_BOP Switching Boolean Operations algorithm to use BVH tree instead of UB tree
|
||||
|
||||
Since OCCT 7.4.0 Boolean Operations algorithm uses BVH tree instead of UBTree to find the pairs of entities with interfering bounding boxes.
|
||||
The following API changes have been made:
|
||||
* BOPTools_BoxBndTree and BOPTools_BoxBndTreeSelector have been removed. Use the BOPTools_BoxTree and BOPTools_BoxTreeSelector instead.
|
||||
* BOPTools_BoxSelector::SetBox() method now accepts the BVH_Box instead of Bnd_Box.
|
||||
* Methods BOPTools_BoxSelector::Reject and BOPTools_BoxSelector::Accept have been removed as unused.
|
||||
* The RunParallel flag has been removed from the list of parameters of BOPAlgo_Tools::IntersectVertices method. Earlier, it performed selection from the UB tree in parallel mode. Now all interfering pairs are found in one pass, using pair traverse of the same BVH tree.
|
||||
|
||||
|
@@ -222,7 +222,6 @@ for which OCCT is certified to work.
|
||||
| Freetype (for text rendering) | FreeType 2.4.11-2.7.1 https://sourceforge.net/projects/freetype/files/ |
|
||||
| FreeImage (optional, for support of common 2D graphic formats) | FreeImage 3.17.0+ https://sourceforge.net/projects/freeimage/files |
|
||||
| FFmpeg (optional, for video recording) | FFmpeg 3.1+ https://www.ffmpeg.org/download.html |
|
||||
| RapidJSON (optional, for reading glTF) | RapidJSON 1.1+ http://rapidjson.org/ |
|
||||
| Intel TBB (optional, for multithreaded algorithms) | TBB 4.x or 5.x https://www.threadingbuildingblocks.org/ |
|
||||
| VTK (for VTK Integration Services | VTK 6.1+ http://www.vtk.org/download/ |
|
||||
| Doxygen (optional for building documentation) | Doxygen 1.8.5+ https://www.stack.nl/~dimitri/doxygen/download.html |
|
||||
|
@@ -5595,7 +5595,7 @@ Draw provides command to create curves and surfaces by approximation.
|
||||
* **appro** fits a curve through 3d points;
|
||||
* **surfapp** and **grilapp** fit a surface through 3d points by approximation;
|
||||
* **surfint** fit a surface through 3d points by interpolation;
|
||||
* **2dinterpole** interpolates a curve.
|
||||
* **2dinterpolate** interpolates a curve.
|
||||
|
||||
@subsubsection occt_draw_6_8_1 appro, dapprox
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 18 KiB |
Binary file not shown.
Before Width: | Height: | Size: 18 KiB |
Binary file not shown.
Before Width: | Height: | Size: 15 KiB |
@@ -1341,26 +1341,7 @@ Further, let us consider the triangle \f$ T_{0}\left \langle p_{0}, p_{1}, p_{2}
|
||||
<span>10.</span> Compute the center of OBB and its half dimensions.<br>
|
||||
<span>11.</span> Create OBB using the center, axes and half dimensions.<br>
|
||||
|
||||
@subsubsection occt_modat_6_1_1_opt Creation of Optimal OBB from set of points
|
||||
|
||||
For creation of the optimal OBB from set of points the same algorithm as described above is used but with some simplifications in logic and increased computation time.
|
||||
For the optimal OBB it is necessary to check all possible axes which can be created by the extremal points. And since the extremal points are only valid for the initial axes it is necessary to project the whole set of points on each axis.
|
||||
This approach usually provides much tighter OBB but the performance is lower. The complexity of the algorithm is still linear and with use of BVH for the set of points it is O(N + C*log(N)).
|
||||
|
||||
Here is the example of optimal and not optimal OBB for the model using the set of 125K nodes:
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td>@figure{/user_guides/modeling_data/images/modeling_data_obb_125K.png,"Not optimal OBB by DiTo-14",160}</td>
|
||||
<td>@figure{/user_guides/modeling_data/images/modeling_data_opt_obb_125K.png,"Optimal OBB by DiTo-14",160}</td>
|
||||
<td>@figure{/user_guides/modeling_data/images/modeling_data_pca_obb_125K.png,"Not optimal OBB by PCA",160}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Computation of the not optimal OBB in this case took 0.007 sec, optimal - 0.1 sec, which is about 14 times slower. Such performance is comparable to creation of the OBB for this shape by PCA approach (see below) which takes about 0.17 sec.
|
||||
|
||||
The computation of optimal OBB is controlled by the same *theIsOptimal* flag in the BRepBndLib::AddOBB method as for PCA algorithm.
|
||||
|
||||
These algorithms are implemented in the *Bnd_OBB::ReBuild(...)* method.
|
||||
This algorithm is implemented in the *Bnd_OBB::ReBuild(...)* method.
|
||||
|
||||
@subsubsection occt_modat_6_1_2 Creation of OBB based on Axes of inertia
|
||||
|
||||
|
@@ -226,6 +226,8 @@ Selection is implemented as a combination of various algorithms divided among se
|
||||
#### SelectBasics
|
||||
|
||||
*SelectBasics* package contains basic classes and interfaces for selection. The most notable are:
|
||||
- *SelectBasics_SensitiveEntity* -- the base definition of a sensitive entity;
|
||||
- *SelectBasics_EntityOwner* -- the base definition of the an entity owner -- the link between the sensitive entity and the object to be selected;
|
||||
- *SelectBasics_PickResult* -- the structure for storing quantitative results of detection procedure, for example, depth and distance to the center of geometry;
|
||||
- *SelectBasics_SelectingVolumeManager* -- the interface for interaction with the current selection frustum.
|
||||
|
||||
@@ -245,11 +247,9 @@ Each custom sensitive entity must inherit at least *SelectBasics_SensitiveEntity
|
||||
- triangulation;
|
||||
- wire.
|
||||
|
||||
Each basic sensitive entity inherits *Select3D_SensitiveEntity*.
|
||||
Each basic sensitive entity inherits *Select3D_SensitiveEntity*, which is a child class of *SelectBasics_SensitiveEntity*.
|
||||
The package also contains two auxiliary classes, *Select3D_SensitivePoly* and *Select3D_SensitiveSet*.
|
||||
|
||||
*Select3D_SensitiveEntity* -- the base definition of a sensitive entity.
|
||||
|
||||
*Select3D_SensitiveSet* -- a base class for all complex sensitive entities that require the third level BVH usage. It implements traverse of the tree and defines an interface for the methods that check sub-entities.
|
||||
|
||||
*Select3D_SensitivePoly* -- describes an arbitrary point set and implements basic functions for selection. It is important to know that this class does not perform any internal data checks. Hence, custom implementations of sensitive entity inherited from *Select3D_SensitivePoly* must satisfy the terms of Separating Axis Theorem to use standard OCCT overlap detection methods.
|
||||
|
@@ -155,6 +155,7 @@ class ISession2D_InteractiveObject;
|
||||
class V3d_Viewer;
|
||||
class SelectMgr_SelectableObject;
|
||||
class TCollection_AsciiString;
|
||||
class SelectBasics_EntityOwner;
|
||||
class gp_Pnt2d;
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
@@ -264,11 +264,11 @@ bfuse _model _model t_s
|
||||
explode _model e
|
||||
|
||||
# Make a weld at joint edges of platform and wedge
|
||||
blend _model _model 2 _model_26
|
||||
blend _model _model 2 _model_27
|
||||
blend _model _model 2 _model_28
|
||||
blend _model _model 2 _model_29
|
||||
blend _model _model 2 _model_30
|
||||
blend _model _model 2 _model_32
|
||||
blend _model _model 2 _model_31
|
||||
|
||||
# Cylinder on wedge
|
||||
blend result _model 2 _model_161
|
||||
|
@@ -783,7 +783,6 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
BRepAdaptor_Surface surf1( aFace );
|
||||
Handle( Adaptor3d_HSurface ) surf2;
|
||||
Standard_Boolean isOffset = Standard_False;
|
||||
Offset = 0.0;
|
||||
|
||||
if (surf1.GetType() == GeomAbs_OffsetSurface)
|
||||
{
|
||||
@@ -802,6 +801,7 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
{
|
||||
aPlane = surf2->Plane();
|
||||
aSurfType = AIS_KOS_Plane;
|
||||
Offset = 0.;
|
||||
Result = Standard_True;
|
||||
}
|
||||
|
||||
@@ -817,6 +817,7 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
gp_Pln thePlane( LinePos, LineDir ^ ExtrusionDir);
|
||||
aPlane = thePlane;
|
||||
aSurfType = AIS_KOS_Plane;
|
||||
Offset = 0.;
|
||||
Result = Standard_True;
|
||||
}
|
||||
}
|
||||
@@ -825,6 +826,7 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
{
|
||||
aSurf = (Handle( Geom_OffsetSurface )::DownCast( aSurf ))->Surface();
|
||||
aPlane = (Handle( Geom_Plane )::DownCast( aSurf ))->Pln();
|
||||
Offset = 0.0e0;
|
||||
}
|
||||
if (Result == Standard_False)
|
||||
{
|
||||
@@ -837,6 +839,7 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
TheType == STANDARD_TYPE(Geom_ToroidalSurface))
|
||||
{
|
||||
aSurf = (Handle( Geom_OffsetSurface )::DownCast( aSurf ))->Surface();
|
||||
Offset = 0.0e0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -896,18 +899,20 @@ gp_Pnt AIS::ProjectPointOnLine( const gp_Pnt & aPoint, const gp_Lin & aLine )
|
||||
//function : InitFaceLength
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS::InitFaceLength (const TopoDS_Face& theFace,
|
||||
gp_Pln& thePlane,
|
||||
Handle(Geom_Surface)& theSurface,
|
||||
AIS_KindOfSurface& theSurfaceType,
|
||||
Standard_Real& theOffset)
|
||||
void AIS::InitFaceLength (const TopoDS_Face& aFace,
|
||||
gp_Pln & aPlane,
|
||||
Handle(Geom_Surface) & aSurface,
|
||||
AIS_KindOfSurface & aSurfaceType,
|
||||
Standard_Real & anOffset)
|
||||
{
|
||||
if (AIS::GetPlaneFromFace (theFace, thePlane, theSurface, theSurfaceType, theOffset)
|
||||
&& Abs (theOffset) > Precision::Confusion())
|
||||
{
|
||||
theSurface = new Geom_OffsetSurface (theSurface, theOffset);
|
||||
theOffset = 0.0e0;
|
||||
}
|
||||
AIS::GetPlaneFromFace( aFace, aPlane, aSurface, aSurfaceType, anOffset );
|
||||
|
||||
if (Abs( anOffset ) > Precision::Confusion())
|
||||
{
|
||||
aSurface = new Geom_OffsetSurface( aSurface, anOffset );
|
||||
anOffset = 0.0e0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -34,8 +34,10 @@
|
||||
#include <Prs3d_Projector.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Select3D_SensitiveSegment.hxx>
|
||||
#include <SelectBasics_EntityOwner.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StdPrs_Curve.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@@ -197,7 +199,8 @@ void AIS_Axis::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(G
|
||||
void AIS_Axis::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
|
||||
const Standard_Integer)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner (this, 3);
|
||||
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this);
|
||||
eown -> SelectBasics_EntityOwner::Set(3);
|
||||
Handle(Select3D_SensitiveSegment) seg = new Select3D_SensitiveSegment(eown,
|
||||
myPfirst,
|
||||
myPlast);
|
||||
|
@@ -512,8 +512,8 @@ void AIS_ColoredShape::ComputeSelection (const Handle(SelectMgr_Selection)& theS
|
||||
Handle(SelectMgr_SelectableObject) aThis (this);
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner)& anOwner = aSelEntIter.Value()->BaseSensitive()->OwnerId();
|
||||
anOwner->SetSelectable (aThis);
|
||||
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelEntIter.Value()->BaseSensitive()->OwnerId());
|
||||
anOwner->Set (aThis);
|
||||
}
|
||||
|
||||
StdSelect_BRepSelectionTool::PreBuildBVH (theSelection);
|
||||
@@ -633,9 +633,6 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation
|
||||
{
|
||||
aShadedGroup = thePrs->NewGroup();
|
||||
aShadedGroup->SetClosed (isClosed);
|
||||
if (isClosed
|
||||
&& !myCappingStyle.IsNull())
|
||||
aShadedGroup->SetGroupPrimitivesAspect (myCappingStyle);
|
||||
}
|
||||
aShadedGroup->SetPrimitivesAspect (aDrawer->ShadingAspect()->Aspect());
|
||||
aShadedGroup->AddPrimitiveArray (aTriangles);
|
||||
|
@@ -233,7 +233,7 @@ void AIS_ConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selectio
|
||||
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (TheRefSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
if (const Handle(Select3D_SensitiveEntity)& aSensitive = aSelEntIter.Value()->BaseSensitive())
|
||||
if (Handle(Select3D_SensitiveEntity) aSensitive = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
|
||||
{
|
||||
// Get the copy of SE3D
|
||||
if (Handle(Select3D_SensitiveEntity) aNewSensitive = aSensitive->GetConnected())
|
||||
@@ -271,7 +271,7 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
|
||||
Shapes2EntitiesMap aShapes2EntitiesMap;
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aRefSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
if (const Handle(Select3D_SensitiveEntity)& aSE = aSelEntIter.Value()->BaseSensitive())
|
||||
if (Handle(Select3D_SensitiveEntity) aSE = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
|
||||
{
|
||||
if (Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast (aSE->OwnerId()))
|
||||
{
|
||||
|
@@ -106,6 +106,7 @@ AIS_InteractiveContext::AIS_InteractiveContext(const Handle(V3d_Viewer)& MainVie
|
||||
myMainPM(new PrsMgr_PresentationManager3d(MainViewer->StructureManager())),
|
||||
myMainVwr(MainViewer),
|
||||
myMainSel(new StdSelect_ViewerSelector3d()),
|
||||
myWasLastMain(Standard_False),
|
||||
myToHilightSelected(Standard_True),
|
||||
mySelection(new AIS_Selection()),
|
||||
myFilters(new SelectMgr_OrFilter()),
|
||||
@@ -424,7 +425,8 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
||||
setContextToObject (theIObj);
|
||||
if (!myObjects.IsBound (theIObj))
|
||||
{
|
||||
setObjectStatus (theIObj, AIS_DS_Displayed, theDispMode, theSelectionMode);
|
||||
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
|
||||
myObjects.Bind (theIObj, aStatus);
|
||||
myMainVwr->StructureManager()->RegisterObject (theIObj);
|
||||
myMainPM->Display(theIObj, theDispMode);
|
||||
if (theSelectionMode != -1)
|
||||
@@ -501,7 +503,8 @@ void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
{
|
||||
Standard_Integer aDispMode, aHiMod, aSelModeDef;
|
||||
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
|
||||
setObjectStatus (theIObj, AIS_DS_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
|
||||
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
|
||||
myObjects.Bind (theIObj, aStatus);
|
||||
myMainVwr->StructureManager()->RegisterObject (theIObj);
|
||||
}
|
||||
|
||||
@@ -752,9 +755,7 @@ Standard_Boolean AIS_InteractiveContext::IsHilighted (const Handle(SelectMgr_Ent
|
||||
return myObjects (anObj)->IsHilighted();
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Drawer)& aStyle = getSelStyle (anObj, theOwner);
|
||||
const Standard_Integer aHiMode = getHilightMode (anObj, aStyle, -1);
|
||||
return theOwner->IsHilighted (myMainPM, aHiMode);
|
||||
return theOwner->IsSelected();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1661,20 +1662,20 @@ void AIS_InteractiveContext::SetWidth (const Handle(AIS_InteractiveObject)& theI
|
||||
setContextToObject (theIObj);
|
||||
theIObj->SetWidth (theWidth);
|
||||
theIObj->UpdatePresentations();
|
||||
if (!myLastPicked.IsNull() && myLastPicked->IsSameSelectable (theIObj))
|
||||
if (!myLastinMain.IsNull() && myLastinMain->IsSameSelectable (theIObj))
|
||||
{
|
||||
if (myLastPicked->IsAutoHilight())
|
||||
if (myLastinMain->IsAutoHilight())
|
||||
{
|
||||
const Standard_Integer aHiMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
|
||||
myLastPicked->HilightWithColor (myMainPM,
|
||||
myLastPicked->IsSelected() ? getSelStyle (theIObj, myLastPicked) : getHiStyle (theIObj, myLastPicked),
|
||||
myLastinMain->HilightWithColor (myMainPM,
|
||||
myLastinMain->IsSelected() ? getSelStyle (theIObj, myLastinMain) : getHiStyle (theIObj, myLastinMain),
|
||||
aHiMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
theIObj->HilightOwnerWithColor (myMainPM,
|
||||
myLastPicked->IsSelected() ? getSelStyle (theIObj, myLastPicked) : getHiStyle (theIObj, myLastPicked),
|
||||
myLastPicked);
|
||||
myLastinMain->IsSelected() ? getSelStyle (theIObj, myLastinMain) : getHiStyle (theIObj, myLastinMain),
|
||||
myLastinMain);
|
||||
}
|
||||
}
|
||||
if (theToUpdateViewer)
|
||||
@@ -1936,18 +1937,42 @@ void AIS_InteractiveContext::GetDefModes (const Handle(AIS_InteractiveObject)& t
|
||||
void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const Standard_Boolean theToUpdateviewer)
|
||||
{
|
||||
Handle(AIS_GlobalStatus) aStatus;
|
||||
if (theIObj.IsNull()
|
||||
|| !myObjects.Find (theIObj, aStatus)
|
||||
|| aStatus->GraphicStatus() == AIS_DS_Erased)
|
||||
|| !myObjects.IsBound (theIObj))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
|
||||
|
||||
const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
|
||||
unhighlightOwners (theIObj);
|
||||
if (aStatus->GraphicStatus() == AIS_DS_Erased)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (aStatus->IsHilighted())
|
||||
{
|
||||
Standard_DISABLE_DEPRECATION_WARNINGS
|
||||
if (IsCurrent (theIObj))
|
||||
{
|
||||
AddOrRemoveCurrentObject (theIObj, Standard_False);
|
||||
}
|
||||
else if (myMainPM->IsHighlighted (theIObj, aStatus->DisplayMode()))
|
||||
{
|
||||
unhighlightGlobal (theIObj);
|
||||
}
|
||||
Standard_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
|
||||
myMainPM->SetVisibility (theIObj, aStatus->DisplayMode(), Standard_False);
|
||||
|
||||
if (aStatus->IsHilighted()
|
||||
&& theIObj->HasHilightMode())
|
||||
{
|
||||
unhighlightGlobal (theIObj);
|
||||
}
|
||||
|
||||
if (!myLastPicked.IsNull()
|
||||
&& myLastPicked->IsSameSelectable (theIObj))
|
||||
{
|
||||
@@ -2003,9 +2028,8 @@ void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObje
|
||||
void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const Standard_Boolean theToUpdateviewer)
|
||||
{
|
||||
Handle(AIS_GlobalStatus) aStatus;
|
||||
if (theIObj.IsNull()
|
||||
|| !myObjects.Find (theIObj, aStatus))
|
||||
|| !myObjects.IsBound (theIObj))
|
||||
{
|
||||
// for cases when reference shape of connected interactives was not displayed
|
||||
// but its selection primitives were calculated
|
||||
@@ -2014,6 +2038,7 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
|
||||
unhighlightOwners (theIObj);
|
||||
|
||||
myMainPM->Erase (theIObj, -1);
|
||||
@@ -2054,7 +2079,7 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity
|
||||
mgrSelector->Remove (anObj);
|
||||
|
||||
setObjectStatus (theIObj, AIS_DS_None, -1, -1);
|
||||
myObjects.UnBind (theIObj);
|
||||
myMainVwr->StructureManager()->UnregisterObject (theIObj);
|
||||
|
||||
for (V3d_ListOfViewIterator aDefViewIter (myMainVwr->DefinedViewIterator()); aDefViewIter.More(); aDefViewIter.Next())
|
||||
@@ -2062,11 +2087,13 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
aDefViewIter.Value()->View()->ChangeHiddenObjects()->Remove (theIObj.get());
|
||||
}
|
||||
|
||||
if (!myLastPicked.IsNull())
|
||||
if (!myLastinMain.IsNull())
|
||||
{
|
||||
if (myLastPicked->IsSameSelectable (theIObj))
|
||||
if (myLastinMain->IsSameSelectable (theIObj)
|
||||
|| myLastPicked->IsSameSelectable(theIObj))
|
||||
{
|
||||
clearDynamicHighlight();
|
||||
myLastinMain.Nullify();
|
||||
myLastPicked.Nullify();
|
||||
}
|
||||
}
|
||||
@@ -2120,12 +2147,15 @@ Standard_Boolean AIS_InteractiveContext::ClearDetected (Standard_Boolean theToRe
|
||||
myCurDetected = 0;
|
||||
myCurHighlighted = 0;
|
||||
myDetectedSeq.Clear();
|
||||
myLastPicked = myLastinMain;
|
||||
myWasLastMain = Standard_True;
|
||||
Standard_Boolean toUpdate = Standard_False;
|
||||
if (!myLastPicked.IsNull() && myLastPicked->HasSelectable())
|
||||
{
|
||||
toUpdate = Standard_True;
|
||||
clearDynamicHighlight();
|
||||
}
|
||||
myLastinMain.Nullify();
|
||||
myLastPicked.Nullify();
|
||||
myMainSel->ClearPicked();
|
||||
if (toUpdate && theToRedrawImmediate)
|
||||
@@ -2522,38 +2552,3 @@ void AIS_InteractiveContext::SetTransformPersistence (const Handle(AIS_Interacti
|
||||
anActiveViewIter.Value()->View()->InvalidateZLayerBoundingBox (aLayerId);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GravityPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
gp_Pnt AIS_InteractiveContext::GravityPoint (const Handle(V3d_View)& theView) const
|
||||
{
|
||||
return theView->GravityPoint();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : setObjectStatus
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::setObjectStatus (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const AIS_DisplayStatus theStatus,
|
||||
const Standard_Integer theDispMode,
|
||||
const Standard_Integer theSelectionMode)
|
||||
{
|
||||
if (theStatus != AIS_DS_None)
|
||||
{
|
||||
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
|
||||
myObjects.Bind (theIObj, aStatus);
|
||||
}
|
||||
else
|
||||
myObjects.UnBind (theIObj);
|
||||
|
||||
for (PrsMgr_ListOfPresentableObjectsIter aPrsIter (theIObj->Children()); aPrsIter.More(); aPrsIter.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) aChild (Handle(AIS_InteractiveObject)::DownCast (aPrsIter.Value()));
|
||||
if (aChild.IsNull())
|
||||
continue;
|
||||
|
||||
setObjectStatus (aChild, theStatus, theDispMode, theSelectionMode);
|
||||
}
|
||||
}
|
||||
|
@@ -557,14 +557,6 @@ public: //! @name Selection management
|
||||
Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& theObject,
|
||||
const Standard_Boolean theToUpdateViewer);
|
||||
|
||||
//! Updates Selected state of specified owner without calling HilightSelected().
|
||||
//! Has no effect if Selected state is not changed, and redirects to AddOrRemoveSelected() otherwise.
|
||||
//! @param theOwner owner object to set selected state
|
||||
//! @param theIsSelected new selected state
|
||||
//! @return TRUE if Selected state has been changed
|
||||
Standard_EXPORT Standard_Boolean SetSelectedState (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Standard_Boolean theIsSelected);
|
||||
|
||||
//! Highlights selected objects.
|
||||
Standard_EXPORT void HilightSelected (const Standard_Boolean theToUpdateViewer);
|
||||
|
||||
@@ -824,9 +816,6 @@ public: //! @name common properties
|
||||
//! returns the number of removed structures from the viewers.
|
||||
Standard_EXPORT Standard_Integer PurgeDisplay();
|
||||
|
||||
//! Return rotation gravity point.
|
||||
Standard_EXPORT virtual gp_Pnt GravityPoint (const Handle(V3d_View)& theView) const;
|
||||
|
||||
public: //! @name debug visualization
|
||||
|
||||
//! Visualization of sensitives - for debugging purposes!
|
||||
@@ -1351,27 +1340,19 @@ protected: //! @name internal methods
|
||||
//! Removes dynamic highlight draw
|
||||
void clearDynamicHighlight() const
|
||||
{
|
||||
if (myLastPicked.IsNull())
|
||||
if (myLastinMain.IsNull())
|
||||
return;
|
||||
|
||||
if (myLastPicked->IsAutoHilight())
|
||||
if (myLastinMain->IsAutoHilight())
|
||||
{
|
||||
myMainPM->ClearImmediateDraw();
|
||||
}
|
||||
else
|
||||
{
|
||||
myLastPicked->Selectable()->ClearDynamicHighlight (myMainPM);
|
||||
myLastinMain->Selectable()->ClearDynamicHighlight (myMainPM);
|
||||
}
|
||||
}
|
||||
|
||||
//! Bind/Unbind status to object and its children
|
||||
//! @param theObj [in] the object to change status
|
||||
//! @param theStatus status, if NULL, unbind object
|
||||
Standard_EXPORT void setObjectStatus (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const AIS_DisplayStatus theStatus,
|
||||
const Standard_Integer theDispyMode,
|
||||
const Standard_Integer theSelectionMode);
|
||||
|
||||
protected: //! @name internal fields
|
||||
|
||||
AIS_DataMapOfIOStatus myObjects;
|
||||
@@ -1380,6 +1361,8 @@ protected: //! @name internal fields
|
||||
Handle(V3d_Viewer) myMainVwr;
|
||||
Handle(StdSelect_ViewerSelector3d) myMainSel;
|
||||
Handle(SelectMgr_EntityOwner) myLastPicked;
|
||||
Handle(SelectMgr_EntityOwner) myLastinMain;
|
||||
Standard_Boolean myWasLastMain;
|
||||
Standard_Boolean myToHilightSelected;
|
||||
Handle(AIS_Selection) mySelection;
|
||||
Handle(SelectMgr_OrFilter) myFilters;
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Select3D_SensitiveEntity.hxx>
|
||||
#include <SelectBasics_SensitiveEntity.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_Filter.hxx>
|
||||
#include <SelectMgr_OrFilter.hxx>
|
||||
@@ -184,6 +184,7 @@ void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsTo
|
||||
{
|
||||
anObjToClear.Add (anInteractive);
|
||||
}
|
||||
anOwner->SetSelected (Standard_False);
|
||||
if (anOwner == anInteractive->GlobalSelOwner())
|
||||
{
|
||||
myObjects.ChangeFind (anInteractive)->SetHilightStatus (Standard_False);
|
||||
@@ -327,6 +328,8 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
myDetectedSeq.Clear();
|
||||
|
||||
// preliminaires
|
||||
myLastPicked = myLastinMain;
|
||||
myWasLastMain = Standard_True;
|
||||
AIS_StatusOfDetection aStatus = AIS_SOD_Nothing;
|
||||
Standard_Boolean toUpdateViewer = Standard_False;
|
||||
|
||||
@@ -396,6 +399,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
|
||||
// initialize myLastPicked field with currently detected object
|
||||
myLastPicked = aNewPickedOwner;
|
||||
myLastinMain = myLastPicked;
|
||||
|
||||
// highlight detected object if it is not selected or myToHilightSelected flag is true
|
||||
if (myLastPicked->HasSelectable())
|
||||
@@ -436,6 +440,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
toUpdateViewer = Standard_True;
|
||||
}
|
||||
|
||||
myLastinMain.Nullify();
|
||||
myLastPicked.Nullify();
|
||||
}
|
||||
|
||||
@@ -495,6 +500,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
|
||||
// all objects detected by the selector are taken, previous current objects are emptied,
|
||||
// new objects are put...
|
||||
ClearSelected (Standard_False);
|
||||
myWasLastMain = Standard_True;
|
||||
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
|
||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
||||
{
|
||||
@@ -503,6 +509,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
|
||||
continue;
|
||||
|
||||
mySelection->Select (aCurOwner);
|
||||
aCurOwner->SetSelected (Standard_True);
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
@@ -534,6 +541,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
|
||||
// all objects detected by the selector are taken, previous current objects are emptied,
|
||||
// new objects are put...
|
||||
ClearSelected (Standard_False);
|
||||
myWasLastMain = Standard_True;
|
||||
myMainSel->Pick (thePolyline, theView);
|
||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
||||
{
|
||||
@@ -542,6 +550,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
|
||||
continue;
|
||||
|
||||
mySelection->Select (anOwner);
|
||||
anOwner->SetSelected (Standard_True);
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
@@ -563,17 +572,17 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
|
||||
//=======================================================================
|
||||
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdateViewer)
|
||||
{
|
||||
if (!myLastPicked.IsNull())
|
||||
if (myWasLastMain && !myLastinMain.IsNull())
|
||||
{
|
||||
if (myAutoHilight)
|
||||
{
|
||||
clearDynamicHighlight();
|
||||
}
|
||||
if (!myLastPicked->IsSelected()
|
||||
|| myLastPicked->IsForcedHilight()
|
||||
if (!myLastinMain->IsSelected()
|
||||
|| myLastinMain->IsForcedHilight()
|
||||
|| NbSelected() > 1)
|
||||
{
|
||||
SetSelected (myLastPicked, Standard_False);
|
||||
SetSelected (myLastinMain, Standard_False);
|
||||
if(toUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
@@ -602,9 +611,9 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Boolean toU
|
||||
{
|
||||
clearDynamicHighlight();
|
||||
}
|
||||
if (!myLastPicked.IsNull())
|
||||
if (myWasLastMain && !myLastinMain.IsNull())
|
||||
{
|
||||
AddOrRemoveSelected (myLastPicked, toUpdateViewer);
|
||||
AddOrRemoveSelected (myLastinMain, toUpdateViewer);
|
||||
}
|
||||
|
||||
Standard_Integer aSelNum = NbSelected();
|
||||
@@ -634,6 +643,7 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
|
||||
{
|
||||
UnhilightSelected (Standard_False);
|
||||
}
|
||||
myWasLastMain = Standard_True;
|
||||
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
|
||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
||||
{
|
||||
@@ -641,7 +651,8 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
|
||||
continue;
|
||||
|
||||
mySelection->Select (anOwner);
|
||||
AIS_SelectStatus aSelStatus = mySelection->Select (anOwner);
|
||||
anOwner->SetSelected (aSelStatus == AIS_SS_Added);
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
@@ -674,6 +685,7 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d
|
||||
{
|
||||
UnhilightSelected (Standard_False);
|
||||
}
|
||||
myWasLastMain = Standard_True;
|
||||
myMainSel->Pick (thePolyline, theView);
|
||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
||||
{
|
||||
@@ -681,7 +693,8 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
|
||||
continue;
|
||||
|
||||
mySelection->Select (anOwner);
|
||||
AIS_SelectStatus aSelStatus = mySelection->Select (anOwner);
|
||||
anOwner->SetSelected (aSelStatus == AIS_SS_Added);
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
@@ -716,6 +729,7 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
|
||||
aState->SetHilightStatus (Standard_True);
|
||||
aState->SetHilightStyle (anObjSelStyle);
|
||||
}
|
||||
anOwner->SetSelected (Standard_True);
|
||||
if (!anOwner->IsAutoHilight())
|
||||
{
|
||||
NCollection_Handle<SelectMgr_SequenceOfOwner> aSeq;
|
||||
@@ -765,6 +779,7 @@ void AIS_InteractiveContext::UnhilightSelected (const Standard_Boolean theToUpda
|
||||
myObjects.ChangeFind (anObj)->SetHilightStatus (Standard_False);
|
||||
}
|
||||
|
||||
anOwner->SetSelected (Standard_False);
|
||||
anOwner->Unhilight (myMainPM);
|
||||
}
|
||||
|
||||
@@ -786,6 +801,13 @@ void AIS_InteractiveContext::ClearSelected (const Standard_Boolean theToUpdateVi
|
||||
{
|
||||
unhighlightSelected();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
aSelIter.Value()->SetSelected (Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
mySelection->Clear();
|
||||
if (myAutoHilight)
|
||||
@@ -811,7 +833,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
|
||||
if (!myObjects.IsBound (theObject))
|
||||
{
|
||||
return;
|
||||
Display (theObject, Standard_False);
|
||||
}
|
||||
|
||||
Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
|
||||
@@ -847,6 +869,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
{
|
||||
Unhilight (aSelectable, Standard_False);
|
||||
}
|
||||
aSelOwner->SetSelected (Standard_False);
|
||||
if (aSelOwner == aSelectable->GlobalSelOwner())
|
||||
{
|
||||
myObjects.ChangeFind (aSelectable)->SetHilightStatus (Standard_False);
|
||||
@@ -871,6 +894,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
HilightWithColor (theObject, anObjSelStyle, Standard_False);
|
||||
}
|
||||
}
|
||||
anOwner->SetSelected (Standard_True);
|
||||
|
||||
if (theToUpdateViewer)
|
||||
UpdateCurrentViewer();
|
||||
@@ -903,7 +927,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
|
||||
}
|
||||
|
||||
if (!myObjects.IsBound (anObject))
|
||||
return;
|
||||
Display (anObject, Standard_False);
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
@@ -917,10 +941,12 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
|
||||
if (!HighlightStyle (theOwner, aCustomStyle) ||
|
||||
(!aCustomStyle.IsNull() && aCustomStyle != anObjSelStyle))
|
||||
{
|
||||
theOwner->SetSelected (Standard_True);
|
||||
highlightSelected (theOwner);
|
||||
}
|
||||
}
|
||||
|
||||
theOwner->SetSelected (Standard_True);
|
||||
if (myAutoHilight && theOwner == anObject->GlobalSelOwner())
|
||||
{
|
||||
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObject);
|
||||
@@ -969,7 +995,8 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
||||
if (!myFilters->IsOk(theOwner) && !theOwner->IsSelected())
|
||||
return;
|
||||
|
||||
mySelection->Select (theOwner);
|
||||
AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
|
||||
theOwner->SetSelected (aSelStat == AIS_SS_Added);
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
@@ -1004,43 +1031,6 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetSelectedState
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean AIS_InteractiveContext::SetSelectedState (const Handle(SelectMgr_EntityOwner)& theEntity,
|
||||
const Standard_Boolean theIsSelected)
|
||||
{
|
||||
if (theEntity.IsNull())
|
||||
{
|
||||
throw Standard_ProgramError ("Internal error: AIS_InteractiveContext::SetSelectedState() called with NO object");
|
||||
}
|
||||
|
||||
if (!theEntity->HasSelectable()
|
||||
|| mySelection->IsSelected (theEntity) == theIsSelected)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (theEntity->IsAutoHilight())
|
||||
{
|
||||
AddOrRemoveSelected (theEntity, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (theIsSelected)
|
||||
{
|
||||
const AIS_SelectStatus aSelStatus = mySelection->AddSelect (theEntity);
|
||||
theEntity->SetSelected (true);
|
||||
return aSelStatus == AIS_SS_Added;
|
||||
}
|
||||
else
|
||||
{
|
||||
const AIS_SelectStatus aSelStatus = mySelection->Select (theEntity);
|
||||
theEntity->SetSelected (false);
|
||||
return aSelStatus == AIS_SS_Removed;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSelected
|
||||
@@ -1154,9 +1144,9 @@ void AIS_InteractiveContext::EntityOwners(Handle(SelectMgr_IndexedMapOfOwner)& t
|
||||
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
if (Handle(Select3D_SensitiveEntity) aEntity = aSelEntIter.Value()->BaseSensitive())
|
||||
if (Handle(SelectBasics_SensitiveEntity) aEntity = aSelEntIter.Value()->BaseSensitive())
|
||||
{
|
||||
if (const Handle(SelectMgr_EntityOwner)& aOwner = aEntity->OwnerId())
|
||||
if (Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast(aEntity->OwnerId()))
|
||||
{
|
||||
theOwners->Add (aOwner);
|
||||
}
|
||||
@@ -1211,6 +1201,7 @@ Standard_Integer AIS_InteractiveContext::HilightNextDetected (const Handle(V3d_V
|
||||
|
||||
highlightWithColor (anOwner, theView->Viewer());
|
||||
myLastPicked = anOwner;
|
||||
myLastinMain = myLastPicked;
|
||||
|
||||
if (theToRedrawImmediate)
|
||||
{
|
||||
@@ -1246,6 +1237,7 @@ Standard_Integer AIS_InteractiveContext::HilightPreviousDetected (const Handle(V
|
||||
|
||||
highlightWithColor (anOwner, theView->Viewer());
|
||||
myLastPicked = anOwner;
|
||||
myLastinMain = myLastPicked;
|
||||
|
||||
if (theToRedrawImmediate)
|
||||
{
|
||||
|
@@ -18,7 +18,6 @@
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectFillCapping.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
@@ -84,37 +83,6 @@ void AIS_InteractiveObject::SetContext (const Handle(AIS_InteractiveContext)& th
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetCappingStyle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetCappingStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle)
|
||||
{
|
||||
myCappingStyle = theStyle;
|
||||
|
||||
// Modify existing presentations
|
||||
for (Standard_Integer aPrsIter = 1, n = myPresentations.Length(); aPrsIter <= n; ++aPrsIter)
|
||||
{
|
||||
const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter);
|
||||
if (!aPrs3d.IsNull())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
|
||||
if (!aStruct.IsNull())
|
||||
{
|
||||
const Graphic3d_SequenceOfGroup& aGroups = aStruct->Groups();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
Handle(Graphic3d_Group)& aGrp = aGroupIter.ChangeValue();
|
||||
if (aGrp.IsNull())
|
||||
continue;
|
||||
|
||||
aGrp->SetGroupPrimitivesAspect (theStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasPresentation
|
||||
//purpose :
|
||||
|
@@ -104,12 +104,6 @@ public:
|
||||
void ClearOwner() { myOwner.Nullify(); }
|
||||
|
||||
public:
|
||||
//! Set style of filling capping section created by clipping planes.
|
||||
Standard_EXPORT virtual void SetCappingStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle);
|
||||
|
||||
//! Returns style for filling capping section created by clipping planes.
|
||||
const Handle(Graphic3d_AspectFillCapping)& CappingStyle() const { return myCappingStyle; }
|
||||
|
||||
|
||||
//! Returns the context pointer to the interactive context.
|
||||
Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
|
||||
@@ -134,7 +128,6 @@ protected:
|
||||
|
||||
AIS_InteractiveContext* myCTXPtr; //!< pointer to Interactive Context, where object is currently displayed; @sa SetContext()
|
||||
Handle(Standard_Transient) myOwner; //!< application-specific owner object
|
||||
Handle(Graphic3d_AspectFillCapping) myCappingStyle;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -85,7 +85,7 @@ namespace
|
||||
{
|
||||
public:
|
||||
//! Main constructor.
|
||||
ManipSensCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
ManipSensCircle (const Handle(SelectBasics_EntityOwner)& theOwnerId,
|
||||
const Handle(Geom_Circle)& theCircle,
|
||||
const Standard_Integer theNbPnts)
|
||||
: Select3D_SensitiveCircle (theOwnerId, theCircle, Standard_False, theNbPnts),
|
||||
@@ -104,7 +104,7 @@ namespace
|
||||
class ManipSensTriangulation : public Select3D_SensitiveTriangulation, public ManipSensRotation
|
||||
{
|
||||
public:
|
||||
ManipSensTriangulation (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
ManipSensTriangulation (const Handle(SelectBasics_EntityOwner)& theOwnerId,
|
||||
const Handle(Poly_Triangulation)& theTrg,
|
||||
const gp_Dir& thePlaneNormal)
|
||||
: Select3D_SensitiveTriangulation (theOwnerId, theTrg, TopLoc_Location(), Standard_True),
|
||||
@@ -1035,21 +1035,15 @@ void AIS_Manipulator::HilightOwnerWithColor (const Handle(PrsMgr_PresentationMan
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
aPresentation->CStructure()->ViewAffinity = thePM->StructureManager()->ObjectAffinity (Handle(Standard_Transient) (this));
|
||||
|
||||
if (anOwner->Mode() == AIS_MM_TranslationPlane)
|
||||
{
|
||||
Handle(Prs3d_Drawer) aStyle = new Prs3d_Drawer();
|
||||
aStyle->SetColor (myAxes[anOwner->Index()].Color());
|
||||
aStyle->SetTransparency (0.5);
|
||||
aPresentation->Highlight (aStyle);
|
||||
aStyle->SetColor(myAxes[anOwner->Index()].Color());
|
||||
aStyle->SetTransparency(0.5);
|
||||
aPresentation->Highlight(aStyle);
|
||||
}
|
||||
else
|
||||
{
|
||||
aPresentation->Highlight (theStyle);
|
||||
}
|
||||
|
||||
aPresentation->Highlight(theStyle);
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPresentation->Groups());
|
||||
aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
|
@@ -1,36 +0,0 @@
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_MouseGesture_HeaderFile
|
||||
#define _AIS_MouseGesture_HeaderFile
|
||||
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
//! Mouse gesture - only one can be active at one moment.
|
||||
enum AIS_MouseGesture
|
||||
{
|
||||
AIS_MouseGesture_NONE, //!< no active gesture
|
||||
//
|
||||
AIS_MouseGesture_SelectRectangle, //!< rectangular selection
|
||||
AIS_MouseGesture_SelectLasso, //!< polygonal selection
|
||||
//
|
||||
AIS_MouseGesture_Zoom, //!< view zoom gesture
|
||||
AIS_MouseGesture_Pan, //!< view panning gesture
|
||||
AIS_MouseGesture_RotateOrbit, //!< orbit rotation gesture
|
||||
AIS_MouseGesture_RotateView, //!< view rotation gesture
|
||||
};
|
||||
|
||||
//! Map defining mouse gestures.
|
||||
typedef NCollection_DataMap<unsigned int, AIS_MouseGesture> AIS_MouseGestureMap;
|
||||
|
||||
#endif // _AIS_MouseGesture_HeaderFile
|
@@ -1,31 +0,0 @@
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_NavigationMode_HeaderFile
|
||||
#define _AIS_NavigationMode_HeaderFile
|
||||
|
||||
//! Camera navigation mode.
|
||||
enum AIS_NavigationMode
|
||||
{
|
||||
AIS_NavigationMode_Orbit, //!< orbit rotation
|
||||
AIS_NavigationMode_FirstPersonFlight, //!< flight rotation (first person)
|
||||
AIS_NavigationMode_FirstPersonWalk, //!< walking mode (first person)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AIS_NavigationMode_LOWER = 0,
|
||||
AIS_NavigationMode_UPPER = AIS_NavigationMode_FirstPersonWalk
|
||||
};
|
||||
|
||||
#endif // _V3d_NavigationMode_HeaderFile
|
@@ -43,6 +43,7 @@
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Select3D_SensitiveTriangulation.hxx>
|
||||
#include <SelectBasics_EntityOwner.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StdPrs_Plane.hxx>
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <Prs3d_Projector.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Select3D_SensitivePoint.hxx>
|
||||
#include <SelectBasics_EntityOwner.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StdPrs_Point.hxx>
|
||||
@@ -123,6 +124,7 @@ void AIS_Point::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
|
||||
const Standard_Integer /*aMode*/)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this,10);
|
||||
// eown -> SelectBasics_EntityOwner::Set(5);
|
||||
Handle(Select3D_SensitivePoint) sp = new Select3D_SensitivePoint(eown,
|
||||
myComponent->Pnt());
|
||||
aSelection->Add(sp);
|
||||
|
@@ -1,33 +0,0 @@
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_RotationMode_HeaderFile
|
||||
#define _AIS_RotationMode_HeaderFile
|
||||
|
||||
//! Camera rotation mode.
|
||||
enum AIS_RotationMode
|
||||
{
|
||||
AIS_RotationMode_BndBoxActive, //!< default OCCT rotation
|
||||
AIS_RotationMode_PickLast, //!< rotate around last picked point
|
||||
AIS_RotationMode_PickCenter, //!< rotate around point at the center of window
|
||||
AIS_RotationMode_CameraAt, //!< rotate around camera center
|
||||
AIS_RotationMode_BndBoxScene, //!< rotate around scene center
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AIS_RotationMode_LOWER = 0,
|
||||
AIS_RotationMode_UPPER = AIS_RotationMode_BndBoxScene,
|
||||
};
|
||||
|
||||
#endif // _AIS_RotationMode_HeaderFile
|
@@ -39,11 +39,6 @@ AIS_Selection::AIS_Selection()
|
||||
//=======================================================================
|
||||
void AIS_Selection::Clear()
|
||||
{
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (Objects()); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anObject = aSelIter.Value();
|
||||
anObject->SetSelected (Standard_False);
|
||||
}
|
||||
myresult.Clear();
|
||||
myResultMap.Clear();
|
||||
myIterator = AIS_NListOfEntityOwner::Iterator();
|
||||
@@ -66,7 +61,6 @@ AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& the
|
||||
AIS_NListOfEntityOwner::Iterator aListIter;
|
||||
myresult.Append (theObject, aListIter);
|
||||
myResultMap.Bind (theObject, aListIter);
|
||||
theObject->SetSelected (Standard_True);
|
||||
return AIS_SS_Added;
|
||||
}
|
||||
|
||||
@@ -93,7 +87,6 @@ AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& the
|
||||
|
||||
myresult.Remove (aListIter);
|
||||
myResultMap.UnBind (theObject);
|
||||
theObject->SetSelected (Standard_False);
|
||||
|
||||
// update list iterator for next object in <myresult> list if any
|
||||
if (aListIter.More())
|
||||
@@ -127,6 +120,5 @@ AIS_SelectStatus AIS_Selection::AddSelect (const Handle(SelectMgr_EntityOwner)&
|
||||
AIS_NListOfEntityOwner::Iterator aListIter;
|
||||
myresult.Append (theObject, aListIter);
|
||||
myResultMap.Bind (theObject, aListIter);
|
||||
theObject->SetSelected (Standard_True);
|
||||
return AIS_SS_Added;
|
||||
}
|
||||
|
@@ -180,7 +180,10 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer, myCappingStyle);
|
||||
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer,
|
||||
myDrawer->ShadingAspect()->Aspect()->ToMapTexture()
|
||||
&& !myDrawer->ShadingAspect()->Aspect()->TextureMap().IsNull(),
|
||||
myUVOrigin, myUVRepeat, myUVScale);
|
||||
}
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||
#include <Select3D_SensitiveSegment.hxx>
|
||||
#include <Select3D_SensitiveTriangle.hxx>
|
||||
#include <SelectBasics_EntityOwner.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
@@ -731,14 +732,14 @@ void AIS_Trihedron::SetDrawArrows (const Standard_Boolean theToDraw)
|
||||
//function : createSensitiveEntity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Select3D_SensitiveEntity) AIS_Trihedron::createSensitiveEntity (const Prs3d_DatumParts thePart,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner) const
|
||||
Handle(SelectBasics_SensitiveEntity) AIS_Trihedron::createSensitiveEntity (const Prs3d_DatumParts thePart,
|
||||
const Handle(SelectBasics_EntityOwner)& theOwner) const
|
||||
{
|
||||
Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect();
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrimitives = arrayOfPrimitives (thePart);
|
||||
if (aPrimitives.IsNull())
|
||||
{
|
||||
return Handle(Select3D_SensitiveEntity)();
|
||||
return Handle(SelectBasics_SensitiveEntity)();
|
||||
}
|
||||
|
||||
if (thePart >= Prs3d_DP_XOYAxis
|
||||
@@ -768,7 +769,7 @@ Handle(Select3D_SensitiveEntity) AIS_Trihedron::createSensitiveEntity (const Prs
|
||||
const gp_Pnt anXYZ2 = aSegments->Vertice (2);
|
||||
return new Select3D_SensitiveSegment (theOwner, anXYZ1, anXYZ2);
|
||||
}
|
||||
return Handle(Select3D_SensitiveEntity)();
|
||||
return Handle(SelectBasics_SensitiveEntity)();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -225,8 +225,8 @@ protected:
|
||||
protected:
|
||||
|
||||
//! Creates a sensitive entity for the datum part that will be used in selection owner creation.
|
||||
Standard_EXPORT Handle(Select3D_SensitiveEntity) createSensitiveEntity (const Prs3d_DatumParts thePart,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner) const;
|
||||
Standard_EXPORT Handle(SelectBasics_SensitiveEntity) createSensitiveEntity (const Prs3d_DatumParts thePart,
|
||||
const Handle(SelectBasics_EntityOwner)& theOwner) const;
|
||||
|
||||
//! Computes presentation for display mode equal 1.
|
||||
Standard_EXPORT void computePresentation (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,658 +0,0 @@
|
||||
// Copyright (c) 2016-2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_ViewController_HeaderFile
|
||||
#define _AIS_ViewController_HeaderFile
|
||||
|
||||
#include <Aspect_VKeySet.hxx>
|
||||
#include <Aspect_TouchMap.hxx>
|
||||
#include <AIS_DragAction.hxx>
|
||||
#include <AIS_MouseGesture.hxx>
|
||||
#include <AIS_NavigationMode.hxx>
|
||||
#include <AIS_ViewInputBuffer.hxx>
|
||||
#include <AIS_RotationMode.hxx>
|
||||
#include <AIS_WalkDelta.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_Vec3.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_Mutex.hxx>
|
||||
|
||||
class AIS_InteractiveObject;
|
||||
class AIS_InteractiveContext;
|
||||
class AIS_Point;
|
||||
class AIS_RubberBand;
|
||||
class V3d_View;
|
||||
|
||||
//! Auxiliary structure for handling viewer events between GUI and Rendering threads.
|
||||
//!
|
||||
//! Class implements the following features:
|
||||
//! - Buffers storing the state of user input (mouse, touches and keyboard).
|
||||
//! - Mapping mouse/multi-touch input to View camera manipulations (panning/rotating/zooming).
|
||||
//! - Input events are not applied immediately but queued for separate processing from two working threads
|
||||
//! UI thread receiving user input and Rendering thread for OCCT 3D Viewer drawing.
|
||||
class AIS_ViewController
|
||||
{
|
||||
public:
|
||||
|
||||
//! Empty constructor.
|
||||
Standard_EXPORT AIS_ViewController();
|
||||
|
||||
//! Return input buffer.
|
||||
const AIS_ViewInputBuffer& InputBuffer (AIS_ViewInputBufferType theType) const { return theType == AIS_ViewInputBufferType_UI ? myUI : myGL; }
|
||||
|
||||
//! Return input buffer.
|
||||
AIS_ViewInputBuffer& ChangeInputBuffer (AIS_ViewInputBufferType theType) { return theType == AIS_ViewInputBufferType_UI ? myUI : myGL; }
|
||||
|
||||
public: //! @name global parameters
|
||||
|
||||
//! Return camera rotation mode, AIS_RotationMode_BndBoxActive by default.
|
||||
AIS_RotationMode RotationMode() const { return myRotationMode; }
|
||||
|
||||
//! Set camera rotation mode.
|
||||
void SetRotationMode (AIS_RotationMode theMode) { myRotationMode = theMode; }
|
||||
|
||||
//! Return camera navigation mode; AIS_NavigationMode_Orbit by default.
|
||||
AIS_NavigationMode NavigationMode() const { return myNavigationMode; }
|
||||
|
||||
//! Set camera navigation mode.
|
||||
Standard_EXPORT void SetNavigationMode (AIS_NavigationMode theMode);
|
||||
|
||||
//! Return mouse input acceleration ratio in First Person mode; 1.0 by default.
|
||||
float MouseAcceleration() const { return myMouseAccel; }
|
||||
|
||||
//! Set mouse input acceleration ratio.
|
||||
void SetMouseAcceleration (float theRatio) { myMouseAccel = theRatio; }
|
||||
|
||||
//! Return orbit rotation acceleration ratio; 1.0 by default.
|
||||
float OrbitAcceleration() const { return myOrbitAccel; }
|
||||
|
||||
//! Set orbit rotation acceleration ratio.
|
||||
void SetOrbitAcceleration (float theRatio) { myOrbitAccel = theRatio; }
|
||||
|
||||
//! Return TRUE if panning anchor point within perspective projection should be displayed in 3D Viewer; TRUE by default.
|
||||
bool ToShowPanAnchorPoint() const { return myToShowPanAnchorPoint; }
|
||||
|
||||
//! Set if panning anchor point within perspective projection should be displayed in 3D Viewer.
|
||||
void SetShowPanAnchorPoint (bool theToShow) { myToShowPanAnchorPoint = theToShow; }
|
||||
|
||||
//! Return TRUE if rotation point should be displayed in 3D Viewer; TRUE by default.
|
||||
bool ToShowRotateCenter() const { return myToShowRotateCenter; }
|
||||
|
||||
//! Set if rotation point should be displayed in 3D Viewer.
|
||||
void SetShowRotateCenter (bool theToShow) { myToShowRotateCenter = theToShow; }
|
||||
|
||||
//! Return TRUE if camera up orientation within AIS_NavigationMode_Orbit rotation mode should be forced Z up; FALSE by default.
|
||||
bool ToLockOrbitZUp() const { return myToLockOrbitZUp; }
|
||||
|
||||
//! Set if camera up orientation within AIS_NavigationMode_Orbit rotation mode should be forced Z up.
|
||||
void SetLockOrbitZUp (bool theToForceUp) { myToLockOrbitZUp = theToForceUp; }
|
||||
|
||||
//! Return TRUE if z-rotation via two-touches gesture is enabled; FALSE by default.
|
||||
bool ToAllowTouchZRotation() const { return myToAllowTouchZRotation; }
|
||||
|
||||
//! Set if z-rotation via two-touches gesture is enabled.
|
||||
void SetAllowTouchZRotation (bool theToEnable) { myToAllowTouchZRotation = theToEnable; }
|
||||
|
||||
//! Return TRUE if camera rotation is allowed; TRUE by default.
|
||||
bool ToAllowRotation() const { return myToAllowRotation; }
|
||||
|
||||
//! Set if camera rotation is allowed.
|
||||
void SetAllowRotation (bool theToEnable) { myToAllowRotation = theToEnable; }
|
||||
|
||||
//! Return TRUE if panning is allowed; TRUE by default.
|
||||
bool ToAllowPanning() const { return myToAllowPanning; }
|
||||
|
||||
//! Set if panning is allowed.
|
||||
void SetAllowPanning (bool theToEnable) { myToAllowPanning = theToEnable; }
|
||||
|
||||
//! Return TRUE if zooming is allowed; TRUE by default.
|
||||
bool ToAllowZooming() const { return myToAllowZooming; }
|
||||
|
||||
//! Set if zooming is allowed.
|
||||
void SetAllowZooming (bool theToEnable) { myToAllowZooming = theToEnable; }
|
||||
|
||||
//! Return TRUE if ZFocus change is allowed; TRUE by default.
|
||||
bool ToAllowZFocus() const { return myToAllowZFocus; }
|
||||
|
||||
//! Set if ZFocus change is allowed.
|
||||
void SetAllowZFocus (bool theToEnable) { myToAllowZFocus = theToEnable; }
|
||||
|
||||
//! Return TRUE if dynamic highlight on mouse move is allowed; TRUE by default.
|
||||
bool ToAllowHighlight() const { return myToAllowHighlight; }
|
||||
|
||||
//! Set if dragging object is allowed.
|
||||
void SetAllowHighlight (bool theToEnable) { myToAllowHighlight = theToEnable; }
|
||||
|
||||
//! Return TRUE if dragging object is allowed; TRUE by default.
|
||||
bool ToAllowDragging() const { return myToAllowDragging; }
|
||||
|
||||
//! Set if dynamic highlight on mouse move is allowed.
|
||||
void SetAllowDragging (bool theToEnable) { myToAllowDragging = theToEnable; }
|
||||
|
||||
//! Return TRUE if pitch direction should be inverted while processing Aspect_VKey_NavLookUp/Aspect_VKey_NavLookDown; FALSE by default.
|
||||
bool ToInvertPitch() const { return myToInvertPitch; }
|
||||
|
||||
//! Set flag inverting pitch direction.
|
||||
void SetInvertPitch (bool theToInvert) { myToInvertPitch = theToInvert; }
|
||||
|
||||
//! Return normal walking speed, in m/s; 1.5 by default.
|
||||
float WalkSpeedAbsolute() const { return myWalkSpeedAbsolute; }
|
||||
|
||||
//! Set normal walking speed, in m/s; 1.5 by default.
|
||||
void SetWalkSpeedAbsolute (float theSpeed) { myWalkSpeedAbsolute = theSpeed; }
|
||||
|
||||
//! Return walking speed relative to scene bounding box; 0.1 by default.
|
||||
float WalkSpeedRelative() const { return myWalkSpeedRelative; }
|
||||
|
||||
//! Set walking speed relative to scene bounding box.
|
||||
void SetWalkSpeedRelative (float theFactor) { myWalkSpeedRelative = theFactor; }
|
||||
|
||||
//! Return active thrust value; 0.0f by default.
|
||||
float ThrustSpeed() const { return myThrustSpeed; }
|
||||
|
||||
//! Set active thrust value.
|
||||
void SetThrustSpeed (float theSpeed) { myThrustSpeed = theSpeed; }
|
||||
|
||||
//! Return TRUE if previous position of MoveTo has been defined.
|
||||
bool HasPreviousMoveTo() const { return myPrevMoveTo != Graphic3d_Vec2i (-1); }
|
||||
|
||||
//! Return previous position of MoveTo event in 3D viewer.
|
||||
const Graphic3d_Vec2i& PreviousMoveTo() const { return myPrevMoveTo; }
|
||||
|
||||
//! Reset previous position of MoveTo.
|
||||
void ResetPreviousMoveTo() { myPrevMoveTo = Graphic3d_Vec2i (-1); }
|
||||
|
||||
public: //! @name keyboard input
|
||||
|
||||
//! Return keyboard state.
|
||||
const Aspect_VKeySet& Keys() const { return myKeys; }
|
||||
|
||||
//! Return keyboard state.
|
||||
Aspect_VKeySet& ChangeKeys() { return myKeys; }
|
||||
|
||||
//! Press key.
|
||||
//! @param theKey key pressed
|
||||
//! @param theTime event timestamp
|
||||
Standard_EXPORT virtual void KeyDown (Aspect_VKey theKey,
|
||||
double theTime,
|
||||
double thePressure = 1.0);
|
||||
|
||||
//! Release key.
|
||||
//! @param theKey key pressed
|
||||
//! @param theTime event timestamp
|
||||
Standard_EXPORT virtual void KeyUp (Aspect_VKey theKey,
|
||||
double theTime);
|
||||
|
||||
//! Simulate key up/down events from axis value.
|
||||
Standard_EXPORT virtual void KeyFromAxis (Aspect_VKey theNegative,
|
||||
Aspect_VKey thePositive,
|
||||
double theTime,
|
||||
double thePressure);
|
||||
|
||||
//! Fetch active navigation actions.
|
||||
Standard_EXPORT AIS_WalkDelta FetchNavigationKeys (Standard_Real theCrouchRatio,
|
||||
Standard_Real theRunRatio);
|
||||
|
||||
public: //! @name mouse input
|
||||
|
||||
//! Return map defining mouse gestures.
|
||||
const AIS_MouseGestureMap& MouseGestureMap() const { return myMouseGestureMap; }
|
||||
|
||||
//! Return map defining mouse gestures.
|
||||
AIS_MouseGestureMap& ChangeMouseGestureMap() { return myMouseGestureMap; }
|
||||
|
||||
//! Return double click interval in seconds; 0.4 by default.
|
||||
double MouseDoubleClickInterval() const { return myMouseDoubleClickInt; }
|
||||
|
||||
//! Set double click interval in seconds.
|
||||
void SetMouseDoubleClickInterval (double theSeconds) { myMouseDoubleClickInt = theSeconds; }
|
||||
|
||||
//! Perform selection in 3D viewer.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePnt picking point
|
||||
//! @param theIsXOR XOR selection flag
|
||||
Standard_EXPORT virtual void SelectInViewer (const Graphic3d_Vec2i& thePnt,
|
||||
const bool theIsXOR = false);
|
||||
|
||||
//! Perform selection in 3D viewer.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePnts picking point
|
||||
//! @param theIsXOR XOR selection flag
|
||||
Standard_EXPORT virtual void SelectInViewer (const NCollection_Sequence<Graphic3d_Vec2i>& thePnts,
|
||||
const bool theIsXOR = false);
|
||||
|
||||
//! Update rectangle selection tool.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePntFrom rectangle first corner
|
||||
//! @param thePntTo rectangle another corner
|
||||
//! @param theIsXOR XOR selection flag
|
||||
Standard_EXPORT virtual void UpdateRubberBand (const Graphic3d_Vec2i& thePntFrom,
|
||||
const Graphic3d_Vec2i& thePntTo,
|
||||
const bool theIsXOR = false);
|
||||
|
||||
//! Update polygonal selection tool.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePnt new point to add to polygon
|
||||
//! @param theToAppend append new point or update the last point
|
||||
Standard_EXPORT virtual void UpdatePolySelection (const Graphic3d_Vec2i& thePnt,
|
||||
bool theToAppend);
|
||||
|
||||
//! Update zoom event (e.g. from mouse scroll).
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param theDelta mouse cursor position to zoom at and zoom delta
|
||||
//! @return TRUE if new zoom event has been created or FALSE if existing one has been updated
|
||||
Standard_EXPORT virtual bool UpdateZoom (const Aspect_ScrollDelta& theDelta);
|
||||
|
||||
//! Update Z rotation event.
|
||||
//! @param theAngle rotation angle, in radians.
|
||||
//! @return TRUE if new zoom event has been created or FALSE if existing one has been updated
|
||||
Standard_EXPORT virtual bool UpdateZRotation (double theAngle);
|
||||
|
||||
//! Update mouse scroll event; redirects to UpdateZoom by default.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param theDelta mouse cursor position and delta
|
||||
//! @return TRUE if new event has been created or FALSE if existing one has been updated
|
||||
Standard_EXPORT virtual bool UpdateMouseScroll (const Aspect_ScrollDelta& theDelta);
|
||||
|
||||
//! Handle mouse button press/release event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButtons pressed buttons
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
|
||||
//! but emulated from non-precise input like touch on screen
|
||||
//! @return TRUE if View should be redrawn
|
||||
Standard_EXPORT virtual bool UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButtons,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated);
|
||||
|
||||
//! Handle mouse cursor movement event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButtons pressed buttons
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
|
||||
//! but emulated from non-precise input like touch on screen
|
||||
//! @return TRUE if View should be redrawn
|
||||
Standard_EXPORT virtual bool UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButtons,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated);
|
||||
|
||||
//! Handle mouse button press event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButton pressed button
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
|
||||
//! but emulated from non-precise input like touch on screen
|
||||
//! @return TRUE if View should be redrawn
|
||||
bool PressMouseButton (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButton,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated)
|
||||
{
|
||||
return UpdateMouseButtons (thePoint, myMousePressed | theButton, theModifiers, theIsEmulated);
|
||||
}
|
||||
|
||||
//! Handle mouse button release event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButton released button
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
|
||||
//! but emulated from non-precise input like touch on screen
|
||||
//! @return TRUE if View should be redrawn
|
||||
bool ReleaseMouseButton (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButton,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated)
|
||||
{
|
||||
Aspect_VKeyMouse aButtons = myMousePressed & (~theButton);
|
||||
return UpdateMouseButtons (thePoint, aButtons, theModifiers, theIsEmulated);
|
||||
}
|
||||
|
||||
//! Handle mouse button click event (emulated by UpdateMouseButtons() while releasing single button).
|
||||
//! Note that as this method is called by UpdateMouseButtons(), it should be executed from UI thread.
|
||||
//! Default implementation redirects to SelectInViewer().
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButton clicked button
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsDoubleClick flag indicating double mouse click
|
||||
//! @return TRUE if View should be redrawn
|
||||
Standard_EXPORT virtual bool UpdateMouseClick (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButton,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsDoubleClick);
|
||||
|
||||
//! Return currently pressed mouse buttons.
|
||||
Aspect_VKeyMouse PressedMouseButtons() const { return myMousePressed; }
|
||||
|
||||
//! Return active key modifiers passed with last mouse event.
|
||||
Aspect_VKeyFlags LastMouseFlags() const { return myMouseModifiers; }
|
||||
|
||||
//! Return last mouse position.
|
||||
const Graphic3d_Vec2i& LastMousePosition() const { return myMousePositionLast; }
|
||||
|
||||
public: //! @name multi-touch input
|
||||
|
||||
//! Return scale factor for adjusting tolerances for starting multi-touch gestures; 1.0 by default
|
||||
//! This scale factor is expected to be computed from touch screen resolution.
|
||||
float TouchToleranceScale() const { return myTouchToleranceScale; }
|
||||
|
||||
//! Set scale factor for adjusting tolerances for starting multi-touch gestures.
|
||||
void SetTouchToleranceScale (float theTolerance) { myTouchToleranceScale = theTolerance; }
|
||||
|
||||
//! Return TRUE if touches map is not empty.
|
||||
bool HasTouchPoints() const { return !myTouchPoints.IsEmpty(); }
|
||||
|
||||
//! Add touch point with the given ID.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param theId touch unique identifier
|
||||
//! @param thePnt touch coordinates
|
||||
//! @param theClearBefore if TRUE previously registered touches will be removed
|
||||
Standard_EXPORT virtual void AddTouchPoint (Standard_Size theId,
|
||||
const Graphic3d_Vec2d& thePnt,
|
||||
Standard_Boolean theClearBefore = false);
|
||||
|
||||
//! Remove touch point with the given ID.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param theId touch unique identifier
|
||||
//! @param theClearSelectPnts if TRUE will initiate clearing of selection points
|
||||
//! @return TRUE if point has been removed
|
||||
Standard_EXPORT virtual bool RemoveTouchPoint (Standard_Size theId,
|
||||
Standard_Boolean theClearSelectPnts = false);
|
||||
|
||||
//! Update touch point with the given ID.
|
||||
//! If point with specified ID was not registered before, it will be added.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param theId touch unique identifier
|
||||
//! @param thePnt touch coordinates
|
||||
Standard_EXPORT virtual void UpdateTouchPoint (Standard_Size theId,
|
||||
const Graphic3d_Vec2d& thePnt);
|
||||
|
||||
public:
|
||||
|
||||
//! Return event time (e.g. current time).
|
||||
double EventTime() const { return myEventTimer.ElapsedTime(); }
|
||||
|
||||
//! Reset input state (pressed keys, mouse buttons, etc.) e.g. on window focus loss.
|
||||
//! This method is expected to be called from UI thread.
|
||||
Standard_EXPORT virtual void ResetViewInput();
|
||||
|
||||
//! Reset view orientation.
|
||||
//! This method is expected to be called from UI thread.
|
||||
Standard_EXPORT virtual void UpdateViewOrientation (V3d_TypeOfOrientation theOrientation,
|
||||
bool theToFitAll);
|
||||
|
||||
//! Update buffer for rendering thread.
|
||||
//! This method is expected to be called within synchronization barrier between GUI
|
||||
//! and Rendering threads (e.g. GUI thread should be locked beforehand to avoid data races).
|
||||
//! @param theCtx interactive context
|
||||
//! @param theView active view
|
||||
//! @param theToHandle if TRUE, the HandleViewEvents() will be called
|
||||
Standard_EXPORT virtual void FlushViewEvents (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView,
|
||||
Standard_Boolean theToHandle = Standard_False);
|
||||
|
||||
//! Process events within rendering thread.
|
||||
Standard_EXPORT virtual void HandleViewEvents (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
public:
|
||||
|
||||
//! Callback called by handleMoveTo() on Selection in 3D Viewer.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void OnSelectionChanged (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Callback called by handleMoveTo() on dragging object in 3D Viewer.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void OnObjectDragged (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView,
|
||||
AIS_DragAction theAction);
|
||||
|
||||
//! Pick closest point under mouse cursor.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
//! @param thePnt [out] result point
|
||||
//! @param theCtx [in] interactive context
|
||||
//! @param theView [in] active view
|
||||
//! @param theCursor [in] mouse cursor
|
||||
//! @param theToStickToPickRay [in] when TRUE, the result point will lie on picking ray
|
||||
//! @return TRUE if result has been found
|
||||
Standard_EXPORT virtual bool PickPoint (gp_Pnt& thePnt,
|
||||
const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView,
|
||||
const Graphic3d_Vec2i& theCursor,
|
||||
bool theToStickToPickRay);
|
||||
|
||||
//! Compute rotation gravity center point depending on rotation mode.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual gp_Pnt GravityPoint (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
public:
|
||||
|
||||
//! Perform camera actions.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleCameraActions (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView,
|
||||
const AIS_WalkDelta& theWalk);
|
||||
|
||||
//! Perform moveto/selection/dragging.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleMoveTo (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Return TRUE if another frame should be drawn right after this one.
|
||||
bool toAskNextFrame() const { return myToAskNextFrame; }
|
||||
|
||||
//! Set if another frame should be drawn right after this one.
|
||||
void setAskNextFrame (bool theToDraw = true) { myToAskNextFrame = theToDraw; }
|
||||
|
||||
//! Return if panning anchor point has been defined.
|
||||
bool hasPanningAnchorPoint() const { return !Precision::IsInfinite (myPanPnt3d.X()); }
|
||||
|
||||
//! Return active panning anchor point.
|
||||
const gp_Pnt& panningAnchorPoint() const { return myPanPnt3d; }
|
||||
|
||||
//! Set active panning anchor point.
|
||||
void setPanningAnchorPoint (const gp_Pnt& thePnt) { myPanPnt3d = thePnt; }
|
||||
|
||||
//! Handle panning event myGL.Panning.
|
||||
Standard_EXPORT virtual void handlePanning (const Handle(V3d_View)& theView);
|
||||
|
||||
//! Handle Z rotation event myGL.ZRotate.
|
||||
Standard_EXPORT virtual void handleZRotate (const Handle(V3d_View)& theView);
|
||||
|
||||
//! Return minimal camera distance for zoom operation.
|
||||
double MinZoomDistance() const { return myMinCamDistance; }
|
||||
|
||||
//! Set minimal camera distance for zoom operation.
|
||||
void SetMinZoomDistance (double theDist) { myMinCamDistance = theDist; }
|
||||
|
||||
//! Handle zoom event myGL.ZoomActions.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleZoom (const Handle(V3d_View)& theView,
|
||||
const Aspect_ScrollDelta& theParams,
|
||||
const gp_Pnt* thePnt);
|
||||
|
||||
//! Handle ZScroll event myGL.ZoomActions.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleZFocusScroll (const Handle(V3d_View)& theView,
|
||||
const Aspect_ScrollDelta& theParams);
|
||||
|
||||
//! Handle orbital rotation events myGL.OrbitRotation.
|
||||
//! @param theView view to modify
|
||||
//! @param thePnt 3D point to rotate around
|
||||
//! @param theToLockZUp amend camera to exclude roll angle (put camera Up vector to plane containing global Z and view direction)
|
||||
Standard_EXPORT virtual void handleOrbitRotation (const Handle(V3d_View)& theView,
|
||||
const gp_Pnt& thePnt,
|
||||
bool theToLockZUp);
|
||||
|
||||
//! Handle view direction rotation events myGL.ViewRotation.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
//! @param theView camera to modify
|
||||
//! @param theYawExtra extra yaw increment
|
||||
//! @param thePitchExtra extra pitch increment
|
||||
//! @param theRoll roll value
|
||||
//! @param theToRestartOnIncrement flag indicating flight mode
|
||||
Standard_EXPORT virtual void handleViewRotation (const Handle(V3d_View)& theView,
|
||||
double theYawExtra,
|
||||
double thePitchExtra,
|
||||
double theRoll,
|
||||
bool theToRestartOnIncrement);
|
||||
|
||||
//! Handle view redraw.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleViewRedraw (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
protected:
|
||||
|
||||
//! Flush buffers.
|
||||
Standard_EXPORT virtual void flushBuffers (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Flush touch gestures.
|
||||
Standard_EXPORT virtual void flushGestures (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Return current and previously fetched event times.
|
||||
//! This callback is intended to compute delta between sequentially processed events.
|
||||
//! @param thePrevTime [out] events time fetched previous time by this method
|
||||
//! @param theCurrTime [out] actual events time
|
||||
void updateEventsTime (double& thePrevTime,
|
||||
double& theCurrTime)
|
||||
{
|
||||
thePrevTime = myLastEventsTime;
|
||||
myLastEventsTime = EventTime();
|
||||
theCurrTime = myLastEventsTime;
|
||||
}
|
||||
|
||||
//! Perform selection via mouse click.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleSelectionPick (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Perform dynamic highlight on mouse move.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleDynamicHighlight (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Perform rubber-band selection.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleSelectionPoly (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Lazy AIS_InteractiveContext::MoveTo() with myPrevMoveTo check.
|
||||
Standard_EXPORT virtual void contextLazyMoveTo (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView,
|
||||
const Graphic3d_Vec2i& thePnt);
|
||||
|
||||
protected:
|
||||
|
||||
AIS_ViewInputBuffer myUI; //!< buffer for UI thread
|
||||
AIS_ViewInputBuffer myGL; //!< buffer for rendering thread
|
||||
|
||||
OSD_Timer myEventTimer; //!< timer for timestamping events
|
||||
Standard_Real myLastEventsTime; //!< last fetched events timer value for computing delta/progress
|
||||
Standard_Boolean myToAskNextFrame; //!< flag indicating that another frame should be drawn right after this one
|
||||
|
||||
Standard_Real myMinCamDistance; //!< minimal camera distance for zoom operation
|
||||
AIS_RotationMode myRotationMode; //!< rotation mode
|
||||
AIS_NavigationMode myNavigationMode; //!< navigation mode (orbit rotation / first person)
|
||||
Standard_ShortReal myMouseAccel; //!< mouse input acceleration ratio in First Person mode
|
||||
Standard_ShortReal myOrbitAccel; //!< Orbit rotation acceleration ratio
|
||||
Standard_Boolean myToShowPanAnchorPoint; //!< option displaying panning anchor point
|
||||
Standard_Boolean myToShowRotateCenter; //!< option displaying rotation center point
|
||||
Standard_Boolean myToLockOrbitZUp; //!< force camera up orientation within AIS_NavigationMode_Orbit rotation mode
|
||||
Standard_Boolean myToInvertPitch; //!< flag inverting pitch direction while processing Aspect_VKey_NavLookUp/Aspect_VKey_NavLookDown
|
||||
Standard_Boolean myToAllowTouchZRotation; //!< enable z-rotation two-touches gesture; FALSE by default
|
||||
Standard_Boolean myToAllowRotation; //!< enable rotation; TRUE by default
|
||||
Standard_Boolean myToAllowPanning; //!< enable panning; TRUE by default
|
||||
Standard_Boolean myToAllowZooming; //!< enable zooming; TRUE by default
|
||||
Standard_Boolean myToAllowZFocus; //!< enable ZFocus change; TRUE by default
|
||||
Standard_Boolean myToAllowHighlight; //!< enable dynamic highlight on mouse move; TRUE by default
|
||||
Standard_Boolean myToAllowDragging; //!< enable dragging object; TRUE by default
|
||||
|
||||
Standard_ShortReal myWalkSpeedAbsolute; //!< normal walking speed, in m/s; 1.5 by default
|
||||
Standard_ShortReal myWalkSpeedRelative; //!< walking speed relative to scene bounding box; 0.1 by default
|
||||
Standard_ShortReal myThrustSpeed; //!< active thrust value
|
||||
Standard_Boolean myHasThrust; //!< flag indicating active thrust
|
||||
|
||||
Handle(AIS_RubberBand) myRubberBand; //!< Rubber-band presentation
|
||||
Handle(AIS_InteractiveObject) myDragObject; //!< currently dragged object
|
||||
Graphic3d_Vec2i myPrevMoveTo; //!< previous position of MoveTo event in 3D viewer
|
||||
Standard_Boolean myHasHlrOnBeforeRotation; //!< flag for restoring Computed mode after rotation
|
||||
|
||||
protected: //! @name keyboard input variables
|
||||
|
||||
Aspect_VKeySet myKeys; //!< keyboard state
|
||||
|
||||
protected: //! @name mouse input variables
|
||||
|
||||
Standard_Real myMouseClickThreshold; //!< mouse click threshold in pixels; 3 by default
|
||||
Standard_Real myMouseDoubleClickInt; //!< double click interval in seconds; 0.4 by default
|
||||
Standard_ShortReal myScrollZoomRatio; //!< distance ratio for mapping mouse scroll event to zoom; 15.0 by default
|
||||
|
||||
AIS_MouseGestureMap myMouseGestureMap; //!< map defining mouse gestures
|
||||
AIS_MouseGesture myMouseActiveGesture; //!< initiated mouse gesture (by pressing mouse button)
|
||||
Standard_Boolean myMouseActiveIdleRotation; //!< flag indicating view idle rotation state
|
||||
Graphic3d_Vec2i myMousePositionLast; //!< last mouse position
|
||||
Graphic3d_Vec2i myMousePressPoint; //!< mouse position where active gesture was been initiated
|
||||
Graphic3d_Vec2i myMouseProgressPoint; //!< gesture progress
|
||||
OSD_Timer myMouseClickTimer; //!< timer for handling double-click event
|
||||
Standard_Integer myMouseClickCounter; //!< counter for handling double-click event
|
||||
Aspect_VKeyMouse myMousePressed; //!< active mouse buttons
|
||||
Aspect_VKeyFlags myMouseModifiers; //!< active key modifiers passed with last mouse event
|
||||
Standard_Integer myMouseSingleButton; //!< index of mouse button pressed alone (>0)
|
||||
|
||||
protected: //! @name multi-touch input variables
|
||||
|
||||
Standard_ShortReal myTouchToleranceScale; //!< tolerance scale factor; 1.0 by default
|
||||
Standard_ShortReal myTouchRotationThresholdPx; //!< threshold for starting one-touch rotation gesture in pixels; 6 by default
|
||||
Standard_ShortReal myTouchZRotationThreshold; //!< threshold for starting two-touch Z-rotation gesture in radians; 2 degrees by default
|
||||
Standard_ShortReal myTouchPanThresholdPx; //!< threshold for starting two-touch panning gesture in pixels; 4 by default
|
||||
Standard_ShortReal myTouchZoomThresholdPx; //!< threshold for starting two-touch zoom (pitch) gesture in pixels; 6 by default
|
||||
Standard_ShortReal myTouchZoomRatio; //!< distance ratio for mapping two-touch zoom (pitch) gesture from pixels to zoom; 0.13 by default
|
||||
|
||||
Aspect_TouchMap myTouchPoints; //!< map of active touches
|
||||
Graphic3d_Vec2d myStartPanCoord; //!< touch coordinates at the moment of starting panning gesture
|
||||
Graphic3d_Vec2d myStartRotCoord; //!< touch coordinates at the moment of starting rotating gesture
|
||||
Standard_Integer myNbTouchesLast; //!< number of touches within previous gesture flush to track gesture changes
|
||||
Standard_Boolean myUpdateStartPointPan; //!< flag indicating that new anchor point should be picked for starting panning gesture
|
||||
Standard_Boolean myUpdateStartPointRot; //!< flag indicating that new gravity point should be picked for starting rotation gesture
|
||||
Standard_Boolean myUpdateStartPointZRot; //!< flag indicating that new gravity point should be picked for starting Z-rotation gesture
|
||||
|
||||
protected: //! @name rotation/panning transient state variables
|
||||
|
||||
Handle(AIS_Point) myAnchorPointPrs1; //!< anchor point presentation (Graphic3d_ZLayerId_Top)
|
||||
Handle(AIS_Point) myAnchorPointPrs2; //!< anchor point presentation (Graphic3d_ZLayerId_Topmost)
|
||||
gp_Pnt myPanPnt3d; //!< active panning anchor point
|
||||
gp_Pnt myRotatePnt3d; //!< active rotation center of gravity
|
||||
gp_Dir myCamStartOpUp; //!< camera Up direction at the beginning of rotation
|
||||
gp_Pnt myCamStartOpEye; //!< camera Eye position at the beginning of rotation
|
||||
gp_Pnt myCamStartOpCenter; //!< camera Center position at the beginning of rotation
|
||||
gp_Vec myCamStartOpToCenter; //!< vector from rotation gravity point to camera Center at the beginning of rotation
|
||||
gp_Vec myCamStartOpToEye; //!< vector from rotation gravity point to camera Eye at the beginning of rotation
|
||||
Graphic3d_Vec3d myRotateStartYawPitchRoll; //!< camera yaw pitch roll at the beginning of rotation
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_ViewController_HeaderFile
|
@@ -1,153 +0,0 @@
|
||||
// Copyright (c) 2016-2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_ViewInputBuffer_HeaderFile
|
||||
#define _AIS_ViewInputBuffer_HeaderFile
|
||||
|
||||
#include <Aspect_ScrollDelta.hxx>
|
||||
|
||||
#include <Graphic3d_Vec2.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
#include <V3d_TypeOfOrientation.hxx>
|
||||
|
||||
//! Selection mode
|
||||
enum AIS_ViewSelectionTool
|
||||
{
|
||||
AIS_ViewSelectionTool_Picking, //!< pick to select
|
||||
AIS_ViewSelectionTool_RubberBand, //!< rubber-band to select
|
||||
AIS_ViewSelectionTool_Polygon //!< polyline to select
|
||||
};
|
||||
|
||||
//! Input buffer type.
|
||||
enum AIS_ViewInputBufferType
|
||||
{
|
||||
AIS_ViewInputBufferType_UI, //!< input buffer for filling from UI thread
|
||||
AIS_ViewInputBufferType_GL, //!< input buffer accessible from GL thread
|
||||
};
|
||||
|
||||
//! Auxiliary structure defining viewer events
|
||||
class AIS_ViewInputBuffer
|
||||
{
|
||||
public:
|
||||
|
||||
bool IsNewGesture; //!< transition from one action to another
|
||||
|
||||
NCollection_Sequence<Aspect_ScrollDelta> ZoomActions; //!< the queue with zoom actions
|
||||
|
||||
struct _orientation
|
||||
{
|
||||
bool ToFitAll; //!< perform FitAll operation
|
||||
bool ToSetViewOrient; //!< set new view orientation
|
||||
V3d_TypeOfOrientation ViewOrient; //!< new view orientation
|
||||
|
||||
_orientation() : ToFitAll (false), ToSetViewOrient (false), ViewOrient (V3d_Xpos) {}
|
||||
} Orientation;
|
||||
|
||||
struct _highlighting
|
||||
{
|
||||
bool ToHilight; //!< perform dynamic highlighting at specified point
|
||||
Graphic3d_Vec2i Point; //!< the new point for dynamic highlighting
|
||||
|
||||
_highlighting() : ToHilight (false) {}
|
||||
} MoveTo;
|
||||
|
||||
struct _selection
|
||||
{
|
||||
AIS_ViewSelectionTool Tool; //!< perform selection
|
||||
bool IsXOR; //!< perform shift selection
|
||||
NCollection_Sequence<Graphic3d_Vec2i>
|
||||
Points; //!< the points for selection
|
||||
bool ToApplyTool; //!< apply rubber-band selection tool
|
||||
|
||||
_selection() : Tool (AIS_ViewSelectionTool_Picking), IsXOR (false), ToApplyTool (false) {}
|
||||
} Selection;
|
||||
|
||||
struct _panningParams
|
||||
{
|
||||
bool ToStart; //!< start panning
|
||||
Graphic3d_Vec2i PointStart; //!< panning start point
|
||||
bool ToPan; //!< perform panning
|
||||
Graphic3d_Vec2i Delta; //!< panning delta
|
||||
|
||||
_panningParams() : ToStart (false), ToPan (false) {}
|
||||
} Panning;
|
||||
|
||||
struct _draggingParams
|
||||
{
|
||||
bool ToStart; //!< start dragging
|
||||
bool ToStop; //!< stop dragging
|
||||
bool ToAbort; //!< abort dragging (restore previous position)
|
||||
Graphic3d_Vec2i PointStart; //!< drag start point
|
||||
Graphic3d_Vec2i PointTo; //!< drag end point
|
||||
|
||||
_draggingParams() : ToStart (false), ToStop (false), ToAbort (false) {}
|
||||
} Dragging;
|
||||
|
||||
struct _orbitRotation
|
||||
{
|
||||
bool ToStart; //!< start orbit rotation
|
||||
Graphic3d_Vec2d PointStart; //!< orbit rotation start point
|
||||
bool ToRotate; //!< perform orbit rotation
|
||||
Graphic3d_Vec2d PointTo; //!< orbit rotation end point
|
||||
|
||||
_orbitRotation() : ToStart (false), ToRotate (false) {}
|
||||
} OrbitRotation;
|
||||
|
||||
struct _viewRotation
|
||||
{
|
||||
bool ToStart; //!< start view rotation
|
||||
Graphic3d_Vec2d PointStart; //!< view rotation start point
|
||||
bool ToRotate; //!< perform view rotation
|
||||
Graphic3d_Vec2d PointTo; //!< view rotation end point
|
||||
|
||||
_viewRotation() : ToStart (false), ToRotate (false) {}
|
||||
} ViewRotation;
|
||||
|
||||
struct _zrotateParams
|
||||
{
|
||||
Graphic3d_Vec2i Point; //!< Z rotation start point
|
||||
double Angle; //!< Z rotation angle
|
||||
bool ToRotate; //!< start Z rotation
|
||||
|
||||
_zrotateParams() : Angle (0.0), ToRotate (false) {}
|
||||
} ZRotate;
|
||||
|
||||
public:
|
||||
|
||||
AIS_ViewInputBuffer()
|
||||
: IsNewGesture (false) {}
|
||||
|
||||
//! Reset events buffer.
|
||||
void Reset()
|
||||
{
|
||||
Orientation.ToFitAll = false;
|
||||
Orientation.ToSetViewOrient = false;
|
||||
MoveTo.ToHilight = false;
|
||||
Selection.ToApplyTool = false;
|
||||
IsNewGesture = false;
|
||||
ZoomActions.Clear();
|
||||
Panning.ToStart = false;
|
||||
Panning.ToPan = false;
|
||||
Dragging.ToStart = false;
|
||||
Dragging.ToStop = false;
|
||||
Dragging.ToAbort = false;
|
||||
OrbitRotation.ToStart = false;
|
||||
OrbitRotation.ToRotate = false;
|
||||
ViewRotation.ToStart = false;
|
||||
ViewRotation.ToRotate = false;
|
||||
ZRotate.ToRotate = false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_ViewInputBuffer_HeaderFile
|
@@ -1,115 +0,0 @@
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_WalkDelta_HeaderFile
|
||||
#define _AIS_WalkDelta_HeaderFile
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
|
||||
//! Walking translation components.
|
||||
enum AIS_WalkTranslation
|
||||
{
|
||||
AIS_WalkTranslation_Forward = 0, //!< translation delta, Forward walk
|
||||
AIS_WalkTranslation_Side, //!< translation delta, Side walk
|
||||
AIS_WalkTranslation_Up, //!< translation delta, Up walk
|
||||
};
|
||||
|
||||
//! Walking rotation components.
|
||||
enum AIS_WalkRotation
|
||||
{
|
||||
AIS_WalkRotation_Yaw = 0, //!< yaw rotation angle
|
||||
AIS_WalkRotation_Pitch, //!< pitch rotation angle
|
||||
AIS_WalkRotation_Roll, //!< roll rotation angle
|
||||
};
|
||||
|
||||
//! Walking value.
|
||||
struct AIS_WalkPart
|
||||
{
|
||||
Standard_Real Value; //!< value
|
||||
Standard_Real Pressure; //!< key pressure
|
||||
Standard_Real Duration; //!< duration
|
||||
|
||||
//! Return TRUE if delta is empty.
|
||||
bool IsEmpty() const { return Abs (Value) <= RealSmall(); }
|
||||
|
||||
//! Empty constructor.
|
||||
AIS_WalkPart() : Value (0.0), Pressure (1.0), Duration (0.0) {}
|
||||
};
|
||||
|
||||
//! Walking values.
|
||||
struct AIS_WalkDelta
|
||||
{
|
||||
//! Empty constructor.
|
||||
AIS_WalkDelta()
|
||||
: myIsJumping (false), myIsCrouching (false), myIsRunning (false) {}
|
||||
|
||||
//! Return translation component.
|
||||
const AIS_WalkPart& operator[] (AIS_WalkTranslation thePart) const { return myTranslation[thePart]; }
|
||||
|
||||
//! Return translation component.
|
||||
AIS_WalkPart& operator[] (AIS_WalkTranslation thePart) { return myTranslation[thePart]; }
|
||||
|
||||
//! Return rotation component.
|
||||
const AIS_WalkPart& operator[] (AIS_WalkRotation thePart) const { return myRotation[thePart]; }
|
||||
|
||||
//! Return rotation component.
|
||||
AIS_WalkPart& operator[] (AIS_WalkRotation thePart) { return myRotation[thePart]; }
|
||||
|
||||
//! Return jumping state.
|
||||
bool IsJumping() const { return myIsJumping; }
|
||||
|
||||
//! Set jumping state.
|
||||
void SetJumping (bool theIsJumping) { myIsJumping = theIsJumping; }
|
||||
|
||||
//! Return crouching state.
|
||||
bool IsCrouching() const { return myIsCrouching; }
|
||||
|
||||
//! Set crouching state.
|
||||
void SetCrouching (bool theIsCrouching) { myIsCrouching = theIsCrouching; }
|
||||
|
||||
//! Return running state.
|
||||
bool IsRunning() const { return myIsRunning; }
|
||||
|
||||
//! Set running state.
|
||||
void SetRunning (bool theIsRunning) { myIsRunning = theIsRunning; }
|
||||
|
||||
//! Return TRUE when both Rotation and Translation deltas are empty.
|
||||
bool IsEmpty() const { return !ToMove() && !ToRotate(); }
|
||||
|
||||
//! Return TRUE if translation delta is defined.
|
||||
bool ToMove() const
|
||||
{
|
||||
return !myTranslation[AIS_WalkTranslation_Forward].IsEmpty()
|
||||
|| !myTranslation[AIS_WalkTranslation_Side].IsEmpty()
|
||||
|| !myTranslation[AIS_WalkTranslation_Up].IsEmpty();
|
||||
}
|
||||
|
||||
//! Return TRUE if rotation delta is defined.
|
||||
bool ToRotate() const
|
||||
{
|
||||
return !myRotation[AIS_WalkRotation_Yaw].IsEmpty()
|
||||
|| !myRotation[AIS_WalkRotation_Pitch].IsEmpty()
|
||||
|| !myRotation[AIS_WalkRotation_Roll].IsEmpty();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
AIS_WalkPart myTranslation[3];
|
||||
AIS_WalkPart myRotation[3];
|
||||
bool myIsJumping;
|
||||
bool myIsCrouching;
|
||||
bool myIsRunning;
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_WalkDelta_HeaderFile
|
@@ -56,7 +56,6 @@ AIS_DimensionSelectionMode.hxx
|
||||
AIS_DisplayMode.hxx
|
||||
AIS_DisplaySpecialSymbol.hxx
|
||||
AIS_DisplayStatus.hxx
|
||||
AIS_DragAction.hxx
|
||||
AIS_EllipseRadiusDimension.cxx
|
||||
AIS_EllipseRadiusDimension.hxx
|
||||
AIS_EqualDistanceRelation.cxx
|
||||
@@ -107,7 +106,6 @@ AIS_MaxRadiusDimension.cxx
|
||||
AIS_MaxRadiusDimension.hxx
|
||||
AIS_MediaPlayer.cxx
|
||||
AIS_MediaPlayer.hxx
|
||||
AIS_MouseGesture.hxx
|
||||
AIS_MidPointRelation.cxx
|
||||
AIS_MidPointRelation.hxx
|
||||
AIS_MidPointRelation.lxx
|
||||
@@ -116,7 +114,6 @@ AIS_MinRadiusDimension.hxx
|
||||
AIS_MultipleConnectedInteractive.cxx
|
||||
AIS_MultipleConnectedInteractive.hxx
|
||||
AIS_MultipleConnectedInteractive.lxx
|
||||
AIS_NavigationMode.hxx
|
||||
AIS_NListOfEntityOwner.hxx
|
||||
AIS_OffsetDimension.cxx
|
||||
AIS_OffsetDimension.hxx
|
||||
@@ -138,7 +135,6 @@ AIS_RadiusDimension.cxx
|
||||
AIS_RadiusDimension.hxx
|
||||
AIS_Relation.cxx
|
||||
AIS_Relation.hxx
|
||||
AIS_RotationMode.hxx
|
||||
AIS_RubberBand.hxx
|
||||
AIS_RubberBand.cxx
|
||||
AIS_Selection.cxx
|
||||
@@ -179,7 +175,3 @@ AIS_TypeOfAxis.hxx
|
||||
AIS_TypeOfDist.hxx
|
||||
AIS_TypeOfIso.hxx
|
||||
AIS_TypeOfPlane.hxx
|
||||
AIS_ViewController.cxx
|
||||
AIS_ViewController.hxx
|
||||
AIS_ViewInputBuffer.hxx
|
||||
AIS_WalkDelta.hxx
|
||||
|
@@ -954,10 +954,6 @@ Standard_Boolean Adaptor3d_CurveOnSurface::IsClosed() const
|
||||
|
||||
Standard_Boolean Adaptor3d_CurveOnSurface::IsPeriodic() const
|
||||
{
|
||||
if (myType == GeomAbs_Circle ||
|
||||
myType == GeomAbs_Ellipse)
|
||||
return Standard_True;
|
||||
|
||||
return myCurve->IsPeriodic();
|
||||
}
|
||||
|
||||
@@ -968,10 +964,6 @@ Standard_Boolean Adaptor3d_CurveOnSurface::IsPeriodic() const
|
||||
|
||||
Standard_Real Adaptor3d_CurveOnSurface::Period() const
|
||||
{
|
||||
if (myType == GeomAbs_Circle ||
|
||||
myType == GeomAbs_Ellipse)
|
||||
return (2.*M_PI);
|
||||
|
||||
return myCurve->Period();
|
||||
}
|
||||
|
||||
|
@@ -1,59 +0,0 @@
|
||||
// Copyright (c) 2019 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 _Aspect_ScrollDelta_HeaderFile
|
||||
#define _Aspect_ScrollDelta_HeaderFile
|
||||
|
||||
#include <Aspect_VKeyFlags.hxx>
|
||||
#include <NCollection_Vec2.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
|
||||
//! Parameters for mouse scroll action.
|
||||
struct Aspect_ScrollDelta
|
||||
{
|
||||
|
||||
NCollection_Vec2<int> Point; //!< scale position
|
||||
Standard_Real Delta; //!< delta in pixels
|
||||
Aspect_VKeyFlags Flags; //!< key flags
|
||||
|
||||
//! Return true if action has point defined.
|
||||
bool HasPoint() const
|
||||
{
|
||||
return Point.x() >= 0
|
||||
&& Point.y() >= 0;
|
||||
}
|
||||
|
||||
//! Reset at point.
|
||||
void ResetPoint()
|
||||
{
|
||||
Point.SetValues (-1, -1);
|
||||
}
|
||||
|
||||
//! Empty constructor.
|
||||
Aspect_ScrollDelta()
|
||||
: Point (-1, -1), Delta (0.0), Flags (Aspect_VKeyFlags_NONE) {}
|
||||
|
||||
//! Constructor.
|
||||
Aspect_ScrollDelta (const NCollection_Vec2<int>& thePnt,
|
||||
Standard_Real theValue,
|
||||
Aspect_VKeyFlags theFlags = Aspect_VKeyFlags_NONE)
|
||||
: Point (thePnt), Delta (theValue), Flags (theFlags) {}
|
||||
|
||||
//! Constructor with undefined point.
|
||||
Aspect_ScrollDelta (Standard_Real theValue,
|
||||
Aspect_VKeyFlags theFlags = Aspect_VKeyFlags_NONE)
|
||||
: Point (-1, -1), Delta (theValue), Flags (theFlags) {}
|
||||
|
||||
};
|
||||
|
||||
#endif // _Aspect_ScrollDelta_HeaderFile
|
@@ -1,49 +0,0 @@
|
||||
// Copyright (c) 2016-2019 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 _Aspect_Touch_HeaderFile
|
||||
#define _Aspect_Touch_HeaderFile
|
||||
|
||||
#include <NCollection_Vec2.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
|
||||
//! Structure holding touch position - original and current location.
|
||||
class Aspect_Touch
|
||||
{
|
||||
public:
|
||||
|
||||
NCollection_Vec2<Standard_Real> From; //!< original touch position
|
||||
NCollection_Vec2<Standard_Real> To; //!< current touch position
|
||||
Standard_Boolean IsPreciseDevice; //!< precise device input (e.g. mouse cursor, NOT emulated from touch screen)
|
||||
|
||||
//! Return values delta.
|
||||
NCollection_Vec2<Standard_Real> Delta() const { return To - From; }
|
||||
|
||||
//! Empty constructor
|
||||
Aspect_Touch()
|
||||
: From (0.0, 0.0), To (0.0, 0.0), IsPreciseDevice (false) {}
|
||||
|
||||
//! Constructor with initialization.
|
||||
Aspect_Touch (const NCollection_Vec2<Standard_Real>& thePnt,
|
||||
Standard_Boolean theIsPreciseDevice)
|
||||
: From (thePnt), To (thePnt), IsPreciseDevice (theIsPreciseDevice) {}
|
||||
|
||||
//! Constructor with initialization.
|
||||
Aspect_Touch (Standard_Real theX, Standard_Real theY,
|
||||
Standard_Boolean theIsPreciseDevice)
|
||||
: From (theX, theY), To (theX, theY), IsPreciseDevice (theIsPreciseDevice) {}
|
||||
|
||||
};
|
||||
|
||||
#endif // _Aspect_Touch_HeaderFile
|
@@ -1,199 +0,0 @@
|
||||
// Copyright (c) 2016-2019 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 _Aspect_VKey_HeaderFile
|
||||
#define _Aspect_VKey_HeaderFile
|
||||
|
||||
#include <Aspect_VKeyFlags.hxx>
|
||||
|
||||
//! Define virtual key as integer number to allow extensions.
|
||||
typedef unsigned int Aspect_VKey;
|
||||
|
||||
//! Enumeration defining virtual keys irrelevant to current keyboard layout for simplified hot-keys management logic.
|
||||
enum Aspect_VKeyBasic
|
||||
{
|
||||
Aspect_VKey_UNKNOWN = 0,
|
||||
|
||||
// main latin alphabet keys
|
||||
Aspect_VKey_A = 1,
|
||||
Aspect_VKey_B,
|
||||
Aspect_VKey_C,
|
||||
Aspect_VKey_D,
|
||||
Aspect_VKey_E,
|
||||
Aspect_VKey_F,
|
||||
Aspect_VKey_G,
|
||||
Aspect_VKey_H,
|
||||
Aspect_VKey_I,
|
||||
Aspect_VKey_J,
|
||||
Aspect_VKey_K,
|
||||
Aspect_VKey_L,
|
||||
Aspect_VKey_M,
|
||||
Aspect_VKey_N,
|
||||
Aspect_VKey_O,
|
||||
Aspect_VKey_P,
|
||||
Aspect_VKey_Q,
|
||||
Aspect_VKey_R,
|
||||
Aspect_VKey_S,
|
||||
Aspect_VKey_T,
|
||||
Aspect_VKey_U,
|
||||
Aspect_VKey_V,
|
||||
Aspect_VKey_W,
|
||||
Aspect_VKey_X,
|
||||
Aspect_VKey_Y,
|
||||
Aspect_VKey_Z,
|
||||
|
||||
Aspect_VKey_0,
|
||||
Aspect_VKey_1,
|
||||
Aspect_VKey_2,
|
||||
Aspect_VKey_3,
|
||||
Aspect_VKey_4,
|
||||
Aspect_VKey_5,
|
||||
Aspect_VKey_6,
|
||||
Aspect_VKey_7,
|
||||
Aspect_VKey_8,
|
||||
Aspect_VKey_9,
|
||||
|
||||
Aspect_VKey_F1,
|
||||
Aspect_VKey_F2,
|
||||
Aspect_VKey_F3,
|
||||
Aspect_VKey_F4,
|
||||
Aspect_VKey_F5,
|
||||
Aspect_VKey_F6,
|
||||
Aspect_VKey_F7,
|
||||
Aspect_VKey_F8,
|
||||
Aspect_VKey_F9,
|
||||
Aspect_VKey_F10,
|
||||
Aspect_VKey_F11,
|
||||
Aspect_VKey_F12,
|
||||
|
||||
// standard keys
|
||||
Aspect_VKey_Up,
|
||||
Aspect_VKey_Down,
|
||||
Aspect_VKey_Left,
|
||||
Aspect_VKey_Right,
|
||||
Aspect_VKey_Plus, //!< '+'
|
||||
Aspect_VKey_Minus, //!< '-'
|
||||
Aspect_VKey_Equal, //!< '=+'
|
||||
Aspect_VKey_PageUp,
|
||||
Aspect_VKey_PageDown,
|
||||
Aspect_VKey_Home,
|
||||
Aspect_VKey_End,
|
||||
Aspect_VKey_Escape,
|
||||
Aspect_VKey_Back,
|
||||
Aspect_VKey_Enter,
|
||||
Aspect_VKey_Backspace,
|
||||
Aspect_VKey_Space,
|
||||
Aspect_VKey_Delete,
|
||||
Aspect_VKey_Tilde,
|
||||
Aspect_VKey_Tab,
|
||||
Aspect_VKey_Comma, //!< ','
|
||||
Aspect_VKey_Period, //!< '.'
|
||||
Aspect_VKey_Semicolon, //!< ';:'
|
||||
Aspect_VKey_Slash, //!< '/?'
|
||||
Aspect_VKey_BracketLeft, //!< '[{'
|
||||
Aspect_VKey_Backslash, //!< '\|'
|
||||
Aspect_VKey_BracketRight, //!< ']}'
|
||||
Aspect_VKey_Apostrophe, //!< ''"'
|
||||
Aspect_VKey_Numlock, //!< Num Lock key
|
||||
Aspect_VKey_Scroll, //!< Scroll Lock key
|
||||
|
||||
// numpad keys
|
||||
Aspect_VKey_Numpad0,
|
||||
Aspect_VKey_Numpad1,
|
||||
Aspect_VKey_Numpad2,
|
||||
Aspect_VKey_Numpad3,
|
||||
Aspect_VKey_Numpad4,
|
||||
Aspect_VKey_Numpad5,
|
||||
Aspect_VKey_Numpad6,
|
||||
Aspect_VKey_Numpad7,
|
||||
Aspect_VKey_Numpad8,
|
||||
Aspect_VKey_Numpad9,
|
||||
Aspect_VKey_NumpadMultiply, //!< numpad '*'
|
||||
Aspect_VKey_NumpadAdd, //!< numpad '+'
|
||||
Aspect_VKey_NumpadSubtract, //!< numpad '-'
|
||||
Aspect_VKey_NumpadDivide, //!< numpad '/'
|
||||
|
||||
// Multimedia keys
|
||||
Aspect_VKey_MediaNextTrack,
|
||||
Aspect_VKey_MediaPreviousTrack,
|
||||
Aspect_VKey_MediaStop,
|
||||
Aspect_VKey_MediaPlayPause,
|
||||
Aspect_VKey_VolumeMute,
|
||||
Aspect_VKey_VolumeDown,
|
||||
Aspect_VKey_VolumeUp,
|
||||
Aspect_VKey_BrowserBack,
|
||||
Aspect_VKey_BrowserForward,
|
||||
Aspect_VKey_BrowserRefresh,
|
||||
Aspect_VKey_BrowserStop,
|
||||
Aspect_VKey_BrowserSearch,
|
||||
Aspect_VKey_BrowserFavorites,
|
||||
Aspect_VKey_BrowserHome,
|
||||
|
||||
// modifier keys, @sa Aspect_VKey_ModifiersLower and Aspect_VKey_ModifiersUpper below
|
||||
Aspect_VKey_Shift,
|
||||
Aspect_VKey_Control,
|
||||
Aspect_VKey_Alt,
|
||||
Aspect_VKey_Menu,
|
||||
Aspect_VKey_Meta,
|
||||
|
||||
// virtual navigation keys, @sa Aspect_VKey_NavigationKeysLower and Aspect_VKey_NavigationKeysUpper below
|
||||
Aspect_VKey_NavInteract, //!< interact
|
||||
Aspect_VKey_NavForward, //!< go forward
|
||||
Aspect_VKey_NavBackward, //!< go backward
|
||||
Aspect_VKey_NavSlideLeft, //!< sidewalk, left
|
||||
Aspect_VKey_NavSlideRight, //!< sidewalk, right
|
||||
Aspect_VKey_NavSlideUp, //!< lift up
|
||||
Aspect_VKey_NavSlideDown, //!< fall down
|
||||
Aspect_VKey_NavRollCCW, //!< bank left (roll counter-clockwise)
|
||||
Aspect_VKey_NavRollCW, //!< bank right (roll clockwise)
|
||||
Aspect_VKey_NavLookLeft, //!< look left (yaw counter-clockwise)
|
||||
Aspect_VKey_NavLookRight, //!< look right (yaw clockwise)
|
||||
Aspect_VKey_NavLookUp, //!< look up (pitch clockwise)
|
||||
Aspect_VKey_NavLookDown, //!< look down (pitch counter-clockwise)
|
||||
Aspect_VKey_NavCrouch, //!< crouch walking
|
||||
Aspect_VKey_NavJump, //!< jump
|
||||
Aspect_VKey_NavThrustForward, //!< increase continuous velocity in forward direction
|
||||
Aspect_VKey_NavThrustBackward, //!< increase continuous velocity in reversed direction
|
||||
Aspect_VKey_NavThrustStop, //!< reset continuous velocity
|
||||
Aspect_VKey_NavSpeedIncrease, //!< increase navigation speed
|
||||
Aspect_VKey_NavSpeedDecrease, //!< decrease navigation speed
|
||||
};
|
||||
|
||||
//! Auxiliary ranges.
|
||||
enum
|
||||
{
|
||||
Aspect_VKey_Lower = 0,
|
||||
Aspect_VKey_ModifiersLower = Aspect_VKey_Shift,
|
||||
Aspect_VKey_ModifiersUpper = Aspect_VKey_Meta,
|
||||
Aspect_VKey_NavigationKeysLower = Aspect_VKey_NavInteract,
|
||||
Aspect_VKey_NavigationKeysUpper = Aspect_VKey_NavSpeedDecrease,
|
||||
Aspect_VKey_Upper = Aspect_VKey_NavSpeedDecrease,
|
||||
Aspect_VKey_NB = Aspect_VKey_Upper - Aspect_VKey_Lower + 1,
|
||||
Aspect_VKey_MAX = 255
|
||||
};
|
||||
|
||||
//! Return modifier flags for specified modifier key.
|
||||
inline Aspect_VKeyFlags Aspect_VKey2Modifier (Aspect_VKey theKey)
|
||||
{
|
||||
switch (theKey)
|
||||
{
|
||||
case Aspect_VKey_Shift: return Aspect_VKeyFlags_SHIFT;
|
||||
case Aspect_VKey_Control: return Aspect_VKeyFlags_CTRL;
|
||||
case Aspect_VKey_Alt: return Aspect_VKeyFlags_ALT;
|
||||
case Aspect_VKey_Menu: return Aspect_VKeyFlags_MENU;
|
||||
case Aspect_VKey_Meta: return Aspect_VKeyFlags_META;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _Aspect_VKey_HeaderFile
|
@@ -1,49 +0,0 @@
|
||||
// Copyright (c) 2016-2019 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 _Aspect_VKeyFlags_HeaderFile
|
||||
#define _Aspect_VKeyFlags_HeaderFile
|
||||
|
||||
//! Key modifier, for combining with general key from Aspect_VKey.
|
||||
typedef unsigned int Aspect_VKeyFlags;
|
||||
|
||||
//! Key modifier, for combining with general key from Aspect_VKey.
|
||||
enum
|
||||
{
|
||||
Aspect_VKeyFlags_NONE = 0,
|
||||
// reserve first 8 bits to combine value with Aspect_VKey
|
||||
Aspect_VKeyFlags_SHIFT = 1 << 8, //!< Aspect_VKey_Shift
|
||||
Aspect_VKeyFlags_CTRL = 1 << 9, //!< Aspect_VKey_Control
|
||||
Aspect_VKeyFlags_ALT = 1 << 10, //!< Aspect_VKey_Alt
|
||||
Aspect_VKeyFlags_MENU = 1 << 11, //!< Aspect_VKey_Menu
|
||||
Aspect_VKeyFlags_META = 1 << 12, //!< Aspect_VKey_Meta
|
||||
|
||||
Aspect_VKeyFlags_ALL = Aspect_VKeyFlags_SHIFT | Aspect_VKeyFlags_CTRL | Aspect_VKeyFlags_ALT | Aspect_VKeyFlags_MENU | Aspect_VKeyFlags_META
|
||||
};
|
||||
|
||||
//! Mouse buttons, for combining with Aspect_VKey and Aspect_VKeyFlags.
|
||||
typedef unsigned int Aspect_VKeyMouse;
|
||||
|
||||
//! Mouse button bitmask
|
||||
enum
|
||||
{
|
||||
Aspect_VKeyMouse_NONE = 0, //!< no buttons
|
||||
|
||||
Aspect_VKeyMouse_LeftButton = 1 << 13, //!< mouse left button
|
||||
Aspect_VKeyMouse_MiddleButton = 1 << 14, //!< mouse middle button (scroll)
|
||||
Aspect_VKeyMouse_RightButton = 1 << 15, //!< mouse right button
|
||||
|
||||
Aspect_VKeyMouse_MainButtons = Aspect_VKeyMouse_LeftButton | Aspect_VKeyMouse_MiddleButton | Aspect_VKeyMouse_RightButton
|
||||
};
|
||||
|
||||
#endif // _Aspect_VKeyFlags_HeaderFile
|
@@ -1,150 +0,0 @@
|
||||
// Copyright (c) 2016-2019 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 "Aspect_VKeySet.hxx"
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Aspect_VKeySet, Standard_Transient)
|
||||
|
||||
// ================================================================
|
||||
// Function : As1pect_VKeySet
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
Aspect_VKeySet::Aspect_VKeySet()
|
||||
: myKeys (0, Aspect_VKey_MAX),
|
||||
myModifiers (Aspect_VKeyFlags_NONE)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : Reset
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void Aspect_VKeySet::Reset()
|
||||
{
|
||||
Standard_Mutex::Sentry aLock (myLock);
|
||||
myModifiers = 0;
|
||||
for (NCollection_Array1<KeyState>::Iterator aKeyIter (myKeys); aKeyIter.More(); aKeyIter.Next())
|
||||
{
|
||||
aKeyIter.ChangeValue().Reset();
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : KeyDown
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void Aspect_VKeySet::KeyDown (Aspect_VKey theKey,
|
||||
double theTime,
|
||||
double thePressure)
|
||||
{
|
||||
Standard_Mutex::Sentry aLock (myLock);
|
||||
if (myKeys[theKey].Status != KeyStatus_Pressed)
|
||||
{
|
||||
myKeys[theKey].Status = KeyStatus_Pressed;
|
||||
myKeys[theKey].TimeDown = theTime;
|
||||
}
|
||||
myKeys[theKey].Pressure = thePressure;
|
||||
|
||||
const unsigned int aModif = Aspect_VKey2Modifier (theKey);
|
||||
myModifiers = myModifiers | aModif;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : KeyUp
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void Aspect_VKeySet::KeyUp (Aspect_VKey theKey,
|
||||
double theTime)
|
||||
{
|
||||
Standard_Mutex::Sentry aLock (myLock);
|
||||
if (myKeys[theKey].Status == KeyStatus_Pressed)
|
||||
{
|
||||
myKeys[theKey].Status = KeyStatus_Released;
|
||||
myKeys[theKey].TimeUp = theTime;
|
||||
}
|
||||
|
||||
const unsigned int aModif = Aspect_VKey2Modifier (theKey);
|
||||
if (aModif != 0)
|
||||
{
|
||||
myModifiers = myModifiers & ~aModif;
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : KeyFromAxis
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void Aspect_VKeySet::KeyFromAxis (Aspect_VKey theNegative,
|
||||
Aspect_VKey thePositive,
|
||||
double theTime,
|
||||
double thePressure)
|
||||
{
|
||||
Standard_Mutex::Sentry aLock (myLock);
|
||||
if (thePressure != 0)
|
||||
{
|
||||
const Aspect_VKey aKeyDown = thePressure > 0 ? thePositive : theNegative;
|
||||
const Aspect_VKey aKeyUp = thePressure < 0 ? thePositive : theNegative;
|
||||
|
||||
KeyDown (aKeyDown, theTime, Abs (thePressure));
|
||||
if (myKeys[aKeyUp].Status == KeyStatus_Pressed)
|
||||
{
|
||||
KeyUp (aKeyUp, theTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (myKeys[theNegative].Status == KeyStatus_Pressed)
|
||||
{
|
||||
KeyUp (theNegative, theTime);
|
||||
}
|
||||
if (myKeys[thePositive].Status == KeyStatus_Pressed)
|
||||
{
|
||||
KeyUp (thePositive, theTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : HoldDuration
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
bool Aspect_VKeySet::HoldDuration (Aspect_VKey theKey,
|
||||
double theTime,
|
||||
double& theDuration,
|
||||
double& thePressure)
|
||||
{
|
||||
Standard_Mutex::Sentry aLock (myLock);
|
||||
switch (myKeys[theKey].Status)
|
||||
{
|
||||
case KeyStatus_Free:
|
||||
{
|
||||
theDuration = 0.0;
|
||||
return false;
|
||||
}
|
||||
case KeyStatus_Released:
|
||||
{
|
||||
myKeys[theKey].Status = KeyStatus_Free;
|
||||
theDuration = myKeys[theKey].TimeUp - myKeys[theKey].TimeDown;
|
||||
thePressure = myKeys[theKey].Pressure;
|
||||
return true;
|
||||
}
|
||||
case KeyStatus_Pressed:
|
||||
{
|
||||
theDuration = theTime - myKeys[theKey].TimeDown;
|
||||
thePressure = myKeys[theKey].Pressure;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
@@ -1,152 +0,0 @@
|
||||
// Copyright (c) 2016-2019 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 _Aspect_VKeySet_HeaderFile
|
||||
#define _Aspect_VKeySet_HeaderFile
|
||||
|
||||
#include <Aspect_VKey.hxx>
|
||||
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <Standard_Mutex.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
//! Structure defining key state.
|
||||
class Aspect_VKeySet : public Standard_Transient
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(Aspect_VKeySet, Standard_Transient)
|
||||
public:
|
||||
|
||||
//! Main constructor.
|
||||
Standard_EXPORT Aspect_VKeySet();
|
||||
|
||||
//! Return active modifiers.
|
||||
Aspect_VKeyFlags Modifiers() const
|
||||
{
|
||||
Standard_Mutex::Sentry aLock (myLock);
|
||||
return myModifiers;
|
||||
}
|
||||
|
||||
//! Return timestamp of press event.
|
||||
double DownTime (Aspect_VKey theKey) const
|
||||
{
|
||||
Standard_Mutex::Sentry aLock (myLock);
|
||||
return myKeys[theKey].TimeDown;
|
||||
}
|
||||
|
||||
//! Return timestamp of release event.
|
||||
double TimeUp (Aspect_VKey theKey) const
|
||||
{
|
||||
Standard_Mutex::Sentry aLock (myLock);
|
||||
return myKeys[theKey].TimeUp;
|
||||
}
|
||||
|
||||
//! Return TRUE if key is in Free state.
|
||||
bool IsFreeKey (Aspect_VKey theKey) const
|
||||
{
|
||||
Standard_Mutex::Sentry aLock (myLock);
|
||||
return myKeys[theKey].Status == KeyStatus_Free;
|
||||
}
|
||||
|
||||
//! Return TRUE if key is in Pressed state.
|
||||
bool IsKeyDown (Aspect_VKey theKey) const
|
||||
{
|
||||
Standard_Mutex::Sentry aLock (myLock);
|
||||
return myKeys[theKey].Status == KeyStatus_Pressed;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Reset the key state into unpressed state.
|
||||
Standard_EXPORT void Reset();
|
||||
|
||||
//! Press key.
|
||||
//! @param theKey key pressed
|
||||
//! @param theTime event timestamp
|
||||
Standard_EXPORT void KeyDown (Aspect_VKey theKey,
|
||||
double theTime,
|
||||
double thePressure = 1.0);
|
||||
|
||||
//! Release key.
|
||||
//! @param theKey key pressed
|
||||
//! @param theTime event timestamp
|
||||
Standard_EXPORT void KeyUp (Aspect_VKey theKey,
|
||||
double theTime);
|
||||
|
||||
//! Simulate key up/down events from axis value.
|
||||
Standard_EXPORT void KeyFromAxis (Aspect_VKey theNegative,
|
||||
Aspect_VKey thePositive,
|
||||
double theTime,
|
||||
double thePressure);
|
||||
|
||||
//! Return duration of the button in pressed state.
|
||||
//! @param theKey key to check
|
||||
//! @param theTime current time (for computing duration from key down time)
|
||||
//! @param theDuration key press duration
|
||||
//! @return TRUE if key was in pressed state
|
||||
bool HoldDuration (Aspect_VKey theKey,
|
||||
double theTime,
|
||||
double& theDuration)
|
||||
{
|
||||
double aPressure = -1.0;
|
||||
return HoldDuration (theKey, theTime, theDuration, aPressure);
|
||||
}
|
||||
|
||||
//! Return duration of the button in pressed state.
|
||||
//! @param theKey key to check
|
||||
//! @param theTime current time (for computing duration from key down time)
|
||||
//! @param theDuration key press duration
|
||||
//! @param thePressure key pressure
|
||||
//! @return TRUE if key was in pressed state
|
||||
Standard_EXPORT bool HoldDuration (Aspect_VKey theKey,
|
||||
double theTime,
|
||||
double& theDuration,
|
||||
double& thePressure);
|
||||
|
||||
private:
|
||||
|
||||
//! Key state.
|
||||
enum KeyStatus
|
||||
{
|
||||
KeyStatus_Free, //!< free status
|
||||
KeyStatus_Pressed, //!< key is in pressed state
|
||||
KeyStatus_Released, //!< key has been just released (transient state before KeyStatus_Free)
|
||||
};
|
||||
|
||||
//! Structure defining key state.
|
||||
struct KeyState
|
||||
{
|
||||
KeyState() : TimeDown (0.0), TimeUp (0.0), Pressure (1.0), Status (KeyStatus_Free) {}
|
||||
void Reset()
|
||||
{
|
||||
Status = KeyStatus_Free;
|
||||
TimeDown = 0.0;
|
||||
TimeUp = 0.0;
|
||||
Pressure = 1.0;
|
||||
}
|
||||
|
||||
double TimeDown; //!< time of key press event
|
||||
double TimeUp; //!< time of key release event
|
||||
double Pressure; //!< key pressure
|
||||
KeyStatus Status; //!< key status
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
NCollection_Array1<KeyState> myKeys; //!< keys state
|
||||
mutable Standard_Mutex myLock; //!< mutex for thread-safe updates
|
||||
Aspect_VKeyFlags myModifiers; //!< active modifiers
|
||||
|
||||
};
|
||||
|
||||
#endif // _Aspect_VKeySet_HeaderFile
|
@@ -16,21 +16,28 @@
|
||||
#ifndef _Aspect_Window_HeaderFile
|
||||
#define _Aspect_Window_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Aspect_Background.hxx>
|
||||
#include <Aspect_GradientBackground.hxx>
|
||||
#include <Aspect_FBConfig.hxx>
|
||||
#include <Aspect_FillMethod.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Aspect_GradientFillMethod.hxx>
|
||||
#include <Aspect_TypeOfResize.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Aspect_Drawable.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
class Aspect_DisplayConnection;
|
||||
class Aspect_WindowDefinitionError;
|
||||
class Aspect_WindowError;
|
||||
class Aspect_Background;
|
||||
class Aspect_GradientBackground;
|
||||
|
||||
class Aspect_Window;
|
||||
DEFINE_STANDARD_HANDLE(Aspect_Window, Standard_Transient)
|
||||
|
||||
//! Defines a window.
|
||||
@@ -102,9 +109,6 @@ public:
|
||||
//! Returns native Window FB config (GLXFBConfig on Xlib)
|
||||
Standard_EXPORT virtual Aspect_FBConfig NativeFBConfig() const = 0;
|
||||
|
||||
//! Sets window title.
|
||||
virtual void SetTitle (const TCollection_AsciiString& theTitle) { (void )theTitle; }
|
||||
|
||||
//! Invalidate entire window content.
|
||||
//!
|
||||
//! Implementation is expected to allow calling this method from non-GUI thread,
|
||||
|
@@ -34,9 +34,6 @@ Aspect_RectangularGrid.cxx
|
||||
Aspect_RectangularGrid.hxx
|
||||
Aspect_RenderingContext.hxx
|
||||
Aspect_SequenceOfColor.hxx
|
||||
Aspect_ScrollDelta.hxx
|
||||
Aspect_Touch.hxx
|
||||
Aspect_TouchMap.hxx
|
||||
Aspect_TypeOfColorScaleData.hxx
|
||||
Aspect_TypeOfColorScaleOrientation.hxx
|
||||
Aspect_TypeOfColorScalePosition.hxx
|
||||
@@ -50,10 +47,6 @@ Aspect_TypeOfResize.hxx
|
||||
Aspect_TypeOfStyleText.hxx
|
||||
Aspect_TypeOfTriedronPosition.hxx
|
||||
Aspect_Units.hxx
|
||||
Aspect_VKey.hxx
|
||||
Aspect_VKeyFlags.hxx
|
||||
Aspect_VKeySet.cxx
|
||||
Aspect_VKeySet.hxx
|
||||
Aspect_WidthOfLine.hxx
|
||||
Aspect_Window.cxx
|
||||
Aspect_Window.hxx
|
||||
|
@@ -24,8 +24,7 @@
|
||||
#include <BOPAlgo_Alerts.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools2D.hxx>
|
||||
#include <BOPTools_BoxTree.hxx>
|
||||
#include <Bnd_Tools.hxx>
|
||||
#include <BOPTools_BoxSelector.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
@@ -39,6 +38,7 @@
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <IntTools_FClass2d.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TopAbs.hxx>
|
||||
#include <TopExp.hxx>
|
||||
@@ -448,28 +448,28 @@ void BOPAlgo_BuilderFace::PerformAreas()
|
||||
|
||||
// Classify holes relatively faces
|
||||
|
||||
// Prepare tree with the boxes of the hole faces
|
||||
BOPTools_Box2dTree aBoxTree;
|
||||
// Prepare tree filler with the boxes of the hole faces
|
||||
NCollection_UBTree<Standard_Integer, Bnd_Box2d> aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFiller(aBBTree);
|
||||
|
||||
Standard_Integer i, aNbH = aHoleFaces.Extent();
|
||||
aBoxTree.SetSize (aNbH);
|
||||
for (i = 1; i <= aNbH; ++i)
|
||||
{
|
||||
const TopoDS_Face& aHFace = TopoDS::Face(aHoleFaces(i));
|
||||
//
|
||||
Bnd_Box2d aBox;
|
||||
BRepTools::AddUVBounds(aHFace, aBox);
|
||||
aBoxTree.Add(i, Bnd_Tools::Bnd2BVH (aBox));
|
||||
aTreeFiller.Add(i, aBox);
|
||||
}
|
||||
|
||||
// Build BVH
|
||||
aBoxTree.Build();
|
||||
// Shake TreeFiller
|
||||
aTreeFiller.Fill();
|
||||
|
||||
// Find outer growth face that is most close to each hole face
|
||||
TopTools_IndexedDataMapOfShapeShape aHoleFaceMap;
|
||||
|
||||
// Selector
|
||||
BOPTools_Box2dTreeSelector aSelector;
|
||||
aSelector.SetBVHSet (&aBoxTree);
|
||||
BOPTools_BoxSelector<Bnd_Box2d> aSelector;
|
||||
|
||||
TopTools_ListIteratorOfListOfShape aItLS(aNewFaces);
|
||||
for (; aItLS.More(); aItLS.Next())
|
||||
@@ -481,8 +481,8 @@ void BOPAlgo_BuilderFace::PerformAreas()
|
||||
BRepTools::AddUVBounds(aFace, aBox);
|
||||
|
||||
aSelector.Clear();
|
||||
aSelector.SetBox(Bnd_Tools::Bnd2BVH (aBox));
|
||||
aSelector.Select();
|
||||
aSelector.SetBox(aBox);
|
||||
aBBTree.Select(aSelector);
|
||||
|
||||
const TColStd_ListOfInteger& aLI = aSelector.Indices();
|
||||
TColStd_ListIteratorOfListOfInteger aItLI(aLI);
|
||||
@@ -590,8 +590,9 @@ void BOPAlgo_BuilderFace::PerformInternalShapes()
|
||||
// No edges left for classification
|
||||
return;
|
||||
|
||||
// Prepare tree with the boxes of the edges to classify
|
||||
BOPTools_Box2dTree aBoxTree;
|
||||
// Prepare tree filler with the boxes of the edges to classify
|
||||
NCollection_UBTree<Standard_Integer, Bnd_Box2d> aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFiller(aBBTree);
|
||||
|
||||
// Map of edges to classify
|
||||
TopTools_IndexedMapOfShape anEdgesMap;
|
||||
@@ -610,13 +611,13 @@ void BOPAlgo_BuilderFace::PerformInternalShapes()
|
||||
BRepTools::AddUVBounds(myFace, aE, aBoxE);
|
||||
// Make sure the index of edge in the map and
|
||||
// of the box in the tree is the same
|
||||
aBoxTree.Add(anEdgesMap.Add(aE), Bnd_Tools::Bnd2BVH (aBoxE));
|
||||
aTreeFiller.Add(anEdgesMap.Add(aE), aBoxE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build BVH
|
||||
aBoxTree.Build();
|
||||
// Shake the tree
|
||||
aTreeFiller.Fill();
|
||||
|
||||
// Fence map
|
||||
TColStd_MapOfInteger aMEDone;
|
||||
@@ -632,10 +633,9 @@ void BOPAlgo_BuilderFace::PerformInternalShapes()
|
||||
BRepTools::AddUVBounds(aF, aBoxF);
|
||||
|
||||
// Select edges for the classification
|
||||
BOPTools_Box2dTreeSelector aSelector;
|
||||
aSelector.SetBVHSet (&aBoxTree);
|
||||
aSelector.SetBox(Bnd_Tools::Bnd2BVH (aBoxF));
|
||||
if (!aSelector.Select())
|
||||
BOPTools_BoxSelector<Bnd_Box2d> aSelector;
|
||||
aSelector.SetBox(aBoxF);
|
||||
if (!aBBTree.Select(aSelector))
|
||||
continue;
|
||||
|
||||
// Collect edges inside the face
|
||||
|
@@ -21,10 +21,9 @@
|
||||
#include <BOPAlgo_Tools.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools3D.hxx>
|
||||
#include <BOPTools_BoxTree.hxx>
|
||||
#include <BOPTools_BoxBndTree.hxx>
|
||||
#include <BOPTools_CoupleOfShape.hxx>
|
||||
#include <BOPTools_Parallel.hxx>
|
||||
#include <Bnd_Tools.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
@@ -40,6 +39,7 @@
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <TColStd_MapIntegerHasher.hxx>
|
||||
#include <TopAbs.hxx>
|
||||
@@ -443,23 +443,24 @@ void BOPAlgo_BuilderSolid::PerformAreas()
|
||||
|
||||
// Classify holes relatively solids
|
||||
|
||||
// Prepare tree with the boxes of the hole shells
|
||||
BOPTools_BoxTree aBBTree;
|
||||
// Prepare tree filler with the boxes of the hole shells
|
||||
BOPTools_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
|
||||
Standard_Integer i, aNbH = aHoleShells.Extent();
|
||||
aBBTree.SetSize (aNbH);
|
||||
for (i = 1; i <= aNbH; ++i)
|
||||
{
|
||||
const TopoDS_Shape& aHShell = aHoleShells(i);
|
||||
//
|
||||
Bnd_Box aBox;
|
||||
BRepBndLib::Add(aHShell, aBox);
|
||||
aBBTree.Add(i, Bnd_Tools::Bnd2BVH(aBox));
|
||||
aTreeFiller.Add(i, aBox);
|
||||
|
||||
myBoxes.Bind(aHShell, aBox);
|
||||
}
|
||||
|
||||
// Build BVH
|
||||
aBBTree.Build();
|
||||
// Shake TreeFiller
|
||||
aTreeFiller.Fill();
|
||||
|
||||
// Find outer growth shell that is most close to each hole shell
|
||||
TopTools_IndexedDataMapOfShapeShape aHoleSolidMap;
|
||||
@@ -475,10 +476,9 @@ void BOPAlgo_BuilderSolid::PerformAreas()
|
||||
|
||||
myBoxes.Bind(aSolid, aBox);
|
||||
|
||||
BOPTools_BoxTreeSelector aSelector;
|
||||
aSelector.SetBox(Bnd_Tools::Bnd2BVH(aBox));
|
||||
aSelector.SetBVHSet (&aBBTree);
|
||||
aSelector.Select();
|
||||
BOPTools_BoxBndTreeSelector aSelector;
|
||||
aSelector.SetBox(aBox);
|
||||
aBBTree.Select(aSelector);
|
||||
|
||||
const TColStd_ListOfInteger& aLI = aSelector.Indices();
|
||||
TColStd_ListIteratorOfListOfInteger aItLI(aLI);
|
||||
|
@@ -298,7 +298,7 @@ void BOPAlgo_PaveFiller::PerformInternal()
|
||||
//
|
||||
MakeSplitEdges();
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
//
|
||||
UpdatePaveBlocksWithSDVertices();
|
||||
@@ -361,7 +361,7 @@ void BOPAlgo_PaveFiller::RepeatIntersection()
|
||||
return;
|
||||
|
||||
// Update iterator of pairs of shapes with interfering boxes
|
||||
myIterator->IntersectExt(anExtraInterfMap);
|
||||
myIterator->PrepareExt(anExtraInterfMap);
|
||||
|
||||
// Perform intersections with vertices
|
||||
PerformVV();
|
||||
|
@@ -256,8 +256,7 @@ protected:
|
||||
|
||||
Standard_EXPORT void FillShrunkData (Handle(BOPDS_PaveBlock)& thePB);
|
||||
|
||||
Standard_EXPORT void FillShrunkData (const TopAbs_ShapeEnum theType1,
|
||||
const TopAbs_ShapeEnum theType2);
|
||||
Standard_EXPORT void FillShrunkData (const TopAbs_ShapeEnum theType1, const TopAbs_ShapeEnum theType2);
|
||||
|
||||
//! Analyzes the results of computation of the valid range for the
|
||||
//! pave block and in case of error adds the warning status, otherwise
|
||||
@@ -270,16 +269,11 @@ protected:
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator,
|
||||
const Standard_Boolean theIsEEIntersection = Standard_True);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckFacePaves (const TopoDS_Vertex& theVnew,
|
||||
const TColStd_MapOfInteger& theMIF);
|
||||
Standard_EXPORT Standard_Boolean CheckFacePaves (const TopoDS_Vertex& theVnew, const TColStd_MapOfInteger& theMIF);
|
||||
|
||||
Standard_EXPORT static Standard_Boolean CheckFacePaves (const Standard_Integer theN,
|
||||
const TColStd_MapOfInteger& theMIFOn,
|
||||
const TColStd_MapOfInteger& theMIFIn);
|
||||
Standard_EXPORT static Standard_Boolean CheckFacePaves (const Standard_Integer theN, const TColStd_MapOfInteger& theMIFOn, const TColStd_MapOfInteger& theMIFIn);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsExistingVertex (const gp_Pnt& theP,
|
||||
const Standard_Real theTol,
|
||||
const TColStd_MapOfInteger& theMVOn) const;
|
||||
Standard_EXPORT Standard_Boolean IsExistingVertex (const gp_Pnt& theP, const Standard_Real theTol, const TColStd_MapOfInteger& theMVOn) const;
|
||||
|
||||
|
||||
//! Checks and puts paves from <theMVOnIn> on the curve <theNC>.
|
||||
@@ -304,10 +298,7 @@ protected:
|
||||
//! 1 - checks only EE;
|
||||
//! 2 - checks only EF;
|
||||
//! other - checks both types of intersections.
|
||||
Standard_EXPORT Standard_Boolean ExtendedTolerance (const Standard_Integer nV,
|
||||
const TColStd_MapOfInteger& aMI,
|
||||
Standard_Real& aTolVExt,
|
||||
const Standard_Integer aType = 0);
|
||||
Standard_EXPORT Standard_Boolean ExtendedTolerance (const Standard_Integer nV, const TColStd_MapOfInteger& aMI, Standard_Real& aTolVExt, const Standard_Integer aType = 0);
|
||||
|
||||
Standard_EXPORT void PutBoundPaveOnCurve(const TopoDS_Face& theF1,
|
||||
const TopoDS_Face& theF2,
|
||||
@@ -340,52 +331,38 @@ protected:
|
||||
const TopTools_IndexedMapOfShape& theVertsOnRejectedPB,
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator);
|
||||
|
||||
Standard_EXPORT void FindPaveBlocks (const Standard_Integer theV,
|
||||
const Standard_Integer theF,
|
||||
BOPDS_ListOfPaveBlock& theLPB);
|
||||
Standard_EXPORT void FindPaveBlocks (const Standard_Integer theV, const Standard_Integer theF, BOPDS_ListOfPaveBlock& theLPB);
|
||||
|
||||
Standard_EXPORT void FillPaves (const Standard_Integer theV,
|
||||
const Standard_Integer theE,
|
||||
const Standard_Integer theF,
|
||||
const BOPDS_ListOfPaveBlock& theLPB,
|
||||
const Handle(BOPDS_PaveBlock)& thePB);
|
||||
Standard_EXPORT void FillPaves (const Standard_Integer theV, const Standard_Integer theE, const Standard_Integer theF, const BOPDS_ListOfPaveBlock& theLPB, const Handle(BOPDS_PaveBlock)& thePB);
|
||||
|
||||
Standard_EXPORT void MakeSplitEdge (const Standard_Integer theV, const Standard_Integer theF);
|
||||
|
||||
Standard_EXPORT void GetEFPnts (const Standard_Integer nF1,
|
||||
const Standard_Integer nF2,
|
||||
IntSurf_ListOfPntOn2S& aListOfPnts);
|
||||
Standard_EXPORT void GetEFPnts (const Standard_Integer nF1, const Standard_Integer nF2, IntSurf_ListOfPntOn2S& aListOfPnts);
|
||||
|
||||
|
||||
//! Checks and puts paves created in EF intersections on the curve <theNC>.
|
||||
Standard_EXPORT void PutEFPavesOnCurve (const BOPDS_VectorOfCurve& theVC,
|
||||
const Standard_Integer theIndex,
|
||||
const TColStd_MapOfInteger& theMI,
|
||||
const TColStd_MapOfInteger& theMVEF,
|
||||
TColStd_DataMapOfIntegerReal& theMVTol,
|
||||
TColStd_DataMapOfIntegerListOfInteger& aDMVLV);
|
||||
Standard_EXPORT void PutEFPavesOnCurve (BOPDS_Curve& theNC,
|
||||
const TColStd_MapOfInteger& theMI,
|
||||
const TColStd_MapOfInteger& theMVEF,
|
||||
TColStd_DataMapOfIntegerReal& theMVTol,
|
||||
TColStd_DataMapOfIntegerListOfInteger& aDMVLV);
|
||||
|
||||
|
||||
//! Puts stick paves on the curve <theNC>
|
||||
Standard_EXPORT void PutStickPavesOnCurve (const TopoDS_Face& aF1,
|
||||
const TopoDS_Face& aF2,
|
||||
const TColStd_MapOfInteger& theMI,
|
||||
const BOPDS_VectorOfCurve& theVC,
|
||||
const Standard_Integer theIndex,
|
||||
const TColStd_MapOfInteger& theMVStick,
|
||||
TColStd_DataMapOfIntegerReal& theMVTol,
|
||||
TColStd_DataMapOfIntegerListOfInteger& aDMVLV);
|
||||
const TopoDS_Face& aF2,
|
||||
const TColStd_MapOfInteger& theMI,
|
||||
BOPDS_Curve& theNC,
|
||||
const TColStd_MapOfInteger& theMVStick,
|
||||
TColStd_DataMapOfIntegerReal& theMVTol,
|
||||
TColStd_DataMapOfIntegerListOfInteger& aDMVLV);
|
||||
|
||||
|
||||
//! Collects indices of vertices created in all intersections between
|
||||
//! two faces (<nF1> and <nF2>) to the map <theMVStick>.
|
||||
//! Also, it collects indices of EF vertices to the <theMVEF> map
|
||||
//! and indices of all subshapes of these two faces to the <theMI> map.
|
||||
Standard_EXPORT void GetStickVertices (const Standard_Integer nF1,
|
||||
const Standard_Integer nF2,
|
||||
TColStd_MapOfInteger& theMVStick,
|
||||
TColStd_MapOfInteger& theMVEF,
|
||||
TColStd_MapOfInteger& theMI);
|
||||
Standard_EXPORT void GetStickVertices (const Standard_Integer nF1, const Standard_Integer nF2, TColStd_MapOfInteger& theMVStick, TColStd_MapOfInteger& theMVEF, TColStd_MapOfInteger& theMI);
|
||||
|
||||
|
||||
//! Collects index nF and indices of all subshapes of the shape with index <nF>
|
||||
@@ -396,7 +373,7 @@ protected:
|
||||
//! Removes indices of vertices that are already on the
|
||||
//! curve <theNC> from the map <theMV>.
|
||||
//! It is used in PutEFPavesOnCurve and PutStickPavesOnCurve methods.
|
||||
Standard_EXPORT void RemoveUsedVertices (const BOPDS_VectorOfCurve& theVC, TColStd_MapOfInteger& theMV);
|
||||
Standard_EXPORT void RemoveUsedVertices (const BOPDS_Curve& theNC, TColStd_MapOfInteger& theMV);
|
||||
|
||||
|
||||
//! Puts the pave nV on the curve theNC.
|
||||
@@ -435,8 +412,7 @@ protected:
|
||||
const BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap);
|
||||
|
||||
//! Treatment of vertices that were created in EE intersections.
|
||||
Standard_EXPORT void TreatNewVertices(const BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theImages);
|
||||
Standard_EXPORT void TreatNewVertices(const BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, TopTools_IndexedDataMapOfShapeListOfShape& theImages);
|
||||
|
||||
|
||||
//! Put paves on the curve <aBC> in case when <aBC>
|
||||
@@ -445,12 +421,7 @@ protected:
|
||||
|
||||
|
||||
//! Keeps data for post treatment
|
||||
Standard_EXPORT void PreparePostTreatFF (const Standard_Integer aInt,
|
||||
const Standard_Integer aCur,
|
||||
const Handle(BOPDS_PaveBlock)& aPB,
|
||||
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB,
|
||||
TopTools_DataMapOfShapeInteger& aMVI,
|
||||
BOPDS_ListOfPaveBlock& aLPB);
|
||||
Standard_EXPORT void PreparePostTreatFF (const Standard_Integer aInt, const Standard_Integer aCur, const Handle(BOPDS_PaveBlock)& aPB, BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB, TopTools_DataMapOfShapeInteger& aMVI, BOPDS_ListOfPaveBlock& aLPB);
|
||||
|
||||
//! Updates the information about faces
|
||||
Standard_EXPORT void UpdateFaceInfo(BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME,
|
||||
@@ -476,11 +447,7 @@ protected:
|
||||
|
||||
//! Creates new edge from the edge nE with vertices nV1 and nV2
|
||||
//! and returns the index of that new edge in the DS.
|
||||
Standard_EXPORT Standard_Integer SplitEdge (const Standard_Integer nE,
|
||||
const Standard_Integer nV1,
|
||||
const Standard_Real aT1,
|
||||
const Standard_Integer nV2,
|
||||
const Standard_Real aT2);
|
||||
Standard_EXPORT Standard_Integer SplitEdge (const Standard_Integer nE, const Standard_Integer nV1, const Standard_Real aT1, const Standard_Integer nV2, const Standard_Real aT2);
|
||||
|
||||
|
||||
//! Updates pave blocks which have the paves with indices contained
|
||||
@@ -559,8 +526,7 @@ protected:
|
||||
Standard_EXPORT void CheckSelfInterference();
|
||||
|
||||
//! Adds the warning about failed intersection of pair of sub-shapes
|
||||
Standard_EXPORT void AddIntersectionFailedWarning(const TopoDS_Shape& theS1,
|
||||
const TopoDS_Shape& theS2);
|
||||
Standard_EXPORT void AddIntersectionFailedWarning(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2);
|
||||
|
||||
//! Repeat intersection of sub-shapes with increased vertices.
|
||||
Standard_EXPORT void RepeatIntersection();
|
||||
|
@@ -595,7 +595,7 @@ void BOPAlgo_PaveFiller::TreatNewVertices
|
||||
//
|
||||
// Perform intersection
|
||||
TopTools_ListOfListOfShape aChains;
|
||||
BOPAlgo_Tools::IntersectVertices(aVerts, myFuzzyValue, aChains);
|
||||
BOPAlgo_Tools::IntersectVertices(aVerts, myRunParallel, myFuzzyValue, aChains);
|
||||
//
|
||||
// Treat the results - make new vertices for each chain
|
||||
TopTools_ListOfListOfShape::Iterator aItC(aChains);
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Bnd_Tools.hxx>
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_Alerts.hxx>
|
||||
#include <BOPAlgo_Tools.hxx>
|
||||
@@ -32,6 +31,7 @@
|
||||
#include <BOPDS_PaveBlock.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools2D.hxx>
|
||||
#include <BOPTools_BoxSelector.hxx>
|
||||
#include <BOPTools_Parallel.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
@@ -469,8 +469,12 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
PerformNewVertices(aMVCPB, aAllocator, Standard_False);
|
||||
//
|
||||
// Update FaceInfoIn for all faces having EF common parts
|
||||
myDS->UpdateFaceInfoIn (aMIEFC);
|
||||
|
||||
TColStd_MapIteratorOfMapOfInteger aItMI;
|
||||
aItMI.Initialize(aMIEFC);
|
||||
for (; aItMI.More(); aItMI.Next()) {
|
||||
nF=aItMI.Value();
|
||||
myDS->UpdateFaceInfoIn(nF);
|
||||
}
|
||||
//-----------------------------------------------------scope t
|
||||
aMIEFC.Clear();
|
||||
aMVCPB.Clear();
|
||||
@@ -729,7 +733,8 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB
|
||||
return;
|
||||
|
||||
// Fill the tree with bounding boxes of the pave blocks
|
||||
BOPTools_BoxTree aBBTree;
|
||||
NCollection_UBTree<Standard_Integer, Bnd_Box> aBBTree;
|
||||
NCollection_UBTreeFiller<Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
BOPDS_IndexedMapOfPaveBlock aPBMap(1, anAlloc);
|
||||
@@ -750,11 +755,11 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB
|
||||
Standard_Boolean isSplit;
|
||||
aPB->ShrunkData(f, l, aPBBox, isSplit);
|
||||
|
||||
aBBTree.Add(aPBMap.Add(aPB), Bnd_Tools::Bnd2BVH(aPBBox));
|
||||
aTreeFiller.Add(aPBMap.Add(aPB), aPBBox);
|
||||
}
|
||||
|
||||
// Shake the tree
|
||||
aBBTree.Build();
|
||||
aTreeFiller.Fill();
|
||||
|
||||
// Find pairs of Face/PaveBlock containing the same vertices
|
||||
// and prepare those pairs for intersection.
|
||||
@@ -773,10 +778,10 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB
|
||||
continue;
|
||||
|
||||
const Bnd_Box& aBoxF = aSI.Box();
|
||||
BOPTools_BoxTreeSelector aSelector;
|
||||
aSelector.SetBox(Bnd_Tools::Bnd2BVH(aBoxF));
|
||||
aSelector.SetBVHSet (&aBBTree);
|
||||
if (!aSelector.Select())
|
||||
BOPTools_BoxSelector<Bnd_Box> aSelector;
|
||||
aSelector.SetBox(aBoxF);
|
||||
|
||||
if (!aBBTree.Select(aSelector))
|
||||
continue;
|
||||
|
||||
const TopoDS_Face& aF = TopoDS::Face(aSI.Shape());
|
||||
|
@@ -200,18 +200,36 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nF1, nF2);
|
||||
|
||||
aMIFence.Add (nF1);
|
||||
aMIFence.Add (nF2);
|
||||
}
|
||||
// Update face info
|
||||
myDS->UpdateFaceInfoOn (aMIFence);
|
||||
myDS->UpdateFaceInfoIn (aMIFence);
|
||||
|
||||
// Initialize interferences
|
||||
myIterator->Initialize(TopAbs_FACE, TopAbs_FACE);
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nF1, nF2);
|
||||
// Update/Initialize FaceInfo structure for first face
|
||||
if (myDS->HasFaceInfo(nF1))
|
||||
{
|
||||
if (aMIFence.Add(nF1))
|
||||
{
|
||||
myDS->UpdateFaceInfoOn(nF1);
|
||||
myDS->UpdateFaceInfoIn(nF1);
|
||||
}
|
||||
}
|
||||
else if (myDS->HasInterfShapeSubShapes(nF2, nF1))
|
||||
{
|
||||
myDS->ChangeFaceInfo(nF1);
|
||||
aMIFence.Add(nF1);
|
||||
}
|
||||
|
||||
// Update/Initialize FaceInfo structure for second face
|
||||
if (myDS->HasFaceInfo(nF2))
|
||||
{
|
||||
if (aMIFence.Add(nF2))
|
||||
{
|
||||
myDS->UpdateFaceInfoOn(nF2);
|
||||
myDS->UpdateFaceInfoIn(nF2);
|
||||
}
|
||||
}
|
||||
else if (myDS->HasInterfShapeSubShapes(nF1, nF2))
|
||||
{
|
||||
myDS->ChangeFaceInfo(nF2);
|
||||
aMIFence.Add(nF2);
|
||||
}
|
||||
//
|
||||
if (myGlue == BOPAlgo_GlueOff)
|
||||
{
|
||||
const TopoDS_Face& aF1 = (*(TopoDS_Face *)(&myDS->Shape(nF1)));
|
||||
@@ -487,10 +505,10 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
BOPDS_Curve& aNC=aVC.ChangeValue(j);
|
||||
const IntTools_Curve& aIC=aNC.Curve();
|
||||
//
|
||||
PutStickPavesOnCurve(aF1, aF2, aMI, aVC, j, aMVStick, aMVTol, aDMVLV);
|
||||
PutStickPavesOnCurve(aF1, aF2, aMI, aNC, aMVStick, aMVTol, aDMVLV);
|
||||
//904/F7
|
||||
if (aNbC == 1) {
|
||||
PutEFPavesOnCurve(aVC, j, aMI, aMVEF, aMVTol, aDMVLV);
|
||||
PutEFPavesOnCurve(aNC, aMI, aMVEF, aMVTol, aDMVLV);
|
||||
}
|
||||
//
|
||||
if (aIC.HasBounds()) {
|
||||
@@ -814,7 +832,12 @@ void BOPAlgo_PaveFiller::PostTreatFF
|
||||
TColStd_MapOfInteger aMV, aMVEF, aMI;
|
||||
GetStickVertices(nF1, nF2, aMV, aMVEF, aMI);
|
||||
BOPDS_VectorOfCurve& aVC = aFF.ChangeCurves();
|
||||
RemoveUsedVertices (aVC, aMV);
|
||||
Standard_Integer aNbC = aVC.Length();
|
||||
for (j = 0; j < aNbC; j++)
|
||||
{
|
||||
BOPDS_Curve& aNC = aVC.ChangeValue(j);
|
||||
RemoveUsedVertices(aNC, aMV);
|
||||
}
|
||||
|
||||
TColStd_MapIteratorOfMapOfInteger itmap(aMV);
|
||||
for(; itmap.More(); itmap.Next())
|
||||
@@ -1645,13 +1668,13 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void getBoundPaves(const BOPDS_DS* theDS,
|
||||
const BOPDS_Curve& theNC,
|
||||
BOPDS_Curve& theNC,
|
||||
Standard_Integer theNV[2])
|
||||
{
|
||||
theNV[0] = theNV[1] = -1;
|
||||
|
||||
// get extreme paves
|
||||
const Handle(BOPDS_PaveBlock)& aPB = theNC.PaveBlocks().First();
|
||||
Handle(BOPDS_PaveBlock)& aPB = theNC.ChangePaveBlock1();
|
||||
const BOPDS_ListOfPave& aLP = aPB->ExtPaves();
|
||||
Standard_Integer aNbEP = aLP.Extent();
|
||||
if (aNbEP == 0)
|
||||
@@ -2057,8 +2080,7 @@ void BOPAlgo_PaveFiller::GetEFPnts
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PutEFPavesOnCurve
|
||||
(const BOPDS_VectorOfCurve& theVC,
|
||||
const Standard_Integer theIndex,
|
||||
(BOPDS_Curve& aNC,
|
||||
const TColStd_MapOfInteger& aMI,
|
||||
const TColStd_MapOfInteger& aMVEF,
|
||||
TColStd_DataMapOfIntegerReal& aMVTol,
|
||||
@@ -2068,7 +2090,6 @@ void BOPAlgo_PaveFiller::GetEFPnts
|
||||
return;
|
||||
}
|
||||
//
|
||||
const BOPDS_Curve& aNC = theVC.Value(theIndex);
|
||||
const IntTools_Curve& aIC=aNC.Curve();
|
||||
GeomAbs_CurveType aTypeC;
|
||||
aTypeC=aIC.Type();
|
||||
@@ -2080,7 +2101,7 @@ void BOPAlgo_PaveFiller::GetEFPnts
|
||||
TColStd_MapOfInteger aMV;
|
||||
//
|
||||
aMV.Assign(aMVEF);
|
||||
RemoveUsedVertices(theVC, aMV);
|
||||
RemoveUsedVertices(aNC, aMV);
|
||||
if (!aMV.Extent()) {
|
||||
return;
|
||||
}
|
||||
@@ -2114,13 +2135,11 @@ void BOPAlgo_PaveFiller::GetEFPnts
|
||||
(const TopoDS_Face& aF1,
|
||||
const TopoDS_Face& aF2,
|
||||
const TColStd_MapOfInteger& aMI,
|
||||
const BOPDS_VectorOfCurve& theVC,
|
||||
const Standard_Integer theIndex,
|
||||
BOPDS_Curve& aNC,
|
||||
const TColStd_MapOfInteger& aMVStick,
|
||||
TColStd_DataMapOfIntegerReal& aMVTol,
|
||||
TColStd_DataMapOfIntegerListOfInteger& aDMVLV)
|
||||
{
|
||||
const BOPDS_Curve& aNC = theVC.Value(theIndex);
|
||||
// Get numbers of vertices assigned to the ends of the curve
|
||||
Standard_Integer aBndNV[2];
|
||||
getBoundPaves(myDS, aNC, aBndNV);
|
||||
@@ -2131,7 +2150,7 @@ void BOPAlgo_PaveFiller::GetEFPnts
|
||||
}
|
||||
TColStd_MapOfInteger aMV;
|
||||
aMV.Assign(aMVStick);
|
||||
RemoveUsedVertices(theVC, aMV);
|
||||
RemoveUsedVertices(aNC, aMV);
|
||||
//
|
||||
if (!aMV.Extent()) {
|
||||
return;
|
||||
@@ -2141,6 +2160,7 @@ void BOPAlgo_PaveFiller::GetEFPnts
|
||||
Handle(Geom_Surface) aS2=BRep_Tool::Surface(aF2);
|
||||
//
|
||||
const IntTools_Curve& aIC=aNC.Curve();
|
||||
//if (aTypeC==GeomAbs_BezierCurve || aTypeC==GeomAbs_BSplineCurve) {
|
||||
Handle(Geom2d_Curve) aC2D[2];
|
||||
//
|
||||
aC2D[0]=aIC.FirstCurve2d();
|
||||
@@ -2235,7 +2255,6 @@ void BOPAlgo_PaveFiller::GetStickVertices(const Standard_Integer nF1,
|
||||
aInt->Indices(nS1, nS2);
|
||||
if(aMI.Contains(nS1) && aMI.Contains(nS2)) {
|
||||
nVNew = aInt->IndexNew();
|
||||
myDS->HasShapeSD (nVNew, nVNew);
|
||||
aMVStick.Add(nVNew);
|
||||
}
|
||||
}
|
||||
@@ -2248,7 +2267,6 @@ void BOPAlgo_PaveFiller::GetStickVertices(const Standard_Integer nF1,
|
||||
aInt.Indices(nS1, nS2);
|
||||
if(aMI.Contains(nS1) && aMI.Contains(nS2)) {
|
||||
nVNew = aInt.IndexNew();
|
||||
myDS->HasShapeSD (nVNew, nVNew);
|
||||
aMVStick.Add(nVNew);
|
||||
aMVEF.Add(nVNew);
|
||||
}
|
||||
@@ -2281,28 +2299,24 @@ void BOPAlgo_PaveFiller::GetFullShapeMap(const Standard_Integer nF,
|
||||
// function: RemoveUsedVertices
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::RemoveUsedVertices(const BOPDS_VectorOfCurve& aVC,
|
||||
void BOPAlgo_PaveFiller::RemoveUsedVertices(const BOPDS_Curve& aNC,
|
||||
TColStd_MapOfInteger& aMV)
|
||||
{
|
||||
if (aMV.IsEmpty())
|
||||
return;
|
||||
|
||||
for (Standard_Integer i = 0; i < aVC.Length(); ++i)
|
||||
const BOPDS_ListOfPaveBlock& aLPBC = aNC.PaveBlocks();
|
||||
BOPDS_ListIteratorOfListOfPaveBlock itPB(aLPBC);
|
||||
for (; itPB.More(); itPB.Next())
|
||||
{
|
||||
const BOPDS_Curve& aNC = aVC.Value(i);
|
||||
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 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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,7 @@
|
||||
#include <BOPDS_PaveBlock.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools2D.hxx>
|
||||
#include <BOPTools_BoxTree.hxx>
|
||||
#include <BOPTools_BoxBndTree.hxx>
|
||||
#include <BOPTools_Parallel.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
#include <Bnd_Tools.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
@@ -46,6 +45,7 @@
|
||||
#include <gp_Vec.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
@@ -954,66 +954,78 @@ Standard_Boolean FindPlane(const TopoDS_Shape& theWire,
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_PairVerticesSelector
|
||||
//class : BOPAlgo_TNV
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_PairVerticesSelector : public BOPTools_BoxPairSelector
|
||||
{
|
||||
public:
|
||||
class BOPAlgo_TNV;
|
||||
typedef NCollection_Vector<BOPAlgo_TNV> BOPAlgo_VectorOfTNV;
|
||||
|
||||
BOPAlgo_PairVerticesSelector()
|
||||
: myVertices(NULL),
|
||||
myFuzzyValue(Precision::Confusion())
|
||||
{}
|
||||
|
||||
//! Sets the map of vertices with tolerances
|
||||
void SetMapOfVerticesTolerances (const TopTools_IndexedDataMapOfShapeReal& theVertices)
|
||||
{
|
||||
myVertices = &theVertices;
|
||||
//=======================================================================
|
||||
class BOPAlgo_TNV : public BOPTools_BoxBndTreeSelector{
|
||||
public:
|
||||
BOPAlgo_TNV()
|
||||
: BOPTools_BoxBndTreeSelector(),
|
||||
myTol (0.), myFuzzyValue(0.), myTree(NULL), myVecTNV(NULL) {
|
||||
};
|
||||
//
|
||||
~BOPAlgo_TNV(){
|
||||
};
|
||||
//
|
||||
void SetVertex(const TopoDS_Vertex& aV) {
|
||||
myV=aV;
|
||||
myPnt = BRep_Tool::Pnt(myV);
|
||||
}
|
||||
|
||||
//! Sets the fuzzy value
|
||||
void SetFuzzyValue (const Standard_Real theFuzzyValue)
|
||||
{
|
||||
//
|
||||
const TopoDS_Vertex& Vertex()const {
|
||||
return myV;
|
||||
}
|
||||
//
|
||||
void SetTree(BOPTools_BoxBndTree& aTree) {
|
||||
myTree=&aTree;
|
||||
}
|
||||
//
|
||||
void SetTolerance(const Standard_Real theTol) {
|
||||
myTol = theTol;
|
||||
}
|
||||
//
|
||||
Standard_Real Tolerance() const {
|
||||
return myTol;
|
||||
}
|
||||
//
|
||||
const gp_Pnt& Pnt() const {
|
||||
return myPnt;
|
||||
}
|
||||
//
|
||||
void SetFuzzyValue(const Standard_Real theFuzzyValue) {
|
||||
myFuzzyValue = theFuzzyValue;
|
||||
}
|
||||
|
||||
//! Checks and accepts the pair of elements.
|
||||
virtual Standard_Boolean Accept (const Standard_Integer theID1,
|
||||
const Standard_Integer theID2) Standard_OVERRIDE
|
||||
//
|
||||
void SetVectorOfTNV(const BOPAlgo_VectorOfTNV& theVec) {
|
||||
myVecTNV = &theVec;
|
||||
}
|
||||
//
|
||||
virtual Standard_Boolean Accept(const Standard_Integer& theIndex)
|
||||
{
|
||||
if (!RejectElement (theID1, theID2))
|
||||
{
|
||||
const Standard_Integer anID1 = this->myBVHSet1->Element (theID1);
|
||||
const TopoDS_Vertex& aV1 = TopoDS::Vertex (myVertices->FindKey (anID1));
|
||||
Standard_Real aTolV1 = BRep_Tool::Tolerance (aV1);
|
||||
if (aTolV1 < myVertices->FindFromIndex (anID1))
|
||||
aTolV1 = myVertices->FindFromIndex (anID1);
|
||||
gp_Pnt aP1 = BRep_Tool::Pnt (aV1);
|
||||
|
||||
const Standard_Integer anID2 = this->myBVHSet1->Element (theID2);
|
||||
const TopoDS_Vertex& aV2 = TopoDS::Vertex (myVertices->FindKey (anID2));
|
||||
Standard_Real aTolV2 = BRep_Tool::Tolerance (aV2);
|
||||
if (aTolV2 < myVertices->FindFromIndex (anID2))
|
||||
aTolV2 = myVertices->FindFromIndex (anID2);
|
||||
gp_Pnt aP2 = BRep_Tool::Pnt (aV2);
|
||||
|
||||
Standard_Real aTolSum2 = aTolV1 + aTolV2 + myFuzzyValue;
|
||||
aTolSum2 *= aTolSum2;
|
||||
|
||||
Standard_Real aD2 = aP1.SquareDistance (aP2);
|
||||
if (aD2 < aTolSum2)
|
||||
{
|
||||
myPairs.push_back (PairIDs (anID1, anID2));
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
const BOPAlgo_TNV& aTNV = myVecTNV->Value(theIndex - 1);
|
||||
Standard_Real aTolSum2 = myTol + aTNV.Tolerance() + myFuzzyValue;
|
||||
aTolSum2 *= aTolSum2;
|
||||
Standard_Real aD2 = myPnt.SquareDistance(aTNV.Pnt());
|
||||
if (aD2 < aTolSum2)
|
||||
return BOPTools_BoxBndTreeSelector::Accept(theIndex);
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
protected:
|
||||
const TopTools_IndexedDataMapOfShapeReal * myVertices;
|
||||
//
|
||||
void Perform() {
|
||||
myTree->Select(*this);
|
||||
}
|
||||
//
|
||||
protected:
|
||||
Standard_Real myTol;
|
||||
Standard_Real myFuzzyValue;
|
||||
gp_Pnt myPnt;
|
||||
TopoDS_Vertex myV;
|
||||
BOPTools_BoxBndTree *myTree;
|
||||
const BOPAlgo_VectorOfTNV *myVecTNV;
|
||||
};
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
@@ -1023,82 +1035,84 @@ protected:
|
||||
//purpose : Builds the chains of intersecting vertices
|
||||
//=======================================================================
|
||||
void BOPAlgo_Tools::IntersectVertices(const TopTools_IndexedDataMapOfShapeReal& theVertices,
|
||||
const Standard_Boolean theRunParallel,
|
||||
const Standard_Real theFuzzyValue,
|
||||
TopTools_ListOfListOfShape& theChains)
|
||||
{
|
||||
Standard_Integer aNbV = theVertices.Extent();
|
||||
Standard_Integer i, j, aNbV = theVertices.Extent();
|
||||
if (aNbV <= 1) {
|
||||
if (aNbV == 1) {
|
||||
theChains.Append(TopTools_ListOfShape()).Append(theVertices.FindKey(1));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Additional tolerance for intersection
|
||||
//
|
||||
// Use unbalanced binary tree of bounding boxes for sorting of the vertices.
|
||||
BOPTools_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer,
|
||||
Bnd_Box> aTreeFiller(aBBTree);
|
||||
// Perform intersection of the vertices
|
||||
BOPAlgo_VectorOfTNV aVTNV;
|
||||
//
|
||||
// Use additional tolerance for intersection
|
||||
Standard_Real aTolAdd = theFuzzyValue / 2.;
|
||||
|
||||
// Use BVH Tree for sorting the vertices
|
||||
BOPTools_BoxTree aBBTree;
|
||||
aBBTree.SetSize (aNbV);
|
||||
|
||||
for (Standard_Integer i = 1; i <= aNbV; ++i)
|
||||
{
|
||||
// Prepare the tree
|
||||
for (i = 1; i <= aNbV; ++i) {
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex(theVertices.FindKey(i));
|
||||
Standard_Real aTol = BRep_Tool::Tolerance(aV);
|
||||
if (aTol < theVertices(i))
|
||||
if (aTol < theVertices(i)) {
|
||||
aTol = theVertices(i);
|
||||
|
||||
}
|
||||
// Build bnd box for vertex
|
||||
Bnd_Box aBox;
|
||||
aBox.Add(BRep_Tool::Pnt(aV));
|
||||
aBox.SetGap(aTol + aTolAdd);
|
||||
aBBTree.Add(i, Bnd_Tools::Bnd2BVH(aBox));
|
||||
//
|
||||
aTreeFiller.Add(i, aBox);
|
||||
//
|
||||
BOPAlgo_TNV& aTNV=aVTNV.Appended();
|
||||
aTNV.SetTree(aBBTree);
|
||||
aTNV.SetBox(aBox);
|
||||
aTNV.SetVertex(aV);
|
||||
aTNV.SetTolerance(aTol);
|
||||
aTNV.SetFuzzyValue(theFuzzyValue);
|
||||
aTNV.SetVectorOfTNV(aVTNV);
|
||||
}
|
||||
|
||||
aBBTree.Build();
|
||||
|
||||
// Perform selection of the interfering vertices
|
||||
BOPAlgo_PairVerticesSelector aPairSelector;
|
||||
aPairSelector.SetBVHSets (&aBBTree, &aBBTree);
|
||||
aPairSelector.SetSame (Standard_True);
|
||||
aPairSelector.SetMapOfVerticesTolerances (theVertices);
|
||||
aPairSelector.SetFuzzyValue (theFuzzyValue);
|
||||
aPairSelector.Select();
|
||||
|
||||
// Treat the selected pairs
|
||||
const std::vector<BOPTools_BoxPairSelector::PairIDs>& aPairs = aPairSelector.Pairs();
|
||||
const Standard_Integer aNbPairs = static_cast<Standard_Integer> (aPairs.size());
|
||||
|
||||
// Collect interfering pairs
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger> aMILI (1, anAlloc);
|
||||
|
||||
for (Standard_Integer iPair = 0; iPair < aNbPairs; ++iPair)
|
||||
{
|
||||
const BOPTools_BoxPairSelector::PairIDs& aPair = aPairs[iPair];
|
||||
BOPAlgo_Tools::FillMap<Standard_Integer, TColStd_MapIntegerHasher> (aPair.ID1, aPair.ID2, aMILI, anAlloc);
|
||||
}
|
||||
|
||||
NCollection_List<TColStd_ListOfInteger> aBlocks (anAlloc);
|
||||
BOPAlgo_Tools::MakeBlocks<Standard_Integer, TColStd_MapIntegerHasher> (aMILI, aBlocks, anAlloc);
|
||||
|
||||
NCollection_List<TColStd_ListOfInteger>::Iterator itLI (aBlocks);
|
||||
for (; itLI.More(); itLI.Next())
|
||||
{
|
||||
const TColStd_ListOfInteger& aLI = itLI.Value();
|
||||
TopTools_ListOfShape &aChain = theChains.Append (TopTools_ListOfShape());
|
||||
|
||||
for (TColStd_ListOfInteger::Iterator itI (aLI); itI.More(); itI.Next())
|
||||
aChain.Append (theVertices.FindKey (itI.Value()));
|
||||
}
|
||||
|
||||
// Add not interfered vertices as a chain of 1 element
|
||||
for (Standard_Integer i = 1; i <= aNbV; ++i)
|
||||
{
|
||||
if (!aMILI.Contains (i))
|
||||
{
|
||||
TopTools_ListOfShape &aChain = theChains.Append (TopTools_ListOfShape());
|
||||
aChain.Append (theVertices.FindKey(i));
|
||||
// Shake the tree
|
||||
aTreeFiller.Fill();
|
||||
//
|
||||
// Perform intersection
|
||||
BOPTools_Parallel::Perform (theRunParallel, aVTNV);
|
||||
//
|
||||
// Fence map
|
||||
TColStd_MapOfInteger aMFence;
|
||||
// Build chains of intersecting vertices
|
||||
for (i = 1; i <= aNbV; ++i) {
|
||||
if (!aMFence.Add(i)) {
|
||||
continue;
|
||||
}
|
||||
// Start the chain
|
||||
TColStd_IndexedMapOfInteger aMChain;
|
||||
aMChain.Add(i);
|
||||
//
|
||||
for (j = 1; j <= aMChain.Extent(); ++j) {
|
||||
BOPAlgo_TNV& aTNV = aVTNV(aMChain(j) - 1);
|
||||
const TColStd_ListOfInteger& aLI = aTNV.Indices();
|
||||
// Add these vertices into the chain
|
||||
for (TColStd_ListIteratorOfListOfInteger aItLI(aLI); aItLI.More(); aItLI.Next()) {
|
||||
if (aMFence.Add(aItLI.Value())) {
|
||||
aMChain.Add(aItLI.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// Put vertices of the chain into the list
|
||||
TopTools_ListOfShape& aChain = theChains.Append(TopTools_ListOfShape());
|
||||
//
|
||||
Standard_Integer aNbVChain = aMChain.Extent();
|
||||
for (j = 1; j <= aNbVChain; ++j) {
|
||||
const TopoDS_Vertex& aVP = aVTNV(aMChain(j) - 1).Vertex();
|
||||
aChain.Append(aVP);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1222,9 +1236,9 @@ public:
|
||||
};
|
||||
|
||||
//! Sets the Bounding Box tree
|
||||
void SetBBTree(BOPTools_BoxTree* theBBTree)
|
||||
void SetBBTree(const BOPTools_BoxBndTree& theBBTree)
|
||||
{
|
||||
myBBTree = theBBTree;
|
||||
myBBTree = (BOPTools_BoxBndTree*)&theBBTree;
|
||||
};
|
||||
|
||||
//! Sets the ShapeBox structure
|
||||
@@ -1274,7 +1288,7 @@ private:
|
||||
TopTools_ListOfShape myOwnIF; //! Own INTERNAL faces of the solid
|
||||
TopTools_ListOfShape myInFaces; //! Faces classified as IN
|
||||
|
||||
BOPTools_BoxTree* myBBTree; //! BVH tree of bounding boxes
|
||||
BOPTools_BoxBndTree* myBBTree; //! UB tree of bounding boxes
|
||||
BOPAlgo_VectorOfShapeBox* myVShapeBox; //! ShapeBoxMap
|
||||
|
||||
TopoDS_Iterator myItF; //! Iterators
|
||||
@@ -1294,11 +1308,10 @@ void BOPAlgo_FillIn3DParts::Perform()
|
||||
myInFaces.Clear();
|
||||
|
||||
// 1. Select boxes of faces that are not out of aBoxS
|
||||
BOPTools_BoxTreeSelector aSelector;
|
||||
aSelector.SetBox(Bnd_Tools::Bnd2BVH(myBoxS));
|
||||
aSelector.SetBVHSet (myBBTree);
|
||||
BOPTools_BoxBndTreeSelector aSelector;
|
||||
aSelector.SetBox(myBoxS);
|
||||
//
|
||||
if (!aSelector.Select())
|
||||
if (!myBBTree->Select(aSelector))
|
||||
return;
|
||||
|
||||
const TColStd_ListOfInteger& aLIFP = aSelector.Indices();
|
||||
@@ -1546,18 +1559,19 @@ void BOPAlgo_Tools::ClassifyFaces(const TopTools_ListOfShape& theFaces,
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare BVH tree of bounding boxes of the faces to classify
|
||||
// Prepare UB tree of bounding boxes of the faces to classify
|
||||
// taking the bounding boxes from the just prepared vector
|
||||
BOPTools_BoxTree aBBTree;
|
||||
BOPTools_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
|
||||
Standard_Integer aNbF = aVSB.Length();
|
||||
aBBTree.SetSize (aNbF);
|
||||
for (Standard_Integer i = 0; i < aNbF; ++i)
|
||||
{
|
||||
aBBTree.Add(i, Bnd_Tools::Bnd2BVH(aVSB(i).Box()));
|
||||
aTreeFiller.Add(i, aVSB(i).Box());
|
||||
}
|
||||
|
||||
// Shake tree filler
|
||||
aBBTree.Build();
|
||||
aTreeFiller.Fill();
|
||||
|
||||
// Prepare vector of solids to classify
|
||||
BOPAlgo_VectorOfFillIn3DParts aVFIP;
|
||||
@@ -1591,7 +1605,7 @@ void BOPAlgo_Tools::ClassifyFaces(const TopTools_ListOfShape& theFaces,
|
||||
if (pLIF)
|
||||
aFIP.SetOwnIF(*pLIF);
|
||||
|
||||
aFIP.SetBBTree(&aBBTree);
|
||||
aFIP.SetBBTree(aBBTree);
|
||||
aFIP.SetShapeBoxVector(aVSB);
|
||||
}
|
||||
|
||||
|
@@ -162,6 +162,7 @@ public:
|
||||
|
||||
//! Finds chains of intersecting vertices
|
||||
Standard_EXPORT static void IntersectVertices(const TopTools_IndexedDataMapOfShapeReal& theVertices,
|
||||
const Standard_Boolean theRunParallel,
|
||||
const Standard_Real theFuzzyValue,
|
||||
TopTools_ListOfListOfShape& theChains);
|
||||
|
||||
|
@@ -1203,33 +1203,9 @@ void BOPDS_DS::InitFaceInfo(const Standard_Integer theI)
|
||||
aSI.SetReference(iRef);
|
||||
//
|
||||
aFI.SetIndex(theI);
|
||||
InitFaceInfoIn(theI);
|
||||
UpdateFaceInfoIn(theI);
|
||||
UpdateFaceInfoOn(theI);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : InitFaceInfoIn
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPDS_DS::InitFaceInfoIn (const Standard_Integer theI)
|
||||
{
|
||||
BOPDS_ShapeInfo& aSI = ChangeShapeInfo (theI);
|
||||
if (aSI.HasReference())
|
||||
{
|
||||
BOPDS_FaceInfo& aFI = myFaceInfoPool (aSI.Reference());
|
||||
const TopoDS_Shape& aF = Shape (theI);
|
||||
for (TopoDS_Iterator itS (aF); itS.More(); itS.Next())
|
||||
{
|
||||
const TopoDS_Shape& aV = itS.Value();
|
||||
if (aV.ShapeType() == TopAbs_VERTEX)
|
||||
{
|
||||
Standard_Integer nV = Index (aV);
|
||||
HasShapeSD (nV, nV);
|
||||
aFI.ChangeVerticesIn().Add (nV);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateFaceInfoIn
|
||||
//purpose :
|
||||
@@ -1380,105 +1356,6 @@ void BOPDS_DS::FaceInfoIn(const Standard_Integer theF,
|
||||
}// for (i=0; i<aNbEF; ++i) {
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateFaceInfoIn
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPDS_DS::UpdateFaceInfoIn (const TColStd_MapOfInteger& theFaces)
|
||||
{
|
||||
for (TColStd_MapOfInteger::Iterator itM (theFaces); itM.More(); itM.Next())
|
||||
{
|
||||
const Standard_Integer nF = itM.Value();
|
||||
BOPDS_ShapeInfo& aSI = ChangeShapeInfo (nF);
|
||||
if (!aSI.HasReference())
|
||||
{
|
||||
myFaceInfoPool.Appended().SetIndex (nF);
|
||||
aSI.SetReference (myFaceInfoPool.Length() - 1);
|
||||
}
|
||||
BOPDS_FaceInfo& aFI = myFaceInfoPool (aSI.Reference());
|
||||
aFI.ChangePaveBlocksIn().Clear();
|
||||
aFI.ChangeVerticesIn().Clear();
|
||||
|
||||
// 1. Add pure internal vertices on the face
|
||||
InitFaceInfoIn (nF);
|
||||
}
|
||||
|
||||
// 2. Analyze Vertex-Face interferences
|
||||
BOPDS_VectorOfInterfVF& aVFs = InterfVF();
|
||||
const Standard_Integer aNbVF = aVFs.Length();
|
||||
for (Standard_Integer iVF = 0; iVF < aNbVF; ++iVF)
|
||||
{
|
||||
BOPDS_InterfVF& aVF = aVFs (iVF);
|
||||
const Standard_Integer nF = aVF.Index2();
|
||||
if (theFaces.Contains (nF))
|
||||
{
|
||||
Standard_Integer nV = aVF.Index1();
|
||||
HasShapeSD (nV, nV);
|
||||
myFaceInfoPool (ShapeInfo (nF).Reference()).ChangeVerticesIn().Add (nV);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 3. Analyze Edge-Face interferences
|
||||
BOPDS_VectorOfInterfEF& aEFs = InterfEF();
|
||||
const Standard_Integer aNbEF = aEFs.Length();
|
||||
for (Standard_Integer iEF = 0; iEF < aNbEF; ++iEF)
|
||||
{
|
||||
BOPDS_InterfEF& aEF = aEFs (iEF);
|
||||
const Standard_Integer nF = aEF.Index2();
|
||||
if (theFaces.Contains (nF))
|
||||
{
|
||||
BOPDS_FaceInfo& aFI = myFaceInfoPool (ShapeInfo (nF).Reference());
|
||||
Standard_Integer nVNew;
|
||||
if (aEF.HasIndexNew (nVNew))
|
||||
{
|
||||
HasShapeSD (nVNew, nVNew);
|
||||
aFI.ChangeVerticesIn().Add (nVNew);
|
||||
}
|
||||
else
|
||||
{
|
||||
const Standard_Integer nE = aEF.Index1();
|
||||
const BOPDS_ListOfPaveBlock& aLPB = PaveBlocks (nE);
|
||||
for (BOPDS_ListOfPaveBlock::Iterator itPB (aLPB); itPB.More(); itPB.Next())
|
||||
{
|
||||
const Handle(BOPDS_PaveBlock)& aPB = itPB.Value();
|
||||
const Handle(BOPDS_CommonBlock)& aCB = CommonBlock (aPB);
|
||||
if (!aCB.IsNull())
|
||||
{
|
||||
if (aCB->Contains (nF))
|
||||
{
|
||||
const Handle(BOPDS_PaveBlock)& aPBR = aCB->PaveBlock1();
|
||||
aFI.ChangePaveBlocksIn().Add(aPBR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateFaceInfoOn
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPDS_DS::UpdateFaceInfoOn (const TColStd_MapOfInteger& theFaces)
|
||||
{
|
||||
for (TColStd_MapOfInteger::Iterator itM (theFaces); itM.More(); itM.Next())
|
||||
{
|
||||
const Standard_Integer nF = itM.Value();
|
||||
BOPDS_ShapeInfo& aSI = ChangeShapeInfo (nF);
|
||||
if (!aSI.HasReference())
|
||||
{
|
||||
myFaceInfoPool.Appended().SetIndex (nF);
|
||||
aSI.SetReference (myFaceInfoPool.Length() - 1);
|
||||
}
|
||||
BOPDS_FaceInfo& aFI = myFaceInfoPool (aSI.Reference());
|
||||
aFI.ChangePaveBlocksOn().Clear();
|
||||
aFI.ChangeVerticesOn().Clear();
|
||||
|
||||
FaceInfoOn (nF, aFI.ChangePaveBlocksOn(), aFI.ChangeVerticesOn());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RefineFaceInfoOn
|
||||
//purpose :
|
||||
|
@@ -274,14 +274,10 @@ Standard_EXPORT virtual ~BOPDS_DS();
|
||||
//! Update the state In of face with index theIndex
|
||||
Standard_EXPORT void UpdateFaceInfoIn (const Standard_Integer theIndex);
|
||||
|
||||
//! Update the state IN for all faces in the given map
|
||||
Standard_EXPORT void UpdateFaceInfoIn (const TColStd_MapOfInteger& theFaces);
|
||||
|
||||
//! Update the state On of face with index theIndex
|
||||
Standard_EXPORT void UpdateFaceInfoOn (const Standard_Integer theIndex);
|
||||
|
||||
//! Update the state ON for all faces in the given map
|
||||
Standard_EXPORT void UpdateFaceInfoOn (const TColStd_MapOfInteger& theFaces);
|
||||
|
||||
//! Selector
|
||||
//! Returns the state On
|
||||
@@ -483,10 +479,6 @@ protected:
|
||||
|
||||
//! Initializes the state of face with index theIndex
|
||||
Standard_EXPORT void InitFaceInfo (const Standard_Integer theIndex);
|
||||
|
||||
//! Initializes the FaceInfo structure for face with index theIndex with elements
|
||||
//! having IN state for the face
|
||||
Standard_EXPORT void InitFaceInfoIn (const Standard_Integer theIndex);
|
||||
|
||||
Standard_EXPORT void InitShape (const Standard_Integer theIndex, const TopoDS_Shape& theS);
|
||||
|
||||
|
@@ -18,16 +18,16 @@
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Bnd_OBB.hxx>
|
||||
#include <Bnd_Tools.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_IndexRange.hxx>
|
||||
#include <BOPDS_Iterator.hxx>
|
||||
#include <BOPDS_Pair.hxx>
|
||||
#include <BOPDS_MapOfPair.hxx>
|
||||
#include <BOPDS_Tools.hxx>
|
||||
#include <BOPTools_BoxTree.hxx>
|
||||
#include <BOPTools_BoxBndTree.hxx>
|
||||
#include <BOPTools_Parallel.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <algorithm>
|
||||
@@ -37,12 +37,12 @@
|
||||
//class : BOPDS_TreeSelector
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPDS_TSR : public BOPTools_BoxTreeSelector
|
||||
{
|
||||
class BOPDS_TSR : public BOPTools_BoxBndTreeSelector{
|
||||
public:
|
||||
BOPDS_TSR() :
|
||||
BOPTools_BoxTreeSelector(),
|
||||
BOPTools_BoxBndTreeSelector(),
|
||||
myHasBRep(Standard_False),
|
||||
myTree(NULL),
|
||||
myIndex(-1) {}
|
||||
//
|
||||
virtual ~BOPDS_TSR() {
|
||||
@@ -52,18 +52,23 @@ class BOPDS_TSR : public BOPTools_BoxTreeSelector
|
||||
myHasBRep=bFlag;
|
||||
}
|
||||
//
|
||||
void SetTree(BOPTools_BoxBndTree& aTree) {
|
||||
myTree=&aTree;
|
||||
}
|
||||
//
|
||||
void SetIndex(const Standard_Integer theIndex) { myIndex = theIndex; }
|
||||
//
|
||||
Standard_Integer Index() const { return myIndex; }
|
||||
//
|
||||
void Perform() {
|
||||
if (myHasBRep) {
|
||||
Select();
|
||||
myTree->Select(*this);
|
||||
}
|
||||
}
|
||||
//
|
||||
protected:
|
||||
Standard_Boolean myHasBRep;
|
||||
BOPTools_BoxBndTree *myTree;
|
||||
Standard_Integer myIndex;
|
||||
};
|
||||
//
|
||||
@@ -71,6 +76,7 @@ class BOPDS_TSR : public BOPTools_BoxTreeSelector
|
||||
typedef NCollection_Vector<BOPDS_TSR> BOPDS_VectorOfTSR;
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
@@ -283,81 +289,142 @@ void BOPDS_Iterator::Intersect(const Handle(IntTools_Context)& theCtx,
|
||||
const Standard_Boolean theCheckOBB,
|
||||
const Standard_Real theFuzzyValue)
|
||||
{
|
||||
const Standard_Integer aNb = myDS->NbSourceShapes();
|
||||
|
||||
// Prepare BVH
|
||||
BOPTools_BoxTree aBoxTree;
|
||||
aBoxTree.SetSize (aNb);
|
||||
for (Standard_Integer i = 0; i < aNb; ++i)
|
||||
{
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
|
||||
if (!aSI.HasBRep())
|
||||
Standard_Integer i, j, iX, i1, i2, iR, aNb, aNbR;
|
||||
Standard_Integer iTi, iTj;
|
||||
TopAbs_ShapeEnum aTi, aTj;
|
||||
//
|
||||
myBoxTree.Clear();
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(myBoxTree);
|
||||
//
|
||||
aNb = myDS->NbSourceShapes();
|
||||
BOPDS_VectorOfTSR aVTSR(aNb);
|
||||
//
|
||||
for (i=0; i<aNb; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
Standard_Boolean bHasBrep = aSI.IsInterfering() && !(aSI.ShapeType() == TopAbs_SOLID);
|
||||
//
|
||||
BOPDS_TSR& aTSR=aVTSR.Appended();
|
||||
//
|
||||
aTSR.SetHasBRep(bHasBrep);
|
||||
if (!bHasBrep) {
|
||||
continue;
|
||||
const Bnd_Box& aBox = aSI.Box();
|
||||
aBoxTree.Add (i, Bnd_Tools::Bnd2BVH (aBox));
|
||||
}
|
||||
|
||||
// Build BVH
|
||||
aBoxTree.Build();
|
||||
|
||||
// Select pairs of shapes with interfering bounding boxes
|
||||
BOPTools_BoxPairSelector aPairSelector;
|
||||
aPairSelector.SetBVHSets (&aBoxTree, &aBoxTree);
|
||||
aPairSelector.SetSame (Standard_True);
|
||||
aPairSelector.Select();
|
||||
aPairSelector.Sort();
|
||||
|
||||
// Treat the selected pairs
|
||||
const std::vector<BOPTools_BoxPairSelector::PairIDs>& aPairs = aPairSelector.Pairs();
|
||||
const Standard_Integer aNbPairs = static_cast<Standard_Integer> (aPairs.size());
|
||||
|
||||
Standard_Integer iPair = 0;
|
||||
|
||||
const Standard_Integer aNbR = myDS->NbRanges();
|
||||
for (Standard_Integer iR = 0; iR < aNbR; ++iR)
|
||||
{
|
||||
const BOPDS_IndexRange& aRange = myDS->Range(iR);
|
||||
|
||||
for (; iPair < aNbPairs; ++iPair)
|
||||
{
|
||||
const BOPTools_BoxPairSelector::PairIDs& aPair = aPairs[iPair];
|
||||
if (!aRange.Contains (aPair.ID1))
|
||||
// Go to the next range
|
||||
break;
|
||||
|
||||
if (aRange.Contains (aPair.ID2))
|
||||
// Go to the next pair
|
||||
continue;
|
||||
|
||||
const BOPDS_ShapeInfo& aSI1 = myDS->ShapeInfo (aPair.ID1);
|
||||
const BOPDS_ShapeInfo& aSI2 = myDS->ShapeInfo (aPair.ID2);
|
||||
|
||||
const TopAbs_ShapeEnum aType1 = aSI1.ShapeType();
|
||||
const TopAbs_ShapeEnum aType2 = aSI2.ShapeType();
|
||||
|
||||
Standard_Integer iType1 = BOPDS_Tools::TypeToInteger (aType1);
|
||||
Standard_Integer iType2 = BOPDS_Tools::TypeToInteger (aType2);
|
||||
|
||||
// avoid interfering of the shape with its sub-shapes
|
||||
if (((iType1 < iType2) && aSI1.HasSubShape (aPair.ID2)) ||
|
||||
((iType1 > iType2) && aSI2.HasSubShape (aPair.ID1)))
|
||||
continue;
|
||||
|
||||
if (theCheckOBB)
|
||||
{
|
||||
// Check intersection of Oriented bounding boxes of the shapes
|
||||
const Bnd_OBB& anOBB1 = theCtx->OBB (aSI1.Shape(), theFuzzyValue);
|
||||
const Bnd_OBB& anOBB2 = theCtx->OBB (aSI2.Shape(), theFuzzyValue);
|
||||
|
||||
if (anOBB1.IsOut (anOBB2))
|
||||
continue;
|
||||
}
|
||||
|
||||
Standard_Integer iX = BOPDS_Tools::TypeToInteger (aType1, aType2);
|
||||
myLists(iX).Append (BOPDS_Pair (Min (aPair.ID1, aPair.ID2),
|
||||
Max (aPair.ID1, aPair.ID2)));
|
||||
}
|
||||
//
|
||||
const Bnd_Box& aBoxEx=aSI.Box();
|
||||
aTSR.SetTree(myBoxTree);
|
||||
aTSR.SetBox(aBoxEx);
|
||||
aTSR.SetIndex(i);
|
||||
//
|
||||
aTreeFiller.Add(i, aBoxEx);
|
||||
}
|
||||
//
|
||||
aTreeFiller.Fill();
|
||||
//
|
||||
//===========================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVTSR);
|
||||
//===========================================
|
||||
//
|
||||
BOPDS_MapOfPair aMPFence;
|
||||
//
|
||||
aNbR = myDS->NbRanges() - 1;
|
||||
for (iR = 0; iR < aNbR; ++iR) {
|
||||
const BOPDS_IndexRange& aR = myDS->Range(iR);
|
||||
i1 = aR.First();
|
||||
i2 = aR.Last();
|
||||
for (i = i1; i <= i2; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
|
||||
//
|
||||
if (!aSI.IsInterfering() || (aSI.ShapeType() == TopAbs_SOLID)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
BOPDS_TSR& aTSRi = aVTSR(i);
|
||||
const TColStd_ListOfInteger& aLI = aTSRi.Indices();
|
||||
Standard_Integer aNbSD = aLI.Extent();
|
||||
if (!aNbSD) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aTi = aSI.ShapeType();
|
||||
iTi = BOPDS_Tools::TypeToInteger(aTi);
|
||||
//
|
||||
TColStd_ListIteratorOfListOfInteger aIt(aLI);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
j = aIt.Value(); // DS index
|
||||
if (j >= i1 && j <= i2) {
|
||||
continue;// same range
|
||||
}
|
||||
//
|
||||
const BOPDS_ShapeInfo& aSJ = myDS->ShapeInfo(j);
|
||||
aTj = aSJ.ShapeType();
|
||||
iTj = BOPDS_Tools::TypeToInteger(aTj);
|
||||
//
|
||||
// avoid interfering of the same shapes and shape with its sub-shapes
|
||||
if (((iTi < iTj) && aSI.HasSubShape(j)) ||
|
||||
((iTi > iTj) && aSJ.HasSubShape(i))) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
BOPDS_Pair aPair(i, j);
|
||||
if (aMPFence.Add(aPair)) {
|
||||
if (theCheckOBB)
|
||||
{
|
||||
// Check intersection of Oriented bounding boxes of the shapes
|
||||
Bnd_OBB& anOBBi = theCtx->OBB(aSI.Shape(), theFuzzyValue);
|
||||
Bnd_OBB& anOBBj = theCtx->OBB(aSJ.Shape(), theFuzzyValue);
|
||||
|
||||
if (anOBBi.IsOut(anOBBj))
|
||||
continue;
|
||||
}
|
||||
|
||||
iX = BOPDS_Tools::TypeToInteger(aTi, aTj);
|
||||
myLists(iX).Append(aPair);
|
||||
}// if (aMPFence.Add(aPair)) {
|
||||
}// for (; aIt.More(); aIt.Next()) {
|
||||
}//for (i=i1; i<=i2; ++i) {
|
||||
}//for (iR=1; iR<aNbR; ++iR) {
|
||||
//
|
||||
aMPFence.Clear();
|
||||
aVTSR.Clear();
|
||||
//-----------------------------------------------------scope_1 t
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: PrepareExt
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPDS_Iterator::PrepareExt(const TColStd_MapOfInteger& theIndices)
|
||||
{
|
||||
if (!myDS)
|
||||
return;
|
||||
|
||||
// Update UB tree of bounding boxes with the increased shapes.
|
||||
// It is expected that not too many shapes will be modified during
|
||||
// the intersection, so after updating the tree it should not become
|
||||
// too unbalanced.
|
||||
TColStd_MapIteratorOfMapOfInteger itM(theIndices);
|
||||
for (; itM.More(); itM.Next())
|
||||
{
|
||||
Standard_Integer nV = itM.Value();
|
||||
myBoxTree.Remove(nV);
|
||||
|
||||
// Add with new box
|
||||
Standard_Integer nVSD = nV;
|
||||
myDS->HasShapeSD(nV, nVSD);
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(nVSD);
|
||||
const Bnd_Box& aBox = aSI.Box();
|
||||
myBoxTree.Add(nV, aBox);
|
||||
}
|
||||
|
||||
// Clear the extra lists
|
||||
const Standard_Integer aNbExt = BOPDS_Iterator::NbExtInterfs();
|
||||
myLength = 0;
|
||||
for (Standard_Integer i = 0; i < aNbExt; ++i)
|
||||
myExtLists(i).Clear();
|
||||
|
||||
IntersectExt(theIndices);
|
||||
|
||||
myUseExt = Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -366,43 +433,24 @@ void BOPDS_Iterator::Intersect(const Handle(IntTools_Context)& theCtx,
|
||||
//=======================================================================
|
||||
void BOPDS_Iterator::IntersectExt(const TColStd_MapOfInteger& theIndices)
|
||||
{
|
||||
if (!myDS)
|
||||
return;
|
||||
|
||||
const Standard_Integer aNb = myDS->NbSourceShapes();
|
||||
|
||||
BOPTools_BoxTree aBoxTree;
|
||||
aBoxTree.SetSize (aNb);
|
||||
// Prepare vector for parallel selection
|
||||
BOPDS_VectorOfTSR aVTSR(theIndices.Extent());
|
||||
//
|
||||
for (Standard_Integer i = 0; i < aNb; ++i)
|
||||
|
||||
TColStd_MapIteratorOfMapOfInteger itM(theIndices);
|
||||
for (; itM.More(); itM.Next())
|
||||
{
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
if (!aSI.IsInterfering() || (aSI.ShapeType() == TopAbs_SOLID))
|
||||
continue;
|
||||
//
|
||||
if (theIndices.Contains (i))
|
||||
{
|
||||
Standard_Integer nVSD = i;
|
||||
myDS->HasShapeSD (i, nVSD);
|
||||
const BOPDS_ShapeInfo& aSISD = myDS->ShapeInfo (nVSD);
|
||||
const Bnd_Box& aBox = aSISD.Box ();
|
||||
aBoxTree.Add (i, Bnd_Tools::Bnd2BVH(aBox));
|
||||
|
||||
BOPDS_TSR& aTSR=aVTSR.Appended();
|
||||
aTSR.SetHasBRep(Standard_True);
|
||||
aTSR.SetBVHSet (&aBoxTree);
|
||||
aTSR.SetBox (Bnd_Tools::Bnd2BVH (aBox));
|
||||
aTSR.SetIndex (i);
|
||||
}
|
||||
else
|
||||
{
|
||||
aBoxTree.Add (i, Bnd_Tools::Bnd2BVH (aSI.Box ()));
|
||||
}
|
||||
Standard_Integer nV = itM.Value();
|
||||
Standard_Integer nVSD = nV;
|
||||
myDS->HasShapeSD(nV, nVSD);
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(nVSD);
|
||||
const Bnd_Box& aBox = aSI.Box();
|
||||
BOPDS_TSR& aTSR = aVTSR.Appended();
|
||||
aTSR.SetHasBRep(Standard_True);
|
||||
aTSR.SetTree(myBoxTree);
|
||||
aTSR.SetBox(aBox);
|
||||
aTSR.SetIndex(nV);
|
||||
}
|
||||
|
||||
aBoxTree.Build();
|
||||
|
||||
// Perform selection
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVTSR);
|
||||
|
||||
@@ -411,8 +459,8 @@ void BOPDS_Iterator::IntersectExt(const TColStd_MapOfInteger& theIndices)
|
||||
// Fence map to avoid duplicating pairs
|
||||
BOPDS_MapOfPair aMPFence;
|
||||
|
||||
const Standard_Integer aNbV = aVTSR.Length();
|
||||
for (Standard_Integer k = 0; k < aNbV; ++k)
|
||||
const Standard_Integer aNb = aVTSR.Length();
|
||||
for (Standard_Integer k = 0; k < aNb; ++k)
|
||||
{
|
||||
BOPDS_TSR& aTSRi = aVTSR(k);
|
||||
const TColStd_ListOfInteger& aLI = aTSRi.Indices();
|
||||
@@ -437,7 +485,7 @@ void BOPDS_Iterator::IntersectExt(const TColStd_MapOfInteger& theIndices)
|
||||
const TopAbs_ShapeEnum aTJ = aSJ.ShapeType();
|
||||
const Standard_Integer iTJ = BOPDS_Tools::TypeToInteger(aTJ);
|
||||
|
||||
// avoid interfering of the shape with its sub-shapes
|
||||
// avoid interfering of the same shapes and shape with its sub-shapes
|
||||
if (((iTI < iTJ) && aSI.HasSubShape(j)) ||
|
||||
((iTI > iTJ) && aSJ.HasSubShape(i)))
|
||||
continue;
|
||||
@@ -451,6 +499,4 @@ void BOPDS_Iterator::IntersectExt(const TColStd_MapOfInteger& theIndices)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myUseExt = Standard_True;
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@
|
||||
#include <BOPDS_PDS.hxx>
|
||||
#include <BOPDS_VectorOfPair.hxx>
|
||||
#include <BOPDS_VectorOfVectorOfPair.hxx>
|
||||
#include <BOPTools_BoxTree.hxx>
|
||||
#include <BOPTools_BoxBndTree.hxx>
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
|
||||
//! Updates the tree of Bounding Boxes with increased boxes and
|
||||
//! intersects such elements with the tree.
|
||||
Standard_EXPORT void IntersectExt(const TColStd_MapOfInteger& theIndicies);
|
||||
Standard_EXPORT void PrepareExt(const TColStd_MapOfInteger& theIndicies);
|
||||
|
||||
//! Returns the number of intersections founded
|
||||
Standard_EXPORT Standard_Integer ExpectedLength() const;
|
||||
@@ -119,6 +119,12 @@ protected: //! @name Protected methods for bounding boxes intersection
|
||||
const Standard_Boolean theCheckOBB = Standard_False,
|
||||
const Standard_Real theFuzzyValue = Precision::Confusion());
|
||||
|
||||
//! Intersects the bounding boxes of the shapes with given indices in DS
|
||||
//! with the tree of bounding boxes and saves the interfering pairs in
|
||||
//! extra lists for further geometrical intersection.
|
||||
Standard_EXPORT void IntersectExt(const TColStd_MapOfInteger& theIndices);
|
||||
|
||||
|
||||
protected: //! @name Fields
|
||||
|
||||
Handle(NCollection_BaseAllocator) myAllocator; //!< Allocator
|
||||
@@ -128,6 +134,7 @@ protected: //! @name Fields
|
||||
BOPDS_VectorOfVectorOfPair myLists; //!< Pairs with interfering bounding boxes
|
||||
BOPDS_VectorOfPair::Iterator myIterator; //!< Iterator on each interfering type
|
||||
Standard_Boolean myRunParallel; //!< Flag for parallel processing
|
||||
BOPTools_BoxBndTree myBoxTree; //!< Unbalanced tree of bounding boxes
|
||||
BOPDS_VectorOfVectorOfPair myExtLists; //!< Extra pairs of sub-shapes found after
|
||||
//! intersection of increased sub-shapes
|
||||
Standard_Boolean myUseExt; //!< Information flag for using the extra lists
|
||||
|
@@ -14,7 +14,6 @@
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Bnd_OBB.hxx>
|
||||
#include <Bnd_Tools.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_IndexRange.hxx>
|
||||
#include <BOPDS_IteratorSI.hxx>
|
||||
@@ -22,10 +21,11 @@
|
||||
#include <BOPDS_Pair.hxx>
|
||||
#include <BOPDS_ShapeInfo.hxx>
|
||||
#include <BOPDS_Tools.hxx>
|
||||
#include <BOPTools_BoxTree.hxx>
|
||||
#include <BOPTools_BoxBndTree.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TColStd_DataMapOfIntegerInteger.hxx>
|
||||
#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
|
||||
@@ -79,68 +79,83 @@ void BOPDS_IteratorSI::UpdateByLevelOfCheck(const Standard_Integer theLevel)
|
||||
// function: Intersect
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPDS_IteratorSI::Intersect (const Handle(IntTools_Context)& theCtx,
|
||||
const Standard_Boolean theCheckOBB,
|
||||
const Standard_Real theFuzzyValue)
|
||||
void BOPDS_IteratorSI::Intersect(const Handle(IntTools_Context)& theCtx,
|
||||
const Standard_Boolean theCheckOBB,
|
||||
const Standard_Real theFuzzyValue)
|
||||
{
|
||||
const Standard_Integer aNbS = myDS->NbSourceShapes();
|
||||
|
||||
BOPTools_BoxTree aBBTree;
|
||||
aBBTree.SetSize (aNbS);
|
||||
|
||||
for (Standard_Integer i = 0; i < aNbS; ++i)
|
||||
{
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo (i);
|
||||
if (!aSI.IsInterfering())
|
||||
Standard_Integer i, j, iX, aNbS;
|
||||
Standard_Integer iTi, iTj;
|
||||
TopAbs_ShapeEnum aTi, aTj;
|
||||
//
|
||||
BOPTools_BoxBndTreeSelector aSelector;
|
||||
BOPTools_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
//
|
||||
aNbS = myDS->NbSourceShapes();
|
||||
for (i=0; i<aNbS; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
if (!aSI.IsInterfering()) {
|
||||
continue;
|
||||
|
||||
const Bnd_Box& aBoxEx = aSI.Box();
|
||||
aBBTree.Add (i, Bnd_Tools::Bnd2BVH (aBoxEx));
|
||||
}
|
||||
|
||||
aBBTree.Build();
|
||||
|
||||
// Select pairs of shapes with interfering bounding boxes
|
||||
BOPTools_BoxPairSelector aPairSelector;
|
||||
aPairSelector.SetBVHSets (&aBBTree, &aBBTree);
|
||||
aPairSelector.SetSame (Standard_True);
|
||||
aPairSelector.Select();
|
||||
aPairSelector.Sort();
|
||||
|
||||
// Treat the selected pairs
|
||||
const std::vector<BOPTools_BoxPairSelector::PairIDs>& aPairs = aPairSelector.Pairs();
|
||||
const Standard_Integer aNbPairs = static_cast<Standard_Integer> (aPairs.size());
|
||||
|
||||
for (Standard_Integer iPair = 0; iPair < aNbPairs; ++iPair)
|
||||
{
|
||||
const BOPTools_BoxPairSelector::PairIDs& aPair = aPairs[iPair];
|
||||
|
||||
const BOPDS_ShapeInfo& aSI1 = myDS->ShapeInfo (aPair.ID1);
|
||||
const BOPDS_ShapeInfo& aSI2 = myDS->ShapeInfo (aPair.ID2);
|
||||
|
||||
const TopAbs_ShapeEnum aType1 = aSI1.ShapeType();
|
||||
const TopAbs_ShapeEnum aType2 = aSI2.ShapeType();
|
||||
|
||||
Standard_Integer iType1 = BOPDS_Tools::TypeToInteger (aType1);
|
||||
Standard_Integer iType2 = BOPDS_Tools::TypeToInteger (aType2);
|
||||
|
||||
// avoid interfering of the shape with its sub-shapes
|
||||
if (((iType1 < iType2) && aSI1.HasSubShape (aPair.ID2)) ||
|
||||
((iType1 > iType2) && aSI2.HasSubShape (aPair.ID1)))
|
||||
continue;
|
||||
|
||||
if (theCheckOBB)
|
||||
{
|
||||
// Check intersection of Oriented bounding boxes of the shapes
|
||||
const Bnd_OBB& anOBB1 = theCtx->OBB (aSI1.Shape (), theFuzzyValue);
|
||||
const Bnd_OBB& anOBB2 = theCtx->OBB (aSI2.Shape (), theFuzzyValue);
|
||||
|
||||
if (anOBB1.IsOut (anOBB2))
|
||||
continue;
|
||||
}
|
||||
|
||||
Standard_Integer iX = BOPDS_Tools::TypeToInteger (aType1, aType2);
|
||||
myLists(iX).Append (BOPDS_Pair (Min (aPair.ID1, aPair.ID2),
|
||||
Max (aPair.ID1, aPair.ID2)));
|
||||
//
|
||||
const Bnd_Box& aBoxEx = aSI.Box();
|
||||
aTreeFiller.Add(i, aBoxEx);
|
||||
}
|
||||
//
|
||||
aTreeFiller.Fill();
|
||||
//
|
||||
BOPDS_MapOfPair aMPFence;
|
||||
//
|
||||
for (i = 0; i < aNbS; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
|
||||
if (!aSI.IsInterfering()){
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const Bnd_Box& aBoxEx = aSI.Box();
|
||||
//
|
||||
aSelector.Clear();
|
||||
aSelector.SetBox(aBoxEx);
|
||||
//
|
||||
Standard_Integer aNbSD = aBBTree.Select(aSelector);
|
||||
if (!aNbSD) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aTi = aSI.ShapeType();
|
||||
iTi = BOPDS_Tools::TypeToInteger(aTi);
|
||||
//
|
||||
const TColStd_ListOfInteger& aLI = aSelector.Indices();
|
||||
TColStd_ListIteratorOfListOfInteger aIt(aLI);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
j = aIt.Value();
|
||||
const BOPDS_ShapeInfo& aSJ = myDS->ShapeInfo(j);
|
||||
aTj = aSJ.ShapeType();
|
||||
iTj = BOPDS_Tools::TypeToInteger(aTj);
|
||||
//
|
||||
// avoid interfering of the same shapes and shape with its sub-shapes
|
||||
if ((i == j) || ((iTi < iTj) && aSI.HasSubShape(j)) ||
|
||||
((iTi > iTj) && aSJ.HasSubShape(i))) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
BOPDS_Pair aPair(i, j);
|
||||
if (aMPFence.Add(aPair)) {
|
||||
if (theCheckOBB)
|
||||
{
|
||||
// Check intersection of Oriented bounding boxes of the shapes
|
||||
Bnd_OBB& anOBBi = theCtx->OBB(aSI.Shape(), theFuzzyValue);
|
||||
Bnd_OBB& anOBBj = theCtx->OBB(aSJ.Shape(), theFuzzyValue);
|
||||
|
||||
if (anOBBi.IsOut(anOBBj))
|
||||
continue;
|
||||
}
|
||||
|
||||
iX = BOPDS_Tools::TypeToInteger(aTi, aTj);
|
||||
myLists(iX).Append(aPair);
|
||||
}// if (aMPKXB.Add(aPKXB)) {
|
||||
}// for (; aIt.More(); aIt.Next()) {
|
||||
}//for (i=1; i<=aNbS; ++i) {
|
||||
//
|
||||
aMPFence.Clear();
|
||||
}
|
||||
|
@@ -126,7 +126,18 @@ inline TColStd_ListOfInteger& BOPDS_ShapeInfo::ChangeSubShapes()
|
||||
inline Standard_Boolean BOPDS_ShapeInfo::HasSubShape
|
||||
(const Standard_Integer theI)const
|
||||
{
|
||||
return mySubShapes.Contains (theI);
|
||||
Standard_Boolean bRet;
|
||||
TColStd_ListIteratorOfListOfInteger aIt;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
aIt.Initialize(mySubShapes);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
bRet=(theI==aIt.Value());
|
||||
if (bRet) {
|
||||
return bRet;
|
||||
}
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : HasReference
|
||||
|
@@ -16,13 +16,14 @@
|
||||
#include <BOPDS_SubIterator.hxx>
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Bnd_Tools.hxx>
|
||||
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_Pair.hxx>
|
||||
#include <BOPDS_MapOfPair.hxx>
|
||||
|
||||
#include <BOPTools_BoxTree.hxx>
|
||||
#include <BOPTools_BoxBndTree.hxx>
|
||||
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
@@ -114,65 +115,60 @@ void BOPDS_SubIterator::Initialize()
|
||||
// function: Intersect
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPDS_SubIterator::Intersect()
|
||||
void BOPDS_SubIterator::Intersect()
|
||||
{
|
||||
if (!mySubSet1->Extent() || !mySubSet2->Extent())
|
||||
return;
|
||||
|
||||
// Construct BVH tree for each sub-set
|
||||
BOPTools_BoxTree aBBTree[2];
|
||||
for (Standard_Integer i = 0; i < 2; ++i)
|
||||
{
|
||||
const TColStd_ListOfInteger* aSubSet = !i ? mySubSet1 : mySubSet2;
|
||||
aBBTree[i].SetSize (aSubSet->Extent());
|
||||
for (TColStd_ListOfInteger::Iterator it (*aSubSet); it.More(); it.Next())
|
||||
{
|
||||
const Standard_Integer nS = it.Value();
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(nS);
|
||||
const Bnd_Box& aBoxEx = aSI.Box();
|
||||
aBBTree[i].Add(nS, Bnd_Tools::Bnd2BVH (aBoxEx));
|
||||
}
|
||||
aBBTree[i].Build();
|
||||
Standard_Integer i, j, iTi, iTj;
|
||||
BOPTools_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
//
|
||||
TColStd_ListIteratorOfListOfInteger aIt(*mySubSet1);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
i = aIt.Value();
|
||||
//
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
|
||||
const Bnd_Box& aBoxEx = aSI.Box();
|
||||
//
|
||||
aTreeFiller.Add(i, aBoxEx);
|
||||
}
|
||||
|
||||
// Perform selection of the interfering pairs
|
||||
BOPTools_BoxPairSelector aPairSelector;
|
||||
aPairSelector.SetBVHSets (&aBBTree[0], &aBBTree[1]);
|
||||
aPairSelector.Select();
|
||||
aPairSelector.Sort();
|
||||
|
||||
// Treat the selected pairs
|
||||
const std::vector<BOPTools_BoxPairSelector::PairIDs>& aPairs = aPairSelector.Pairs();
|
||||
const Standard_Integer aNbPairs = static_cast<Standard_Integer> (aPairs.size());
|
||||
|
||||
// Fence map
|
||||
//
|
||||
aTreeFiller.Fill();
|
||||
//
|
||||
BOPDS_MapOfPair aMPKFence;
|
||||
|
||||
for (Standard_Integer iPair = 0; iPair < aNbPairs; ++iPair)
|
||||
{
|
||||
const BOPTools_BoxPairSelector::PairIDs& aPair = aPairs[iPair];
|
||||
if (aPair.ID1 == aPair.ID2)
|
||||
//
|
||||
aIt.Initialize(*mySubSet2);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
i = aIt.Value();
|
||||
//
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
|
||||
const Bnd_Box& aBoxEx = aSI.Box();
|
||||
//
|
||||
BOPTools_BoxBndTreeSelector aSelector;
|
||||
aSelector.SetBox(aBoxEx);
|
||||
Standard_Integer aNbSD = aBBTree.Select(aSelector);
|
||||
if (!aNbSD) {
|
||||
continue;
|
||||
|
||||
BOPDS_Pair aDSPair (Min(aPair.ID1, aPair.ID2),
|
||||
Max(aPair.ID1, aPair.ID2));
|
||||
if (!aMPKFence.Add(aDSPair))
|
||||
continue;
|
||||
|
||||
const BOPDS_ShapeInfo& aSI1 = myDS->ShapeInfo (aPair.ID1);
|
||||
const BOPDS_ShapeInfo& aSI2 = myDS->ShapeInfo (aPair.ID2);
|
||||
|
||||
const TopAbs_ShapeEnum aType1 = aSI1.ShapeType();
|
||||
const TopAbs_ShapeEnum aType2 = aSI2.ShapeType();
|
||||
|
||||
Standard_Integer iType1 = BOPDS_Tools::TypeToInteger (aType1);
|
||||
Standard_Integer iType2 = BOPDS_Tools::TypeToInteger (aType2);
|
||||
|
||||
// avoid interfering of the shape with its sub-shapes
|
||||
if (((iType1 < iType2) && aSI1.HasSubShape (aPair.ID2)) ||
|
||||
((iType1 > iType2) && aSI2.HasSubShape (aPair.ID1)))
|
||||
continue;
|
||||
|
||||
myList.Append(aDSPair);
|
||||
}
|
||||
//
|
||||
iTi = BOPDS_Tools::TypeToInteger(aSI.ShapeType());
|
||||
//
|
||||
const TColStd_ListOfInteger& aLI = aSelector.Indices();
|
||||
TColStd_ListIteratorOfListOfInteger aItLI(aLI);
|
||||
for (; aItLI.More(); aItLI.Next()) {
|
||||
j = aItLI.Value();
|
||||
//
|
||||
const BOPDS_ShapeInfo& aSJ = myDS->ShapeInfo(j);
|
||||
iTj = BOPDS_Tools::TypeToInteger(aSJ.ShapeType());
|
||||
//
|
||||
// avoid interfering of the same shapes and shape with its sub-shapes
|
||||
if ((i == j) || ((iTi < iTj) && aSI.HasSubShape(j)) ||
|
||||
((iTi > iTj) && aSJ.HasSubShape(i))) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
BOPDS_Pair aPair(j, i);
|
||||
if (aMPKFence.Add(aPair)) {
|
||||
myList.Append(aPair);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -58,9 +58,9 @@ static
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
|
||||
(const TopoDS_Edge& theE2, // old
|
||||
const TopoDS_Edge& theE1, // new
|
||||
const TopoDS_Face& theF,
|
||||
(const TopoDS_Edge& aE2, // old
|
||||
const TopoDS_Edge& aE1, // new
|
||||
const TopoDS_Face& aF,
|
||||
const Handle(IntTools_Context)& aCtx)
|
||||
{
|
||||
Standard_Boolean bIsToReverse, bIsClosed, bComp;
|
||||
@@ -73,13 +73,6 @@ Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
|
||||
//
|
||||
iRet=0;
|
||||
//
|
||||
TopoDS_Face aF = theF;
|
||||
aF.Orientation (TopAbs_FORWARD);
|
||||
TopoDS_Edge aE1 = theE1;
|
||||
aE1.Orientation (TopAbs_FORWARD);
|
||||
TopoDS_Edge aE2 = theE2;
|
||||
aE2.Orientation (TopAbs_FORWARD);
|
||||
//
|
||||
aC2Dold=BRep_Tool::CurveOnSurface(aE2, aF, aT21, aT22);
|
||||
if (aC2Dold.IsNull()){
|
||||
iRet=1;
|
||||
|
@@ -1,4 +1,5 @@
|
||||
// Copyright (c) 2018-2019 OPEN CASCADE SAS
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
@@ -11,16 +12,15 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_DragAction_HeaderFile
|
||||
#define _AIS_DragAction_HeaderFile
|
||||
#ifndef BOPTools_BoxBndTree_HeaderFile
|
||||
#define BOPTools_BoxBndTree_HeaderFile
|
||||
|
||||
//! Dragging action.
|
||||
enum AIS_DragAction
|
||||
{
|
||||
AIS_DragAction_Start, //!< (try) start dragging object
|
||||
AIS_DragAction_Update, //!< perform dragging (update position)
|
||||
AIS_DragAction_Stop, //!< stop dragging (save position)
|
||||
AIS_DragAction_Abort, //!< abort dragging (restore initial position)
|
||||
};
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BOPTools_BoxSelector.hxx>
|
||||
#include <NCollection_EBTree.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
#endif // _AIS_DragAction_HeaderFile
|
||||
typedef NCollection_EBTree<Standard_Integer, Bnd_Box> BOPTools_BoxBndTree;
|
||||
typedef BOPTools_BoxSelector<Bnd_Box> BOPTools_BoxBndTreeSelector;
|
||||
|
||||
#endif
|
@@ -15,27 +15,32 @@
|
||||
#ifndef BOPTools_BoxSelector_HeaderFile
|
||||
#define BOPTools_BoxSelector_HeaderFile
|
||||
|
||||
#include <BVH_Traverse.hxx>
|
||||
#include <BVH_BoxSet.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <NCollection_UBTree.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
//! Template Selector for elements selection from BVH tree.
|
||||
template <int Dimension>
|
||||
class BOPTools_BoxSelector :
|
||||
public BVH_Traverse <Standard_Real, Dimension, BVH_BoxSet <Standard_Real, Dimension, Standard_Integer>, Standard_Boolean>
|
||||
//! Template Selector for the unbalanced binary tree
|
||||
//! of overlapped bounding boxes.
|
||||
template <class BoxType> class BOPTools_BoxSelector :
|
||||
public NCollection_UBTree<Standard_Integer, BoxType>::Selector
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename BVH::VectorType<Standard_Real, Dimension>::Type BVH_VecNd;
|
||||
|
||||
public: //! @name Constructor
|
||||
|
||||
//! Empty constructor
|
||||
BOPTools_BoxSelector() {};
|
||||
|
||||
public: //! @name public interfaces
|
||||
//! Checks if the box should be rejected
|
||||
virtual Standard_Boolean Reject(const BoxType& theOther) const
|
||||
{
|
||||
return myBox.IsOut(theOther);
|
||||
}
|
||||
|
||||
//! Accepts the index
|
||||
virtual Standard_Boolean Accept(const Standard_Integer& theIndex)
|
||||
{
|
||||
myIndices.Append(theIndex);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Clears the indices
|
||||
void Clear()
|
||||
@@ -44,7 +49,7 @@ public: //! @name public interfaces
|
||||
}
|
||||
|
||||
//! Sets the box
|
||||
void SetBox (const BVH_Box <Standard_Real, Dimension>& theBox)
|
||||
void SetBox(const BoxType& theBox)
|
||||
{
|
||||
myBox = theBox;
|
||||
}
|
||||
@@ -55,46 +60,11 @@ public: //! @name public interfaces
|
||||
return myIndices;
|
||||
}
|
||||
|
||||
public: //! @name Rejection/Acceptance rules
|
||||
private:
|
||||
|
||||
//! Checks if the box should be rejected
|
||||
virtual Standard_Boolean RejectNode (const BVH_VecNd& theCMin,
|
||||
const BVH_VecNd& theCMax,
|
||||
Standard_Boolean& theIsInside) const Standard_OVERRIDE
|
||||
{
|
||||
Standard_Boolean hasOverlap;
|
||||
theIsInside = myBox.Contains (theCMin, theCMax, hasOverlap);
|
||||
return !hasOverlap;
|
||||
}
|
||||
BoxType myBox;
|
||||
TColStd_ListOfInteger myIndices;
|
||||
|
||||
//! Checks if the element should be rejected
|
||||
Standard_Boolean RejectElement (const Standard_Integer theIndex)
|
||||
{
|
||||
return myBox.IsOut (this->myBVHSet->Box (theIndex));
|
||||
}
|
||||
|
||||
//! Checks if the metric of the node may be accepted
|
||||
virtual Standard_Boolean AcceptMetric (const Standard_Boolean& theIsInside) const Standard_OVERRIDE
|
||||
{
|
||||
return theIsInside;
|
||||
}
|
||||
|
||||
//! Accepts the element with the index <theIndex> in BVH tree
|
||||
virtual Standard_Boolean Accept (const Standard_Integer theIndex,
|
||||
const Standard_Boolean& theIsInside) Standard_OVERRIDE
|
||||
{
|
||||
if (theIsInside || !RejectElement (theIndex))
|
||||
{
|
||||
myIndices.Append (this->myBVHSet->Element (theIndex));
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
protected: //! @name Fields
|
||||
|
||||
BVH_Box <Standard_Real, Dimension> myBox; //!< Selection box
|
||||
TColStd_ListOfInteger myIndices; //!< Selected indices
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -1,47 +0,0 @@
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef BOPTools_BoxTree_HeaderFile
|
||||
#define BOPTools_BoxTree_HeaderFile
|
||||
|
||||
#include <BVH_BoxSet.hxx>
|
||||
#include <BOPTools_BoxSelector.hxx>
|
||||
#include <BOPTools_PairSelector.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <BVH_LinearBuilder.hxx>
|
||||
|
||||
//! Redefines BoxSet to use the Linear builder by default
|
||||
|
||||
template <class NumType, int Dimension, class DataType>
|
||||
class BOPTools_BoxSet : public BVH_BoxSet <NumType, Dimension, DataType>
|
||||
{
|
||||
public: //! @name Constructors
|
||||
//! Empty constructor for use the default BVH_Builder
|
||||
BOPTools_BoxSet (const opencascade::handle <BVH_Builder <NumType, Dimension> >& theBuilder = NULL)
|
||||
: BVH_BoxSet <NumType, Dimension, DataType> (theBuilder.IsNull() ? new BVH_LinearBuilder<NumType, Dimension>() : theBuilder)
|
||||
{}
|
||||
};
|
||||
|
||||
//! 2D definitions
|
||||
typedef BOPTools_BoxSet <Standard_Real, 2, Standard_Integer> BOPTools_Box2dTree;
|
||||
typedef BOPTools_BoxSelector<2> BOPTools_Box2dTreeSelector;
|
||||
typedef BOPTools_PairSelector<2> BOPTools_Box2dPairSelector;
|
||||
|
||||
//! 3D definitions
|
||||
typedef BOPTools_BoxSet <Standard_Real, 3, Standard_Integer> BOPTools_BoxTree;
|
||||
typedef BOPTools_BoxSelector<3> BOPTools_BoxTreeSelector;
|
||||
typedef BOPTools_PairSelector<3> BOPTools_BoxPairSelector;
|
||||
|
||||
#endif
|
@@ -1,131 +0,0 @@
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef BOPTools_PairSelector_HeaderFile
|
||||
#define BOPTools_PairSelector_HeaderFile
|
||||
|
||||
#include <BVH_Traverse.hxx>
|
||||
#include <BVH_BoxSet.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <algorithm>
|
||||
|
||||
//! Template Selector for selection of the elements from two BVH trees.
|
||||
template <int Dimension>
|
||||
class BOPTools_PairSelector :
|
||||
public BVH_PairTraverse <Standard_Real, Dimension, BVH_BoxSet <Standard_Real, Dimension, Standard_Integer>>
|
||||
{
|
||||
public: //! @name public types
|
||||
|
||||
//! Auxiliary structure to keep the pair of indices
|
||||
struct PairIDs
|
||||
{
|
||||
PairIDs (const Standard_Integer theId1 = -1,
|
||||
const Standard_Integer theId2 = -1)
|
||||
: ID1 (theId1), ID2 (theId2)
|
||||
{}
|
||||
|
||||
Standard_Boolean operator< (const PairIDs& theOther) const
|
||||
{
|
||||
return ID1 < theOther.ID1 ||
|
||||
(ID1 == theOther.ID1 && ID2 < theOther.ID2);
|
||||
}
|
||||
|
||||
Standard_Integer ID1;
|
||||
Standard_Integer ID2;
|
||||
};
|
||||
|
||||
typedef typename BVH::VectorType<Standard_Real, Dimension>::Type BVH_VecNd;
|
||||
|
||||
public: //! @name Constructor
|
||||
|
||||
//! Empty constructor
|
||||
BOPTools_PairSelector()
|
||||
: mySameBVHs (Standard_False)
|
||||
{}
|
||||
|
||||
public: //! @name public interfaces
|
||||
|
||||
//! Clears the indices
|
||||
void Clear()
|
||||
{
|
||||
myPairs.Clear();
|
||||
}
|
||||
|
||||
//! Sorts the indices
|
||||
void Sort()
|
||||
{
|
||||
std::sort (myPairs.begin(), myPairs.end());
|
||||
}
|
||||
|
||||
//! Tells to selector that BVH trees are the same.
|
||||
//! If the flag is set to true the resulting vector will contain
|
||||
//! only unique pairs (mirrored pairs will be rejected,
|
||||
//! e.g. (1, 2) will be taken, (2, 1) will be rejected) and will
|
||||
//! not contain pairs in which IDs are the same (pair (1, 1) will be rejected).
|
||||
//! If it is required to have a full vector of pairs even
|
||||
//! for the same BVH trees, just keep the false value of this flag.
|
||||
void SetSame (const Standard_Boolean theIsSame)
|
||||
{
|
||||
mySameBVHs = theIsSame;
|
||||
}
|
||||
|
||||
//! Returns the list of accepted indices
|
||||
const std::vector<PairIDs>& Pairs() const
|
||||
{
|
||||
return myPairs;
|
||||
}
|
||||
|
||||
public: //! @name Rejection/Acceptance rules
|
||||
|
||||
//! Basing on the bounding boxes of the nodes checks if the pair of nodes should be rejected.
|
||||
virtual Standard_Boolean RejectNode (const BVH_VecNd& theCMin1,
|
||||
const BVH_VecNd& theCMax1,
|
||||
const BVH_VecNd& theCMin2,
|
||||
const BVH_VecNd& theCMax2,
|
||||
Standard_Real&) const Standard_OVERRIDE
|
||||
{
|
||||
return BVH_Box<Standard_Real, 3> (theCMin1, theCMax1).IsOut (theCMin2, theCMax2);
|
||||
}
|
||||
|
||||
//! Checks if the pair of elements should be rejected.
|
||||
Standard_Boolean RejectElement (const Standard_Integer theID1,
|
||||
const Standard_Integer theID2)
|
||||
{
|
||||
return (mySameBVHs && theID1 >= theID2) ||
|
||||
this->myBVHSet1->Box (theID1).IsOut(
|
||||
this->myBVHSet2->Box (theID2));
|
||||
}
|
||||
|
||||
//! Checks and accepts the pair of elements.
|
||||
virtual Standard_Boolean Accept (const Standard_Integer theID1,
|
||||
const Standard_Integer theID2) Standard_OVERRIDE
|
||||
{
|
||||
if (!RejectElement (theID1, theID2))
|
||||
{
|
||||
myPairs.push_back (PairIDs (this->myBVHSet1->Element (theID1),
|
||||
this->myBVHSet2->Element (theID2)));
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
protected: //! @name Fields
|
||||
|
||||
std::vector<PairIDs> myPairs; //!< Selected pairs of indices
|
||||
Standard_Boolean mySameBVHs; //!< Selection is performed from the same BVH trees
|
||||
};
|
||||
|
||||
#endif
|
@@ -8,14 +8,13 @@ BOPTools_AlgoTools3D.hxx
|
||||
BOPTools_AlgoTools_1.cxx
|
||||
BOPTools_AlgoTools_2.cxx
|
||||
BOPTools_BoxSelector.hxx
|
||||
BOPTools_BoxTree.hxx
|
||||
BOPTools_BoxBndTree.hxx
|
||||
BOPTools_ConnexityBlock.hxx
|
||||
BOPTools_CoupleOfShape.hxx
|
||||
BOPTools_IndexedDataMapOfSetShape.hxx
|
||||
BOPTools_ListOfConnexityBlock.hxx
|
||||
BOPTools_ListOfCoupleOfShape.hxx
|
||||
BOPTools_MapOfSet.hxx
|
||||
BOPTools_PairSelector.hxx
|
||||
BOPTools_Parallel.hxx
|
||||
BOPTools_Set.cxx
|
||||
BOPTools_Set.hxx
|
||||
|
@@ -93,8 +93,9 @@ public:
|
||||
//! be ignored at all.
|
||||
//! If theIsShapeToleranceUsed == TRUE then resulting box will be
|
||||
//! extended on the tolerance of the shape.
|
||||
//! theIsOptimal flag defines whether to look for the more tight
|
||||
//! OBB for the cost of performance or not.
|
||||
//! theIsOptimal flag defines the algorithm for construction of initial
|
||||
//! Bnd_Box for the second method (if theIsOptimal == TRUE then
|
||||
//! this box will be created by AddOptimal(...) method).
|
||||
Standard_EXPORT static
|
||||
void AddOBB(const TopoDS_Shape& theS,
|
||||
Bnd_OBB& theOBB,
|
||||
|
@@ -293,7 +293,6 @@ static Standard_Integer IsWCS(const gp_Dir& theDir)
|
||||
//=======================================================================
|
||||
static Standard_Boolean CheckPoints(const TopoDS_Shape& theS,
|
||||
const Standard_Boolean theIsTriangulationUsed,
|
||||
const Standard_Boolean theIsOptimal,
|
||||
const Standard_Boolean theIsShapeToleranceUsed,
|
||||
Bnd_OBB& theOBB)
|
||||
{
|
||||
@@ -330,7 +329,7 @@ static Standard_Boolean CheckPoints(const TopoDS_Shape& theS,
|
||||
}
|
||||
#endif
|
||||
|
||||
theOBB.ReBuild(anArrPnts, aPtrArrTol, theIsOptimal);
|
||||
theOBB.ReBuild(anArrPnts, aPtrArrTol);
|
||||
|
||||
return (!theOBB.IsVoid());
|
||||
}
|
||||
@@ -499,7 +498,7 @@ void BRepBndLib::AddOBB(const TopoDS_Shape& theS,
|
||||
const Standard_Boolean theIsOptimal,
|
||||
const Standard_Boolean theIsShapeToleranceUsed)
|
||||
{
|
||||
if (CheckPoints(theS, theIsTriangulationUsed, theIsOptimal, theIsShapeToleranceUsed, theOBB))
|
||||
if(CheckPoints(theS, theIsTriangulationUsed, theIsShapeToleranceUsed, theOBB))
|
||||
return;
|
||||
|
||||
ComputePCA(theS, theOBB, theIsTriangulationUsed, theIsOptimal, theIsShapeToleranceUsed);
|
||||
|
@@ -97,7 +97,7 @@ void BRepClass_FaceClassifier::Perform(const TopoDS_Face& aF,
|
||||
aMaxDist=RealLast();
|
||||
aIndice=0;
|
||||
//
|
||||
BRepAdaptor_Surface aSurf(aF, Standard_False);
|
||||
BRepAdaptor_Surface aSurf(aF);
|
||||
BRepTools::UVBounds(aF, aU1, aU2, aV1, aV2);
|
||||
aExtrema.Initialize(aSurf, aU1, aU2, aV1, aV2, aTol, aTol);
|
||||
//
|
||||
@@ -128,3 +128,10 @@ void BRepClass_FaceClassifier::Perform(const TopoDS_Face& aF,
|
||||
Perform(aF, aPuv, aTol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -40,61 +40,45 @@ static const Standard_Real Probing_Step = 0.2111;
|
||||
BRepClass_FaceExplorer::BRepClass_FaceExplorer(const TopoDS_Face& F) :
|
||||
myFace(F),
|
||||
myCurEdgeInd(1),
|
||||
myCurEdgePar(Probing_Start),
|
||||
myUMin (Precision::Infinite()),
|
||||
myUMax (-Precision::Infinite()),
|
||||
myVMin (Precision::Infinite()),
|
||||
myVMax (-Precision::Infinite())
|
||||
myCurEdgePar(Probing_Start)
|
||||
{
|
||||
myFace.Orientation(TopAbs_FORWARD);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeFaceBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepClass_FaceExplorer::ComputeFaceBounds()
|
||||
{
|
||||
TopLoc_Location aLocation;
|
||||
const Handle(Geom_Surface)& aSurface = BRep_Tool::Surface (myFace, aLocation);
|
||||
aSurface->Bounds (myUMin, myUMax, myVMin, myVMax);
|
||||
if (Precision::IsInfinite (myUMin) || Precision::IsInfinite (myUMax) ||
|
||||
Precision::IsInfinite (myVMin) || Precision::IsInfinite (myVMax))
|
||||
{
|
||||
BRepTools::UVBounds(myFace, myUMin, myUMax, myVMin, myVMax);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepClass_FaceExplorer::CheckPoint(gp_Pnt2d& thePoint)
|
||||
Standard_Boolean BRepClass_FaceExplorer::CheckPoint(gp_Pnt2d& thePoint)
|
||||
{
|
||||
if (myUMin > myUMax)
|
||||
Standard_Real anUMin = 0.0, anUMax = 0.0, aVMin = 0.0, aVMax = 0.0;
|
||||
TopLoc_Location aLocation;
|
||||
const Handle(Geom_Surface)& aSurface = BRep_Tool::Surface(myFace, aLocation);
|
||||
aSurface->Bounds(anUMin, anUMax, aVMin, aVMax);
|
||||
if (Precision::IsInfinite(anUMin) || Precision::IsInfinite(anUMax) ||
|
||||
Precision::IsInfinite(aVMin) || Precision::IsInfinite(aVMax))
|
||||
{
|
||||
ComputeFaceBounds();
|
||||
BRepTools::UVBounds(myFace, anUMin, anUMax, aVMin, aVMax);
|
||||
if (Precision::IsInfinite(anUMin) || Precision::IsInfinite(anUMax) ||
|
||||
Precision::IsInfinite(aVMin) || Precision::IsInfinite(aVMax))
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
if (Precision::IsInfinite(myUMin) || Precision::IsInfinite(myUMax) ||
|
||||
Precision::IsInfinite(myVMin) || Precision::IsInfinite(myVMax))
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
gp_Pnt2d aCenterPnt(( myUMin + myUMax ) / 2, ( myVMin + myVMax ) / 2);
|
||||
gp_Pnt2d aCenterPnt(( anUMin + anUMax ) / 2, ( aVMin + aVMax ) / 2);
|
||||
Standard_Real aDistance = aCenterPnt.Distance(thePoint);
|
||||
if (Precision::IsInfinite(aDistance))
|
||||
{
|
||||
thePoint.SetCoord (myUMin - (myUMax - myUMin ),
|
||||
myVMin - (myVMax - myVMin ));
|
||||
thePoint.SetCoord(anUMin - ( anUMax - anUMin ),
|
||||
aVMin - ( aVMax - aVMin ));
|
||||
return Standard_False;
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real anEpsilon = Epsilon(aDistance);
|
||||
if (anEpsilon > Max (myUMax - myUMin, myVMax - myVMin))
|
||||
if (anEpsilon > Max(anUMax - anUMin, aVMax - aVMin))
|
||||
{
|
||||
gp_Vec2d aLinVec(aCenterPnt, thePoint);
|
||||
gp_Dir2d aLinDir(aLinVec);
|
||||
|
@@ -99,8 +99,8 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
//! Computes UV bounds of a face
|
||||
Standard_EXPORT void ComputeFaceBounds();
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
@@ -113,10 +113,7 @@ private:
|
||||
Standard_Integer myCurEdgeInd;
|
||||
Standard_Real myCurEdgePar;
|
||||
|
||||
Standard_Real myUMin;
|
||||
Standard_Real myUMax;
|
||||
Standard_Real myVMin;
|
||||
Standard_Real myVMax;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@@ -37,7 +37,7 @@
|
||||
|
||||
static
|
||||
void RefineTolerance(const TopoDS_Face& aF,
|
||||
const Geom2dAdaptor_Curve& aC,
|
||||
const BRepAdaptor_Curve2d& aC,
|
||||
const Standard_Real aT,
|
||||
Standard_Real& aTolZ);
|
||||
|
||||
@@ -72,7 +72,7 @@ void BRepClass_Intersector::Perform(const gp_Lin2d& L,
|
||||
return;
|
||||
}
|
||||
//
|
||||
Geom2dAdaptor_Curve C(aC2D, deb, fin);
|
||||
BRepAdaptor_Curve2d C(EE, F);
|
||||
//
|
||||
deb = C.FirstParameter();
|
||||
fin = C.LastParameter();
|
||||
@@ -185,7 +185,7 @@ void BRepClass_Intersector::LocalGeometry(const BRepClass_Edge& E,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RefineTolerance(const TopoDS_Face& aF,
|
||||
const Geom2dAdaptor_Curve& aC,
|
||||
const BRepAdaptor_Curve2d& aC,
|
||||
const Standard_Real aT,
|
||||
Standard_Real& aTolZ)
|
||||
{
|
||||
|
@@ -22,8 +22,7 @@
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepExtrema_OverlapTool::BRepExtrema_OverlapTool()
|
||||
: myFilter (NULL),
|
||||
myTolerance (0.0)
|
||||
: myFilter (NULL)
|
||||
{
|
||||
myIsDone = Standard_False;
|
||||
}
|
||||
@@ -34,8 +33,7 @@ BRepExtrema_OverlapTool::BRepExtrema_OverlapTool()
|
||||
//=======================================================================
|
||||
BRepExtrema_OverlapTool::BRepExtrema_OverlapTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2)
|
||||
: myFilter (NULL),
|
||||
myTolerance (0.0)
|
||||
: myFilter (NULL)
|
||||
{
|
||||
LoadTriangleSets (theSet1, theSet2);
|
||||
}
|
||||
@@ -59,6 +57,21 @@ void BRepExtrema_OverlapTool::LoadTriangleSets (const Handle(BRepExtrema_Triangl
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Tool class to describe stack item in traverse function.
|
||||
struct BRepExtrema_StackItem
|
||||
{
|
||||
Standard_Integer Node1;
|
||||
Standard_Integer Node2;
|
||||
|
||||
BRepExtrema_StackItem (const Standard_Integer theNode1 = 0,
|
||||
const Standard_Integer theNode2 = 0)
|
||||
: Node1 (theNode1),
|
||||
Node2 (theNode2)
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
||||
|
||||
//! Bounding triangular prism for specified triangle.
|
||||
class BRepExtrema_BoundingPrism
|
||||
{
|
||||
@@ -504,163 +517,175 @@ namespace
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : intersectTrianglesExact
|
||||
//function : intersectTriangleRangesExact
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepExtrema_OverlapTool::intersectTrianglesExact (const Standard_Integer theTrgIdx1,
|
||||
const Standard_Integer theTrgIdx2)
|
||||
void BRepExtrema_OverlapTool::intersectTriangleRangesExact (const BVH_Vec4i& theLeaf1,
|
||||
const BVH_Vec4i& theLeaf2)
|
||||
{
|
||||
const Standard_Integer aFaceIdx1 = mySet1->GetFaceID (theTrgIdx1);
|
||||
|
||||
BVH_Vec3d aTrg1Vert1;
|
||||
BVH_Vec3d aTrg1Vert2;
|
||||
BVH_Vec3d aTrg1Vert3;
|
||||
|
||||
mySet1->GetVertices (theTrgIdx1,
|
||||
aTrg1Vert1,
|
||||
aTrg1Vert2,
|
||||
aTrg1Vert3);
|
||||
|
||||
const Standard_Boolean aIsInSet = myOverlapSubShapes1.IsBound (aFaceIdx1);
|
||||
|
||||
const Standard_Integer aFaceIdx2 = mySet2->GetFaceID (theTrgIdx2);
|
||||
|
||||
if (aIsInSet && myOverlapSubShapes1.Find (aFaceIdx1).Contains (aFaceIdx2))
|
||||
for (Standard_Integer aTrgIdx1 = theLeaf1.y(); aTrgIdx1 <= theLeaf1.z(); ++aTrgIdx1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const Standard_Integer aFaceIdx1 = mySet1->GetFaceID (aTrgIdx1);
|
||||
|
||||
BRepExtrema_ElementFilter::FilterResult aResult = myFilter == NULL ?
|
||||
BRepExtrema_ElementFilter::DoCheck : myFilter->PreCheckElements (theTrgIdx1, theTrgIdx2);
|
||||
BVH_Vec3d aTrg1Vert1;
|
||||
BVH_Vec3d aTrg1Vert2;
|
||||
BVH_Vec3d aTrg1Vert3;
|
||||
|
||||
if (aResult == BRepExtrema_ElementFilter::Overlap)
|
||||
{
|
||||
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
|
||||
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
|
||||
mySet1->GetVertices (aTrgIdx1,
|
||||
aTrg1Vert1,
|
||||
aTrg1Vert2,
|
||||
aTrg1Vert3);
|
||||
|
||||
const Standard_Boolean aIsInSet = myOverlapSubShapes1.IsBound (aFaceIdx1);
|
||||
|
||||
for (Standard_Integer aTrgIdx2 = theLeaf2.y(); aTrgIdx2 <= theLeaf2.z(); ++aTrgIdx2)
|
||||
{
|
||||
const Standard_Integer aFaceIdx2 = mySet2->GetFaceID (aTrgIdx2);
|
||||
|
||||
if (aIsInSet && myOverlapSubShapes1.Find (aFaceIdx1).Contains (aFaceIdx2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
BRepExtrema_ElementFilter::FilterResult aResult = myFilter == NULL ?
|
||||
BRepExtrema_ElementFilter::DoCheck : myFilter->PreCheckElements (aTrgIdx1, aTrgIdx2);
|
||||
|
||||
if (aResult == BRepExtrema_ElementFilter::Overlap)
|
||||
{
|
||||
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
|
||||
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
|
||||
|
||||
#ifdef OVERLAP_TOOL_OUTPUT_TRIANGLES
|
||||
if (mySet1 == mySet2)
|
||||
{
|
||||
myOverlapTriangles1.Add (theTrgIdx1);
|
||||
myOverlapTriangles1.Add (theTrgIdx2);
|
||||
}
|
||||
else
|
||||
{
|
||||
myOverlapTriangles1.Add (theTrgIdx1);
|
||||
myOverlapTriangles2.Add (theTrgIdx2);
|
||||
}
|
||||
if (mySet1 == mySet2)
|
||||
{
|
||||
myOverlapTriangles1.Add (aTrgIdx1);
|
||||
myOverlapTriangles1.Add (aTrgIdx2);
|
||||
}
|
||||
else
|
||||
{
|
||||
myOverlapTriangles1.Add (aTrgIdx1);
|
||||
myOverlapTriangles2.Add (aTrgIdx2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (aResult == BRepExtrema_ElementFilter::DoCheck)
|
||||
{
|
||||
BVH_Vec3d aTrg2Vert1;
|
||||
BVH_Vec3d aTrg2Vert2;
|
||||
BVH_Vec3d aTrg2Vert3;
|
||||
}
|
||||
else if (aResult == BRepExtrema_ElementFilter::DoCheck)
|
||||
{
|
||||
BVH_Vec3d aTrg2Vert1;
|
||||
BVH_Vec3d aTrg2Vert2;
|
||||
BVH_Vec3d aTrg2Vert3;
|
||||
|
||||
mySet2->GetVertices (theTrgIdx2, aTrg2Vert1, aTrg2Vert2, aTrg2Vert3);
|
||||
mySet2->GetVertices (aTrgIdx2, aTrg2Vert1, aTrg2Vert2, aTrg2Vert3);
|
||||
|
||||
if (trianglesIntersected (aTrg1Vert1,
|
||||
aTrg1Vert2,
|
||||
aTrg1Vert3,
|
||||
aTrg2Vert1,
|
||||
aTrg2Vert2,
|
||||
aTrg2Vert3))
|
||||
{
|
||||
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
|
||||
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
|
||||
if (trianglesIntersected (aTrg1Vert1,
|
||||
aTrg1Vert2,
|
||||
aTrg1Vert3,
|
||||
aTrg2Vert1,
|
||||
aTrg2Vert2,
|
||||
aTrg2Vert3))
|
||||
{
|
||||
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
|
||||
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
|
||||
|
||||
#ifdef OVERLAP_TOOL_OUTPUT_TRIANGLES
|
||||
if (mySet1 == mySet2)
|
||||
{
|
||||
myOverlapTriangles1.Add (theTrgIdx1);
|
||||
myOverlapTriangles1.Add (theTrgIdx2);
|
||||
}
|
||||
else
|
||||
{
|
||||
myOverlapTriangles1.Add (theTrgIdx1);
|
||||
myOverlapTriangles2.Add (theTrgIdx2);
|
||||
}
|
||||
if (mySet1 == mySet2)
|
||||
{
|
||||
myOverlapTriangles1.Add (aTrgIdx1);
|
||||
myOverlapTriangles1.Add (aTrgIdx2);
|
||||
}
|
||||
else
|
||||
{
|
||||
myOverlapTriangles1.Add (aTrgIdx1);
|
||||
myOverlapTriangles2.Add (aTrgIdx2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : intersectTrianglesToler
|
||||
//function : intersectTriangleRangesToler
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepExtrema_OverlapTool::intersectTrianglesToler (const Standard_Integer theTrgIdx1,
|
||||
const Standard_Integer theTrgIdx2,
|
||||
const Standard_Real theToler)
|
||||
void BRepExtrema_OverlapTool::intersectTriangleRangesToler (const BVH_Vec4i& theLeaf1,
|
||||
const BVH_Vec4i& theLeaf2,
|
||||
const Standard_Real theToler)
|
||||
{
|
||||
const Standard_Integer aFaceIdx1 = mySet1->GetFaceID (theTrgIdx1);
|
||||
|
||||
BVH_Vec3d aTrg1Vert1;
|
||||
BVH_Vec3d aTrg1Vert2;
|
||||
BVH_Vec3d aTrg1Vert3;
|
||||
|
||||
mySet1->GetVertices (theTrgIdx1,
|
||||
aTrg1Vert1,
|
||||
aTrg1Vert2,
|
||||
aTrg1Vert3);
|
||||
|
||||
BRepExtrema_BoundingPrism aPrism1; // not initialized
|
||||
|
||||
const Standard_Boolean aIsInSet = myOverlapSubShapes1.IsBound (aFaceIdx1);
|
||||
|
||||
const Standard_Integer aFaceIdx2 = mySet2->GetFaceID (theTrgIdx2);
|
||||
|
||||
if (aIsInSet && myOverlapSubShapes1.Find (aFaceIdx1).Contains (aFaceIdx2))
|
||||
for (Standard_Integer aTrgIdx1 = theLeaf1.y(); aTrgIdx1 <= theLeaf1.z(); ++aTrgIdx1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const Standard_Integer aFaceIdx1 = mySet1->GetFaceID (aTrgIdx1);
|
||||
|
||||
BRepExtrema_ElementFilter::FilterResult aResult = myFilter == NULL ?
|
||||
BRepExtrema_ElementFilter::DoCheck : myFilter->PreCheckElements (theTrgIdx1, theTrgIdx2);
|
||||
BVH_Vec3d aTrg1Vert1;
|
||||
BVH_Vec3d aTrg1Vert2;
|
||||
BVH_Vec3d aTrg1Vert3;
|
||||
|
||||
if (aResult == BRepExtrema_ElementFilter::Overlap)
|
||||
{
|
||||
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
|
||||
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
|
||||
mySet1->GetVertices (aTrgIdx1,
|
||||
aTrg1Vert1,
|
||||
aTrg1Vert2,
|
||||
aTrg1Vert3);
|
||||
|
||||
BRepExtrema_BoundingPrism aPrism1; // not initialized
|
||||
|
||||
const Standard_Boolean aIsInSet = myOverlapSubShapes1.IsBound (aFaceIdx1);
|
||||
|
||||
for (Standard_Integer aTrgIdx2 = theLeaf2.y(); aTrgIdx2 <= theLeaf2.z(); ++aTrgIdx2)
|
||||
{
|
||||
const Standard_Integer aFaceIdx2 = mySet2->GetFaceID (aTrgIdx2);
|
||||
|
||||
if (aIsInSet && myOverlapSubShapes1.Find (aFaceIdx1).Contains (aFaceIdx2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
BRepExtrema_ElementFilter::FilterResult aResult = myFilter == NULL ?
|
||||
BRepExtrema_ElementFilter::DoCheck : myFilter->PreCheckElements (aTrgIdx1, aTrgIdx2);
|
||||
|
||||
if (aResult == BRepExtrema_ElementFilter::Overlap)
|
||||
{
|
||||
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
|
||||
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
|
||||
|
||||
#ifdef OVERLAP_TOOL_OUTPUT_TRIANGLES
|
||||
if (mySet1 == mySet2)
|
||||
{
|
||||
myOverlapTriangles1.Add (theTrgIdx1);
|
||||
myOverlapTriangles1.Add (theTrgIdx2);
|
||||
}
|
||||
else
|
||||
{
|
||||
myOverlapTriangles1.Add (theTrgIdx1);
|
||||
myOverlapTriangles2.Add (theTrgIdx2);
|
||||
}
|
||||
if (mySet1 == mySet2)
|
||||
{
|
||||
myOverlapTriangles1.Add (aTrgIdx1);
|
||||
myOverlapTriangles1.Add (aTrgIdx2);
|
||||
}
|
||||
else
|
||||
{
|
||||
myOverlapTriangles1.Add (aTrgIdx1);
|
||||
myOverlapTriangles2.Add (aTrgIdx2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (aResult == BRepExtrema_ElementFilter::DoCheck)
|
||||
{
|
||||
if (!aPrism1.IsInited)
|
||||
{
|
||||
aPrism1.Init (aTrg1Vert1, aTrg1Vert2, aTrg1Vert3, theToler);
|
||||
}
|
||||
}
|
||||
else if (aResult == BRepExtrema_ElementFilter::DoCheck)
|
||||
{
|
||||
if (!aPrism1.IsInited)
|
||||
{
|
||||
aPrism1.Init (aTrg1Vert1, aTrg1Vert2, aTrg1Vert3, theToler);
|
||||
}
|
||||
|
||||
BVH_Vec3d aTrg2Vert1;
|
||||
BVH_Vec3d aTrg2Vert2;
|
||||
BVH_Vec3d aTrg2Vert3;
|
||||
BVH_Vec3d aTrg2Vert1;
|
||||
BVH_Vec3d aTrg2Vert2;
|
||||
BVH_Vec3d aTrg2Vert3;
|
||||
|
||||
mySet2->GetVertices (theTrgIdx2,
|
||||
aTrg2Vert1,
|
||||
aTrg2Vert2,
|
||||
aTrg2Vert3);
|
||||
mySet2->GetVertices (aTrgIdx2,
|
||||
aTrg2Vert1,
|
||||
aTrg2Vert2,
|
||||
aTrg2Vert3);
|
||||
|
||||
BRepExtrema_BoundingPrism aPrism2 (aTrg2Vert1,
|
||||
aTrg2Vert2,
|
||||
aTrg2Vert3,
|
||||
theToler);
|
||||
BRepExtrema_BoundingPrism aPrism2 (aTrg2Vert1,
|
||||
aTrg2Vert2,
|
||||
aTrg2Vert3,
|
||||
theToler);
|
||||
|
||||
if (prismsIntersected (aPrism1, aPrism2))
|
||||
{
|
||||
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
|
||||
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
|
||||
if (prismsIntersected (aPrism1, aPrism2))
|
||||
{
|
||||
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
|
||||
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -671,38 +696,136 @@ void BRepExtrema_OverlapTool::intersectTrianglesToler (const Standard_Integer th
|
||||
//=======================================================================
|
||||
void BRepExtrema_OverlapTool::Perform (const Standard_Real theTolerance)
|
||||
{
|
||||
myTolerance = theTolerance;
|
||||
|
||||
myIsDone = (this->Select(mySet1->BVH(), mySet2->BVH()) > 0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Branch rejection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_OverlapTool::RejectNode (const BVH_Vec3d& theCornerMin1,
|
||||
const BVH_Vec3d& theCornerMax1,
|
||||
const BVH_Vec3d& theCornerMin2,
|
||||
const BVH_Vec3d& theCornerMax2,
|
||||
Standard_Real&) const
|
||||
{
|
||||
return !overlapBoxes (theCornerMin1, theCornerMax1, theCornerMin2, theCornerMax2, myTolerance);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Leaf acceptance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_OverlapTool::Accept (const Standard_Integer theTrgIdx1,
|
||||
const Standard_Integer theTrgIdx2)
|
||||
{
|
||||
if (myTolerance == 0.0)
|
||||
if (mySet1.IsNull() || mySet2.IsNull())
|
||||
{
|
||||
intersectTrianglesExact (theTrgIdx1, theTrgIdx2);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
BRepExtrema_StackItem aStack[96];
|
||||
|
||||
const opencascade::handle<BVH_Tree<Standard_Real, 3> >& aBVH1 = mySet1->BVH();
|
||||
const opencascade::handle<BVH_Tree<Standard_Real, 3> >& aBVH2 = mySet2->BVH();
|
||||
|
||||
if (aBVH1.IsNull() || aBVH2.IsNull())
|
||||
{
|
||||
intersectTrianglesToler (theTrgIdx1, theTrgIdx2, myTolerance);
|
||||
return;
|
||||
}
|
||||
return Standard_True;
|
||||
|
||||
BRepExtrema_StackItem aNodes; // current pair of nodes
|
||||
|
||||
Standard_Integer aHead = -1; // stack head position
|
||||
|
||||
for (;;)
|
||||
{
|
||||
BVH_Vec4i aNodeData1 = aBVH1->NodeInfoBuffer()[aNodes.Node1];
|
||||
BVH_Vec4i aNodeData2 = aBVH2->NodeInfoBuffer()[aNodes.Node2];
|
||||
|
||||
if (aNodeData1.x() != 0 && aNodeData2.x() != 0) // leaves
|
||||
{
|
||||
if (theTolerance == 0.0)
|
||||
{
|
||||
intersectTriangleRangesExact (aNodeData1, aNodeData2);
|
||||
}
|
||||
else
|
||||
{
|
||||
intersectTriangleRangesToler (aNodeData1, aNodeData2, theTolerance);
|
||||
}
|
||||
|
||||
if (aHead < 0)
|
||||
break;
|
||||
|
||||
aNodes = aStack[aHead--];
|
||||
}
|
||||
else
|
||||
{
|
||||
BRepExtrema_StackItem aPairsToProcess[4];
|
||||
|
||||
Standard_Integer aNbPairs = 0;
|
||||
|
||||
if (aNodeData1.x() == 0) // inner node
|
||||
{
|
||||
const BVH_Vec3d& aMinPntLft1 = aBVH1->MinPoint (aNodeData1.y());
|
||||
const BVH_Vec3d& aMaxPntLft1 = aBVH1->MaxPoint (aNodeData1.y());
|
||||
const BVH_Vec3d& aMinPntRgh1 = aBVH1->MinPoint (aNodeData1.z());
|
||||
const BVH_Vec3d& aMaxPntRgh1 = aBVH1->MaxPoint (aNodeData1.z());
|
||||
|
||||
if (aNodeData2.x() == 0) // inner node
|
||||
{
|
||||
const BVH_Vec3d& aMinPntLft2 = aBVH2->MinPoint (aNodeData2.y());
|
||||
const BVH_Vec3d& aMaxPntLft2 = aBVH2->MaxPoint (aNodeData2.y());
|
||||
const BVH_Vec3d& aMinPntRgh2 = aBVH2->MinPoint (aNodeData2.z());
|
||||
const BVH_Vec3d& aMaxPntRgh2 = aBVH2->MaxPoint (aNodeData2.z());
|
||||
|
||||
if (overlapBoxes (aMinPntLft1, aMaxPntLft1, aMinPntLft2, aMaxPntLft2, theTolerance))
|
||||
{
|
||||
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodeData1.y(), aNodeData2.y());
|
||||
}
|
||||
if (overlapBoxes (aMinPntLft1, aMaxPntLft1, aMinPntRgh2, aMaxPntRgh2, theTolerance))
|
||||
{
|
||||
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodeData1.y(), aNodeData2.z());
|
||||
}
|
||||
if (overlapBoxes (aMinPntRgh1, aMaxPntRgh1, aMinPntLft2, aMaxPntLft2, theTolerance))
|
||||
{
|
||||
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodeData1.z(), aNodeData2.y());
|
||||
}
|
||||
if (overlapBoxes (aMinPntRgh1, aMaxPntRgh1, aMinPntRgh2, aMaxPntRgh2, theTolerance))
|
||||
{
|
||||
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodeData1.z(), aNodeData2.z());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const BVH_Vec3d& aMinPntLeaf = aBVH2->MinPoint (aNodes.Node2);
|
||||
const BVH_Vec3d& aMaxPntLeaf = aBVH2->MaxPoint (aNodes.Node2);
|
||||
|
||||
if (overlapBoxes (aMinPntLft1, aMaxPntLft1, aMinPntLeaf, aMaxPntLeaf, theTolerance))
|
||||
{
|
||||
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodeData1.y(), aNodes.Node2);
|
||||
}
|
||||
if (overlapBoxes (aMinPntRgh1, aMaxPntRgh1, aMinPntLeaf, aMaxPntLeaf, theTolerance))
|
||||
{
|
||||
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodeData1.z(), aNodes.Node2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const BVH_Vec3d& aMinPntLeaf = aBVH1->MinPoint (aNodes.Node1);
|
||||
const BVH_Vec3d& aMaxPntLeaf = aBVH1->MaxPoint (aNodes.Node1);
|
||||
|
||||
const BVH_Vec3d& aMinPntLft2 = aBVH2->MinPoint (aNodeData2.y());
|
||||
const BVH_Vec3d& aMaxPntLft2 = aBVH2->MaxPoint (aNodeData2.y());
|
||||
const BVH_Vec3d& aMinPntRgh2 = aBVH2->MinPoint (aNodeData2.z());
|
||||
const BVH_Vec3d& aMaxPntRgh2 = aBVH2->MaxPoint (aNodeData2.z());
|
||||
|
||||
if (overlapBoxes (aMinPntLft2, aMaxPntLft2, aMinPntLeaf, aMaxPntLeaf, theTolerance))
|
||||
{
|
||||
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodes.Node1, aNodeData2.y());
|
||||
}
|
||||
if (overlapBoxes (aMinPntRgh2, aMaxPntRgh2, aMinPntLeaf, aMaxPntLeaf, theTolerance))
|
||||
{
|
||||
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodes.Node1, aNodeData2.z());
|
||||
}
|
||||
}
|
||||
|
||||
if (aNbPairs > 0)
|
||||
{
|
||||
aNodes = aPairsToProcess[0];
|
||||
|
||||
for (Standard_Integer anIdx = 1; anIdx < aNbPairs; ++anIdx)
|
||||
{
|
||||
aStack[++aHead] = aPairsToProcess[anIdx];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aHead < 0)
|
||||
break;
|
||||
|
||||
aNodes = aStack[aHead--];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myIsDone = Standard_True;
|
||||
}
|
||||
|
@@ -16,10 +16,10 @@
|
||||
#ifndef _BRepExtrema_OverlapTool_HeaderFile
|
||||
#define _BRepExtrema_OverlapTool_HeaderFile
|
||||
|
||||
#include <BVH_Geometry.hxx>
|
||||
#include <BRepExtrema_TriangleSet.hxx>
|
||||
#include <BRepExtrema_ElementFilter.hxx>
|
||||
#include <BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx>
|
||||
#include <BVH_Traverse.hxx>
|
||||
|
||||
//! Enables storing of individual overlapped triangles (useful for debug).
|
||||
// #define OVERLAP_TOOL_OUTPUT_TRIANGLES
|
||||
@@ -35,7 +35,7 @@
|
||||
//! In second case, tessellation of single shape will be tested for self-
|
||||
//! intersections. Please note that algorithm results are approximate and
|
||||
//! depend greatly on the quality of input tessellation(s).
|
||||
class BRepExtrema_OverlapTool : public BVH_PairTraverse <Standard_Real, 3>
|
||||
class BRepExtrema_OverlapTool
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -78,30 +78,16 @@ public:
|
||||
//! Sets filtering tool for preliminary checking pairs of mesh elements.
|
||||
void SetElementFilter (BRepExtrema_ElementFilter* theFilter) { myFilter = theFilter; }
|
||||
|
||||
|
||||
public: //! @name Reject/Accept implementations
|
||||
|
||||
//! Defines the rules for node rejection by bounding box
|
||||
Standard_EXPORT virtual Standard_Boolean RejectNode (const BVH_Vec3d& theCornerMin1,
|
||||
const BVH_Vec3d& theCornerMax1,
|
||||
const BVH_Vec3d& theCornerMin2,
|
||||
const BVH_Vec3d& theCornerMax2,
|
||||
Standard_Real&) const Standard_OVERRIDE;
|
||||
//! Defines the rules for leaf acceptance
|
||||
Standard_EXPORT virtual Standard_Boolean Accept (const Standard_Integer theLeaf1,
|
||||
const Standard_Integer theLeaf2) Standard_OVERRIDE;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
//! Performs narrow-phase of overlap test (exact intersection).
|
||||
void intersectTrianglesExact (const Standard_Integer theTrgIdx1,
|
||||
const Standard_Integer theTrgIdx2);
|
||||
void intersectTriangleRangesExact (const BVH_Vec4i& theLeaf1,
|
||||
const BVH_Vec4i& theLeaf2);
|
||||
|
||||
//! Performs narrow-phase of overlap test (intersection with non-zero tolerance).
|
||||
void intersectTrianglesToler (const Standard_Integer theTrgIdx1,
|
||||
const Standard_Integer theTrgIdx2,
|
||||
const Standard_Real theToler);
|
||||
void intersectTriangleRangesToler (const BVH_Vec4i& theLeaf1,
|
||||
const BVH_Vec4i& theLeaf2,
|
||||
const Standard_Real theToler);
|
||||
|
||||
private:
|
||||
|
||||
@@ -127,8 +113,6 @@ private:
|
||||
|
||||
//! Is overlap test test completed?
|
||||
Standard_Boolean myIsDone;
|
||||
|
||||
Standard_Real myTolerance;
|
||||
};
|
||||
|
||||
#endif // _BRepExtrema_OverlapTool_HeaderFile
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#ifndef _BRepExtrema_ShapeProximity_HeaderFile
|
||||
#define _BRepExtrema_ShapeProximity_HeaderFile
|
||||
|
||||
#include <BVH_Geometry.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <TColStd_PackedMapOfInteger.hxx>
|
||||
|
||||
|
@@ -1437,13 +1437,16 @@ Standard_Boolean CheckAndOrientEdges(const TopTools_ListOfShape& theOrderedList
|
||||
gp_Pnt2d ap = aCurve->Value(f);
|
||||
Standard_Boolean bFirstFound = Standard_False;
|
||||
Standard_Boolean bLastFound = Standard_False;
|
||||
Standard_Boolean bforward = Standard_True;
|
||||
|
||||
if(ap.Distance(theFirstPoint) < aTolerance1) {
|
||||
bforward = Standard_True;
|
||||
if(theOrientedList.IsEmpty())
|
||||
theOrientedList.Append(aEPrev.Oriented(TopAbs_FORWARD));
|
||||
bFirstFound = Standard_True;
|
||||
}
|
||||
else if(ap.Distance(theLastPoint) < aTolerance1) {
|
||||
bforward = Standard_False;
|
||||
if(theOrientedList.IsEmpty())
|
||||
theOrientedList.Append(aEPrev.Oriented(TopAbs_REVERSED));
|
||||
bLastFound = Standard_True;
|
||||
@@ -1451,31 +1454,36 @@ Standard_Boolean CheckAndOrientEdges(const TopTools_ListOfShape& theOrderedList
|
||||
ap = aCurve->Value(l);
|
||||
|
||||
if(ap.Distance(theLastPoint) < aTolerance2) {
|
||||
bforward = Standard_True;
|
||||
|
||||
if(theOrientedList.IsEmpty())
|
||||
theOrientedList.Append(aEPrev.Oriented(TopAbs_FORWARD));
|
||||
bLastFound = Standard_True;
|
||||
}
|
||||
else if(ap.Distance(theFirstPoint) < aTolerance2) {
|
||||
bforward = Standard_False;
|
||||
|
||||
if(theOrientedList.IsEmpty())
|
||||
theOrientedList.Append(aEPrev.Oriented(TopAbs_REVERSED));
|
||||
bFirstFound = Standard_True;
|
||||
}
|
||||
|
||||
if (!theOrientedList.IsEmpty())
|
||||
aEPrev = TopoDS::Edge (theOrientedList.Last());
|
||||
|
||||
for(; anIt.More(); anIt.Next()) {
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(anIt.Value());
|
||||
TopoDS_Vertex aV11, aV12;
|
||||
TopExp::Vertices(aEPrev, aV11, aV12, Standard_True);
|
||||
TopExp::Vertices(aEPrev, aV11, aV12);
|
||||
TopoDS_Vertex aV21, aV22;
|
||||
TopExp::Vertices(aE, aV21, aV22, Standard_False);
|
||||
TopExp::Vertices(aE, aV21, aV22);
|
||||
TopAbs_Orientation anOri = TopAbs_FORWARD;
|
||||
|
||||
TopAbs_Orientation anOri =
|
||||
(aV12.IsSame (aV21) || aV11.IsSame (aV22)) ? TopAbs_FORWARD : TopAbs_REVERSED;
|
||||
if(aV12.IsSame(aV21) || aV11.IsSame(aV22)) {
|
||||
anOri = (bforward) ? TopAbs_FORWARD : TopAbs_REVERSED;
|
||||
}
|
||||
else {
|
||||
anOri = (bforward) ? TopAbs_REVERSED : TopAbs_FORWARD;
|
||||
}
|
||||
theOrientedList.Append(aE.Oriented(anOri));
|
||||
aEPrev = TopoDS::Edge (theOrientedList.Last());
|
||||
|
||||
aEPrev = aE;
|
||||
aTolerance1 = (aV21.IsNull()) ? Precision::Confusion() : BRep_Tool::Tolerance(aV21);
|
||||
aTolerance2 = (aV22.IsNull()) ? Precision::Confusion() : BRep_Tool::Tolerance(aV22);
|
||||
utol = aBAS.UResolution(aTolerance1);
|
||||
@@ -1503,7 +1511,9 @@ Standard_Boolean CheckAndOrientEdges(const TopTools_ListOfShape& theOrderedList
|
||||
}
|
||||
}
|
||||
|
||||
return bFirstFound && bLastFound;
|
||||
if(!bFirstFound || !bLastFound)
|
||||
return Standard_False;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
|
@@ -55,8 +55,6 @@ static Standard_Boolean findNearestValidPoint(
|
||||
//
|
||||
// the general step is computed using general curve resolution
|
||||
Standard_Real aStep = theCurve.Resolution(theTol) * 1.01;
|
||||
if (aStep < theEps)
|
||||
aStep = theEps;
|
||||
// aD1Mag is a threshold to consider local derivative magnitude too small
|
||||
// and to accelerate going out of sphere
|
||||
// (inverse of resolution is the maximal derivative);
|
||||
@@ -161,19 +159,11 @@ Standard_Boolean BRepLib::FindValidRange
|
||||
if (theParV2 - theParV1 < Precision::PConfusion())
|
||||
return Standard_False;
|
||||
|
||||
Standard_Boolean isInfParV1 = Precision::IsInfinite (theParV1),
|
||||
isInfParV2 = Precision::IsInfinite (theParV2);
|
||||
Standard_Real anEps = Max(Max(theCurve.Resolution(theTolE) * 0.1,
|
||||
Epsilon(Max(Abs(theParV1), Abs(theParV2)))),
|
||||
Precision::PConfusion());
|
||||
|
||||
Standard_Real aMaxPar = 0.0;
|
||||
if (!isInfParV1)
|
||||
aMaxPar = Abs (theParV1);
|
||||
if (!isInfParV2)
|
||||
aMaxPar = Max (aMaxPar, Abs (theParV2));
|
||||
|
||||
Standard_Real anEps = Max (Max (theCurve.Resolution (theTolE) * 0.1, Epsilon (aMaxPar)),
|
||||
Precision::PConfusion());
|
||||
|
||||
if (isInfParV1)
|
||||
if (Precision::IsInfinite(theParV1))
|
||||
theFirst = theParV1;
|
||||
else
|
||||
{
|
||||
@@ -184,7 +174,7 @@ Standard_Boolean BRepLib::FindValidRange
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if (isInfParV2)
|
||||
if (Precision::IsInfinite(theParV2))
|
||||
theLast = theParV2;
|
||||
else
|
||||
{
|
||||
|
@@ -65,7 +65,7 @@ void BRepMesh_BaseMeshAlgo::Perform(
|
||||
commitSurfaceTriangulation();
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure const& /*theExeption*/)
|
||||
catch (Standard_Failure& /*theExeption*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -83,12 +83,6 @@ public:
|
||||
myFaceMax = theMax;
|
||||
}
|
||||
|
||||
//! Retruns true if cell filter contains no circle.
|
||||
inline Standard_Boolean IsEmpty () const
|
||||
{
|
||||
return mySelector.Circles ().IsEmpty ();
|
||||
}
|
||||
|
||||
//! Binds the circle to the tool.
|
||||
//! @param theIndex index a circle should be bound with.
|
||||
//! @param theCircle circle to be bound.
|
||||
|
@@ -1,60 +0,0 @@
|
||||
// Created on: 2019-07-08
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// 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 _BRepMesh_ConstrainedBaseMeshAlgo_HeaderFile
|
||||
#define _BRepMesh_ConstrainedBaseMeshAlgo_HeaderFile
|
||||
|
||||
#include <BRepMesh_BaseMeshAlgo.hxx>
|
||||
#include <NCollection_Shared.hxx>
|
||||
#include <IMeshTools_Parameters.hxx>
|
||||
|
||||
class BRepMesh_DataStructureOfDelaun;
|
||||
class BRepMesh_Delaun;
|
||||
|
||||
//! Class provides base fuctionality to build face triangulation using Dealunay approach.
|
||||
//! Performs generation of mesh using raw data from model.
|
||||
class BRepMesh_ConstrainedBaseMeshAlgo : public BRepMesh_BaseMeshAlgo
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
BRepMesh_ConstrainedBaseMeshAlgo ()
|
||||
{
|
||||
}
|
||||
|
||||
//! Destructor.
|
||||
virtual ~BRepMesh_ConstrainedBaseMeshAlgo ()
|
||||
{
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ConstrainedBaseMeshAlgo, BRepMesh_BaseMeshAlgo)
|
||||
|
||||
protected:
|
||||
|
||||
//! Returns size of cell to be used by acceleration circles grid structure.
|
||||
virtual std::pair<Standard_Integer, Standard_Integer> getCellsCount (const Standard_Integer /*theVerticesNb*/)
|
||||
{
|
||||
return std::pair<Standard_Integer, Standard_Integer> (-1, -1);
|
||||
}
|
||||
|
||||
//! Perfroms processing of generated mesh.
|
||||
//! By default does nothing.
|
||||
//! Expected to be called from method generateMesh() in successor classes.
|
||||
virtual void postProcessMesh (BRepMesh_Delaun& /*theMesher*/)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
@@ -26,7 +26,6 @@
|
||||
#include <Adaptor3d_HCurveOnSurface.hxx>
|
||||
#include <Adaptor2d_HCurve2d.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
@@ -80,28 +79,21 @@ void BRepMesh_CurveTessellator::init()
|
||||
aPreciseLinDef *= 0.5;
|
||||
}
|
||||
|
||||
aPreciseLinDef = Max (aPreciseLinDef, Precision::Confusion());
|
||||
aPreciseAngDef = Max (aPreciseAngDef, Precision::Angular());
|
||||
|
||||
Standard_Real aMinSize = myParameters.MinSize;
|
||||
if (myParameters.AdjustMinSize)
|
||||
{
|
||||
aMinSize = Min (aMinSize, myParameters.RelMinSize() * GCPnts_AbscissaPoint::Length (
|
||||
myCurve, myCurve.FirstParameter(), myCurve.LastParameter(), aPreciseLinDef));
|
||||
}
|
||||
aPreciseLinDef = Max(aPreciseLinDef, Precision::Confusion());
|
||||
aPreciseAngDef = Max(aPreciseAngDef, Precision::Angular());
|
||||
|
||||
mySquareEdgeDef = aPreciseLinDef * aPreciseLinDef;
|
||||
mySquareMinSize = Max (mySquareEdgeDef, aMinSize * aMinSize);
|
||||
mySquareMinSize = Max(mySquareEdgeDef, myParameters.MinSize * myParameters.MinSize);
|
||||
|
||||
myEdgeSqTol = BRep_Tool::Tolerance (myEdge);
|
||||
myEdgeSqTol = BRep_Tool::Tolerance(myEdge);
|
||||
myEdgeSqTol *= myEdgeSqTol;
|
||||
|
||||
const Standard_Integer aMinPntNb = (myCurve.GetType() == GeomAbs_Circle) ? 4 : 2; //OCC287
|
||||
|
||||
myDiscretTool.Initialize (myCurve,
|
||||
myCurve.FirstParameter(), myCurve.LastParameter(),
|
||||
aPreciseAngDef, aPreciseLinDef, aMinPntNb,
|
||||
Precision::PConfusion(), aMinSize);
|
||||
myDiscretTool.Initialize(myCurve,
|
||||
myCurve.FirstParameter(), myCurve.LastParameter(),
|
||||
aPreciseAngDef, aPreciseLinDef, aMinPntNb,
|
||||
Precision::PConfusion(), myParameters.MinSize);
|
||||
|
||||
if (myCurve.IsCurveOnSurface())
|
||||
{
|
||||
|
@@ -1,70 +0,0 @@
|
||||
// Created on: 2019-06-07
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// 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 _BRepMesh_CustomBaseMeshAlgo_HeaderFile
|
||||
#define _BRepMesh_CustomBaseMeshAlgo_HeaderFile
|
||||
|
||||
#include <BRepMesh_ConstrainedBaseMeshAlgo.hxx>
|
||||
#include <NCollection_Shared.hxx>
|
||||
#include <IMeshTools_Parameters.hxx>
|
||||
|
||||
#include <BRepMesh_Delaun.hxx>
|
||||
#include <BRepMesh_MeshTool.hxx>
|
||||
|
||||
class BRepMesh_DataStructureOfDelaun;
|
||||
|
||||
//! Class provides base fuctionality to build face triangulation using custom triangulation algorithm.
|
||||
//! Performs generation of mesh using raw data from model.
|
||||
class BRepMesh_CustomBaseMeshAlgo : public BRepMesh_ConstrainedBaseMeshAlgo
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT BRepMesh_CustomBaseMeshAlgo ()
|
||||
{
|
||||
}
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_CustomBaseMeshAlgo ()
|
||||
{
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_CustomBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
|
||||
|
||||
protected:
|
||||
|
||||
//! Generates mesh for the contour stored in data structure.
|
||||
Standard_EXPORT virtual void generateMesh () Standard_OVERRIDE
|
||||
{
|
||||
const Handle (BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure ();
|
||||
buildBaseTriangulation ();
|
||||
|
||||
std::pair<Standard_Integer, Standard_Integer> aCellsCount = this->getCellsCount (aStructure->NbNodes ());
|
||||
BRepMesh_Delaun aMesher (aStructure, aCellsCount.first, aCellsCount.second, Standard_False);
|
||||
aMesher.ProcessConstraints ();
|
||||
|
||||
BRepMesh_MeshTool aCleaner (aStructure);
|
||||
aCleaner.EraseFreeLinks ();
|
||||
|
||||
postProcessMesh (aMesher);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//! Builds base triangulation using custom triangulation algorithm.
|
||||
Standard_EXPORT virtual void buildBaseTriangulation() = 0;
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,53 +0,0 @@
|
||||
// Created on: 2019-06-07
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// 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 _BRepMesh_CustomDelaunayBaseMeshAlgo_HeaderFile
|
||||
#define _BRepMesh_CustomDelaunayBaseMeshAlgo_HeaderFile
|
||||
|
||||
class BRepMesh_DataStructureOfDelaun;
|
||||
class BRepMesh_Delaun;
|
||||
|
||||
//! Class provides base fuctionality to build face triangulation using custom
|
||||
//! triangulation algorithm with possibility to modify final mesh.
|
||||
//! Performs generation of mesh using raw data from model.
|
||||
template<class BaseAlgo>
|
||||
class BRepMesh_CustomDelaunayBaseMeshAlgo : public BaseAlgo
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
BRepMesh_CustomDelaunayBaseMeshAlgo ()
|
||||
{
|
||||
}
|
||||
|
||||
//! Destructor.
|
||||
virtual ~BRepMesh_CustomDelaunayBaseMeshAlgo ()
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//! Perfroms processing of generated mesh.
|
||||
virtual void postProcessMesh(BRepMesh_Delaun& theMesher)
|
||||
{
|
||||
BaseAlgo::postProcessMesh (theMesher);
|
||||
|
||||
const Handle(BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure();
|
||||
std::pair<Standard_Integer, Standard_Integer> aCellsCount = this->getCellsCount (aStructure->NbNodes());
|
||||
theMesher.InitCirclesTool (aCellsCount.first, aCellsCount.second);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
@@ -78,25 +78,6 @@ namespace {
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_Delaun
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_Delaun::BRepMesh_Delaun (
|
||||
const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
|
||||
const Standard_Integer theCellsCountU,
|
||||
const Standard_Integer theCellsCountV,
|
||||
const Standard_Boolean isFillCircles)
|
||||
: myMeshData ( theOldMesh ),
|
||||
myCircles (new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
{
|
||||
if (isFillCircles)
|
||||
{
|
||||
InitCirclesTool (theCellsCountU, theCellsCountV);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_Delaun
|
||||
//purpose : Creates the triangulation with an empty Mesh data structure
|
||||
@@ -122,8 +103,7 @@ BRepMesh_Delaun::BRepMesh_Delaun(
|
||||
const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
|
||||
IMeshData::Array1OfVertexOfDelaun& theVertices)
|
||||
: myMeshData( theOldMesh ),
|
||||
myCircles ( theVertices.Length(), new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
myCircles ( theVertices.Length(), theOldMesh->Allocator() )
|
||||
{
|
||||
if ( theVertices.Length() > 2 )
|
||||
{
|
||||
@@ -139,8 +119,7 @@ BRepMesh_Delaun::BRepMesh_Delaun(
|
||||
const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
|
||||
IMeshData::VectorOfInteger& theVertexIndices)
|
||||
: myMeshData( theOldMesh ),
|
||||
myCircles ( theVertexIndices.Length(), new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
myCircles ( theVertexIndices.Length(), theOldMesh->Allocator() )
|
||||
{
|
||||
perform(theVertexIndices);
|
||||
}
|
||||
@@ -154,8 +133,7 @@ BRepMesh_Delaun::BRepMesh_Delaun (const Handle (BRepMesh_DataStructureOfDelaun)&
|
||||
const Standard_Integer theCellsCountU,
|
||||
const Standard_Integer theCellsCountV)
|
||||
: myMeshData (theOldMesh),
|
||||
myCircles (theVertexIndices.Length (), new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
myCircles (theVertexIndices.Length (), theOldMesh->Allocator ())
|
||||
{
|
||||
perform (theVertexIndices, theCellsCountU, theCellsCountV);
|
||||
}
|
||||
@@ -179,63 +157,6 @@ void BRepMesh_Delaun::Init(IMeshData::Array1OfVertexOfDelaun& theVertices)
|
||||
perform( aVertexIndexes );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitCirclesTool
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::InitCirclesTool (const Standard_Integer theCellsCountU,
|
||||
const Standard_Integer theCellsCountV)
|
||||
{
|
||||
Bnd_Box2d aBox;
|
||||
for (Standard_Integer aNodeIt = 1; aNodeIt <= myMeshData->NbNodes(); ++aNodeIt)
|
||||
{
|
||||
aBox.Add (gp_Pnt2d (GetVertex (aNodeIt).Coord ()));
|
||||
}
|
||||
aBox.Enlarge (Precision);
|
||||
|
||||
initCirclesTool (aBox, theCellsCountU, theCellsCountV);
|
||||
|
||||
IMeshData::IteratorOfMapOfInteger aTriangleIt (myMeshData->ElementsOfDomain());
|
||||
for (; aTriangleIt.More(); aTriangleIt.Next())
|
||||
{
|
||||
Standard_Integer aNodesIndices[3];
|
||||
const BRepMesh_Triangle& aTriangle = myMeshData->GetElement (aTriangleIt.Key());
|
||||
myMeshData->ElementNodes (aTriangle, aNodesIndices);
|
||||
myCircles.Bind (aTriangleIt.Key(),
|
||||
GetVertex( aNodesIndices[0] ).Coord(),
|
||||
GetVertex( aNodesIndices[1] ).Coord(),
|
||||
GetVertex( aNodesIndices[2] ).Coord());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : initCirclesTool
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::initCirclesTool (const Bnd_Box2d& theBox,
|
||||
const Standard_Integer theCellsCountU,
|
||||
const Standard_Integer theCellsCountV)
|
||||
{
|
||||
Standard_Real aMinX, aMinY, aMaxX, aMaxY;
|
||||
theBox.Get ( aMinX, aMinY, aMaxX, aMaxY );
|
||||
const Standard_Real aDeltaX = aMaxX - aMinX;
|
||||
const Standard_Real aDeltaY = aMaxY - aMinY;
|
||||
|
||||
Standard_Integer aScaler = 2;
|
||||
if ( myMeshData->NbNodes() > 100 )
|
||||
{
|
||||
aScaler = 5;
|
||||
}
|
||||
else if( myMeshData->NbNodes() > 1000 )
|
||||
{
|
||||
aScaler = 7;
|
||||
}
|
||||
|
||||
myCircles.SetMinMaxSize( gp_XY( aMinX, aMinY ), gp_XY( aMaxX, aMaxY ) );
|
||||
myCircles.SetCellSize ( aDeltaX / Max (theCellsCountU, aScaler),
|
||||
aDeltaY / Max (theCellsCountV, aScaler));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : perform
|
||||
//purpose : Create super mesh and run triangulation procedure
|
||||
@@ -259,8 +180,18 @@ void BRepMesh_Delaun::perform(IMeshData::VectorOfInteger& theVertexIndices,
|
||||
|
||||
aBox.Enlarge (Precision);
|
||||
|
||||
initCirclesTool (aBox, theCellsCountU, theCellsCountV);
|
||||
superMesh (aBox);
|
||||
Standard_Integer aScaler = 2;
|
||||
if ( myMeshData->NbNodes() > 100 )
|
||||
{
|
||||
aScaler = 5;
|
||||
}
|
||||
else if( myMeshData->NbNodes() > 1000 )
|
||||
{
|
||||
aScaler = 7;
|
||||
}
|
||||
|
||||
superMesh (aBox, Max (theCellsCountU, aScaler),
|
||||
Max (theCellsCountV, aScaler));
|
||||
|
||||
ComparatorOfIndexedVertexOfDelaun aCmp(myMeshData);
|
||||
std::make_heap(theVertexIndices.begin(), theVertexIndices.end(), aCmp);
|
||||
@@ -273,7 +204,9 @@ void BRepMesh_Delaun::perform(IMeshData::VectorOfInteger& theVertexIndices,
|
||||
//function : superMesh
|
||||
//purpose : Build the super mesh
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
|
||||
void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox,
|
||||
const Standard_Integer theCellsCountU,
|
||||
const Standard_Integer theCellsCountV)
|
||||
{
|
||||
Standard_Real aMinX, aMinY, aMaxX, aMaxY;
|
||||
theBox.Get ( aMinX, aMinY, aMaxX, aMaxY );
|
||||
@@ -284,6 +217,9 @@ void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
|
||||
Standard_Real aDeltaMax = Max( aDeltaX, aDeltaY );
|
||||
Standard_Real aDelta = aDeltaX + aDeltaY;
|
||||
|
||||
myCircles.SetMinMaxSize( gp_XY( aMinX, aMinY ), gp_XY( aMaxX, aMaxY ) );
|
||||
myCircles.SetCellSize( aDeltaX / theCellsCountU, aDeltaY / theCellsCountV);
|
||||
|
||||
mySupVert[0] = myMeshData->AddNode(
|
||||
BRepMesh_Vertex( ( aMinX + aMaxX ) / 2, aMaxY + aDeltaMax, BRepMesh_Free ) );
|
||||
|
||||
@@ -318,10 +254,7 @@ void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
|
||||
void BRepMesh_Delaun::deleteTriangle(const Standard_Integer theIndex,
|
||||
IMeshData::MapOfIntegerInteger& theLoopEdges )
|
||||
{
|
||||
if (!myCircles.IsEmpty())
|
||||
{
|
||||
myCircles.Delete (theIndex);
|
||||
}
|
||||
myCircles.Delete( theIndex );
|
||||
|
||||
const BRepMesh_Triangle& aElement = GetTriangle(theIndex);
|
||||
const Standard_Integer(&e)[3] = aElement.myEdges;
|
||||
@@ -346,11 +279,8 @@ void BRepMesh_Delaun::deleteTriangle(const Standard_Integer theIndex,
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes)
|
||||
{
|
||||
// Insertion of edges of super triangles in the list of free edges:
|
||||
Handle(NCollection_IncAllocator) aAllocator = new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE);
|
||||
|
||||
IMeshData::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
// Insertion of edges of super triangles in the list of free edges:
|
||||
IMeshData::MapOfIntegerInteger aLoopEdges(10, myMeshData->Allocator());
|
||||
const Standard_Integer(&e)[3] = mySupTrian.myEdges;
|
||||
|
||||
aLoopEdges.Bind( e[0], Standard_True );
|
||||
@@ -601,7 +531,10 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
}
|
||||
}
|
||||
|
||||
ProcessConstraints();
|
||||
insertInternalEdges();
|
||||
|
||||
// Adjustment of meshes to boundary edges
|
||||
frontierAdjust();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -41,12 +41,6 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Creates instance of triangulator, but do not run the algorithm automatically.
|
||||
Standard_EXPORT BRepMesh_Delaun (const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
|
||||
const Standard_Integer theCellsCountU,
|
||||
const Standard_Integer theCellsCountV,
|
||||
const Standard_Boolean isFillCircles);
|
||||
|
||||
//! Creates the triangulation with an empty Mesh data structure.
|
||||
Standard_EXPORT BRepMesh_Delaun (IMeshData::Array1OfVertexOfDelaun& theVertices);
|
||||
|
||||
@@ -67,10 +61,6 @@ public:
|
||||
//! Initializes the triangulation with an array of vertices.
|
||||
Standard_EXPORT void Init (IMeshData::Array1OfVertexOfDelaun& theVertices);
|
||||
|
||||
//! Forces initialization of circles cell filter using working structure.
|
||||
Standard_EXPORT void InitCirclesTool (const Standard_Integer theCellsCountU,
|
||||
const Standard_Integer theCellsCountV);
|
||||
|
||||
//! Removes a vertex from the triangulation.
|
||||
Standard_EXPORT void RemoveVertex (const BRepMesh_Vertex& theVertex);
|
||||
|
||||
@@ -87,15 +77,6 @@ public:
|
||||
return myMeshData;
|
||||
}
|
||||
|
||||
//! Forces insertion of constraint edges into the base triangulation.
|
||||
inline void ProcessConstraints()
|
||||
{
|
||||
insertInternalEdges();
|
||||
|
||||
// Adjustment of meshes to boundary edges
|
||||
frontierAdjust();
|
||||
}
|
||||
|
||||
//! Gives the list of frontier edges.
|
||||
inline Handle(IMeshData::MapOfInteger) Frontier() const
|
||||
{
|
||||
@@ -158,11 +139,6 @@ private:
|
||||
|
||||
typedef NCollection_DataMap<Standard_Integer, IMeshData::MapOfInteger> DataMapOfMap;
|
||||
|
||||
//! Performs initialization of circles cell filter tool.
|
||||
void initCirclesTool (const Bnd_Box2d& theBox,
|
||||
const Standard_Integer theCellsCountU,
|
||||
const Standard_Integer theCellsCountV);
|
||||
|
||||
//! Add boundig box for edge defined by start & end point to
|
||||
//! the given vector of bounding boxes for triangulation edges.
|
||||
void fillBndBox (IMeshData::SequenceOfBndB2d& theBoxes,
|
||||
@@ -180,7 +156,9 @@ private:
|
||||
const Standard_Integer theCellsCountV = -1);
|
||||
|
||||
//! Build the super mesh.
|
||||
void superMesh (const Bnd_Box2d& theBox);
|
||||
void superMesh (const Bnd_Box2d& theBox,
|
||||
const Standard_Integer theCellsCountU,
|
||||
const Standard_Integer theCellsCountV);
|
||||
|
||||
//! Computes the triangulation and adds the vertices,
|
||||
//! edges and triangles to the Mesh data structure.
|
||||
|
@@ -16,7 +16,7 @@
|
||||
#ifndef _BRepMesh_DelaunayBaseMeshAlgo_HeaderFile
|
||||
#define _BRepMesh_DelaunayBaseMeshAlgo_HeaderFile
|
||||
|
||||
#include <BRepMesh_ConstrainedBaseMeshAlgo.hxx>
|
||||
#include <BRepMesh_BaseMeshAlgo.hxx>
|
||||
#include <NCollection_Shared.hxx>
|
||||
#include <IMeshTools_Parameters.hxx>
|
||||
|
||||
@@ -25,7 +25,7 @@ class BRepMesh_Delaun;
|
||||
|
||||
//! Class provides base fuctionality to build face triangulation using Dealunay approach.
|
||||
//! Performs generation of mesh using raw data from model.
|
||||
class BRepMesh_DelaunayBaseMeshAlgo : public BRepMesh_ConstrainedBaseMeshAlgo
|
||||
class BRepMesh_DelaunayBaseMeshAlgo : public BRepMesh_BaseMeshAlgo
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -35,12 +35,24 @@ public:
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_DelaunayBaseMeshAlgo();
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_DelaunayBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_DelaunayBaseMeshAlgo, BRepMesh_BaseMeshAlgo)
|
||||
|
||||
protected:
|
||||
|
||||
//! Returns size of cell to be used by acceleration circles grid structure.
|
||||
virtual std::pair<Standard_Integer, Standard_Integer> getCellsCount (const Standard_Integer /*theVerticesNb*/)
|
||||
{
|
||||
return std::pair<Standard_Integer, Standard_Integer> (-1, -1);
|
||||
}
|
||||
|
||||
//! Generates mesh for the contour stored in data structure.
|
||||
Standard_EXPORT virtual void generateMesh() Standard_OVERRIDE;
|
||||
|
||||
//! Perfroms processing of generated mesh.
|
||||
//! By default does nothing.
|
||||
virtual void postProcessMesh(BRepMesh_Delaun& /*theMesher*/)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user