1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
kgv
704bb74d93 0031482: OpenGl_LayerList::renderLayer() - keep shadowmap from global list 2021-03-22 10:20:07 +03:00
2740 changed files with 18756 additions and 20403 deletions

View File

@@ -364,25 +364,12 @@ if (MSVC)
endif()
# whether use optional 3rdparty or not
set (USE_TK ON CACHE BOOL "${USE_TK_DESCR}")
set (USE_FREETYPE ON CACHE BOOL "${USE_FREETYPE_DESCR}")
set (USE_FREEIMAGE OFF CACHE BOOL "${USE_FREEIMAGE_DESCR}")
set (USE_FFMPEG OFF CACHE BOOL "${USE_FFMPEG_DESCR}")
set (USE_OPENVR OFF CACHE BOOL "${USE_OPENVR_DESCR}")
set (USE_RAPIDJSON OFF CACHE BOOL "${USE_RAPIDJSON_DESCR}")
set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}")
set (USE_EIGEN OFF CACHE BOOL "${USE_EIGEN_DESCR}")
if (APPLE)
set (USE_GLX OFF CACHE BOOL "${USE_GLX_DESCR}")
else()
set (USE_GLX OFF)
endif()
if (WIN32)
set (USE_D3D OFF CACHE BOOL "${USE_D3D_DESCR}")
else()
set (USE_D3D OFF)
endif()
# Enable/Disable the floating point exceptions (FPE) during runtime.
@@ -396,15 +383,6 @@ else()
set (BUILD_ENABLE_FPE_SIGNAL_HANDLER 0)
endif()
# OpenGL
if (ANDROID OR IOS OR EMSCRIPTEN OR "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
set (USE_OPENGL OFF)
set (USE_GLES2 ON)
else()
set (USE_OPENGL ON CACHE BOOL "${USE_OPENGL_DESCR}")
set (USE_GLES2 OFF CACHE BOOL "${USE_GLES2_DESCR}")
endif()
# include the patched or original list of modules
# list <MODULENAME>_TOOLKITS is created foreach module and contains its toolkits
# list <OCCT_MODULES> will contain all modules
@@ -436,6 +414,10 @@ if (NOT DEFINED BUILD_DOC_Overview)
set (BUILD_DOC_Overview ${CAN_DOXYGEN_BE_USED} CACHE BOOL "${BUILD_DOC_Overview_DESCR}")
endif()
if (NOT USE_D3D)
list (REMOVE_ITEM Visualization_TOOLKITS TKD3DHost)
endif()
# accumulate used toolkits (first level) in BUILD_TOOLKITS variable
list (APPEND BUILD_TOOLKITS ${BUILD_ADDITIONAL_TOOLKITS})
@@ -502,56 +484,35 @@ endif()
# search for CSF variable in EXTERNLIB of each being used toolkit
OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGE)
OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
OCCT_IS_PRODUCT_REQUIRED (CSF_TclTkLibs CAN_USE_TK)
OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE CAN_USE_FREETYPE)
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlLibs CAN_USE_OPENGL)
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlesLibs CAN_USE_GLES2)
OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE USE_FREETYPE)
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlLibs CAN_USE_GLES2)
OCCT_IS_PRODUCT_REQUIRED (CSF_TBB CAN_USE_TBB)
OCCT_IS_PRODUCT_REQUIRED (CSF_EIGEN CAN_USE_EIGEN)
# define CSF variable
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
# Tcl (mandatory for Draw Harness)
if (USE_TCL)
message (STATUS "Info: TCL is used by OCCT")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl")
message (STATUS "Info: TK is used by OCCT")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tk")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL")
OCCT_CHECK_AND_UNSET ("INSTALL_TCL")
endif()
# Tk (optional for Draw Harness)
if (CAN_USE_TK)
if (USE_TK)
message (STATUS "Info: TK is used by OCCT")
add_definitions (-DHAVE_TK)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tk")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK")
OCCT_CHECK_AND_UNSET ("INSTALL_TK")
endif()
else()
OCCT_CHECK_AND_UNSET ("USE_TK")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK")
OCCT_CHECK_AND_UNSET ("INSTALL_TCL")
OCCT_CHECK_AND_UNSET ("INSTALL_TK")
endif()
# FreeType
if (CAN_USE_FREETYPE)
if (USE_FREETYPE)
message (STATUS "Info: FreeType is used by OCCT")
add_definitions (-DHAVE_FREETYPE)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE")
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2")
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build")
OCCT_CHECK_AND_UNSET ("INSTALL_FREETYPE")
endif()
if (USE_FREETYPE)
message (STATUS "Info: Freetype is used by OCCT")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype")
else()
OCCT_CHECK_AND_UNSET ("USE_FREETYPE")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE")
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2")
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build")
OCCT_CHECK_AND_UNSET ("INSTALL_FREETYPE")
endif()
@@ -571,6 +532,14 @@ else()
endif()
endif()
# D3D
if (USE_D3D)
add_definitions (-DHAVE_D3D)
#if(MSVC_VERSION LESS 1700)
#OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/d3d")
#endif()
endif()
# GLX
if (USE_GLX)
add_definitions (-DMACOSX_USE_GLX)
@@ -578,7 +547,10 @@ if (USE_GLX)
endif()
# FREEIMAGE
if (CAN_USE_FREEIMAGE)
set (USE_FREEIMAGE OFF CACHE BOOL "${USE_FREEIMAGE_DESCR}")
if (USE_FREEIMAGE)
add_definitions (-DHAVE_FREEIMAGE)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage")
@@ -597,6 +569,8 @@ endif()
# search for CSF_OpenVR variable in EXTERNLIB of each being used toolkit
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenVR CAN_USE_OPENVR)
if (CAN_USE_OPENVR)
set (USE_OPENVR OFF CACHE BOOL "${USE_OPENVR_DESCR}")
if (USE_OPENVR)
add_definitions (-DHAVE_OPENVR)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/openvr")
@@ -616,6 +590,8 @@ endif()
OCCT_IS_PRODUCT_REQUIRED (CSF_FFmpeg CAN_USE_FFMPEG)
if (CAN_USE_FFMPEG)
set (USE_FFMPEG OFF CACHE BOOL "${USE_FFMPEG_DESCR}")
if (USE_FFMPEG)
add_definitions (-DHAVE_FFMPEG)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/ffmpeg")
@@ -630,31 +606,23 @@ else()
OCCT_CHECK_AND_UNSET ("INSTALL_FFMPEG")
endif()
# OpenGL
if (CAN_USE_OPENGL)
if (USE_OPENGL)
add_definitions (-DHAVE_OPENGL_EXT)
else()
list (REMOVE_ITEM BUILD_TOOLKITS TKOpenGl)
list (REMOVE_ITEM BUILD_TOOLKITS TKOpenGlTest)
endif()
else()
OCCT_CHECK_AND_UNSET ("USE_OPENGL")
endif()
# OpenGL ES 2.0
if (CAN_USE_GLES2)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
set (USE_GLES2 ON)
else()
set (USE_GLES2 OFF CACHE BOOL "${USE_GLES2_DESCR}")
endif()
if (USE_GLES2)
add_definitions (-DHAVE_GLES2_EXT)
add_definitions (-DHAVE_GLES2)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2")
OCCT_CHECK_AND_UNSET ("INSTALL_EGL")
OCCT_CHECK_AND_UNSET ("INSTALL_GLES2")
list (REMOVE_ITEM BUILD_TOOLKITS TKOpenGles)
list (REMOVE_ITEM BUILD_TOOLKITS TKOpenGlesTest)
endif()
else()
OCCT_CHECK_AND_UNSET ("USE_GLES2")
@@ -665,19 +633,10 @@ else()
OCCT_CHECK_AND_UNSET ("INSTALL_GLES2")
endif()
# D3D
if (USE_D3D)
add_definitions (-DHAVE_D3D)
#if(MSVC_VERSION LESS 1700)
#OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/d3d")
#endif()
else()
list (REMOVE_ITEM BUILD_TOOLKITS TKD3DHost)
list (REMOVE_ITEM BUILD_TOOLKITS TKD3DHostTest)
endif()
# TBB
if (NOT DEFINED ANDROID AND CAN_USE_TBB)
set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}")
if (USE_TBB)
add_definitions (-DHAVE_TBB)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb")
@@ -698,6 +657,8 @@ endif()
# 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")
@@ -714,6 +675,8 @@ endif()
# EIGEN
if (CAN_USE_EIGEN)
set (USE_EIGEN OFF CACHE BOOL "${USE_EIGEN_DESCR}")
if (USE_EIGEN)
add_definitions (-DHAVE_EIGEN)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/eigen")
@@ -1176,9 +1139,6 @@ foreach (OCCT_TOOLKIT ${BUILD_TOOLKITS})
endforeach()
list (REMOVE_DUPLICATES OCCT_MODULES_ENABLED)
list (REMOVE_DUPLICATES OCCT_COMPILE_DEFINITIONS)
# these macros are defined for specific tookits, not globalwise
list (REMOVE_ITEM OCCT_COMPILE_DEFINITIONS HAVE_OPENGL)
list (REMOVE_ITEM OCCT_COMPILE_DEFINITIONS HAVE_GLES2)
# export compile definitions and C/C++ flags for each configuration to OpenCASCADE config files
foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})

View File

@@ -1,7 +1,7 @@
FoundationClasses TKernel TKMath
ModelingData TKG2d TKG3d TKGeomBase TKBRep
ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
Visualization TKService TKV3d TKOpenGl TKOpenGles TKMeshVS TKIVtk TKD3DHost
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
Draw TKDraw TKTopTest TKOpenGlTest TKOpenGlesTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
Draw TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE

View File

@@ -207,7 +207,6 @@ n Image
n Media
n MeshVS
n OpenGl
n OpenGles
n D3DHost
n Prs3d
n PrsMgr
@@ -225,7 +224,6 @@ r Shaders
r XRResources
t TKMeshVS
t TKOpenGl
t TKOpenGles
t TKD3DHost
t TKService
t TKV3d
@@ -404,9 +402,6 @@ n HLRTest
n MeshTest
n SWDRAW
n TObjDRAW
n OpenGlTest
n OpenGlesTest
n D3DHostTest
n ViewerTest
n XDEDRAW
n XSDRAW
@@ -418,9 +413,6 @@ t TKDCAF
t TKDraw
t TKTObjDRAW
t TKTopTest
t TKOpenGlTest
t TKOpenGlesTest
t TKD3DHostTest
t TKViewerTest
t TKXDEDRAW
t TKXSDRAW

View File

@@ -1,3 +1,3 @@
# EGL
THIRDPARTY_PRODUCT("EGL" "EGL/egl.h" "CSF_OpenGlesLibs" "")
THIRDPARTY_PRODUCT("EGL" "EGL/egl.h" "CSF_OpenGlLibs" "")

View File

@@ -1,3 +1,3 @@
# OpenGL ES 2.0
THIRDPARTY_PRODUCT("GLES2" "GLES2/gl2.h" "CSF_OpenGlesLibs" "")
THIRDPARTY_PRODUCT("GLES2" "GLES2/gl2.h" "CSF_OpenGlLibs" "")

View File

@@ -49,28 +49,18 @@ else()
set (CSF_OpenVR)
endif()
# TCL
# TCL/TK
if (USE_TCL)
if (WIN32)
set (CSF_TclLibs "tcl86")
else()
if(APPLE)
set (CSF_TclLibs Tcl)
elseif(UNIX)
set (CSF_TclLibs "tcl8.6")
endif()
endif()
endif()
# TK
if (USE_TK)
if (WIN32)
set (CSF_TclTkLibs "tk86")
else()
if(APPLE)
set (CSF_TclTkLibs Tk)
set (CSF_TclLibs Tcl)
elseif(UNIX)
set (CSF_TclTkLibs "tk8.6")
set (CSF_TclLibs "tcl8.6")
set (CSF_TclTkLibs "tk8.6")
endif()
endif()
endif()
@@ -84,8 +74,12 @@ if (WIN32)
set (CSF_psapi "psapi.lib")
set (CSF_winmm "winmm.lib")
set (CSF_d3d9 "D3D9.lib")
set (CSF_OpenGlLibs "opengl32.lib")
set (CSF_OpenGlesLibs "libEGL libGLESv2")
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" OR USE_GLES2)
set (CSF_OpenGlLibs "libEGL libGLESv2")
else()
set (CSF_OpenGlLibs "opengl32.lib")
endif()
else()
if (APPLE)
@@ -106,9 +100,9 @@ else()
OCCT_CHECK_AND_UNSET (IOKit_LIB)
if (IOS)
find_library (OpenGlesLibs_LIB NAMES OpenGLES)
set (CSF_OpenGlesLibs ${OpenGlesLibs_LIB})
OCCT_CHECK_AND_UNSET (OpenGlesLibs_LIB)
find_library (OpenGlLibs_LIB NAMES OpenGLES)
set (CSF_OpenGlLibs ${OpenGlLibs_LIB})
OCCT_CHECK_AND_UNSET (OpenGlLibs_LIB)
elseif (USE_GLX)
set (CSF_OpenGlLibs GL)
set (CSF_XwLibs "X11 Xext Xmu Xi")
@@ -117,19 +111,20 @@ else()
set (CSF_OpenGlLibs ${OpenGlLibs_LIB})
OCCT_CHECK_AND_UNSET (OpenGlLibs_LIB)
endif()
elseif (ANDROID)
set (CSF_ThreadLibs "c")
set (CSF_OpenGlesLibs "EGL GLESv2")
set (CSF_OpenGlLibs "EGL GLESv2")
set (CSF_androidlog "log")
elseif (UNIX)
set (CSF_ThreadLibs "pthread rt stdc++")
set (CSF_OpenGlLibs "GL")
set (CSF_OpenGlesLibs "EGL GLESv2")
if (USE_GLES2)
set (CSF_OpenGlLibs "EGL GLESv2")
else()
set (CSF_OpenGlLibs "GL")
endif()
set (CSF_XwLibs "X11 Xext Xmu Xi")
set (CSF_dl "dl")
if (USE_FREETYPE)
set (CSF_fontconfig "fontconfig")
endif()
set (CSF_fontconfig "fontconfig")
endif()
endif()

View File

@@ -303,13 +303,6 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
else() # get CSF_ value
set (CURRENT_CSF ${${USED_ITEM}})
if (NOT "x${CURRENT_CSF}" STREQUAL "x")
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlLibs")
add_definitions (-DHAVE_OPENGL)
endif()
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlesLibs")
add_definitions (-DHAVE_GLES2)
endif()
set (LIBRARY_FROM_CACHE 0)
separate_arguments (CURRENT_CSF)
foreach (CSF_LIBRARY ${CURRENT_CSF})

View File

@@ -155,18 +155,12 @@ set (3RDPARTY_DIR_DESCR
third-party product have been found - corresponding CMake variables will be specified
(VTK: 3RDPARTY_VTK_DIR, 3RDPARTY_VTK_INCLUDE_DIR, 3RDPARTY_VTK_LIBRARY_DIR)")
set (USE_TK_DESCR
"Indicates whether Tk product should be used by Draw Harness for user interface")
set (USE_FREETYPE_DESCR
"Indicates whether FreeType product should be used in OCCT for text rendering using external font files")
set (USE_FFMPEG_DESCR
"Indicates whether FFmpeg framework is used or not. FFmpeg stands for
multimedia data handling, open-source software libraries used for video encoding and decoding.")
set (USE_FREEIMAGE_DESCR
"Indicates whether FreeImage product should be used in OCCT visualization
"Indicates whether Freeimage product should be used in OCCT visualization
module for support of popular graphics image formats (PNG, BMP etc)")
set (USE_OPENVR_DESCR
@@ -180,10 +174,9 @@ set (USE_EGL_DESCR
"Indicates whether EGL should be used in OCCT visualization
module instead of conventional OpenGL context creation APIs")
set (USE_OPENGL_DESCR
"Indicates whether OpenGL desktop should be used in OCCT visualization module")
set (USE_GLES2_DESCR
"Indicates whether OpenGL ES 2.0 should be used in OCCT visualization module")
"Indicates whether OpenGL ES 2.0 should be used in OCCT visualization
module instead of desktop OpenGL")
set (USE_TBB_DESCR
"Indicates whether TBB is used or not. TBB stands for Threading Building Blocks,

View File

@@ -175,9 +175,7 @@ proc wokdep:gui:UpdateList {} {
set anBin32Errs {}
set anBin64Errs {}
wokdep:SearchTclTk anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
if { "$::HAVE_FREETYPE" == "true" } {
wokdep:SearchFreeType anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
wokdep:SearchFreeType anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
wokdep:SearchX11 anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
if { "$::HAVE_GLES2" == "true" } {
wokdep:SearchEGL anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
@@ -473,8 +471,6 @@ ttk::label .myFrame.myHxxChecks.myScutsLbl -text "Strategy for filling he
ttk::label .myFrame.mySrchLbl -text "3rd-parties search path:" -padding {5 5 80 5}
entry .myFrame.mySrchEntry -textvariable PRODUCTS_PATH_INPUT -width 80
ttk::button .myFrame.mySrchBrowseBtn -text "Browse" -command wokdep:gui:BrowsePartiesRoot
checkbutton .myFrame.myChecks.myFreeTypeCheck -offvalue "false" -onvalue "true" -variable HAVE_FREETYPE -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myFreeTypeLbl -text "Use FreeType"
checkbutton .myFrame.myChecks.myFImageCheck -offvalue "false" -onvalue "true" -variable HAVE_FREEIMAGE -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myFImageLbl -text "Use FreeImage"
checkbutton .myFrame.myChecks.myTbbCheck -offvalue "false" -onvalue "true" -variable HAVE_TBB -command wokdep:gui:UpdateList
@@ -608,10 +604,10 @@ incr aRowIter
grid .myFrame.myChecks -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter
grid .myFrame.myChecks.myFreeTypeCheck -row $aCheckRowIter -column 0 -sticky e
grid .myFrame.myChecks.myFreeTypeLbl -row $aCheckRowIter -column 1 -sticky w
grid .myFrame.myChecks.myRapidJsonCheck -row $aCheckRowIter -column 2 -sticky e
grid .myFrame.myChecks.myRapidJsonLbl -row $aCheckRowIter -column 3 -sticky w
grid .myFrame.myChecks.myFImageCheck -row $aCheckRowIter -column 0 -sticky e
grid .myFrame.myChecks.myFImageLbl -row $aCheckRowIter -column 1 -sticky w
grid .myFrame.myChecks.myTbbCheck -row $aCheckRowIter -column 2 -sticky e
grid .myFrame.myChecks.myTbbLbl -row $aCheckRowIter -column 3 -sticky w
if { "$::tcl_platform(os)" != "Darwin" } {
grid .myFrame.myChecks.myGlesCheck -row $aCheckRowIter -column 4 -sticky e
grid .myFrame.myChecks.myGlesLbl -row $aCheckRowIter -column 5 -sticky w
@@ -625,10 +621,10 @@ grid .myFrame.myChecks.myQtCheck -row $aCheckRowIter -column 12 -sticky e
grid .myFrame.myChecks.myQtLbl -row $aCheckRowIter -column 13 -sticky w
incr aCheckRowIter
grid .myFrame.myChecks.myFImageCheck -row $aCheckRowIter -column 0 -sticky e
grid .myFrame.myChecks.myFImageLbl -row $aCheckRowIter -column 1 -sticky w
grid .myFrame.myChecks.myTbbCheck -row $aCheckRowIter -column 2 -sticky e
grid .myFrame.myChecks.myTbbLbl -row $aCheckRowIter -column 3 -sticky w
grid .myFrame.myChecks.myFFmpegCheck -row $aCheckRowIter -column 0 -sticky e
grid .myFrame.myChecks.myFFmpegLbl -row $aCheckRowIter -column 1 -sticky w
grid .myFrame.myChecks.myVtkCheck -row $aCheckRowIter -column 2 -sticky e
grid .myFrame.myChecks.myVtkLbl -row $aCheckRowIter -column 3 -sticky w
if { "$::tcl_platform(platform)" == "windows" } {
grid .myFrame.myChecks.myD3dCheck -row $aCheckRowIter -column 4 -sticky e
grid .myFrame.myChecks.myD3dLbl -row $aCheckRowIter -column 5 -sticky w
@@ -642,10 +638,8 @@ grid .myFrame.myChecks.myJDKCheck -row $aCheckRowIter -column 12 -sticky e
grid .myFrame.myChecks.myJDKLbl -row $aCheckRowIter -column 13 -sticky w
incr aCheckRowIter
grid .myFrame.myChecks.myFFmpegCheck -row $aCheckRowIter -column 0 -sticky e
grid .myFrame.myChecks.myFFmpegLbl -row $aCheckRowIter -column 1 -sticky w
grid .myFrame.myChecks.myVtkCheck -row $aCheckRowIter -column 2 -sticky e
grid .myFrame.myChecks.myVtkLbl -row $aCheckRowIter -column 3 -sticky w
grid .myFrame.myChecks.myRapidJsonCheck -row $aCheckRowIter -column 0 -sticky e
grid .myFrame.myChecks.myRapidJsonLbl -row $aCheckRowIter -column 1 -sticky w
grid .myFrame.myChecks.myOpenVrCheck -row $aCheckRowIter -column 4 -sticky e
grid .myFrame.myChecks.myOpenVrLbl -row $aCheckRowIter -column 5 -sticky w
grid .myFrame.myChecks.myE57Check -row $aCheckRowIter -column 6 -sticky e

View File

@@ -68,11 +68,9 @@ 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_TK HAVE_FREETYPE HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_E57 HAVE_RAPIDJSON HAVE_OPENVR HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo BUILD_Inspector}
foreach anEnvIter $THE_ENV_VARIABLES { set ${anEnvIter} "false" }
set HAVE_TK "true"
set HAVE_FREETYPE "true"
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_E57 HAVE_RAPIDJSON HAVE_OPENVR HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo BUILD_Inspector}
foreach anEnvIter $THE_ENV_VARIABLES {
set ${anEnvIter} "false"
if { [info exists ::env(${anEnvIter})] } {
set ${anEnvIter} "$::env(${anEnvIter})"
}

View File

@@ -686,17 +686,6 @@ proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMod
# Write specific options
if { $docType == "REFMAN" } {
# always include optional components
set aHaveD3dBack ""
set aHaveGlesBack ""
set aHaveVtkBack ""
if { [info exists ::env(HAVE_D3D)] } { set aHaveD3dBack "$::env(HAVE_D3D)" }
if { [info exists ::env(HAVE_GLES2)] } { set aHaveGlesBack "$::env(HAVE_GLES2)" }
if { [info exists ::env(HAVE_VTK)] } { set aHaveVtkBack "$::env(HAVE_VTK)" }
set ::env(HAVE_D3D) "true"
set ::env(HAVE_GLES2) "true"
set ::env(HAVE_VTK) "true"
# Load lists of modules scripts
if { $productsPath == "" } {
set modules_scripts [glob -nocomplain -type f -directory "[OCCDoc_GetSourceDir $productsPath]/OS/" *.tcl]
@@ -822,11 +811,6 @@ proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMod
puts $doxyFile ""
# restore environment variables
set ::env(HAVE_D3D) "$aHaveD3dBack"
set ::env(HAVE_GLES2) "$aHaveGlesBack"
set ::env(HAVE_VTK) "$aHaveVtkBack"
} elseif { $docType == "OVERVIEW" } {
# Add common options for generation of Overview and User Guides

View File

@@ -129,7 +129,7 @@ proc osutils:isEqualContent { theContent1 theContent2 } {
# Auxiliary function for writing new file content only if it has been actually changed
# (e.g. to preserve file timestamp on no change).
# Useful for automatically (re)generated files.
proc osutils:writeTextFile { theFile theContent {theEol lf} {theToBackup false} } {
proc osutils:writeTextFile { theFile theContent {theEol lf} } {
if {[file exists "${theFile}"]} {
set aFileOld [open "${theFile}" rb]
fconfigure $aFileOld -translation crlf
@@ -143,10 +143,6 @@ proc osutils:writeTextFile { theFile theContent {theEol lf} {theToBackup false}
return false
}
if { $theToBackup == true } {
puts "Warning: file ${theFile} is updated. Old content is saved to ${theFile}.bak"
file copy -force -- "${theFile}" "${theFile}.bak"
}
file delete -force "${theFile}"
}
@@ -377,28 +373,29 @@ proc copy_with_warning {from to} {
# Generate auxiliary scripts for launching IDE.
proc genprojbat {theFormat thePlatform theSolution} {
set aTargetPlatformExt sh
set aTargetEol lf
if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
set aTargetPlatformExt bat
set aTargetEol crlf
}
if { [file exists "$::path/src/OS/FoundationClasses.tcl"] || ![file exists "$::path/env.${aTargetPlatformExt}"] } {
# generate env.bat/sh
set anEnvTmplFilePath "$::THE_CASROOT/adm/templates/env.${aTargetPlatformExt}"
set anEnvTmplFile [open "$anEnvTmplFilePath" "r"]
set anEnvTmpl [read $anEnvTmplFile]
close $anEnvTmplFile
if {"$theFormat" != "cmake"} {
# copy env.bat/sh only if not yet present
if { ! [file exists "$::path/env.${aTargetPlatformExt}"] } {
set anEnvTmplFile [open "$::THE_CASROOT/adm/templates/env.${aTargetPlatformExt}" "r"]
set anEnvTmpl [read $anEnvTmplFile]
close $anEnvTmplFile
set aCasRoot ""
if { [file normalize "$::path"] != [file normalize "$::THE_CASROOT"] } {
set aCasRoot [relativePath "$::path" "$::THE_CASROOT"]
set aCasRoot ""
if { [file normalize "$::path"] != [file normalize "$::THE_CASROOT"] } {
set aCasRoot [relativePath "$::path" "$::THE_CASROOT"]
}
regsub -all -- {__CASROOT__} $anEnvTmpl "$aCasRoot" anEnvTmpl
set anEnvFile [open "$::path/env.${aTargetPlatformExt}" "w"]
puts $anEnvFile $anEnvTmpl
close $anEnvFile
}
regsub -all -- {__CASROOT__} $anEnvTmpl "$aCasRoot" anEnvTmpl
set aLineList [split $anEnvTmpl "\n"]
osutils:writeTextFile "$::path/env.${aTargetPlatformExt}" $aLineList $aTargetEol true
copy_with_warning "$::THE_CASROOT/adm/templates/draw.${aTargetPlatformExt}" "$::path/draw.${aTargetPlatformExt}"
if { "$::BUILD_Inspector" == "true" } {
@@ -1412,13 +1409,9 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
unset theCsfLibsMap
unset theCsfFrmsMap
if { "$::HAVE_FREETYPE" == "true" } {
set aLibsMap(CSF_FREETYPE) "freetype"
}
set aLibsMap(CSF_FREETYPE) "freetype"
set aLibsMap(CSF_TclLibs) "tcl8.6"
if { "$::HAVE_TK" == "true" } {
set aLibsMap(CSF_TclTkLibs) "tk8.6"
}
set aLibsMap(CSF_TclTkLibs) "tk8.6"
if { "$::HAVE_FREEIMAGE" == "true" } {
if { "$theOS" == "wnt" } {
set aLibsMap(CSF_FreeImagePlus) "FreeImage"
@@ -1468,15 +1461,15 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
set aLibsMap(CSF_netapi32) "netapi32"
set aLibsMap(CSF_winmm) "winmm"
set aLibsMap(CSF_OpenGlLibs) "opengl32"
set aLibsMap(CSF_OpenGlesLibs) "libEGL libGLESv2"
if { "$::HAVE_GLES2" == "true" } {
set aLibsMap(CSF_OpenGlLibs) "libEGL libGLESv2"
}
set aLibsMap(CSF_psapi) "Psapi"
set aLibsMap(CSF_d3d9) "d3d9"
# the naming is different on Windows
set aLibsMap(CSF_TclLibs) "tcl86"
if { "$::HAVE_TK" == "true" } {
set aLibsMap(CSF_TclTkLibs) "tk86"
}
set aLibsMap(CSF_TclTkLibs) "tk86"
if { "$theRelease" == "true" } {
set aLibsMap(CSF_QT) "Qt5Gui Qt5Widgets Qt5Xml Qt5Core"
} else {
@@ -1491,43 +1484,40 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
}
} else {
set aLibsMap(CSF_dl) "dl"
set aLibsMap(CSF_OpenGlLibs) "GL"
set aLibsMap(CSF_OpenGlesLibs) "EGL GLESv2"
if { "$theOS" == "mac" || "$theOS" == "ios" } {
set aLibsMap(CSF_objc) "objc"
set aLibsMap(CSF_OpenGlLibs) ""
set aLibsMap(CSF_OpenGlesLibs) ""
set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
set aFrmsMap(CSF_OpenGlesLibs) "OpenGLES"
set aLibsMap(CSF_objc) "objc"
if { "$theOS" == "ios" } {
set aFrmsMap(CSF_Appkit) "UIKit"
set aFrmsMap(CSF_Appkit) "UIKit"
set aFrmsMap(CSF_OpenGlLibs) "OpenGLES"
} else {
set aFrmsMap(CSF_Appkit) "AppKit"
set aFrmsMap(CSF_Appkit) "AppKit"
set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
}
set aFrmsMap(CSF_IOKit) "IOKit"
set aLibsMap(CSF_TclLibs) ""
set aLibsMap(CSF_TclTkLibs) ""
set aFrmsMap(CSF_TclLibs) "Tcl"
if { "$::HAVE_TK" == "true" } {
set aFrmsMap(CSF_TclTkLibs) "Tk"
}
set aLibsMap(CSF_TclLibs) ""
set aFrmsMap(CSF_TclTkLibs) "Tk"
set aLibsMap(CSF_TclTkLibs) ""
set aLibsMap(CSF_QT) "QtCore QtGui"
} elseif { "$theOS" == "android" } {
set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
set aLibsMap(CSF_androidlog) "log"
} else {
if { "$::HAVE_FREETYPE" == "true" } {
set aLibsMap(CSF_fontconfig) "fontconfig"
}
set aLibsMap(CSF_fontconfig) "fontconfig"
if { "$theOS" == "qnx" } {
# CSF_ThreadLibs - pthread API is part of libc on QNX
set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
} else {
set aLibsMap(CSF_ThreadLibs) "pthread rt"
if { "$::HAVE_TK" == "true" } {
set aLibsMap(CSF_TclTkLibs) "tk8.6"
}
set aLibsMap(CSF_OpenGlLibs) "GL"
set aLibsMap(CSF_TclTkLibs) "X11 tk8.6"
set aLibsMap(CSF_XwLibs) "X11 Xext Xmu Xi"
set aLibsMap(CSF_MotifLibs) "X11"
}
if { "$::HAVE_GLES2" == "true" } {
set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
}
}
}
}
@@ -1795,14 +1785,9 @@ proc osutils:vcproj { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir
global path
set aHasQtDep "false"
set aTkDefines ""
foreach aCsfElem [osutils:tk:csfInExternlib "$path/$theSrcDir/${theToolKit}/EXTERNLIB"] {
if { "$aCsfElem" == "CSF_QT" } {
set aHasQtDep "true"
} elseif { "$aCsfElem" == "CSF_OpenGlLibs" } {
set aTkDefines "$aTkDefines;HAVE_OPENGL"
} elseif { "$aCsfElem" == "CSF_OpenGlesLibs" } {
set aTkDefines "$aTkDefines;HAVE_GLES2"
}
}
set theProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 0]
@@ -1837,9 +1822,9 @@ proc osutils:vcproj { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir
# depending on VC version
regsub -all -- {__TKDEP__} $theProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] theProjTmpl
regsub -all -- {__TKDEP_DEBUG__} $theProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] theProjTmpl
regsub -all -- {__TKDEFINES__} $theProjTmpl $aTkDefines theProjTmpl
set anIncPaths "..\\..\\..\\inc"
# set aTKDefines ""
set aFilesSection ""
set aVcFilesCxx(units) ""
set aVcFilesHxx(units) ""
@@ -2123,7 +2108,6 @@ proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir
set aVCRTVer [string range $theVcVer 0 3]
regsub -all -- {__TKDEP__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEP_DEBUG__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEFINES__} $aProjTmpl "" aProjTmpl
set aFilesSection ""
set aVcFilesCxx(units) ""

View File

@@ -153,4 +153,5 @@ win32 {
}
}
OBJECTS_DIR = $$DESTDIR/../obj$${MY_BUILDTYPE}/$${TARGET}
#OBJECTS_DIR = $$DESTDIR/../obj$${MY_BUILDTYPE}/$${TARGET}
OBJECTS_DIR = $$DESTDIR/../obj$${MY_BUILDTYPE}

View File

@@ -15,14 +15,8 @@ for (aModuleIter, aModuleList) {
equals (aToolKit, $$OCC_MODULE_NAME) { toSkipToolkit = 1 }
!HAVE_VTK:equals (aToolKit, "TKIVtk") { toSkipToolkit = 1 }
!HAVE_VTK:equals (aToolKit, "TKIVtkDraw") { toSkipToolkit = 1 }
#!HAVE_OPENGL: equals (aToolKit, "TKOpenGl") { toSkipToolkit = 1 }
#!HAVE_OPENGL: equals (aToolKit, "TKOpenGlTest") { toSkipToolkit = 1 }
!HAVE_GLES2: equals (aToolKit, "TKOpenGles") { toSkipToolkit = 1 }
!HAVE_GLES2: equals (aToolKit, "TKOpenGlesTest") { toSkipToolkit = 1 }
!win32: equals (aToolKit, "TKD3DHost") { toSkipToolkit = 1 }
!win32: equals (aToolKit, "TKD3DHostTest") { toSkipToolkit = 1 }
equals (toSkipToolkit, 0) {
#warning(aToolKit($$OCC_MODULE_NAME)=$$aToolKit)
eval(occtkgen_$${aToolKit}.input = $$_PRO_FILE_PWD_/../OccToolkit.pro.in)
eval(occtkgen_$${aToolKit}.output = $$_PRO_FILE_PWD_/$${aToolKit}/$${aToolKit}.pro)

View File

@@ -18,7 +18,7 @@ aHxxRoot = $$OccGitRoot/inc
INCLUDEPATH += $$aHxxRoot
# CSF variables
HAVE_FREETYPE { CSF_FREETYPE = -lfreetype }
CSF_FREETYPE = -lfreetype
CSF_TclLibs = -ltcl8.6
CSF_TclTkLibs = -ltk8.6
HAVE_FREEIMAGE { CSF_FreeImagePlus = -lfreeimage } else:win32 { CSF_FreeImagePlus = -lwindowscodecs -lole32 }
@@ -36,7 +36,7 @@ win32 {
CSF_wsock32 = -lwsock32
CSF_netapi32 = -lnetapi32
CSF_OpenGlLibs = -lopengl32
CSF_OpenGlesLibs = -llibEGL -llibGLESv2
HAVE_GLES2 { CSF_OpenGlLibs = -llibEGL -llibGLESv2 }
CSF_psapi = -lPsapi
CSF_winmm = -lwinmm
CSF_d3d9 = -ld3d9
@@ -46,12 +46,12 @@ win32 {
} else:mac {
CSF_dl = -ldl
CSF_objc = -lobjc
CSF_OpenGlLibs = -framework OpenGL
CSF_OpenGlesLibs = -framework OpenGLES
iphoneos {
CSF_Appkit = -framework UIKit
CSF_OpenGlLibs = -framework OpenGLES
} else {
CSF_Appkit = -framework AppKit
CSF_OpenGlLibs = -framework OpenGL
}
CSF_IOKit = -framework IOKit
CSF_TclLibs = -framework Tcl
@@ -60,19 +60,17 @@ win32 {
CSF_dl = -ldl
CSF_ThreadLibs = -lpthread -lrt
CSF_OpenGlLibs = -lGL
CSF_OpenGlesLibs = -lEGL -lGLESv2
CSF_TclTkLibs = -lX11 -ltk8.6
CSF_XwLibs = -lX11 -lXext -lXmu -lXi
CSF_MotifLibs = -lX11
HAVE_FREETYPE { CSF_fontconfig = -lfontconfig }
CSF_fontconfig = -lfontconfig
HAVE_GLES2 { CSF_OpenGlLibs = -lEGL -lGLESv2 }
}
for (aCfgIter, CONFIG) {
aRes = $$find(aCfgIter, "^HAVE_")
!equals(aCfgIter, "HAVE_GLES2") {
count(aRes, 1) {
DEFINES += $$aCfgIter
}
count(aRes, 1) {
DEFINES += $$aCfgIter
}
}
@@ -105,12 +103,6 @@ for (anExternLib, anExternLibs) {
count(hasCsf, 1) {
aList = $$split($$anExternLib, "\n")
LIBS += $$aList
equals(anExternLib, "CSF_OpenGlLibs") {
DEFINES += "HAVE_OPENGL"
}
equals(anExternLib, "CSF_OpenGlesLibs") {
DEFINES += "HAVE_GLES2"
}
} else {
LIBS += -l$$anExternLib
}

View File

@@ -17,8 +17,6 @@ set "ARCH=64"
set "VCVARS="
set "HAVE_TBB=false"
set "HAVE_OPENCL=false"
set "HAVE_TK=true"
set "HAVE_FREETYPE=true"
set "HAVE_FREEIMAGE=false"
set "HAVE_FFMPEG=false"
set "HAVE_VTK=false"
@@ -58,9 +56,9 @@ rem Decode VCVER variable and define related ones:
rem
rem VCFMT - "vc" followed by full version number of Visual Studio toolset
rem (same as VCVER without optional suffix "-uwp")
rem VCLIB - name of folder containing binaries
rem VCLIB - name of folder contining binaries
rem (same as VCVER except without third version in number)
rem VCPROP - name of required Visual Studio Workload (starting with VS 2017)
rem VCPROP - name of required Visual Studion Workload (starting with VS 2017)
rem
rem Note that for VS before 2015 (vc14) always
rem VCFMT=VCLIB=VCVER and VCPROP=NativeDesktop
@@ -184,12 +182,10 @@ set "CSF_OPT_CMPL="
set "PRODUCTS_DEFINES="
if ["%HAVE_TBB%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_TBB" & set "CSF_DEFINES=HAVE_TBB;%CSF_DEFINES%"
if ["%HAVE_OPENCL%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_OPENCL" & set "CSF_DEFINES=HAVE_OPENCL;%CSF_DEFINES%"
if ["%HAVE_TK%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_TK" & set "CSF_DEFINES=HAVE_TK;%CSF_DEFINES%"
if ["%HAVE_FREETYPE%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FREEIMAGE" & set "CSF_DEFINES=HAVE_FREETYPE;%CSF_DEFINES%"
if ["%HAVE_FREEIMAGE%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FREEIMAGE" & set "CSF_DEFINES=HAVE_FREEIMAGE;%CSF_DEFINES%"
if ["%HAVE_FFMPEG%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FFMPEG" & set "CSF_DEFINES=HAVE_FFMPEG;%CSF_DEFINES%"
if ["%HAVE_VTK%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_VTK" & set "CSF_DEFINES=HAVE_VTK;%CSF_DEFINES%"
if ["%HAVE_GLES2%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_GLES2_EXT" & set "CSF_DEFINES=HAVE_GLES2_EXT;%CSF_DEFINES%"
if ["%HAVE_GLES2%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_GLES2" & set "CSF_DEFINES=HAVE_GLES2;%CSF_DEFINES%"
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%"
@@ -203,20 +199,20 @@ if ["%CSF_DEFINES%"] == [""] set "CSF_DEFINES=;"
rem ----- Optional 3rd-parties should be enabled by HAVE macros -----
if not ["%PRODUCTS_DEFINES%"] == [""] set "CSF_OPT_CMPL=%CSF_OPT_CMPL% %PRODUCTS_DEFINES%"
rem ----- Collect 3rd-parties additional include paths into compiler options -----
rem ----- Colect 3rd-parties additional include paths into compiler options -----
for %%a in ("%CSF_OPT_INC:;=";"%") do (
set "anItem=%%~a"
if not ["%%~a"] == [""] call :concatCmplInc %%~a
)
rem ----- Collect 3rd-parties additional library paths (32-bit) into linker options -----
rem ----- Colect 3rd-parties additional library paths (32-bit) into linker options -----
set "OPT_LIB32="
for %%a in ("%CSF_OPT_LIB32:;=";"%") do (
set "anItem=%%~a"
if not ["%%~a"] == [""] call :concatLib32 %%~a
)
rem ----- Collect 3rd-parties additional library paths (64-bit) into linker options -----
rem ----- Colect 3rd-parties additional library paths (64-bit) into linker options -----
set "OPT_LIB64="
for %%a in ("%CSF_OPT_LIB64:;=";"%") do (
set "anItem=%%~a"
@@ -248,7 +244,7 @@ if ["%CASDEB%"] == ["d"] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64D%;%PAT
if ["%CASDEB%"] == ["i"] if ["%ARCH%"] == ["32"] set "PATH=%CSF_OPT_BIN32I%;%PATH%"
if ["%CASDEB%"] == ["i"] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64I%;%PATH%"
rem ----- Set environment variables used by OCCT -----
rem ----- Set envoronment variables used by OCCT -----
set CSF_LANGUAGE=us
set MMGT_CLEAR=1
set "CSF_SHMessage=%CSF_OCCTResourcePath%\SHMessage"

View File

@@ -9,8 +9,6 @@ export CASDEB=""
export PRJFMT="";
export HAVE_TBB="false";
export HAVE_OPENCL="false";
export HAVE_TK="true";
export HAVE_FREETYPE="true";
export HAVE_FREEIMAGE="false";
export HAVE_FFMPEG="false";
export HAVE_VTK="false";
@@ -102,11 +100,9 @@ export CSF_OPT_CMPL=""
# Optiona 3rd-parties should be enabled by HAVE macros
if [ "$HAVE_TBB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_TBB"; fi
if [ "$HAVE_OPENCL" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_OPENCL"; fi
if [ "$HAVE_TK" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_TK"; fi
if [ "$HAVE_FREETYPE" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_FREETYPE"; fi
if [ "$HAVE_FREEIMAGE" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_FREEIMAGE"; fi
if [ "$HAVE_FFMPEG" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_FFMPEG"; fi
if [ "$HAVE_GLES2" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_GLES2_EXT"; fi
if [ "$HAVE_GLES2" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_GLES2"; fi
if [ "$HAVE_VTK" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_VTK"; fi
if [ "$HAVE_ZLIB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_ZLIB"; fi
if [ "$HAVE_LIBLZMA" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_LIBLZMA"; fi

View File

@@ -90,7 +90,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -107,7 +107,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;No_Exception;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
@@ -138,7 +138,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AssemblerListingLocation>.\..\..\..\win32\__VCVER__\objd\__TKNAM__/</AssemblerListingLocation>
@@ -156,7 +156,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>
@@ -186,7 +186,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -203,7 +203,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;No_Exception;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
@@ -234,7 +234,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AssemblerListingLocation>.\..\..\..\win64\__VCVER__\objd\__TKNAM__/</AssemblerListingLocation>
@@ -252,7 +252,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>

View File

@@ -85,7 +85,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -100,7 +100,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;No_Exception;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
@@ -130,7 +130,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AssemblerListingLocation>.\..\..\..\win32\__VCVER__\objd\__XQTNAM__/</AssemblerListingLocation>
@@ -146,7 +146,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>
@@ -175,7 +175,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -190,7 +190,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;No_Exception;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
@@ -219,7 +219,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AssemblerListingLocation>.\..\..\..\win64\__VCVER__\objd\__XQTNAM__/</AssemblerListingLocation>
@@ -235,7 +235,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>

View File

@@ -471,7 +471,7 @@ The environment is defined in the file *custom.sh* which can be edited directly:
* "HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~~
export HAVE_FREEIMAGE=false
export HAVE_GL2PS=false
~~~~~
Alternatively, or when *custom.sh* does not exist, you can launch *genconf.sh* to configure environment interactively:
@@ -544,7 +544,7 @@ directly:
* "HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~~
export HAVE_FREEIMAGE=false
export HAVE_GL2PS=false
~~~~~
Alternatively, or when *custom.sh* or *custom.bat* does not exist, you can launch **genconf** tool to configure

View File

@@ -2211,29 +2211,8 @@ BRep and Binary BRep Shape formats (only in case of triangulation-only Faces, wi
Versions of formats have been changed (11 for BinOCAF, 10 for XmlOCAF, 4 for BRep Shape and 3 for Binary BRep Shape).
Files written with the new version will not be readable by applications of old versions.
@subsection upgrade_occt760_poly Changes in *Poly* package and *Poly_Triangulation* class
@subsection upgrade_occt760_poly Changes in *Poly* package and *Poly_Triangulation* class:
*Poly_Triangulation* does no more provide access to internal array structures: methods Nodes(), ChangeNode(), Triangles(), ChangeTriangle(), UVNodes(), ChangeUVNode(), Normals() have been removed.
Methods of *Poly_Triangulation* for accessing individual nodal properties / triangles by index and implementing copy semantics should be used instead.
The same is applicable to *Poly_PolygonOnTriangulation* interface.
@subsection upgrade_occt760_glsl Custom GLSL programs
Accessors to standard materials have been modified within *Declarations.glsl* (*occFrontMaterial_Diffuse()* -> *occMaterial_Diffuse(bool)* and similar).
Applications defining custom GLSL programs should take into account syntax changes.
@subsection upgrade_occt760_noral_colors Nodal color modulation
Nodal color vertex attribute is now modulated in the same way as a color texture - color is multiplied by material coefficients (diffuse/ambient/specular in case of a common material definition).
Existing code defining nodal colors should be updated to:
- Use *Graphic3d_TOSM_UNLIT* shading model when lighting is not needed.
- Adjust diffuse/ambient material coefficients, which have been previously ignored.
- Remove code multiplying nodal colors, intended to compensate over-brightness due to addition of specular color from material definition, as specular component is now also modulated by a vertex color.
@subsection upgrade_occt760_tkopengles TKOpenGles library
OCCT now provides two separate toolkits - *TKOpenGl* depending on desktop OpenGL and *TKOpenGles* depending on OpenGL ES.
Both libraries can be now built simultaneously on systems providing both APIs (like desktop Linux).
Existing applications depending on OpenGL ES (mobile projects first of all) should be adjusted to link against *TKOpenGles*.
Note that both *TKOpenGl* and *TKOpenGles* keep exporting classes with the same name, so applications should not attempt to link both libraries simultaneously.

View File

@@ -1,27 +0,0 @@
<svg width="188" height="90" viewBox="0 0 188 90" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="188" height="90" fill="white"/>
<rect x="6.5" y="6.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 8V16H13V26H21V16H26V8H8Z" fill="#DDDDDD"/>
<path d="M42 15H41V16V25H35V9H51V15H42Z" fill="#DDDDDD" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 18V8H63V18H60V26H80V18H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="34.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 36V44H13V54H21V44H26V36H8Z" fill="#DDDDDD"/>
<path d="M42 43H41V44V53H35V37H51V43H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 46V36H63V46H60V54H80V46H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="62.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 64V72H13V82H21V72H26V64H8Z" fill="#3D3ACF"/>
<path d="M42 71H41V72V81H35V65H51V71H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 74V64H63V74H60V82H80V74H71Z" fill="#3D3ACF"/>
<path d="M93 10L100 17L93 24V20H84V14H93V10Z" fill="#7C97DE"/>
<path d="M93 38L100 45L93 52V48H84V42H93V38Z" fill="#7C97DE"/>
<path d="M93 66L100 73L93 80V76H84V70H93V66Z" fill="#7C97DE"/>
<path d="M108 8V16H113V26H121V16H126V8H108Z" fill="#DDDDDD"/>
<path d="M108 36V44H113V54H121V44H126V36H108Z" fill="#DDDDDD"/>
<path d="M108 64V72H113V82H121V72H126V64H108Z" fill="#DDDDDD"/>
<path d="M152 8H134V26H142V16H152V8Z" fill="#3D3ACF"/>
<path d="M152 36H134V54H142V44H152V36Z" fill="#DDDDDD"/>
<path d="M152 64H134V82H142V72H152V64Z" fill="#3D3ACF"/>
<path d="M171 18V8H163V18H160V26H180V18H171Z" fill="#DDDDDD"/>
<path d="M171 46V36H163V46H160V54H180V46H171Z" fill="#DDDDDD"/>
<path d="M171 74V64H163V74H160V82H180V74H171Z" fill="#DDDDDD"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -1040,7 +1040,7 @@ Select* methods of AIS_InteractiveContext accept some selection scheme as parame
| :----- | :----- | :----- | :----- | :----- |
| AIS_SelectionScheme_Replace | @figure{visualization_selection_scheme_replace.svg, ""} | | AIS_SelectionScheme_XOR | @figure{visualization_selection_scheme_XOR.svg, ""} |
| AIS_SelectionScheme_Add | @figure{visualization_selection_scheme_add.svg, ""} | | AIS_SelectionScheme_Clear | @figure{visualization_selection_scheme_clear.svg, ""} |
| AIS_SelectionScheme_Remove | @figure{visualization_selection_scheme_remove.svg, ""} | | AIS_SelectionScheme_ReplaceExtra | @figure{visualization_selection_scheme_replaceExtra.svg, ""} |
| AIS_SelectionScheme_Remove | @figure{visualization_selection_scheme_remove.svg, ""} | | | |
@subsection occt_visu_3_5 Standard Interactive Object Classes

View File

@@ -32,7 +32,7 @@
0A7DEE351E2D2AE000267B9B /* libTKXCAF.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE151E2D2AC000267B9B /* libTKXCAF.a */; };
0A7DEE371E2D2AE000267B9B /* libTKXDESTEP.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE171E2D2AC700267B9B /* libTKXDESTEP.a */; };
0A7DEE3E1E2D2B8100267B9B /* libTKBO.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE021E2D2A7F00267B9B /* libTKBO.a */; };
0A7DEE3F1E2D2BB000267B9B /* libTKOpenGles.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE091E2D2A9700267B9B /* libTKOpenGles.a */; };
0A7DEE3F1E2D2BB000267B9B /* libTKOpenGl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE091E2D2A9700267B9B /* libTKOpenGl.a */; };
0A7DEE401E2D2BEA00267B9B /* libTKSTEP209.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE0F1E2D2AAB00267B9B /* libTKSTEP209.a */; };
0A7DEE411E2D2C1500267B9B /* libTKXSBase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE1D1E2D2ADC00267B9B /* libTKXSBase.a */; };
0AAE0DE61EAF816E00C1F65B /* screw.step in Resources */ = {isa = PBXBuildFile; fileRef = 0AAE0DE51EAF816D00C1F65B /* screw.step */; };
@@ -82,7 +82,7 @@
0A7DEE061E2D2A8C00267B9B /* libTKIGES.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKIGES.a; path = ../occt/lib/libTKIGES.a; sourceTree = "<group>"; };
0A7DEE071E2D2A8F00267B9B /* libTKMeshVS.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKMeshVS.a; path = ../occt/lib/libTKMeshVS.a; sourceTree = "<group>"; };
0A7DEE081E2D2A9300267B9B /* libTKOffset.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKOffset.a; path = ../occt/lib/libTKOffset.a; sourceTree = "<group>"; };
0A7DEE091E2D2A9700267B9B /* libTKOpenGles.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKOpenGles.a; path = ../occt/lib/libTKOpenGles.a; sourceTree = "<group>"; };
0A7DEE091E2D2A9700267B9B /* libTKOpenGl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKOpenGl.a; path = ../occt/lib/libTKOpenGl.a; sourceTree = "<group>"; };
0A7DEE0A1E2D2A9A00267B9B /* libTKPrim.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKPrim.a; path = ../occt/lib/libTKPrim.a; sourceTree = "<group>"; };
0A7DEE0B1E2D2A9D00267B9B /* libTKService.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKService.a; path = ../occt/lib/libTKService.a; sourceTree = "<group>"; };
0A7DEE0C1E2D2AA100267B9B /* libTKStd.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKStd.a; path = ../occt/lib/libTKStd.a; sourceTree = "<group>"; };
@@ -135,7 +135,7 @@
0AE286641EB0D29B00A9D719 /* libz.tbd in Frameworks */,
0A7DEE411E2D2C1500267B9B /* libTKXSBase.a in Frameworks */,
0A7DEE401E2D2BEA00267B9B /* libTKSTEP209.a in Frameworks */,
0A7DEE3F1E2D2BB000267B9B /* libTKOpenGles.a in Frameworks */,
0A7DEE3F1E2D2BB000267B9B /* libTKOpenGl.a in Frameworks */,
0A7DEE3E1E2D2B8100267B9B /* libTKBO.a in Frameworks */,
0A7DEE2B1E2D2AE000267B9B /* libTKService.a in Frameworks */,
0A7DEE2E1E2D2AE000267B9B /* libTKSTEP.a in Frameworks */,
@@ -234,7 +234,7 @@
0A7DEE061E2D2A8C00267B9B /* libTKIGES.a */,
0A7DEE071E2D2A8F00267B9B /* libTKMeshVS.a */,
0A7DEE081E2D2A9300267B9B /* libTKOffset.a */,
0A7DEE091E2D2A9700267B9B /* libTKOpenGles.a */,
0A7DEE091E2D2A9700267B9B /* libTKOpenGl.a */,
0A7DEE0A1E2D2A9A00267B9B /* libTKPrim.a */,
0A7DEE0B1E2D2A9D00267B9B /* libTKService.a */,
0A7DEE0C1E2D2AA100267B9B /* libTKStd.a */,

View File

@@ -147,7 +147,7 @@ public class OcctJniActivity extends Activity implements OnClickListener
|| !loadLibVerbose ("TKService", aLoaded, aFailed)
|| !loadLibVerbose ("TKHLR", aLoaded, aFailed)
|| !loadLibVerbose ("TKV3d", aLoaded, aFailed)
|| !loadLibVerbose ("TKOpenGles", aLoaded, aFailed)
|| !loadLibVerbose ("TKOpenGl", aLoaded, aFailed)
// application code
|| !loadLibVerbose ("TKJniSample", aLoaded, aFailed))
{

View File

@@ -11,7 +11,7 @@ set (anOcctLibs
TKIGES
TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP
# OCCT Visualization
TKService TKHLR TKV3d TKOpenGles
TKService TKHLR TKV3d TKOpenGl
)
set(aLibDeps "")

View File

@@ -577,7 +577,7 @@ bool OcctJni_Viewer::saveSnapshot (const TCollection_AsciiString& thePath,
}
Image_AlienPixMap anAlienImage;
if (!anAlienImage.InitTrash (Image_Format_BGRA, theWidth, theHeight))
if (!anAlienImage.InitTrash (Image_PixMap::ImgBGRA, theWidth, theHeight))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString() + "RGBA image " + theWidth + "x" + theHeight + " allocation failed", Message_Fail);
return false;
@@ -586,7 +586,7 @@ bool OcctJni_Viewer::saveSnapshot (const TCollection_AsciiString& thePath,
// OpenGL ES does not support fetching data in BGRA format
// while FreeImage does not support RGBA format.
Image_PixMap anImage;
anImage.InitWrapper (Image_Format_RGBA,
anImage.InitWrapper (Image_PixMap::ImgRGBA,
anAlienImage.ChangeData(),
anAlienImage.SizeX(),
anAlienImage.SizeY(),

View File

@@ -217,7 +217,7 @@ void OCC_2dView::OnUpdateBUTTONGridCancel(CCmdUI* pCmdUI)
void OCC_2dView::OnSize(UINT nType, int cx, int cy)
{
OCC_BaseView::OnSize (nType, cx, cy);
// Take care : This function is called before OnInitialUpdate
// Take care : This fonction is call before OnInitialUpdate
if (!myView.IsNull())
myView->MustBeResized();
}

View File

@@ -38,7 +38,7 @@ LIBS += -lTKernel \
-lTKMesh \
-lTKHLR \
-lTKV3d \
-lTKOpenGles
-lTKOpenGl
# IMPORTANT. load libraries in a proper order
ANDROID_EXTRA_LIBS = $$3rdparty_lib_path/libfreeimage.so \
@@ -56,4 +56,4 @@ ANDROID_EXTRA_LIBS = $$3rdparty_lib_path/libfreeimage.so \
$$occt_lib_path/libTKMesh.so \
$$occt_lib_path/libTKHLR.so \
$$occt_lib_path/libTKV3d.so \
$$occt_lib_path/libTKOpenGles.so
$$occt_lib_path/libTKOpenGl.so

View File

@@ -3,7 +3,7 @@
#Category: Modeling
#Title: Snowflake - creation of 2d drawing
pload MODELING VISUALIZATION
pload MODELING AISV
puts "Generating sample drawing of snowflake..."

View File

@@ -64,7 +64,7 @@ else()
set(OCCT_BIN_DIR)
endif()
set(OpenCASCADE_LIBS TKRWMesh TKBinXCAF TKBin TKBinL TKOpenGles TKXCAF TKVCAF TKCAF TKV3d TKHLR TKMesh TKService TKShHealing TKPrim TKTopAlgo TKGeomAlgo TKBRep TKGeomBase TKG3d TKG2d TKMath TKLCAF TKCDF TKernel)
set(OpenCASCADE_LIBS TKRWMesh TKBinXCAF TKBin TKBinL TKOpenGl TKXCAF TKVCAF TKCAF TKV3d TKHLR TKMesh TKService TKShHealing TKPrim TKTopAlgo TKGeomAlgo TKBRep TKGeomBase TKG3d TKG2d TKMath TKLCAF TKCDF TKernel)
add_executable(${APP_TARGET} ${SOURCES})
target_link_libraries(

View File

@@ -710,7 +710,7 @@ EM_BOOL WasmOcctView::onTouchEvent (int theEventType, const EmscriptenTouchEvent
myDoubleTapTimer.Stop();
myDoubleTapTimer.Reset();
myDoubleTapTimer.Start();
SelectInViewer (Graphic3d_Vec2i (myClickTouch.From), AIS_SelectionScheme_Replace);
SelectInViewer (Graphic3d_Vec2i (myClickTouch.From), false);
}
}
hasUpdates = true;

View File

@@ -149,29 +149,6 @@ void AIS_Selection::SelectOwners (const AIS_NArray1OfEntityOwner& thePickedOwner
{
return;
}
case AIS_SelectionScheme_ReplaceExtra:
{
// If picked owners is equivalent to the selected then just clear selected
// Else go to AIS_SelectionScheme_Replace
if (thePickedOwners.Size() == myresult.Size())
{
Standard_Boolean isTheSame = Standard_True;
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
{
if (!myResultMap.IsBound (aSelIter.Value()))
{
isTheSame = Standard_False;
break;
}
}
if (isTheSame)
{
Clear();
return;
}
}
}
Standard_FALLTHROUGH
case AIS_SelectionScheme_Replace:
{
Clear();

View File

@@ -22,9 +22,7 @@ enum AIS_SelectionScheme
AIS_SelectionScheme_Add, //!< adds detected object to current selection
AIS_SelectionScheme_Remove, //!< removes detected object from the current selection
AIS_SelectionScheme_XOR, //!< performs XOR for detected objects, other selected not touched
AIS_SelectionScheme_Clear, //!< clears current selection
AIS_SelectionScheme_ReplaceExtra, //!< replace with one difference: if result of replace is an empty,
//!< and current selection contains detected element, it will be selected
AIS_SelectionScheme_Clear //!< clears current selection
};
#endif // _AIS_SelectionScheme_HeaderFile

View File

@@ -404,11 +404,9 @@ Standard_Boolean AIS_TextLabel::calculateLabelParams (const gp_Pnt& thePosition,
{
// Get width and height of text
Handle(Prs3d_TextAspect) anAsp = myDrawer->TextAspect();
const Graphic3d_RenderingParams& aRendParams = GetContext()->CurrentViewer()->DefaultRenderingParams();
Font_FTFontParams aFontParams;
aFontParams.PointSize = (unsigned int) anAsp->Height();
aFontParams.Resolution = aRendParams.Resolution;
aFontParams.FontHinting = aRendParams.FontHinting;
aFontParams.Resolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
Handle(Font_FTFont) aFont = Font_FTFont::FindAndCreate (anAsp->Aspect()->Font(),
anAsp->Aspect()->GetTextFontAspect(),

View File

@@ -133,7 +133,7 @@ void AIS_Triangulation::Compute (const Handle(PrsMgr_PresentationManager)& ,
Handle(Graphic3d_Group) aGroup = thePrs->CurrentGroup();
Handle(Graphic3d_AspectFillArea3d) anAspect = myDrawer->ShadingAspect()->Aspect();
const Standard_Real anAmbient = 1.0;
const Standard_Real anAmbient = 0.2;
if (hasVNormals)
{
gp_Vec3f aNormal;

View File

@@ -27,7 +27,6 @@
#include <Message_Messenger.hxx>
#include <gp_Quaternion.hxx>
#include <V3d_View.hxx>
#include <V3d_Viewer.hxx>
#include <WNT_HIDSpaceMouse.hxx>
// =======================================================================

View File

@@ -16,6 +16,7 @@
#include <Aspect_DisplayConnectionDefinitionError.hxx>
#include <OSD_Environment.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Aspect_DisplayConnection,Standard_Transient)
// =======================================================================
@@ -26,8 +27,6 @@ Aspect_DisplayConnection::Aspect_DisplayConnection()
{
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
myDisplay = NULL;
myDefVisualInfo = NULL;
myDefFBConfig = NULL;
myIsOwnDisplay = false;
OSD_Environment anEnv ("DISPLAY");
myDisplayName = anEnv.Value();
@@ -42,10 +41,6 @@ Aspect_DisplayConnection::Aspect_DisplayConnection()
Aspect_DisplayConnection::~Aspect_DisplayConnection()
{
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
if (myDefVisualInfo != NULL)
{
XFree (myDefVisualInfo);
}
if (myDisplay != NULL
&& myIsOwnDisplay)
{
@@ -61,8 +56,6 @@ Aspect_DisplayConnection::~Aspect_DisplayConnection()
// =======================================================================
Aspect_DisplayConnection::Aspect_DisplayConnection (const TCollection_AsciiString& theDisplayName)
: myDisplay (NULL),
myDefVisualInfo (NULL),
myDefFBConfig (NULL),
myIsOwnDisplay (false)
{
myDisplayName = theDisplayName;
@@ -75,28 +68,11 @@ Aspect_DisplayConnection::Aspect_DisplayConnection (const TCollection_AsciiStrin
// =======================================================================
Aspect_DisplayConnection::Aspect_DisplayConnection (Display* theDisplay)
: myDisplay (NULL),
myDefVisualInfo (NULL),
myDefFBConfig (NULL),
myIsOwnDisplay (false)
{
Init (theDisplay);
}
// =======================================================================
// function : SetDefaultVisualInfo
// purpose :
// =======================================================================
void Aspect_DisplayConnection::SetDefaultVisualInfo (XVisualInfo* theVisual,
Aspect_FBConfig theFBConfig)
{
if (myDefVisualInfo != NULL)
{
XFree (myDefVisualInfo);
}
myDefVisualInfo = theVisual;
myDefFBConfig = theFBConfig;
}
// =======================================================================
// function : Init
// purpose :

View File

@@ -22,7 +22,6 @@
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
#include <InterfaceGraphic.hxx>
#include <Aspect_FBConfig.hxx>
#endif
//! This class creates and provides connection with X server.
@@ -73,21 +72,9 @@ public:
//! @param theDisplay external pointer to allocated Display, or NULL if new connection should be created
void Init (Display* theDisplay);
//! Return default window visual or NULL when undefined.
XVisualInfo* GetDefaultVisualInfo() const { return myDefVisualInfo; }
//! @return native Window FB config (GLXFBConfig on Xlib)
Aspect_FBConfig GetDefaultFBConfig() const { return myDefFBConfig; }
//! Set default window visual; the visual will be deallocated using XFree().
Standard_EXPORT void SetDefaultVisualInfo (XVisualInfo* theVisual,
Aspect_FBConfig theFBConfig);
private:
Display* myDisplay;
XVisualInfo* myDefVisualInfo;
Aspect_FBConfig myDefFBConfig;
NCollection_DataMap<Aspect_XAtom, Atom> myAtoms;
TCollection_AsciiString myDisplayName;
Standard_Boolean myIsOwnDisplay;

View File

@@ -49,9 +49,9 @@ void Aspect_VKeySet::KeyDown (Aspect_VKey theKey,
double thePressure)
{
Standard_Mutex::Sentry aLock (myLock);
if (myKeys[theKey].KStatus != KeyStatus_Pressed)
if (myKeys[theKey].Status != KeyStatus_Pressed)
{
myKeys[theKey].KStatus = KeyStatus_Pressed;
myKeys[theKey].Status = KeyStatus_Pressed;
myKeys[theKey].TimeDown = theTime;
}
myKeys[theKey].Pressure = thePressure;
@@ -68,9 +68,9 @@ void Aspect_VKeySet::KeyUp (Aspect_VKey theKey,
double theTime)
{
Standard_Mutex::Sentry aLock (myLock);
if (myKeys[theKey].KStatus == KeyStatus_Pressed)
if (myKeys[theKey].Status == KeyStatus_Pressed)
{
myKeys[theKey].KStatus = KeyStatus_Released;
myKeys[theKey].Status = KeyStatus_Released;
myKeys[theKey].TimeUp = theTime;
}
@@ -97,18 +97,18 @@ void Aspect_VKeySet::KeyFromAxis (Aspect_VKey theNegative,
const Aspect_VKey aKeyUp = thePressure < 0 ? thePositive : theNegative;
KeyDown (aKeyDown, theTime, Abs (thePressure));
if (myKeys[aKeyUp].KStatus == KeyStatus_Pressed)
if (myKeys[aKeyUp].Status == KeyStatus_Pressed)
{
KeyUp (aKeyUp, theTime);
}
}
else
{
if (myKeys[theNegative].KStatus == KeyStatus_Pressed)
if (myKeys[theNegative].Status == KeyStatus_Pressed)
{
KeyUp (theNegative, theTime);
}
if (myKeys[thePositive].KStatus == KeyStatus_Pressed)
if (myKeys[thePositive].Status == KeyStatus_Pressed)
{
KeyUp (thePositive, theTime);
}
@@ -125,7 +125,7 @@ bool Aspect_VKeySet::HoldDuration (Aspect_VKey theKey,
double& thePressure)
{
Standard_Mutex::Sentry aLock (myLock);
switch (myKeys[theKey].KStatus)
switch (myKeys[theKey].Status)
{
case KeyStatus_Free:
{
@@ -134,7 +134,7 @@ bool Aspect_VKeySet::HoldDuration (Aspect_VKey theKey,
}
case KeyStatus_Released:
{
myKeys[theKey].KStatus = KeyStatus_Free;
myKeys[theKey].Status = KeyStatus_Free;
theDuration = myKeys[theKey].TimeUp - myKeys[theKey].TimeDown;
thePressure = myKeys[theKey].Pressure;
return true;

View File

@@ -55,14 +55,14 @@ public:
bool IsFreeKey (Aspect_VKey theKey) const
{
Standard_Mutex::Sentry aLock (myLock);
return myKeys[theKey].KStatus == KeyStatus_Free;
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].KStatus == KeyStatus_Pressed;
return myKeys[theKey].Status == KeyStatus_Pressed;
}
//! Return mutex for thread-safe updates.
@@ -131,10 +131,10 @@ private:
//! Structure defining key state.
struct KeyState
{
KeyState() : TimeDown (0.0), TimeUp (0.0), Pressure (1.0), KStatus (KeyStatus_Free) {}
KeyState() : TimeDown (0.0), TimeUp (0.0), Pressure (1.0), Status (KeyStatus_Free) {}
void Reset()
{
KStatus = KeyStatus_Free;
Status = KeyStatus_Free;
TimeDown = 0.0;
TimeUp = 0.0;
Pressure = 1.0;
@@ -143,7 +143,7 @@ private:
double TimeDown; //!< time of key press event
double TimeUp; //!< time of key release event
double Pressure; //!< key pressure
KeyStatus KStatus; //!< key status
KeyStatus Status; //!< key status
};
private:

View File

@@ -648,8 +648,8 @@ void BOPAlgo_PaveFiller::MakeBlocks()
// check if the pave block has a valid range
Standard_Real aFirst, aLast;
if (!BRepLib::FindValidRange(GeomAdaptor_Curve(aIC.Curve()), aTolR3D,
aT1, BRep_Tool::Pnt(aV1), Max (aTolR3D, BRep_Tool::Tolerance(aV1)),
aT2, BRep_Tool::Pnt(aV2), Max (aTolR3D, BRep_Tool::Tolerance(aV2)),
aT1, BRep_Tool::Pnt(aV1), BRep_Tool::Tolerance(aV1),
aT2, BRep_Tool::Pnt(aV2), BRep_Tool::Tolerance(aV2),
aFirst, aLast))
{
// If the pave block does not have valid range, i.e. it is completely

View File

@@ -41,11 +41,7 @@ static Standard_Integer ClearRepetitions(Draw_Interpretor&, Standard_Integer, co
namespace
{
static BOPAlgo_MakeConnected& getMakeConnectedTool()
{
static BOPAlgo_MakeConnected TheMakeConnectedTool;
return TheMakeConnectedTool;
}
static BOPAlgo_MakeConnected TheMakeConnectedTool;
}
//=======================================================================
@@ -108,7 +104,7 @@ Standard_Integer MakeConnected(Draw_Interpretor& theDI,
return 1;
}
getMakeConnectedTool().Clear();
TheMakeConnectedTool.Clear();
for (Standard_Integer i = 2; i < theArgc; ++i)
{
@@ -118,24 +114,24 @@ Standard_Integer MakeConnected(Draw_Interpretor& theDI,
theDI << "Error: " << theArgv[i] << " is a null shape. Skip it.\n";
continue;
}
getMakeConnectedTool().AddArgument(aS);
TheMakeConnectedTool.AddArgument(aS);
}
getMakeConnectedTool().SetRunParallel(BOPTest_Objects::RunParallel());
TheMakeConnectedTool.SetRunParallel(BOPTest_Objects::RunParallel());
getMakeConnectedTool().Perform();
TheMakeConnectedTool.Perform();
// Print Error/Warning messages
BOPTest::ReportAlerts(getMakeConnectedTool().GetReport());
BOPTest::ReportAlerts(TheMakeConnectedTool.GetReport());
// Set the history of the operation in session
BRepTest_Objects::SetHistory(getMakeConnectedTool().History());
BRepTest_Objects::SetHistory(TheMakeConnectedTool.History());
if (getMakeConnectedTool().HasErrors())
if (TheMakeConnectedTool.HasErrors())
return 0;
// Draw the result shape
const TopoDS_Shape& aResult = getMakeConnectedTool().Shape();
const TopoDS_Shape& aResult = TheMakeConnectedTool.Shape();
DBRep::Set(theArgv[1], aResult);
return 0;
@@ -155,7 +151,7 @@ Standard_Integer MakePeriodic(Draw_Interpretor& theDI,
return 1;
}
if (getMakeConnectedTool().Shape().IsNull() || getMakeConnectedTool().HasErrors())
if (TheMakeConnectedTool.Shape().IsNull() || TheMakeConnectedTool.HasErrors())
{
theDI << "Make the shapes connected first.\n";
return 1;
@@ -214,19 +210,19 @@ Standard_Integer MakePeriodic(Draw_Interpretor& theDI,
}
}
getMakeConnectedTool().MakePeriodic(aParams);
TheMakeConnectedTool.MakePeriodic(aParams);
// Print Error/Warning messages
BOPTest::ReportAlerts(getMakeConnectedTool().GetReport());
BOPTest::ReportAlerts(TheMakeConnectedTool.GetReport());
// Set the history of the operation in session
BRepTest_Objects::SetHistory(getMakeConnectedTool().History());
BRepTest_Objects::SetHistory(TheMakeConnectedTool.History());
if (getMakeConnectedTool().HasErrors())
if (TheMakeConnectedTool.HasErrors())
return 0;
// Draw the result shape
const TopoDS_Shape& aResult = getMakeConnectedTool().PeriodicShape();
const TopoDS_Shape& aResult = TheMakeConnectedTool.PeriodicShape();
DBRep::Set(theArgv[1], aResult);
return 0;
@@ -246,7 +242,7 @@ Standard_Integer RepeatShape(Draw_Interpretor& theDI,
return 1;
}
if (getMakeConnectedTool().PeriodicityTool().HasErrors())
if (TheMakeConnectedTool.PeriodicityTool().HasErrors())
{
theDI << "The shapes have not been made periodic yet.\n";
return 1;
@@ -280,20 +276,20 @@ Standard_Integer RepeatShape(Draw_Interpretor& theDI,
return 1;
}
getMakeConnectedTool().RepeatShape(aDirID, aTimes);
TheMakeConnectedTool.RepeatShape(aDirID, aTimes);
}
// Print Error/Warning messages
BOPTest::ReportAlerts(getMakeConnectedTool().GetReport());
BOPTest::ReportAlerts(TheMakeConnectedTool.GetReport());
// Set the history of the operation in session
BRepTest_Objects::SetHistory(getMakeConnectedTool().History());
BRepTest_Objects::SetHistory(TheMakeConnectedTool.History());
if (getMakeConnectedTool().HasErrors())
if (TheMakeConnectedTool.HasErrors())
return 0;
// Draw the result shape
const TopoDS_Shape& aResult = getMakeConnectedTool().PeriodicShape();
const TopoDS_Shape& aResult = TheMakeConnectedTool.PeriodicShape();
DBRep::Set(theArgv[1], aResult);
return 0;
@@ -335,8 +331,8 @@ Standard_Integer MaterialsOn(Draw_Interpretor& theDI,
}
const TopTools_ListOfShape& aLS = bPositive ?
getMakeConnectedTool().MaterialsOnPositiveSide(aShape) :
getMakeConnectedTool().MaterialsOnNegativeSide(aShape);
TheMakeConnectedTool.MaterialsOnPositiveSide(aShape) :
TheMakeConnectedTool.MaterialsOnNegativeSide(aShape);
TopoDS_Shape aResult;
if (aLS.IsEmpty())
@@ -377,7 +373,7 @@ Standard_Integer GetTwins(Draw_Interpretor& theDI,
return 1;
}
const TopTools_ListOfShape& aTwins = getMakeConnectedTool().PeriodicityTool().GetTwins(aShape);
const TopTools_ListOfShape& aTwins = TheMakeConnectedTool.PeriodicityTool().GetTwins(aShape);
TopoDS_Shape aCTwins;
if (aTwins.IsEmpty())
@@ -405,15 +401,13 @@ Standard_Integer ClearRepetitions(Draw_Interpretor&,
const char **theArgv)
{
// Clear all previous repetitions
getMakeConnectedTool().ClearRepetitions();
TheMakeConnectedTool.ClearRepetitions();
// Set the history of the operation in session
BRepTest_Objects::SetHistory(getMakeConnectedTool().History());
BRepTest_Objects::SetHistory(TheMakeConnectedTool.History());
if (theArgc > 1)
{
DBRep::Set(theArgv[1], getMakeConnectedTool().PeriodicShape());
}
DBRep::Set(theArgv[1], TheMakeConnectedTool.PeriodicShape());
return 0;
}

View File

@@ -37,11 +37,7 @@ static Standard_Integer ClearRepetitions(Draw_Interpretor&, Standard_Integer, co
namespace
{
static BOPAlgo_MakePeriodic& getPeriodicityMaker()
{
static BOPAlgo_MakePeriodic ThePeriodicityMaker;
return ThePeriodicityMaker;
}
static BOPAlgo_MakePeriodic ThePeriodicityMaker;
}
//=======================================================================
@@ -103,8 +99,8 @@ Standard_Integer MakePeriodic(Draw_Interpretor& theDI,
return 1;
}
getPeriodicityMaker().Clear();
getPeriodicityMaker().SetShape(aShape);
ThePeriodicityMaker.Clear();
ThePeriodicityMaker.SetShape(aShape);
for (Standard_Integer i = 3; i < theArgc;)
{
@@ -135,7 +131,7 @@ Standard_Integer MakePeriodic(Draw_Interpretor& theDI,
Standard_Real aPeriod = Draw::Atof(theArgv[++i]);
getPeriodicityMaker().MakePeriodic(aDirID, Standard_True, aPeriod);
ThePeriodicityMaker.MakePeriodic(aDirID, Standard_True, aPeriod);
++i;
if (theArgc > i + 1)
@@ -150,30 +146,28 @@ Standard_Integer MakePeriodic(Draw_Interpretor& theDI,
}
Standard_Real aFirst = Draw::Atof(theArgv[++i]);
getPeriodicityMaker().SetTrimmed(aDirID, Standard_False, aFirst);
ThePeriodicityMaker.SetTrimmed(aDirID, Standard_False, aFirst);
++i;
}
}
}
getPeriodicityMaker().SetRunParallel(BOPTest_Objects::RunParallel());
ThePeriodicityMaker.SetRunParallel(BOPTest_Objects::RunParallel());
// Perform operation
getPeriodicityMaker().Perform();
ThePeriodicityMaker.Perform();
// Print Error/Warning messages
BOPTest::ReportAlerts(getPeriodicityMaker().GetReport());
BOPTest::ReportAlerts(ThePeriodicityMaker.GetReport());
// Set the history of the operation in session
BRepTest_Objects::SetHistory(getPeriodicityMaker().History());
BRepTest_Objects::SetHistory(ThePeriodicityMaker.History());
if (getPeriodicityMaker().HasErrors())
{
if (ThePeriodicityMaker.HasErrors())
return 0;
}
// Draw the result shape
const TopoDS_Shape& aResult = getPeriodicityMaker().Shape();
const TopoDS_Shape& aResult = ThePeriodicityMaker.Shape();
DBRep::Set(theArgv[1], aResult);
return 0;
@@ -201,7 +195,7 @@ Standard_Integer GetTwins(Draw_Interpretor& theDI,
return 1;
}
const TopTools_ListOfShape& aTwins = getPeriodicityMaker().GetTwins(aShape);
const TopTools_ListOfShape& aTwins = ThePeriodicityMaker.GetTwins(aShape);
TopoDS_Shape aCTwins;
if (aTwins.IsEmpty())
@@ -262,22 +256,20 @@ Standard_Integer RepeatShape(Draw_Interpretor& theDI,
return 1;
}
getPeriodicityMaker().RepeatShape(aDirID, aTimes);
ThePeriodicityMaker.RepeatShape(aDirID, aTimes);
}
// Print Error/Warning messages
BOPTest::ReportAlerts(getPeriodicityMaker().GetReport());
BOPTest::ReportAlerts(ThePeriodicityMaker.GetReport());
// Set the history of the operation in session
BRepTest_Objects::SetHistory(getPeriodicityMaker().History());
BRepTest_Objects::SetHistory(ThePeriodicityMaker.History());
if (getPeriodicityMaker().HasErrors())
{
if (ThePeriodicityMaker.HasErrors())
return 0;
}
// Draw the result shape
const TopoDS_Shape& aResult = getPeriodicityMaker().RepeatedShape();
const TopoDS_Shape& aResult = ThePeriodicityMaker.RepeatedShape();
DBRep::Set(theArgv[1], aResult);
return 0;
@@ -292,15 +284,13 @@ Standard_Integer ClearRepetitions(Draw_Interpretor&,
const char **theArgv)
{
// Clear all previous repetitions
getPeriodicityMaker().ClearRepetitions();
ThePeriodicityMaker.ClearRepetitions();
// Set the history of the operation in session
BRepTest_Objects::SetHistory(getPeriodicityMaker().History());
BRepTest_Objects::SetHistory(ThePeriodicityMaker.History());
if (theArgc > 1)
{
DBRep::Set(theArgv[1], getPeriodicityMaker().Shape());
}
DBRep::Set(theArgv[1], ThePeriodicityMaker.Shape());
return 0;
}

View File

@@ -414,8 +414,7 @@ void ProcessVertex(const TopoDS_Vertex& aV,
}
//
// Update Tolerance
// with a small margin
TV->Tolerance(aTolMax2 + aTolMax2*0.0001);
TV->Tolerance(aTolMax2);
}
//=======================================================================
//function : breducetolerance

View File

@@ -576,7 +576,6 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
Standard_Integer aDegMin = -1, aDegMax = -1, aMaxSegments = -1;
Standard_Real aMaxDist = -1;
AppParCurves_Constraint aBndPnt = AppParCurves_TangencyPoint;
Standard_Boolean isExtendSurf = Standard_False;
if ((TolReached2d >= 10. * aTR) && (TolReached2d <= aMaxTol || isAnaSurf))
{
aTR = Min(aMaxTol, 0.1*TolReached2d);
@@ -586,34 +585,12 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
{
aBndPnt = AppParCurves_PassPoint;
}
isExtendSurf = Standard_True;
}
else if(TolReached2d > aMaxTol)
{
aTR = Min(TolReached2d, 1.e3 * aMaxTol);
aMaxDist = 1.e2 * aTR;
aMaxSegments = 100;
isExtendSurf = Standard_True;
}
if (isExtendSurf)
{
Handle(Adaptor3d_Surface) anA3dSurf;
Standard_Real dt = (aBAHS->LastUParameter() - aBAHS->FirstUParameter());
if (!aBAHS->IsUPeriodic() || Abs(dt - aBAHS->UPeriod()) > 0.01 * dt)
{
dt *= 0.01;
anA3dSurf = aBAHS->UTrim(aBAHS->FirstUParameter() - dt, aBAHS->LastUParameter() + dt, 0.);
}
dt = (aBAHS->LastVParameter() - aBAHS->FirstVParameter());
if (!aBAHS->IsVPeriodic() || Abs(dt - aBAHS->VPeriod()) > 0.01 * dt)
{
dt *= 0.01;
anA3dSurf = aBAHS->VTrim(aBAHS->FirstVParameter() - dt, aBAHS->LastVParameter() + dt, 0.);
}
if (!anA3dSurf.IsNull())
{
aProjCurv.Load(anA3dSurf);
}
}
aProjCurv.Load(aTR);
aProjCurv.SetDegree(aDegMin, aDegMax);

View File

@@ -469,34 +469,19 @@ void BRep_Builder::MakeFace(TopoDS_Face& F,
//function : MakeFace
//purpose :
//=======================================================================
void BRep_Builder::MakeFace(TopoDS_Face& theFace,
const Handle(Poly_Triangulation)& theTriangulation) const
void BRep_Builder::MakeFace(TopoDS_Face& F,
const Handle(Poly_Triangulation)& T) const
{
Handle(BRep_TFace) aTFace = new BRep_TFace();
if(!theFace.IsNull() && theFace.Locked())
Handle(BRep_TFace) TF = new BRep_TFace();
if(!F.IsNull() && F.Locked())
{
throw TopoDS_LockedShape("BRep_Builder::MakeFace");
}
aTFace->Triangulation (theTriangulation);
MakeShape (theFace, aTFace);
TF->Triangulation(T);
MakeShape(F, TF);
}
//=======================================================================
//function : MakeFace
//purpose :
//=======================================================================
void BRep_Builder::MakeFace (TopoDS_Face& theFace,
const Poly_ListOfTriangulation& theTriangulations,
const Handle(Poly_Triangulation)& theActiveTriangulation) const
{
Handle(BRep_TFace) aTFace = new BRep_TFace();
if(!theFace.IsNull() && theFace.Locked())
{
throw TopoDS_LockedShape ("BRep_Builder::MakeFace");
}
aTFace->Triangulations (theTriangulations, theActiveTriangulation);
MakeShape (theFace, aTFace);
}
//=======================================================================
//function : MakeFace
@@ -546,19 +531,20 @@ void BRep_Builder::UpdateFace(const TopoDS_Face& F,
//function : UpdateFace
//purpose :
//=======================================================================
void BRep_Builder::UpdateFace (const TopoDS_Face& theFace,
const Handle(Poly_Triangulation)& theTriangulation,
const Standard_Boolean theToReset) const
void BRep_Builder::UpdateFace(const TopoDS_Face& F,
const Handle(Poly_Triangulation)& T) const
{
const Handle(BRep_TFace)& aTFace = *((Handle(BRep_TFace)*) &theFace.TShape());
if(aTFace->Locked())
const Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &F.TShape());
if(TF->Locked())
{
throw TopoDS_LockedShape("BRep_Builder::UpdateFace");
}
aTFace->Triangulation (theTriangulation, theToReset);
theFace.TShape()->Modified (Standard_True);
TF->Triangulation(T);
F.TShape()->Modified(Standard_True);
}
//=======================================================================
//function : UpdateFace
//purpose :

View File

@@ -28,7 +28,7 @@
#include <GeomAbs_Shape.hxx>
#include <Poly_Polygon3D.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
#include <Poly_ListOfTriangulation.hxx>
#include <Poly_Triangulation.hxx>
class Standard_NullObject;
class Standard_DomainError;
@@ -79,26 +79,19 @@ public:
//! Makes a Face with a surface and a location.
Standard_EXPORT void MakeFace (TopoDS_Face& F, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol) const;
//! Makes a theFace with a single triangulation. The triangulation
//! Makes a Face with a triangulation. The triangulation
//! is in the same reference system than the TFace.
Standard_EXPORT void MakeFace (TopoDS_Face& theFace, const Handle(Poly_Triangulation)& theTriangulation) const;
//! Makes a Face with a list of triangulations and active one.
//! Use NULL active triangulation to set the first triangulation in list as active.
//! The triangulations is in the same reference system than the TFace.
Standard_EXPORT void MakeFace (TopoDS_Face& theFace, const Poly_ListOfTriangulation& theTriangulations, const Handle(Poly_Triangulation)& theActiveTriangulation = Handle(Poly_Triangulation)()) const;
Standard_EXPORT void MakeFace (TopoDS_Face& F, const Handle(Poly_Triangulation)& T) const;
//! Updates the face F using the tolerance value Tol,
//! surface S and location Location.
Standard_EXPORT void UpdateFace (const TopoDS_Face& F, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol) const;
//! Changes a face triangulation.
//! A NULL theTriangulation removes face triangulations.
//! If theToReset is TRUE face triangulations will be reset to new list with only one input triangulation that will be active.
//! Else if theTriangulation is contained in internal triangulations list it will be made active,
//! else the active triangulation will be replaced to theTriangulation one.
Standard_EXPORT void UpdateFace (const TopoDS_Face& theFace, const Handle(Poly_Triangulation)& theTriangulation, const Standard_Boolean theToReset = true) const;
//! Changes a face triangulation.
//!
//! A null Triangulation removes the triangulation.
Standard_EXPORT void UpdateFace (const TopoDS_Face& F, const Handle(Poly_Triangulation)& T) const;
//! Updates the face Tolerance.
Standard_EXPORT void UpdateFace (const TopoDS_Face& F, const Standard_Real Tol) const;

View File

@@ -51,131 +51,6 @@ Handle(TopoDS_TShape) BRep_TFace::EmptyCopy() const
return TF;
}
//=======================================================================
//function : Triangulation
//purpose :
//=======================================================================
const Handle(Poly_Triangulation)& BRep_TFace::Triangulation (const Poly_MeshPurpose thePurpose) const
{
if (thePurpose == Poly_MeshPurpose_NONE)
{
return ActiveTriangulation();
}
for (Poly_ListOfTriangulation::Iterator anIter(myTriangulations); anIter.More(); anIter.Next())
{
const Handle(Poly_Triangulation)& aTriangulation = anIter.Value();
if ((aTriangulation->MeshPurpose() & thePurpose) != 0)
{
return aTriangulation;
}
}
if ((thePurpose & Poly_MeshPurpose_AnyFallback) != 0
&& !myTriangulations.IsEmpty())
{
// if none matching other criteria was found return the first defined triangulation
return myTriangulations.First();
}
static const Handle(Poly_Triangulation) anEmptyTriangulation;
return anEmptyTriangulation;
}
//=======================================================================
//function : Triangulation
//purpose :
//=======================================================================
void BRep_TFace::Triangulation (const Handle(Poly_Triangulation)& theTriangulation,
const Standard_Boolean theToReset)
{
if (theToReset || theTriangulation.IsNull())
{
if (!myActiveTriangulation.IsNull())
{
// Reset Active bit
myActiveTriangulation->SetMeshPurpose (myActiveTriangulation->MeshPurpose() & ~Poly_MeshPurpose_Active);
myActiveTriangulation.Nullify();
}
myTriangulations.Clear();
if (!theTriangulation.IsNull())
{
// Reset list of triangulations to new list with only one input triangulation that will be active
myTriangulations.Append (theTriangulation);
myActiveTriangulation = theTriangulation;
// Set Active bit
theTriangulation->SetMeshPurpose (theTriangulation->MeshPurpose() | Poly_MeshPurpose_Active);
}
return;
}
for (Poly_ListOfTriangulation::Iterator anIter(myTriangulations); anIter.More(); anIter.Next())
{
// Make input triangulation active if it is already contained in list of triangulations
if (anIter.Value() == theTriangulation)
{
if (!myActiveTriangulation.IsNull())
{
// Reset Active bit
myActiveTriangulation->SetMeshPurpose (myActiveTriangulation->MeshPurpose() & ~Poly_MeshPurpose_Active);
}
myActiveTriangulation = theTriangulation;
// Set Active bit
theTriangulation->SetMeshPurpose (theTriangulation->MeshPurpose() | Poly_MeshPurpose_Active);
return;
}
}
for (Poly_ListOfTriangulation::Iterator anIter(myTriangulations); anIter.More(); anIter.Next())
{
// Replace active triangulation to input one
if (anIter.Value() == myActiveTriangulation)
{
// Reset Active bit
myActiveTriangulation->SetMeshPurpose (myActiveTriangulation->MeshPurpose() & ~Poly_MeshPurpose_Active);
anIter.ChangeValue() = theTriangulation;
myActiveTriangulation = theTriangulation;
// Set Active bit
theTriangulation->SetMeshPurpose (theTriangulation->MeshPurpose() | Poly_MeshPurpose_Active);
return;
}
}
}
//=======================================================================
//function : Triangulations
//purpose :
//=======================================================================
void BRep_TFace::Triangulations (const Poly_ListOfTriangulation& theTriangulations,
const Handle(Poly_Triangulation)& theActiveTriangulation)
{
if (theTriangulations.IsEmpty())
{
myActiveTriangulation.Nullify();
myTriangulations.Clear();
return;
}
Standard_Boolean anActiveInList = false;
for (Poly_ListOfTriangulation::Iterator anIter(theTriangulations); anIter.More(); anIter.Next())
{
const Handle(Poly_Triangulation)& aTriangulation = anIter.Value();
Standard_ASSERT_RAISE (!aTriangulation.IsNull(), "Try to set list with NULL triangulation to the face");
if (aTriangulation == theActiveTriangulation)
{
anActiveInList = true;
}
// Reset Active bit
aTriangulation->SetMeshPurpose (aTriangulation->MeshPurpose() & ~Poly_MeshPurpose_Active);
}
Standard_ASSERT_RAISE (theActiveTriangulation.IsNull() || anActiveInList, "Active triangulation isn't part of triangulations list");
myTriangulations = theTriangulations;
if (theActiveTriangulation.IsNull())
{
// Save the first one as active
myActiveTriangulation = myTriangulations.First();
}
else
{
myActiveTriangulation = theActiveTriangulation;
}
myActiveTriangulation->SetMeshPurpose (myActiveTriangulation->MeshPurpose() | Poly_MeshPurpose_Active);
}
//=======================================================================
//function : DumpJson
//purpose :
@@ -186,16 +61,10 @@ void BRep_TFace::DumpJson (Standard_OStream& theOStream, Standard_Integer theDep
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TopoDS_TFace)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myActiveTriangulation.get())
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySurface.get())
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTriangulation.get())
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myLocation)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolerance)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNaturalRestriction)
for (Poly_ListOfTriangulation::Iterator anIter(myTriangulations); anIter.More(); anIter.Next())
{
const Handle(Poly_Triangulation)& aTriangulation = anIter.Value();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aTriangulation.get())
}
}

View File

@@ -20,15 +20,16 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Poly_ListOfTriangulation.hxx>
#include <TopLoc_Location.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <TopoDS_TFace.hxx>
class Geom_Surface;
class Poly_Triangulation;
class TopLoc_Location;
class TopoDS_TShape;
class BRep_TFace;
DEFINE_STANDARD_HANDLE(BRep_TFace, TopoDS_TFace)
@@ -41,8 +42,8 @@ DEFINE_STANDARD_HANDLE(BRep_TFace, TopoDS_TFace)
//! True the boundary of the face is known to be the
//! parametric space (Umin, UMax, VMin, VMax).
//!
//! * An optional list of triangulations. If there are any
//! triangulations the surface can be absent.
//! * An optional Triangulation. If there is a
//! triangulation the surface can be absent.
//!
//! The Location is used for the Surface.
//!
@@ -59,51 +60,30 @@ class BRep_TFace : public TopoDS_TFace
public:
//! Creates an empty TFace.
Standard_EXPORT BRep_TFace();
//! Returns face surface.
const Handle(Geom_Surface)& Surface() const { return mySurface; }
//! Sets surface for this face.
void Surface (const Handle(Geom_Surface)& theSurface) { mySurface = theSurface;}
//! Returns the face location.
const TopLoc_Location& Location() const { return myLocation; }
//! Sets the location for this face.
void Location (const TopLoc_Location& theLocation) { myLocation = theLocation; }
//! Returns the face tolerance.
Standard_Real Tolerance() const { return myTolerance; }
//! Sets the tolerance for this face.
void Tolerance (const Standard_Real theTolerance) { myTolerance = theTolerance; }
//! Returns TRUE if the boundary of this face is known to be the parametric space (Umin, UMax, VMin, VMax).
Standard_Boolean NaturalRestriction() const { return myNaturalRestriction; }
//! Sets the flag that is TRUE if the boundary of this face is known to be the parametric space.
void NaturalRestriction (const Standard_Boolean theRestriction) { myNaturalRestriction = theRestriction; }
//! Returns the triangulation of this face according to the mesh purpose.
//! @param theMeshPurpose [in] a mesh purpose to find appropriate triangulation (NONE by default).
//! @return an active triangulation in case of NONE purpose,
//! the first triangulation appropriate for the input purpose,
//! just the first triangulation if none matching other criteria and input purpose is AnyFallback
//! or null handle if there is no any suitable triangulation.
Standard_EXPORT const Handle(Poly_Triangulation)& Triangulation (const Poly_MeshPurpose thePurpose = Poly_MeshPurpose_NONE) const;
//! Sets input triangulation for this face.
//! @param theTriangulation [in] triangulation to be set
//! @param theToReset [in] flag to reset triangulations list to new list with only one input triangulation.
//! If theTriangulation is NULL internal list of triangulations will be cleared and active triangulation will be nullified.
//! If theToReset is TRUE internal list of triangulations will be reset
//! to new list with only one input triangulation that will be active.
//! Else if input triangulation is contained in internal triangulations list it will be made active,
//! else the active triangulation will be replaced to input one.
Standard_EXPORT void Triangulation (const Handle(Poly_Triangulation)& theTriangulation, const Standard_Boolean theToReset = true);
const Handle(Geom_Surface)& Surface() const;
const Handle(Poly_Triangulation)& Triangulation() const;
const TopLoc_Location& Location() const;
Standard_Real Tolerance() const;
void Surface (const Handle(Geom_Surface)& S);
void Triangulation (const Handle(Poly_Triangulation)& T);
void Location (const TopLoc_Location& L);
void Tolerance (const Standard_Real T);
Standard_Boolean NaturalRestriction() const;
void NaturalRestriction (const Standard_Boolean N);
//! Returns a copy of the TShape with no sub-shapes.
//! The new Face has no triangulation.
Standard_EXPORT virtual Handle(TopoDS_TShape) EmptyCopy() const Standard_OVERRIDE;
@@ -111,35 +91,33 @@ public:
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
public:
//! Returns the list of available face triangulations.
const Poly_ListOfTriangulation& Triangulations() const { return myTriangulations; }
//! Sets input list of triangulations and currently active triangulation for this face.
//! If list is empty internal list of triangulations will be cleared and active triangulation will be nullified.
//! Else this list will be saved and the input active triangulation be saved as active.
//! Use NULL active triangulation to set the first triangulation in list as active.
//! Note: the method throws exception if there is any NULL triangulation in input list or
//! if this list doesn't contain input active triangulation.
Standard_EXPORT void Triangulations (const Poly_ListOfTriangulation& theTriangulations, const Handle(Poly_Triangulation)& theActiveTriangulation);
//! Returns number of available face triangulations.
Standard_Integer NbTriangulations() const { return myTriangulations.Size(); }
//! Returns current active triangulation.
const Handle(Poly_Triangulation)& ActiveTriangulation() const { return myActiveTriangulation; }
DEFINE_STANDARD_RTTIEXT(BRep_TFace,TopoDS_TFace)
protected:
private:
Poly_ListOfTriangulation myTriangulations;
Handle(Poly_Triangulation) myActiveTriangulation;
Handle(Geom_Surface) mySurface;
Handle(Poly_Triangulation) myTriangulation;
TopLoc_Location myLocation;
Standard_Real myTolerance;
Standard_Boolean myNaturalRestriction;
};
#include <BRep_TFace.lxx>
#endif // _BRep_TFace_HeaderFile

127
src/BRep/BRep_TFace.lxx Normal file
View File

@@ -0,0 +1,127 @@
// Created on: 1992-08-25
// Created by: Modelistation
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//=======================================================================
//function : Surface
//purpose :
//=======================================================================
inline const Handle(Geom_Surface)& BRep_TFace::Surface()const
{
return mySurface;
}
//=======================================================================
//function : Triangulation
//purpose :
//=======================================================================
inline const Handle(Poly_Triangulation)& BRep_TFace::Triangulation()const
{
return myTriangulation;
}
//=======================================================================
//function : Location
//purpose :
//=======================================================================
inline const TopLoc_Location& BRep_TFace::Location()const
{
return myLocation;
}
//=======================================================================
//function : Tolerance
//purpose :
//=======================================================================
inline Standard_Real BRep_TFace::Tolerance()const
{
return myTolerance;
}
//=======================================================================
//function : Surface
//purpose :
//=======================================================================
inline void BRep_TFace::Surface(const Handle(Geom_Surface)& S)
{
mySurface = S;
}
//=======================================================================
//function : Triangulation
//purpose :
//=======================================================================
inline void BRep_TFace::Triangulation(const Handle(Poly_Triangulation)& T)
{
myTriangulation = T;
}
//=======================================================================
//function : Location
//purpose :
//=======================================================================
inline void BRep_TFace::Location(const TopLoc_Location& L)
{
myLocation = L;
}
//=======================================================================
//function : Tolerance
//purpose :
//=======================================================================
inline void BRep_TFace::Tolerance(const Standard_Real T)
{
myTolerance = T;
}
//=======================================================================
//function : NaturalRestriction
//purpose :
//=======================================================================
inline Standard_Boolean BRep_TFace::NaturalRestriction()const
{
return myNaturalRestriction;
}
//=======================================================================
//function : NaturalRestriction
//purpose :
//=======================================================================
inline void BRep_TFace::NaturalRestriction(const Standard_Boolean N)
{
myNaturalRestriction = N;
}

View File

@@ -113,27 +113,16 @@ Handle(Geom_Surface) BRep_Tool::Surface(const TopoDS_Face& F)
//=======================================================================
//function : Triangulation
//purpose :
//purpose : Returns the Triangulation of the face. It is a
// null handle if there is no triangulation.
//=======================================================================
const Handle(Poly_Triangulation)& BRep_Tool::Triangulation (const TopoDS_Face& theFace,
TopLoc_Location& theLocation,
const Poly_MeshPurpose theMeshPurpose)
{
theLocation = theFace.Location();
const BRep_TFace* aTFace = static_cast<const BRep_TFace*>(theFace.TShape().get());
return aTFace->Triangulation (theMeshPurpose);
}
//=======================================================================
//function : Triangulations
//purpose :
//=======================================================================
const Poly_ListOfTriangulation& BRep_Tool::Triangulations (const TopoDS_Face& theFace,
TopLoc_Location& theLocation)
const Handle(Poly_Triangulation)& BRep_Tool::Triangulation(const TopoDS_Face& F,
TopLoc_Location& L)
{
theLocation = theFace.Location();
const BRep_TFace* aTFace = static_cast<const BRep_TFace*>(theFace.TShape().get());
return aTFace->Triangulations();
L = F.Location();
const BRep_TFace* TF = static_cast<const BRep_TFace*>(F.TShape().get());
return TF->Triangulation();
}
//=======================================================================

View File

@@ -27,7 +27,7 @@
#include <Geom2d_Curve.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Pnt.hxx>
#include <Poly_ListOfTriangulation.hxx>
#include <Poly_Triangulation.hxx>
#include <Poly_Polygon3D.hxx>
#include <Poly_Polygon2D.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
@@ -63,24 +63,11 @@ public:
//! Returns the geometric surface of the face. It can
//! be a copy if there is a Location.
Standard_EXPORT static Handle(Geom_Surface) Surface (const TopoDS_Face& F);
//! Returns the triangulation of the face according to the mesh purpose.
//! @param theFace [in] the input face to find triangulation.
//! @param theLocation [out] the face location.
//! @param theMeshPurpose [in] a mesh purpose to find appropriate triangulation (NONE by default).
//! @return an active triangulation in case of NONE purpose,
//! the first triangulation appropriate for the input purpose,
//! just the first triangulation if none matching other criteria and input purpose is AnyFallback
//! or null handle if there is no any suitable triangulation.
Standard_EXPORT static const Handle(Poly_Triangulation)& Triangulation (const TopoDS_Face& theFace, TopLoc_Location& theLocation,
const Poly_MeshPurpose theMeshPurpose = Poly_MeshPurpose_NONE);
//! Returns all triangulations of the face.
//! @param theFace [in] the input face.
//! @param theLocation [out] the face location.
//! @return list of all available face triangulations.
Standard_EXPORT static const Poly_ListOfTriangulation& Triangulations (const TopoDS_Face& theFace, TopLoc_Location& theLocation);
//! Returns the Triangulation of the face. It is a
//! null handle if there is no triangulation.
Standard_EXPORT static const Handle(Poly_Triangulation)& Triangulation (const TopoDS_Face& F, TopLoc_Location& L);
//! Returns the tolerance of the face.
Standard_EXPORT static Standard_Real Tolerance (const TopoDS_Face& F);

View File

@@ -47,6 +47,7 @@ BRep_TEdge.hxx
BRep_TEdge.lxx
BRep_TFace.cxx
BRep_TFace.hxx
BRep_TFace.lxx
BRep_Tool.cxx
BRep_Tool.hxx
BRep_TVertex.cxx

View File

@@ -42,7 +42,7 @@ void BRepCheck::Add(BRepCheck_ListOfStatus& lst, const BRepCheck_Status stat)
}
else {
if (it.Value() == stat) {
return;
return;
}
it.Next();
}
@@ -55,15 +55,15 @@ void BRepCheck::Add(BRepCheck_ListOfStatus& lst, const BRepCheck_Status stat)
//purpose :
//=======================================================================
Standard_Boolean BRepCheck::SelfIntersection(const TopoDS_Wire& W,
const TopoDS_Face& myFace,
TopoDS_Edge& RetE1,
TopoDS_Edge& RetE2)
const TopoDS_Face& myFace,
TopoDS_Edge& RetE1,
TopoDS_Edge& RetE2)
{
Handle(BRepCheck_Wire) chkw = new BRepCheck_Wire(W);
BRepCheck_Status stat = chkw->SelfIntersect(myFace,RetE1,RetE2);
return (stat == BRepCheck_SelfIntersectingWire);
}
//=======================================================================
//function : PrecCurve
//purpose :
@@ -129,7 +129,7 @@ Standard_Real BRepCheck::PrecSurface(const Handle(Adaptor3d_Surface)& aAHSurf)
//purpose :
//=======================================================================
void BRepCheck::Print(const BRepCheck_Status stat,
Standard_OStream& OS)
Standard_OStream& OS)
{
switch (stat) {
@@ -244,10 +244,6 @@ void BRepCheck::Print(const BRepCheck_Status stat,
case BRepCheck_EnclosedRegion:
OS << "BRepCheck_EnclosedRegion\n";
break;
case BRepCheck_CollapsedEdge:
OS << "BRepCheck_CollapsedEdge\n";
break;
default:
break;
}

View File

@@ -40,7 +40,7 @@
//purpose :
//=======================================================================
void BRepCheck_Analyzer::Init(const TopoDS_Shape& S,
const Standard_Boolean B)
const Standard_Boolean B)
{
if (S.IsNull()) {
throw Standard_NullObject();
@@ -55,7 +55,7 @@ void BRepCheck_Analyzer::Init(const TopoDS_Shape& S,
//purpose :
//=======================================================================
void BRepCheck_Analyzer::Put(const TopoDS_Shape& S,
const Standard_Boolean B)
const Standard_Boolean B)
{
if (!myMap.IsBound(S)) {
Handle(BRepCheck_Result) HR;
@@ -114,7 +114,7 @@ void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
// modified by NIZHNY-MKK Wed May 19 16:56:16 2004.BEGIN
// There is no need to check anything.
// if (myShape.IsSame(S)) {
// myMap(S)->Blind();
// myMap(S)->Blind();
// }
// modified by NIZHNY-MKK Wed May 19 16:56:23 2004.END
@@ -123,66 +123,6 @@ void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
{
Handle(BRepCheck_Result)& aRes = myMap(S);
try
{
BRepCheck_Status ste = Handle(BRepCheck_Edge)::
DownCast(aRes)->CheckTolerance(TopoDS::Edge(S));
if(ste != BRepCheck_NoError)
{
Handle(BRepCheck_Edge)::DownCast(aRes)->SetStatus(ste);
break;
}
}
catch(Standard_Failure)
{
#ifdef DEB
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
#endif
if ( ! myMap(S).IsNull() )
{
myMap(S)->SetFailStatus(S);
}
if ( ! aRes.IsNull() )
{
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
}
}
TopTools_MapOfShape MapS;
for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next())
{
const TopoDS_Shape& aVertex = exp.Current();
try
{
OCC_CATCH_SIGNALS
if (MapS.Add(aVertex))
myMap(aVertex)->InContext(S);
}
catch (Standard_Failure)
{
#ifdef DEB
cout << "BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout << endl;
#endif
if (!myMap(S).IsNull())
myMap(S)->SetFailStatus(S);
Handle(BRepCheck_Result) aVertexRes = myMap(aVertex);
if (!aVertexRes.IsNull())
{
aVertexRes->SetFailStatus(aVertex);
aVertexRes->SetFailStatus(S);
}
}
}
try
{
BRepCheck_Status ste = Handle(BRepCheck_Edge)::
@@ -200,18 +140,18 @@ void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
std::cout<<std::endl;
#endif
(void)anException;
if (!myMap(S).IsNull())
if ( ! myMap(S).IsNull() )
{
myMap(S)->SetFailStatus(S);
}
if ( ! aRes.IsNull() )
if ( ! aRes.IsNull() )
{
aRes->SetFailStatus(S);
}
}
}
TopTools_MapOfShape avertexMap;
TopTools_MapOfShape MapS;
for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next())
{
@@ -219,7 +159,7 @@ void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
try
{
OCC_CATCH_SIGNALS
if (avertexMap.Add(aVertex))
if (MapS.Add(aVertex))
myMap(aVertex)->InContext(S);
}
catch(Standard_Failure const& anException) {
@@ -316,12 +256,6 @@ void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
performwire = Standard_False;
break;
}
//if(ste == BRepCheck_CollapsedEdge)
//{
// isInvalidTolerance = Standard_True;
// break;
//}
}
}
}
@@ -458,15 +392,15 @@ void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
case TopAbs_SOLID:
{
exp.Init(S,TopAbs_SHELL);
exp.Init(S,TopAbs_SHELL);
for (; exp.More(); exp.Next())
{
const TopoDS_Shape& aShell=exp.Current();
const TopoDS_Shape& aShell=exp.Current();
try
{
OCC_CATCH_SIGNALS
myMap(aShell)->InContext(S);
}
OCC_CATCH_SIGNALS
myMap(aShell)->InContext(S);
}
catch(Standard_Failure const& anException) {
#ifdef OCCT_DEBUG
std::cout<<"BRepCheck_Analyzer : ";
@@ -476,19 +410,19 @@ void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
(void)anException;
if ( ! myMap(S).IsNull() )
{
myMap(S)->SetFailStatus(S);
}
myMap(S)->SetFailStatus(S);
}
//
Handle(BRepCheck_Result) aRes = myMap(aShell);
//
Handle(BRepCheck_Result) aRes = myMap(aShell);
if (!aRes.IsNull() )
{
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
}
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
}
}//catch(Standard_Failure)
}//for (; exp.More(); exp.Next())
}
}
break;//case TopAbs_SOLID
default:
break;
@@ -562,10 +496,10 @@ Standard_Boolean BRepCheck_Analyzer::ValidSub
// for (TopExp_Explorer exp(S,SubType);exp.More(); exp.Next()) {
const Handle(BRepCheck_Result)& RV = myMap(exp.Current());
for (RV->InitContextIterator();
RV->MoreShapeInContext();
RV->NextShapeInContext()) {
RV->MoreShapeInContext();
RV->NextShapeInContext()) {
if (RV->ContextualShape().IsSame(S)) {
break;
break;
}
}
@@ -573,7 +507,7 @@ Standard_Boolean BRepCheck_Analyzer::ValidSub
for (itl.Initialize(RV->StatusOnShape()); itl.More(); itl.Next()) {
if (itl.Value() != BRepCheck_NoError) {
return Standard_False;
return Standard_False;
}
}
}

View File

@@ -27,15 +27,6 @@
#include <BRep_PolygonOnTriangulation.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_TFace.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRep_CurveRepresentation.hxx>
#include <BRep_ListOfCurveRepresentation.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_GCurve.hxx>
#include <BRep_CurveOnSurface.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepCheck.hxx>
@@ -49,10 +40,6 @@
#include <Geom_Curve.hxx>
#include <Geom_Plane.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
@@ -73,39 +60,23 @@
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <Precision.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRepCheck_Edge,BRepCheck_Result)
//Golden ratio
static const Standard_Real GoldRatio = (sqrt(5.0)-1)/2.0;
static const Standard_Real DivPoints[] = {
GoldRatio,
1.0-GoldRatio,
4.0*GoldRatio-2.0,
3.0-4.0*GoldRatio,
0.5
};
static const Standard_Integer maxNIter = sizeof(DivPoints)/sizeof(DivPoints[0]);
//modified by NIZNHY-PKV Thu May 05 09:01:57 2011f
static
Standard_Boolean Validate(const Adaptor3d_Curve&,
const Adaptor3d_CurveOnSurface&,
const Standard_Real,
const Standard_Boolean);
const Adaptor3d_CurveOnSurface&,
const Standard_Real,
const Standard_Boolean);
static
void PrintProblematicPoint(const gp_Pnt&,
const Standard_Real,
const Standard_Real);
const Standard_Real,
const Standard_Real);
static
Standard_Real Prec(const Adaptor3d_Curve& aAC3D,
const Adaptor3d_CurveOnSurface& aACS);
const Adaptor3d_CurveOnSurface& aACS);
//static Standard_Boolean Validate(const Adaptor3d_Curve&,
// const Adaptor3d_Curve&,
@@ -147,27 +118,27 @@ void BRepCheck_Edge::Minimum()
Standard_Boolean unique = Standard_True;
// Search for a 3D reference. If no existent one, creates it with the
// first encountered CurveOnSurf; if multiple, chooses the first one...
Standard_Boolean Degenerated = TE->Degenerated();
Standard_Boolean SameParameter = TE->SameParameter();
Standard_Boolean SameRange = TE->SameRange();
if (!SameRange && SameParameter) {
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
// Handle(Geom_Curve) C3d;
// Handle(Geom_Curve) C3d;
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurve3D()) {
if (!exist) {
exist = Standard_True;
}
else {
unique = Standard_False;
}
if (myCref.IsNull() && !cr->Curve3D().IsNull()) {
myCref = cr;
}
if (!exist) {
exist = Standard_True;
}
else {
unique = Standard_False;
}
if (myCref.IsNull() && !cr->Curve3D().IsNull()) {
myCref = cr;
}
}
itcr.Next();
}
@@ -183,12 +154,12 @@ void BRepCheck_Edge::Minimum()
if (myCref.IsNull() && !Degenerated) {
itcr.Initialize(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurveOnSurface()) {
myCref = cr;
break;
}
itcr.Next();
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurveOnSurface()) {
myCref = cr;
break;
}
itcr.Next();
}
}
else if (!myCref.IsNull() && Degenerated){
@@ -201,24 +172,24 @@ void BRepCheck_Edge::Minimum()
Standard_Real First,Last;
GCref->Range(First,Last);
if (Last<=First) {
myCref.Nullify();
BRepCheck::Add(lst,BRepCheck_InvalidRange);
myCref.Nullify();
BRepCheck::Add(lst,BRepCheck_InvalidRange);
}
else {
if (myCref->IsCurve3D()) {
if (myCref->IsCurve3D()) {
// eap 6 Jun 2002 occ332
// better transform C3d instead of transforming Surf upto C3d initial location,
// on transformed BSpline surface 'same parameter' may seem wrong
TopLoc_Location L = myShape.Location() * myCref->Location();
Handle(Geom_Curve) C3d = Handle(Geom_Curve)::DownCast
(myCref->Curve3D()->Transformed
(/*myCref->Location()*/L.Transformation()));
Handle(Geom_Curve) C3d = Handle(Geom_Curve)::DownCast
(myCref->Curve3D()->Transformed
(/*myCref->Location()*/L.Transformation()));
Standard_Boolean IsPeriodic = C3d->IsPeriodic();
Standard_Real aPeriod = RealLast();
if(IsPeriodic)
{
aPeriod = C3d->Period();
}
}
Standard_Real f = C3d->FirstParameter(), l = C3d->LastParameter();
if (C3d->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve))
{
@@ -248,11 +219,11 @@ void BRepCheck_Edge::Minimum()
myHCurve = new GeomAdaptor_Curve(GAC3d);
}
}
else { // curve on surface
Handle(Geom_Surface) Sref = myCref->Surface();
Sref = Handle(Geom_Surface)::DownCast
(Sref->Transformed(myCref->Location().Transformation()));
const Handle(Geom2d_Curve)& PCref = myCref->PCurve();
else { // curve on surface
Handle(Geom_Surface) Sref = myCref->Surface();
Sref = Handle(Geom_Surface)::DownCast
(Sref->Transformed(myCref->Location().Transformation()));
const Handle(Geom2d_Curve)& PCref = myCref->PCurve();
Standard_Boolean IsPeriodic = PCref->IsPeriodic();
Standard_Real aPeriod = RealLast();
if(IsPeriodic)
@@ -286,12 +257,12 @@ void BRepCheck_Edge::Minimum()
Handle(GeomAdaptor_Surface) GAHSref = new GeomAdaptor_Surface(Sref);
Handle(Geom2dAdaptor_Curve) GHPCref =
new Geom2dAdaptor_Curve(PCref,First,Last);
Adaptor3d_CurveOnSurface ACSref(GHPCref,GAHSref);
Adaptor3d_CurveOnSurface ACSref(GHPCref,GAHSref);
myHCurve = new Adaptor3d_CurveOnSurface(ACSref);
}
}
}
}
}
}
if (lst.IsEmpty()) {
lst.Append(BRepCheck_NoError);
}
@@ -318,7 +289,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
Standard_Real Tol = BRep_Tool::Tolerance(TopoDS::Edge(myShape));
TopAbs_ShapeEnum styp = S.ShapeType();
// for (TopExp_Explorer exp(S,TopAbs_EDGE); exp.More(); exp.Next()) {
// for (TopExp_Explorer exp(S,TopAbs_EDGE); exp.More(); exp.Next()) {
TopExp_Explorer exp(S,TopAbs_EDGE) ;
for ( ; exp.More(); exp.Next()) {
if (exp.Current().IsSame(myShape)) {
@@ -329,35 +300,29 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
BRepCheck::Add(lst,BRepCheck_SubshapeNotInShape);
return;
}
switch (styp)
{
case TopAbs_WIRE:
{
//if (CheckTolerance(TopoDS::Edge(myShape)) == BRepCheck_CollapsedEdge)
//{
// BRepCheck::Add(lst,BRepCheck_CollapsedEdge);
// return;
//}
}
break;
case TopAbs_FACE:
if (!myCref.IsNull()) {
Standard_Boolean SameParameter = TE->SameParameter();
Standard_Boolean SameRange = TE->SameRange();
// Modified by skv - Tue Apr 27 11:48:13 2004 Begin
// Modified by skv - Tue Apr 27 11:48:13 2004 Begin
if (!SameParameter || !SameRange) {
if (!SameParameter)
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
if (!SameRange)
BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
if (!SameParameter)
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
if (!SameRange)
BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
return;
return;
}
// Modified by skv - Tue Apr 27 11:48:14 2004 End
// Modified by skv - Tue Apr 27 11:48:14 2004 End
Standard_Real First = myHCurve->FirstParameter();
Standard_Real Last = myHCurve->LastParameter();
@@ -373,12 +338,12 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
Standard_Real eps = Precision::PConfusion();
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
pcurvefound = Standard_True;
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
pcurvefound = Standard_True;
Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr));
Standard_Real f,l;
GC->Range(f,l);
Standard_Real f,l;
GC->Range(f,l);
Standard_Real ff = f, ll = l;
if(myCref->IsCurve3D())
{
@@ -386,13 +351,13 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
ll = myCref->Curve3D()->TransformedParameter(l, Etrsf);
}
// gka OCC
// Modified by skv - Tue Apr 27 11:50:35 2004 Begin
// Modified by skv - Tue Apr 27 11:50:35 2004 Begin
if (Abs(ff-First) > eps ||
Abs(ll-Last) > eps) {
BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
// Modified by skv - Tue Apr 27 11:50:37 2004 End
BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
// Modified by skv - Tue Apr 27 11:50:37 2004 End
//
const Handle(Geom2d_Curve)& pc = cr->PCurve();
Standard_Boolean IsPeriodic = pc->IsPeriodic();
@@ -424,95 +389,95 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
return;
}
if (myGctrl) {
Handle(Geom_Surface) Sb = cr->Surface();
Sb = Handle(Geom_Surface)::DownCast
// (Su->Transformed(L.Transformation()));
(Su->Transformed(/*L*/(Floc * TFloc).Transformation()));
Handle(Geom2d_Curve) PC = cr->PCurve();
if (myGctrl) {
Handle(Geom_Surface) Sb = cr->Surface();
Sb = Handle(Geom_Surface)::DownCast
// (Su->Transformed(L.Transformation()));
(Su->Transformed(/*L*/(Floc * TFloc).Transformation()));
Handle(Geom2d_Curve) PC = cr->PCurve();
Handle(GeomAdaptor_Surface) GAHS = new GeomAdaptor_Surface(Sb);
Handle(Geom2dAdaptor_Curve) GHPC = new Geom2dAdaptor_Curve(PC,f,l);
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
Standard_Boolean ok = Validate (*myHCurve, ACS, Tol, SameParameter);
if (!ok) {
if (cr->IsCurveOnClosedSurface()) {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
}
else {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
}
// Modified by skv - Tue Apr 27 11:53:00 2004 Begin
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
// if (SameParameter) {
// BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
// }
// Modified by skv - Tue Apr 27 11:53:01 2004 End
}
if (cr->IsCurveOnClosedSurface()) {
if (!ok) {
if (cr->IsCurveOnClosedSurface()) {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
}
else {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
}
// Modified by skv - Tue Apr 27 11:53:00 2004 Begin
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
// if (SameParameter) {
// BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
// }
// Modified by skv - Tue Apr 27 11:53:01 2004 End
}
if (cr->IsCurveOnClosedSurface()) {
GHPC->Load(cr->PCurve2(),f,l); // same bounds
ACS.Load(GHPC, GAHS); // sans doute inutile
ok = Validate(*myHCurve,ACS,Tol,SameParameter);
if (!ok) {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
// Modified by skv - Tue Apr 27 11:53:20 2004 Begin
if (SameParameter) {
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
// Modified by skv - Tue Apr 27 11:53:23 2004 End
}
}
}
}
itcr.Next();
if (!ok) {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
// Modified by skv - Tue Apr 27 11:53:20 2004 Begin
if (SameParameter) {
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
// Modified by skv - Tue Apr 27 11:53:23 2004 End
}
}
}
}
itcr.Next();
}
if (!pcurvefound) {
Handle(Geom_Plane) P;
Handle(Standard_Type) dtyp = Su->DynamicType();
if (dtyp == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
P = Handle(Geom_Plane)::DownCast
(Handle(Geom_RectangularTrimmedSurface)::
DownCast(Su)->BasisSurface());
}
else {
P = Handle(Geom_Plane)::DownCast(Su);
}
if (P.IsNull()) { // not a plane
BRepCheck::Add(lst,BRepCheck_NoCurveOnSurface);
}
else { // on fait la projection a la volee, comme BRep_Tool
// plan en position
if (myGctrl) {
P = Handle(Geom_Plane)::
DownCast(P->Transformed(/*L*/(Floc * TFloc).Transformation()));// eap occ332
//on projette Cref sur ce plan
Handle(Geom_Plane) P;
Handle(Standard_Type) dtyp = Su->DynamicType();
if (dtyp == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
P = Handle(Geom_Plane)::DownCast
(Handle(Geom_RectangularTrimmedSurface)::
DownCast(Su)->BasisSurface());
}
else {
P = Handle(Geom_Plane)::DownCast(Su);
}
if (P.IsNull()) { // not a plane
BRepCheck::Add(lst,BRepCheck_NoCurveOnSurface);
}
else { // on fait la projection a la volee, comme BRep_Tool
// plan en position
if (myGctrl) {
P = Handle(Geom_Plane)::
DownCast(P->Transformed(/*L*/(Floc * TFloc).Transformation()));// eap occ332
//on projette Cref sur ce plan
Handle(GeomAdaptor_Surface) GAHS = new GeomAdaptor_Surface(P);
// Dub - Normalement myHCurve est une GeomAdaptor_Curve
Handle(GeomAdaptor_Curve) Gac = Handle(GeomAdaptor_Curve)::DownCast(myHCurve);
Handle(Geom_Curve) C3d = Gac->Curve();
Handle(Geom_Curve) ProjOnPlane =
GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,First,Last),
P, P->Position().Direction(),
Standard_True);
Handle(Geom_Curve) ProjOnPlane =
GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,First,Last),
P, P->Position().Direction(),
Standard_True);
Handle(GeomAdaptor_Curve) aHCurve =
new GeomAdaptor_Curve(ProjOnPlane);
ProjLib_ProjectedCurve proj(GAHS,aHCurve);
Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
ProjLib_ProjectedCurve proj(GAHS,aHCurve);
Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
Handle(Geom2dAdaptor_Curve) GHPC =
new Geom2dAdaptor_Curve(PC,
myHCurve->FirstParameter(),
myHCurve->LastParameter());
myHCurve->FirstParameter(),
myHCurve->LastParameter());
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
Standard_Boolean ok = Validate (*myHCurve, ACS, Tol,Standard_True); // voir dub...
if (!ok) {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
}
}
}
if (!ok) {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
}
}
}
}
}
break;
@@ -522,22 +487,22 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
Standard_Integer nbconnection = 0;
//TopExp_Explorer exp;
for (exp.Init(S,TopAbs_FACE); exp.More(); exp.Next()) {
const TopoDS_Face& fac = TopoDS::Face(exp.Current());
TopExp_Explorer exp2;
for (exp2.Init(fac,TopAbs_EDGE); exp2.More(); exp2.Next()) {
if (exp2.Current().IsSame(myShape)) {
nbconnection++;
}
}
const TopoDS_Face& fac = TopoDS::Face(exp.Current());
TopExp_Explorer exp2;
for (exp2.Init(fac,TopAbs_EDGE); exp2.More(); exp2.Next()) {
if (exp2.Current().IsSame(myShape)) {
nbconnection++;
}
}
}
if (nbconnection < 2 && !TE->Degenerated()) {
BRepCheck::Add(myMap(S),BRepCheck_FreeEdge);
BRepCheck::Add(myMap(S),BRepCheck_FreeEdge);
}
else if (nbconnection > 2) {
BRepCheck::Add(myMap(S),BRepCheck_InvalidMultiConnexity);
BRepCheck::Add(myMap(S),BRepCheck_InvalidMultiConnexity);
}
else {
BRepCheck::Add(myMap(S),BRepCheck_NoError);
BRepCheck::Add(myMap(S),BRepCheck_NoError);
}
}
break;
@@ -557,12 +522,12 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
void BRepCheck_Edge::Blind()
{
// Modified by skv - Tue Apr 27 11:36:01 2004 Begin
// The body of this function is removed because of its useless.
// Modified by skv - Tue Apr 27 11:36:01 2004 Begin
// The body of this function is removed because of its useless.
if (!myBlind) {
myBlind = Standard_True;
}
// Modified by skv - Tue Apr 27 11:36:02 2004 End
// Modified by skv - Tue Apr 27 11:36:02 2004 End
}
@@ -591,14 +556,12 @@ Standard_Boolean BRepCheck_Edge::GeometricControls() const
//function : SetStatus
//purpose :
//=======================================================================
void BRepCheck_Edge::SetStatus(const BRepCheck_Status theStatus)
{
BRepCheck::Add(myMap(myShape),theStatus);
BRepCheck::Add(myMap(myShape),theStatus);
}
//=======================================================================
//function : Tolerance
//purpose :
@@ -628,13 +591,13 @@ Standard_Real BRepCheck_Edge::Tolerance()
//// modified by jgv, 20.03.03 ////
TopLoc_Location Loc = myShape.Location() * cr->Location();
Handle(Geom_Curve) C3d = Handle(Geom_Curve)::DownCast
(cr->Curve3D()->Transformed( Loc.Transformation() ));
(cr->Curve3D()->Transformed( Loc.Transformation() ));
///////////////////////////////////
GeomAdaptor_Curve GAC3d(C3d,First,Last);
it=iRep;
if (iRep>1) {
theRep(iRep)=theRep(1);
it=1;
theRep(iRep)=theRep(1);
it=1;
}
theRep(it) = new GeomAdaptor_Curve(GAC3d);
iRep++;
@@ -642,11 +605,11 @@ Standard_Real BRepCheck_Edge::Tolerance()
else if (cr->IsCurveOnSurface()) {
{
Handle(Geom_Surface) Sref = cr->Surface();
//// modified by jgv, 20.03.03 ////
TopLoc_Location Loc = myShape.Location() * cr->Location();
//// modified by jgv, 20.03.03 ////
TopLoc_Location Loc = myShape.Location() * cr->Location();
Sref = Handle(Geom_Surface)::DownCast
(Sref->Transformed( Loc.Transformation() ));
///////////////////////////////////
///////////////////////////////////
const Handle(Geom2d_Curve)& PCref = cr->PCurve();
Handle(GeomAdaptor_Surface) GAHSref = new GeomAdaptor_Surface(Sref);
Handle(Geom2dAdaptor_Curve) GHPCref =
@@ -656,17 +619,17 @@ Standard_Real BRepCheck_Edge::Tolerance()
iRep++;
}
if (cr->IsCurveOnClosedSurface()) {
Handle(Geom_Surface) Sref = cr->Surface();
Sref = Handle(Geom_Surface)::DownCast
(Sref->Transformed(cr->Location().Transformation()));
const Handle(Geom2d_Curve)& PCref = cr->PCurve2();
Handle(Geom_Surface) Sref = cr->Surface();
Sref = Handle(Geom_Surface)::DownCast
(Sref->Transformed(cr->Location().Transformation()));
const Handle(Geom2d_Curve)& PCref = cr->PCurve2();
Handle(GeomAdaptor_Surface) GAHSref = new GeomAdaptor_Surface(Sref);
Handle(Geom2dAdaptor_Curve) GHPCref =
new Geom2dAdaptor_Curve(PCref,First,Last);
Adaptor3d_CurveOnSurface ACSref(GHPCref,GAHSref);
Adaptor3d_CurveOnSurface ACSref(GHPCref,GAHSref);
theRep(iRep) = new Adaptor3d_CurveOnSurface(ACSref);
iRep++;
nbRep++;
iRep++;
nbRep++;
}
}
else {
@@ -814,136 +777,15 @@ BRepCheck_Status BRepCheck_Edge::
return BRepCheck_NoError;
}
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRep_TVertex.hxx>
#include <DBRep.hxx>
//=======================================================================
//function : CheckTolerance
//purpose : Cheks, if theEdge lies entirely into sphere, center of which
// is middle point of line segment, which joins first and last
// vertex of an edge, and radius is aTol (see function's body).
//=======================================================================
BRepCheck_Status BRepCheck_Edge::CheckTolerance(const TopoDS_Edge& theEdge)
{
BRepCheck_Status aStatus = BRepCheck_NoError;
Standard_Real aTol1 = 1.0e-7, aTol2 = 1.0e-7;
if(BRep_Tool::Degenerated(theEdge))
{
aStatus = BRepCheck_NoError;
return aStatus;
}
TopoDS_Vertex aV1 = TopExp::FirstVertex(theEdge),
aV2 = TopExp::LastVertex(theEdge);
if(aV2.IsNull() || aV1.IsNull())
{
aStatus = BRepCheck_NoError;
return aStatus;
}
gp_Pnt aPnt1, aPnt2;
aPnt1 = BRep_Tool::Pnt(aV1);
aPnt2 = BRep_Tool::Pnt(aV2);
aTol1 = BRep_Tool::Tolerance(aV1);
aTol2 = BRep_Tool::Tolerance(aV2);
if( Precision::IsInfinite(aTol1) ||
Precision::IsInfinite(aTol2))
{
aStatus = BRepCheck_CollapsedEdge;
return aStatus;
}
Standard_Real st = aTol1 + aTol2;
if(aPnt1.SquareDistance(aPnt2) >= st*st)
{
aStatus = BRepCheck_NoError;
return aStatus;
}
gp_Pnt aPn( (aPnt1.X() + aPnt2.X())/2.0,
(aPnt1.Y() + aPnt2.Y())/2.0,
(aPnt1.Z() + aPnt2.Z())/2.0);
const Standard_Real aTol = Max(aTol1,aTol2) + aPnt1.Distance(aPnt2)/2.0;
const Standard_Real aTols = aTol*aTol;
BRepAdaptor_Curve BACurve(theEdge);
const Standard_Real aFirst = BACurve.FirstParameter(),
aLast = BACurve.LastParameter();
const Standard_Real dParam = aLast - aFirst;
for(Standard_Integer i = 0; i < maxNIter; i++)
{
const Standard_Real ParOnC = aFirst + DivPoints[i]*dParam;
gp_Pnt pt = BACurve.Value(ParOnC);
if((aPn.SquareDistance(pt) >= aTols))
{
aStatus = BRepCheck_NoError;
return aStatus;
}
}
gp_Pnt aPFirst = BACurve.Value(aFirst);
gp_Pnt aPLast = BACurve.Value(aLast);
double aFirstLastDist = aPFirst.Distance(aPLast);
double aV1V2Dist = aPnt1.Distance(aPnt2);
TopoDS_Vertex aVFirst = BRepBuilderAPI_MakeVertex(aPFirst);
TopoDS_Vertex aVLast = BRepBuilderAPI_MakeVertex(aPLast);
const Handle(BRep_TEdge)& theTEdge = Handle(BRep_TEdge)::DownCast(theEdge.TShape());
Standard_Boolean sp1 = theTEdge->SameParameter();
Standard_Boolean sr1 = theTEdge->SameRange();
Standard_Boolean dg1 = theTEdge->Degenerated();
Standard_Boolean ch1 = theTEdge->Checked();
Standard_Boolean or1 = theTEdge->Orientable();
Standard_Boolean cl1 = theTEdge->Closed();
Standard_Boolean in1 = theTEdge->Infinite();
Standard_Boolean cv1 = theTEdge->Convex();
//std::cout << std::endl;
//std::cout << (aV1.IsEqual(aV2) ? "Vertexes are equal" : "Vertexes are different") << std::endl;
//std::cout << "aPnt1: " << aPnt1.X() << " " << aPnt1.Y() << " " << aPnt1.Z() << std::endl;
//std::cout << "aPnt2: " << aPnt2.X() << " " << aPnt2.Y() << " " << aPnt2.Z() << std::endl;
//std::cout << (aPnt1.IsEqual(aPFirst, 1E-6) ? "aPnt1 & aPFirst are equal" : "aPnt1 & aPFirst are different") << std::endl;
//std::cout << (aPnt2.IsEqual(aPLast, 1E-6) ? "aPnt2 & aPLast are equal" : "aPnt2 & aPLast are different") << std::endl;
//std::cout << "aPFirst: " << aPFirst.X() << " " << aPFirst.Y() << " " << aPFirst.Z() << std::endl;
//std::cout << "aPLast: " << aPLast.X() << " " << aPLast.Y() << " " << aPLast.Z() << std::endl;
//std::cout << "aTol1: " << aTol1 << " aTol2: " << aTol2 << std::endl;
//std::cout << "aFirstLastDist: " << aFirstLastDist << std::endl;
//std::cout << "aV1V2Dist: " << aV1V2Dist << std::endl;
//std::cout << "Degenerated: " << theTEdge->Degenerated() << std::endl;
//std::cout << "Closed: " << theTEdge->Closed() << std::endl;
static int num(0);
num++;
std::cout << "vertex vf" << num << " " << aPnt1.X() << " " << aPnt1.Y() << " " << aPnt1.Z() << std::endl;
std::cout << "vertex vl" << num << " " << aPnt2.X() << " " << aPnt2.Y() << " " << aPnt2.Z() << std::endl;
aStatus = BRepCheck_CollapsedEdge;
return aStatus;
}
//=======================================================================
//function : Validate
//purpose :
//=======================================================================
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
const Adaptor3d_CurveOnSurface& Other,
const Standard_Real Tol,
const Standard_Boolean SameParameter)
const Adaptor3d_CurveOnSurface& Other,
const Standard_Real Tol,
const Standard_Boolean SameParameter)
{
Standard_Boolean Status, proj;
Standard_Real aPC, First, Last, Error;
@@ -970,17 +812,17 @@ Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
Tol2=Tol2*Tol2;
//Tol2=Tol*Tol;
//modified by NIZNHY-PKV Thu May 05 09:06:47 2011t
for (i = 0; i < NCONTROL; ++i) {
prm = ((NCONTROL-1-i)*First + i*Last)/(NCONTROL-1);
pref = CRef.Value(prm);
pother = Other.Value(prm);
if (pref.SquareDistance(pother) > Tol2) {
problematic_point = pref ;
Status = Standard_False;
Error = pref.Distance(pother);
PrintProblematicPoint(problematic_point, Error, Tol);
return Status;
problematic_point = pref ;
Status = Standard_False;
Error = pref.Distance(pother);
PrintProblematicPoint(problematic_point, Error, Tol);
return Status;
//goto FINISH ;
}
}
@@ -1021,37 +863,37 @@ Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
gp_Pnt pother = Other.Value(oprm);
refd.Perform(pother,rprm);
if (!refd.IsDone() || refd.SquareDistance() > Tol * Tol) {
problematic_point = pref ;
Status = Standard_False ;
if (refd.IsDone()) {
Error = sqrt (refd.SquareDistance());
}
else {
Error = RealLast();
}
PrintProblematicPoint(problematic_point, Error, Tol);
return Status;
problematic_point = pref ;
Status = Standard_False ;
if (refd.IsDone()) {
Error = sqrt (refd.SquareDistance());
}
else {
Error = RealLast();
}
PrintProblematicPoint(problematic_point, Error, Tol);
return Status;
//goto FINISH ;
}
otherd.Perform(pref,oprm);
if (!otherd.IsDone() || otherd.SquareDistance() > Tol * Tol) {
problematic_point = pref ;
Status = Standard_False ;
if (otherd.IsDone()) {
Error = sqrt (otherd.SquareDistance());
}
else {
Error = RealLast();
}
PrintProblematicPoint(problematic_point, Error, Tol);
return Status;
//goto FINISH ;
problematic_point = pref ;
Status = Standard_False ;
if (otherd.IsDone()) {
Error = sqrt (otherd.SquareDistance());
}
else {
Error = RealLast();
}
PrintProblematicPoint(problematic_point, Error, Tol);
return Status;
//goto FINISH ;
}
}
}
return Status ;
}
//=======================================================================
@@ -1059,14 +901,14 @@ Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
//purpose :
//=======================================================================
Standard_Real Prec(const Adaptor3d_Curve& aAC3D,
const Adaptor3d_CurveOnSurface& aACS)
const Adaptor3d_CurveOnSurface& aACS)
{
Standard_Real aXEmax, aXC, aXS;
const Handle(Adaptor3d_Surface)& aAHS = aACS.GetSurface();
//
aXC = BRepCheck::PrecCurve(aAC3D);
aXS = BRepCheck::PrecSurface(aAHS);
aXEmax=(aXC>aXS) ? aXC: aXS;
aXEmax = (aXC>aXS) ? aXC: aXS;
return aXEmax;
}
@@ -1076,8 +918,8 @@ Standard_Real Prec(const Adaptor3d_Curve& aAC3D,
//=======================================================================
#ifdef OCCT_DEBUG
void PrintProblematicPoint(const gp_Pnt& problematic_point,
const Standard_Real Error,
const Standard_Real Tol)
const Standard_Real Error,
const Standard_Real Tol)
{
std::cout << " **** probleme de SameParameter au point :" << std::endl;
std::cout << " " << problematic_point.Coord(1) << " "
@@ -1086,8 +928,8 @@ void PrintProblematicPoint(const gp_Pnt& problematic_point,
}
#else
void PrintProblematicPoint(const gp_Pnt&,
const Standard_Real,
const Standard_Real)
const Standard_Real,
const Standard_Real)
{
}
#endif

View File

@@ -48,8 +48,6 @@ public:
Standard_EXPORT void GeometricControls (const Standard_Boolean B);
Standard_EXPORT Standard_Real Tolerance();
Standard_EXPORT BRepCheck_Status CheckTolerance(const TopoDS_Edge& theEdge);
//! Sets status of Edge;
Standard_EXPORT void SetStatus (const BRepCheck_Status theStatus);

View File

@@ -56,7 +56,6 @@ BRepCheck_BadOrientationOfSubshape,
BRepCheck_InvalidPolygonOnTriangulation,
BRepCheck_InvalidToleranceValue,
BRepCheck_EnclosedRegion,
BRepCheck_CollapsedEdge,
BRepCheck_CheckFail
};

View File

@@ -2969,25 +2969,13 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
// Construction of the shell
TopoDS_Shell shell;
B.MakeShell(shell);
Standard_Integer aNbFaces = 0;
for (ipath=1; ipath<=NbPath; ipath++)
for (isec=1; isec <=NbLaw; isec++)
{
const TopoDS_Shape& face = myFaces->Value(isec, ipath);
for (isec=1; isec <=NbLaw; isec++) {
const TopoDS_Shape& face = myFaces->Value(isec, ipath);
if (!face.IsNull() &&
(face.ShapeType() == TopAbs_FACE) )
{
B.Add(shell, face);
aNbFaces++;
}
(face.ShapeType() == TopAbs_FACE) ) B.Add(shell, face);
}
if (aNbFaces == 0)
{
isDone = Standard_False;
return;
}
TopTools_ListIteratorOfListOfShape It(myAuxShape);
for (; It.More(); It.Next()) {
const TopoDS_Shape& face = It.Value();

View File

@@ -281,30 +281,11 @@ void BRepFill_TrimShellCorner::Perform()
}
}
Standard_Real aMaxTol = 0.;
TopExp_Explorer anExp(myShape1, TopAbs_VERTEX);
for (; anExp.More(); anExp.Next())
{
aMaxTol = Max(aMaxTol, BRep_Tool::Tolerance(TopoDS::Vertex(anExp.Current())));
}
anExp.Init(myShape2, TopAbs_VERTEX);
for (; anExp.More(); anExp.Next())
{
aMaxTol = Max(aMaxTol, BRep_Tool::Tolerance(TopoDS::Vertex(anExp.Current())));
}
Standard_Real aFuzzy = 4.*Precision::Confusion();
BOPAlgo_PaveFiller aPF;
TopTools_ListOfShape aLS;
aLS.Append(myShape1);
aLS.Append(myShape2);
aPF.SetArguments(aLS);
if (aMaxTol < 1.005 * Precision::Confusion())
{
aFuzzy = Max(aPF.FuzzyValue(), aFuzzy);
aPF.SetFuzzyValue(aFuzzy);
}
//
aPF.Perform();
if (aPF.HasErrors()) {
@@ -875,9 +856,6 @@ Standard_Boolean BRepFill_TrimShellCorner::ChooseSection(const TopoDS_Shape& Com
TopoDS_Edge FirstEdge = FindEdgeCloseToBisectorPlane(theFirstVertex,
OldComp,
myAxeOfBisPlane.Axis());
if (FirstEdge.IsNull())
return Standard_False;
iter.Initialize(OldComp);
if (!iter.More())
{
@@ -887,9 +865,7 @@ Standard_Boolean BRepFill_TrimShellCorner::ChooseSection(const TopoDS_Shape& Com
TopoDS_Edge LastEdge = FindEdgeCloseToBisectorPlane(theLastVertex,
OldComp,
myAxeOfBisPlane.Axis());
if (LastEdge.IsNull())
return Standard_False;
BB.Add(NewWire, FirstEdge);
if (!FirstEdge.IsSame(LastEdge))

View File

@@ -92,7 +92,6 @@
#include <BRepTools_ReShape.hxx>
#include <TopTools_DataMapOfShapeReal.hxx>
#include <TopoDS_LockedShape.hxx>
#include <GeomLib_CheckCurveOnSurface.hxx>
#include <algorithm>
@@ -1059,23 +1058,127 @@ static Standard_Boolean EvalTol(const Handle(Geom2d_Curve)& pc,
//function : ComputeTol
//purpose :
//=======================================================================
static Standard_Real ComputeTol(const Handle(Geom_Curve)& theC3d,
const Handle(Geom2d_Curve)& theC2d,
const Handle(Geom_Surface)& theSurf,
const Standard_Real theFPar,
const Standard_Real theLPar)
static Standard_Real ComputeTol(const Handle(Adaptor3d_Curve)& c3d,
const Handle(Adaptor2d_Curve2d)& c2d,
const Handle(Adaptor3d_Surface)& surf,
const Standard_Integer nbp)
{
GeomLib_CheckCurveOnSurface aCOS(theC3d, theSurf, theFPar, theLPar);
aCOS.Perform(theC2d);
if (!aCOS.IsDone())
TColStd_Array1OfReal dist(1,nbp+10);
dist.Init(-1.);
//Adaptor3d_CurveOnSurface cons(c2d,surf);
Standard_Real uf = surf->FirstUParameter(), ul = surf->LastUParameter(),
vf = surf->FirstVParameter(), vl = surf->LastVParameter();
Standard_Real du = 0.01 * (ul - uf), dv = 0.01 * (vl - vf);
Standard_Boolean isUPeriodic = surf->IsUPeriodic(), isVPeriodic = surf->IsVPeriodic();
Standard_Real DSdu = 1./surf->UResolution(1.), DSdv = 1./surf->VResolution(1.);
Standard_Real d2 = 0.;
Standard_Real first = c3d->FirstParameter();
Standard_Real last = c3d->LastParameter();
Standard_Real dapp = -1.;
for (Standard_Integer i = 0; i <= nbp; ++i)
{
return RealLast();
const Standard_Real t = IntToReal(i)/IntToReal(nbp);
const Standard_Real u = first*(1.-t) + last*t;
gp_Pnt Pc3d = c3d->Value(u);
gp_Pnt2d Puv = c2d->Value(u);
if(!isUPeriodic)
{
if(Puv.X() < uf - du)
{
dapp = Max(dapp, DSdu * (uf - Puv.X()));
continue;
}
else if(Puv.X() > ul + du)
{
dapp = Max(dapp, DSdu * (Puv.X() - ul));
continue;
}
}
if(!isVPeriodic)
{
if(Puv.Y() < vf - dv)
{
dapp = Max(dapp, DSdv * (vf - Puv.Y()));
continue;
}
else if(Puv.Y() > vl + dv)
{
dapp = Max(dapp, DSdv * (Puv.Y() - vl));
continue;
}
}
gp_Pnt Pcons = surf->Value(Puv.X(), Puv.Y());
if (Precision::IsInfinite(Pcons.X()) ||
Precision::IsInfinite(Pcons.Y()) ||
Precision::IsInfinite(Pcons.Z()))
{
d2 = Precision::Infinite();
break;
}
Standard_Real temp = Pc3d.SquareDistance(Pcons);
return aCOS.MaxDistance();
dist(i+1) = temp;
d2 = Max (d2, temp);
}
if(Precision::IsInfinite(d2))
{
return d2;
}
d2 = Sqrt(d2);
if(dapp > d2)
{
return dapp;
}
Standard_Boolean ana = Standard_False;
Standard_Real D2 = 0;
Standard_Integer N1 = 0;
Standard_Integer N2 = 0;
Standard_Integer N3 = 0;
for (Standard_Integer i = 1; i<= nbp+10; ++i)
{
if (dist(i) > 0)
{
if (dist(i) < 1.0)
{
++N1;
}
else
{
++N2;
}
}
}
if (N1 > N2 && N2 != 0)
{
N3 = 100*N2/(N1+N2);
}
if (N3 < 10 && N3 != 0)
{
ana = Standard_True;
for (Standard_Integer i = 1; i <= nbp+10; ++i)
{
if (dist(i) > 0 && dist(i) < 1.0)
{
D2 = Max (D2, dist(i));
}
}
}
//d2 = 1.5*sqrt(d2);
d2 = (!ana) ? 1.5 * d2 : 1.5*sqrt(D2);
d2 = Max (d2, 1.e-7);
return d2;
}
//=======================================================================
//function : GetCurve3d
//purpose :
@@ -1167,6 +1270,8 @@ TopoDS_Edge BRepLib::SameParameter(const TopoDS_Edge& theEdge,
BRep_ListIteratorOfListOfCurveRepresentation It(CList);
const Standard_Integer NCONTROL = 22;
Handle(GeomAdaptor_Curve) HC = new GeomAdaptor_Curve();
Handle(Geom2dAdaptor_Curve) HC2d = new Geom2dAdaptor_Curve();
Handle(GeomAdaptor_Surface) HS = new GeomAdaptor_Surface();
@@ -1254,7 +1359,7 @@ TopoDS_Edge BRepLib::SameParameter(const TopoDS_Edge& theEdge,
Standard_Boolean goodpc = 1;
GAC2d.Load(curPC,f3d,l3d);
Standard_Real error = ComputeTol(C3d, curPC, S, f3d, l3d);
Standard_Real error = ComputeTol(HC, HC2d, HS, NCONTROL);
if(error > BigError)
{
@@ -1365,7 +1470,7 @@ TopoDS_Edge BRepLib::SameParameter(const TopoDS_Edge& theEdge,
Standard_Boolean updatepcsov = updatepc;
updatepc = Standard_True;
Standard_Real error1 = ComputeTol(C3d, curPC, S, f3d, l3d);
Standard_Real error1 = ComputeTol(HC, HC2d, HS, NCONTROL);
if(error1 > error) {
bs2d = bs2dsov;
GAC2d.Load(bs2d,f3d,l3d);

View File

@@ -75,7 +75,7 @@
//Number of BRepCheck_Statuses in BRepCheck_Status.hxx file
//(BRepCheck_NoError is not considered, i.e. general status
//is smaller by one specified in file)
static const Standard_Integer NumberOfStatus = 37;
static const Standard_Integer NumberOfStatus = 36;
static char* checkfaultyname = NULL;
Standard_EXPORT void BRepTest_CheckCommands_SetFaultyName(const char* name)
@@ -516,6 +516,7 @@ void ContextualDump(Draw_Interpretor& theCommands,
static void FillProblems(const BRepCheck_Status stat,
Handle(TColStd_HArray1OfInteger)& NbProblems)
{
const Standard_Integer anID = static_cast<Standard_Integer> (stat);
if((NbProblems->Upper() < anID) || (NbProblems->Lower() > anID))
@@ -654,78 +655,9 @@ void StructuralDump(Draw_Interpretor& theCommands,
GetProblemShapes(theAna, theShape, sl, NbProblems);
theMap.Clear();
if(NbProblems->Value(13)>0)
theCommands<<" Edge is collapsed in vertex............... "<<NbProblems->Value(13)<<"\n";
//cout<<" Invalid Degenerated Flag ................. "<<NbProblems->Value(12)<<endl;
if(NbProblems->Value(14)>0)
theCommands<<" Free Edge ................................ "<<NbProblems->Value(14)<<"\n";
//cout<<" Free Edge ................................ "<<NbProblems->Value(14)<<endl;
if(NbProblems->Value(15)>0)
theCommands<<" Invalid MultiConnexity ................... "<<NbProblems->Value(15)<<"\n";
//cout<<" Invalid MultiConnexity ................... "<<NbProblems->Value(15)<<endl;
if(NbProblems->Value(16)>0)
theCommands<<" Invalid Range ............................ "<<NbProblems->Value(16)<<"\n";
//cout<<" Invalid Range ............................ "<<NbProblems->Value(16)<<endl;
if(NbProblems->Value(17)>0)
theCommands<<" Empty Wire ............................... "<<NbProblems->Value(17)<<"\n";
//cout<<" Empty Wire ............................... "<<NbProblems->Value(17)<<endl;
if(NbProblems->Value(18)>0)
theCommands<<" Redundant Edge ........................... "<<NbProblems->Value(18)<<"\n";
//cout<<" Redundant Edge ........................... "<<NbProblems->Value(18)<<endl;
if(NbProblems->Value(19)>0)
theCommands<<" Self Intersecting Wire ................... "<<NbProblems->Value(19)<<"\n";
//cout<<" Self Intersecting Wire ................... "<<NbProblems->Value(19)<<endl;
if(NbProblems->Value(20)>0)
theCommands<<" No Surface ............................... "<<NbProblems->Value(20)<<"\n";
//cout<<" No Surface ............................... "<<NbProblems->Value(20)<<endl;
if(NbProblems->Value(21)>0)
theCommands<<" Invalid Wire ............................. "<<NbProblems->Value(21)<<"\n";
//cout<<" Invalid Wire ............................. "<<NbProblems->Value(21)<<endl;
if(NbProblems->Value(22)>0)
theCommands<<" Redundant Wire ........................... "<<NbProblems->Value(22)<<"\n";
//cout<<" Redundant Wire ........................... "<<NbProblems->Value(22)<<endl;
if(NbProblems->Value(23)>0)
theCommands<<" Intersecting Wires ....................... "<<NbProblems->Value(23)<<"\n";
//cout<<" Intersecting Wires ....................... "<<NbProblems->Value(23)<<endl;
if(NbProblems->Value(24)>0)
theCommands<<" Invalid Imbrication of Wires ............. "<<NbProblems->Value(24)<<"\n";
//cout<<" Invalid Imbrication of Wires ............. "<<NbProblems->Value(24)<<endl;
if(NbProblems->Value(25)>0)
theCommands<<" Empty Shell .............................. "<<NbProblems->Value(25)<<"\n";
//cout<<" Empty Shell .............................. "<<NbProblems->Value(25)<<endl;
if(NbProblems->Value(26)>0)
theCommands<<" Redundant Face ........................... "<<NbProblems->Value(26)<<"\n";
//cout<<" Redundant Face ........................... "<<NbProblems->Value(26)<<endl;
if(NbProblems->Value(27)>0)
theCommands<<" Unorientable Shape ....................... "<<NbProblems->Value(27)<<"\n";
//cout<<" Unorientable Shape ....................... "<<NbProblems->Value(27)<<endl;
if(NbProblems->Value(28)>0)
theCommands<<" Not Closed ............................... "<<NbProblems->Value(28)<<"\n";
//cout<<" Not Closed ............................... "<<NbProblems->Value(28)<<endl;
if(NbProblems->Value(29)>0)
theCommands<<" Not Connected ............................ "<<NbProblems->Value(29)<<"\n";
//cout<<" Not Connected ............................ "<<NbProblems->Value(29)<<endl;
if(NbProblems->Value(30)>0)
theCommands<<" Subshape not in Shape .................... "<<NbProblems->Value(30)<<"\n";
//cout<<" Subshape not in Shape .................... "<<NbProblems->Value(30)<<endl;
if(NbProblems->Value(31)>0)
theCommands<<" Bad Orientation .......................... "<<NbProblems->Value(31)<<"\n";
//cout<<" Bad Orientation .......................... "<<NbProblems->Value(31)<<endl;
if(NbProblems->Value(32)>0)
theCommands<<" Bad Orientation of Subshape .............. "<<NbProblems->Value(32)<<"\n";
//cout<<" Bad Orientation of Subshape .............. "<<NbProblems->Value(32)<<endl;
if(NbProblems->Value(33)>0)
theCommands<<" Invalid tolerance value................... "<<NbProblems->Value(33)<<"\n";
//cout<<" checkshape failure......... .............. "<<NbProblems->Value(33)<<endl;
if(NbProblems->Value(34)>0)
theCommands<<" checkshape failure......... .............. "<<NbProblems->Value(34)<<"\n";
//cout<<" checkshape failure......... .............. "<<NbProblems->Value(34)<<endl;
Standard_Integer aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidPointOnCurve);
if(NbProblems->Value(aProblemID) > 0)
theCommands<<" Invalid Point on Curve ................... "<<NbProblems->Value(aProblemID)<<"\n";
if(NbProblems->Value(34)>0)
theCommands<<" checkshape failure........................ "<<NbProblems->Value(34)<<"\n";
//cout<<" checkshape failure......... .............. "<<NbProblems->Value(32)<<endl;
aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidPointOnCurveOnSurface);
if(NbProblems->Value(aProblemID)>0)
@@ -1150,7 +1082,7 @@ static Standard_Integer shapeG1continuity (Draw_Interpretor& di, Standard_Intege
face1=TopoDS::Face(It.Value());
It.Next();
face2=TopoDS::Face(It.Value());
Standard_Boolean IsSeam = face1.IsEqual(face2);
// calcul des deux pcurves
@@ -1197,13 +1129,13 @@ static Standard_Integer shapeG1continuity (Draw_Interpretor& di, Standard_Intege
{
case 7 : epsG1 = Draw::Atof(a[6]);
Standard_FALLTHROUGH
case 6 : epsC0 = Draw::Atof(a[5]);
case 6 : epsC0 = Draw::Atof(a[5]);
Standard_FALLTHROUGH
case 5 : epsnl = Draw::Atof(a[4]);
case 5 : epsnl = Draw::Atof(a[4]);
Standard_FALLTHROUGH
case 4 : break;
default : return 1;
}
default : return 1;
}
Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;
@@ -1331,11 +1263,11 @@ static Standard_Integer shapeG0continuity (Draw_Interpretor& di, Standard_Intege
{
case 6 : epsC0 = Draw::Atof(a[5]);
Standard_FALLTHROUGH
case 5 : epsnl = Draw::Atof(a[4]);
case 5 : epsnl = Draw::Atof(a[4]);
Standard_FALLTHROUGH
case 4 : break;
default : return 1;
}
default : return 1;
}
Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;
Standard_Boolean isconti = Standard_True;
@@ -1457,20 +1389,20 @@ static Standard_Integer shapeG2continuity (Draw_Interpretor& di, Standard_Intege
nbeval = (Standard_Integer ) Draw::Atof( a[3]);
switch(n)
{
case 9 : maxlen = Draw::Atof(a[8]);
{
case 9 : maxlen = Draw::Atof(a[8]);
Standard_FALLTHROUGH
case 8 : percent = Draw::Atof(a[7]);
case 8 : percent = Draw::Atof(a[7]);
Standard_FALLTHROUGH
case 7 : epsG1 = Draw::Atof(a[6]);
case 7 : epsG1 = Draw::Atof(a[6]);
Standard_FALLTHROUGH
case 6 : epsC0 = Draw::Atof(a[5]);
case 6 : epsC0 = Draw::Atof(a[5]);
Standard_FALLTHROUGH
case 5 : epsnl = Draw::Atof(a[4]);
case 5 : epsnl = Draw::Atof(a[4]);
Standard_FALLTHROUGH
case 4 : break;
default : return 1;
}
default : return 1;
}
Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;

View File

@@ -74,45 +74,17 @@
Standard_IMPORT Draw_Viewer dout;
#endif
static BRepFeat_MakeCylindricalHole& getHole()
{
static BRepFeat_MakeCylindricalHole theHole;
return theHole;
}
static BRepFeat_MakeCylindricalHole theHole;
static Standard_Boolean WithControl = Standard_True;
Standard_Boolean DownCastingEnforcing = Standard_False;
static BRepFeat_MakePrism& getPrism()
{
static BRepFeat_MakePrism thePrism;
return thePrism;
}
static BRepFeat_MakeDPrism& getDPrism()
{
static BRepFeat_MakeDPrism theDPrism;
return theDPrism;
}
static BRepFeat_MakeRevol& getRevol()
{
static BRepFeat_MakeRevol theRevol;
return theRevol;
}
static BRepFeat_MakePipe& getPipe()
{
static BRepFeat_MakePipe thePipe;
return thePipe;
}
static BRepFeat_MakeLinearForm& getLienarForm()
{
static BRepFeat_MakeLinearForm theLF;
return theLF;
}
static BRepFeat_MakeRevolutionForm& getRevolutionForm()
{
static BRepFeat_MakeRevolutionForm theRF;
return theRF;
}
static BRepFeat_MakePrism thePrism;
static BRepFeat_MakeDPrism theDPrism;
static BRepFeat_MakeRevol theRevol;
static BRepFeat_MakePipe thePipe;
static BRepFeat_MakeLinearForm theLF;
static BRepFeat_MakeRevolutionForm theRF;
//Input shapes for Prism, DPrism, Revol, Pipe
static TopoDS_Shape theSbase, thePbase;
@@ -259,27 +231,26 @@ static Standard_Integer HOLE1(Draw_Interpretor& theCommands,
Standard_Real Radius = Draw::Atof(a[9]);
getHole().Init(S, gp_Ax1(Or, Di));
theHole.Init(S, gp_Ax1(Or, Di));
if (narg <= 10) {
getHole().Perform(Radius);
theHole.Perform(Radius);
}
else {
Standard_Real pfrom = Draw::Atof(a[10]);
Standard_Real pto = Draw::Atof(a[11]);
getHole().Perform(Radius, pfrom, pto, WithControl);
theHole.Perform(Radius, pfrom, pto, WithControl);
}
getHole().Build();
if (!getHole().HasErrors())
{
theHole.Build();
if (!theHole.HasErrors()) {
// dout.Clear();
DBRep::Set(a[1], getHole().Shape());
DBRep::Set(a[1], theHole.Shape());
dout.Flush();
return 0;
}
theCommands << "Echec de MakeCylindricalHole";
Print(theCommands, getHole().Status());
Print(theCommands, theHole.Status());
return 1;
}
@@ -294,19 +265,18 @@ static Standard_Integer HOLE2(Draw_Interpretor& theCommands,
Standard_Real Radius = Draw::Atof(a[9]);
getHole().Init(S, gp_Ax1(Or, Di));
getHole().PerformThruNext(Radius, WithControl);
theHole.Init(S, gp_Ax1(Or, Di));
theHole.PerformThruNext(Radius, WithControl);
getHole().Build();
if (!getHole().HasErrors())
{
theHole.Build();
if (!theHole.HasErrors()) {
// dout.Clear();
DBRep::Set(a[1], getHole().Shape());
DBRep::Set(a[1], theHole.Shape());
dout.Flush();
return 0;
}
theCommands << "Echec de MakeCylindricalHole";
Print(theCommands, getHole().Status());
Print(theCommands, theHole.Status());
return 1;
}
@@ -321,17 +291,17 @@ static Standard_Integer HOLE3(Draw_Interpretor& theCommands,
Standard_Real Radius = Draw::Atof(a[9]);
getHole().Init(S, gp_Ax1(Or, Di));
getHole().PerformUntilEnd(Radius, WithControl);
getHole().Build();
if (!getHole().HasErrors()) {
theHole.Init(S, gp_Ax1(Or, Di));
theHole.PerformUntilEnd(Radius, WithControl);
theHole.Build();
if (!theHole.HasErrors()) {
// dout.Clear();
DBRep::Set(a[1], getHole().Shape());
DBRep::Set(a[1], theHole.Shape());
dout.Flush();
return 0;
}
theCommands << "Echec de MakeCylindricalHole";
Print(theCommands, getHole().Status());
Print(theCommands, theHole.Status());
return 1;
}
@@ -348,18 +318,17 @@ static Standard_Integer HOLE4(Draw_Interpretor& theCommands,
Standard_Real Radius = Draw::Atof(a[9]);
Standard_Real Length = Draw::Atof(a[10]);
getHole().Init(S, gp_Ax1(Or, Di));
getHole().PerformBlind(Radius, Length, WithControl);
getHole().Build();
if (!getHole().HasErrors())
{
theHole.Init(S, gp_Ax1(Or, Di));
theHole.PerformBlind(Radius, Length, WithControl);
theHole.Build();
if (!theHole.HasErrors()) {
// dout.Clear();
DBRep::Set(a[1], getHole().Shape());
DBRep::Set(a[1], theHole.Shape());
dout.Flush();
return 0;
}
theCommands << "Echec de MakeCylindricalHole";
Print(theCommands, getHole().Status());
Print(theCommands, theHole.Status());
return 1;
}
@@ -1661,7 +1630,7 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
theSbase = Sbase;
thePbase = Pbase;
theSkface = Skface;
getPrism().Init(Sbase, Pbase, Skface, gp_Dir(X, Y, Z), Fuse, Modify);
thePrism.Init(Sbase, Pbase, Skface, gp_Dir(X, Y, Z), Fuse, Modify);
}
else if (narg == 14) {
rfdef = Standard_True;
@@ -1672,10 +1641,9 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
Standard_Real H1 = Draw::Atof(a[10]);
Standard_Real H2 = Draw::Atof(a[11]);
gp_Ax1 ax1(Or, gp_Dir(X, Y, Z));
getRevolutionForm().Init(Sbase, W, P, ax1, H1, H2, Fuse, Modify);
if (!getRevolutionForm().IsDone())
{
se = getRevolutionForm().CurrentStatusError();
theRF.Init(Sbase, W, P, ax1, H1, H2, Fuse, Modify);
if (!theRF.IsDone()) {
se = theRF.CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
@@ -1692,7 +1660,7 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
theSbase = Sbase;
thePbase = Pbase;
theSkface = Skface;
getRevol().Init(Sbase, Pbase, Skface, gp_Ax1(Or, gp_Dir(X, Y, Z)),
theRevol.Init(Sbase, Pbase, Skface, gp_Ax1(Or, gp_Dir(X, Y, Z)),
Fuse, Modify);
}
else {
@@ -1701,10 +1669,9 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
X = Draw::Atof(a[7]);
Y = Draw::Atof(a[8]);
Z = Draw::Atof(a[9]);
getLienarForm().Init(Sbase, W, P, Direct, gp_Vec(X, Y, Z), Fuse, Modify);
if (!getLienarForm().IsDone())
{
se = getLienarForm().CurrentStatusError();
theLF.Init(Sbase, W, P, Direct, gp_Vec(X, Y, Z), Fuse, Modify);
if (!theLF.IsDone()) {
se = theLF.CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
@@ -1724,7 +1691,7 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
theSbase = Sbase;
thePbase = Pbase;
theSkface = Skface;
getDPrism().Init(Sbase, TopoDS::Face(Pbase), Skface, Angle, Fuse, Modify);
theDPrism.Init(Sbase, TopoDS::Face(Pbase), Skface, Angle, Fuse, Modify);
}
else { // FEATPIPE
TopoDS_Shape aLocalShape(DBRep::Get(a[4], TopAbs_WIRE));
@@ -1744,7 +1711,7 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
theSbase = Sbase;
thePbase = Pbase;
theSkface = Skface;
getPipe().Init(Sbase, Pbase, Skface, Spine, Fuse, Modify);
thePipe.Init(Sbase, Pbase, Skface, Spine, Fuse, Modify);
}
}
return 0;
@@ -1776,7 +1743,7 @@ static Standard_Integer ADD(Draw_Interpretor&,
if (fac.IsNull()) {
return 1;
}
getPrism().Add(edg, fac);
thePrism.Add(edg, fac);
}
}
else if (!strcasecmp("REVOL", a[1])) {
@@ -1796,7 +1763,7 @@ static Standard_Integer ADD(Draw_Interpretor&,
if (fac.IsNull()) {
return 1;
}
getRevol().Add(edg, fac);
theRevol.Add(edg, fac);
}
}
else if (!strcasecmp("PIPE", a[1])) {
@@ -1816,7 +1783,7 @@ static Standard_Integer ADD(Draw_Interpretor&,
if (fac.IsNull()) {
return 1;
}
getPipe().Add(edg, fac);
thePipe.Add(edg, fac);
}
}
else {
@@ -1907,14 +1874,14 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
if (narg == 4) {
Standard_Real Val = Draw::Atof(a[3]);
if (Kas == 1) {
getPrism().Perform(Val);
thePrism.Perform(Val);
}
else if (Kas == 2) {
Val *= (M_PI / 180.);
getRevol().Perform(Val);
theRevol.Perform(Val);
}
else if (Kas == 4) {
getDPrism().Perform(Val);
theDPrism.Perform(Val);
}
else if (Kas == 5) {
theCommands << "invalid command for lf";
@@ -1929,14 +1896,14 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
Standard_Real Val = Draw::Atof(a[3]);
TopoDS_Shape FUntil = DBRep::Get(a[4], TopAbs_SHAPE);
if (Kas == 1) {
getPrism().PerformUntilHeight(FUntil, Val);
thePrism.PerformUntilHeight(FUntil, Val);
}
else if (Kas == 2) {
Val *= (M_PI / 180.);
getRevol().PerformUntilAngle(FUntil, Val);
theRevol.PerformUntilAngle(FUntil, Val);
}
else if (Kas == 4) {
getDPrism().PerformUntilHeight(FUntil, Val);
theDPrism.PerformUntilHeight(FUntil, Val);
}
else {
theCommands << "invalid command for ribs or slots";
@@ -1948,22 +1915,22 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
if (narg == 3) { // Thru all
switch (Kas) {
case 1:
getPrism().PerformThruAll();
thePrism.PerformThruAll();
break;
case 2:
getRevol().PerformThruAll();
theRevol.PerformThruAll();
break;
case 3:
getPipe().Perform();
thePipe.Perform();
break;
case 4:
getDPrism().PerformThruAll();
theDPrism.PerformThruAll();
break;
case 5:
getLienarForm().Perform();
theLF.Perform();
break;
case 6:
getRevolutionForm().Perform();
theRF.Perform();
break;
default:
@@ -1976,17 +1943,17 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
case 1:
{
if (Funtil.IsNull()) {
getPrism().PerformUntilEnd();
thePrism.PerformUntilEnd();
}
else {
getPrism().Perform(Funtil);
thePrism.Perform(Funtil);
}
}
break;
case 2:
{
if (!Funtil.IsNull()) {
getRevol().Perform(Funtil);
theRevol.Perform(Funtil);
}
else {
return 1;
@@ -1995,9 +1962,8 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
break;
case 3:
{
if (!Funtil.IsNull())
{
getPipe().Perform(Funtil);
if (!Funtil.IsNull()) {
thePipe.Perform(Funtil);
}
else {
theCommands << "invalid command for ribs pipe";
@@ -2008,10 +1974,10 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
case 4:
{
if (!Funtil.IsNull()) {
getDPrism().Perform(Funtil);
theDPrism.Perform(Funtil);
}
else {
getDPrism().PerformUntilEnd();
theDPrism.PerformUntilEnd();
}
}
break;
@@ -2040,13 +2006,11 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
switch (Kas) {
case 1:
{
if (Ffrom.IsNull())
{
getPrism().PerformFromEnd(Funtil);
if (Ffrom.IsNull()) {
thePrism.PerformFromEnd(Funtil);
}
else
{
getPrism().Perform(Ffrom, Funtil);
else {
thePrism.Perform(Ffrom, Funtil);
}
}
break;
@@ -2055,7 +2019,7 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
if (Ffrom.IsNull()) {
return 1;
}
getRevol().Perform(Ffrom, Funtil);
theRevol.Perform(Ffrom, Funtil);
}
break;
case 3:
@@ -2063,16 +2027,16 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
if (Ffrom.IsNull()) {
return 1;
}
getPipe().Perform(Ffrom, Funtil);
thePipe.Perform(Ffrom, Funtil);
}
break;
case 4:
{
if (Ffrom.IsNull()) {
getDPrism().PerformFromEnd(Funtil);
theDPrism.PerformFromEnd(Funtil);
}
else {
getDPrism().Perform(Ffrom, Funtil);
theDPrism.Perform(Ffrom, Funtil);
}
}
break;
@@ -2086,16 +2050,15 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
BRepFeat_StatusError se;
switch (Kas) {
case 1:
if (!getPrism().IsDone())
{
se = getPrism().CurrentStatusError();
if (!thePrism.IsDone()) {
se = thePrism.CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
theCommands << aSStream << "\n";
return 1;
}
DBRep::Set(a[2], getPrism());
DBRep::Set(a[2], thePrism);
dout.Flush();
//History
if (BRepTest_Objects::IsHistoryNeeded())
@@ -2104,13 +2067,12 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
anArgs.Append(theSbase);
anArgs.Append(thePbase);
anArgs.Append(theSkface);
BRepTest_Objects::SetHistory(anArgs, getPrism());
BRepTest_Objects::SetHistory(anArgs, thePrism);
}
return 0;
case 2:
if (!getRevol().IsDone())
{
se = getRevol().CurrentStatusError();
if (!theRevol.IsDone()) {
se = theRevol.CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
@@ -2124,15 +2086,14 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
anArgs.Append(theSbase);
anArgs.Append(thePbase);
anArgs.Append(theSkface);
BRepTest_Objects::SetHistory(anArgs, getRevol());
BRepTest_Objects::SetHistory(anArgs, theRevol);
}
DBRep::Set(a[2], getRevol());
DBRep::Set(a[2], theRevol);
dout.Flush();
return 0;
case 3:
if (!getPipe().IsDone())
{
se = getPipe().CurrentStatusError();
if (!thePipe.IsDone()) {
se = thePipe.CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
@@ -2146,15 +2107,14 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
anArgs.Append(theSbase);
anArgs.Append(thePbase);
anArgs.Append(theSkface);
BRepTest_Objects::SetHistory(anArgs, getPipe());
BRepTest_Objects::SetHistory(anArgs, thePipe);
}
DBRep::Set(a[2], getPipe());
DBRep::Set(a[2], thePipe);
dout.Flush();
return 0;
case 4:
if (!getDPrism().IsDone())
{
se = getDPrism().CurrentStatusError();
if (!theDPrism.IsDone()) {
se = theDPrism.CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
@@ -2168,35 +2128,33 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
anArgs.Append(theSbase);
anArgs.Append(thePbase);
anArgs.Append(theSkface);
BRepTest_Objects::SetHistory(anArgs, getDPrism());
BRepTest_Objects::SetHistory(anArgs, theDPrism);
}
DBRep::Set(a[2], getDPrism());
DBRep::Set(a[2], theDPrism);
dout.Flush();
return 0;
case 5:
if (!getLienarForm().IsDone())
{
se = getLienarForm().CurrentStatusError();
if (!theLF.IsDone()) {
se = theLF.CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
theCommands << aSStream << "\n";
return 1;
}
DBRep::Set(a[2], getLienarForm());
DBRep::Set(a[2], theLF);
dout.Flush();
return 0;
case 6:
if (!getRevolutionForm().IsDone())
{
se = getRevolutionForm().CurrentStatusError();
if (!theRF.IsDone()) {
se = theRF.CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
theCommands << aSStream << "\n";
return 1;
}
DBRep::Set(a[2], getRevolutionForm());
DBRep::Set(a[2], theRF);
dout.Flush();
return 0;
default:
@@ -2249,11 +2207,11 @@ static Standard_Integer BOSS(Draw_Interpretor& theCommands,
return 1;
}
getDPrism().BossEdges(dprsig);
theDPrism.BossEdges(dprsig);
TopTools_ListOfShape theTopEdges, theLatEdges;
theTopEdges = getDPrism().TopEdges();
theLatEdges = getDPrism().LatEdges();
theTopEdges = theDPrism.TopEdges();
theLatEdges = theDPrism.LatEdges();
TopTools_ListIteratorOfListOfShape it;
BRep_Builder B;
@@ -2287,7 +2245,7 @@ static Standard_Integer BOSS(Draw_Interpretor& theCommands,
V = DBRep::Get(a[2], TopAbs_SHAPE);
}
else if (Kas == 3) {
V = getDPrism();
V = theDPrism;
}
if (V.IsNull()) return 1;

View File

@@ -29,7 +29,6 @@
#include <GeometryTest.hxx>
#include <Draw_Interpretor.hxx>
#include <Draw_Appli.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <DrawTrSurf.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS.hxx>
@@ -168,13 +167,8 @@ static Standard_Integer plate (Draw_Interpretor & di,Standard_Integer n,const ch
NbPtsCur->Value(i));
Henri.Add(Cont);
}
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
Henri.Perform(aProgress->Start());
if (aProgress->UserBreak())
{
di << "Error: UserBreak\n";
return 0;
}
Henri.Perform();
Standard_Real ErrG0 = 1.1*Henri.G0Error();
//std::cout<<" dist. max = "<<Henri.G0Error()<<" ; angle max = "<<Henri.G1Error()<<std::endl;
@@ -223,7 +217,7 @@ static Standard_Integer plate (Draw_Interpretor & di,Standard_Integer n,const ch
// commande gplate : resultat face egale a la surface approchee
////////////////////////////////////////////////////////////////////////////////
static Standard_Integer gplate (Draw_Interpretor & di,Standard_Integer n,const char** a)
static Standard_Integer gplate (Draw_Interpretor & ,Standard_Integer n,const char** a)
{
if (n < 6 ) return 1;
Standard_Integer NbCurFront=Draw::Atoi(a[2]),
@@ -304,13 +298,7 @@ static Standard_Integer gplate (Draw_Interpretor & di,Standard_Integer n,const c
Henri.Add(PCont);
}
}
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
Henri.Perform(aProgress->Start());
if (aProgress->UserBreak())
{
di << "Error: UserBreak\n";
return 0;
}
Henri.Perform();
Standard_Integer nbcarreau=9;
Standard_Integer degmax=8;
Standard_Real seuil;
@@ -380,13 +368,7 @@ static Standard_Integer approxplate (Draw_Interpretor & di,Standard_Integer n,co
Henri.Add(Cont);
}
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
Henri.Perform(aProgress->Start());
if (aProgress->UserBreak())
{
di << "Error: UserBreak\n";
return 0;
}
Henri.Perform();
Standard_Real dmax = Henri.G0Error(),
anmax = Henri.G1Error();

View File

@@ -19,11 +19,7 @@
#include <Draw_Interpretor.hxx>
#include <Draw_Appli.hxx>
#include <DrawTrSurf.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <BRep_Builder.hxx>
#include <BRepBuilderAPI.hxx>
#include <BRepPreviewAPI_MakeBox.hxx>
@@ -122,7 +118,7 @@ static Standard_Integer box(Draw_Interpretor& , Standard_Integer n, const char**
aParams.SetY (Draw::Atof(a[anArgIter + 4]));
aParams.SetZ (Draw::Atof(a[anArgIter + 5]));
anArgIter += 5;
}
}
else if (aCountReal == 3)
{
@@ -130,7 +126,7 @@ static Standard_Integer box(Draw_Interpretor& , Standard_Integer n, const char**
aParams.SetY (Draw::Atof(a[anArgIter + 1]));
aParams.SetZ (Draw::Atof(a[anArgIter + 2]));
anArgIter += 2;
}
}
else
{
Message::SendFail() << "Syntax error";
@@ -163,7 +159,7 @@ static Standard_Integer box(Draw_Interpretor& , Standard_Integer n, const char**
}
S = aPreview;
DBRep::Set(a[1],S);
DBRep::Set(a[1],S);
}
else
{
@@ -387,78 +383,6 @@ static Standard_Integer torus(Draw_Interpretor& , Standard_Integer n, const char
return 0;
}
//=======================================================================
//function : DrawTolerance
//purpose :
//=======================================================================
static Standard_Integer DrawTolerance(Draw_Interpretor& theDI, Standard_Integer theNArg, const char** a)
{
if(theNArg != 3)
{
theDI << "use toolsphere name vertex\\edge\n";
return 1;
}
TopoDS_Shape aS = DBRep::Get(a[2]);
if(aS.IsNull())
{
theDI << "No source shape found\n";
return 1;
}
Standard_Real aRadius;
gp_Pnt aCenter;
switch(aS.ShapeType())
{
case TopAbs_VERTEX:
{
TopoDS_Vertex aV = TopoDS::Vertex(aS);
aRadius = BRep_Tool::Tolerance(aV);
aCenter = BRep_Tool::Pnt(aV);
}
break;
case TopAbs_EDGE:
{
TopoDS_Edge anE = TopoDS::Edge(DBRep::Get(a[2]));
TopoDS_Vertex aV1 = TopExp::FirstVertex(anE),
aV2 = TopExp::LastVertex(anE);
Standard_Real aTol1 = BRep_Tool::Tolerance(aV1);
Standard_Real aTol2 = BRep_Tool::Tolerance(aV2);
if( Precision::IsInfinite(aTol1) ||
Precision::IsInfinite(aTol2))
{
theDI << "Tolerance is infinity\n";
return 0;
}
gp_Pnt aPnt1 = BRep_Tool::Pnt(aV1);
gp_Pnt aPnt2 = BRep_Tool::Pnt(aV2);
aCenter = gp_Pnt( (aPnt1.X() + aPnt2.X())/2.0,
(aPnt1.Y() + aPnt2.Y())/2.0,
(aPnt1.Z() + aPnt2.Z())/2.0);
aRadius = Max(aTol1,aTol2) + aPnt1.Distance(aPnt2)/2.0;
}
break;
default:
{
theDI << "Enter a vertex or an edge (see help)\n";
return 1;
}
}
TopoDS_Solid S = BRepPrimAPI_MakeSphere(aCenter,aRadius);
DBRep::Set(a[1],S);
return 0;
}
//=======================================================================
@@ -535,9 +459,6 @@ void BRepTest::PrimitiveCommands(Draw_Interpretor& theCommands)
"\n\t\t: - angle2 second angle to create a torus ring segment"
"\n\t\t: - angle angle to create a torus pipe segment",
__FILE__, torus, g);
theCommands.Add("tolsphere", "toolsphere name vertex\\edge (if vertex is given, center of sphere is the \"vertex\", "
"radius is a tolerance of vertex; if edge is given, sphere is built, which is determined in "
"BRepCheck_Edge::CheckTolerance(...) function)",__FILE__,DrawTolerance,g);
}

View File

@@ -36,8 +36,6 @@
#include <Geom_Surface.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Vec2d.hxx>
#include <Message.hxx>
#include <OSD_FileSystem.hxx>
#include <OSD_OpenFile.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
#include <Poly_Triangulation.hxx>
@@ -1022,230 +1020,6 @@ Standard_Boolean BRepTools::Triangulation(const TopoDS_Shape& theShape,
return Standard_True;
}
//=======================================================================
//function : LoadTriangulation
//purpose :
//=======================================================================
Standard_Boolean BRepTools::LoadTriangulation (const TopoDS_Shape& theShape,
const Standard_Integer theTriangulationIdx,
const Standard_Boolean theToSetAsActive,
const Handle(OSD_FileSystem)& theFileSystem)
{
Standard_ASSERT_RAISE (theTriangulationIdx >= -1, "Invalid negative triangulation index!");
Standard_Boolean wasLoaded = false;
BRep_Builder aBuilder;
TopLoc_Location aDummyLoc;
const Handle(OSD_FileSystem)& aFileSystem = !theFileSystem.IsNull() ? theFileSystem : OSD_FileSystem::DefaultFileSystem();
for (TopExp_Explorer aFaceIter (theShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
{
const TopoDS_Face& aFace = TopoDS::Face (aFaceIter.Current());
Handle(Poly_Triangulation) aTriangulation;
if (theTriangulationIdx == -1)
{
// load an active triangulation
aTriangulation = BRep_Tool::Triangulation (aFace, aDummyLoc);
}
else
{
const Poly_ListOfTriangulation& aTriangulations = BRep_Tool::Triangulations (aFace, aDummyLoc);
if (theTriangulationIdx >= aTriangulations.Size())
{
// triangulation index is out of range
continue;
}
Standard_Integer aTriangulationIdx = 0;
for (Poly_ListOfTriangulation::Iterator anIter(aTriangulations);
anIter.More(); anIter.Next(), aTriangulationIdx++)
{
if (aTriangulationIdx != theTriangulationIdx)
{
continue;
}
aTriangulation = anIter.Value();
break;
}
}
if (aTriangulation.IsNull() ||
!aTriangulation->HasDeferredData())
{
// NULL triangulation, already loaded triangulation or triangulation without deferred storage
// cannot be loaded
continue;
}
if (aTriangulation->LoadDeferredData (aFileSystem))
{
wasLoaded = true;
if (theToSetAsActive
&& (theTriangulationIdx != -1)) // triangulation is already active
{
aBuilder.UpdateFace (aFace, aTriangulation, false);
}
}
}
return wasLoaded;
}
//=======================================================================
//function : LoadAllTriangulation
//purpose :
//=======================================================================
Standard_Boolean BRepTools::LoadAllTriangulations (const TopoDS_Shape& theShape,
const Handle(OSD_FileSystem)& theFileSystem)
{
Standard_Boolean wasLoaded = false;
TopLoc_Location aDummyLoc;
const Handle(OSD_FileSystem)& aFileSystem = !theFileSystem.IsNull() ? theFileSystem : OSD_FileSystem::DefaultFileSystem();
for (TopExp_Explorer aFaceIter (theShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
{
const TopoDS_Face& aFace = TopoDS::Face (aFaceIter.Current());
for (Poly_ListOfTriangulation::Iterator anIter (BRep_Tool::Triangulations (aFace, aDummyLoc));
anIter.More(); anIter.Next())
{
const Handle(Poly_Triangulation)& aTriangulation = anIter.Value();
if (aTriangulation.IsNull() ||
!aTriangulation->HasDeferredData())
{
// NULL triangulation, already loaded triangulation or triangulation without deferred storage
// cannot be loaded
continue;
}
wasLoaded = aTriangulation->LoadDeferredData (aFileSystem);
}
}
return wasLoaded;
}
//=======================================================================
//function : UnloadTriangulation
//purpose :
//=======================================================================
Standard_Boolean BRepTools::UnloadTriangulation (const TopoDS_Shape& theShape,
const Standard_Integer theTriangulationIdx)
{
Standard_ASSERT_RAISE (theTriangulationIdx >= -1, "Invalid negative triangulation index!");
Standard_Boolean wasUnloaded = false;
TopLoc_Location aDummyLoc;
for (TopExp_Explorer aFaceIter (theShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
{
const TopoDS_Face& aFace = TopoDS::Face (aFaceIter.Current());
Handle(Poly_Triangulation) aTriangulation;
if (theTriangulationIdx == -1)
{
// unload an active triangulation
aTriangulation = BRep_Tool::Triangulation (aFace, aDummyLoc);
}
else
{
Standard_Integer aTriangulationIdx = 0;
const Poly_ListOfTriangulation& aTriangulations = BRep_Tool::Triangulations (aFace, aDummyLoc);
if (theTriangulationIdx >= aTriangulations.Size())
{
// triangulation index is out of range
continue;
}
for (Poly_ListOfTriangulation::Iterator anIter (aTriangulations);
anIter.More(); anIter.Next(), aTriangulationIdx++)
{
if (aTriangulationIdx != theTriangulationIdx)
{
continue;
}
aTriangulation = anIter.Value();
break;
}
}
if (aTriangulation.IsNull() ||
!aTriangulation->HasDeferredData())
{
// NULL triangulation or triangulation without deferred storage cannot be unloaded
continue;
}
wasUnloaded = aTriangulation->UnloadDeferredData();
}
return wasUnloaded;
}
//=======================================================================
//function : UnloadAllTriangulations
//purpose :
//=======================================================================
Standard_Boolean BRepTools::UnloadAllTriangulations (const TopoDS_Shape& theShape)
{
Standard_Boolean wasUnloaded = false;
TopLoc_Location aDummyLoc;
for (TopExp_Explorer aFaceIter (theShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
{
const TopoDS_Face& aFace = TopoDS::Face (aFaceIter.Current());
Handle(Poly_Triangulation) aTriangulation;
for (Poly_ListOfTriangulation::Iterator anIter (BRep_Tool::Triangulations (aFace, aDummyLoc));
anIter.More(); anIter.Next())
{
aTriangulation = anIter.Value();
if (aTriangulation.IsNull() ||
!aTriangulation->HasDeferredData())
{
// NULL triangulation or triangulation without deferred storage cannot be unloaded
continue;
}
wasUnloaded = aTriangulation->UnloadDeferredData();
}
}
return wasUnloaded;
}
//=======================================================================
//function : ActivateTriangulation
//purpose :
//=======================================================================
Standard_Boolean BRepTools::ActivateTriangulation (const TopoDS_Shape& theShape,
const Standard_Integer theTriangulationIdx,
const Standard_Boolean theToActivateStrictly)
{
Standard_ASSERT_RAISE (theTriangulationIdx > -1, "Invalid negative triangulation index!");
Standard_Boolean wasActivated = false;
BRep_Builder aBuilder;
TopLoc_Location aDummyLoc;
for (TopExp_Explorer aFaceIter (theShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
{
const TopoDS_Face& aFace = TopoDS::Face (aFaceIter.Current());
Standard_Integer aTriangulationIdx = theTriangulationIdx;
const Poly_ListOfTriangulation& aTriangulations = BRep_Tool::Triangulations (aFace, aDummyLoc);
const Standard_Integer aTriangulationsNb = aTriangulations.Size();
if (theTriangulationIdx >= aTriangulationsNb)
{
// triangulation index is out of range
if (theToActivateStrictly)
{
// skip activation
continue;
}
// use last available
aTriangulationIdx = aTriangulationsNb - 1;
}
Handle(Poly_Triangulation) anActiveTriangulation;
Standard_Integer aTriangulationIter = 0;
for (Poly_ListOfTriangulation::Iterator anIter (aTriangulations);
anIter.More(); anIter.Next(), aTriangulationIter++)
{
if (aTriangulationIter != aTriangulationIdx)
{
continue;
}
anActiveTriangulation = anIter.Value();
break;
}
if (anActiveTriangulation.IsNull())
{
continue;
}
aBuilder.UpdateFace (aFace, anActiveTriangulation, false);
wasActivated = true;
}
return wasActivated;
}
//=======================================================================
//function : IsReallyClosed

View File

@@ -54,7 +54,6 @@ class BRepTools_ReShape;
class Geom_Curve;
class Geom2d_Curve;
class Geom_Surface;
class OSD_FileSystem;
//! The BRepTools package provides utilities for BRep
@@ -166,9 +165,7 @@ public:
//! Removes all the pcurves of the edges of <S> that
//! refer to surfaces not belonging to any face of <S>
Standard_EXPORT static void RemoveUnusedPCurves (const TopoDS_Shape& S);
public:
//! Verifies that each Face from the shape has got a triangulation with a deflection smaller or equal to specified one
//! and the Edges a discretization on this triangulation.
//! @param theShape [in] shape to verify
@@ -181,60 +178,7 @@ public:
Standard_EXPORT static Standard_Boolean Triangulation (const TopoDS_Shape& theShape,
const Standard_Real theLinDefl,
const Standard_Boolean theToCheckFreeEdges = Standard_False);
//! Loads triangulation data for each face of the shape
//! from some deferred storage using specified shared input file system
//! @param theShape [in] shape to load triangulations
//! @param theTriangulationIdx [in] index defining what triangulation should be loaded. Starts from 0.
//! -1 is used in specific case to load currently already active triangulation.
//! If some face doesn't contain triangulation with this index, nothing will be loaded for it.
//! Exception will be thrown in case of invalid negative index
//! @param theToSetAsActive [in] flag to activate triangulation after its loading
//! @param theFileSystem [in] shared file system
//! @return TRUE if at least one triangulation is loaded.
Standard_EXPORT static Standard_Boolean LoadTriangulation (const TopoDS_Shape& theShape,
const Standard_Integer theTriangulationIdx = -1,
const Standard_Boolean theToSetAsActive = Standard_False,
const Handle(OSD_FileSystem)& theFileSystem = Handle(OSD_FileSystem)());
//! Releases triangulation data for each face of the shape if there is deferred storage to load it later
//! @param theShape [in] shape to unload triangulations
//! @param theTriangulationIdx [in] index defining what triangulation should be unloaded. Starts from 0.
//! -1 is used in specific case to unload currently already active triangulation.
//! If some face doesn't contain triangulation with this index, nothing will be unloaded for it.
//! Exception will be thrown in case of invalid negative index
//! @return TRUE if at least one triangulation is unloaded.
Standard_EXPORT static Standard_Boolean UnloadTriangulation (const TopoDS_Shape& theShape,
const Standard_Integer theTriangulationIdx = -1);
//! Activates triangulation data for each face of the shape
//! from some deferred storage using specified shared input file system
//! @param theShape [in] shape to activate triangulations
//! @param theTriangulationIdx [in] index defining what triangulation should be activated. Starts from 0.
//! Exception will be thrown in case of invalid negative index
//! @param theToActivateStrictly [in] flag to activate exactly triangulation with defined theTriangulationIdx index.
//! In TRUE case if some face doesn't contain triangulation with this index, active triangulation
//! will not be changed for it. Else the last available triangulation will be activated.
//! @return TRUE if at least one active triangulation was changed.
Standard_EXPORT static Standard_Boolean ActivateTriangulation (const TopoDS_Shape& theShape,
const Standard_Integer theTriangulationIdx,
const Standard_Boolean theToActivateStrictly = false);
//! Loads all available triangulations for each face of the shape
//! from some deferred storage using specified shared input file system
//! @param theShape [in] shape to load triangulations
//! @param theFileSystem [in] shared file system
//! @return TRUE if at least one triangulation is loaded.
Standard_EXPORT static Standard_Boolean LoadAllTriangulations (const TopoDS_Shape& theShape,
const Handle(OSD_FileSystem)& theFileSystem = Handle(OSD_FileSystem)());
//! Releases all available triangulations for each face of the shape if there is deferred storage to load them later
//! @param theShape [in] shape to unload triangulations
//! @return TRUE if at least one triangulation is unloaded.
Standard_EXPORT static Standard_Boolean UnloadAllTriangulations (const TopoDS_Shape& theShape);
public:
//! Returns True if the distance between the two
//! vertices is lower than their tolerance.
Standard_EXPORT static Standard_Boolean Compare (const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);

View File

@@ -34,8 +34,6 @@ IMPLEMENT_STANDARD_RTTIEXT(BVH_ObjectTransient, Standard_Transient)
template class NCollection_Vec2<Standard_Real>;
template class NCollection_Vec3<Standard_Real>;
template class NCollection_Vec4<Standard_Real>;
template class NCollection_Mat3<Standard_Real>;
template class NCollection_Mat4<Standard_Real>;
template class BVH_Box<Standard_Real, 2>;
template class BVH_Box<Standard_Real, 3>;

View File

@@ -2062,18 +2062,8 @@ void ChFi3d_Builder::PerformMoreThreeCorner(const Standard_Integer Jndex,
}
// declaration for plate
//GeomPlate_BuildPlateSurface PSurf(3,10,3,tol2d,tolesp,angular);
//
//Sence of Plate parameters and their preferable values :
// degree is total order of ordinary or mixed derivatives:
// dS/dU, dS/dV have degree 1, d2S/dU2, d2S/dV2, d2S/(dUdV) have degree 2
// nbiter - number of iterations, when surface from previous iteration uses as initial surface for next one
// practically this process does not converge, using "bad" initial surface leads to much more "bad" solution.
// constr is order of constraint: 0 - G0, 1 - G1 ...
// Using constraint order > 0 very often causes unpredicable undulations of solution
Standard_Integer degree = 3, nbcurvpnt = 10, nbiter = 1;
Standard_Integer constr = 1; //G1
GeomPlate_BuildPlateSurface PSurf(degree, nbcurvpnt, nbiter, tol2d, tolesp, angular);
GeomPlate_BuildPlateSurface PSurf(3,10,3,tol2d,tolesp,angular);
// calculation of curves on surface for each stripe
for (ic=0;ic<nedge;ic++) {
gp_Pnt2d p2d1, p2d2;
@@ -2098,10 +2088,9 @@ void ChFi3d_Builder::PerformMoreThreeCorner(const Standard_Integer Jndex,
Adaptor3d_CurveOnSurface CurvOnS (Acurv,Asurf);
Handle(Adaptor3d_CurveOnSurface) HCons =
new Adaptor3d_CurveOnSurface(CurvOnS);
//Order.SetValue(ic,1);
Order.SetValue(ic, constr);
Handle(GeomPlate_CurveConstraint) Cont =
new GeomPlate_CurveConstraint(HCons,Order.Value(ic), nbcurvpnt,tolesp,angular,0.1);
Order.SetValue(ic,1);
Handle(GeomPlate_CurveConstraint) Cont =
new GeomPlate_CurveConstraint(HCons,Order.Value(ic),10,tolesp,angular,0.1);
PSurf.Add(Cont);
// calculate indexes of points and of the curve for the DS

View File

@@ -245,7 +245,6 @@ Standard_Boolean D3DHost_FrameBuffer::registerD3dBuffer (const Handle(OpenGl_Con
return Standard_False;
}
myIsOwnColor = true;
myColorTextures (0)->Release (theCtx.operator->());
myColorTextures (0)->Create (theCtx);

View File

@@ -1,39 +0,0 @@
// Copyright (c) 2021 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 <D3DHost_GraphicDriverFactory.hxx>
#include <D3DHost_GraphicDriver.hxx>
IMPLEMENT_STANDARD_RTTIEXT(D3DHost_GraphicDriverFactory, OpenGl_GraphicDriverFactory)
// =======================================================================
// function : D3DHost_GraphicDriverFactory
// purpose :
// =======================================================================
D3DHost_GraphicDriverFactory::D3DHost_GraphicDriverFactory()
{
myName = "TKD3DHost";
}
// =======================================================================
// function : CreateDriver
// purpose :
// =======================================================================
Handle(Graphic3d_GraphicDriver) D3DHost_GraphicDriverFactory::CreateDriver (const Handle(Aspect_DisplayConnection)& )
{
Handle(D3DHost_GraphicDriver) aDriver = new D3DHost_GraphicDriver();
aDriver->ChangeOptions() = *myDefaultCaps;
aDriver->InitContext();
return aDriver;
}

View File

@@ -1,33 +0,0 @@
// Copyright (c) 2021 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 _D3DHost_GraphicDriverFactory_Header
#define _D3DHost_GraphicDriverFactory_Header
#include <OpenGl_GraphicDriverFactory.hxx>
//! This class for creation of D3DHost_GraphicDriver.
class D3DHost_GraphicDriverFactory : public OpenGl_GraphicDriverFactory
{
DEFINE_STANDARD_RTTIEXT(D3DHost_GraphicDriverFactory, OpenGl_GraphicDriverFactory)
public:
//! Empty constructor.
Standard_EXPORT D3DHost_GraphicDriverFactory();
//! Creates new empty graphic driver.
Standard_EXPORT virtual Handle(Graphic3d_GraphicDriver) CreateDriver (const Handle(Aspect_DisplayConnection)& theDisp) Standard_OVERRIDE;
};
#endif //_D3DHost_GraphicDriverFactory_Header

View File

@@ -87,7 +87,11 @@ D3DHost_View::D3DHost_View (const Handle(Graphic3d_StructureManager)& theMgr,
// =======================================================================
D3DHost_View::~D3DHost_View()
{
ReleaseGlResources (NULL);
if (!myD3dWglFbo.IsNull())
{
myD3dWglFbo->Release (myWorkspace->GetGlContext().operator->());
myD3dWglFbo.Nullify();
}
if (myD3dDevice != NULL)
{
myD3dDevice->Release();
@@ -100,20 +104,6 @@ D3DHost_View::~D3DHost_View()
}
}
// =======================================================================
// function : ReleaseGlResources
// purpose :
// =======================================================================
void D3DHost_View::ReleaseGlResources (const Handle(OpenGl_Context)& theCtx)
{
if (!myD3dWglFbo.IsNull())
{
myD3dWglFbo->Release (theCtx.get());
myD3dWglFbo.Nullify();
}
OpenGl_View::ReleaseGlResources (theCtx);
}
// =======================================================================
// function : D3dColorSurface
// purpose :

View File

@@ -40,9 +40,6 @@ public:
//! Default destructor.
Standard_EXPORT virtual ~D3DHost_View();
//! Release OpenGL resources.
Standard_EXPORT virtual void ReleaseGlResources (const Handle(OpenGl_Context)& theCtx) Standard_OVERRIDE;
//! Creates and maps rendering window to the view.
//! @param theWindow [in] the window.
//! @param theContext [in] the rendering context. If NULL the context will be created internally.

View File

@@ -1,7 +1,5 @@
D3DHost_GraphicDriver.hxx
D3DHost_GraphicDriver.cxx
D3DHost_GraphicDriverFactory.hxx
D3DHost_GraphicDriverFactory.cxx
D3DHost_FrameBuffer.hxx
D3DHost_FrameBuffer.cxx
D3DHost_View.hxx

View File

@@ -1,33 +0,0 @@
// Copyright (c) 2021 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 <D3DHostTest.hxx>
#include <Draw_PluginMacro.hxx>
#include <D3DHost_GraphicDriverFactory.hxx>
// ======================================================================
// function : Factory
// purpose :
// ======================================================================
void D3DHostTest::Factory (Draw_Interpretor& )
{
static const Handle(D3DHost_GraphicDriverFactory) aFactory = new D3DHost_GraphicDriverFactory();
Graphic3d_GraphicDriverFactory::RegisterFactory (aFactory);
#ifdef DEB
theDI << "Draw Plugin : D3DHost commands are loaded.\n";
#endif
}
// Declare entry point PLUGINFACTORY
DPLUGIN(D3DHostTest)

View File

@@ -1,2 +0,0 @@
D3DHostTest.cxx
D3DHostTest.hxx

View File

@@ -343,21 +343,11 @@ static Standard_Integer dversion(Draw_Interpretor& di, Standard_Integer, const c
#elif defined(_DEBUG)
di << "Debug mode\n";
#endif
#ifdef HAVE_TK
di << "Tk enabled (HAVE_TK)\n";
#else
di << "Tk disabled\n";
#endif
#ifdef HAVE_TBB
di << "TBB enabled (HAVE_TBB)\n";
#else
di << "TBB disabled\n";
#endif
#ifdef HAVE_FREETYPE
di << "FreeType enabled (HAVE_FREETYPE)\n";
#else
di << "FreeType disabled\n";
#endif
#ifdef HAVE_FREEIMAGE
di << "FreeImage enabled (HAVE_FREEIMAGE)\n";
#else
@@ -368,11 +358,10 @@ static Standard_Integer dversion(Draw_Interpretor& di, Standard_Integer, const c
#else
di << "FFmpeg disabled\n";
#endif
#ifdef HAVE_OPENGL_EXT
di << "OpenGL: enabled (HAVE_OPENGL_EXT)\n";
#endif
#ifdef HAVE_GLES2_EXT
di << "OpenGL ES: enabled (HAVE_GLES2_EXT)\n";
#ifdef HAVE_GLES2
di << "OpenGL: ES2\n";
#else
di << "OpenGL: desktop\n";
#endif
#ifdef HAVE_OPENVR
di << "OpenVR enabled (HAVE_OPENVR)\n";

View File

@@ -28,7 +28,6 @@
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <Image_AlienPixMap.hxx>
#include <Message.hxx>
#include <NCollection_List.hxx>
extern Standard_Boolean Draw_Batch;
@@ -110,7 +109,6 @@ defaultPrompt:
#include <Draw_Window.hxx>
#include <unistd.h>
#ifdef HAVE_TK
#if defined(__APPLE__) && !defined(MACOSX_USE_GLX)
// use forward declaration for small subset of used Tk functions
// to workaround broken standard Tk framework installation within OS X SDKs
@@ -129,7 +127,6 @@ defaultPrompt:
#else
#include <tk.h>
#endif
#endif
/*
* Global variables used by the main program:
@@ -929,38 +926,41 @@ void Draw_Window::WConfigureNotify(const Standard_Integer,
//function : WUnmapNotify
//purpose :
//=======================================================================
void Draw_Window::WUnmapNotify()
{
}
//======================================================
// function : ProcessEvents
// purpose : process pending X events
//======================================================
static void ProcessEvents(ClientData,int)
{
// test for X Event
while (XPending (Draw_WindowDisplay))
{
XEvent anEvent = {};
XNextEvent (Draw_WindowDisplay, &anEvent);
// search the window in the window list
bool isFound = false;
for (Draw_Window* aWinIter = Draw_Window::firstWindow; aWinIter != NULL; aWinIter = aWinIter->next)
{
if (anEvent.xany.window == aWinIter->win)
{
ProcessEvent (*aWinIter, anEvent);
isFound = true;
while (XPending(Draw_WindowDisplay)) {
XEvent xev;
xev.type = 0;
XNextEvent(Draw_WindowDisplay,&xev);
/* search the window in the window list */
Draw_Window* w = Draw_Window::firstWindow;
Standard_Integer found=0;
while (w) {
if (xev.xany.window == w->win) {
ProcessEvent(*w, xev);
found=1;
break;
}
w = w->next;
}
if (!isFound)
{
#ifdef _TK
Tk_HandleEvent (&anEvent);
#endif
if (found==0) {
Tk_HandleEvent(&xev);
}
}
}
@@ -998,59 +998,96 @@ void GetNextEvent(Event& ev)
// function :Run_Appli
// purpose :
//======================================================
static Standard_Boolean(*Interprete) (const char*);
void Run_Appli(Standard_Boolean (*interprete) (const char*))
{
Tcl_Channel outChannel, inChannel ;
Interprete = interprete;
// Commands will come from standard input, so set up an event handler for standard input.
// If the input device is aEvaluate the .rc file, if one has been specified,
// set up an event handler for standard input, and print a prompt if the input device is a terminal.
Tcl_Channel anInChannel = Tcl_GetStdChannel(TCL_STDIN);
if (anInChannel)
{
Tcl_CreateChannelHandler (anInChannel, TCL_READABLE, StdinProc, (ClientData )anInChannel);
}
#ifdef _TK
/*
* Commands will come from standard input, so set up an event
* handler for standard input. If the input device is aEvaluate the
* .rc file, if one has been specified, set up an event handler
* for standard input, and print a prompt if the input
* device is a terminal.
*/
inChannel = Tcl_GetStdChannel(TCL_STDIN);
if (inChannel) {
Tcl_CreateChannelHandler(inChannel, TCL_READABLE, StdinProc,
(ClientData) inChannel);
}
// Create a handler for the draw display
// Adding of the casting into void* to be able to compile on AO1
// ConnectionNumber(Draw_WindowDisplay) is an int 32 bits
// (void*) is a pointer 64 bits ???????
#if !defined(__APPLE__) || defined(MACOSX_USE_GLX)
Tcl_CreateFileHandler (ConnectionNumber(Draw_WindowDisplay), TCL_READABLE, ProcessEvents, (ClientData) 0);
#if TCL_MAJOR_VERSION < 8
Tk_CreateFileHandler((void*) ConnectionNumber(Draw_WindowDisplay),
TK_READABLE, ProcessEvents,(ClientData) 0 );
#else
Tk_CreateFileHandler(ConnectionNumber(Draw_WindowDisplay),
TK_READABLE, ProcessEvents,(ClientData) 0 );
#endif
#endif // __APPLE__
#endif
Draw_Interpretor& aCommands = Draw::GetInterpretor();
if (tty) { Prompt (aCommands.Interp(), 0); }
Prompt (aCommands.Interp(), 0);
if (tty) Prompt(aCommands.Interp(), 0);
Prompt(aCommands.Interp(), 0);
Tcl_Channel anOutChannel = Tcl_GetStdChannel(TCL_STDOUT);
if (anOutChannel)
{
Tcl_Flush (anOutChannel);
}
Tcl_DStringInit (&command);
outChannel = Tcl_GetStdChannel(TCL_STDOUT);
if (outChannel) {
Tcl_Flush(outChannel);
}
Tcl_DStringInit(&command);
/*
* Loop infinitely, waiting for commands to execute. When there
* are no windows left, Tk_MainLoop returns and we exit.
*/
#ifdef _TK
if (Draw_VirtualWindows)
{
if (Draw_VirtualWindows) {
// main window will never shown
// but main loop will parse all Xlib messages
Tcl_Eval(aCommands.Interp(), "wm withdraw .");
}
// Loop infinitely, waiting for commands to execute.
// When there are no windows left, Tk_MainLoop returns and we exit.
Tk_MainLoop();
#else
for (;;)
{
Tcl_DoOneEvent (0); // practically the same as Tk_MainLoop()
}
#endif
for (NCollection_List<Draw_Window::FCallbackBeforeTerminate>::Iterator anIter (MyCallbacks);
anIter.More(); anIter.Next())
#else
fd_set readset;
Standard_Integer count = ConnectionNumber(Draw_WindowDisplay);
Standard_Integer numfd;
while (1) {
FD_ZERO(&readset);
FD_SET(0,&readset);
FD_SET(count,&readset);
#ifdef HPUX
numfd = select(count+1,(Integer*)&readset,NULL,NULL,NULL);
#else
numfd = select(count+1,&readset,NULL,NULL,NULL);
#endif
if (FD_ISSET(0,&readset)) StdinProc((ClientData)0,0);
if (FD_ISSET(count,&readset)) ProcessEvents((ClientData)0,0);
}
#endif
NCollection_List<Draw_Window::FCallbackBeforeTerminate>::Iterator Iter(MyCallbacks);
for(; Iter.More(); Iter.Next())
{
(*anIter.Value())();
(*Iter.Value())();
}
}
@@ -1065,15 +1102,11 @@ Standard_Boolean Init_Appli()
Tcl_Interp *interp = aCommands.Interp();
Tcl_Init (interp);
#ifdef _TK
try
{
try {
OCC_CATCH_SIGNALS
Tk_Init (interp);
}
catch (Standard_Failure const& theFail)
{
Message::SendFail() << "TK_Init() failed with " << theFail;
Tk_Init(interp) ;
} catch (Standard_Failure const&) {
std::cout <<" Pb au lancement de TK_Init "<<std::endl;
}
Tcl_StaticPackage(interp, "Tk", Tk_Init, (Tcl_PackageInitProc *) NULL);
@@ -1094,7 +1127,6 @@ Standard_Boolean Init_Appli()
#endif
Tk_GeometryRequest (aMainWindow, 200, 200);
#endif
#if !defined(__APPLE__) || defined(MACOSX_USE_GLX)
if (Draw_DisplayConnection.IsNull())
@@ -1103,9 +1135,9 @@ Standard_Boolean Init_Appli()
{
Draw_DisplayConnection = new Aspect_DisplayConnection();
}
catch (Standard_Failure const& theFail)
catch (Standard_Failure const&)
{
std::cout << "Cannot open display (" << theFail << "). Interpret commands in batch mode." << std::endl;
std::cout << "Cannot open display. Interpret commands in batch mode." << std::endl;
return Standard_False;
}
}
@@ -1281,9 +1313,7 @@ prompt:
#include <Draw_Appli.hxx>
#include <OSD.hxx>
#ifdef HAVE_TK
#include <tk.h>
#endif
#include <tk.h>
#define PENWIDTH 1
#define CLIENTWND 0

View File

@@ -934,12 +934,6 @@ help checktrinfo {
Use: checktrinfo shapename [options...]
Allowed options are:
-face [N]: compare current number of faces in "shapename" mesh with given reference data.
If reference value N is not given and current number of faces is equal to 0
procedure checktrinfo will print an error.
-empty[N]: compare current number of empty faces in "shapename" mesh with given reference data.
If reference value N is not given and current number of empty faces is greater that 0
procedure checktrinfo will print an error.
-tri [N]: compare current number of triangles in "shapename" mesh with given reference data.
If reference value N is not given and current number of triangles is equal to 0
procedure checktrinfo will print an error.
@@ -967,8 +961,6 @@ proc checktrinfo {shape args} {
return
}
set ref_nb_faces false
set ref_nb_empty_faces true
set ref_nb_triangles false
set ref_nb_nodes false
set ref_deflection false
@@ -981,9 +973,7 @@ proc checktrinfo {shape args} {
set max_defl -1
set ref_info ""
set options {{"-face" ref_nb_faces ?}
{"-empty" ref_nb_empty_faces ?}
{"-tri" ref_nb_triangles ?}
set options {{"-tri" ref_nb_triangles ?}
{"-nod" ref_nb_nodes ?}
{"-defl" ref_deflection ?}
{"-tol_abs_defl" tol_abs_defl 1}
@@ -997,52 +987,20 @@ proc checktrinfo {shape args} {
_check_args ${args} ${options} "checktrinfo"
# get current number of faces, triangles and nodes, value of max deflection
# get current number of triangles and nodes, value of max deflection
set tri_info [trinfo ${shape}]
set triinfo_pattern "(\[0-9\]+) +faces(.*\[^0-9]\(\[0-9\]+) +empty faces)?.*\[^0-9]\(\[0-9\]+) +triangles.*\[^0-9]\(\[0-9\]+) +nodes.*deflection +(\[-0-9.+eE\]+)"
if {![regexp "${triinfo_pattern}" ${tri_info} dump cur_nb_faces tmp cur_nb_empty_faces cur_nb_triangles cur_nb_nodes cur_deflection]} {
set triinfo_pattern "(\[0-9\]+) +triangles.*\[^0-9]\(\[0-9\]+) +nodes.*deflection +(\[-0-9.+eE\]+)"
if {![regexp "${triinfo_pattern}" ${tri_info} dump cur_nb_triangles cur_nb_nodes cur_deflection]} {
puts "Error: command trinfo prints empty info"
}
if { ${cur_nb_empty_faces} == "" } {
set cur_nb_empty_faces 0
}
# get reference values from -ref option
if { "${ref_info}" != ""} {
if {![regexp "${triinfo_pattern}" ${ref_info} dump ref_nb_faces tmp ref_nb_empty_faces ref_nb_triangles ref_nb_nodes ref_deflection]} {
if {![regexp "${triinfo_pattern}" ${ref_info} dump ref_nb_triangles ref_nb_nodes ref_deflection]} {
puts "Error: reference information given by -ref option is wrong"
}
}
# check number of faces
if { [string is boolean ${ref_nb_faces}] } {
if { ${cur_nb_faces} <= 0 && ${ref_nb_faces} } {
puts "Error: Number of faces is equal to 0"
}
} else {
if {[regexp {!([-0-9.+eE]+)} $ref_nb_faces full ref_nb_faces_value]} {
if {${ref_nb_faces_value} == ${cur_nb_faces} } {
puts "Error: Number of faces is equal to ${ref_nb_faces_value} but it should not"
}
} else {
checkreal "Number of faces" ${cur_nb_faces} ${ref_nb_faces} ${tol_abs_tri} ${tol_rel_tri}
}
}
# check number of empty faces
if { [string is boolean ${ref_nb_empty_faces}] } {
if { ${cur_nb_empty_faces} > 0 && !${ref_nb_empty_faces} } {
puts "Error: Number of empty faces is greater that 0"
}
} else {
if {[regexp {!([-0-9.+eE]+)} $ref_nb_empty_faces full ref_nb_empty_faces_value]} {
if {${ref_nb_empty_faces_value} == ${cur_nb_empty_faces} } {
puts "Error: Number of empty faces is equal to ${ref_nb_empty_faces_value} but it should not"
}
} else {
checkreal "Number of empty faces" ${cur_nb_empty_faces} ${ref_nb_empty_faces} ${tol_abs_tri} ${tol_rel_tri}
}
}
# check number of triangles
if { [string is boolean ${ref_nb_triangles}] } {
if { ${cur_nb_triangles} <= 0 && ${ref_nb_triangles} } {

View File

@@ -42,11 +42,6 @@ ALL : MODELING, OCAFKERNEL, DATAEXCHANGE
TOPTEST : TKTopTest
DCAF : TKDCAF
AISV : TKViewerTest
GL : TKOpenGlTest
OPENGL : TKOpenGlTest
GLES : TKOpenGlesTest
OPENGLES : TKOpenGlesTest
D3DHOST : TKD3DHostTest
XSDRAW : TKXSDRAW
XDEDRAW : TKXDEDRAW
TOBJ : TKTObjDRAW

View File

@@ -1118,7 +1118,7 @@ proc testfile {filelist} {
# warn if shape contains triangulation
pload MODELING
if { "$format" != "STL" &&
[regexp {([0-9]+)\s+triangles} [uplevel trinfo a] res nbtriangles] &&
[regexp {contains\s+([0-9]+)\s+triangles} [uplevel trinfo a] res nbtriangles] &&
$nbtriangles != 0 } {
puts " Warning: shape contains triangulation ($nbtriangles triangles),"
puts " consider removing them unless they are needed for the test!"
@@ -1145,7 +1145,7 @@ proc testfile {filelist} {
file mkdir $tmpdir/$dir
# make snapshot
pload VISUALIZATION
pload AISV
uplevel vdisplay a
uplevel vsetdispmode 1
uplevel vfit

View File

@@ -82,22 +82,6 @@ public:
//! Return the Nth extremum on S.
Standard_EXPORT const Extrema_POnSurf& PointOnSurface (const Standard_Integer N) const;
//! Change Sequence of SquareDistance
TColStd_SequenceOfReal& SquareDistances()
{
return mySqDist;
}
//! Change Sequence of PointOnCurv
Extrema_SequenceOfPOnCurv& PointsOnCurve()
{
return myPoint1;
}
//! Change Sequence of PointOnSurf
Extrema_SequenceOfPOnSurf& PointsOnSurf()
{
return myPoint2;
}
private:
const Adaptor3d_Curve* myC;

View File

@@ -107,8 +107,8 @@ Standard_Boolean Extrema_FuncPSDist::IsInside(const math_Vector& X)
{
if (X(1) < mySurf.FirstUParameter() ||
X(1) > mySurf.LastUParameter() ||
X(2) < mySurf.FirstVParameter() ||
X(2) > mySurf.LastVParameter() )
X(2) < mySurf.FirstUParameter() ||
X(2) > mySurf.LastUParameter() )
{
// Point out of borders.
return Standard_False;

View File

@@ -304,83 +304,33 @@ void Extrema_GenExtCS::Perform (const Adaptor3d_Curve& C,
Tol(2) = mytol2;
Tol(3) = mytol2;
//
TUVinf(1) = mytmin;
TUVinf(2) = trimumin;
TUVinf(3) = trimvmin;
//
TUVsup(1) = mytsup;
TUVsup(2) = trimusup;
TUVsup(3) = trimvsup;
//
// Number of particles used in PSO algorithm (particle swarm optimization).
const Standard_Integer aNbParticles = 48;
Standard_Integer aNbIntC = 1;
if (C.IsClosed() || C.IsPeriodic())
//
if (aNbVar == 3)
{
Standard_Real aPeriod = C.Period();
if (C.LastParameter() - C.FirstParameter() > 2. * aPeriod / 3.)
{
aNbIntC = 2;
}
GlobMinGenCS(C, aNbParticles, TUVinf, TUVsup, TUV);
}
else if (aNbVar == 2)
{
GlobMinConicS(C, aNbParticles, TUVinf, TUVsup, TUV);
}
else
{
GlobMinCQuadric(C, aNbParticles, TUVinf, TUVsup, TUV);
}
Standard_Integer anInt;
Standard_Real dT = (mytsup - mytmin) / aNbIntC;
for (anInt = 1; anInt <= aNbIntC; anInt++)
{
TUVinf(1) = mytmin + (anInt - 1) * dT;
TUVinf(2) = trimumin;
TUVinf(3) = trimvmin;
//
TUVsup(1) = TUVinf(1) + dT; // mytsup;
TUVsup(2) = trimusup;
TUVsup(3) = trimvsup;
//
if (aNbVar == 3)
{
GlobMinGenCS(C, aNbParticles, TUVinf, TUVsup, TUV);
}
else if (aNbVar == 2)
{
GlobMinConicS(C, aNbParticles, TUVinf, TUVsup, TUV);
}
else
{
GlobMinCQuadric(C, aNbParticles, TUVinf, TUVsup, TUV);
}
// Find min approximation
math_FunctionSetRoot anA(myF, Tol);
anA.Perform(myF, TUV, TUVinf, TUVsup);
}
if (aNbIntC > 1 && myF.NbExt() > 1)
{
//Try to remove "false" extrema caused by dividing curve interval
TColStd_SequenceOfReal& aSqDists = myF.SquareDistances();
Extrema_SequenceOfPOnCurv& aPntsOnCrv = myF.PointsOnCurve();
Extrema_SequenceOfPOnSurf& aPntsOnSurf = myF.PointsOnSurf();
TColStd_SequenceOfReal aSqDists1(aSqDists);
Extrema_SequenceOfPOnCurv aPntsOnCrv1(aPntsOnCrv);
Extrema_SequenceOfPOnSurf aPntsOnSurf1(aPntsOnSurf);
Standard_Real aMinDist = aSqDists(1);
Standard_Integer i;
for (i = 2; i <= aSqDists.Length(); ++i)
{
Standard_Real aDist = aSqDists(i);
if (aDist < aMinDist)
{
aMinDist = aDist;
}
}
aSqDists.Clear();
aPntsOnCrv.Clear();
aPntsOnSurf.Clear();
Standard_Real aTol = Precision::SquareConfusion();
for (i = 1; i <= aSqDists1.Length(); ++i)
{
Standard_Real aDist = aSqDists1(i);
if (Abs(aDist - aMinDist) <= aTol)
{
aSqDists.Append(aDist);
aPntsOnCrv.Append(aPntsOnCrv1(i));
aPntsOnSurf.Append(aPntsOnSurf1(i));
}
}
}
// Find min approximation
math_FunctionSetRoot anA(myF, Tol);
anA.Perform(myF, TUV, TUVinf, TUVsup);
myDone = Standard_True;
}

View File

@@ -23,84 +23,10 @@
#include <Extrema_POnSurf.hxx>
#include <gp_Pnt.hxx>
#include <math_FunctionSetRoot.hxx>
#include <math_NewtonFunctionSetRoot.hxx>
#include <math_BFGS.hxx>
#include <math_BFGS.hxx>
#include <math_FRPR.hxx>
#include <math_Vector.hxx>
#include <StdFail_NotDone.hxx>
static void CorrectTol(const Standard_Real theU0, const Standard_Real theV0,
math_Vector& theTol)
{
//Correct tolerance for large values of UV parameters
Standard_Real aTolRef = Precision::PConfusion();
Standard_Real anEpsRef = Epsilon(1.);
Standard_Real epsu = Epsilon(theU0);
const Standard_Real tolog10 = 0.43429;
if (epsu > anEpsRef)
{
Standard_Integer n = RealToInt(tolog10 * Log(epsu / anEpsRef) + 1) + 1;
Standard_Integer i;
Standard_Real tol = aTolRef;
for (i = 1; i <= n; ++i)
{
tol *= 10.;
}
theTol(1) = Max(theTol(1), tol);
}
Standard_Real epsv = Epsilon(theV0);
if (epsv > anEpsRef)
{
Standard_Integer n = RealToInt(tolog10 * Log(epsv / anEpsRef) + 1) + 1;
Standard_Integer i;
Standard_Real tol = aTolRef;
for (i = 1; i <= n; ++i)
{
tol *= 10.;
}
theTol(2) = Max(theTol(2), tol);
}
}
//=======================================================================
//function : IsMinDist
//purpose :
//=======================================================================
Standard_Boolean Extrema_GenLocateExtPS::IsMinDist(const gp_Pnt& theP, const Adaptor3d_Surface& theS,
const Standard_Real theU0, const Standard_Real theV0)
{
Standard_Real du = Max(theS.UResolution(10.*Precision::Confusion()), 10.*Precision::PConfusion());
Standard_Real dv = Max(theS.VResolution(10.*Precision::Confusion()), 10.*Precision::PConfusion());
Standard_Real u, v;
gp_Pnt aP0 = theS.Value(theU0, theV0);
Standard_Real d0 = theP.SquareDistance(aP0);
Standard_Integer iu, iv;
for (iu = -1; iu <= 1; ++iu)
{
u = theU0 + iu * du;
if (!theS.IsUPeriodic())
{
u = Max(u, theS.FirstUParameter());
u = Min(u, theS.LastUParameter());
}
for (iv = -1; iv <= 1; ++iv)
{
if (iu == 0 && iv == 0)
continue;
v = theV0 + iv * dv;
if (!theS.IsVPeriodic())
{
v = Max(v, theS.FirstVParameter());
v = Min(v, theS.LastVParameter());
}
Standard_Real d = theP.SquareDistance(theS.Value(u, v));
if (d < d0)
return Standard_False;
}
}
return Standard_True;
}
//=======================================================================
//function : Extrema_GenLocateExtPS
//purpose :
@@ -143,84 +69,36 @@ void Extrema_GenLocateExtPS::Perform(const gp_Pnt& theP,
aBoundSup(1) = mySurf.LastUParameter();
aBoundSup(2) = mySurf.LastVParameter();
if (isDistanceCriteria)
if (isDistanceCriteria == Standard_False)
{
// Distance criteria.
Standard_Real aRelTol = 1.e-8;
math_Vector aResPnt(1, 2);
// Normal projection criteria.
Extrema_FuncPSNorm F(theP,mySurf);
Extrema_FuncPSDist F(mySurf, theP);
math_FunctionSetRoot SR (F, aTol);
SR.Perform(F, aStart, aBoundInf, aBoundSup);
if (!SR.IsDone())
return;
math_BFGS aSolver(2, aRelTol);
aSolver.Perform(F, aStart);
if (!aSolver.IsDone())
{
//Try another method
math_FRPR aSolver1(F, aRelTol);
aSolver1.Perform(F, aStart);
if(!aSolver1.IsDone())
return;
aSolver1.Location(aResPnt);
mySqDist = aSolver1.Minimum();
}
else
{
aSolver.Location(aResPnt);
mySqDist = aSolver.Minimum();
}
myPoint.SetParameters(aResPnt(1), aResPnt(2), mySurf.Value(aResPnt(1), aResPnt(2)));
mySqDist = F.SquareDistance(1);
myPoint = F.Point(1);
myDone = Standard_True;
}
else
{
// Normal projection criteria.
Extrema_FuncPSNorm F(theP, mySurf);
// Distance criteria.
Extrema_FuncPSDist F(mySurf, theP);
math_BFGS aSolver(2);
aSolver.Perform(F, aStart);
if (mySurf.GetType() == GeomAbs_BSplineSurface)
{
aTol(1) = myTolU;
aTol(2) = myTolV;
CorrectTol(theU0, theV0, aTol);
}
if (!aSolver.IsDone())
return;
Standard_Boolean isCorrectTol = (Abs(aTol(1) - myTolU) > Precision::PConfusion() ||
Abs(aTol(2) - myTolV) > Precision::PConfusion());
math_FunctionSetRoot aSR(F, aTol);
aSR.Perform(F, aStart, aBoundInf, aBoundSup);
if (!aSR.IsDone() || isCorrectTol)
{
if (isCorrectTol)
{
aTol(1) = myTolU;
aTol(2) = myTolV;
}
math_NewtonFunctionSetRoot aNSR(F, aTol, Precision::Confusion());
aNSR.Perform(F, aStart, aBoundInf, aBoundSup);
if (!aSR.IsDone() && !aNSR.IsDone())
{
return;
}
}
Standard_Real aNbExt = F.NbExt();
mySqDist = F.SquareDistance(1);
myPoint = F.Point(1);
Standard_Integer i;
for (i = 2; i <= aNbExt; ++i)
{
if (F.SquareDistance(i) < mySqDist)
{
mySqDist = F.SquareDistance(i);
myPoint = F.Point(i);
}
}
math_Vector aResPnt(1,2);
aSolver.Location(aResPnt);
mySqDist = aSolver.Minimum();
myPoint.SetParameters(aResPnt(1), aResPnt(2), mySurf.Value(aResPnt(1), aResPnt(2)));
myDone = Standard_True;
}
}
//=======================================================================

View File

@@ -63,11 +63,6 @@ public:
//! Returns the point of the extremum distance.
Standard_EXPORT const Extrema_POnSurf& Point() const;
//! Returns True if UV point theU0, theV0 is point of local minimum of square distance between
//! point theP and points theS(U, V), U, V are in small area around theU0, theV0
Standard_EXPORT static Standard_Boolean IsMinDist(const gp_Pnt& theP, const Adaptor3d_Surface& theS,
const Standard_Real theU0, const Standard_Real theV0);
private:
const Extrema_GenLocateExtPS& operator=(const Extrema_GenLocateExtPS&);

View File

@@ -7,7 +7,6 @@ Font_FTFont.cxx
Font_FTFont.hxx
Font_FTLibrary.cxx
Font_FTLibrary.hxx
Font_Hinting.hxx
Font_NameOfFont.hxx
Font_NListOfSystemFont.hxx
Font_Rect.hxx

View File

@@ -23,10 +23,8 @@
#include <algorithm>
#ifdef HAVE_FREETYPE
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
#include <ft2build.h>
#include FT_FREETYPE_H
IMPLEMENT_STANDARD_RTTIEXT(Font_FTFont,Standard_Transient)
@@ -40,11 +38,7 @@ Font_FTFont::Font_FTFont (const Handle(Font_FTLibrary)& theFTLib)
myActiveFTFace(NULL),
myFontAspect (Font_FontAspect_Regular),
myWidthScaling(1.0),
#ifdef HAVE_FREETYPE
myLoadFlags (FT_LOAD_NO_HINTING | FT_LOAD_TARGET_NORMAL),
#else
myLoadFlags (0),
#endif
myUChar (0U),
myToUseUnicodeSubsetFallback (Font_FontMgr::ToUseUnicodeSubsetFallback())
{
@@ -74,9 +68,7 @@ void Font_FTFont::Release()
myUChar = 0;
if (myFTFace != NULL)
{
#ifdef HAVE_FREETYPE
FT_Done_Face (myFTFace);
#endif
myFTFace = NULL;
}
myActiveFTFace = NULL;
@@ -96,26 +88,6 @@ bool Font_FTFont::Init (const Handle(NCollection_Buffer)& theData,
myBuffer = theData;
myFontPath = theFileName;
myFontParams = theParams;
// manage hinting style
if ((theParams.FontHinting & Font_Hinting_Light) != 0
&& (theParams.FontHinting & Font_Hinting_Normal) != 0)
{
throw Standard_ProgramError ("Font_FTFont, Light and Normal hinting styles are mutually exclusive");
}
setLoadFlag (FT_LOAD_TARGET_LIGHT, (theParams.FontHinting & Font_Hinting_Light) != 0);
setLoadFlag (FT_LOAD_NO_HINTING, (theParams.FontHinting & Font_Hinting_Normal) == 0
&& (theParams.FontHinting & Font_Hinting_Light) == 0);
// manage native / autohinting
if ((theParams.FontHinting & Font_Hinting_ForceAutohint) != 0
&& (theParams.FontHinting & Font_Hinting_NoAutohint) != 0)
{
throw Standard_ProgramError ("Font_FTFont, ForceAutohint and NoAutohint are mutually exclusive");
}
setLoadFlag (FT_LOAD_FORCE_AUTOHINT, (theParams.FontHinting & Font_Hinting_ForceAutohint) != 0);
setLoadFlag (FT_LOAD_NO_AUTOHINT, (theParams.FontHinting & Font_Hinting_NoAutohint) != 0);
if (!myFTLib->IsValid())
{
Message::SendTrace ("FreeType library is unavailable");
@@ -123,7 +95,6 @@ bool Font_FTFont::Init (const Handle(NCollection_Buffer)& theData,
return false;
}
#ifdef HAVE_FREETYPE
if (!theData.IsNull())
{
if (FT_New_Memory_Face (myFTLib->Instance(), theData->Data(), (FT_Long )theData->Size(), (FT_Long )theFaceId, &myFTFace) != 0)
@@ -173,10 +144,6 @@ bool Font_FTFont::Init (const Handle(NCollection_Buffer)& theData,
}
myActiveFTFace = myFTFace;
return true;
#else
(void )theFaceId;
return false;
#endif
}
// =======================================================================
@@ -207,7 +174,6 @@ Handle(Font_FTFont) Font_FTFont::FindAndCreate (const TCollection_AsciiString& t
return aFont;
}
}
#ifdef HAVE_FREETYPE
else if (theStrictLevel == Font_StrictLevel_Any)
{
switch (theFontAspect)
@@ -230,7 +196,6 @@ Handle(Font_FTFont) Font_FTFont::FindAndCreate (const TCollection_AsciiString& t
return aFont;
}
}
#endif
return Handle(Font_FTFont)();
}
@@ -257,7 +222,6 @@ bool Font_FTFont::FindAndInit (const TCollection_AsciiString& theFontName,
const TCollection_AsciiString& aPath = aRequestedFont->FontPathAny (myFontAspect, aParams.ToSynthesizeItalic, aFaceId);
return Init (aPath, aParams, aFaceId);
}
#ifdef HAVE_FREETYPE
else if (theStrictLevel == Font_StrictLevel_Any)
{
if (theFontAspect == Font_FontAspect_Italic
@@ -267,7 +231,6 @@ bool Font_FTFont::FindAndInit (const TCollection_AsciiString& theFontName,
}
return Init (Font_FontMgr::EmbedFallbackFont(), "Embed Fallback Font", aParams, 0);
}
#endif
Release();
return false;
}
@@ -283,7 +246,6 @@ bool Font_FTFont::findAndInitFallback (Font_UnicodeSubset theSubset)
return myFallbackFaces[theSubset]->IsValid();
}
#ifdef HAVE_FREETYPE
myFallbackFaces[theSubset] = new Font_FTFont (myFTLib);
myFallbackFaces[theSubset]->myToUseUnicodeSubsetFallback = false; // no recursion
@@ -301,7 +263,6 @@ bool Font_FTFont::findAndInitFallback (Font_UnicodeSubset theSubset)
+ " for symbols unsupported by '" + myFTFace->family_name + "'");
}
}
#endif
return myFallbackFaces[theSubset]->IsValid();
}
@@ -311,12 +272,7 @@ bool Font_FTFont::findAndInitFallback (Font_UnicodeSubset theSubset)
// =======================================================================
bool Font_FTFont::HasSymbol (Standard_Utf32Char theUChar) const
{
#ifdef HAVE_FREETYPE
return FT_Get_Char_Index (myFTFace, theUChar) != 0;
#else
(void )theUChar;
return false;
#endif
}
// =======================================================================
@@ -330,7 +286,6 @@ bool Font_FTFont::loadGlyph (const Standard_Utf32Char theUChar)
return myUChar != 0;
}
#ifdef HAVE_FREETYPE
myGlyphImg.Clear();
myUChar = 0;
myActiveFTFace = myFTFace;
@@ -359,9 +314,6 @@ bool Font_FTFont::loadGlyph (const Standard_Utf32Char theUChar)
myUChar = theUChar;
return true;
#else
return false;
#endif
}
// =======================================================================
@@ -374,7 +326,6 @@ bool Font_FTFont::RenderGlyph (const Standard_Utf32Char theUChar)
myUChar = 0;
myActiveFTFace = myFTFace;
#ifdef HAVE_FREETYPE
if (theUChar != 0
&& myToUseUnicodeSubsetFallback
&& !HasSymbol (theUChar))
@@ -436,10 +387,6 @@ bool Font_FTFont::RenderGlyph (const Standard_Utf32Char theUChar)
myUChar = theUChar;
return true;
#else
(void )theUChar;
return false;
#endif
}
// =======================================================================
@@ -448,7 +395,6 @@ bool Font_FTFont::RenderGlyph (const Standard_Utf32Char theUChar)
// =======================================================================
unsigned int Font_FTFont::GlyphMaxSizeX (bool theToIncludeFallback) const
{
#ifdef HAVE_FREETYPE
if (!theToIncludeFallback)
{
float aWidth = (FT_IS_SCALABLE(myFTFace) != 0)
@@ -470,10 +416,6 @@ unsigned int Font_FTFont::GlyphMaxSizeX (bool theToIncludeFallback) const
}
}
return aWidth;
#else
(void )theToIncludeFallback;
return 0;
#endif
}
// =======================================================================
@@ -482,7 +424,6 @@ unsigned int Font_FTFont::GlyphMaxSizeX (bool theToIncludeFallback) const
// =======================================================================
unsigned int Font_FTFont::GlyphMaxSizeY (bool theToIncludeFallback) const
{
#ifdef HAVE_FREETYPE
if (!theToIncludeFallback)
{
float aHeight = (FT_IS_SCALABLE(myFTFace) != 0)
@@ -504,10 +445,6 @@ unsigned int Font_FTFont::GlyphMaxSizeY (bool theToIncludeFallback) const
}
}
return aHeight;
#else
(void )theToIncludeFallback;
return 0;
#endif
}
// =======================================================================
@@ -516,11 +453,7 @@ unsigned int Font_FTFont::GlyphMaxSizeY (bool theToIncludeFallback) const
// =======================================================================
float Font_FTFont::Ascender() const
{
#ifdef HAVE_FREETYPE
return float(myFTFace->ascender) * (float(myFTFace->size->metrics.y_ppem) / float(myFTFace->units_per_EM));
#else
return 0.0f;
#endif
}
// =======================================================================
@@ -529,11 +462,7 @@ float Font_FTFont::Ascender() const
// =======================================================================
float Font_FTFont::Descender() const
{
#ifdef HAVE_FREETYPE
return float(myFTFace->descender) * (float(myFTFace->size->metrics.y_ppem) / float(myFTFace->units_per_EM));
#else
return 0.0f;
#endif
}
// =======================================================================
@@ -542,11 +471,7 @@ float Font_FTFont::Descender() const
// =======================================================================
float Font_FTFont::LineSpacing() const
{
#ifdef HAVE_FREETYPE
return float(myFTFace->height) * (float(myFTFace->size->metrics.y_ppem) / float(myFTFace->units_per_EM));
#else
return 0.0f;
#endif
}
// =======================================================================
@@ -579,7 +504,6 @@ bool Font_FTFont::getKerning (FT_Vector& theKern,
Standard_Utf32Char theUCharCurr,
Standard_Utf32Char theUCharNext) const
{
#ifdef HAVE_FREETYPE
theKern.x = 0;
theKern.y = 0;
if (theUCharNext != 0 && FT_HAS_KERNING(myActiveFTFace) != 0)
@@ -595,11 +519,6 @@ bool Font_FTFont::getKerning (FT_Vector& theKern,
}
return true;
}
#else
(void )theKern;
(void )theUCharCurr;
(void )theUCharNext;
#endif
return false;
}
@@ -614,15 +533,9 @@ float Font_FTFont::AdvanceX (Standard_Utf32Char theUCharNext) const
return 0.0f;
}
#ifdef HAVE_FREETYPE
FT_Vector aKern;
getKerning (aKern, myUChar, theUCharNext);
return myWidthScaling * fromFTPoints<float> (myActiveFTFace->glyph->advance.x + aKern.x
+ myActiveFTFace->glyph->lsb_delta - myActiveFTFace->glyph->rsb_delta);
#else
(void )theUCharNext;
return 0.0f;
#endif
return myWidthScaling * fromFTPoints<float> (myActiveFTFace->glyph->advance.x + aKern.x);
}
// =======================================================================
@@ -636,14 +549,9 @@ float Font_FTFont::AdvanceY (Standard_Utf32Char theUCharNext) const
return 0.0f;
}
#ifdef HAVE_FREETYPE
FT_Vector aKern;
getKerning (aKern, myUChar, theUCharNext);
return fromFTPoints<float> (myActiveFTFace->glyph->advance.y + aKern.y);
#else
(void )theUCharNext;
return 0.0f;
#endif
}
// =======================================================================
@@ -652,7 +560,6 @@ float Font_FTFont::AdvanceY (Standard_Utf32Char theUCharNext) const
// =======================================================================
Standard_Integer Font_FTFont::GlyphsNumber (bool theToIncludeFallback) const
{
#ifdef HAVE_FREETYPE
Standard_Integer aNbGlyphs = myFTFace->num_glyphs;
if (theToIncludeFallback)
{
@@ -666,10 +573,6 @@ Standard_Integer Font_FTFont::GlyphsNumber (bool theToIncludeFallback) const
}
}
return aNbGlyphs;
#else
(void )theToIncludeFallback;
return 0;
#endif
}
// =======================================================================
@@ -678,15 +581,11 @@ Standard_Integer Font_FTFont::GlyphsNumber (bool theToIncludeFallback) const
// =======================================================================
void Font_FTFont::GlyphRect (Font_Rect& theRect) const
{
#ifdef HAVE_FREETYPE
const FT_Bitmap& aBitmap = myActiveFTFace->glyph->bitmap;
theRect.Left = float(myActiveFTFace->glyph->bitmap_left);
theRect.Top = float(myActiveFTFace->glyph->bitmap_top);
theRect.Right = float(myActiveFTFace->glyph->bitmap_left + (int )aBitmap.width);
theRect.Bottom = float(myActiveFTFace->glyph->bitmap_top - (int )aBitmap.rows);
#else
(void )theRect;
#endif
}
// =======================================================================
@@ -715,15 +614,10 @@ Font_Rect Font_FTFont::BoundingBox (const NCollection_String& theS
// =======================================================================
const FT_Outline* Font_FTFont::renderGlyphOutline (const Standard_Utf32Char theChar)
{
#ifdef HAVE_FREETYPE
if (!loadGlyph (theChar)
|| myActiveFTFace->glyph->format != FT_GLYPH_FORMAT_OUTLINE)
{
return 0;
}
return &myActiveFTFace->glyph->outline;
#else
(void )theChar;
return 0;
#endif
}

View File

@@ -17,7 +17,6 @@
#define _Font_FTFont_H__
#include <Font_FontAspect.hxx>
#include <Font_Hinting.hxx>
#include <Font_Rect.hxx>
#include <Font_StrictLevel.hxx>
#include <Font_UnicodeSubset.hxx>
@@ -38,26 +37,16 @@ struct Font_FTFontParams
{
unsigned int PointSize; //!< face size in points (1/72 inch)
unsigned int Resolution; //!< resolution of the target device in dpi for FT_Set_Char_Size()
Font_Hinting FontHinting; //!< request hinting (exclude FT_LOAD_NO_HINTING flag), Font_Hinting_Off by default;
//! hinting improves readability of thin text on low-resolution screen,
//! but adds distortions to original font depending on font family and font library version
bool ToSynthesizeItalic; //!< generate italic style (e.g. for font family having no italic style); FALSE by default
bool IsSingleStrokeFont; //!< single-stroke (one-line) font, FALSE by default
//! Empty constructor.
Font_FTFontParams()
: PointSize (0), Resolution (72u),
FontHinting (Font_Hinting_Off),
ToSynthesizeItalic (false),
IsSingleStrokeFont (false) {}
Font_FTFontParams() : PointSize (0), Resolution (72u), ToSynthesizeItalic (false), IsSingleStrokeFont (false) {}
//! Constructor.
Font_FTFontParams (unsigned int thePointSize,
unsigned int theResolution)
: PointSize (thePointSize), Resolution (theResolution),
FontHinting (Font_Hinting_Off),
ToSynthesizeItalic (false),
IsSingleStrokeFont (false) {}
: PointSize (thePointSize), Resolution (theResolution), ToSynthesizeItalic (false), IsSingleStrokeFont (false) {}
};
DEFINE_STANDARD_HANDLE(Font_FTFont, Standard_Transient)
@@ -370,19 +359,6 @@ protected:
//! Initialize fallback font.
Standard_EXPORT bool findAndInitFallback (Font_UnicodeSubset theSubset);
//! Enable/disable load flag.
void setLoadFlag (int32_t theFlag, bool theToEnable)
{
if (theToEnable)
{
myLoadFlags |= theFlag;
}
else
{
myLoadFlags &= ~theFlag;
}
}
protected:
Handle(Font_FTLibrary) myFTLib; //!< handle to the FT library object

View File

@@ -15,10 +15,8 @@
#include <Font_FTLibrary.hxx>
#ifdef HAVE_FREETYPE
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
#include <ft2build.h>
#include FT_FREETYPE_H
IMPLEMENT_STANDARD_RTTIEXT(Font_FTLibrary,Standard_Transient)
@@ -29,12 +27,10 @@ IMPLEMENT_STANDARD_RTTIEXT(Font_FTLibrary,Standard_Transient)
Font_FTLibrary::Font_FTLibrary()
: myFTLib (NULL)
{
#ifdef HAVE_FREETYPE
if (FT_Init_FreeType (&myFTLib) != 0)
{
myFTLib = NULL;
}
#endif
}
// =======================================================================
@@ -45,8 +41,6 @@ Font_FTLibrary::~Font_FTLibrary()
{
if (IsValid())
{
#ifdef HAVE_FREETYPE
FT_Done_FreeType (myFTLib);
#endif
}
}

View File

@@ -28,12 +28,10 @@
#include <Standard_Type.hxx>
#include <TCollection_HAsciiString.hxx>
#ifdef HAVE_FREETYPE
#include "Font_DejavuSans_Latin_woff.pxx"
#include "Font_DejavuSans_Latin_woff.pxx"
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
#include <ft2build.h>
#include FT_FREETYPE_H
IMPLEMENT_STANDARD_RTTIEXT(Font_FontMgr,Standard_Transient)
#if defined(_WIN32)
@@ -41,7 +39,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Font_FontMgr,Standard_Transient)
#include <windows.h>
#include <stdlib.h>
#if defined(_MSC_VER) && defined(HAVE_FREETYPE)
#ifdef _MSC_VER
#pragma comment (lib, "freetype.lib")
#endif
@@ -84,7 +82,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Font_FontMgr,Standard_Transient)
NULL
};
#if defined(HAVE_FREETYPE) && !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
#if !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
// X11 configuration file in plain text format (obsolete - doesn't exists in modern distributives)
static Standard_CString myFontServiceConf[] = {"/etc/X11/fs/config",
"/usr/X11R6/lib/X11/fs/config",
@@ -151,9 +149,8 @@ IMPLEMENT_STANDARD_RTTIEXT(Font_FontMgr,Standard_Transient)
static bool checkFont (NCollection_Sequence<Handle(Font_SystemFont)>& theFonts,
const Handle(Font_FTLibrary)& theFTLib,
const TCollection_AsciiString& theFontPath,
signed long theFaceId = -1) // FT_Long
FT_Long theFaceId = -1)
{
#ifdef HAVE_FREETYPE
const FT_Long aFaceId = theFaceId != -1 ? theFaceId : 0;
FT_Face aFontFace;
FT_Error aFaceError = FT_New_Face (theFTLib->Instance(), theFontPath.ToCString(), aFaceId, &aFontFace);
@@ -286,13 +283,6 @@ static bool checkFont (NCollection_Sequence<Handle(Font_SystemFont)>& theFonts,
FT_Done_Face (aFontFace);
return true;
#else
(void )theFonts;
(void )theFTLib;
(void )theFontPath;
(void )theFaceId;
return false;
#endif
}
// =======================================================================
@@ -722,7 +712,7 @@ void Font_FontMgr::InitFontDataBase()
#else
NCollection_Map<TCollection_AsciiString> aMapOfFontsDirs;
#if defined(HAVE_FREETYPE) && !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
#if !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
if (FcConfig* aFcCfg = FcInitLoadConfig())
{
if (FcStrList* aFcFontDir = FcConfigGetFontDirs (aFcCfg))
@@ -825,7 +815,7 @@ void Font_FontMgr::InitFontDataBase()
for (NCollection_Map<TCollection_AsciiString>::Iterator anIter (aMapOfFontsDirs);
anIter.More(); anIter.Next())
{
#if defined(HAVE_FREETYPE) && !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
#if !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
OSD_File aReadFile (anIter.Value() + "/fonts.dir");
if (!aReadFile.Exists())
{
@@ -845,7 +835,7 @@ void Font_FontMgr::InitFontDataBase()
RegisterFonts (aFonts, false);
}
#if defined(HAVE_FREETYPE) && !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
#if !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
continue;
}
@@ -1164,11 +1154,7 @@ Handle(Font_SystemFont) Font_FontMgr::Font_FontMap::Find (const TCollection_Asci
// =======================================================================
Handle(NCollection_Buffer) Font_FontMgr::EmbedFallbackFont()
{
#ifdef HAVE_FREETYPE
return new NCollection_Buffer (Handle(NCollection_BaseAllocator)(),
Font_DejavuSans_Latin_woff_size,
const_cast<Standard_Byte*>(Font_DejavuSans_Latin_woff));
#else
return Handle(NCollection_Buffer)();
#endif
}

View File

@@ -1,29 +0,0 @@
// Copyright (c) 2021 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 _Font_Hinting_HeaderFile
#define _Font_Hinting_HeaderFile
//! Enumeration defining font hinting options.
enum Font_Hinting
{
// hinting style
Font_Hinting_Off = 0x00, //!< no hinting (FT_LOAD_NO_HINTING)
Font_Hinting_Normal = 0x01, //!< default hinting (FT_LOAD_TARGET_NORMAL)
Font_Hinting_Light = 0x02, //!< light hinting (FT_LOAD_TARGET_LIGHT)
// native/autohinting flags
Font_Hinting_ForceAutohint = 0x10, //!< prefer autohinting over native hinting (FT_LOAD_FORCE_AUTOHINT)
Font_Hinting_NoAutohint = 0x20, //!< disallow autohinting (FT_LOAD_NO_AUTOHINT)
};
#endif // _Font_Hinting_HeaderFile

View File

@@ -1,17 +1,22 @@
GCPnts_AbscissaPoint.cxx
GCPnts_AbscissaPoint.pxx
GCPnts_AbscissaPoint.hxx
GCPnts_AbscissaType.hxx
GCPnts_DeflectionType.hxx
GCPnts_QuasiUniformAbscissa.cxx
GCPnts_QuasiUniformAbscissa.pxx
GCPnts_QuasiUniformAbscissa.hxx
GCPnts_QuasiUniformDeflection.cxx
GCPnts_QuasiUniformDeflection.pxx
GCPnts_QuasiUniformDeflection.hxx
GCPnts_TangentialDeflection.cxx
GCPnts_TangentialDeflection.pxx
GCPnts_TangentialDeflection.hxx
GCPnts_TCurveTypes.hxx
GCPnts_UniformAbscissa.cxx
GCPnts_UniformAbscissa.pxx
GCPnts_UniformAbscissa.hxx
GCPnts_UniformDeflection.cxx
GCPnts_UniformDeflection.pxx
GCPnts_UniformDeflection.hxx
GCPnts_DistFunction.hxx
GCPnts_DistFunction.cxx

View File

@@ -14,593 +14,39 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Adaptor2d_Curve2d.hxx>
#include <Adaptor3d_Curve.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <GCPnts_AbscissaType.hxx>
#include <GCPnts_TCurveTypes.hxx>
#include <Standard_ConstructionError.hxx>
//! Dimension independent used to implement GCPnts_AbscissaPoint
//! compute the type and the length ratio if GCPnts_LengthParametrized.
template<class TheCurve>
static GCPnts_AbscissaType computeType (const TheCurve& theC,
Standard_Real& theRatio)
{
if (theC.NbIntervals (GeomAbs_CN) > 1)
{
return GCPnts_AbsComposite;
}
switch (theC.GetType())
{
case GeomAbs_Line:
{
theRatio = 1.0;
return GCPnts_LengthParametrized;
}
case GeomAbs_Circle:
{
theRatio = theC.Circle().Radius();
return GCPnts_LengthParametrized;
}
case GeomAbs_BezierCurve:
{
Handle(typename GCPnts_TCurveTypes<TheCurve>::BezierCurve) aBz = theC.Bezier();
if (aBz->NbPoles() == 2
&& !aBz->IsRational())
{
theRatio = aBz->DN (0, 1).Magnitude();
return GCPnts_LengthParametrized;
}
return GCPnts_Parametrized;
}
case GeomAbs_BSplineCurve:
{
Handle(typename GCPnts_TCurveTypes<TheCurve>::BSplineCurve) aBs = theC.BSpline();
if (aBs->NbPoles() == 2
&& !aBs->IsRational())
{
theRatio = aBs->DN (aBs->FirstParameter(), 1).Magnitude();
return GCPnts_LengthParametrized;
}
return GCPnts_Parametrized;
}
default:
{
return GCPnts_Parametrized;
}
}
}
//! Compute a point at distance theAbscis from parameter theU0 using theUi as initial guess
template<class TheCurve>
static void Compute (CPnts_AbscissaPoint& theComputer,
const TheCurve& theC,
Standard_Real& theAbscis,
Standard_Real& theU0,
Standard_Real& theUi,
const Standard_Real theEPSILON)
{
// test for easy solution
if (Abs (theAbscis) <= Precision::Confusion())
{
theComputer.SetParameter (theU0);
return;
}
Standard_Real aRatio = 1.0;
const GCPnts_AbscissaType aType = computeType (theC, aRatio);
switch (aType)
{
case GCPnts_LengthParametrized:
{
theComputer.SetParameter (theU0 + theAbscis / aRatio);
return;
}
case GCPnts_Parametrized:
{
theComputer.Init (theC);
theComputer.Perform (theAbscis, theU0, theUi, theEPSILON);
return;
}
case GCPnts_AbsComposite:
{
const Standard_Integer aNbIntervals = theC.NbIntervals (GeomAbs_CN);
TColStd_Array1OfReal aTI (1, aNbIntervals + 1);
theC.Intervals (aTI, GeomAbs_CN);
Standard_Real aL = 0.0, aSign = 1.0;
Standard_Integer anIndex = 1;
BSplCLib::Hunt (aTI, theU0, anIndex);
Standard_Integer aDirection = 1;
if (theAbscis < 0)
{
aDirection = 0;
theAbscis = -theAbscis;
aSign = -1.0;
}
while (anIndex >= 1
&& anIndex <= aNbIntervals)
{
aL = CPnts_AbscissaPoint::Length (theC, theU0, aTI (anIndex + aDirection));
if (Abs (aL - theAbscis) <= Precision::Confusion())
{
theComputer.SetParameter (aTI (anIndex + aDirection));
return;
}
if (aL > theAbscis)
{
if (theUi < aTI (anIndex)
|| theUi > aTI (anIndex + 1))
{
theUi = (theAbscis / aL) * (aTI (anIndex + 1) - theU0);
if (aDirection)
{
theUi = theU0 + theUi;
}
else
{
theUi = theU0 - theUi;
}
}
theComputer.Init (theC, aTI (anIndex), aTI (anIndex + 1));
theComputer.Perform (aSign * theAbscis, theU0, theUi, theEPSILON);
return;
}
else
{
theU0 = aTI (anIndex + aDirection);
theAbscis -= aL;
}
if (aDirection)
{
++anIndex;
}
else
{
--anIndex;
}
}
// Push a little bit outside the limits (hairy !!!)
theUi = theU0 + 0.1;
theComputer.Init (theC, theU0, theU0 + 0.2);
theComputer.Perform (aSign * theAbscis, theU0, theUi, theEPSILON);
return;
}
break;
}
}
//! Introduced by rbv for curvilinear parametrization
//! performs more appropriate tolerance management.
template<class TheCurve>
static void AdvCompute (CPnts_AbscissaPoint& theComputer,
const TheCurve& theC,
Standard_Real& theAbscis,
Standard_Real& theU0,
Standard_Real& theUi,
const Standard_Real theEPSILON)
{
Standard_Real aRatio = 1.0;
const GCPnts_AbscissaType aType = computeType (theC, aRatio);
switch (aType)
{
case GCPnts_LengthParametrized:
{
theComputer.SetParameter (theU0 + theAbscis / aRatio);
return;
}
case GCPnts_Parametrized:
{
// theComputer.Init (theC);
theComputer.Init (theC, theEPSILON); //rbv's modification
theComputer.AdvPerform (theAbscis, theU0, theUi, theEPSILON);
return;
}
case GCPnts_AbsComposite:
{
const Standard_Integer aNbIntervals = theC.NbIntervals (GeomAbs_CN);
TColStd_Array1OfReal aTI (1, aNbIntervals + 1);
theC.Intervals (aTI, GeomAbs_CN);
Standard_Real aL = 0.0, aSign = 1.0;
Standard_Integer anIndex = 1;
BSplCLib::Hunt (aTI, theU0, anIndex);
Standard_Integer aDirection = 1;
if (theAbscis < 0)
{
aDirection = 0;
theAbscis = -theAbscis;
aSign = -1.0;
}
if (anIndex == 0 && aDirection > 0)
{
aL = CPnts_AbscissaPoint::Length (theC, theU0, aTI (anIndex + aDirection), theEPSILON);
if (Abs (aL - theAbscis) <= /*Precision::Confusion()*/theEPSILON)
{
theComputer.SetParameter (aTI (anIndex + aDirection));
return;
}
if (aL > theAbscis)
{
if (theUi > aTI (anIndex + 1))
{
theUi = (theAbscis / aL) * (aTI (anIndex + 1) - theU0);
theUi = theU0 + theUi;
}
theComputer.Init (theC, theU0, aTI (anIndex + 1), theEPSILON);
theComputer.AdvPerform (aSign * theAbscis, theU0, theUi, theEPSILON);
return;
}
else
{
theU0 = aTI (anIndex + aDirection);
theAbscis -= aL;
}
++anIndex;
}
while (anIndex >= 1
&& anIndex <= aNbIntervals)
{
aL = CPnts_AbscissaPoint::Length (theC, theU0, aTI (anIndex + aDirection), theEPSILON);
if (Abs (aL - theAbscis) <= Precision::PConfusion())
{
theComputer.SetParameter (aTI (anIndex + aDirection));
return;
}
if (aL > theAbscis)
{
if (theUi < aTI (anIndex)
|| theUi > aTI (anIndex + 1))
{
theUi = (theAbscis / aL) * (aTI (anIndex + 1) - theU0);
if (aDirection)
{
theUi = theU0 + theUi;
}
else
{
theUi = theU0 - theUi;
}
}
theComputer.Init (theC, aTI (anIndex), aTI (anIndex + 1), theEPSILON);
theComputer.AdvPerform (aSign * theAbscis, theU0, theUi, theEPSILON);
return;
}
else
{
theU0 = aTI (anIndex + aDirection);
theAbscis -= aL;
}
if (aDirection)
{
++anIndex;
}
else
{
--anIndex;
}
}
// Push a little bit outside the limits (hairy !!!)
const Standard_Boolean isNonPeriodic = !theC.IsPeriodic();
theUi = theU0 + aSign * 0.1;
Standard_Real aU1 = theU0 + aSign * 0.2;
if (isNonPeriodic)
{
if (aSign > 0)
{
theUi = Min (theUi, theC.LastParameter());
aU1 = Min (aU1, theC.LastParameter());
}
else
{
theUi = Max (theUi, theC.FirstParameter());
aU1 = Max (aU1, theC.FirstParameter());
}
}
theComputer.Init (theC, theU0, aU1, theEPSILON);
theComputer.AdvPerform (aSign * theAbscis, theU0, theUi, theEPSILON);
return;
}
break;
}
}
#include <StdFail_NotDone.hxx>
//=======================================================================
//function : GCPnts_AbscissaPoint
//purpose :
//purpose :
//=======================================================================
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint()
{
//
}
//=======================================================================
//function : Length
//purpose :
//=======================================================================
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor3d_Curve& theC)
{
return GCPnts_AbscissaPoint::Length (theC, theC.FirstParameter(), theC.LastParameter());
}
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
//=======================================================================
//function : Length
//purpose :
//=======================================================================
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor2d_Curve2d& theC)
{
return GCPnts_AbscissaPoint::Length (theC, theC.FirstParameter(), theC.LastParameter());
}
#define TheCurve Adaptor3d_Curve
#define Handle_TheBezierCurve Handle(Geom_BezierCurve)
#define Handle_TheBSplineCurve Handle(Geom_BSplineCurve)
//=======================================================================
//function : Length
//purpose :
//=======================================================================
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor3d_Curve& theC,
const Standard_Real theTol)
{
return GCPnts_AbscissaPoint::Length (theC, theC.FirstParameter(), theC.LastParameter(), theTol);
}
#include "GCPnts_AbscissaPoint.pxx"
//=======================================================================
//function : Length
//purpose :
//=======================================================================
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor2d_Curve2d& theC,
const Standard_Real theTol)
{
return GCPnts_AbscissaPoint::Length (theC, theC.FirstParameter(), theC.LastParameter(), theTol);
}
#undef TheCurve
#undef Handle_TheBezierCurve
#undef Handle_TheBSplineCurve
//=======================================================================
//function : Length
//purpose :
//=======================================================================
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor3d_Curve& theC,
const Standard_Real theU1, const Standard_Real theU2)
{
return length (theC, theU1, theU2, NULL);
}
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
//=======================================================================
//function : Length
//purpose :
//=======================================================================
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor2d_Curve2d& theC,
const Standard_Real theU1, const Standard_Real theU2)
{
return length (theC, theU1, theU2, NULL);
}
#define TheCurve Adaptor2d_Curve2d
#define Handle_TheBezierCurve Handle(Geom2d_BezierCurve)
#define Handle_TheBSplineCurve Handle(Geom2d_BSplineCurve)
//=======================================================================
//function : Length
//purpose :
//=======================================================================
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor3d_Curve& theC,
const Standard_Real theU1, const Standard_Real theU2,
const Standard_Real theTol)
{
return length (theC, theU1, theU2, &theTol);
}
//=======================================================================
//function : Length
//purpose :
//=======================================================================
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor2d_Curve2d& theC,
const Standard_Real theU1, const Standard_Real theU2,
const Standard_Real theTol)
{
return length (theC, theU1, theU2, &theTol);
}
//=======================================================================
//function : length
//purpose :
//=======================================================================
template<class TheCurve>
Standard_Real GCPnts_AbscissaPoint::length (const TheCurve& theC,
const Standard_Real theU1, const Standard_Real theU2,
const Standard_Real* theTol)
{
Standard_Real aRatio = 1.0;
const GCPnts_AbscissaType aType = computeType (theC, aRatio);
switch (aType)
{
case GCPnts_LengthParametrized:
{
return Abs (theU2 - theU1) * aRatio;
}
case GCPnts_Parametrized:
{
return theTol != NULL
? CPnts_AbscissaPoint::Length (theC, theU1, theU2, *theTol)
: CPnts_AbscissaPoint::Length (theC, theU1, theU2);
}
case GCPnts_AbsComposite:
{
const Standard_Integer aNbIntervals = theC.NbIntervals (GeomAbs_CN);
TColStd_Array1OfReal aTI (1, aNbIntervals + 1);
theC.Intervals (aTI, GeomAbs_CN);
const Standard_Real aUU1 = Min (theU1, theU2);
const Standard_Real aUU2 = Max (theU1, theU2);
Standard_Real aL = 0.0;
for (Standard_Integer anIndex = 1; anIndex <= aNbIntervals; ++anIndex)
{
if (aTI (anIndex) > aUU2) { break; }
if (aTI (anIndex + 1) < aUU1) { continue; }
if (theTol != NULL)
{
aL += CPnts_AbscissaPoint::Length (theC,
Max (aTI (anIndex), aUU1),
Min (aTI (anIndex + 1), aUU2),
*theTol);
}
else
{
aL += CPnts_AbscissaPoint::Length (theC,
Max (aTI (anIndex), aUU1),
Min (aTI (anIndex + 1), aUU2));
}
}
return aL;
}
}
return RealLast();
}
//=======================================================================
//function : compute
//purpose :
//=======================================================================
template<class TheCurve>
void GCPnts_AbscissaPoint::compute (const TheCurve& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0)
{
const Standard_Real aL = GCPnts_AbscissaPoint::Length (theC);
if (aL < Precision::Confusion())
{
throw Standard_ConstructionError();
}
Standard_Real anAbscis = theAbscissa;
Standard_Real aUU0 = theU0;
Standard_Real aUUi = theU0 + (anAbscis / aL) * (theC.LastParameter() - theC.FirstParameter());
Compute (myComputer, theC, anAbscis, aUU0, aUUi,
theC.Resolution (Precision::Confusion()));
}
//=======================================================================
//function : GCPnts_AbscissaPoint
//purpose :
//=======================================================================
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0)
{
compute (theC, theAbscissa, theU0);
}
//=======================================================================
//function : GCPnts_AbscissaPoint
//purpose :
//=======================================================================
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0)
{
compute (theC, theAbscissa, theU0);
}
//=======================================================================
//function : advCompute
//purpose :
//=======================================================================
template<class TheCurve>
void GCPnts_AbscissaPoint::advCompute (const Standard_Real theTol,
const TheCurve& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0)
{
const Standard_Real aL = GCPnts_AbscissaPoint::Length (theC, theTol);
/*if (aL < Precision::Confusion())
{
throw Standard_ConstructionError ("GCPnts_AbscissaPoint::GCPnts_AbscissaPoint");
}*/
Standard_Real anAbscis = theAbscissa;
Standard_Real aUU0 = theU0;
Standard_Real aUUi = 0.0;
if (aL >= Precision::Confusion())
{
aUUi= theU0 + (anAbscis / aL) * (theC.LastParameter() - theC.FirstParameter());
}
else
{
aUUi = theU0;
}
AdvCompute (myComputer, theC, anAbscis, aUU0, aUUi, theTol);
}
//=======================================================================
//function : GCPnts_AbscissaPoint
//purpose :
//=======================================================================
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Standard_Real theTol,
const Adaptor3d_Curve& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0)
{
advCompute (theTol, theC, theAbscissa, theU0);
}
//=======================================================================
//function : GCPnts_AbscissaPoint
//purpose :
//=======================================================================
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Standard_Real theTol,
const Adaptor2d_Curve2d& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0)
{
advCompute (theTol, theC, theAbscissa, theU0);
}
//=======================================================================
//function : GCPnts_AbscissaPoint
//purpose :
//=======================================================================
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0, const Standard_Real theUi)
{
Standard_Real anAbscis = theAbscissa, aUU0 = theU0, aUUi = theUi;
Compute (myComputer, theC, anAbscis, aUU0, aUUi, theC.Resolution (Precision::Confusion()));
}
//=======================================================================
//function : GCPnts_AbscissaPoint
//purpose :
//=======================================================================
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0, const Standard_Real theUi)
{
Standard_Real anAbscis = theAbscissa, aUU0 = theU0, aUUi = theUi;
Compute (myComputer, theC, anAbscis, aUU0, aUUi, theC.Resolution (Precision::Confusion()));
}
//=======================================================================
//function : GCPnts_AbscissaPoint
//purpose :
//=======================================================================
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0, const Standard_Real theUi,
const Standard_Real theTol)
{
Standard_Real anAbscis = theAbscissa, aUU0 = theU0, aUUi = theUi;
AdvCompute (myComputer, theC, anAbscis, aUU0, aUUi, theTol);
}
//=======================================================================
//function : GCPnts_AbscissaPoint
//purpose :
//=======================================================================
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0, const Standard_Real theUi,
const Standard_Real theTol)
{
Standard_Real anAbscis = theAbscissa, aUU0 = theU0, aUUi = theUi;
AdvCompute (myComputer, theC, anAbscis, aUU0, aUUi, theTol);
}
#include "GCPnts_AbscissaPoint.pxx"

View File

@@ -19,122 +19,104 @@
#include <CPnts_AbscissaPoint.hxx>
class StdFail_NotDone;
class Standard_ConstructionError;
class Adaptor3d_Curve;
class Adaptor2d_Curve2d;
//! Provides an algorithm to compute a point on a curve
//! situated at a given distance from another point on the curve,
//! the distance being measured along the curve (curvilinear abscissa on the curve).
//! situated at a given distance from another point on the
//! curve, the distance being measured along the curve
//! (curvilinear abscissa on the curve).
//! This algorithm is also used to compute the length of a curve.
//! An AbscissaPoint object provides a framework for:
//! - defining the point to compute
//! - implementing the construction algorithm
//! - consulting the result.
class GCPnts_AbscissaPoint
class GCPnts_AbscissaPoint
{
public:
DEFINE_STANDARD_ALLOC
//! Computes the length of the 3D Curve.
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& theC);
//! Computes the length of the 2D Curve.
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& theC);
//! Computes the length of the Curve <C>.
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C);
//! Computes the length of the 3D Curve with the given tolerance.
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& theC,
const Standard_Real theTol);
//! Computes the length of the Curve <C>.
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C);
//! Computes the length of the 2D Curve with the given tolerance.
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& theC,
const Standard_Real theTol);
//! Computes the length of the Curve <C> with the given tolerance.
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real Tol);
//! Computes the length of the 3D Curve.
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& theC,
const Standard_Real theU1, const Standard_Real theU2);
//! Computes the length of the Curve <C> with the given tolerance.
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real Tol);
//! Computes the length of the 2D Curve.
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& theC,
const Standard_Real theU1, const Standard_Real theU2);
//! Computes the length of the Curve <C>.
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2);
//! Computes the length of the Curve <C>.
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2);
//! Computes the length of the Curve <C> with the given tolerance.
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol);
//! Computes the length of the Curve <C> with the given tolerance.
//! Constructs an empty algorithm. This function is used
//! only for initializing a framework to compute the length
//! of a curve (or a series of curves).
//! Warning
//! The function IsDone will return the value false after the use of this function.
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol);
//! Computes the length of the 3D Curve with the given tolerance.
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& theC,
const Standard_Real theU1, const Standard_Real theU2,
const Standard_Real theTol);
//! Computes the length of the Curve with the given tolerance.
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& theC,
const Standard_Real theU1, const Standard_Real theU2,
const Standard_Real theTol);
public:
//! Empty constructor.
Standard_EXPORT GCPnts_AbscissaPoint();
//! The algorithm computes a point on a curve at the
//! distance theAbscissa from the point of parameter theU0.
Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0);
//! The algorithm computes a point on a curve at
//! the distance theAbscissa from the point of parameter
//! theU0 with the given tolerance.
Standard_EXPORT GCPnts_AbscissaPoint (const Standard_Real theTol,
const Adaptor3d_Curve& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0);
//! The algorithm computes a point on a curve at
//! the distance theAbscissa from the point of parameter
//! theU0 with the given tolerance.
Standard_EXPORT GCPnts_AbscissaPoint (const Standard_Real theTol,
const Adaptor2d_Curve2d& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0);
//! The algorithm computes a point on a curve at the
//! distance theAbscissa from the point of parameter theU0.
Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0);
//! The algorithm computes a point on a curve at the
//! distance theAbscissa from the point of parameter theU0.
//! theUi is the starting value used in the iterative process
//! which find the solution, it must be close to the final solution.
Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0, const Standard_Real theUi);
//! The algorithm computes a point on a curve at the
//! distance theAbscissa from the point of parameter theU0.
//! theUi is the starting value used in the iterative process
//! which find the solution, it must be closed to the final solution
Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0, const Standard_Real theUi);
//! The algorithm computes a point on a curve at the
//! distance theAbscissa from the point of parameter theU0.
//! theUi is the starting value used in the iterative process
//! which find the solution, it must be close to the final solution
Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0, const Standard_Real theUi,
const Standard_Real theTol);
//! The algorithm computes a point on a curve at the
//! distance theAbscissa from the point of parameter theU0.
//! theUi is the starting value used in the iterative process
//! which find the solution, it must be close to the final solution
Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0, const Standard_Real theUi,
const Standard_Real theTol);
//! the algorithm computes a point on a curve <Curve> at the
//! distance <Abscissa> from the point of parameter <U0>.
Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0);
//! the algorithm computes a point on a curve <Curve> at
//! the distance <Abscissa> from the point of parameter
//! <U0> with the given tolerance.
Standard_EXPORT GCPnts_AbscissaPoint(const Standard_Real Tol, const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0);
//! the algorithm computes a point on a curve <Curve> at
//! the distance <Abscissa> from the point of parameter
//! <U0> with the given tolerance.
Standard_EXPORT GCPnts_AbscissaPoint(const Standard_Real Tol, const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0);
//! the algorithm computes a point on a curve <Curve> at the
//! distance <Abscissa> from the point of parameter <U0>.
Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0);
//! the algorithm computes a point on a curve <Curve> at the
//! distance <Abscissa> from the point of parameter <U0>.
//! <Ui> is the starting value used in the iterative process
//! which find the solution, it must be close to the final
//! solution
Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui);
//! the algorithm computes a point on a curve <Curve> at the
//! distance <Abscissa> from the point of parameter <U0>.
//! <Ui> is the starting value used in the iterative process
//! which find the solution, it must be closed to the final
//! solution
Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui);
//! the algorithm computes a point on a curve <Curve> at the
//! distance <Abscissa> from the point of parameter <U0>.
//! <Ui> is the starting value used in the iterative process
//! which find the solution, it must be close to the final
//! solution
Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui, const Standard_Real Tol);
//! the algorithm computes a point on a curve <Curve> at the
//! distance <Abscissa> from the point of parameter <U0>.
//! <Ui> is the starting value used in the iterative process
//! which find the solution, it must be close to the final
//! solution
Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui, const Standard_Real Tol);
//! True if the computation was successful, False otherwise.
//! IsDone is a protection against:
//! - non-convergence of the algorithm
@@ -154,27 +136,6 @@ public:
return myComputer.Parameter ();
}
private:
//! Computes the length of the Curve with the optional tolerance.
template<class TheCurve>
static Standard_Real length (const TheCurve& theC,
const Standard_Real theU1, const Standard_Real theU2,
const Standard_Real* theTol);
//! Performs algorithm from the point of parameter.
template<class TheCurve>
void compute (const TheCurve& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0);
//! Performs algorithm from the point of parameter with the given tolerance.
template<class TheCurve>
void advCompute (const Standard_Real theTol,
const TheCurve& theC,
const Standard_Real theAbscissa,
const Standard_Real theU0);
private:
CPnts_AbscissaPoint myComputer;
};

View File

@@ -0,0 +1,474 @@
// Created on: 1995-05-05
// Created by: Modelistation
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// Dimension independent used to implement GCPnts_AbscissaPoint
// compute the type
// and the length ratio if GCPnts_LengthParametrized
#include <GCPnts_AbscissaType.hxx>
#include <gp_Vec.hxx>
#include <gp_Vec2d.hxx>
#include <gp_Circ.hxx>
#include <gp_Circ2d.hxx>
#include <Precision.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <BSplCLib.hxx>
static GCPnts_AbscissaType computeType( const TheCurve& C,
Standard_Real& Ratio)
{
GCPnts_AbscissaType LocalType ;
if (C.NbIntervals(GeomAbs_CN) > 1)
return GCPnts_AbsComposite;
switch (C.GetType()) {
case GeomAbs_Line:
Ratio = 1.0e0 ;
return GCPnts_LengthParametrized;
case GeomAbs_Circle:
Ratio = C.Circle().Radius();
return GCPnts_LengthParametrized;
case GeomAbs_BezierCurve:
{
Handle_TheBezierCurve Bz = C.Bezier();
if ((Bz->NbPoles() == 2) && !(Bz->IsRational())) {
Ratio = Bz->DN(0,1).Magnitude();
LocalType = GCPnts_LengthParametrized;
}
else
LocalType = GCPnts_Parametrized;
return LocalType ;
}
case GeomAbs_BSplineCurve:
{
Handle_TheBSplineCurve Bs = C.BSpline();
if ((Bs->NbPoles() == 2) && !(Bs->IsRational())) {
Ratio = Bs->DN(Bs->FirstParameter(),1).Magnitude();
LocalType = GCPnts_LengthParametrized;
}
else
LocalType = GCPnts_Parametrized;
return LocalType ;
}
default:
return GCPnts_Parametrized;
}
}
// compute a point at distance Abscis from parameter U0
// using Ui as initial guess
static void Compute(CPnts_AbscissaPoint& theComputer,
const TheCurve& C,
Standard_Real& Abscis,
Standard_Real& U0,
Standard_Real& Ui,
const Standard_Real EPSILON)
{
// test for easy solution
if (Abs(Abscis) <= Precision::Confusion()) {
theComputer.SetParameter(U0);
return;
}
Standard_Real Ratio = 1.;
GCPnts_AbscissaType Type = computeType(C,Ratio);
switch (Type) {
case GCPnts_LengthParametrized :
theComputer.SetParameter(U0 + Abscis / Ratio);
return;
case GCPnts_Parametrized :
theComputer.Init(C);
theComputer.Perform(Abscis, U0, Ui, EPSILON);
return;
case GCPnts_AbsComposite :
{
Standard_Integer NbIntervals = C.NbIntervals(GeomAbs_CN);
TColStd_Array1OfReal TI(1,NbIntervals+1);
C.Intervals(TI,GeomAbs_CN);
Standard_Real L = 0.0, sign = 1.;
Standard_Integer Index = 1;
BSplCLib::Hunt(TI,U0,Index);
Standard_Integer Direction = 1;
if (Abscis < 0) {
Direction = 0;
Abscis = -Abscis;
sign = -1.;
}
while ((Index >= 1) && (Index <= NbIntervals)) {
L = CPnts_AbscissaPoint::Length(C, U0, TI(Index+Direction));
if (Abs(L - Abscis) <= Precision::Confusion()) {
theComputer.SetParameter(TI(Index+Direction));
return;
}
if(L > Abscis) {
if ((Ui < TI(Index)) || (Ui > TI(Index+1))) {
Ui = (Abscis / L) * (TI(Index+1) - U0);
if (Direction)
Ui = U0 + Ui;
else
Ui = U0 - Ui;
}
theComputer.Init(C,TI(Index),TI(Index+1));
theComputer.Perform(sign*Abscis, U0, Ui, EPSILON);
return;
}
else {
U0 = TI(Index+Direction);
Abscis -= L;
}
if (Direction)
Index++;
else
Index--;
}
// Push a little bit outside the limits (hairy !!!)
Ui = U0 + 0.1;
theComputer.Init(C,U0,U0+0.2);
theComputer.Perform(sign*Abscis, U0, Ui, EPSILON);
return;
}
break;
}
}
// introduced by rbv for curvilinear parametrization
// performs more appropriate tolerance management
static void AdvCompute(CPnts_AbscissaPoint& theComputer,
const TheCurve& C,
Standard_Real& Abscis,
Standard_Real& U0,
Standard_Real& Ui,
const Standard_Real EPSILON)
{
Standard_Real Ratio = 1.0;
GCPnts_AbscissaType Type = computeType(C,Ratio);
switch (Type) {
case GCPnts_LengthParametrized :
theComputer.SetParameter(U0 + Abscis / Ratio);
return;
case GCPnts_Parametrized :
// theComputer.Init(C);
theComputer.Init(C, EPSILON); //rbv's modification
//
theComputer.AdvPerform(Abscis, U0, Ui, EPSILON);
return;
case GCPnts_AbsComposite :
{
Standard_Integer NbIntervals = C.NbIntervals(GeomAbs_CN);
TColStd_Array1OfReal TI(1,NbIntervals+1);
C.Intervals(TI,GeomAbs_CN);
Standard_Real L = 0.0, sign = 1.;
Standard_Integer Index = 1;
BSplCLib::Hunt(TI,U0,Index);
Standard_Integer Direction = 1;
if (Abscis < 0) {
Direction = 0;
Abscis = -Abscis;
sign = -1.;
}
if(Index == 0 && Direction > 0) {
L = CPnts_AbscissaPoint::Length(C, U0, TI(Index+Direction), EPSILON);
if (Abs(L - Abscis) <= /*Precision::Confusion()*/EPSILON) {
theComputer.SetParameter(TI(Index+Direction));
return;
}
if(L > Abscis) {
if ( Ui > TI(Index+1) ) {
Ui = (Abscis / L) * (TI(Index+1) - U0);
Ui = U0 + Ui;
}
theComputer.Init(C,U0,TI(Index+1), EPSILON);
theComputer.AdvPerform(sign*Abscis, U0, Ui, EPSILON);
return;
}
else {
U0 = TI(Index+Direction);
Abscis -= L;
}
Index++;
}
while ((Index >= 1) && (Index <= NbIntervals)) {
L = CPnts_AbscissaPoint::Length(C, U0, TI(Index+Direction), EPSILON);
if (Abs(L - Abscis) <= Precision::PConfusion()) {
theComputer.SetParameter(TI(Index+Direction));
return;
}
if(L > Abscis) {
if ((Ui < TI(Index)) || (Ui > TI(Index+1))) {
Ui = (Abscis / L) * (TI(Index+1) - U0);
if (Direction)
Ui = U0 + Ui;
else
Ui = U0 - Ui;
}
theComputer.Init(C,TI(Index),TI(Index+1), EPSILON);
theComputer.AdvPerform(sign*Abscis, U0, Ui, EPSILON);
return;
}
else {
U0 = TI(Index+Direction);
Abscis -= L;
}
if (Direction) {
Index++;
}
else {
Index--;
}
}
// Push a little bit outside the limits (hairy !!!)
Standard_Boolean nonperiodic = !C.IsPeriodic();
Ui = U0 + sign*0.1;
Standard_Real U1 = U0 + sign*.2;
if(nonperiodic) {
if(sign > 0) {
Ui = Min(Ui,C.LastParameter());
U1 = Min(U1, C.LastParameter());
}
else {
Ui = Max(Ui,C.FirstParameter());
U1 = Max(U1, C.FirstParameter());
}
}
theComputer.Init(C, U0, U1, EPSILON);
theComputer.AdvPerform(sign*Abscis, U0, Ui, EPSILON);
return;
}
break;
}
}
//=======================================================================
//function : Length
//purpose :
//=======================================================================
Standard_Real GCPnts_AbscissaPoint::Length(const TheCurve& C)
{
return GCPnts_AbscissaPoint::Length(C,C.FirstParameter(),
C.LastParameter());
}
//=======================================================================
//function : Length
//purpose :
//=======================================================================
Standard_Real GCPnts_AbscissaPoint::Length(const TheCurve& C,
const Standard_Real Tol)
{
return GCPnts_AbscissaPoint::Length(C,C.FirstParameter(),
C.LastParameter(),Tol);
}
//=======================================================================
//function : Length
//purpose :
//=======================================================================
Standard_Real GCPnts_AbscissaPoint::Length(const TheCurve& C,
const Standard_Real U1,
const Standard_Real U2)
{
Standard_Real Ratio = 1.0;
GCPnts_AbscissaType Type = computeType(C,Ratio);
switch (Type) {
case GCPnts_LengthParametrized:
return Abs(U2-U1) * Ratio;
case GCPnts_Parametrized:
return CPnts_AbscissaPoint::Length(C, U1, U2);
case GCPnts_AbsComposite:
{
Standard_Integer NbIntervals = C.NbIntervals(GeomAbs_CN);
TColStd_Array1OfReal TI(1,NbIntervals+1);
C.Intervals(TI,GeomAbs_CN);
Standard_Real UU1 = Min(U1, U2);
Standard_Real UU2 = Max(U1, U2);
Standard_Real L = 0.0;
for(Standard_Integer Index = 1; Index <= NbIntervals; Index++) {
if (TI(Index) > UU2) break;
if (TI(Index+1) < UU1) continue;
L += CPnts_AbscissaPoint::Length(C,
Max(TI(Index),UU1),
Min(TI(Index+1),UU2));
}
return L;
}
}
return RealLast();
}
//=======================================================================
//function : Length
//purpose :
//=======================================================================
Standard_Real GCPnts_AbscissaPoint::Length(const TheCurve& C,
const Standard_Real U1,
const Standard_Real U2,
const Standard_Real Tol)
{
Standard_Real Ratio = 1.0;
GCPnts_AbscissaType Type = computeType(C,Ratio);
switch (Type) {
case GCPnts_LengthParametrized:
return Abs(U2-U1) * Ratio;
case GCPnts_Parametrized:
return CPnts_AbscissaPoint::Length(C, U1, U2, Tol);
case GCPnts_AbsComposite:
{
Standard_Integer NbIntervals = C.NbIntervals(GeomAbs_CN);
TColStd_Array1OfReal TI(1,NbIntervals+1);
C.Intervals(TI,GeomAbs_CN);
Standard_Real UU1 = Min(U1, U2);
Standard_Real UU2 = Max(U1, U2);
Standard_Real L = 0.0;
for(Standard_Integer Index = 1; Index <= NbIntervals; Index++) {
if (TI(Index) > UU2) break;
if (TI(Index+1) < UU1) continue;
L += CPnts_AbscissaPoint::Length(C,
Max(TI(Index),UU1),
Min(TI(Index+1),UU2),
Tol);
}
return L;
}
}
return RealLast();
}
//=======================================================================
//function : GCPnts_AbscissaPoint
//purpose :
//=======================================================================
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint
(const TheCurve& C,
const Standard_Real Abscissa,
const Standard_Real U0)
{
Standard_Real L = GCPnts_AbscissaPoint::Length(C);
if (L < Precision::Confusion()) {
throw Standard_ConstructionError();
}
Standard_Real Abscis = Abscissa;
Standard_Real UU0 = U0;
Standard_Real UUi = U0 +
(Abscis / L) * (C.LastParameter() - C.FirstParameter());
Compute(myComputer, C, Abscis, UU0, UUi,
C.Resolution(Precision::Confusion()));
}
//=======================================================================
//function : GCPnts_AbscissaPoint
//purpose : rbv for curvilinear parametrization
//=======================================================================
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint
(const Standard_Real Tol,
const TheCurve& C,
const Standard_Real Abscissa,
const Standard_Real U0)
{
Standard_Real L = GCPnts_AbscissaPoint::Length(C, Tol);
/* if (L < Precision::Confusion()) {
cout<<"FirstParameter = "<<C.FirstParameter()<<endl;
cout<<"LastParameter = "<<C.LastParameter()<<endl;
throw Standard_ConstructionError("GCPnts_AbscissaPoint::GCPnts_AbscissaPoint");
}
*/
Standard_Real Abscis = Abscissa;
Standard_Real UU0 = U0;
Standard_Real UUi;
if (L >= Precision::Confusion())
UUi= U0 +
(Abscis / L) * (C.LastParameter() - C.FirstParameter());
else UUi = U0;
AdvCompute(myComputer, C, Abscis, UU0, UUi, Tol);
}
//=======================================================================
//function : GCPnts_AbscissaPoint
//purpose :
//=======================================================================
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint
(const TheCurve& C,
const Standard_Real Abscissa,
const Standard_Real U0,
const Standard_Real Ui)
{
Standard_Real Abscis = Abscissa;
Standard_Real UU0 = U0;
Standard_Real UUi = Ui;
Compute(myComputer, C, Abscis, UU0, UUi,
C.Resolution(Precision::Confusion()));
}
//=======================================================================
//function : GCPnts_AbscissaPoint
//purpose : rbv for curvilinear parametrization
//=======================================================================
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint
(const TheCurve& C,
const Standard_Real Abscissa,
const Standard_Real U0,
const Standard_Real Ui,
const Standard_Real Tol)
{
Standard_Real Abscis = Abscissa;
Standard_Real UU0 = U0;
Standard_Real UUi = Ui;
AdvCompute(myComputer, C, Abscis, UU0, UUi, Tol);
}

View File

@@ -23,7 +23,7 @@ class gp_Pnt;
//! Class to define function, which calculates square distance between point on curve
//! C(u), U1 <= u <= U2 and line passing through points C(U1) and C(U2)
//! This function is used in any minimization algorithm to define maximal deviation between curve and line,
//! This function is used in any minimisation algorithm to define maximal deviation between curve and line,
//! which required one variable function without derivative (for ex. math_BrentMinimum)
class GCPnts_DistFunction : public math_Function
{

View File

@@ -12,200 +12,65 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <GCPnts_QuasiUniformAbscissa.hxx>
//#include <GCPnts_QuasiUniformAbscissa.ixx>
#include <GCPnts_TCurveTypes.hxx>
#include <GCPnts_UniformAbscissa.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <StdFail_NotDone.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_ConstructionError.hxx>
#include <GCPnts_QuasiUniformAbscissa.hxx>
#include <GCPnts_UniformAbscissa.hxx>
#include <Adaptor3d_Curve.hxx>
#include <Adaptor2d_Curve2d.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <gp_Pnt2d.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <gp_Pnt.hxx>
#ifdef OCCT_DEBUG
//#include <DrawTrSurf.hxx>
//static Standard_Integer compteur = 0;
#endif
//=======================================================================
//function : GCPnts_QuasiUniformAbscissa
//purpose :
//purpose :
//=======================================================================
GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa()
: myDone (Standard_False),
myNbPoints (0)
GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa ()
:myDone(Standard_False),
myNbPoints(0)
{
//
}
//=======================================================================
//function : GCPnts_QuasiUniformAbscissa
//purpose :
//=======================================================================
GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa (const Adaptor3d_Curve& theC,
const Standard_Integer theNbPoints)
: myDone (Standard_False),
myNbPoints (0)
{
Initialize (theC, theNbPoints);
}
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
//=======================================================================
//function : GCPnts_QuasiUniformAbscissa
//purpose :
//=======================================================================
GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa (const Adaptor3d_Curve& theC,
const Standard_Integer theNbPoints,
const Standard_Real theU1,
const Standard_Real theU2)
: myDone (Standard_False),
myNbPoints (0)
{
Initialize (theC, theNbPoints, theU1, theU2);
}
#define TheCurve Adaptor3d_Curve
#define Handle_TheBezierCurve Handle(Geom_BezierCurve)
#define Handle_TheBSplineCurve Handle(Geom_BSplineCurve)
#define TheArray1OfPnt TColgp_Array1OfPnt
#define ThePnt gp_Pnt
//=======================================================================
//function : GCPnts_QuasiUniformAbscissa
//purpose :
//=======================================================================
GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa (const Adaptor2d_Curve2d& theC,
const Standard_Integer theNbPoints)
: myDone (Standard_False),
myNbPoints (0)
{
Initialize (theC, theNbPoints);
}
#include "GCPnts_QuasiUniformAbscissa.pxx"
//=======================================================================
//function : GCPnts_QuasiUniformAbscissa
//purpose :
//=======================================================================
GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa (const Adaptor2d_Curve2d& theC,
const Standard_Integer theNbPoints,
const Standard_Real theU1,
const Standard_Real theU2)
: myDone (Standard_False),
myNbPoints (0)
{
Initialize (theC, theNbPoints, theU1, theU2);
}
#undef TheCurve
#undef Handle_TheBezierCurve
#undef Handle_TheBSplineCurve
#undef TheArray1OfPnt
#undef ThePnt
//=======================================================================
//function : Initialize
//purpose :
//=======================================================================
void GCPnts_QuasiUniformAbscissa::Initialize (const Adaptor3d_Curve& theC,
const Standard_Integer theNbPoints)
{
Initialize (theC, theNbPoints, theC.FirstParameter(), theC.LastParameter());
}
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
//=======================================================================
//function : Initialize
//purpose :
//=======================================================================
void GCPnts_QuasiUniformAbscissa::Initialize (const Adaptor2d_Curve2d& theC,
const Standard_Integer theNbPoints)
{
Initialize (theC, theNbPoints, theC.FirstParameter(), theC.LastParameter());
}
#define TheCurve Adaptor2d_Curve2d
#define Handle_TheBezierCurve Handle(Geom2d_BezierCurve)
#define Handle_TheBSplineCurve Handle(Geom2d_BSplineCurve)
#define TheArray1OfPnt TColgp_Array1OfPnt2d
#define ThePnt gp_Pnt2d
//=======================================================================
//function : Initialize
//purpose :
//=======================================================================
void GCPnts_QuasiUniformAbscissa::Initialize (const Adaptor3d_Curve& theC,
const Standard_Integer theNbPoints,
const Standard_Real theU1,
const Standard_Real theU2)
{
initialize (theC, theNbPoints, theU1, theU2);
}
#include "GCPnts_QuasiUniformAbscissa.pxx"
//=======================================================================
//function : Initialize
//purpose :
//=======================================================================
void GCPnts_QuasiUniformAbscissa::Initialize (const Adaptor2d_Curve2d& theC,
const Standard_Integer theNbPoints,
const Standard_Real theU1,
const Standard_Real theU2)
{
initialize (theC, theNbPoints, theU1, theU2);
}
//=======================================================================
//function : initialize
//purpose :
//=======================================================================
template<class TheCurve>
void GCPnts_QuasiUniformAbscissa::initialize (const TheCurve& theC,
const Standard_Integer theNbPoints,
const Standard_Real theU1,
const Standard_Real theU2)
{
if (theC.GetType() != GeomAbs_BezierCurve
&& theC.GetType() != GeomAbs_BSplineCurve)
{
GCPnts_UniformAbscissa aUA (theC, theNbPoints, theU1, theU2);
myDone = aUA.IsDone();
myNbPoints = aUA.NbPoints();
myParams = new TColStd_HArray1OfReal (1, myNbPoints);
for (Standard_Integer aPntIter = 1 ; aPntIter <= myNbPoints; ++aPntIter)
{
myParams->SetValue (aPntIter, aUA.Parameter (aPntIter));
}
return;
}
Standard_ConstructionError_Raise_if (theNbPoints <= 1, "GCPnts_QuasiUniformAbscissa::Initialize(), number of points should be >= 2");
// evaluate the approximative length of the 3dCurve
myNbPoints = theNbPoints;
Standard_Real aLength = 0.0;
const Standard_Real dU = (theU2 - theU1) / (2 * theNbPoints - 1);
TColgp_Array1OfPnt2d aLP (1, 2 * theNbPoints); // table Length <-> Param
typename GCPnts_TCurveTypes<TheCurve>::Point aP1, aP2;
aP1 = theC.Value (theU1);
// On additionne toutes les distances
for (Standard_Integer i = 0; i < 2 * theNbPoints; ++i)
{
aP2 = theC.Value (theU1 + i * dU);
const Standard_Real aDist = aP1.Distance (aP2);
aLength += aDist;
aLP(i+1) = gp_Pnt2d (aLength, theU1 + (i * dU));
aP1 = aP2;
}
// On cherche a mettre NbPoints dans la curve.
// on met les points environ a Length/NbPoints.
if (IsEqual (aLength, 0.0))
{ //use usual analytical grid
Standard_Real aStep = (theU2 - theU1) / (theNbPoints - 1);
myParams = new TColStd_HArray1OfReal (1, theNbPoints);
myParams->SetValue (1, theU1);
for (Standard_Integer i = 2; i < theNbPoints; ++i)
{
myParams->SetValue (i, theU1 + aStep * (i - 1));
}
}
else
{
const Standard_Real aDCorde = aLength / (theNbPoints - 1);
Standard_Real aCorde = aDCorde;
Standard_Integer anIndex = 1;
myParams = new TColStd_HArray1OfReal (1, theNbPoints);
myParams->SetValue (1, theU1);
for (Standard_Integer i = 2; i < theNbPoints; ++i)
{
while (aLP (anIndex).X() < aCorde)
{
++anIndex;
}
Standard_Real anAlpha = (aCorde - aLP(anIndex - 1).X()) / (aLP (anIndex).X() - aLP (anIndex-1).X());
Standard_Real aU = aLP (anIndex - 1).Y() + anAlpha * (aLP (anIndex).Y() - aLP (anIndex-1).Y());
myParams->SetValue (i, aU);
aCorde = i * aDCorde;
}
}
myParams->SetValue (theNbPoints, theU2);
myDone = Standard_True;
}

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