mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f858df7b56 | ||
|
fd2efe5428 | ||
|
a34bddcfd6 | ||
|
d0d9e9375f | ||
|
f6651f22e6 | ||
|
ad3dc75556 | ||
|
b06da8f1f1 | ||
|
e186cf152b | ||
|
316ea29318 | ||
|
b69e576af0 | ||
|
e8e157df45 | ||
|
1294d5e39e | ||
|
93e453aa02 | ||
|
57357010a8 | ||
|
b907cca37e | ||
|
d85cd274c4 | ||
|
87b68a0fd6 | ||
|
e76471b558 | ||
|
d37aef5ccf | ||
|
75e1b51170 | ||
|
9e7cc3ad59 | ||
|
194c71af96 | ||
|
24579ecd6e | ||
|
de8a63e98e | ||
|
3d42fbc189 | ||
|
a2af24d1a9 | ||
|
c6aa2a8317 | ||
|
95bdefb201 | ||
|
c57bf5636c | ||
|
5c9493b348 |
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -1,6 +1,8 @@
|
||||
.gitattributes eol=lf
|
||||
.gitignore eol=lf
|
||||
*.txt eol=lf
|
||||
*.htm eol=lf
|
||||
*.html eol=lf
|
||||
*.h eol=lf
|
||||
*.c eol=lf
|
||||
*.inl eol=lf
|
||||
@@ -29,6 +31,7 @@
|
||||
*.xib eol=lf
|
||||
*.plist eol=lf
|
||||
*.java eol=lf
|
||||
*.js eol=lf
|
||||
*.igs eol=lf
|
||||
*.iges eol=lf
|
||||
*.stp eol=lf
|
||||
@@ -44,6 +47,7 @@
|
||||
FILES eol=lf
|
||||
PACKAGES eol=lf
|
||||
EXTERNLIB eol=lf
|
||||
EXTERNLIB_STATIC eol=lf
|
||||
UDLIST eol=lf
|
||||
tests/* eol=lf
|
||||
tests/*/* eol=lf
|
||||
|
@@ -373,10 +373,12 @@ 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}")
|
||||
if (WIN32 OR ANDROID OR IOS OR EMSCRIPTEN)
|
||||
# no Xlib
|
||||
elseif (APPLE)
|
||||
set (USE_XLIB OFF CACHE BOOL "${USE_XLIB_DESCR}")
|
||||
else()
|
||||
set (USE_GLX OFF)
|
||||
set (USE_XLIB ON CACHE BOOL "${USE_XLIB_DESCR}")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
@@ -445,12 +447,6 @@ foreach (OCCT_MODULE ${OCCT_MODULES})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# DRAWEXE excluded when library build is static
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
list (REMOVE_ITEM BUILD_TOOLKITS DRAWEXE)
|
||||
message (STATUS "Info: DRAWEXE is not included due to ${BUILD_LIBRARY_TYPE} build library type")
|
||||
endif()
|
||||
|
||||
# accumulate all used toolkits
|
||||
list (REMOVE_DUPLICATES BUILD_TOOLKITS)
|
||||
set (RAW_BUILD_TOOLKITS)
|
||||
@@ -503,6 +499,7 @@ endif()
|
||||
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_XwLibs CAN_USE_XLIB)
|
||||
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)
|
||||
@@ -537,6 +534,19 @@ else()
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TK")
|
||||
endif()
|
||||
|
||||
# Xlib
|
||||
if (CAN_USE_XLIB)
|
||||
if (USE_XLIB)
|
||||
message (STATUS "Info: Xlib is used by OCCT")
|
||||
add_definitions (-DHAVE_XLIB)
|
||||
if (APPLE)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_XLIB")
|
||||
endif()
|
||||
|
||||
# FreeType
|
||||
if (CAN_USE_FREETYPE)
|
||||
if (USE_FREETYPE)
|
||||
@@ -571,12 +581,6 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# GLX
|
||||
if (USE_GLX)
|
||||
add_definitions (-DMACOSX_USE_GLX)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx")
|
||||
endif()
|
||||
|
||||
# FREEIMAGE
|
||||
if (CAN_USE_FREEIMAGE)
|
||||
if (USE_FREEIMAGE)
|
||||
@@ -1232,7 +1236,7 @@ if (WIN32)
|
||||
set (SET_OpenCASCADE_WITH_D3D "set (OpenCASCADE_WITH_D3D ${USE_D3D})")
|
||||
endif()
|
||||
if (APPLE)
|
||||
set (SET_OpenCASCADE_WITH_GLX "set (OpenCASCADE_WITH_GLX ${USE_GLX})")
|
||||
set (SET_OpenCASCADE_WITH_GLX "set (OpenCASCADE_WITH_GLX ${USE_XLIB})")
|
||||
endif()
|
||||
|
||||
# Configure and install cmake config file
|
||||
|
@@ -197,7 +197,6 @@ t TKPrim
|
||||
t TKShHealing
|
||||
t TKTopAlgo
|
||||
t TKXMesh
|
||||
n InterfaceGraphic
|
||||
n AIS
|
||||
n Aspect
|
||||
n DsgPrs
|
||||
|
@@ -109,7 +109,7 @@ else()
|
||||
find_library (OpenGlesLibs_LIB NAMES OpenGLES)
|
||||
set (CSF_OpenGlesLibs ${OpenGlesLibs_LIB})
|
||||
OCCT_CHECK_AND_UNSET (OpenGlesLibs_LIB)
|
||||
elseif (USE_GLX)
|
||||
elseif (USE_XLIB)
|
||||
set (CSF_OpenGlLibs GL)
|
||||
set (CSF_XwLibs "X11 Xext Xmu Xi")
|
||||
else()
|
||||
@@ -118,15 +118,23 @@ else()
|
||||
OCCT_CHECK_AND_UNSET (OpenGlLibs_LIB)
|
||||
endif()
|
||||
|
||||
elseif (EMSCRIPTEN)
|
||||
set (CSF_ThreadLibs "pthread rt stdc++")
|
||||
set (CSF_OpenGlesLibs "EGL GLESv2")
|
||||
set (CSF_dl "dl")
|
||||
elseif (ANDROID)
|
||||
set (CSF_ThreadLibs "c")
|
||||
set (CSF_OpenGlesLibs "EGL GLESv2")
|
||||
set (CSF_androidlog "log")
|
||||
elseif (UNIX)
|
||||
set (CSF_ThreadLibs "pthread rt stdc++")
|
||||
set (CSF_OpenGlLibs "GL")
|
||||
if (USE_XLIB)
|
||||
set (CSF_OpenGlLibs "GL")
|
||||
set (CSF_XwLibs "X11 Xext Xmu Xi")
|
||||
else()
|
||||
set (CSF_OpenGlLibs "GL EGL")
|
||||
endif()
|
||||
set (CSF_OpenGlesLibs "EGL GLESv2")
|
||||
set (CSF_XwLibs "X11 Xext Xmu Xi")
|
||||
set (CSF_dl "dl")
|
||||
if (USE_FREETYPE)
|
||||
set (CSF_fontconfig "fontconfig")
|
||||
|
@@ -22,7 +22,7 @@ if ("${OCCT_TOOLKITS_NAME_SUFFIX}" STREQUAL "")
|
||||
set (OCCT_TOOLKITS_NAME_SUFFIX "TOOLKITS")
|
||||
endif()
|
||||
|
||||
# parce PACKAGES file
|
||||
# parse PACKAGES file
|
||||
FILE_TO_LIST ("${RELATIVE_SOURCES_DIR}/${PROJECT_NAME}/PACKAGES" USED_PACKAGES)
|
||||
if ("${USED_PACKAGES}" STREQUAL "")
|
||||
set (USED_PACKAGES ${PROJECT_NAME})
|
||||
@@ -39,7 +39,7 @@ set (PRECOMPILED_DEFS)
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
list (APPEND PRECOMPILED_DEFS "-DOCCT_NO_PLUGINS")
|
||||
if (WIN32)
|
||||
if (WIN32 AND NOT EXECUTABLE_PROJECT)
|
||||
list (APPEND PRECOMPILED_DEFS "-DOCCT_STATIC_BUILD")
|
||||
endif()
|
||||
endif()
|
||||
@@ -228,6 +228,10 @@ if (EXECUTABLE_PROJECT)
|
||||
|
||||
install (TARGETS ${PROJECT_NAME}
|
||||
DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.wasm DESTINATION "${INSTALL_DIR_BIN}/${OCCT_INSTALL_BIN_LETTER}")
|
||||
endif()
|
||||
else()
|
||||
add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
|
||||
|
||||
@@ -283,8 +287,12 @@ endif()
|
||||
set (USED_TOOLKITS_BY_CURRENT_PROJECT)
|
||||
set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT)
|
||||
|
||||
# parce EXTERNLIB file
|
||||
FILE_TO_LIST ("${RELATIVE_SOURCES_DIR}/${PROJECT_NAME}/EXTERNLIB" USED_EXTERNLIB_AND_TOOLKITS)
|
||||
# parse EXTERNLIB file
|
||||
if (CUSTOM_EXTERNLIB)
|
||||
set (USED_EXTERNLIB_AND_TOOLKITS ${CUSTOM_EXTERNLIB})
|
||||
else()
|
||||
FILE_TO_LIST ("${RELATIVE_SOURCES_DIR}/${PROJECT_NAME}/EXTERNLIB" USED_EXTERNLIB_AND_TOOLKITS)
|
||||
endif()
|
||||
foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
|
||||
string (REGEX MATCH "^ *#" COMMENT_FOUND ${USED_ITEM})
|
||||
if (NOT COMMENT_FOUND)
|
||||
@@ -383,7 +391,7 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (BUILD_SHARED_LIBS OR EXECUTABLE_PROJECT)
|
||||
if(IS_VTK_9XX)
|
||||
string (REGEX REPLACE "vtk" "VTK::" USED_TOOLKITS_BY_CURRENT_PROJECT "${USED_TOOLKITS_BY_CURRENT_PROJECT}")
|
||||
endif()
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# tcl
|
||||
|
||||
if (NOT DEFINED INSTALL_TCL AND BUILD_SHARED_LIBS)
|
||||
if (NOT DEFINED INSTALL_TCL)
|
||||
set (INSTALL_TCL OFF CACHE BOOL "${INSTALL_TCL_DESCR}")
|
||||
endif()
|
||||
|
||||
@@ -14,30 +14,30 @@ if (NOT DEFINED 3RDPARTY_TCL_INCLUDE_DIR)
|
||||
set (3RDPARTY_TCL_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tcl")
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# tcl library file (with absolute path)
|
||||
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR)
|
||||
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library" FORCE)
|
||||
endif()
|
||||
|
||||
# tcl library directory
|
||||
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR)
|
||||
set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library")
|
||||
endif()
|
||||
# tcl library file (with absolute path)
|
||||
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR)
|
||||
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library" FORCE)
|
||||
endif()
|
||||
|
||||
# tcl shared library (with absolute path)
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR)
|
||||
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "tcl shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
# tcl library directory
|
||||
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR)
|
||||
set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library")
|
||||
endif()
|
||||
|
||||
# tcl shared library directory
|
||||
if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR)
|
||||
set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library")
|
||||
# tcl shared library (with absolute path)
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR)
|
||||
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "tcl shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# tcl shared library directory
|
||||
if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR)
|
||||
set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library")
|
||||
endif()
|
||||
|
||||
|
||||
# search for tcl in user defined directory
|
||||
if (NOT 3RDPARTY_TCL_DIR AND 3RDPARTY_DIR)
|
||||
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" tcl TCL_DIR_NAME)
|
||||
@@ -64,204 +64,198 @@ if (NOT 3RDPARTY_TCL_INCLUDE_DIR)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# tcl dir and library
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY)
|
||||
if (TCL_LIBRARY AND EXISTS "${TCL_LIBRARY}")
|
||||
set (3RDPARTY_TCL_LIBRARY "${TCL_LIBRARY}" CACHE FILEPATH "TCL library" FORCE)
|
||||
# tcl dir and library
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY)
|
||||
if (TCL_LIBRARY AND EXISTS "${TCL_LIBRARY}")
|
||||
set (3RDPARTY_TCL_LIBRARY "${TCL_LIBRARY}" CACHE FILEPATH "TCL library" FORCE)
|
||||
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY_DIR)
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
|
||||
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
|
||||
endif()
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY_DIR)
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
|
||||
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_TCL_DLL)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll .a)
|
||||
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_TCL_DLL)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll .a)
|
||||
|
||||
set (DLL_FOLDER_FOR_SEARCH "")
|
||||
if (3RDPARTY_TCL_DLL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
|
||||
elseif (3RDPARTY_TCL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
|
||||
elseif (3RDPARTY_TCL_LIBRARY_DIR)
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
|
||||
find_library (3RDPARTY_TCL_DLL NAMES ${CSF_TclLibs}
|
||||
PATHS "${DLL_FOLDER_FOR_SEARCH}"
|
||||
NO_DEFAULT_PATH)
|
||||
set (DLL_FOLDER_FOR_SEARCH "")
|
||||
if (3RDPARTY_TCL_DLL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
|
||||
elseif (3RDPARTY_TCL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
|
||||
elseif (3RDPARTY_TCL_LIBRARY_DIR)
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
|
||||
find_library (3RDPARTY_TCL_DLL NAMES ${CSF_TclLibs}
|
||||
PATHS "${DLL_FOLDER_FOR_SEARCH}"
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
COMPLIANCE_PRODUCT_CONSISTENCY(TCL)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# tcl dir and library
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY)
|
||||
set (3RDPARTY_TCL_LIBRARY "3RDPARTY_TCL_LIBRARY-NOTFOUND" CACHE FILEPATH "TCL library" FORCE)
|
||||
find_library (3RDPARTY_TCL_LIBRARY NAMES ${CSF_TclLibs}
|
||||
PATHS "${3RDPARTY_TCL_LIBRARY_DIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
# search in another place if previous search doesn't find anything
|
||||
find_library (3RDPARTY_TCL_LIBRARY NAMES ${CSF_TclLibs}
|
||||
PATHS "${3RDPARTY_TCL_DIR}/lib"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY OR NOT EXISTS "${3RDPARTY_TCL_LIBRARY}")
|
||||
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "TCL library" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY_DIR AND 3RDPARTY_TCL_LIBRARY)
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
|
||||
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION "")
|
||||
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
|
||||
get_filename_component (TCL_LIBRARY_NAME "${3RDPARTY_TCL_LIBRARY}" NAME)
|
||||
string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY_NAME}")
|
||||
|
||||
if (NOT "${TCL_LIBRARY_VERSION}" STREQUAL "${TCL_LIBRARY_NAME}")
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION "${TCL_LIBRARY_VERSION}")
|
||||
else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
|
||||
message (STATUS "Info: TCL version isn't found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "")
|
||||
if (3RDPARTY_TCL_LIBRARY_VERSION)
|
||||
string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TCL_MAJOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
|
||||
string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TCL_MINOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TCL_MAJOR_VERSION}.${3RDPARTY_TCL_MINOR_VERSION}")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_TCL_DLL)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll .a)
|
||||
|
||||
set (DLL_FOLDER_FOR_SEARCH "")
|
||||
if (3RDPARTY_TCL_DLL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
|
||||
elseif (3RDPARTY_TCL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
|
||||
else()
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
|
||||
find_library (3RDPARTY_TCL_DLL NAMES tcl${3RDPARTY_TCL_LIBRARY_VERSION}
|
||||
PATHS "${DLL_FOLDER_FOR_SEARCH}"
|
||||
# tcl dir and library
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY)
|
||||
set (3RDPARTY_TCL_LIBRARY "3RDPARTY_TCL_LIBRARY-NOTFOUND" CACHE FILEPATH "TCL library" FORCE)
|
||||
find_library (3RDPARTY_TCL_LIBRARY NAMES ${CSF_TclLibs}
|
||||
PATHS "${3RDPARTY_TCL_LIBRARY_DIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
if (NOT 3RDPARTY_TCL_DLL OR NOT EXISTS "${3RDPARTY_TCL_DLL}")
|
||||
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "TCL shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
if (NOT 3RDPARTY_TCL_DLL_DIR AND 3RDPARTY_TCL_DLL)
|
||||
get_filename_component (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH)
|
||||
set (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL_DIR}" CACHE FILEPATH "The directory containing TCL shared library" FORCE)
|
||||
endif()
|
||||
# search in another place if previous search doesn't find anything
|
||||
find_library (3RDPARTY_TCL_LIBRARY NAMES ${CSF_TclLibs}
|
||||
PATHS "${3RDPARTY_TCL_DIR}/lib"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY OR NOT EXISTS "${3RDPARTY_TCL_LIBRARY}")
|
||||
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "TCL library" FORCE)
|
||||
endif()
|
||||
|
||||
# include found paths to common variables
|
||||
if (3RDPARTY_TCL_INCLUDE_DIR AND EXISTS "${3RDPARTY_TCL_INCLUDE_DIR}")
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TCL_INCLUDE_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_INCLUDE_DIR)
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY_DIR AND 3RDPARTY_TCL_LIBRARY)
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
|
||||
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_TCL_LIBRARY_DIR)
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION "")
|
||||
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
|
||||
get_filename_component (TCL_LIBRARY_NAME "${3RDPARTY_TCL_LIBRARY}" NAME)
|
||||
string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY_NAME}")
|
||||
|
||||
if (NOT "${TCL_LIBRARY_VERSION}" STREQUAL "${TCL_LIBRARY_NAME}")
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION "${TCL_LIBRARY_VERSION}")
|
||||
else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
|
||||
message (STATUS "Info: TCL version isn't found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "")
|
||||
if (3RDPARTY_TCL_LIBRARY_VERSION)
|
||||
string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TCL_MAJOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
|
||||
string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TCL_MINOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TCL_MAJOR_VERSION}.${3RDPARTY_TCL_MINOR_VERSION}")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_TCL_DLL)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll .a)
|
||||
|
||||
set (DLL_FOLDER_FOR_SEARCH "")
|
||||
if (3RDPARTY_TCL_DLL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
|
||||
elseif (3RDPARTY_TCL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
|
||||
else()
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
|
||||
find_library (3RDPARTY_TCL_DLL NAMES tcl${3RDPARTY_TCL_LIBRARY_VERSION}
|
||||
PATHS "${DLL_FOLDER_FOR_SEARCH}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
if (NOT 3RDPARTY_TCL_DLL OR NOT EXISTS "${3RDPARTY_TCL_DLL}")
|
||||
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "TCL shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
if (NOT 3RDPARTY_TCL_DLL_DIR AND 3RDPARTY_TCL_DLL)
|
||||
get_filename_component (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH)
|
||||
set (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL_DIR}" CACHE FILEPATH "The directory containing TCL shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# include found paths to common variables
|
||||
if (3RDPARTY_TCL_INCLUDE_DIR AND EXISTS "${3RDPARTY_TCL_INCLUDE_DIR}")
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TCL_INCLUDE_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_TCL_LIBRARY_DIR)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (3RDPARTY_TCL_DLL OR EXISTS "${3RDPARTY_TCL_DLL}")
|
||||
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TCL_DLL_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_TCL_DLL_DIR)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# install tcl
|
||||
if (INSTALL_TCL)
|
||||
# include occt macros. compiler_bitness, os_wiht_bit, compiler
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
if (WIN32)
|
||||
if (3RDPARTY_TCL_DLL OR EXISTS "${3RDPARTY_TCL_DLL}")
|
||||
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TCL_DLL_DIR}")
|
||||
# tcl 8.6 requires zlib. install all dlls from tcl bin folder that may contain zlib also
|
||||
|
||||
# collect and install all dlls from tcl dll dirs
|
||||
file (GLOB TCL_DLLS "${3RDPARTY_TCL_DLL_DIR}/*.dll")
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${TCL_DLLS} DESTINATION "${INSTALL_DIR_BIN}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_TCL_DLL_DIR)
|
||||
install (FILES ${TCL_DLLS}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR_BIN}")
|
||||
install (FILES ${TCL_DLLS}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR_BIN}i")
|
||||
install (FILES ${TCL_DLLS}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR_BIN}d")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# install tcl
|
||||
if (INSTALL_TCL)
|
||||
# include occt macros. compiler_bitness, os_wiht_bit, compiler
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
if (WIN32)
|
||||
# tcl 8.6 requires zlib. install all dlls from tcl bin folder that may contain zlib also
|
||||
|
||||
# collect and install all dlls from tcl dll dirs
|
||||
file (GLOB TCL_DLLS "${3RDPARTY_TCL_DLL_DIR}/*.dll")
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${TCL_DLLS} DESTINATION "${INSTALL_DIR_BIN}")
|
||||
else()
|
||||
install (FILES ${TCL_DLLS}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR_BIN}")
|
||||
install (FILES ${TCL_DLLS}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR_BIN}i")
|
||||
install (FILES ${TCL_DLLS}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR_BIN}d")
|
||||
endif()
|
||||
else()
|
||||
get_filename_component(3RDPARTY_TCL_LIBRARY_REALPATH ${3RDPARTY_TCL_LIBRARY} REALPATH)
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR_LIB}")
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR_LIB}i")
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR_LIB}d")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (TCL_TCLSH_VERSION)
|
||||
# tcl is required to install in lib folder (without)
|
||||
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8" DESTINATION "${INSTALL_DIR_LIB}")
|
||||
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
message (STATUS "\nWarning: tclX.X subdir won't be copied during the installation process.")
|
||||
message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
|
||||
endif()
|
||||
|
||||
set (USED_3RDPARTY_TCL_DIR "")
|
||||
else()
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR})
|
||||
get_filename_component(3RDPARTY_TCL_LIBRARY_REALPATH ${3RDPARTY_TCL_LIBRARY} REALPATH)
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR})
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR_LIB}")
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR_LIB}i")
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR_LIB}d")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TCL_DLL)
|
||||
if (TCL_TCLSH_VERSION)
|
||||
# tcl is required to install in lib folder (without)
|
||||
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8" DESTINATION "${INSTALL_DIR_LIB}")
|
||||
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
message (STATUS "\nWarning: tclX.X subdir won't be copied during the installation process.")
|
||||
message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
|
||||
endif()
|
||||
|
||||
set (USED_3RDPARTY_TCL_DIR "")
|
||||
else()
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR})
|
||||
else()
|
||||
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TCL_DLL)
|
||||
|
||||
if (TK_FOUND AND 3RDPARTY_TCL_DIR)
|
||||
|
||||
get_filename_component (TK_WISH_ABSOLUTE "${TK_WISH}" ABSOLUTE)
|
||||
@@ -285,10 +279,3 @@ OCCT_CHECK_AND_UNSET (TK_LIBRARY)
|
||||
OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH)
|
||||
OCCT_CHECK_AND_UNSET (TK_WISH)
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_LIBRARY)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_LIBRARY_DIR)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL_DIR)
|
||||
OCCT_CHECK_AND_UNSET (INSTALL_TCL)
|
||||
endif()
|
||||
|
@@ -196,7 +196,7 @@ ToolKit, the technology of Kitware Inc intended for general-purpose scientific
|
||||
visualization. OCCT comes with a bridge between CAD data representation and
|
||||
VTK by means of its dedicated VIS component (VTK Integration Services).")
|
||||
|
||||
set (USE_GLX_DESCR "Indicates whether X11 OpenGl on OSX is used or not")
|
||||
set (USE_XLIB_DESCR "Indicates whether X11 is used or not")
|
||||
|
||||
set (USE_D3D_DESCR "Indicates whether optional Direct3D wrapper in OCCT visualization module should be build or not")
|
||||
|
||||
|
@@ -496,8 +496,8 @@ ttk::label .myFrame.myChecks.myFFmpegLbl -text "Use FFmpeg"
|
||||
checkbutton .myFrame.myChecks.myRapidJsonCheck -offvalue "false" -onvalue "true" -variable HAVE_RAPIDJSON -command wokdep:gui:UpdateList
|
||||
ttk::label .myFrame.myChecks.myRapidJsonLbl -text "Use RapidJSON"
|
||||
|
||||
checkbutton .myFrame.myChecks.myMacGLXCheck -offvalue "false" -onvalue "true" -variable MACOSX_USE_GLX
|
||||
ttk::label .myFrame.myChecks.myMacGLXLbl -text "Use X11 for windows drawing"
|
||||
checkbutton .myFrame.myChecks.myXLibCheck -offvalue "false" -onvalue "true" -variable HAVE_XLIB
|
||||
ttk::label .myFrame.myChecks.myXLibLbl -text "Use X11 for windows drawing"
|
||||
ttk::label .myFrame.myChecks.myVtkLbl -text "Use VTK"
|
||||
checkbutton .myFrame.myChecks.myVtkCheck -offvalue "false" -onvalue "true" -variable HAVE_VTK -command wokdep:gui:UpdateList
|
||||
|
||||
@@ -632,9 +632,9 @@ grid .myFrame.myChecks.myTbbLbl -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
|
||||
} elseif { "$::tcl_platform(os)" == "Darwin" } {
|
||||
grid .myFrame.myChecks.myMacGLXCheck -row $aCheckRowIter -column 4 -sticky e
|
||||
grid .myFrame.myChecks.myMacGLXLbl -row $aCheckRowIter -column 5 -sticky w
|
||||
} else {
|
||||
grid .myFrame.myChecks.myXLibCheck -row $aCheckRowIter -column 4 -sticky e
|
||||
grid .myFrame.myChecks.myXLibLbl -row $aCheckRowIter -column 5 -sticky w
|
||||
}
|
||||
grid .myFrame.myChecks.myLzmaCheck -row $aCheckRowIter -column 6 -sticky e
|
||||
grid .myFrame.myChecks.myLzmaLbl -row $aCheckRowIter -column 7 -sticky w
|
||||
|
@@ -68,10 +68,11 @@ 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}
|
||||
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 HAVE_XLIB HAVE_RelWithDebInfo BUILD_Inspector}
|
||||
foreach anEnvIter $THE_ENV_VARIABLES { set ${anEnvIter} "false" }
|
||||
set HAVE_TK "true"
|
||||
set HAVE_FREETYPE "true"
|
||||
if { "$tcl_platform(os)" != "Darwin" } { set HAVE_XLIB "true" }
|
||||
foreach anEnvIter $THE_ENV_VARIABLES {
|
||||
if { [info exists ::env(${anEnvIter})] } {
|
||||
set ${anEnvIter} "$::env(${anEnvIter})"
|
||||
@@ -80,12 +81,12 @@ foreach anEnvIter $THE_ENV_VARIABLES {
|
||||
# do not export platform-specific variables
|
||||
if { "$::tcl_platform(os)" == "Darwin" } {
|
||||
set HAVE_GLES2 ""
|
||||
} else {
|
||||
set MACOSX_USE_GLX ""
|
||||
}
|
||||
if { "$tcl_platform(platform)" != "windows" } {
|
||||
set HAVE_D3D ""
|
||||
set HAVE_RelWithDebInfo ""
|
||||
} else {
|
||||
set HAVE_XLIB ""
|
||||
}
|
||||
foreach anEnvIter {ARCH VCVER VCVARS PRJFMT } {
|
||||
if { [info exists ::env(${anEnvIter})] } {
|
||||
@@ -1195,7 +1196,7 @@ proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
|
||||
upvar $theErrBin64 anErrBin64
|
||||
|
||||
set isFound "true"
|
||||
if { "$::tcl_platform(platform)" == "windows" || ( "$::tcl_platform(os)" == "Darwin" && "$::MACOSX_USE_GLX" != "true" ) } {
|
||||
if { "$::tcl_platform(platform)" == "windows" || ( "$::tcl_platform(os)" == "Darwin" && "$::HAVE_XLIB" != "true" ) } {
|
||||
return "$isFound"
|
||||
}
|
||||
|
||||
|
@@ -1491,7 +1491,11 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
|
||||
}
|
||||
} else {
|
||||
set aLibsMap(CSF_dl) "dl"
|
||||
set aLibsMap(CSF_OpenGlLibs) "GL"
|
||||
if { "$::HAVE_XLIB" == "true" } {
|
||||
set aLibsMap(CSF_OpenGlLibs) "GL"
|
||||
} else {
|
||||
set aLibsMap(CSF_OpenGlLibs) "GL EGL"
|
||||
}
|
||||
set aLibsMap(CSF_OpenGlesLibs) "EGL GLESv2"
|
||||
if { "$theOS" == "mac" || "$theOS" == "ios" } {
|
||||
set aLibsMap(CSF_objc) "objc"
|
||||
@@ -1525,8 +1529,10 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
|
||||
if { "$::HAVE_TK" == "true" } {
|
||||
set aLibsMap(CSF_TclTkLibs) "tk8.6"
|
||||
}
|
||||
set aLibsMap(CSF_XwLibs) "X11 Xext Xmu Xi"
|
||||
set aLibsMap(CSF_MotifLibs) "X11"
|
||||
if { "$::HAVE_XLIB" == "true" } {
|
||||
set aLibsMap(CSF_XwLibs) "X11 Xext Xmu Xi"
|
||||
set aLibsMap(CSF_MotifLibs) "X11"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -59,11 +59,15 @@ win32 {
|
||||
} else {
|
||||
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
|
||||
CSF_TclTkLibs = -ltk8.6
|
||||
HAVE_XLIB {
|
||||
CSF_OpenGlLibs = -lGL
|
||||
CSF_XwLibs = -lX11 -lXext -lXmu -lXi
|
||||
CSF_MotifLibs = -lX11
|
||||
} else {
|
||||
CSF_OpenGlLibs = -lGL -lEGL
|
||||
}
|
||||
HAVE_FREETYPE { CSF_fontconfig = -lfontconfig }
|
||||
}
|
||||
|
||||
|
@@ -9,6 +9,10 @@
|
||||
# - Open project in Qt Creator, and call "Run qmake".
|
||||
# - Close the project in Qt Creator, open it again so that you should see the sub-modules in Project tree; call "Run qmake" again.
|
||||
# - "Run qmake" and perform Build.
|
||||
#
|
||||
# Within Debian-based Linux repository Qt Creator can be installed like this:
|
||||
# > sudo apt-get install qtcreator qtbase5-dev
|
||||
|
||||
TEMPLATE = subdirs
|
||||
exists(custom.auto.pri) { include(custom.auto.pri) }
|
||||
exists(custom.pri) { include(custom.pri) }
|
||||
|
39
adm/qmake/qtcreator-occt-cpp.xml
Normal file
39
adm/qmake/qtcreator-occt-cpp.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorCodeStyle>
|
||||
<!-- Written by QtCreator 3.6.1, 2016-05-19T14:46:43. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>CodeStyleData</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="AlignAssignments">true</value>
|
||||
<value type="bool" key="AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="BindStarToIdentifier">false</value>
|
||||
<value type="bool" key="BindStarToLeftSpecifier">true</value>
|
||||
<value type="bool" key="BindStarToRightSpecifier">false</value>
|
||||
<value type="bool" key="BindStarToTypeName">true</value>
|
||||
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
|
||||
<value type="bool" key="IndentAccessSpecifiers">false</value>
|
||||
<value type="bool" key="IndentBlockBody">true</value>
|
||||
<value type="bool" key="IndentBlockBraces">false</value>
|
||||
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">true</value>
|
||||
<value type="bool" key="IndentClassBraces">false</value>
|
||||
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
|
||||
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
|
||||
<value type="bool" key="IndentEnumBraces">false</value>
|
||||
<value type="bool" key="IndentFunctionBody">true</value>
|
||||
<value type="bool" key="IndentFunctionBraces">false</value>
|
||||
<value type="bool" key="IndentNamespaceBody">true</value>
|
||||
<value type="bool" key="IndentNamespaceBraces">false</value>
|
||||
<value type="int" key="IndentSize">2</value>
|
||||
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
|
||||
<value type="bool" key="IndentSwitchLabels">true</value>
|
||||
<value type="int" key="PaddingMode">2</value>
|
||||
<value type="bool" key="SpacesForTabs">true</value>
|
||||
<value type="int" key="TabSize">2</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>DisplayName</variable>
|
||||
<value type="QString">occt</value>
|
||||
</data>
|
||||
</qtcreator>
|
@@ -12,6 +12,7 @@ set VS=14
|
||||
set VSDATA=2015
|
||||
set VSPLATFORM=Win64
|
||||
set "BUILD_DIR=build-vs%VS%-%VSPLATFORM%"
|
||||
set "OCCT3RDPARTY="
|
||||
set "INSTALL_DIR=%SrcRoot%\install"
|
||||
|
||||
set BUILD_ADDITIONAL_TOOLKITS=
|
||||
|
@@ -13,6 +13,7 @@ rem Paths to 3rd-party tools and libraries
|
||||
set "aCmakeBin="
|
||||
set "aFreeType="
|
||||
set "aRapidJson="
|
||||
set "aTcl="
|
||||
|
||||
rem Build stages to perform
|
||||
set "toCMake=1"
|
||||
@@ -30,6 +31,7 @@ set "BUILD_ModelingAlgorithms=ON"
|
||||
set "BUILD_Visualization=ON"
|
||||
set "BUILD_ApplicationFramework=ON"
|
||||
set "BUILD_DataExchange=ON"
|
||||
set "BUILD_Draw=OFF"
|
||||
|
||||
rem Optional 3rd-party libraries to enable
|
||||
set "USE_RAPIDJSON=OFF"
|
||||
@@ -162,11 +164,16 @@ if ["%toCMake%"] == ["1"] (
|
||||
-D BUILD_MODULE_Visualization:BOOL="%BUILD_Visualization%" ^
|
||||
-D BUILD_MODULE_ApplicationFramework:BOOL="%BUILD_ApplicationFramework%" ^
|
||||
-D BUILD_MODULE_DataExchange:BOOL="%BUILD_DataExchange%" ^
|
||||
-D BUILD_MODULE_Draw:BOOL="OFF" ^
|
||||
-D BUILD_MODULE_Draw:BOOL="%BUILD_Draw%" ^
|
||||
-D BUILD_DOC_Overview:BOOL="OFF" ^
|
||||
-D USE_RAPIDJSON:BOOL="%USE_RAPIDJSON%" ^
|
||||
-D 3RDPARTY_RAPIDJSON_DIR:PATH="%aRapidJson%" ^
|
||||
-D 3RDPARTY_RAPIDJSON_INCLUDE_DIR:PATH="%aRapidJson%/include" ^
|
||||
-D 3RDPARTY_TCL_DIR:PATH="%aTcl%" ^
|
||||
-D 3RDPARTY_TCL_INCLUDE_DIR:PATH="%aTcl%/include" ^
|
||||
-D 3RDPARTY_TCL_LIBRARY_DIR:PATH="%aTcl%/lib" ^
|
||||
-D 3RDPARTY_TCL_LIBRARY:FILEPATH="%aTcl%/lib/libtcl.a" ^
|
||||
-D USE_TK:BOOL="OFF" ^
|
||||
"%aCasSrc%"
|
||||
|
||||
if errorlevel 1 (
|
||||
|
@@ -3,6 +3,8 @@
|
||||
# go to the script directory
|
||||
aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
|
||||
|
||||
aSystem=`uname -s`
|
||||
|
||||
# Reset values
|
||||
export CASROOT="__CASROOT__"
|
||||
export CASDEB=""
|
||||
@@ -20,7 +22,10 @@ export HAVE_LIBLZMA="false";
|
||||
export HAVE_RAPIDJSON="false";
|
||||
export HAVE_OPENVR="false";
|
||||
export HAVE_E57="false";
|
||||
export MACOSX_USE_GLX="false";
|
||||
export HAVE_XLIB="true";
|
||||
if [ "$aSystem" == "Darwin" ]; then
|
||||
export HAVE_XLIB="false";
|
||||
fi
|
||||
export CSF_OPT_INC=""
|
||||
export CSF_OPT_LIB32=""
|
||||
export CSF_OPT_LIB64=""
|
||||
@@ -60,7 +65,6 @@ else
|
||||
export ARCH="64";
|
||||
fi
|
||||
|
||||
aSystem=`uname -s`
|
||||
if [ "$aSystem" == "Darwin" ]; then
|
||||
export WOKSTATION="mac";
|
||||
export ARCH="64";
|
||||
@@ -113,8 +117,7 @@ if [ "$HAVE_LIBLZMA" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -D
|
||||
if [ "$HAVE_RAPIDJSON" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_RAPIDJSON"; fi
|
||||
if [ "$HAVE_OPENVR" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_OPENVR"; fi
|
||||
if [ "$HAVE_E57" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_E57"; fi
|
||||
# Option to compile OCCT with X11 libs on Mac OS X
|
||||
if [ "$MACOSX_USE_GLX" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DMACOSX_USE_GLX"; fi
|
||||
if [ "$HAVE_XLIB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_XLIB"; fi
|
||||
|
||||
# To split string into array
|
||||
aDelimBack=$IFS
|
||||
|
25
dox/build/build_3rdparty/building_3rdparty.md
vendored
25
dox/build/build_3rdparty/building_3rdparty.md
vendored
@@ -265,6 +265,18 @@ There are two types of third-party products, which are necessary to build OCCT:
|
||||
* FreeImage 3.14.1 - 3.16.0;
|
||||
* VTK 6.1.0.
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_4 Installation From Official Repositories
|
||||
|
||||
**Debian-based distributives**
|
||||
|
||||
All 3rd-party products required for building of OCCT could be installed
|
||||
from official repositories. You may install them from console using apt-get utility:
|
||||
|
||||
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libxt-dev libxmu-dev libxi-dev libgl1-mesa-dev libfreeimage-dev rapidjson-dev
|
||||
|
||||
Building is possible with C++ compliant compiler:
|
||||
|
||||
sudo apt-get install g++
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_2_1 Tcl/Tk
|
||||
|
||||
@@ -439,19 +451,6 @@ Download the necessary archive from https://www.vtk.org/VTK/resources/software.h
|
||||
|
||||
make install
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_4 Installation From Official Repositories
|
||||
|
||||
**Debian-based distributives**
|
||||
|
||||
All 3rd-party products required for building of OCCT could be installed
|
||||
from official repositories. You may install them from console using apt-get utility:
|
||||
|
||||
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libxt-dev libxmu-dev libxi-dev libgl1-mesa-dev libfreeimage-dev
|
||||
|
||||
Building is possible with C++ compliant compiler:
|
||||
|
||||
sudo apt-get install g++
|
||||
|
||||
@section build_3rdparty_macos Mac OS X
|
||||
|
||||
This document presents additional guidelines for building third-party products
|
||||
|
@@ -21,7 +21,6 @@ FILE_PATTERNS = *.md *.dox
|
||||
RECURSIVE = YES
|
||||
SOURCE_BROWSER = NO
|
||||
INLINE_SOURCES = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
GENERATE_DOCSET = NO
|
||||
GENERATE_CHI = NO
|
||||
GENERATE_QHP = NO
|
||||
|
@@ -21,7 +21,6 @@ FILE_PATTERNS = *.md *.dox
|
||||
RECURSIVE = YES
|
||||
SOURCE_BROWSER = NO
|
||||
INLINE_SOURCES = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
GENERATE_DOCSET = NO
|
||||
GENERATE_CHI = NO
|
||||
GENERATE_QHP = NO
|
||||
|
@@ -180,7 +180,7 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl
|
||||
const TDF_LabelList& currentFunctions = iterator.Current();
|
||||
|
||||
//The list of current functions is iterated.
|
||||
TDF_ListIteratorOfLabelList currentterator( currentFucntions );
|
||||
TDF_ListIteratorOfLabelList currentterator( currentFunctions );
|
||||
for (; currentIterator.More(); currentIterator.Next())
|
||||
{
|
||||
// An interface for the function is created.
|
||||
|
@@ -11004,9 +11004,9 @@ Converts a surface of linear extrusion, revolution and offset surfaces into BSpl
|
||||
|
||||
**Example:**
|
||||
~~~~~
|
||||
DT_ToBspl res sh
|
||||
== error = 5.20375663162094e-08 spans = 10
|
||||
== Surface is aproximated with continuity 2
|
||||
DT_ToBspl res sh
|
||||
== error = 5.20375663162094e-08 spans = 10
|
||||
== Surface is approximated with continuity 2
|
||||
~~~~~
|
||||
|
||||
@section occt_draw_10 Performance evaluation commands
|
||||
|
@@ -1171,27 +1171,29 @@ It is possible to describe any model by means of standard OCAF attributes.
|
||||
|
||||
@subsubsection occt_ocaf_6_2_3 Comparison and analysis of approaches
|
||||
|
||||
Below are described two different model implementations:
|
||||
one is based on standard OCAF attributes and the other is based
|
||||
on the creation of a new attribute possessing all data of the model.
|
||||
|
||||
Below are described two different model implementations:
|
||||
one is based on standard OCAF attributes and the other is based
|
||||
on the creation of a new attribute possessing all data of the model.
|
||||
|
||||
A load is distributed through the shape.
|
||||
The measurements are taken at particular points defined by (x, y and z) coordinates.
|
||||
The load is represented as a projection onto X, Y and Z axes of the local co-ordinate system at each point of measurement.
|
||||
A matrix of transformation is needed to convert the local co-ordinate system to the global one, but this is optional.
|
||||
|
||||
So, we have 15 double values at each point of measurement.
|
||||
If the number of such points is 100 000, for example, it means
|
||||
that we have to store 1 500 000 double values in the OCAF document.
|
||||
|
||||
The first approach consists in using standard OCAF attributes.
|
||||
Besides, there are several variants of how the standard attributes may be used:
|
||||
The load is represented as a projection onto X, Y and Z axes of the local coordinate system at each point of measurement.
|
||||
A matrix of transformation is needed to convert the local coordinate system to the global one, but this is optional.
|
||||
|
||||
So, we have 15 double values at each point of measurement.
|
||||
If the number of such points is 100 000, for example, it means
|
||||
that we have to store 1 500 000 double values in the OCAF document.
|
||||
|
||||
The first approach consists in using standard OCAF attributes.
|
||||
Besides, there are several variants of how the standard attributes may be used:
|
||||
* Allocation of all 1 500 000 double values as one array of double values attached to one label;
|
||||
* Allocation of values of one measure of load (15 values) as one array of double values and attachment of one point of measure to one label;
|
||||
* Allocation of each point of measure as an array of 3 double values attached to one label, the projection of load onto the local co-ordinate system axes as another array of 3 double values attached to a sub-label, and the matrix of projection (9 values) as the third array also attached to a sub-label.
|
||||
|
||||
Certainly, other variants are also possible.
|
||||
|
||||
* Allocation of each point of measure as an array of 3 double values attached to one label,
|
||||
the projection of load onto the local coordinate system axes as another array of 3 double values attached to a sub-label,
|
||||
and the matrix of projection (9 values) as the third array also attached to a sub-label.
|
||||
|
||||
Certainly, other variants are also possible.
|
||||
|
||||
@figure{ocaf_tree_wp_image003.png,"Allocation of all data as one array of double values",350}
|
||||
|
||||
The first approach to allocation of all data represented as one array of double values
|
||||
@@ -1560,43 +1562,45 @@ To automatically erase the nail from the viewer and the data tree it is enough
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
|
||||
|
||||
// The scope of functions is defined.
|
||||
Handle(TFunction_Scope) scope = TFunction_Scope::Set( anyLabel );
|
||||
|
||||
// The information on modifications in the model is received.
|
||||
TFunction_Logbook& log = scope-GetLogbook();
|
||||
|
||||
// The iterator is iInitialized by the scope of functions.
|
||||
TFunction_Iterator iterator( anyLabel );
|
||||
Iterator.SetUsageOfExecutionOrder( true );
|
||||
|
||||
// The function is iterated, its dependency is checked on the modified data and executed if necessary.
|
||||
for (; iterator.more(); iterator.Next())
|
||||
{
|
||||
// The function iterator may return a list of current functions for execution.
|
||||
// It might be useful for multi-threaded execution of functions.
|
||||
const TDF_LabelList& currentFunctions = iterator.Current();
|
||||
|
||||
//The list of current functions is iterated.
|
||||
TDF_ListIteratorOfLabelList currentterator( currentFucntions );
|
||||
for (; currentIterator.More(); currentIterator.Next())
|
||||
{
|
||||
// An interface for the function is created.
|
||||
TFunction_IFunction interface( currentIterator.Value() );
|
||||
|
||||
// The function driver is retrieved.
|
||||
Handle(TFunction_Driver) driver = interface.GetDriver();
|
||||
|
||||
// The dependency of the function on the modified data is checked.
|
||||
If (driver-MustExecute( log ))
|
||||
{
|
||||
// The function is executed.
|
||||
int ret = driver-Execute( log );
|
||||
if ( ret )
|
||||
return false;
|
||||
} // end if check on modification
|
||||
} // end of iteration of current functions
|
||||
} // end of iteration of functions.
|
||||
// The scope of functions is defined.
|
||||
Handle(TFunction_Scope) aScope = TFunction_Scope::Set (anyLabel);
|
||||
|
||||
// The information on modifications in the model is received.
|
||||
TFunction_Logbook& aLog = aScope->GetLogbook();
|
||||
|
||||
// The iterator is iInitialized by the scope of functions.
|
||||
TFunction_Iterator anIterator (anyLabel);
|
||||
anIterator.SetUsageOfExecutionOrder (true);
|
||||
|
||||
// The function is iterated, its dependency is checked on the modified data and executed if necessary.
|
||||
for (; anIterator.more(); anIterator.Next())
|
||||
{
|
||||
// The function iterator may return a list of current functions for execution.
|
||||
// It might be useful for multi-threaded execution of functions.
|
||||
const TDF_LabelList& aCurrentFunctions = anIterator.Current();
|
||||
|
||||
// The list of current functions is iterated.
|
||||
for (TDF_ListIteratorOfLabelList aCurrentIterator (aCurrentFunctions);
|
||||
aCurrentIterator.More(); aCurrentIterator.Next())
|
||||
{
|
||||
// An interface for the function is created.
|
||||
TFunction_IFunction anInterface (aCurrentIterator.Value());
|
||||
|
||||
// The function driver is retrieved.
|
||||
Handle(TFunction_Driver) aDriver = anInterface.GetDriver();
|
||||
|
||||
// The dependency of the function on the modified data is checked.
|
||||
if (aDriver->MustExecute (aLog))
|
||||
{
|
||||
// The function is executed.
|
||||
int aRes = aDriver->Execute (aLog);
|
||||
if (aRes)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@@ -14,7 +14,7 @@
|
||||
<Sample name="Clear" function="ClearGrid2dSample"/>
|
||||
</MenuItem>
|
||||
<MenuItem name="Image">
|
||||
<Sample name="Backgroung Image" function="BackgroungImage2dSample"/>
|
||||
<Sample name="Background Image" function="BackgroundImage2dSample"/>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
</Menu>
|
@@ -1,87 +1,87 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang=en-us>
|
||||
<head>
|
||||
<meta charset=utf-8><meta content="text/html; charset=utf-8" http-equiv=Content-Type>
|
||||
<link rel="shortcut icon" href="lamp.ico" type="image/x-icon" />
|
||||
<title>OCCT WebGL Viewer Sample</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2>OCCT WebGL Viewer Sample</h2>
|
||||
<div>
|
||||
<canvas id=occViewerCanvas oncontextmenu=event.preventDefault() tabindex=-1 style="border:0 none;background-color:#000" width="409" height="409"></canvas>
|
||||
<img id=occlogo src="OCC_logo.png" style="position: absolute; left: 20px; top: 0px; z-index: 2;" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="fileInput">Choose BREP file to upload: </label><input type="file" id="fileInput" accept=".brep">
|
||||
<input type="button" value="Clear All" onclick="OccViewerModule.removeAllObjects()">
|
||||
<input type="button" value="Fit All" onclick="OccViewerModule.fitAllObjects(true)">
|
||||
</div>
|
||||
<h4>Console output:</h4>
|
||||
<p id="output"></p>
|
||||
<script>
|
||||
//! Resize canvas to fit into window.
|
||||
function updateCanvasSize()
|
||||
{
|
||||
// size of canvas in logical (density-independent) units
|
||||
var aSizeX = Math.min (window.innerWidth, window.screen.availWidth);
|
||||
var aSizeY = Math.min (window.innerHeight, window.screen.availHeight);
|
||||
aSizeX = Math.max (300, aSizeX - 30);
|
||||
aSizeY = Math.max (300, aSizeY / 2);
|
||||
occViewerCanvas.style.width = aSizeX + "px";
|
||||
occViewerCanvas.style.height = aSizeY + "px";
|
||||
|
||||
// drawing buffer size (aka backing store)
|
||||
var aDevicePixelRatio = window.devicePixelRatio || 1;
|
||||
occViewerCanvas.width = aSizeX * aDevicePixelRatio;
|
||||
occViewerCanvas.height = aSizeY * aDevicePixelRatio;
|
||||
|
||||
occlogo.style.top = (aSizeY - 30) + "px";
|
||||
}
|
||||
window.onresize = updateCanvasSize;
|
||||
updateCanvasSize();
|
||||
|
||||
//! Check browser support.
|
||||
function isWasmSupported()
|
||||
{
|
||||
try {
|
||||
if (typeof WebAssembly === "object"
|
||||
&& typeof WebAssembly.instantiate === "function") {
|
||||
const aDummyModule = new WebAssembly.Module (Uint8Array.of (0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
|
||||
if (aDummyModule instanceof WebAssembly.Module)
|
||||
{
|
||||
return new WebAssembly.Instance(aDummyModule) instanceof WebAssembly.Instance;
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
if (!isWasmSupported())
|
||||
{
|
||||
var anElement = document.getElementById('output');
|
||||
anElement.innerHTML += "Browser is too old - WebAssembly support is missing!<br>Please check updates or install a modern browser.<br>";
|
||||
}
|
||||
|
||||
//! Handle file uploading.
|
||||
fileInput.onchange = function()
|
||||
{
|
||||
if (fileInput.files.length == 0) { return; }
|
||||
// Warning! Entire file is pre-loaded into memory.
|
||||
var aFile = fileInput.files[0];
|
||||
var aReader = new FileReader();
|
||||
aReader.onload = function()
|
||||
{
|
||||
var aDataArray = new Uint8Array (aReader.result);
|
||||
const aDataBuffer = OccViewerModule._malloc (aDataArray.length);
|
||||
OccViewerModule.HEAPU8.set (aDataArray, aDataBuffer);
|
||||
OccViewerModule.openFromMemory (aFile.name, aDataBuffer, aDataArray.length, true);
|
||||
//OccViewerModule._free (aDataBuffer); will be freed by called method
|
||||
OccViewerModule.displayGround (true);
|
||||
};
|
||||
aReader.readAsArrayBuffer(aFile);
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="occt-webgl-sample.js" charset="utf-8"></script>
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html lang=en-us>
|
||||
<head>
|
||||
<meta charset=utf-8><meta content="text/html; charset=utf-8" http-equiv=Content-Type>
|
||||
<link rel="shortcut icon" href="lamp.ico" type="image/x-icon" />
|
||||
<title>OCCT WebGL Viewer Sample</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2>OCCT WebGL Viewer Sample</h2>
|
||||
<div>
|
||||
<canvas id=occViewerCanvas oncontextmenu=event.preventDefault() tabindex=-1 style="border:0 none;background-color:#000" width="409" height="409"></canvas>
|
||||
<img id=occlogo src="OCC_logo.png" style="position: absolute; left: 20px; top: 0px; z-index: 2;" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="fileInput">Choose BREP file to upload: </label><input type="file" id="fileInput" accept=".brep">
|
||||
<input type="button" value="Clear All" onclick="OccViewerModule.removeAllObjects()">
|
||||
<input type="button" value="Fit All" onclick="OccViewerModule.fitAllObjects(true)">
|
||||
</div>
|
||||
<h4>Console output:</h4>
|
||||
<p id="output"></p>
|
||||
<script>
|
||||
//! Resize canvas to fit into window.
|
||||
function updateCanvasSize()
|
||||
{
|
||||
// size of canvas in logical (density-independent) units
|
||||
var aSizeX = Math.min (window.innerWidth, window.screen.availWidth);
|
||||
var aSizeY = Math.min (window.innerHeight, window.screen.availHeight);
|
||||
aSizeX = Math.max (300, aSizeX - 30);
|
||||
aSizeY = Math.max (300, aSizeY / 2);
|
||||
occViewerCanvas.style.width = aSizeX + "px";
|
||||
occViewerCanvas.style.height = aSizeY + "px";
|
||||
|
||||
// drawing buffer size (aka backing store)
|
||||
var aDevicePixelRatio = window.devicePixelRatio || 1;
|
||||
occViewerCanvas.width = aSizeX * aDevicePixelRatio;
|
||||
occViewerCanvas.height = aSizeY * aDevicePixelRatio;
|
||||
|
||||
occlogo.style.top = (aSizeY - 30) + "px";
|
||||
}
|
||||
window.onresize = updateCanvasSize;
|
||||
updateCanvasSize();
|
||||
|
||||
//! Check browser support.
|
||||
function isWasmSupported()
|
||||
{
|
||||
try {
|
||||
if (typeof WebAssembly === "object"
|
||||
&& typeof WebAssembly.instantiate === "function") {
|
||||
const aDummyModule = new WebAssembly.Module (Uint8Array.of (0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
|
||||
if (aDummyModule instanceof WebAssembly.Module)
|
||||
{
|
||||
return new WebAssembly.Instance(aDummyModule) instanceof WebAssembly.Instance;
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
if (!isWasmSupported())
|
||||
{
|
||||
var anElement = document.getElementById('output');
|
||||
anElement.innerHTML += "Browser is too old - WebAssembly support is missing!<br>Please check updates or install a modern browser.<br>";
|
||||
}
|
||||
|
||||
//! Handle file uploading.
|
||||
fileInput.onchange = function()
|
||||
{
|
||||
if (fileInput.files.length == 0) { return; }
|
||||
// Warning! Entire file is pre-loaded into memory.
|
||||
var aFile = fileInput.files[0];
|
||||
var aReader = new FileReader();
|
||||
aReader.onload = function()
|
||||
{
|
||||
var aDataArray = new Uint8Array (aReader.result);
|
||||
const aDataBuffer = OccViewerModule._malloc (aDataArray.length);
|
||||
OccViewerModule.HEAPU8.set (aDataArray, aDataBuffer);
|
||||
OccViewerModule.openFromMemory (aFile.name, aDataBuffer, aDataArray.length, true);
|
||||
//OccViewerModule._free (aDataBuffer); will be freed by called method
|
||||
OccViewerModule.displayGround (true);
|
||||
};
|
||||
aReader.readAsArrayBuffer(aFile);
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="occt-webgl-sample.js" charset="utf-8"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -1,28 +1,28 @@
|
||||
var OccViewerModule =
|
||||
{
|
||||
print: (function() {
|
||||
var anElement = document.getElementById('output');
|
||||
return function(theText) { anElement.innerHTML += theText + "<br>"; };
|
||||
})(),
|
||||
printErr: function(theText) {
|
||||
//var anElement = document.getElementById('output');
|
||||
//anElement.innerHTML += theText + "<br>";
|
||||
console.warn(theText);
|
||||
},
|
||||
canvas: (function() {
|
||||
var aCanvas = document.getElementById('occViewerCanvas');
|
||||
var aGlCtx = aCanvas.getContext ('webgl2', { alpha: false, depth: true, antialias: false, preserveDrawingBuffer: true } );
|
||||
if (aGlCtx == null) { aGlCtx = aCanvas.getContext ('webgl', { alpha: false, depth: true, antialias: false, preserveDrawingBuffer: true } ); }
|
||||
return aCanvas;
|
||||
})(),
|
||||
|
||||
onRuntimeInitialized: function() {
|
||||
//console.log(" @@ onRuntimeInitialized()" + Object.getOwnPropertyNames(OccViewerModule));
|
||||
}
|
||||
};
|
||||
|
||||
const OccViewerModuleInitialized = createOccViewerModule(OccViewerModule);
|
||||
OccViewerModuleInitialized.then(function(Module) {
|
||||
//OccViewerModule.setCubemapBackground ("cubemap.jpg");
|
||||
OccViewerModule.openFromUrl ("ball", "samples/Ball.brep");
|
||||
});
|
||||
var OccViewerModule =
|
||||
{
|
||||
print: (function() {
|
||||
var anElement = document.getElementById('output');
|
||||
return function(theText) { anElement.innerHTML += theText + "<br>"; };
|
||||
})(),
|
||||
printErr: function(theText) {
|
||||
//var anElement = document.getElementById('output');
|
||||
//anElement.innerHTML += theText + "<br>";
|
||||
console.warn(theText);
|
||||
},
|
||||
canvas: (function() {
|
||||
var aCanvas = document.getElementById('occViewerCanvas');
|
||||
var aGlCtx = aCanvas.getContext ('webgl2', { alpha: false, depth: true, antialias: false, preserveDrawingBuffer: true } );
|
||||
if (aGlCtx == null) { aGlCtx = aCanvas.getContext ('webgl', { alpha: false, depth: true, antialias: false, preserveDrawingBuffer: true } ); }
|
||||
return aCanvas;
|
||||
})(),
|
||||
|
||||
onRuntimeInitialized: function() {
|
||||
//console.log(" @@ onRuntimeInitialized()" + Object.getOwnPropertyNames(OccViewerModule));
|
||||
}
|
||||
};
|
||||
|
||||
const OccViewerModuleInitialized = createOccViewerModule(OccViewerModule);
|
||||
OccViewerModuleInitialized.then(function(Module) {
|
||||
//OccViewerModule.setCubemapBackground ("cubemap.jpg");
|
||||
OccViewerModule.openFromUrl ("ball", "samples/Ball.brep");
|
||||
});
|
||||
|
@@ -140,7 +140,7 @@ public:
|
||||
protected:
|
||||
|
||||
//! The TypeOfPresention3d means that the interactive object
|
||||
//! may have a presentation dependant of the view of Display.
|
||||
//! may have a presentation dependent on the view of Display.
|
||||
Standard_EXPORT AIS_InteractiveObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
|
||||
|
||||
//! Set presentation display status.
|
||||
|
@@ -196,7 +196,7 @@ public:
|
||||
Standard_EXPORT void StopTransform (const Standard_Boolean theToApply = Standard_True);
|
||||
|
||||
//! Apply transformation made from mouse moving from start position
|
||||
//! (save on the first Tranform() call and reset on DeactivateCurrentMode() call.)
|
||||
//! (save on the first Transform() call and reset on DeactivateCurrentMode() call.)
|
||||
//! to the in/out mouse position (theX, theY)
|
||||
Standard_EXPORT gp_Trsf Transform (const Standard_Integer theX, const Standard_Integer theY,
|
||||
const Handle(V3d_View)& theView);
|
||||
@@ -361,7 +361,7 @@ protected:
|
||||
|
||||
Standard_EXPORT void setTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers);
|
||||
|
||||
//! Redefines local transformation management method to inform user of inproper use.
|
||||
//! Redefines local transformation management method to inform user of improper use.
|
||||
//! @warning this interactive object does not support setting custom local transformation,
|
||||
//! this class solely uses this property to implement visual positioning of the manipulator
|
||||
//! without need for recomputing presentation.
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_MaterialAspect.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Graphic3d_TransformPersScaledAbove.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d_DatumAspect.hxx>
|
||||
@@ -415,6 +416,40 @@ Standard_Boolean AIS_Plane::Size(Standard_Real& X,Standard_Real& Y) const
|
||||
return Abs(X-Y)<=Precision::Confusion();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMinimumSize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Plane::SetMinimumSize (const Standard_Real theValue)
|
||||
{
|
||||
if (theValue <= 0)
|
||||
{
|
||||
UnsetMinimumSize();
|
||||
return;
|
||||
}
|
||||
Standard_Real aX, anY;
|
||||
Size (aX, anY);
|
||||
SetTransformPersistence (new Graphic3d_TransformPersScaledAbove (Min (aX, anY) / theValue, myCenter));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UnsetMinimumSize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Plane::UnsetMinimumSize()
|
||||
{
|
||||
SetTransformPersistence (NULL);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasMinimumSize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_Plane::HasMinimumSize() const
|
||||
{
|
||||
return !Handle(Graphic3d_TransformPersScaledAbove)::DownCast (TransformPersistence()).IsNull();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetColor
|
||||
//purpose :
|
||||
|
@@ -66,6 +66,15 @@ public:
|
||||
|
||||
Standard_Boolean HasOwnSize() const { return myHasOwnSize; }
|
||||
|
||||
//! Sets transform persistence for zoom with value of minimum size
|
||||
Standard_EXPORT void SetMinimumSize (const Standard_Real theValue);
|
||||
|
||||
//! Unsets transform persistence zoom
|
||||
Standard_EXPORT void UnsetMinimumSize();
|
||||
|
||||
//! Returns true if transform persistence for zoom is set
|
||||
Standard_EXPORT Standard_Boolean HasMinimumSize() const;
|
||||
|
||||
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 7; }
|
||||
|
||||
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Datum; }
|
||||
|
@@ -31,7 +31,7 @@ class TColStd_HPackedMapOfInteger;
|
||||
//! The presentation supports two display modes:
|
||||
//! - Points.
|
||||
//! - Bounding box for highlighting.
|
||||
//! Presentation provides selection by bouding box.
|
||||
//! Presentation provides selection by bounding box.
|
||||
//! Selection and consequently highlighting can disabled by
|
||||
//! setting default selection mode to -1. There will be no way
|
||||
//! to select object from interactive view. Any calls to
|
||||
|
@@ -27,7 +27,7 @@ DEFINE_STANDARD_HANDLE(AIS_RubberBand, AIS_InteractiveObject)
|
||||
//! Presentation for drawing rubber band selection.
|
||||
//! It supports rectangle and polygonal selection.
|
||||
//! It is constructed in 2d overlay.
|
||||
//! Default configaration is built without filling.
|
||||
//! Default configuration is built without filling.
|
||||
//! For rectangle selection use SetRectangle() method.
|
||||
//! For polygonal selection use AddPoint() and GetPoints() methods.
|
||||
class AIS_RubberBand : public AIS_InteractiveObject
|
||||
|
@@ -82,8 +82,6 @@ AIS_ViewController::AIS_ViewController()
|
||||
myMouseActiveGesture (AIS_MouseGesture_NONE),
|
||||
myMouseActiveIdleRotation (false),
|
||||
myMouseClickCounter (0),
|
||||
myMousePressed (Aspect_VKeyMouse_NONE),
|
||||
myMouseModifiers (Aspect_VKeyFlags_NONE),
|
||||
myMouseSingleButton (-1),
|
||||
myMouseStopDragOnUnclick (false),
|
||||
//
|
||||
@@ -99,16 +97,8 @@ AIS_ViewController::AIS_ViewController()
|
||||
myUpdateStartPointRot (true),
|
||||
myUpdateStartPointZRot (true),
|
||||
//
|
||||
my3dMouseNoRotate (false, false, false),
|
||||
my3dMouseToReverse (true, false, false),
|
||||
my3dMouseAccelTrans (2.0f),
|
||||
my3dMouseAccelRotate (4.0f),
|
||||
my3dMouseIsQuadric (true),
|
||||
//
|
||||
myPanPnt3d (Precision::Infinite(), 0.0, 0.0)
|
||||
{
|
||||
memset(my3dMouseButtonState, 0, sizeof(my3dMouseButtonState));
|
||||
myEventTimer.Start();
|
||||
myViewAnimation->SetOwnDuration (0.5);
|
||||
|
||||
myAnchorPointPrs1 = new AIS_Point (new Geom_CartesianPoint (0.0, 0.0, 0.0));
|
||||
@@ -1119,104 +1109,11 @@ bool AIS_ViewController::Update3dMouse (const WNT_HIDSpaceMouse& theEvent)
|
||||
{
|
||||
bool toUpdate = false;
|
||||
toUpdate = update3dMouseTranslation (theEvent) || toUpdate;
|
||||
toUpdate = update3dMouseRotation (theEvent) || toUpdate;
|
||||
toUpdate = (myToAllowRotation && update3dMouseRotation (theEvent)) || toUpdate;
|
||||
toUpdate = update3dMouseKeys (theEvent) || toUpdate;
|
||||
return toUpdate;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : update3dMouseTranslation
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool AIS_ViewController::update3dMouseTranslation (const WNT_HIDSpaceMouse& theEvent)
|
||||
{
|
||||
if (!theEvent.IsTranslation())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isIdle = true;
|
||||
const double aTimeStamp = EventTime();
|
||||
const Graphic3d_Vec3d aTrans = theEvent.Translation (isIdle, my3dMouseIsQuadric) * my3dMouseAccelTrans;
|
||||
myKeys.KeyFromAxis (Aspect_VKey_NavSlideLeft, Aspect_VKey_NavSlideRight, aTimeStamp, aTrans.x());
|
||||
myKeys.KeyFromAxis (Aspect_VKey_NavForward, Aspect_VKey_NavBackward, aTimeStamp, aTrans.y());
|
||||
myKeys.KeyFromAxis (Aspect_VKey_NavSlideUp, Aspect_VKey_NavSlideDown, aTimeStamp, aTrans.z());
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : update3dMouseRotation
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool AIS_ViewController::update3dMouseRotation (const WNT_HIDSpaceMouse& theEvent)
|
||||
{
|
||||
if (!theEvent.IsRotation()
|
||||
|| !myToAllowRotation)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isIdle = true, toUpdate = false;
|
||||
const double aTimeStamp = EventTime();
|
||||
const Graphic3d_Vec3d aRot3 = theEvent.Rotation (isIdle, my3dMouseIsQuadric) * my3dMouseAccelRotate;
|
||||
if (!my3dMouseNoRotate.x())
|
||||
{
|
||||
KeyFromAxis (Aspect_VKey_NavLookUp, Aspect_VKey_NavLookDown, aTimeStamp, !my3dMouseToReverse.x() ? aRot3.x() : -aRot3.x());
|
||||
toUpdate = true;
|
||||
}
|
||||
if (!my3dMouseNoRotate.y())
|
||||
{
|
||||
KeyFromAxis (Aspect_VKey_NavRollCW, Aspect_VKey_NavRollCCW, aTimeStamp, !my3dMouseToReverse.y() ? aRot3.y() : -aRot3.y());
|
||||
toUpdate = true;
|
||||
}
|
||||
if (!my3dMouseNoRotate.z())
|
||||
{
|
||||
KeyFromAxis (Aspect_VKey_NavLookLeft, Aspect_VKey_NavLookRight, aTimeStamp, !my3dMouseToReverse.z() ? aRot3.z() : -aRot3.z());
|
||||
toUpdate = true;
|
||||
}
|
||||
return toUpdate;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : update3dMouseKeys
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool AIS_ViewController::update3dMouseKeys (const WNT_HIDSpaceMouse& theEvent)
|
||||
{
|
||||
bool toUpdate = false;
|
||||
const double aTimeStamp = EventTime();
|
||||
if (theEvent.IsKeyState())
|
||||
{
|
||||
const uint32_t aKeyState = theEvent.KeyState();
|
||||
for (unsigned short aKeyBit = 0; aKeyBit < 32; ++aKeyBit)
|
||||
{
|
||||
const bool isPressed = (aKeyState & (1 << aKeyBit)) != 0;
|
||||
const bool isReleased = my3dMouseButtonState[aKeyBit] && !isPressed;
|
||||
//const bool isRepeated = my3dMouseButtonState[aKeyBit] && isPressed;
|
||||
my3dMouseButtonState[aKeyBit] = isPressed;
|
||||
if (!isReleased && !isPressed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Aspect_VKey aVKey = theEvent.HidToSpaceKey (aKeyBit);
|
||||
if (aVKey != Aspect_VKey_UNKNOWN)
|
||||
{
|
||||
toUpdate = true;
|
||||
if (isPressed)
|
||||
{
|
||||
KeyDown (aVKey, aTimeStamp);
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyUp (aVKey, aTimeStamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return toUpdate;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetNavigationMode
|
||||
// purpose :
|
||||
@@ -1240,7 +1137,7 @@ void AIS_ViewController::KeyDown (Aspect_VKey theKey,
|
||||
double theTime,
|
||||
double thePressure)
|
||||
{
|
||||
myKeys.KeyDown (theKey, theTime, thePressure);
|
||||
Aspect_WindowInputListener::KeyDown (theKey, theTime, thePressure);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -1250,7 +1147,7 @@ void AIS_ViewController::KeyDown (Aspect_VKey theKey,
|
||||
void AIS_ViewController::KeyUp (Aspect_VKey theKey,
|
||||
double theTime)
|
||||
{
|
||||
myKeys.KeyUp (theKey, theTime);
|
||||
Aspect_WindowInputListener::KeyUp (theKey, theTime);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -1262,7 +1159,7 @@ void AIS_ViewController::KeyFromAxis (Aspect_VKey theNegative,
|
||||
double theTime,
|
||||
double thePressure)
|
||||
{
|
||||
myKeys.KeyFromAxis (theNegative, thePositive, theTime, thePressure);
|
||||
Aspect_WindowInputListener::KeyFromAxis (theNegative, thePositive, theTime, thePressure);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <Aspect_VKeySet.hxx>
|
||||
#include <Aspect_TouchMap.hxx>
|
||||
#include <Aspect_WindowInputListener.hxx>
|
||||
#include <Aspect_XRHapticActionData.hxx>
|
||||
#include <Aspect_XRTrackedDeviceRole.hxx>
|
||||
#include <AIS_DragAction.hxx>
|
||||
@@ -51,7 +52,7 @@ class WNT_HIDSpaceMouse;
|
||||
//! - Mapping mouse/multi-touch input to View camera manipulations (panning/rotating/zooming).
|
||||
//! - Input events are not applied immediately but queued for separate processing from two working threads
|
||||
//! UI thread receiving user input and Rendering thread for OCCT 3D Viewer drawing.
|
||||
class AIS_ViewController
|
||||
class AIS_ViewController : public Aspect_WindowInputListener
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -221,30 +222,30 @@ public: //! @name global parameters
|
||||
|
||||
public: //! @name keyboard input
|
||||
|
||||
//! Return keyboard state.
|
||||
const Aspect_VKeySet& Keys() const { return myKeys; }
|
||||
|
||||
//! Return keyboard state.
|
||||
Aspect_VKeySet& ChangeKeys() { return myKeys; }
|
||||
using Aspect_WindowInputListener::Keys;
|
||||
using Aspect_WindowInputListener::ChangeKeys;
|
||||
|
||||
//! Press key.
|
||||
//! Default implementation updates internal cache.
|
||||
//! @param theKey key pressed
|
||||
//! @param theTime event timestamp
|
||||
Standard_EXPORT virtual void KeyDown (Aspect_VKey theKey,
|
||||
double theTime,
|
||||
double thePressure = 1.0);
|
||||
double thePressure = 1.0) Standard_OVERRIDE;
|
||||
|
||||
//! Release key.
|
||||
//! Default implementation updates internal cache.
|
||||
//! @param theKey key pressed
|
||||
//! @param theTime event timestamp
|
||||
Standard_EXPORT virtual void KeyUp (Aspect_VKey theKey,
|
||||
double theTime);
|
||||
double theTime) Standard_OVERRIDE;
|
||||
|
||||
//! Simulate key up/down events from axis value.
|
||||
//! Default implementation updates internal cache.
|
||||
Standard_EXPORT virtual void KeyFromAxis (Aspect_VKey theNegative,
|
||||
Aspect_VKey thePositive,
|
||||
double theTime,
|
||||
double thePressure);
|
||||
double thePressure) Standard_OVERRIDE;
|
||||
|
||||
//! Fetch active navigation actions.
|
||||
Standard_EXPORT AIS_WalkDelta FetchNavigationKeys (Standard_Real theCrouchRatio,
|
||||
@@ -313,7 +314,7 @@ public: //! @name mouse input
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param theDelta mouse cursor position and delta
|
||||
//! @return TRUE if new event has been created or FALSE if existing one has been updated
|
||||
Standard_EXPORT virtual bool UpdateMouseScroll (const Aspect_ScrollDelta& theDelta);
|
||||
Standard_EXPORT virtual bool UpdateMouseScroll (const Aspect_ScrollDelta& theDelta) Standard_OVERRIDE;
|
||||
|
||||
//! Handle mouse button press/release event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
@@ -326,7 +327,7 @@ public: //! @name mouse input
|
||||
Standard_EXPORT virtual bool UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButtons,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated);
|
||||
bool theIsEmulated) Standard_OVERRIDE;
|
||||
|
||||
//! Handle mouse cursor movement event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
@@ -339,40 +340,7 @@ public: //! @name mouse input
|
||||
Standard_EXPORT virtual bool UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButtons,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated);
|
||||
|
||||
//! Handle mouse button press event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButton pressed button
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
|
||||
//! but emulated from non-precise input like touch on screen
|
||||
//! @return TRUE if View should be redrawn
|
||||
bool PressMouseButton (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButton,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated)
|
||||
{
|
||||
return UpdateMouseButtons (thePoint, myMousePressed | theButton, theModifiers, theIsEmulated);
|
||||
}
|
||||
|
||||
//! Handle mouse button release event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButton released button
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
|
||||
//! but emulated from non-precise input like touch on screen
|
||||
//! @return TRUE if View should be redrawn
|
||||
bool ReleaseMouseButton (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButton,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated)
|
||||
{
|
||||
Aspect_VKeyMouse aButtons = myMousePressed & (~theButton);
|
||||
return UpdateMouseButtons (thePoint, aButtons, theModifiers, theIsEmulated);
|
||||
}
|
||||
bool theIsEmulated) Standard_OVERRIDE;
|
||||
|
||||
//! Handle mouse button click event (emulated by UpdateMouseButtons() while releasing single button).
|
||||
//! Note that as this method is called by UpdateMouseButtons(), it should be executed from UI thread.
|
||||
@@ -388,14 +356,12 @@ public: //! @name mouse input
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsDoubleClick);
|
||||
|
||||
//! Return currently pressed mouse buttons.
|
||||
Aspect_VKeyMouse PressedMouseButtons() const { return myMousePressed; }
|
||||
using Aspect_WindowInputListener::PressMouseButton;
|
||||
using Aspect_WindowInputListener::ReleaseMouseButton;
|
||||
|
||||
//! Return active key modifiers passed with last mouse event.
|
||||
Aspect_VKeyFlags LastMouseFlags() const { return myMouseModifiers; }
|
||||
|
||||
//! Return last mouse position.
|
||||
const Graphic3d_Vec2i& LastMousePosition() const { return myMousePositionLast; }
|
||||
using Aspect_WindowInputListener::PressedMouseButtons;
|
||||
using Aspect_WindowInputListener::LastMouseFlags;
|
||||
using Aspect_WindowInputListener::LastMousePosition;
|
||||
|
||||
public: //! @name multi-touch input
|
||||
|
||||
@@ -436,52 +402,40 @@ public: //! @name multi-touch input
|
||||
|
||||
public: //! @name 3d mouse input
|
||||
|
||||
//! Return acceleration ratio for translation event; 2.0 by default.
|
||||
float Get3dMouseTranslationScale() const { return my3dMouseAccelTrans; }
|
||||
|
||||
//! Set acceleration ratio for translation event.
|
||||
void Set3dMouseTranslationScale (float theScale) { my3dMouseAccelTrans = theScale; }
|
||||
|
||||
//! Return acceleration ratio for rotation event; 4.0 by default.
|
||||
float Get3dMouseRotationScale() const { return my3dMouseAccelRotate; }
|
||||
|
||||
//! Set acceleration ratio for rotation event.
|
||||
void Set3dMouseRotationScale (float theScale) { my3dMouseAccelRotate = theScale; }
|
||||
|
||||
//! Return quadric acceleration flag; TRUE by default.
|
||||
bool To3dMousePreciseInput() const { return my3dMouseIsQuadric; }
|
||||
|
||||
//! Set quadric acceleration flag.
|
||||
void Set3dMousePreciseInput (bool theIsQuadric) { my3dMouseIsQuadric = theIsQuadric; }
|
||||
|
||||
//! Return 3d mouse rotation axes (tilt/roll/spin) ignore flag; (FALSE, FALSE, FALSE) by default.
|
||||
const NCollection_Vec3<bool>& Get3dMouseIsNoRotate() const { return my3dMouseNoRotate; }
|
||||
|
||||
//! Return 3d mouse rotation axes (tilt/roll/spin) ignore flag; (FALSE, FALSE, FALSE) by default.
|
||||
NCollection_Vec3<bool>& Change3dMouseIsNoRotate() { return my3dMouseNoRotate; }
|
||||
|
||||
//! Return 3d mouse rotation axes (tilt/roll/spin) reverse flag; (TRUE, FALSE, FALSE) by default.
|
||||
const NCollection_Vec3<bool>& Get3dMouseToReverse() const { return my3dMouseToReverse; }
|
||||
|
||||
//! Return 3d mouse rotation axes (tilt/roll/spin) reverse flag; (TRUE, FALSE, FALSE) by default.
|
||||
NCollection_Vec3<bool>& Change3dMouseToReverse() { return my3dMouseToReverse; }
|
||||
|
||||
//! Process 3d mouse input event (redirects to translation, rotation and keys).
|
||||
Standard_EXPORT virtual bool Update3dMouse (const WNT_HIDSpaceMouse& theEvent);
|
||||
Standard_EXPORT virtual bool Update3dMouse (const WNT_HIDSpaceMouse& theEvent) Standard_OVERRIDE;
|
||||
|
||||
//! Process 3d mouse input translation event.
|
||||
Standard_EXPORT virtual bool update3dMouseTranslation (const WNT_HIDSpaceMouse& theEvent);
|
||||
public: //! @name resize events
|
||||
|
||||
//! Process 3d mouse input rotation event.
|
||||
Standard_EXPORT virtual bool update3dMouseRotation (const WNT_HIDSpaceMouse& theEvent);
|
||||
//! Handle expose event (window content has been invalidation and should be redrawn).
|
||||
//! Default implementation does nothing.
|
||||
virtual void ProcessExpose() Standard_OVERRIDE {}
|
||||
|
||||
//! Process 3d mouse input keys event.
|
||||
Standard_EXPORT virtual bool update3dMouseKeys (const WNT_HIDSpaceMouse& theEvent);
|
||||
//! Handle window resize event.
|
||||
//! Default implementation does nothing.
|
||||
virtual void ProcessConfigure (bool theIsResized) Standard_OVERRIDE
|
||||
{
|
||||
(void )theIsResized;
|
||||
}
|
||||
|
||||
//! Handle window input event immediately.
|
||||
//! Default implementation does nothing - input events are accumulated in internal buffer until explicit FlushViewEvents() call.
|
||||
virtual void ProcessInput() Standard_OVERRIDE {}
|
||||
|
||||
//! Handle focus event.
|
||||
//! Default implementation does nothing.
|
||||
virtual void ProcessFocus (bool theIsActivated) Standard_OVERRIDE
|
||||
{
|
||||
(void )theIsActivated;
|
||||
}
|
||||
|
||||
//! Handle window close event.
|
||||
//! Default implementation does nothing.
|
||||
virtual void ProcessClose() Standard_OVERRIDE {}
|
||||
|
||||
public:
|
||||
|
||||
//! Return event time (e.g. current time).
|
||||
double EventTime() const { return myEventTimer.ElapsedTime(); }
|
||||
using Aspect_WindowInputListener::EventTime;
|
||||
|
||||
//! Reset input state (pressed keys, mouse buttons, etc.) e.g. on window focus loss.
|
||||
//! This method is expected to be called from UI thread.
|
||||
@@ -712,7 +666,6 @@ protected:
|
||||
AIS_ViewInputBuffer myUI; //!< buffer for UI thread
|
||||
AIS_ViewInputBuffer myGL; //!< buffer for rendering thread
|
||||
|
||||
OSD_Timer myEventTimer; //!< timer for timestamping events
|
||||
Standard_Real myLastEventsTime; //!< last fetched events timer value for computing delta/progress
|
||||
Standard_Boolean myToAskNextFrame; //!< flag indicating that another frame should be drawn right after this one
|
||||
|
||||
@@ -764,10 +717,6 @@ protected: //! @name XR input variables
|
||||
Standard_Boolean myToDisplayXRAuxDevices; //!< flag to display auxiliary tracked XR devices
|
||||
Standard_Boolean myToDisplayXRHands; //!< flag to display XR hands
|
||||
|
||||
protected: //! @name keyboard input variables
|
||||
|
||||
Aspect_VKeySet myKeys; //!< keyboard state
|
||||
|
||||
protected: //! @name mouse input variables
|
||||
|
||||
Standard_Real myMouseClickThreshold; //!< mouse click threshold in pixels; 3 by default
|
||||
@@ -779,13 +728,10 @@ protected: //! @name mouse input variables
|
||||
AIS_MouseSelectionSchemeMap
|
||||
myMouseSelectionSchemes; //!< map defining selection schemes bound to mouse + modifiers
|
||||
Standard_Boolean myMouseActiveIdleRotation; //!< flag indicating view idle rotation state
|
||||
Graphic3d_Vec2i myMousePositionLast; //!< last mouse position
|
||||
Graphic3d_Vec2i myMousePressPoint; //!< mouse position where active gesture was been initiated
|
||||
Graphic3d_Vec2i myMouseProgressPoint; //!< gesture progress
|
||||
OSD_Timer myMouseClickTimer; //!< timer for handling double-click event
|
||||
Standard_Integer myMouseClickCounter; //!< counter for handling double-click event
|
||||
Aspect_VKeyMouse myMousePressed; //!< active mouse buttons
|
||||
Aspect_VKeyFlags myMouseModifiers; //!< active key modifiers passed with last mouse event
|
||||
Standard_Integer myMouseSingleButton; //!< index of mouse button pressed alone (>0)
|
||||
Standard_Boolean myMouseStopDragOnUnclick; //!< queue stop dragging even with at next mouse unclick
|
||||
|
||||
@@ -806,15 +752,6 @@ protected: //! @name multi-touch input variables
|
||||
Standard_Boolean myUpdateStartPointRot; //!< flag indicating that new gravity point should be picked for starting rotation gesture
|
||||
Standard_Boolean myUpdateStartPointZRot; //!< flag indicating that new gravity point should be picked for starting Z-rotation gesture
|
||||
|
||||
protected: //! @name 3d mouse input variables
|
||||
|
||||
bool my3dMouseButtonState[32];//!< cached button state
|
||||
NCollection_Vec3<bool> my3dMouseNoRotate; //!< ignore 3d mouse rotation axes
|
||||
NCollection_Vec3<bool> my3dMouseToReverse; //!< reverse 3d mouse rotation axes
|
||||
float my3dMouseAccelTrans; //!< acceleration ratio for translation event
|
||||
float my3dMouseAccelRotate; //!< acceleration ratio for rotation event
|
||||
bool my3dMouseIsQuadric; //!< quadric acceleration
|
||||
|
||||
protected: //! @name rotation/panning transient state variables
|
||||
|
||||
Handle(AIS_Point) myAnchorPointPrs1; //!< anchor point presentation (Graphic3d_ZLayerId_Top)
|
||||
|
@@ -148,8 +148,8 @@ static void CompareBounds(gp_Pnt2d& P1,
|
||||
static void Hunt(const TColStd_Array1OfReal& Arr,
|
||||
const Standard_Real Coord,
|
||||
Standard_Integer& Iloc)
|
||||
{//Warning: Hunt is used to find number of knot which equals co-ordinate component,
|
||||
// when co-ordinate component definitly equals a knot only.
|
||||
{//Warning: Hunt is used to find number of knot which equals coordinate component,
|
||||
// when coordinate component definitly equals a knot only.
|
||||
Standard_Real Tol=Precision::PConfusion()/10;
|
||||
Standard_Integer i=1;
|
||||
while((i <= Arr.Upper()) && (Abs(Coord - Arr(i)) > Tol)){
|
||||
|
@@ -752,7 +752,7 @@ void AdvApprox_ApproxAFunction::Perform(const Standard_Integer Num1DSS,
|
||||
index += 1 ;
|
||||
}
|
||||
//
|
||||
// Ouput
|
||||
// Output
|
||||
//
|
||||
|
||||
Standard_Integer ErrorCode = 0,
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
//! Class describing a continous 3d and/or function f(u).
|
||||
//! Class describing a continuous 3d and/or function f(u).
|
||||
//! This class must be provided by the user to use the approximation algorithm FittingCurve.
|
||||
class AppCont_Function
|
||||
{
|
||||
|
@@ -166,7 +166,7 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
|
||||
}
|
||||
else
|
||||
{
|
||||
// keep best decison
|
||||
// keep best decision
|
||||
if ((thetol3d + thetol2d) < (KeptT3d + KeptT2d))
|
||||
{
|
||||
KeptMultiCurve = TheMultiCurve;
|
||||
|
@@ -22,13 +22,17 @@
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
|
||||
//! Approximation of a Curve to make its parameter be its
|
||||
//! curvilinear abscissa
|
||||
//! Approximation of a Curve to make its parameter be its curvilinear abscissa.
|
||||
//! If the curve is a curve on a surface S, C2D is the corresponding Pcurve,
|
||||
//! we considere the curve is given by its representation S(C2D(u))
|
||||
//! If the curve is a curve on 2 surfaces S1 and S2 and C2D1 C2D2 are
|
||||
//! the two corresponding Pcurve, we considere the curve is given
|
||||
//! by its representation 1/2(S1(C2D1(u) + S2 (C2D2(u)))
|
||||
//! we consider the curve is given by its representation
|
||||
//! @code
|
||||
//! S(C2D(u))
|
||||
//! @endcode
|
||||
//! If the curve is a curve on 2 surfaces S1 and S2 and C2D1 C2D2 are the two corresponding Pcurve,
|
||||
//! we consider the curve is given by its representation
|
||||
//! @code
|
||||
//! 1/2(S1(C2D1(u) + S2(C2D2(u)))
|
||||
//! @endcode
|
||||
class Approx_CurvilinearParameter
|
||||
{
|
||||
public:
|
||||
@@ -72,20 +76,11 @@ public:
|
||||
//! print the maximum errors(s)
|
||||
Standard_EXPORT void Dump (Standard_OStream& o) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT static void ToleranceComputation (const Handle(Adaptor2d_Curve2d)& C2D, const Handle(Adaptor3d_Surface)& S, const Standard_Integer MaxNumber, const Standard_Real Tol, Standard_Real& TolV, Standard_Real& TolW);
|
||||
|
||||
private:
|
||||
|
||||
Standard_Integer myCase;
|
||||
Standard_Boolean myDone;
|
||||
@@ -97,13 +92,6 @@ private:
|
||||
Handle(Geom2d_BSplineCurve) myCurve2d2;
|
||||
Standard_Real myMaxError2d2;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Approx_CurvilinearParameter_HeaderFile
|
||||
|
@@ -349,7 +349,7 @@ void ApproxInt_KnotTools::FilterKnots(NCollection_Sequence<Standard_Integer>& th
|
||||
}
|
||||
}
|
||||
|
||||
// II: Filter poins with too small amount of points per knot interval.
|
||||
// II: Filter points with too small amount of points per knot interval.
|
||||
i = 1;
|
||||
theLKnots.Append(theInds(i));
|
||||
Standard_Integer anIndsPrev = theInds(i);
|
||||
|
@@ -68,7 +68,7 @@ public:
|
||||
//! @param thePntsXYZ - Set of 3d points.
|
||||
//! @param thePntsU1V1 - Set of 2d points.
|
||||
//! @param thePntsU2V2 - Set of 2d points.
|
||||
//! @param thePars - Expected parameters assoiated with set.
|
||||
//! @param thePars - Expected parameters associated with set.
|
||||
//! @param theApproxXYZ - Flag, existence of 3d set.
|
||||
//! @param theApproxU1V1 - Flag existence of first 2d set.
|
||||
//! @param theApproxU2V2 - Flag existence of second 2d set.
|
||||
@@ -121,7 +121,7 @@ private:
|
||||
//!
|
||||
//! I: Filter too big number of points per knot interval.
|
||||
//!
|
||||
//! II: Filter poins with too small amount of points per knot interval.
|
||||
//! II: Filter points with too small amount of points per knot interval.
|
||||
//!
|
||||
//! III: Fill Last Knot.
|
||||
static void FilterKnots(NCollection_Sequence<Standard_Integer>& theInds,
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
/*============================================================================*/
|
||||
/*==== Titre: Aspect_Display.hxx */
|
||||
/*==== Title: Aspect_Display.hxx */
|
||||
/*==== Role : The header file of primitive type "Display" from package */
|
||||
/*==== "V3d" */
|
||||
/*==== Implementation: This is a primitive type implemented with typedef */
|
||||
|
@@ -16,6 +16,12 @@
|
||||
#include <Aspect_DisplayConnectionDefinitionError.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
|
||||
#if defined(HAVE_XLIB)
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
#endif
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Aspect_DisplayConnection,Standard_Transient)
|
||||
|
||||
// =======================================================================
|
||||
@@ -24,7 +30,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Aspect_DisplayConnection,Standard_Transient)
|
||||
// =======================================================================
|
||||
Aspect_DisplayConnection::Aspect_DisplayConnection()
|
||||
{
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
|
||||
#if defined(HAVE_XLIB)
|
||||
myDisplay = NULL;
|
||||
myDefVisualInfo = NULL;
|
||||
myDefFBConfig = NULL;
|
||||
@@ -41,7 +47,7 @@ Aspect_DisplayConnection::Aspect_DisplayConnection()
|
||||
// =======================================================================
|
||||
Aspect_DisplayConnection::~Aspect_DisplayConnection()
|
||||
{
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
|
||||
#if defined(HAVE_XLIB)
|
||||
if (myDefVisualInfo != NULL)
|
||||
{
|
||||
XFree (myDefVisualInfo);
|
||||
@@ -49,12 +55,11 @@ Aspect_DisplayConnection::~Aspect_DisplayConnection()
|
||||
if (myDisplay != NULL
|
||||
&& myIsOwnDisplay)
|
||||
{
|
||||
XCloseDisplay (myDisplay);
|
||||
XCloseDisplay ((Display* )myDisplay);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
|
||||
// =======================================================================
|
||||
// function : Aspect_DisplayConnection
|
||||
// purpose :
|
||||
@@ -73,7 +78,7 @@ Aspect_DisplayConnection::Aspect_DisplayConnection (const TCollection_AsciiStrin
|
||||
// function : Aspect_DisplayConnection
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Aspect_DisplayConnection::Aspect_DisplayConnection (Display* theDisplay)
|
||||
Aspect_DisplayConnection::Aspect_DisplayConnection (Aspect_XDisplay* theDisplay)
|
||||
: myDisplay (NULL),
|
||||
myDefVisualInfo (NULL),
|
||||
myDefFBConfig (NULL),
|
||||
@@ -86,12 +91,14 @@ Aspect_DisplayConnection::Aspect_DisplayConnection (Display* theDisplay)
|
||||
// function : SetDefaultVisualInfo
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Aspect_DisplayConnection::SetDefaultVisualInfo (XVisualInfo* theVisual,
|
||||
void Aspect_DisplayConnection::SetDefaultVisualInfo (Aspect_XVisualInfo* theVisual,
|
||||
Aspect_FBConfig theFBConfig)
|
||||
{
|
||||
if (myDefVisualInfo != NULL)
|
||||
{
|
||||
#if defined(HAVE_XLIB)
|
||||
XFree (myDefVisualInfo);
|
||||
#endif
|
||||
}
|
||||
myDefVisualInfo = theVisual;
|
||||
myDefFBConfig = theFBConfig;
|
||||
@@ -101,17 +108,18 @@ void Aspect_DisplayConnection::SetDefaultVisualInfo (XVisualInfo* theVisual,
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Aspect_DisplayConnection::Init (Display* theDisplay)
|
||||
void Aspect_DisplayConnection::Init (Aspect_XDisplay* theDisplay)
|
||||
{
|
||||
#if defined(HAVE_XLIB)
|
||||
if (myDisplay != NULL
|
||||
&& myIsOwnDisplay)
|
||||
{
|
||||
XCloseDisplay (myDisplay);
|
||||
XCloseDisplay ((Display* )myDisplay);
|
||||
}
|
||||
myIsOwnDisplay = false;
|
||||
myAtoms.Clear();
|
||||
|
||||
myDisplay = theDisplay != NULL ? theDisplay : XOpenDisplay (myDisplayName.ToCString());
|
||||
myDisplay = theDisplay != NULL ? theDisplay : (Aspect_XDisplay* )XOpenDisplay (myDisplayName.ToCString());
|
||||
if (myDisplay == NULL)
|
||||
{
|
||||
TCollection_AsciiString aMessage;
|
||||
@@ -122,18 +130,10 @@ void Aspect_DisplayConnection::Init (Display* theDisplay)
|
||||
else
|
||||
{
|
||||
myIsOwnDisplay = theDisplay == NULL;
|
||||
myAtoms.Bind (Aspect_XA_DELETE_WINDOW, XInternAtom(myDisplay, "WM_DELETE_WINDOW", False));
|
||||
myAtoms.Bind (Aspect_XA_DELETE_WINDOW, (uint64_t )XInternAtom((Display* )myDisplay, "WM_DELETE_WINDOW", False));
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetAtom
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Atom Aspect_DisplayConnection::GetAtom (const Aspect_XAtom theAtom) const
|
||||
{
|
||||
Atom anAtom = myAtoms.Find(theAtom);
|
||||
return anAtom;
|
||||
}
|
||||
|
||||
#else
|
||||
myDisplay = theDisplay;
|
||||
myIsOwnDisplay = theDisplay == NULL;
|
||||
#endif
|
||||
}
|
||||
|
@@ -16,51 +16,52 @@
|
||||
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Aspect_XAtom.hxx>
|
||||
#include <Aspect_FBConfig.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
|
||||
#include <InterfaceGraphic.hxx>
|
||||
#include <Aspect_FBConfig.hxx>
|
||||
#endif
|
||||
struct Aspect_XDisplay;
|
||||
struct Aspect_XVisualInfo;
|
||||
|
||||
//! This class creates and provides connection with X server.
|
||||
//! Raises exception if can not connect to X server.
|
||||
//! On Windows and Mac OS X (in case when Cocoa used) platforms this class do nothing.
|
||||
//! WARRNING: Do not close display connection manualy!
|
||||
|
||||
//! On Windows and Mac OS X (in case when Cocoa used) platforms this class does nothing.
|
||||
//! WARRNING: Do not close display connection manually!
|
||||
class Aspect_DisplayConnection : public Standard_Transient
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(Aspect_DisplayConnection, Standard_Transient)
|
||||
public:
|
||||
|
||||
//! Default constructor. Creates connection with display name taken from "DISPLAY" environment variable
|
||||
Standard_EXPORT Aspect_DisplayConnection();
|
||||
|
||||
//! Destructor. Close opened connection.
|
||||
Standard_EXPORT ~Aspect_DisplayConnection();
|
||||
Standard_EXPORT virtual ~Aspect_DisplayConnection();
|
||||
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
|
||||
//! Constructor. Creates connection with display specified in theDisplayName.
|
||||
//! Display name should be in format "hostname:number" or "hostname:number.screen_number", where:
|
||||
//! hostname - Specifies the name of the host machine on which the display is physically attached.
|
||||
//! number - Specifies the number of the display server on that host machine.
|
||||
//! screen_number - Specifies the screen to be used on that server. Optional variable.
|
||||
Aspect_DisplayConnection (const TCollection_AsciiString& theDisplayName);
|
||||
Standard_EXPORT Aspect_DisplayConnection (const TCollection_AsciiString& theDisplayName);
|
||||
|
||||
//! Constructor wrapping existing Display instance.
|
||||
//! WARNING! it is a responsibility of application to keep this pointer
|
||||
//! valid while Aspect_DisplayConnection is alive and to close Display when it is no more needed.
|
||||
Aspect_DisplayConnection (Display* theDisplay);
|
||||
Standard_EXPORT Aspect_DisplayConnection (Aspect_XDisplay* theDisplay);
|
||||
|
||||
//! @return pointer to Display structure that serves as the connection to the X server.
|
||||
Display* GetDisplay() { return myDisplay; }
|
||||
Aspect_XDisplay* GetDisplayAspect() { return myDisplay; }
|
||||
|
||||
//! @return TRUE if X Display has been allocated by this class
|
||||
Standard_Boolean IsOwnDisplay() const { return myIsOwnDisplay; }
|
||||
|
||||
//! @return identifier(atom) for custom named property associated with windows that use current connection to X server.
|
||||
Atom GetAtom (const Aspect_XAtom theAtom) const;
|
||||
uint64_t GetAtom (const Aspect_XAtom theAtom) const
|
||||
{
|
||||
return myAtoms.Find (theAtom);
|
||||
}
|
||||
|
||||
//! @return display name for this connection.
|
||||
const TCollection_AsciiString& GetDisplayName() { return myDisplayName; }
|
||||
@@ -71,27 +72,60 @@ public:
|
||||
//! to keep this pointer valid while Aspect_DisplayConnection is alive
|
||||
//! and to close Display when it is no more needed.
|
||||
//! @param theDisplay external pointer to allocated Display, or NULL if new connection should be created
|
||||
void Init (Display* theDisplay);
|
||||
Standard_EXPORT void Init (Aspect_XDisplay* theDisplay);
|
||||
|
||||
//! Return default window visual or NULL when undefined.
|
||||
XVisualInfo* GetDefaultVisualInfo() const { return myDefVisualInfo; }
|
||||
Aspect_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,
|
||||
Standard_EXPORT void SetDefaultVisualInfo (Aspect_XVisualInfo* theVisual,
|
||||
Aspect_FBConfig theFBConfig);
|
||||
|
||||
#ifdef X_PROTOCOL
|
||||
//! Constructor wrapping existing Display instance.
|
||||
//! WARNING! it is a responsibility of application to keep this pointer
|
||||
//! valid while Aspect_DisplayConnection is alive and to close Display when it is no more needed.
|
||||
Aspect_DisplayConnection (Display* theDisplay)
|
||||
: Aspect_DisplayConnection ((Aspect_XDisplay* )theDisplay) {}
|
||||
|
||||
//! @return pointer to Display structure that serves as the connection to the X server.
|
||||
Display* GetDisplay() { return (Display* )myDisplay; }
|
||||
|
||||
//! Return default window visual or NULL when undefined.
|
||||
XVisualInfo* GetDefaultVisualInfoX() const { return (XVisualInfo* )myDefVisualInfo; }
|
||||
|
||||
//! Set default window visual; the visual will be deallocated using XFree().
|
||||
void SetDefaultVisualInfo (XVisualInfo* theVisual,
|
||||
Aspect_FBConfig theFBConfig)
|
||||
{
|
||||
SetDefaultVisualInfo ((Aspect_XVisualInfo* )theVisual, theFBConfig);
|
||||
}
|
||||
|
||||
//! @return identifier(atom) for custom named property associated with windows that use current connection to X server.
|
||||
Atom GetAtomX (const Aspect_XAtom theAtom) const
|
||||
{
|
||||
return (Atom )GetAtom (theAtom);
|
||||
}
|
||||
|
||||
//! Open connection with display specified in myDisplayName class field
|
||||
//! or takes theDisplay parameter when it is not NULL.
|
||||
void Init (Display* theDisplay)
|
||||
{
|
||||
Init ((Aspect_XDisplay* )theDisplay);
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
Display* myDisplay;
|
||||
XVisualInfo* myDefVisualInfo;
|
||||
Aspect_XDisplay* myDisplay;
|
||||
Aspect_XVisualInfo* myDefVisualInfo;
|
||||
Aspect_FBConfig myDefFBConfig;
|
||||
NCollection_DataMap<Aspect_XAtom, Atom> myAtoms;
|
||||
NCollection_DataMap<Aspect_XAtom, uint64_t> myAtoms;
|
||||
TCollection_AsciiString myDisplayName;
|
||||
Standard_Boolean myIsOwnDisplay;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
@@ -99,10 +133,6 @@ private:
|
||||
Aspect_DisplayConnection (const Aspect_DisplayConnection& );
|
||||
Aspect_DisplayConnection& operator= (const Aspect_DisplayConnection& );
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Aspect_DisplayConnection,Standard_Transient) // Type definition
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE (Aspect_DisplayConnection, Standard_Transient)
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
/*============================================================================*/
|
||||
/*==== Titre: Aspect_Drawable.hxx */
|
||||
/*==== Title: Aspect_Drawable.hxx */
|
||||
/*==== Role : The header file of primitive type "Handle" from packages */
|
||||
/*==== "Xw" & "WNT" */
|
||||
/*==== Implementation: This is a primitive type implemented with typedef */
|
||||
|
@@ -14,11 +14,7 @@
|
||||
#ifndef _Aspect_FBConfig_HeaderFile
|
||||
#define _Aspect_FBConfig_HeaderFile
|
||||
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
|
||||
typedef struct __GLXFBConfigRec* GLXFBConfig;
|
||||
typedef GLXFBConfig Aspect_FBConfig; // GLXFBConfig* under UNIX
|
||||
#else
|
||||
typedef void* Aspect_FBConfig; // unused on other systems
|
||||
#endif
|
||||
typedef struct __GLXFBConfigRec* GLXFBConfig;
|
||||
typedef GLXFBConfig Aspect_FBConfig;
|
||||
|
||||
#endif // _Aspect_FBConfig_HeaderFile
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
/*============================================================================*/
|
||||
/*==== Titre: Aspect_Handle.hxx */
|
||||
/*==== Title: Aspect_Handle.hxx */
|
||||
/*==== Role : The header file of primitive type "Handle" from packages */
|
||||
/*==== "Xw" & "WNT" */
|
||||
/*==== Implementation: This is a primitive type implemented with typedef */
|
||||
|
@@ -12,9 +12,9 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
/*============================================================================*/
|
||||
/*==== Titre: Aspect_RenderingContext.hxx */
|
||||
/*==== Role : The header file of primitive type "RenderingContext" from package */
|
||||
/*==== "V3d" */
|
||||
/*==== Title: Aspect_RenderingContext.hxx */
|
||||
/*==== Role: The header file of primitive type "RenderingContext" from package*/
|
||||
/*==== "V3d" */
|
||||
/*==== Implementation: This is a primitive type implemented with typedef */
|
||||
/*============================================================================*/
|
||||
// To manage 2D or 3D graphic context
|
||||
@@ -22,7 +22,7 @@
|
||||
#ifndef _Aspect_RenderingContext_HeaderFile
|
||||
#define _Aspect_RenderingContext_HeaderFile
|
||||
|
||||
#if defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
#if defined(__APPLE__) && !defined(HAVE_XLIB)
|
||||
#import <TargetConditionals.h>
|
||||
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
||||
#ifdef __OBJC__
|
||||
|
168
src/Aspect/Aspect_WindowInputListener.cxx
Normal file
168
src/Aspect/Aspect_WindowInputListener.cxx
Normal file
@@ -0,0 +1,168 @@
|
||||
// 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 <Aspect_WindowInputListener.hxx>
|
||||
|
||||
#include <WNT_HIDSpaceMouse.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : Aspect_WindowInputListener
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Aspect_WindowInputListener::Aspect_WindowInputListener()
|
||||
: myMousePressed (Aspect_VKeyMouse_NONE),
|
||||
myMouseModifiers (Aspect_VKeyFlags_NONE),
|
||||
//
|
||||
my3dMouseNoRotate (false, false, false),
|
||||
my3dMouseToReverse (true, false, false),
|
||||
my3dMouseAccelTrans (2.0f),
|
||||
my3dMouseAccelRotate (4.0f),
|
||||
my3dMouseIsQuadric (true)
|
||||
{
|
||||
memset(my3dMouseButtonState, 0, sizeof(my3dMouseButtonState));
|
||||
myEventTimer.Start();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ~Aspect_WindowInputListener
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Aspect_WindowInputListener::~Aspect_WindowInputListener()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : KeyDown
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Aspect_WindowInputListener::KeyDown (Aspect_VKey theKey,
|
||||
double theTime,
|
||||
double thePressure)
|
||||
{
|
||||
myKeys.KeyDown (theKey, theTime, thePressure);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : KeyUp
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Aspect_WindowInputListener::KeyUp (Aspect_VKey theKey,
|
||||
double theTime)
|
||||
{
|
||||
myKeys.KeyUp (theKey, theTime);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : KeyFromAxis
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Aspect_WindowInputListener::KeyFromAxis (Aspect_VKey theNegative,
|
||||
Aspect_VKey thePositive,
|
||||
double theTime,
|
||||
double thePressure)
|
||||
{
|
||||
myKeys.KeyFromAxis (theNegative, thePositive, theTime, thePressure);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : update3dMouseTranslation
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool Aspect_WindowInputListener::update3dMouseTranslation (const WNT_HIDSpaceMouse& theEvent)
|
||||
{
|
||||
if (!theEvent.IsTranslation())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isIdle = true;
|
||||
const double aTimeStamp = EventTime();
|
||||
const Graphic3d_Vec3d aTrans = theEvent.Translation (isIdle, my3dMouseIsQuadric) * my3dMouseAccelTrans;
|
||||
myKeys.KeyFromAxis (Aspect_VKey_NavSlideLeft, Aspect_VKey_NavSlideRight, aTimeStamp, aTrans.x());
|
||||
myKeys.KeyFromAxis (Aspect_VKey_NavForward, Aspect_VKey_NavBackward, aTimeStamp, aTrans.y());
|
||||
myKeys.KeyFromAxis (Aspect_VKey_NavSlideUp, Aspect_VKey_NavSlideDown, aTimeStamp, aTrans.z());
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : update3dMouseRotation
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool Aspect_WindowInputListener::update3dMouseRotation (const WNT_HIDSpaceMouse& theEvent)
|
||||
{
|
||||
if (!theEvent.IsRotation())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isIdle = true, toUpdate = false;
|
||||
const double aTimeStamp = EventTime();
|
||||
const Graphic3d_Vec3d aRot3 = theEvent.Rotation (isIdle, my3dMouseIsQuadric) * my3dMouseAccelRotate;
|
||||
if (!my3dMouseNoRotate.x())
|
||||
{
|
||||
KeyFromAxis (Aspect_VKey_NavLookUp, Aspect_VKey_NavLookDown, aTimeStamp, !my3dMouseToReverse.x() ? aRot3.x() : -aRot3.x());
|
||||
toUpdate = true;
|
||||
}
|
||||
if (!my3dMouseNoRotate.y())
|
||||
{
|
||||
KeyFromAxis (Aspect_VKey_NavRollCW, Aspect_VKey_NavRollCCW, aTimeStamp, !my3dMouseToReverse.y() ? aRot3.y() : -aRot3.y());
|
||||
toUpdate = true;
|
||||
}
|
||||
if (!my3dMouseNoRotate.z())
|
||||
{
|
||||
KeyFromAxis (Aspect_VKey_NavLookLeft, Aspect_VKey_NavLookRight, aTimeStamp, !my3dMouseToReverse.z() ? aRot3.z() : -aRot3.z());
|
||||
toUpdate = true;
|
||||
}
|
||||
return toUpdate;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : update3dMouseKeys
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool Aspect_WindowInputListener::update3dMouseKeys (const WNT_HIDSpaceMouse& theEvent)
|
||||
{
|
||||
bool toUpdate = false;
|
||||
const double aTimeStamp = EventTime();
|
||||
if (theEvent.IsKeyState())
|
||||
{
|
||||
const uint32_t aKeyState = theEvent.KeyState();
|
||||
for (unsigned short aKeyBit = 0; aKeyBit < 32; ++aKeyBit)
|
||||
{
|
||||
const bool isPressed = (aKeyState & (1 << aKeyBit)) != 0;
|
||||
const bool isReleased = my3dMouseButtonState[aKeyBit] && !isPressed;
|
||||
//const bool isRepeated = my3dMouseButtonState[aKeyBit] && isPressed;
|
||||
my3dMouseButtonState[aKeyBit] = isPressed;
|
||||
if (!isReleased && !isPressed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Aspect_VKey aVKey = theEvent.HidToSpaceKey (aKeyBit);
|
||||
if (aVKey != Aspect_VKey_UNKNOWN)
|
||||
{
|
||||
toUpdate = true;
|
||||
if (isPressed)
|
||||
{
|
||||
KeyDown (aVKey, aTimeStamp);
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyUp (aVKey, aTimeStamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return toUpdate;
|
||||
}
|
236
src/Aspect/Aspect_WindowInputListener.hxx
Normal file
236
src/Aspect/Aspect_WindowInputListener.hxx
Normal file
@@ -0,0 +1,236 @@
|
||||
// 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 _Aspect_WindowInputListener_HeaderFile
|
||||
#define _Aspect_WindowInputListener_HeaderFile
|
||||
|
||||
#include <Aspect_VKeySet.hxx>
|
||||
#include <Graphic3d_Vec.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
|
||||
struct Aspect_ScrollDelta;
|
||||
class WNT_HIDSpaceMouse;
|
||||
|
||||
//! Defines a listener for window input events.
|
||||
class Aspect_WindowInputListener
|
||||
{
|
||||
public:
|
||||
///DEFINE_STANDARD_ALLOC
|
||||
public:
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~Aspect_WindowInputListener();
|
||||
|
||||
//! Return event time (e.g. current time).
|
||||
double EventTime() const { return myEventTimer.ElapsedTime(); }
|
||||
|
||||
//! Handle expose event (window content has been invalidation and should be redrawn).
|
||||
virtual void ProcessExpose() = 0;
|
||||
|
||||
//! Handle window resize event.
|
||||
virtual void ProcessConfigure (bool theIsResized) = 0;
|
||||
|
||||
//! Handle window input event immediately (flush input buffer or ignore).
|
||||
virtual void ProcessInput() = 0;
|
||||
|
||||
//! Handle focus event.
|
||||
virtual void ProcessFocus (bool theIsActivated) = 0;
|
||||
|
||||
//! Handle window close event.
|
||||
virtual void ProcessClose() = 0;
|
||||
|
||||
public: //! @name keyboard input
|
||||
|
||||
//! Return keyboard state.
|
||||
const Aspect_VKeySet& Keys() const { return myKeys; }
|
||||
|
||||
//! Return keyboard state.
|
||||
Aspect_VKeySet& ChangeKeys() { return myKeys; }
|
||||
|
||||
//! Press key.
|
||||
//! Default implementation updates internal cache.
|
||||
//! @param theKey key pressed
|
||||
//! @param theTime event timestamp
|
||||
Standard_EXPORT virtual void KeyDown (Aspect_VKey theKey,
|
||||
double theTime,
|
||||
double thePressure = 1.0) = 0;
|
||||
|
||||
//! Release key.
|
||||
//! Default implementation updates internal cache.
|
||||
//! @param theKey key pressed
|
||||
//! @param theTime event timestamp
|
||||
Standard_EXPORT virtual void KeyUp (Aspect_VKey theKey,
|
||||
double theTime) = 0;
|
||||
|
||||
//! Simulate key up/down events from axis value.
|
||||
//! Default implementation updates internal cache.
|
||||
Standard_EXPORT virtual void KeyFromAxis (Aspect_VKey theNegative,
|
||||
Aspect_VKey thePositive,
|
||||
double theTime,
|
||||
double thePressure) = 0;
|
||||
|
||||
public: //! @name mouse input
|
||||
|
||||
//! Update mouse scroll event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param theDelta mouse cursor position and delta
|
||||
//! @return TRUE if new event has been created or FALSE if existing one has been updated
|
||||
virtual bool UpdateMouseScroll (const Aspect_ScrollDelta& theDelta) = 0;
|
||||
|
||||
//! Handle mouse button press/release event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButtons pressed buttons
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
|
||||
//! but emulated from non-precise input like touch on screen
|
||||
//! @return TRUE if window content should be redrawn
|
||||
virtual bool UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButtons,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated) = 0;
|
||||
|
||||
//! Handle mouse cursor movement event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! Default implementation does nothing.
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButtons pressed buttons
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
|
||||
//! but emulated from non-precise input like touch on screen
|
||||
//! @return TRUE if window content should be redrawn
|
||||
virtual bool UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButtons,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated) = 0;
|
||||
|
||||
//! Handle mouse button press event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! Default implementation redirects to UpdateMousePosition().
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButton pressed button
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
|
||||
//! but emulated from non-precise input like touch on screen
|
||||
//! @return TRUE if window content should be redrawn
|
||||
bool PressMouseButton (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButton,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated)
|
||||
{
|
||||
return UpdateMouseButtons (thePoint, myMousePressed | theButton, theModifiers, theIsEmulated);
|
||||
}
|
||||
|
||||
//! Handle mouse button release event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! Default implementation redirects to UpdateMousePosition().
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButton released button
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
|
||||
//! but emulated from non-precise input like touch on screen
|
||||
//! @return TRUE if window content should be redrawn
|
||||
bool ReleaseMouseButton (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButton,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated)
|
||||
{
|
||||
Aspect_VKeyMouse aButtons = myMousePressed & (~theButton);
|
||||
return UpdateMouseButtons (thePoint, aButtons, theModifiers, theIsEmulated);
|
||||
}
|
||||
|
||||
//! Return currently pressed mouse buttons.
|
||||
Aspect_VKeyMouse PressedMouseButtons() const { return myMousePressed; }
|
||||
|
||||
//! Return active key modifiers passed with last mouse event.
|
||||
Aspect_VKeyFlags LastMouseFlags() const { return myMouseModifiers; }
|
||||
|
||||
//! Return last mouse position.
|
||||
const Graphic3d_Vec2i& LastMousePosition() const { return myMousePositionLast; }
|
||||
|
||||
public: //! @name 3d mouse input
|
||||
|
||||
//! Return acceleration ratio for translation event; 2.0 by default.
|
||||
float Get3dMouseTranslationScale() const { return my3dMouseAccelTrans; }
|
||||
|
||||
//! Set acceleration ratio for translation event.
|
||||
void Set3dMouseTranslationScale (float theScale) { my3dMouseAccelTrans = theScale; }
|
||||
|
||||
//! Return acceleration ratio for rotation event; 4.0 by default.
|
||||
float Get3dMouseRotationScale() const { return my3dMouseAccelRotate; }
|
||||
|
||||
//! Set acceleration ratio for rotation event.
|
||||
void Set3dMouseRotationScale (float theScale) { my3dMouseAccelRotate = theScale; }
|
||||
|
||||
//! Return quadric acceleration flag; TRUE by default.
|
||||
bool To3dMousePreciseInput() const { return my3dMouseIsQuadric; }
|
||||
|
||||
//! Set quadric acceleration flag.
|
||||
void Set3dMousePreciseInput (bool theIsQuadric) { my3dMouseIsQuadric = theIsQuadric; }
|
||||
|
||||
//! Return 3d mouse rotation axes (tilt/roll/spin) ignore flag; (FALSE, FALSE, FALSE) by default.
|
||||
const NCollection_Vec3<bool>& Get3dMouseIsNoRotate() const { return my3dMouseNoRotate; }
|
||||
|
||||
//! Return 3d mouse rotation axes (tilt/roll/spin) ignore flag; (FALSE, FALSE, FALSE) by default.
|
||||
NCollection_Vec3<bool>& Change3dMouseIsNoRotate() { return my3dMouseNoRotate; }
|
||||
|
||||
//! Return 3d mouse rotation axes (tilt/roll/spin) reverse flag; (TRUE, FALSE, FALSE) by default.
|
||||
const NCollection_Vec3<bool>& Get3dMouseToReverse() const { return my3dMouseToReverse; }
|
||||
|
||||
//! Return 3d mouse rotation axes (tilt/roll/spin) reverse flag; (TRUE, FALSE, FALSE) by default.
|
||||
NCollection_Vec3<bool>& Change3dMouseToReverse() { return my3dMouseToReverse; }
|
||||
|
||||
//! Process 3d mouse input event (redirects to translation, rotation and keys).
|
||||
virtual bool Update3dMouse (const WNT_HIDSpaceMouse& theEvent) = 0;
|
||||
|
||||
//! Process 3d mouse input translation event.
|
||||
Standard_EXPORT virtual bool update3dMouseTranslation (const WNT_HIDSpaceMouse& theEvent);
|
||||
|
||||
//! Process 3d mouse input rotation event.
|
||||
Standard_EXPORT virtual bool update3dMouseRotation (const WNT_HIDSpaceMouse& theEvent);
|
||||
|
||||
//! Process 3d mouse input keys event.
|
||||
Standard_EXPORT virtual bool update3dMouseKeys (const WNT_HIDSpaceMouse& theEvent);
|
||||
|
||||
protected:
|
||||
|
||||
//! Empty constructor.
|
||||
Standard_EXPORT Aspect_WindowInputListener();
|
||||
|
||||
protected:
|
||||
|
||||
OSD_Timer myEventTimer; //!< timer for timestamping events
|
||||
|
||||
protected: //! @name keyboard input variables
|
||||
|
||||
Aspect_VKeySet myKeys; //!< keyboard state
|
||||
|
||||
protected: //! @name mouse input variables
|
||||
|
||||
Graphic3d_Vec2i myMousePositionLast; //!< last mouse position
|
||||
Aspect_VKeyMouse myMousePressed; //!< active mouse buttons
|
||||
Aspect_VKeyFlags myMouseModifiers; //!< active key modifiers passed with last mouse event
|
||||
|
||||
protected: //! @name 3d mouse input variables
|
||||
|
||||
bool my3dMouseButtonState[32];//!< cached button state
|
||||
NCollection_Vec3<bool> my3dMouseNoRotate; //!< ignore 3d mouse rotation axes
|
||||
NCollection_Vec3<bool> my3dMouseToReverse; //!< reverse 3d mouse rotation axes
|
||||
float my3dMouseAccelTrans; //!< acceleration ratio for translation event
|
||||
float my3dMouseAccelRotate; //!< acceleration ratio for rotation event
|
||||
bool my3dMouseIsQuadric; //!< quadric acceleration
|
||||
|
||||
};
|
||||
|
||||
#endif // _Aspect_WindowInputListener_HeaderFile
|
@@ -14,7 +14,7 @@
|
||||
#ifndef __Aspect_WNTXWD_HXX
|
||||
# define __Aspect_WNTXWD_HXX
|
||||
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(HAVE_XLIB)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
|
||||
# include <X11/XWDFile.h>
|
||||
# else
|
||||
|
||||
|
@@ -66,6 +66,8 @@ Aspect_Window.cxx
|
||||
Aspect_Window.hxx
|
||||
Aspect_WindowDefinitionError.hxx
|
||||
Aspect_WindowError.hxx
|
||||
Aspect_WindowInputListener.cxx
|
||||
Aspect_WindowInputListener.hxx
|
||||
Aspect_XAtom.hxx
|
||||
Aspect_XRAction.hxx
|
||||
Aspect_XRActionSet.hxx
|
||||
|
@@ -53,7 +53,7 @@ BOPAlgo_Builder::BOPAlgo_Builder()
|
||||
myShapesSD(100, myAllocator),
|
||||
myOrigins(100, myAllocator),
|
||||
myInParts(100, myAllocator),
|
||||
myNonDestructive(Standard_False),
|
||||
myNonDestructive(Standard_True),
|
||||
myGlue(BOPAlgo_GlueOff),
|
||||
myCheckInverted(Standard_True)
|
||||
{
|
||||
@@ -75,7 +75,7 @@ BOPAlgo_Builder::BOPAlgo_Builder
|
||||
myShapesSD(100, myAllocator),
|
||||
myOrigins(100, myAllocator),
|
||||
myInParts(100, myAllocator),
|
||||
myNonDestructive(Standard_False),
|
||||
myNonDestructive(Standard_True),
|
||||
myGlue(BOPAlgo_GlueOff),
|
||||
myCheckInverted(Standard_True)
|
||||
{
|
||||
|
@@ -52,7 +52,7 @@ class TopoDS_Solid;
|
||||
//! Additionally to the options of the base classes, the algorithm has
|
||||
//! the following options:<br>
|
||||
//! - *Safe processing mode* - allows to avoid modification of the input
|
||||
//! shapes during the operation (by default it is off);<br>
|
||||
//! shapes during the operation (enabled by default);<br>
|
||||
//! - *Gluing options* - allows to speed up the calculation of the intersections
|
||||
//! on the special cases, in which some sub-shapes are coinciding.<br>
|
||||
//! - *Disabling the check for inverted solids* - Disables/Enables the check of the input solids
|
||||
@@ -126,6 +126,7 @@ public: //! @name Options
|
||||
//! This flag is taken into account if internal PaveFiller is used only.
|
||||
//! In the case of calling PerformWithFiller the corresponding flag of that PaveFiller
|
||||
//! is in force.
|
||||
//! Enabled by default.
|
||||
void SetNonDestructive(const Standard_Boolean theFlag)
|
||||
{
|
||||
myNonDestructive = theFlag;
|
||||
|
@@ -42,7 +42,7 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
|
||||
{
|
||||
myDS = NULL;
|
||||
myIterator = NULL;
|
||||
myNonDestructive = Standard_False;
|
||||
myNonDestructive = Standard_True;
|
||||
myIsPrimary = Standard_True;
|
||||
myAvoidBuildPCurve = Standard_False;
|
||||
myGlue = BOPAlgo_GlueOff;
|
||||
@@ -62,7 +62,7 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
|
||||
{
|
||||
myDS = NULL;
|
||||
myIterator = NULL;
|
||||
myNonDestructive = Standard_False;
|
||||
myNonDestructive = Standard_True;
|
||||
myIsPrimary = Standard_True;
|
||||
myAvoidBuildPCurve = Standard_False;
|
||||
myGlue = BOPAlgo_GlueOff;
|
||||
|
@@ -83,7 +83,7 @@ class TopoDS_Face;
|
||||
//! - *Section attributes* - allows to customize the intersection of the faces
|
||||
//! (avoid approximation or building 2d curves);<br>
|
||||
//! - *Safe processing mode* - allows to avoid modification of the input
|
||||
//! shapes during the operation (by default it is off);<br>
|
||||
//! shapes during the operation (enabled by default);<br>
|
||||
//! - *Gluing options* - allows to speed up the calculation on the special
|
||||
//! cases, in which some sub-shapes are coincide.<br>
|
||||
//!
|
||||
@@ -151,6 +151,7 @@ public:
|
||||
//! Sets the flag that defines the mode of treatment.
|
||||
//! In non-destructive mode the argument shapes are not modified. Instead
|
||||
//! a copy of a sub-shape is created in the result if it is needed to be updated.
|
||||
//! Enabled by default.
|
||||
Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag);
|
||||
|
||||
//! Returns the flag that defines the mode of treatment.
|
||||
|
@@ -102,7 +102,7 @@ class BOPTest_Session {
|
||||
void SetDefaultOptions()
|
||||
{
|
||||
myRunParallel = Standard_False;
|
||||
myNonDestructive = Standard_False;
|
||||
myNonDestructive = Standard_True;
|
||||
myFuzzyValue = Precision::Confusion();
|
||||
myGlue = BOPAlgo_GlueOff;
|
||||
myDrawWarnShapes = Standard_False;
|
||||
|
@@ -64,7 +64,7 @@ void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
|
||||
"\t\tUsage: bglue [0 (off) / 1 (shift) / 2 (full)]",
|
||||
__FILE__, bGlue, g);
|
||||
|
||||
theCommands.Add("bdrawwarnshapes", "Enables/Disables drawing of waring shapes of BOP algorithms.\n"
|
||||
theCommands.Add("bdrawwarnshapes", "Enables/Disables drawing of warning shapes of BOP algorithms.\n"
|
||||
"\t\tUsage: bdrawwarnshapes 0 (do not draw) / 1 (draw warning shapes)",
|
||||
__FILE__, bdrawwarnshapes, g);
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -189,14 +189,15 @@ public:
|
||||
|
||||
//! Checks if CurveOnSurface of theE on theF matches with isoline of theF surface.
|
||||
//! Sets corresponding values for isTheUIso and isTheVIso variables.
|
||||
//!
|
||||
//! ATTENTION!!!
|
||||
//! This method is based on comparation between direction of
|
||||
//! surface (which theF is based on) iso-lines and the direction
|
||||
//! of the edge p-curve (on theF) in middle-point of the p-curve.
|
||||
//! This method should be used carefully
|
||||
//! (e.g. BRep_Tool::IsClosed(...) together) in order to
|
||||
//! avoid false classification some p-curves as isoline (e.g. circle
|
||||
//! on a plane).
|
||||
//! This method is based on the comparison between direction of
|
||||
//! surface (which theF is based on) iso-lines and the direction
|
||||
//! of the edge p-curve (on theF) in middle-point of the p-curve.
|
||||
//!
|
||||
//! This method should be used carefully
|
||||
//! (e.g. BRep_Tool::IsClosed(...) together) in order to avoid
|
||||
//! false classification some p-curves as isoline (e.g. circle on a plane).
|
||||
Standard_EXPORT static void IsEdgeIsoline(const TopoDS_Edge& theE,
|
||||
const TopoDS_Face& theF,
|
||||
Standard_Boolean& isTheUIso,
|
||||
|
@@ -80,11 +80,10 @@ public:
|
||||
//! auto-intersection of new wires are not searched.
|
||||
Standard_EXPORT static Standard_Boolean IsValid (const TopTools_ListOfShape& theArgs, const TopoDS_Shape& theResult, const Standard_Boolean closedSolid = Standard_False, const Standard_Boolean GeomCtrl = Standard_True);
|
||||
|
||||
//! Checks if the shape is "correct". If not, returns
|
||||
//! <Standard_False>, else returns <Standard_True>.
|
||||
//! This method differs from the previous one in the
|
||||
//! fact that no geometric contols (intersection of
|
||||
//! wires, pcurve validity) are performed.
|
||||
//! Checks if the shape is "correct".
|
||||
//! If not, returns FALSE, else returns TRUE.
|
||||
//! This method differs from the previous one in the fact that no geometric controls
|
||||
//! (intersection of wires, pcurve validity) are performed.
|
||||
Standard_EXPORT static Standard_Boolean IsTopologicallyValid (const TopoDS_Shape& S);
|
||||
|
||||
|
||||
|
@@ -37,7 +37,6 @@ class BRepAlgo_AsDes : public Standard_Transient
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates an empty AsDes.
|
||||
Standard_EXPORT BRepAlgo_AsDes();
|
||||
|
||||
@@ -61,45 +60,34 @@ public:
|
||||
|
||||
//! Returns futur subhapes of <S>.
|
||||
Standard_EXPORT TopTools_ListOfShape& ChangeDescendant (const TopoDS_Shape& S);
|
||||
|
||||
//! Replace <OldS> by <NewS>.
|
||||
//! <OldS> disapear from <me>.
|
||||
Standard_EXPORT void Replace (const TopoDS_Shape& OldS, const TopoDS_Shape& NewS);
|
||||
|
||||
//! Remove <S> from me.
|
||||
Standard_EXPORT void Remove (const TopoDS_Shape& S);
|
||||
|
||||
|
||||
//! Replace theOldS by theNewS.
|
||||
//! theOldS disappear from this.
|
||||
Standard_EXPORT void Replace (const TopoDS_Shape& theOldS, const TopoDS_Shape& theNewS);
|
||||
|
||||
//! Remove theS from me.
|
||||
Standard_EXPORT void Remove (const TopoDS_Shape& theS);
|
||||
|
||||
//! Returns True if (S1> and <S2> has common
|
||||
//! Descendants. Stores in <LC> the Commons Descendants.
|
||||
Standard_EXPORT Standard_Boolean HasCommonDescendant (const TopoDS_Shape& S1, const TopoDS_Shape& S2, TopTools_ListOfShape& LC) const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BRepAlgo_AsDes,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Replace <OldS> by <NewS>.
|
||||
//! <OldS> disapear from <me>.
|
||||
Standard_EXPORT void BackReplace (const TopoDS_Shape& OldS, const TopoDS_Shape& NewS, const TopTools_ListOfShape& L, const Standard_Boolean InUp);
|
||||
//! Replace theOldS by theNewS.
|
||||
//! theOldS disappear from this.
|
||||
Standard_EXPORT void BackReplace (const TopoDS_Shape& theOldS,
|
||||
const TopoDS_Shape& theNewS,
|
||||
const TopTools_ListOfShape& theL,
|
||||
const Standard_Boolean theInUp);
|
||||
|
||||
private:
|
||||
|
||||
TopTools_DataMapOfShapeListOfShape up;
|
||||
TopTools_DataMapOfShapeListOfShape down;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BRepAlgo_AsDes_HeaderFile
|
||||
|
@@ -28,7 +28,7 @@
|
||||
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
|
||||
:
|
||||
BRepAlgoAPI_Algo(),
|
||||
myNonDestructive(Standard_False),
|
||||
myNonDestructive(Standard_True),
|
||||
myGlue(BOPAlgo_GlueOff),
|
||||
myCheckInverted(Standard_True),
|
||||
myFillHistory(Standard_True),
|
||||
@@ -43,7 +43,7 @@ BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
|
||||
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo(const BOPAlgo_PaveFiller& aPF)
|
||||
:
|
||||
BRepAlgoAPI_Algo(),
|
||||
myNonDestructive(Standard_False),
|
||||
myNonDestructive(Standard_True),
|
||||
myGlue(BOPAlgo_GlueOff),
|
||||
myCheckInverted(Standard_True),
|
||||
myFillHistory(Standard_True),
|
||||
|
@@ -34,7 +34,7 @@
|
||||
//! Additionally to the options defined in the base class, the algorithm has
|
||||
//! the following options:<br>
|
||||
//! - *Safe processing mode* - allows to avoid modification of the input
|
||||
//! shapes during the operation (by default it is off);
|
||||
//! shapes during the operation (enabled by default);
|
||||
//! - *Gluing options* - allows to speed up the calculation of the intersections
|
||||
//! on the special cases, in which some sub-shapes are coinciding.
|
||||
//! - *Disabling the check for inverted solids* - Disables/Enables the check of the input solids
|
||||
@@ -94,6 +94,7 @@ public: //! @name Setting options
|
||||
//! Sets the flag that defines the mode of treatment.
|
||||
//! In non-destructive mode the argument shapes are not modified. Instead
|
||||
//! a copy of a sub-shape is created in the result if it is needed to be updated.
|
||||
//! Enabled by default.
|
||||
void SetNonDestructive(const Standard_Boolean theFlag)
|
||||
{
|
||||
myNonDestructive = theFlag;
|
||||
|
@@ -151,7 +151,7 @@ protected:
|
||||
NCollection_List<Standard_Integer> myFaces;
|
||||
NCollection_List<Standard_Integer> myEdges;
|
||||
|
||||
//! Indentifies the place of this Vertex in
|
||||
//! Identifies the place of this Vertex in
|
||||
//! BRepBuilderAPI_FastSewing::myVertexVec list
|
||||
Standard_Integer myID;
|
||||
};
|
||||
@@ -201,7 +201,7 @@ protected:
|
||||
//! myVertices[i] is Start point of myEdges[i]
|
||||
Standard_Integer myVertices[4];
|
||||
|
||||
//! Indentifies the place of this Face in
|
||||
//! Identifies the place of this Face in
|
||||
//! BRepBuilderAPI_FastSewing::myFaceVec list
|
||||
Standard_Integer myID;
|
||||
};
|
||||
@@ -245,7 +245,7 @@ protected:
|
||||
//! Value is the index of this shape in myFaceVec array
|
||||
NCollection_Sequence<Standard_Integer> myFaces;
|
||||
|
||||
//! Indentifies the place of this Edge in
|
||||
//! Identifies the place of this Edge in
|
||||
//! BRepBuilderAPI_FastSewing::myEdgeVec list
|
||||
Standard_Integer myID;
|
||||
|
||||
|
@@ -235,7 +235,7 @@ public:
|
||||
|
||||
//! Gets mode for non-manifold sewing.
|
||||
//!
|
||||
//! INTERNAL FUCTIONS ---
|
||||
//! INTERNAL FUNCTIONS ---
|
||||
Standard_Boolean NonManifoldMode() const;
|
||||
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
@@ -473,7 +473,7 @@ BRepCheck_Status BRepCheck_Face::OrientationOfWires
|
||||
}
|
||||
}
|
||||
}
|
||||
// quit withour error
|
||||
// quit without error
|
||||
if (Update) {
|
||||
BRepCheck::Add(myMap(myShape),myOrires);
|
||||
}
|
||||
|
@@ -56,7 +56,6 @@ BRepCheck_BadOrientationOfSubshape,
|
||||
BRepCheck_InvalidPolygonOnTriangulation,
|
||||
BRepCheck_InvalidToleranceValue,
|
||||
BRepCheck_EnclosedRegion,
|
||||
BRepCheck_CollapsedEdge,
|
||||
BRepCheck_CheckFail
|
||||
};
|
||||
|
||||
|
@@ -110,10 +110,10 @@ class BRepExtrema_DistShapeShape
|
||||
//! This support can be a Vertex, an Edge or a Face. <br>
|
||||
Standard_EXPORT TopoDS_Shape SupportOnShape2(const Standard_Integer N) const;
|
||||
//! gives the corresponding parameter t if the Nth solution <br>
|
||||
//! is situated on an Egde of the first shape <br>
|
||||
//! is situated on an Edge of the first shape <br>
|
||||
Standard_EXPORT void ParOnEdgeS1(const Standard_Integer N,Standard_Real& t) const;
|
||||
//! gives the corresponding parameter t if the Nth solution <br>
|
||||
//! is situated on an Egde of the first shape <br>
|
||||
//! is situated on an Edge of the first shape <br>
|
||||
Standard_EXPORT void ParOnEdgeS2(const Standard_Integer N,Standard_Real& t) const;
|
||||
//! gives the corresponding parameters (U,V) if the Nth solution <br>
|
||||
//! is situated on an face of the first shape <br>
|
||||
|
@@ -28,18 +28,15 @@ class Geom2d_Curve;
|
||||
class StdFail_NotDone;
|
||||
|
||||
|
||||
//! Evaluate the 3dCurve and the PCurves described in
|
||||
//! a MultiLine from BRepFill. The parametrization of
|
||||
//! those curves is not imposed by the Bissectrice.
|
||||
//! The parametrization is given approximatively by
|
||||
//! the abscissa of the curve3d.
|
||||
class BRepFill_ApproxSeewing
|
||||
//! Evaluate the 3dCurve and the PCurves described in a MultiLine from BRepFill.
|
||||
//! The parametrization of those curves is not imposed by the Bissectrice.
|
||||
//! The parametrization is given approximately by the abscissa of the curve3d.
|
||||
class BRepFill_ApproxSeewing
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT BRepFill_ApproxSeewing();
|
||||
|
||||
Standard_EXPORT BRepFill_ApproxSeewing(const BRepFill_MultiLine& ML);
|
||||
@@ -59,32 +56,14 @@ public:
|
||||
//! first face of the MultiLine
|
||||
Standard_EXPORT const Handle(Geom2d_Curve)& CurveOnF2() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
BRepFill_MultiLine myML;
|
||||
Standard_Boolean myIsDone;
|
||||
Handle(Geom_Curve) myCurve;
|
||||
Handle(Geom2d_Curve) myPCurve1;
|
||||
Handle(Geom2d_Curve) myPCurve2;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BRepFill_ApproxSeewing_HeaderFile
|
||||
|
@@ -129,7 +129,7 @@ public:
|
||||
//! - correspondence between profile, and section on the sweeped shape defined by a vertex of the spine
|
||||
Standard_EXPORT void SetForceApproxC1 (const Standard_Boolean ForceApproxC1);
|
||||
|
||||
//! Set an section. The correspondence with the spine, will be automaticaly performed.
|
||||
//! Set an section. The correspondence with the spine, will be automatically performed.
|
||||
Standard_EXPORT void Add (const TopoDS_Shape& Profile, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
|
||||
|
||||
//! Set an section. The correspondence with the spine, is given by Location.
|
||||
|
@@ -146,7 +146,7 @@ public:
|
||||
const Standard_Boolean SkipShared = Standard_False,
|
||||
const Standard_Boolean UseTriangulation = Standard_False);
|
||||
|
||||
//! Updates <SProps> with the shape <S>, that contains its pricipal properties.
|
||||
//! Updates <SProps> with the shape <S>, that contains its principal properties.
|
||||
//! The surface properties of all the faces in <S> are computed.
|
||||
//! Adaptive 2D Gauss integration is used.
|
||||
//! Parameter Eps sets maximal relative error of computed mass (area) for each face.
|
||||
@@ -207,7 +207,7 @@ public:
|
||||
const Standard_Boolean SkipShared = Standard_False,
|
||||
const Standard_Boolean UseTriangulation = Standard_False);
|
||||
|
||||
//! Updates <VProps> with the shape <S>, that contains its pricipal properties.
|
||||
//! Updates <VProps> with the shape <S>, that contains its principal properties.
|
||||
//! The volume properties of all the FORWARD and REVERSED faces in <S> are computed.
|
||||
//! If OnlyClosed is True then computed faces must belong to closed Shells.
|
||||
//! Adaptive 2D Gauss integration is used.
|
||||
@@ -225,7 +225,7 @@ public:
|
||||
const Standard_Real Eps, const Standard_Boolean OnlyClosed = Standard_False,
|
||||
const Standard_Boolean SkipShared = Standard_False);
|
||||
|
||||
//! Updates <VProps> with the shape <S>, that contains its pricipal properties.
|
||||
//! Updates <VProps> with the shape <S>, that contains its principal properties.
|
||||
//! The volume properties of all the FORWARD and REVERSED faces in <S> are computed.
|
||||
//! If OnlyClosed is True then computed faces must belong to closed Shells.
|
||||
//! Adaptive 2D Gauss integration is used.
|
||||
|
@@ -225,7 +225,7 @@ void BRepGProp_Face::Normal (const Standard_Real U,
|
||||
|
||||
// APO 17.04.2002 (OCC104)
|
||||
// This is functions that calculate coeff. to optimize "integration order".
|
||||
//They had been produced experementally for some hard example.
|
||||
// They had been produced experimentally for some hard example.
|
||||
static Standard_Real AS = -0.15, AL = -0.50, B = 1.0, C = 0.75, D = 0.25;
|
||||
static inline Standard_Real SCoeff(const Standard_Real Eps){
|
||||
return Eps < 0.1? AS*(B+Log10(Eps)) + C: C;
|
||||
|
@@ -58,7 +58,7 @@ public:
|
||||
//! surfaces.
|
||||
//! Non-adaptive 2D Gauss integration with predefined numbers of Gauss points
|
||||
//! is used. Numbers of points depend on types of surfaces and curves.
|
||||
//! Errror of the computation is not calculated.
|
||||
//! Error of the computation is not calculated.
|
||||
Standard_EXPORT BRepGProp_Vinert(const BRepGProp_Face& S, const gp_Pnt& VLocation);
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
//! surfaces.
|
||||
//! Non-adaptive 2D Gauss integration with predefined numbers of Gauss points
|
||||
//! is used. Numbers of points depend on types of surfaces and curves.
|
||||
//! Errror of the computation is not calculated.
|
||||
//! Error of the computation is not calculated.
|
||||
Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& VLocation);
|
||||
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -64,6 +64,7 @@
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <IntRes2d_IntersectionPoint.hxx>
|
||||
#include <IntRes2d_IntersectionSegment.hxx>
|
||||
#include <IntTools_Tools.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TColGeom2d_SequenceOfCurve.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
@@ -278,6 +279,14 @@ static void Store(const TopoDS_Edge& theEdge,
|
||||
Handle(BRepAlgo_AsDes) theAsDes2d,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
|
||||
{
|
||||
// Update vertices
|
||||
TopTools_ListIteratorOfListOfShape aIt(theLV);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex(aIt.Value());
|
||||
BRep_Builder().UpdateVertex(aV, theTol);
|
||||
}
|
||||
|
||||
// Get vertices already added to the edge and check the distances to the new ones
|
||||
const TopTools_ListOfShape& aLVEx = theAsDes2d->Descendant(theEdge);
|
||||
if (!IsToUpdate && aLVEx.IsEmpty()) {
|
||||
if (theLV.Extent()) theAsDes2d->Add(theEdge, theLV);
|
||||
@@ -285,21 +294,23 @@ static void Store(const TopoDS_Edge& theEdge,
|
||||
}
|
||||
//
|
||||
GeomAPI_ProjectPointOnCurve aProjPC;
|
||||
Standard_Real aTolE = 0.0;
|
||||
if (IsToUpdate) {
|
||||
Standard_Real aT1, aT2;
|
||||
const Handle(Geom_Curve)& aC = BRep_Tool::Curve(theEdge, aT1, aT2);
|
||||
aProjPC.Init(aC, aT1, aT2);
|
||||
aTolE = BRep_Tool::Tolerance(theEdge);
|
||||
}
|
||||
//
|
||||
TopTools_MapOfShape aMV;
|
||||
TopTools_ListIteratorOfListOfShape aIt(theLV);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
for (aIt.Init(theLV); aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex(aIt.Value());
|
||||
if (!aMV.Add(aV)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const gp_Pnt& aP = BRep_Tool::Pnt(aV);
|
||||
const Standard_Real aTol = BRep_Tool::Tolerance(aV);
|
||||
//
|
||||
TopTools_ListOfShape aLVC;
|
||||
TopTools_ListIteratorOfListOfShape aItEx(aLVEx);
|
||||
@@ -309,7 +320,8 @@ static void Store(const TopoDS_Edge& theEdge,
|
||||
break;
|
||||
}
|
||||
const gp_Pnt& aPEx = BRep_Tool::Pnt(aVEx);
|
||||
if (aP.IsEqual(aPEx, theTol)) {
|
||||
const Standard_Real aTolVEx = BRep_Tool::Tolerance(aVEx);
|
||||
if (aP.IsEqual(aPEx, aTol + aTolVEx)) {
|
||||
aLVC.Append(aVEx);
|
||||
}
|
||||
}
|
||||
@@ -325,16 +337,13 @@ static void Store(const TopoDS_Edge& theEdge,
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (aProjPC.LowerDistance() > theTol) {
|
||||
if (aProjPC.LowerDistance() > aTol + aTolE) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
Standard_Real aT = aProjPC.LowerDistanceParameter();
|
||||
TopoDS_Shape aLocalShape = aV.Oriented(TopAbs_INTERNAL);
|
||||
BRep_Builder().UpdateVertex(TopoDS::Vertex(aLocalShape), aT, theEdge, theTol);
|
||||
}
|
||||
else {
|
||||
BRep_Builder().UpdateVertex(aV, theTol);
|
||||
BRep_Builder().UpdateVertex(TopoDS::Vertex(aLocalShape), aT, theEdge, aTol);
|
||||
}
|
||||
//
|
||||
if (aLVC.Extent()) {
|
||||
@@ -672,7 +681,7 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
return;
|
||||
|
||||
Standard_Real f[3],l[3];
|
||||
Standard_Real TolDub = 1.e-7;
|
||||
Standard_Real TolDub = 1.e-7, TolLL = 0.0;
|
||||
Standard_Integer i;
|
||||
|
||||
//BRep_Tool::Range(E1, f[1], l[1]);
|
||||
@@ -689,9 +698,6 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
BRepLib::BuildCurve3d(E1);
|
||||
BRepLib::BuildCurve3d(E2);
|
||||
|
||||
Standard_Real TolSum = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2);
|
||||
TolSum = Max( TolSum, 1.e-5 );
|
||||
|
||||
TColgp_SequenceOfPnt ResPoints;
|
||||
TColStd_SequenceOfReal ResParamsOnE1, ResParamsOnE2;
|
||||
gp_Pnt DegPoint;
|
||||
@@ -721,11 +727,19 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
(GAC2.GetType() == GeomAbs_Line))
|
||||
{
|
||||
// Just quickly check if lines coincide
|
||||
if (GAC1.Line().Direction().IsParallel (GAC2.Line().Direction(), 1.e-8))
|
||||
Standard_Real anAngle = Abs(GAC1.Line().Direction().Angle(GAC2.Line().Direction()));
|
||||
if (anAngle <= 1.e-8 || M_PI - anAngle <= 1.e-8)
|
||||
{
|
||||
theCoincide = Standard_True;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Take into account the intersection range of line-line intersection
|
||||
// (the smaller angle between curves, the bigger range)
|
||||
TolLL = IntTools_Tools::ComputeIntRange(TolDub, TolDub, anAngle);
|
||||
TolLL = Min (TolLL, 1.e-5);
|
||||
}
|
||||
}
|
||||
|
||||
Geom2dInt_GInter Inter2d( GAC1, GAC2, TolDub, TolDub );
|
||||
@@ -943,10 +957,12 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
else
|
||||
theImageVV.Bind (theVref.Oriented(TopAbs_FORWARD), aNewVertex);
|
||||
}
|
||||
|
||||
|
||||
////-----------------------------------------------------
|
||||
Standard_Real TolStore = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2);
|
||||
TolStore = Max (TolStore, Tol);
|
||||
// Compare to Line-Line tolerance
|
||||
TolStore = Max (TolStore, TolLL);
|
||||
Store (E1,E2,LV1,LV2,TolStore,AsDes, aDMVV);
|
||||
}
|
||||
}
|
||||
|
@@ -4302,6 +4302,7 @@ Standard_Boolean BuildShellsCompleteInter(const TopTools_ListOfShape& theLF,
|
||||
// we need to intersect the faces to process the tangential faces
|
||||
aMV1.SetIntersect(Standard_True);
|
||||
aMV1.SetAvoidInternalShapes(Standard_True);
|
||||
aMV1.SetNonDestructive(Standard_False);
|
||||
aMV1.Perform();
|
||||
//
|
||||
Standard_Boolean bDone = ! aMV1.HasErrors();
|
||||
@@ -4382,6 +4383,7 @@ Standard_Boolean BuildShellsCompleteInter(const TopTools_ListOfShape& theLF,
|
||||
// no need to intersect this time
|
||||
aMV2.SetIntersect(Standard_False);
|
||||
aMV2.SetAvoidInternalShapes(Standard_True);
|
||||
aMV2.SetNonDestructive(Standard_False);
|
||||
aMV2.Perform();
|
||||
bDone = ! aMV2.HasErrors();
|
||||
if (!bDone) {
|
||||
@@ -4433,6 +4435,7 @@ Standard_Boolean BuildShellsCompleteInter(const TopTools_ListOfShape& theLF,
|
||||
aMV3.SetArguments(aLF);
|
||||
aMV3.SetIntersect(Standard_False);
|
||||
aMV3.SetAvoidInternalShapes(Standard_True);
|
||||
aMV3.SetNonDestructive(Standard_False);
|
||||
aMV3.Perform();
|
||||
bDone = ! aMV3.HasErrors();
|
||||
if (!bDone) {
|
||||
|
@@ -46,7 +46,6 @@
|
||||
|
||||
#include <BOPDS_DS.hxx>
|
||||
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_Builder.hxx>
|
||||
#include <BOPAlgo_Section.hxx>
|
||||
#include <BOPAlgo_MakerVolume.hxx>
|
||||
@@ -1304,6 +1303,7 @@ void IntersectTrimmedEdges(const TopTools_ListOfShape& theLF,
|
||||
// perform intersection of the edges
|
||||
BOPAlgo_Builder aGFE;
|
||||
aGFE.SetArguments(aLS);
|
||||
aGFE.SetNonDestructive(Standard_False);
|
||||
aGFE.Perform();
|
||||
if (aGFE.HasErrors()) {
|
||||
return;
|
||||
@@ -1496,9 +1496,9 @@ void BuildSplitsOfTrimmedFace(const TopoDS_Face& theFace,
|
||||
TopTools_ListOfShape& theLFImages)
|
||||
{
|
||||
BOPAlgo_Builder aGF;
|
||||
//
|
||||
aGF.AddArgument(theFace);
|
||||
aGF.AddArgument(theEdges);
|
||||
aGF.SetNonDestructive(Standard_False);
|
||||
aGF.Perform();
|
||||
if (aGF.HasErrors()) {
|
||||
return;
|
||||
@@ -3502,6 +3502,7 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
|
||||
BOPAlgo_MakerVolume aMV;
|
||||
aMV.SetArguments(aLS);
|
||||
aMV.SetIntersect(Standard_True);
|
||||
aMV.SetNonDestructive(Standard_False);
|
||||
aMV.Perform();
|
||||
if (aMV.HasErrors())
|
||||
return;
|
||||
@@ -5882,6 +5883,7 @@ void IntersectAndTrimEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theF
|
||||
// Intersect Edges
|
||||
BOPAlgo_Builder aGF;
|
||||
aGF.SetArguments(aLArgs);
|
||||
aGF.SetNonDestructive(Standard_False);
|
||||
aGF.Perform();
|
||||
if (aGF.HasErrors()) {
|
||||
return;
|
||||
@@ -5950,6 +5952,7 @@ void IntersectAndTrimEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theF
|
||||
BOPAlgo_Builder aGFCE;
|
||||
aGFCE.SetArguments(aLCE);
|
||||
aGFCE.AddArgument(aCEIm);
|
||||
aGFCE.SetNonDestructive(Standard_False);
|
||||
aGFCE.Perform();
|
||||
//
|
||||
if (aGFCE.HasErrors()) {
|
||||
@@ -6398,6 +6401,7 @@ void UpdateValidEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theFImage
|
||||
BOPAlgo_Builder aGF;
|
||||
aGF.AddArgument(aBounds);
|
||||
aGF.AddArgument(aSplits);
|
||||
aGF.SetNonDestructive(Standard_False);
|
||||
aGF.Perform();
|
||||
//
|
||||
// update splits
|
||||
@@ -6545,6 +6549,7 @@ void TrimNewIntersectionEdges(const TopTools_ListOfShape& theLE,
|
||||
aMV.Add(aV1);
|
||||
aMV.Add(aV2);
|
||||
//
|
||||
aGFE.SetNonDestructive(Standard_False);
|
||||
aGFE.Perform();
|
||||
if (!aGFE.HasErrors()) {
|
||||
// get images of bounding vertices to remove splits containing them
|
||||
@@ -6634,6 +6639,7 @@ void IntersectEdges(const TopTools_ListOfShape& theLA,
|
||||
{
|
||||
BOPAlgo_Builder aGFA;
|
||||
aGFA.SetArguments(theLA);
|
||||
aGFA.SetNonDestructive(Standard_False);
|
||||
aGFA.Perform();
|
||||
if (aGFA.HasErrors()) {
|
||||
// just copy input to the result
|
||||
@@ -6874,6 +6880,7 @@ void GetInvalidEdgesByBounds(const TopoDS_Shape& theSplits,
|
||||
BOPAlgo_Section aSec;
|
||||
aSec.AddArgument(theSplits);
|
||||
aSec.AddArgument(theBounds);
|
||||
aSec.SetNonDestructive(Standard_False);
|
||||
//
|
||||
aSec.Perform();
|
||||
//
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -412,7 +412,7 @@ Standard_Boolean BRepTools_Modifier::Rebuild
|
||||
{
|
||||
// rem dub 16/09/97 : Make constant topology or not make at all.
|
||||
// Do not make if CopySurface = 1
|
||||
// Atention, TRUE sewing edges (ReallyClosed)
|
||||
// Attention, TRUE sewing edges (ReallyClosed)
|
||||
// stay even if CopySurface is true.
|
||||
|
||||
// check that edge contains two pcurves on this surface:
|
||||
|
@@ -112,17 +112,16 @@ public:
|
||||
|
||||
//! Applies the substitutions requests to a shape.
|
||||
//!
|
||||
//! <until> gives the level of type until which requests are taken
|
||||
//! into account. For subshapes of the type <until> no rebuild
|
||||
//! and futher exploring are done.
|
||||
//! theUntil gives the level of type until which requests are taken into account.
|
||||
//! For subshapes of the type <until> no rebuild and further exploring are done.
|
||||
//!
|
||||
//! NOTE: each subshape can be replaced by shape of the same type
|
||||
//! or by shape containing only shapes of that type (for
|
||||
//! example, TopoDS_Edge can be replaced by TopoDS_Edge,
|
||||
//! or by shape containing only shapes of that type
|
||||
//! (for example, TopoDS_Edge can be replaced by TopoDS_Edge,
|
||||
//! TopoDS_Wire or TopoDS_Compound containing TopoDS_Edges).
|
||||
//! If incompatible shape type is encountered, it is ignored
|
||||
//! and flag FAIL1 is set in Status.
|
||||
Standard_EXPORT virtual TopoDS_Shape Apply (const TopoDS_Shape& shape, const TopAbs_ShapeEnum until = TopAbs_SHAPE);
|
||||
//! If incompatible shape type is encountered, it is ignored and flag FAIL1 is set in Status.
|
||||
Standard_EXPORT virtual TopoDS_Shape Apply (const TopoDS_Shape& theShape,
|
||||
const TopAbs_ShapeEnum theUntil = TopAbs_SHAPE);
|
||||
|
||||
//! Returns (modifiable) the flag which defines whether Location of shape take into account
|
||||
//! during replacing shapes.
|
||||
|
@@ -125,9 +125,9 @@ void BRepTools_Substitution::Build(const TopoDS_Shape& S)
|
||||
if (!HasSubShape) {
|
||||
if (NewS.ShapeType() == TopAbs_WIRE || NewS.ShapeType() == TopAbs_SHELL ||
|
||||
NewS.ShapeType() == TopAbs_SOLID || NewS.ShapeType() == TopAbs_COMPOUND)
|
||||
//----------------------------------------------------------------
|
||||
// Wire,Solid,Shell,Compound mut have subshape else they disapear
|
||||
//---------------------------------------------------------------
|
||||
//-----------------------------------------------------------------
|
||||
// Wire,Solid,Shell,Compound must have subshape else they disappear
|
||||
//-----------------------------------------------------------------
|
||||
NewS.Nullify();
|
||||
}
|
||||
}
|
||||
|
@@ -524,64 +524,67 @@ public:
|
||||
Standard_EXPORT static void IncreaseDegree (const Standard_Integer NewDegree, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
|
||||
|
||||
//! Increase the degree of a bspline (or bezier) curve
|
||||
//! of dimension <Dimension> form <Degree> to
|
||||
//! <NewDegree>.
|
||||
//! of dimension theDimension form theDegree to theNewDegree.
|
||||
//!
|
||||
//! The number of poles in the new curve is :
|
||||
//! The number of poles in the new curve is:
|
||||
//! @code
|
||||
//! Poles.Length() + (NewDegree - Degree) * Number of spans
|
||||
//! @endcode
|
||||
//! Where the number of spans is:
|
||||
//! @code
|
||||
//! LastUKnotIndex(Mults) - FirstUKnotIndex(Mults) + 1
|
||||
//! @endcode
|
||||
//! for a non-periodic curve, and
|
||||
//! @code
|
||||
//! Knots.Length() - 1
|
||||
//! @endcode
|
||||
//! for a periodic curve.
|
||||
//!
|
||||
//! Poles.Length() + (NewDegree - Degree) * Number of spans
|
||||
//! The multiplicities of all knots are increased by the degree elevation.
|
||||
//!
|
||||
//! Where the number of spans is :
|
||||
//!
|
||||
//! LastUKnotIndex(Mults) - FirstUKnotIndex(Mults) + 1
|
||||
//!
|
||||
//! for a non-periodic curve
|
||||
//!
|
||||
//! And Knots.Length() - 1 for a periodic curve.
|
||||
//!
|
||||
//! The multiplicities of all knots are increased by
|
||||
//! the degree elevation.
|
||||
//!
|
||||
//! The new knots are usually the same knots with the
|
||||
//! exception of a non-periodic curve with the first
|
||||
//! The new knots are usually the same knots with the
|
||||
//! exception of a non-periodic curve with the first
|
||||
//! and last multiplicity not equal to Degree+1 where
|
||||
//! knots are removed form the start and the bottom
|
||||
//! untils the sum of the multiplicities is equal to
|
||||
//! NewDegree+1 at the knots corresponding to the
|
||||
//! knots are removed form the start and the bottom
|
||||
//! until the sum of the multiplicities is equal to
|
||||
//! NewDegree+1 at the knots corresponding to the
|
||||
//! first and last parameters of the curve.
|
||||
//!
|
||||
//! Example : Suppose a curve of degree 3 starting
|
||||
//! with following knots and multiplicities :
|
||||
//! Example: Suppose a curve of degree 3 starting
|
||||
//! with following knots and multiplicities:
|
||||
//! @code
|
||||
//! knot : 0. 1. 2.
|
||||
//! mult : 1 2 1
|
||||
//! @endcode
|
||||
//!
|
||||
//! knot : 0. 1. 2.
|
||||
//! mult : 1 2 1
|
||||
//! The FirstUKnot is 2.0 because the sum of multiplicities is
|
||||
//! @code
|
||||
//! Degree+1 : 1 + 2 + 1 = 4 = 3 + 1
|
||||
//! @endcode
|
||||
//! i.e. the first parameter of the curve is 2.0 and
|
||||
//! will still be 2.0 after degree elevation.
|
||||
//! Let raise this curve to degree 4.
|
||||
//! The multiplicities are increased by 2.
|
||||
//!
|
||||
//! The FirstUKnot is 2. because the sum of
|
||||
//! multiplicities is Degree+1 : 1 + 2 + 1 = 4 = 3 + 1
|
||||
//! They become 2 3 2.
|
||||
//! But we need a sum of multiplicities of 5 at knot 2.
|
||||
//! So the first knot is removed and the new knots are:
|
||||
//! @code
|
||||
//! knot : 1. 2.
|
||||
//! mult : 3 2
|
||||
//! @endcode
|
||||
//! The multipicity of the first knot may also be reduced if the sum is still to big.
|
||||
//!
|
||||
//! i.e. the first parameter of the curve is 2. and
|
||||
//! will still be 2. after degree elevation. Let
|
||||
//! raises this curve to degree 4. The multiplicities
|
||||
//! are increased by 2.
|
||||
//! In the most common situations (periodic curve or curve with first
|
||||
//! and last multiplicities equals to Degree+1) the knots are knot changes.
|
||||
//!
|
||||
//! They become 2 3 2. But we need a sum of
|
||||
//! multiplicities of 5 at knot 2. So the first knot
|
||||
//! is removed and the new knots are :
|
||||
//!
|
||||
//! knot : 1. 2.
|
||||
//! mult : 3 2
|
||||
//!
|
||||
//! The multipicity of the first knot may also be
|
||||
//! reduced if the sum is still to big.
|
||||
//!
|
||||
//! In the most common situations (periodic curve or
|
||||
//! curve with first and last multiplicities equals to
|
||||
//! Degree+1) the knots are knot changes.
|
||||
//!
|
||||
//! The method IncreaseDegreeCountKnots can be used to
|
||||
//! compute the new number of knots.
|
||||
Standard_EXPORT static void IncreaseDegree (const Standard_Integer NewDegree, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
|
||||
|
||||
//! The method IncreaseDegreeCountKnots can be used to compute the new number of knots.
|
||||
Standard_EXPORT static void IncreaseDegree (const Standard_Integer theNewDegree,
|
||||
const TColgp_Array1OfPnt2d& thePoles,
|
||||
const TColStd_Array1OfReal* theWeights,
|
||||
TColgp_Array1OfPnt2d& theNewPoles,
|
||||
TColStd_Array1OfReal* theNewWeights);
|
||||
|
||||
//! Set in <NbKnots> and <NbPolesToAdd> the number of Knots and
|
||||
//! Poles of the NotPeriodic Curve identical at the
|
||||
//! periodic curve with a degree <Degree> , a
|
||||
|
@@ -31,11 +31,11 @@ class gp_Vec2d;
|
||||
class Geom2d_Point;
|
||||
|
||||
|
||||
//! Bisec provides the bisecting line between two elements
|
||||
//! This line is trimed by a point <P> and it's contained in the domain
|
||||
//! Bisec provides the bisecting line between two elements
|
||||
//! This line is trimmed by a point <P> and it's contained in the domain
|
||||
//! defined by the two vectors <V1>, <V2> and <Sense>.
|
||||
//!
|
||||
//! Definition of the domain:
|
||||
//! Definition of the domain:
|
||||
//! if <Sense> is true the bisecting line is contained in the sector
|
||||
//! defined by <-V1> and <-V2> in the sense indirect.
|
||||
//! if <Sense> is false the bisecting line is contained in the sector
|
||||
@@ -47,7 +47,7 @@ class Geom2d_Point;
|
||||
//! corresponding to one of hyperbola's axes.
|
||||
//! if the bisector is a parabola on the focal length is smaller than
|
||||
//! <Tolerance>, the bisector is replaced by a semi_line corresponding
|
||||
//! to the axe of symetrie of the parabola.
|
||||
//! to the axe of symmetry of the parabola.
|
||||
//! if the bisector is an ellipse and the minor radius is smaller than
|
||||
//! <Tolerance>, the bisector is replaced by a segment corresponding
|
||||
//! to the great axe of the ellipse.
|
||||
|
@@ -49,7 +49,7 @@ static Standard_Integer nbint = 0;
|
||||
|
||||
//===================================================================================
|
||||
// function :
|
||||
// putpose :
|
||||
// purpose :
|
||||
//===================================================================================
|
||||
Bisector_Inter::Bisector_Inter()
|
||||
{
|
||||
@@ -57,7 +57,7 @@ Bisector_Inter::Bisector_Inter()
|
||||
|
||||
//===================================================================================
|
||||
// function :
|
||||
// putpose :
|
||||
// purpose :
|
||||
//===================================================================================
|
||||
Bisector_Inter::Bisector_Inter(const Bisector_Bisec& C1,
|
||||
const IntRes2d_Domain& D1,
|
||||
@@ -72,7 +72,7 @@ Bisector_Inter::Bisector_Inter(const Bisector_Bisec& C1,
|
||||
|
||||
//===================================================================================
|
||||
// function : ConstructSegment
|
||||
// putpose :
|
||||
// purpose :
|
||||
//===================================================================================
|
||||
static Handle(Geom2d_Line) ConstructSegment(const gp_Pnt2d& PMin,
|
||||
const gp_Pnt2d& PMax,
|
||||
@@ -88,7 +88,7 @@ static Handle(Geom2d_Line) ConstructSegment(const gp_Pnt2d& PMin,
|
||||
|
||||
//===================================================================================
|
||||
// function : Perform
|
||||
// putpose :
|
||||
// purpose :
|
||||
//===================================================================================
|
||||
void Bisector_Inter::Perform(const Bisector_Bisec& C1,
|
||||
const IntRes2d_Domain& D1,
|
||||
@@ -208,7 +208,7 @@ void Bisector_Inter::Perform(const Bisector_Bisec& C1,
|
||||
|
||||
//===================================================================================
|
||||
// function : SinglePerform
|
||||
// putpose :
|
||||
// purpose :
|
||||
//===================================================================================
|
||||
void Bisector_Inter::SinglePerform(const Handle(Geom2d_Curve)& CBis1,
|
||||
const IntRes2d_Domain& D1,
|
||||
@@ -308,7 +308,7 @@ void Bisector_Inter::SinglePerform(const Handle(Geom2d_Curve)& CBis1,
|
||||
|
||||
//===================================================================================
|
||||
// function : NeighbourPerform
|
||||
// putpose : Find the intersection of 2 neighbor bissectrices curve/curve
|
||||
// purpose : Find the intersection of 2 neighbor bissectrices curve/curve
|
||||
// (ie Bis1 separates A and B and Bis2 separates B and C).
|
||||
// Bis1 is parameterized by B and Bis2 by C.
|
||||
//
|
||||
@@ -371,7 +371,7 @@ void Bisector_Inter::NeighbourPerform(const Handle(Bisector_BisecCC)& Bis1,
|
||||
|
||||
//=====================================================================================
|
||||
// function : TestBound
|
||||
// putpose : Test if the extremities of Bis2 are on the segment cooresponding to Bis1.
|
||||
// purpose : Test if the extremities of Bis2 are on the segment corresponding to Bis1.
|
||||
//=====================================================================================
|
||||
void Bisector_Inter::TestBound (const Handle(Geom2d_Line)& Bis1,
|
||||
const IntRes2d_Domain& D1,
|
||||
|
@@ -137,7 +137,7 @@ public:
|
||||
PCDM_ReaderStatus GetRetrieveStatus() const { return myRetrievableStatus; }
|
||||
|
||||
//! Reads aDoc from standard SEEKABLE stream theIStream,
|
||||
//! the stream should support SEEK fuctionality
|
||||
//! the stream should support SEEK functionality
|
||||
Standard_EXPORT Handle(CDM_Document) Read
|
||||
(Standard_IStream& theIStream,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
|
@@ -776,7 +776,7 @@ Standard_Boolean ChFi3d_Builder::StoreData(Handle(ChFiDS_SurfData)& Data,
|
||||
|
||||
if(!ChFi3d_CheckSameParameter(checkcurve,PCurveOnFace,S1,tolC1,tolcheck)){
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout<<"aaproximate tolerance under-valued : "<<tolC1<<" for "<<tolcheck<<std::endl;
|
||||
std::cout<<"approximate tolerance under-valued : "<<tolC1<<" for "<<tolcheck<<std::endl;
|
||||
#endif
|
||||
tolC1 = tolcheck;
|
||||
}
|
||||
|
@@ -1,5 +1,41 @@
|
||||
project(DRAWEXE)
|
||||
|
||||
unset (CUSTOM_EXTERNLIB)
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
# link specific list of plugins explicitly
|
||||
FILE_TO_LIST ("src/${PROJECT_NAME}/EXTERNLIB_STATIC" CUSTOM_EXTERNLIB)
|
||||
if (USE_OPENGL)
|
||||
list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGles)
|
||||
list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGlesTest)
|
||||
list (REMOVE_ITEM CUSTOM_EXTERNLIB CSF_OpenGlesLibs)
|
||||
elseif(USE_GLES2)
|
||||
list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGl)
|
||||
list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGlTest)
|
||||
list (REMOVE_ITEM CUSTOM_EXTERNLIB CSF_OpenGlLibs)
|
||||
else()
|
||||
list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGles)
|
||||
list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGlesTest)
|
||||
list (REMOVE_ITEM CUSTOM_EXTERNLIB CSF_OpenGlesLibs)
|
||||
list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGl)
|
||||
list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGlTest)
|
||||
list (REMOVE_ITEM CUSTOM_EXTERNLIB CSF_OpenGlLibs)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (EXECUTABLE_PROJECT ON)
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
unset (EXECUTABLE_PROJECT)
|
||||
unset (CUSTOM_EXTERNLIB)
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM=1")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s MAX_WEBGL_VERSION=2")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --bind")
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s MODULARIZE=1")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXPORT_NAME='createDRAWEXE'")
|
||||
|
||||
install(FILES ${PROJECT_NAME}.html DESTINATION "${INSTALL_DIR_BIN}/${OCCT_INSTALL_BIN_LETTER}")
|
||||
install(FILES ../DrawResources/lamp.ico DESTINATION "${INSTALL_DIR_BIN}/${OCCT_INSTALL_BIN_LETTER}")
|
||||
endif()
|
||||
|
@@ -16,6 +16,20 @@
|
||||
#include <Draw.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_PrinterSystemLog.hxx>
|
||||
|
||||
#ifdef OCCT_NO_PLUGINS
|
||||
#include <BOPTest.hxx>
|
||||
#include <DPrsStd.hxx>
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_GLES2)
|
||||
#include <OpenGlTest.hxx>
|
||||
#endif
|
||||
#include <TObjDRAW.hxx>
|
||||
#include <ViewerTest.hxx>
|
||||
#include <XSDRAWSTLVRML.hxx>
|
||||
#include <XDEDRAW.hxx>
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
//function : Draw_InitAppli
|
||||
@@ -24,9 +38,29 @@
|
||||
|
||||
void Draw_InitAppli (Draw_Interpretor& di)
|
||||
{
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
// open JavaScript console within the Browser to see this output
|
||||
Handle(Message_PrinterSystemLog) aJSConsolePrinter = new Message_PrinterSystemLog ("DRAWEXE");
|
||||
Message::DefaultMessenger()->AddPrinter (aJSConsolePrinter);
|
||||
#endif
|
||||
|
||||
Draw::Commands (di);
|
||||
DBRep::BasicCommands (di);
|
||||
DrawTrSurf::BasicCommands (di);
|
||||
|
||||
#ifdef OCCT_NO_PLUGINS
|
||||
// load a couple of plugins
|
||||
BOPTest::Factory (di);
|
||||
DPrsStd::Factory (di);
|
||||
XSDRAWSTLVRML::Factory (di);
|
||||
XDEDRAW::Factory (di);
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_GLES2)
|
||||
ViewerTest::Factory (di);
|
||||
OpenGlTest::Factory (di);
|
||||
#endif
|
||||
//TObjDRAW::Factory (di);
|
||||
//QADraw::Factory (di);
|
||||
#endif
|
||||
}
|
||||
|
||||
#include <Draw_Main.hxx>
|
||||
|
68
src/DRAWEXE/DRAWEXE.html
Normal file
68
src/DRAWEXE/DRAWEXE.html
Normal file
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang=en-us>
|
||||
<head>
|
||||
<meta charset=utf-8><meta content="text/html; charset=utf-8" http-equiv=Content-Type>
|
||||
<link rel="shortcut icon" href="lamp.ico" type="image/x-icon" />
|
||||
<title>OCCT Draw Harness</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2>OCCT Draw Harness</h2>
|
||||
<div>
|
||||
<canvas id=occViewerCanvas oncontextmenu=event.preventDefault() tabindex=-1 style="border:0 none;background-color:#000" width="409" height="409"></canvas>
|
||||
</div>
|
||||
<h4>Output (open JavaScript console):</h4>
|
||||
<p id="output"></p>
|
||||
<script type="text/javascript" src="DRAWEXE.js" charset="utf-8"></script>
|
||||
<script>
|
||||
//! Check browser support.
|
||||
function isWasmSupported()
|
||||
{
|
||||
try {
|
||||
if (typeof WebAssembly === "object"
|
||||
&& typeof WebAssembly.instantiate === "function") {
|
||||
const aDummyModule = new WebAssembly.Module (Uint8Array.of (0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
|
||||
if (aDummyModule instanceof WebAssembly.Module)
|
||||
{
|
||||
return new WebAssembly.Instance(aDummyModule) instanceof WebAssembly.Instance;
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
if (!isWasmSupported())
|
||||
{
|
||||
var anElement = document.getElementById('output');
|
||||
anElement.innerHTML += "Browser is too old - WebAssembly support is missing!<br>Please check updates or install a modern browser.<br>";
|
||||
}
|
||||
|
||||
var DRAWEXE =
|
||||
{
|
||||
print: (function() {
|
||||
var anElement = document.getElementById('output');
|
||||
//return function(theText) { anElement.innerHTML += theText + "<br>"; };
|
||||
return function(theText) { console.warn(theText); };
|
||||
})(),
|
||||
printErr: function(theText) {
|
||||
//var anElement = document.getElementById('output');
|
||||
//anElement.innerHTML += theText + "<br>";
|
||||
console.warn(theText);
|
||||
},
|
||||
canvas: (function() {
|
||||
var aCanvas = document.getElementById('occViewerCanvas');
|
||||
return aCanvas;
|
||||
})(),
|
||||
|
||||
onRuntimeInitialized: function() {
|
||||
//
|
||||
}
|
||||
};
|
||||
|
||||
const DRAWEXEInitialized = createDRAWEXE(DRAWEXE);
|
||||
DRAWEXEInitialized.then(function(Module) {
|
||||
//DRAWEXE.eval("dversion");
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
75
src/DRAWEXE/EXTERNLIB_STATIC
Normal file
75
src/DRAWEXE/EXTERNLIB_STATIC
Normal file
@@ -0,0 +1,75 @@
|
||||
TKTopTest
|
||||
TKDCAF
|
||||
TKXSDRAW
|
||||
TKXDEDRAW
|
||||
TKOpenGlTest
|
||||
TKOpenGlesTest
|
||||
TKViewerTest
|
||||
TKDraw
|
||||
TKMeshVS
|
||||
TKXDESTEP
|
||||
TKSTEP
|
||||
TKSTEPAttr
|
||||
TKSTEP209
|
||||
TKSTEPBase
|
||||
TKXDEIGES
|
||||
TKIGES
|
||||
TKXSBase
|
||||
TKVRML
|
||||
TKSTL
|
||||
TKRWMesh
|
||||
TKBinXCAF
|
||||
TKXmlXCAF
|
||||
TKBin
|
||||
TKXml
|
||||
TKXmlL
|
||||
TKBinL
|
||||
TKOpenGl
|
||||
TKOpenGles
|
||||
TKXCAF
|
||||
TKVCAF
|
||||
TKStd
|
||||
TKCAF
|
||||
TKV3d
|
||||
TKHLR
|
||||
TKMesh
|
||||
TKService
|
||||
TKOffset
|
||||
TKFillet
|
||||
TKFeat
|
||||
TKBool
|
||||
TKBO
|
||||
TKShHealing
|
||||
TKPrim
|
||||
TKTopAlgo
|
||||
TKGeomAlgo
|
||||
TKBRep
|
||||
TKGeomBase
|
||||
TKG3d
|
||||
TKG2d
|
||||
TKMath
|
||||
TKStdL
|
||||
TKLCAF
|
||||
TKCDF
|
||||
TKernel
|
||||
CSF_TclLibs
|
||||
CSF_OpenVR
|
||||
CSF_OpenGlLibs
|
||||
CSF_OpenGlesLibs
|
||||
CSF_FFmpeg
|
||||
CSF_FreeImagePlus
|
||||
CSF_FREETYPE
|
||||
CSF_user32
|
||||
CSF_advapi32
|
||||
CSF_XwLibs
|
||||
CSF_dpsLibs
|
||||
CSF_XmuLibs
|
||||
CSF_fontconfig
|
||||
CSF_objc
|
||||
CSF_Appkit
|
||||
CSF_IOKit
|
||||
CSF_winmm
|
||||
CSF_ThreadLibs
|
||||
CSF_wsock32
|
||||
CSF_psapi
|
||||
CSF_androidlog
|
@@ -348,6 +348,11 @@ static Standard_Integer dversion(Draw_Interpretor& di, Standard_Integer, const c
|
||||
#else
|
||||
di << "Tk disabled\n";
|
||||
#endif
|
||||
#ifdef HAVE_XLIB
|
||||
di << "Xlib enabled (HAVE_XLIB)\n";
|
||||
#elif !defined(_WIN32)
|
||||
di << "Xlib disabled\n";
|
||||
#endif
|
||||
#ifdef HAVE_TBB
|
||||
di << "TBB enabled (HAVE_TBB)\n";
|
||||
#else
|
||||
@@ -447,6 +452,12 @@ static Standard_Integer dversion(Draw_Interpretor& di, Standard_Integer, const c
|
||||
#else
|
||||
di << "Architecture: ARM 32-bit\n";
|
||||
#endif
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
#if defined(__LP64__)
|
||||
di << "Architecture: WASM 64-bit\n";
|
||||
#else
|
||||
di << "Architecture: WASM 32-bit\n";
|
||||
#endif
|
||||
#else
|
||||
di << "Architecture: unrecognized\n";
|
||||
#endif
|
||||
@@ -470,6 +481,8 @@ static Standard_Integer dversion(Draw_Interpretor& di, Standard_Integer, const c
|
||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
|
||||
#include <sys/param.h>
|
||||
di << "OS: BSD (BSD = " << BSD << ")\n";
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
di << "OS: WebAssembly (Emscripten SDK " << __EMSCRIPTEN_major__ << "." << __EMSCRIPTEN_minor__ << "." << __EMSCRIPTEN_tiny__ << ")\n";
|
||||
#else
|
||||
di << "OS: unrecognized\n";
|
||||
#endif
|
||||
|
@@ -16,10 +16,13 @@
|
||||
#ifndef _Draw_PluginMacro_HeaderFile
|
||||
#define _Draw_PluginMacro_HeaderFile
|
||||
|
||||
#ifdef OCCT_NO_PLUGINS
|
||||
#define DPLUGIN(name)
|
||||
#else
|
||||
#define DPLUGIN(name) \
|
||||
extern "C" {Standard_EXPORT void PLUGINFACTORY(Draw_Interpretor&);} \
|
||||
void PLUGINFACTORY(Draw_Interpretor& theDI) { \
|
||||
name::Factory(theDI);} \
|
||||
\
|
||||
extern "C" Standard_EXPORT void PLUGINFACTORY(Draw_Interpretor& theDI) { \
|
||||
name::Factory(theDI); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -20,42 +20,17 @@
|
||||
//function : Draw_View
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
Draw_View::Draw_View(Standard_Integer theId,
|
||||
Draw_Viewer* theViewer,
|
||||
Standard_Integer theX,
|
||||
Standard_Integer theY,
|
||||
Standard_Integer theWidth,
|
||||
Standard_Integer theHeight)
|
||||
: Draw_Window("Win", theX, theY, theWidth, theHeight),
|
||||
myId (theId),
|
||||
myViewer (theViewer),
|
||||
myIsPers (Standard_False),
|
||||
myIs2D (Standard_False),
|
||||
myFocalDistance(0.0),
|
||||
myZoom (0.0),
|
||||
myDx (0),
|
||||
myDy (0),
|
||||
myFrameX0 (0),
|
||||
myFrameY0 (0),
|
||||
myFrameX1 (0),
|
||||
myFrameY1 (0)
|
||||
{
|
||||
memset (myType, 0, sizeof (myType));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Draw_View
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
Draw_View::Draw_View(Standard_Integer theId,
|
||||
Draw_Viewer* theViewer,
|
||||
Standard_Integer theX,
|
||||
Standard_Integer theY,
|
||||
Standard_Integer theWidth,
|
||||
Standard_Integer theHeight,
|
||||
HWND theWindow)
|
||||
: Draw_Window("Win", theX, theY, theWidth, theHeight, theWindow),
|
||||
Aspect_Drawable theWindow)
|
||||
: Draw_Window ("Win",
|
||||
NCollection_Vec2<int> (theX, theY),
|
||||
NCollection_Vec2<int> (theWidth, theHeight),
|
||||
0, theWindow),
|
||||
myId (theId),
|
||||
myViewer (theViewer),
|
||||
myIsPers (Standard_False),
|
||||
@@ -72,56 +47,28 @@ Draw_View::Draw_View(Standard_Integer theId,
|
||||
memset (myType, 0, sizeof (myType));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Draw_View
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
Draw_View::Draw_View(Standard_Integer theId,
|
||||
Draw_Viewer* theViewer,
|
||||
Standard_Integer theX,
|
||||
Standard_Integer theY,
|
||||
Standard_Integer theWidth,
|
||||
Standard_Integer theHeight,
|
||||
NSWindow* theWindow)
|
||||
: Draw_Window(theWindow, "Win", theX, theY, theWidth, theHeight),
|
||||
myId (theId),
|
||||
myViewer (theViewer),
|
||||
myIsPers (Standard_False),
|
||||
myIs2D (Standard_False),
|
||||
myFocalDistance(0.0),
|
||||
myZoom (0.0),
|
||||
myDx (0),
|
||||
myDy (0),
|
||||
myFrameX0 (0),
|
||||
myFrameY0 (0),
|
||||
myFrameX1 (0),
|
||||
myFrameY1 (0)
|
||||
//! Find window by it's XID - applicable only to X11.
|
||||
static Aspect_Drawable findWindow (const char* theWindow)
|
||||
{
|
||||
memset (myType, 0, sizeof (myType));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Draw_View
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
#if defined(_WIN32) || defined (__WIN32__) || (defined(__APPLE__) && !defined(MACOSX_USE_GLX))
|
||||
Draw_View::Draw_View(Standard_Integer /*theId*/,
|
||||
Draw_Viewer* /*theViewer*/,
|
||||
const char* /*theTitle*/)
|
||||
: Draw_Window (),
|
||||
myId (-1),
|
||||
myViewer (NULL),
|
||||
Aspect_Drawable aWindow = 0;
|
||||
#ifdef HAVE_XLIB
|
||||
sscanf (theWindow, "%lx", &aWindow);
|
||||
#else
|
||||
(void )theWindow;
|
||||
#endif
|
||||
return aWindow;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Draw_View
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
Draw_View::Draw_View(Standard_Integer theId,
|
||||
Draw_Viewer* theViewer,
|
||||
const char* theTitle)
|
||||
: Draw_Window (theTitle),
|
||||
: Draw_Window (theTitle, NCollection_Vec2<int>(0), NCollection_Vec2<int>(50), 0, findWindow (theTitle)),
|
||||
myId (theId),
|
||||
myViewer (theViewer),
|
||||
#endif
|
||||
myIsPers (Standard_False),
|
||||
myIs2D (Standard_False),
|
||||
myFocalDistance(0.0),
|
||||
|
@@ -24,30 +24,13 @@ class Draw_View : public Draw_Window
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
Draw_View(Standard_Integer theId,
|
||||
Draw_Viewer* theViewer,
|
||||
Standard_Integer theX,
|
||||
Standard_Integer theY,
|
||||
Standard_Integer theWidth,
|
||||
Standard_Integer theHeight);
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
Draw_View(Standard_Integer theId,
|
||||
Draw_Viewer* theViewer,
|
||||
Standard_Integer theX,
|
||||
Standard_Integer theY,
|
||||
Standard_Integer theWidth,
|
||||
Standard_Integer theHeight,
|
||||
HWND theWindow);
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
Draw_View(Standard_Integer theId,
|
||||
Draw_Viewer* theViewer,
|
||||
Standard_Integer theX,
|
||||
Standard_Integer theY,
|
||||
Standard_Integer theWidth,
|
||||
Standard_Integer theHeight,
|
||||
NSWindow* theWindow);
|
||||
#endif
|
||||
Aspect_Drawable theWindow = 0);
|
||||
|
||||
//! Constructor.
|
||||
Draw_View(Standard_Integer theId,
|
||||
@@ -59,85 +42,44 @@ public:
|
||||
|
||||
public: // @name getters and setters
|
||||
|
||||
//! Sets horizontal offset.
|
||||
void SetDx(const Standard_Integer theDx)
|
||||
{
|
||||
myDx = theDx;
|
||||
}
|
||||
|
||||
//! Sets vertical offset.
|
||||
void SetDy(const Standard_Integer theDy)
|
||||
{
|
||||
myDy = theDy;
|
||||
}
|
||||
|
||||
//! Sets parameter of zoom.
|
||||
void SetZoom(const Standard_Real theZoom)
|
||||
{
|
||||
myZoom = theZoom;
|
||||
}
|
||||
|
||||
//! Sets view matrix.
|
||||
void SetMatrix(const gp_Trsf& theMatrix)
|
||||
{
|
||||
myMatrix = theMatrix;
|
||||
}
|
||||
|
||||
//! Sets focal distance.
|
||||
void SetFocalDistance(const Standard_Real theDistance)
|
||||
{
|
||||
myFocalDistance = theDistance;
|
||||
}
|
||||
|
||||
//! Gets horizontal offset.
|
||||
Standard_Integer GetDx() const
|
||||
{
|
||||
return myDx;
|
||||
}
|
||||
Standard_Integer GetDx() const { return myDx; }
|
||||
|
||||
//! Sets horizontal offset.
|
||||
void SetDx (const Standard_Integer theDx) { myDx = theDx; }
|
||||
|
||||
//! Gets vertical offset.
|
||||
Standard_Integer GetDy() const
|
||||
{
|
||||
return myDy;
|
||||
}
|
||||
Standard_Integer GetDy() const { return myDy; }
|
||||
|
||||
//! Sets vertical offset.
|
||||
void SetDy (const Standard_Integer theDy) { myDy = theDy; }
|
||||
|
||||
//! Gets parameter of zoom.
|
||||
Standard_Real GetZoom() const
|
||||
{
|
||||
return myZoom;
|
||||
}
|
||||
Standard_Real GetZoom() const { return myZoom; }
|
||||
|
||||
//! Sets parameter of zoom.
|
||||
void SetZoom (const Standard_Real theZoom) { myZoom = theZoom; }
|
||||
|
||||
//! Gets matrix of view.
|
||||
const gp_Trsf& GetMatrix() const
|
||||
{
|
||||
return myMatrix;
|
||||
}
|
||||
const gp_Trsf& GetMatrix() const { return myMatrix; }
|
||||
|
||||
//! Sets view matrix.
|
||||
void SetMatrix (const gp_Trsf& theMatrix) { myMatrix = theMatrix; }
|
||||
|
||||
//! Gets focal distance.
|
||||
Standard_Real GetFocalDistance() const
|
||||
{
|
||||
return myFocalDistance;
|
||||
}
|
||||
Standard_Real GetFocalDistance() const { return myFocalDistance; }
|
||||
|
||||
public: //! @name public inline methods
|
||||
//! Sets focal distance.
|
||||
void SetFocalDistance (const Standard_Real theDistance) { myFocalDistance = theDistance; }
|
||||
|
||||
//! Returns type of view.
|
||||
const char* Type()
|
||||
{
|
||||
return myType;
|
||||
}
|
||||
const char* Type() { return myType; }
|
||||
|
||||
//! Returns true value if current view in 2D mode.
|
||||
Standard_Boolean Is2D() const
|
||||
{
|
||||
return myIs2D;
|
||||
}
|
||||
Standard_Boolean Is2D() const { return myIs2D; }
|
||||
|
||||
//! Returns true value if current view in perspective mode.
|
||||
Standard_Real IsPerspective() const
|
||||
{
|
||||
return myIsPers;
|
||||
}
|
||||
Standard_Real IsPerspective() const { return myIsPers; }
|
||||
|
||||
public: //! @name view API
|
||||
|
||||
@@ -155,7 +97,7 @@ public: //! @name view API
|
||||
Standard_Integer& theX1,Standard_Integer& theY1);
|
||||
|
||||
//! Perform window exposing.
|
||||
void WExpose();
|
||||
virtual void WExpose() Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -30,7 +30,7 @@ static const Standard_Real DRAWINFINITE = 1e50;
|
||||
Standard_EXPORT Standard_Boolean Draw_Bounds = Standard_True;
|
||||
extern Standard_Boolean Draw_Batch;
|
||||
const Standard_Integer MAXSEGMENT = 1000;
|
||||
Segment segm[MAXSEGMENT];
|
||||
Draw_XSegment segm[MAXSEGMENT];
|
||||
static int nbseg=0;
|
||||
static Draw_View* curview = NULL;
|
||||
static Standard_Integer curviewId = 0;
|
||||
@@ -943,12 +943,17 @@ Draw_Display Draw_Viewer::MakeDisplay (const Standard_Integer id) const
|
||||
//function : Select
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Draw_Viewer::Select (Standard_Integer& id, Standard_Integer& X, Standard_Integer& Y,
|
||||
Standard_Integer& Button, Standard_Boolean wait)
|
||||
void Draw_Viewer::Select (Standard_Integer& theId,
|
||||
Standard_Integer& theX, Standard_Integer& theY,
|
||||
Standard_Integer& theButton,
|
||||
Standard_Boolean theToWait)
|
||||
{
|
||||
if (Draw_Batch) return;
|
||||
id = X = Y = Button = 0;
|
||||
if (Draw_Batch)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
theId = theX = theY = theButton = 0;
|
||||
Standard_Boolean hasView = Standard_False;
|
||||
for (int aViewIter = 0; aViewIter < MAXVIEW; ++aViewIter)
|
||||
{
|
||||
@@ -965,105 +970,142 @@ void Draw_Viewer::Select (Standard_Integer& id, Standard_Integer& X, Standard_In
|
||||
return;
|
||||
}
|
||||
Flush();
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
||||
if (!wait) {
|
||||
if (id >=0 && id < MAXVIEW) {
|
||||
if (myViews[id]) myViews[id]->Wait(wait);
|
||||
|
||||
#ifdef _WIN32
|
||||
HANDLE hWnd = NULL;
|
||||
|
||||
theId = MAXVIEW; //:abv 29.05.02: cycle for working in console mode
|
||||
while (theId >= MAXVIEW)
|
||||
{
|
||||
if (theToWait)
|
||||
{
|
||||
Draw_Window::SelectWait (hWnd, theX, theY, theButton);
|
||||
}
|
||||
else
|
||||
{
|
||||
Draw_Window::SelectNoWait (hWnd, theX, theY, theButton);
|
||||
}
|
||||
|
||||
// Recherche du numero de la vue grace au HANDLE
|
||||
for (int aViewIter = 0; aViewIter < MAXVIEW; ++aViewIter)
|
||||
{
|
||||
if (myViews[aViewIter] != NULL
|
||||
&& myViews[aViewIter]->IsEqualWindows (hWnd))
|
||||
{
|
||||
theId = aViewIter;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(int i=0 ; i<MAXVIEW ; i++)
|
||||
if (myViews[i]) myViews[i]->Wait(wait);
|
||||
theX = theX - myViews[theId]->GetDx();
|
||||
theY = -theY - myViews[theId]->GetDy();
|
||||
#elif defined(HAVE_XLIB)
|
||||
if (!theToWait)
|
||||
{
|
||||
if (theId >= 0 && theId < MAXVIEW)
|
||||
{
|
||||
if (myViews[theId] != NULL)
|
||||
{
|
||||
myViews[theId]->Wait (theToWait);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int aViewIter = 0; aViewIter < MAXVIEW; ++aViewIter)
|
||||
{
|
||||
if (myViews[aViewIter] != NULL)
|
||||
{
|
||||
myViews[aViewIter]->Wait (theToWait);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean again = Standard_True;
|
||||
while (again) {
|
||||
|
||||
Event ev;
|
||||
while (again)
|
||||
{
|
||||
Draw_Window::Draw_XEvent ev;
|
||||
ev.type = 0;
|
||||
|
||||
GetNextEvent(ev);
|
||||
|
||||
switch (ev.type) {
|
||||
|
||||
case ButtonPress :
|
||||
Standard_Integer iv;
|
||||
for (iv = 0; iv < MAXVIEW; iv++) {
|
||||
if (myViews[iv]) {
|
||||
if (myViews[iv]->win == ev.window)
|
||||
break;
|
||||
}
|
||||
Draw_Window::GetNextEvent (ev);
|
||||
switch (ev.type)
|
||||
{
|
||||
case ButtonPress:
|
||||
{
|
||||
Standard_Integer aViewIter = 0;
|
||||
for (; aViewIter < MAXVIEW; ++aViewIter)
|
||||
{
|
||||
if (myViews[aViewIter] != NULL
|
||||
&& myViews[aViewIter]->IsEqualWindows (ev.window))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (theToWait || theId == aViewIter)
|
||||
{
|
||||
if (aViewIter < MAXVIEW)
|
||||
{
|
||||
theId = aViewIter;
|
||||
theX = ev.x;
|
||||
theY = ev.y;
|
||||
theButton = ev.button;
|
||||
}
|
||||
else
|
||||
{
|
||||
theId = -1;
|
||||
}
|
||||
again = Standard_False;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (wait || id == iv) {
|
||||
if (iv < MAXVIEW) {
|
||||
id = iv;
|
||||
X = ev.x;
|
||||
Y = ev.y;
|
||||
Button = ev.button;
|
||||
}
|
||||
else {
|
||||
id = -1;
|
||||
}
|
||||
again = Standard_False;
|
||||
case MotionNotify:
|
||||
{
|
||||
if (theToWait)
|
||||
{
|
||||
break;
|
||||
}
|
||||
theX = ev.x;
|
||||
theY = ev.y;
|
||||
theButton = 0;
|
||||
again = Standard_False;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case MotionNotify :
|
||||
if (wait) break;
|
||||
X = ev.x;
|
||||
Y = ev.y;
|
||||
Button = 0;
|
||||
again = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (id != -1) {
|
||||
X = X - myViews[id]->GetDx();
|
||||
Y = -Y - myViews[id]->GetDy();
|
||||
}
|
||||
if (!wait) myViews[id]->Wait(!wait);
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
Standard_Integer aWindowNumber;
|
||||
|
||||
id = MAXVIEW;
|
||||
while (id >= MAXVIEW)
|
||||
if (theId != -1)
|
||||
{
|
||||
GetNextEvent(wait, aWindowNumber, X, Y, Button);
|
||||
|
||||
if (Y < 0)
|
||||
theX = theX - myViews[theId]->GetDx();
|
||||
theY = -theY - myViews[theId]->GetDy();
|
||||
}
|
||||
if (!theToWait)
|
||||
{
|
||||
myViews[theId]->Wait (!theToWait);
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
theId = MAXVIEW;
|
||||
while (theId >= MAXVIEW)
|
||||
{
|
||||
Standard_Integer aWindowNumber = 0;
|
||||
Draw_Window::GetNextEvent (theToWait, aWindowNumber, theX, theY, theButton);
|
||||
if (theY < 0)
|
||||
{
|
||||
continue; // mouse clicked on window title
|
||||
}
|
||||
|
||||
for (Standard_Integer anIter = 0; anIter < MAXVIEW; anIter++)
|
||||
for (Standard_Integer aViewIter = 0; aViewIter < MAXVIEW; ++aViewIter)
|
||||
{
|
||||
if (myViews[anIter] && myViews[anIter]->IsEqualWindows (aWindowNumber))
|
||||
if (myViews[aViewIter] != NULL
|
||||
&& myViews[aViewIter]->IsEqualWindows (aWindowNumber))
|
||||
{
|
||||
id = anIter;
|
||||
theId = aViewIter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
X = X - myViews[id]->GetDx();
|
||||
Y = -Y - myViews[id]->GetDy();
|
||||
|
||||
theX = theX - myViews[theId]->GetDx();
|
||||
theY = -theY - myViews[theId]->GetDy();
|
||||
#else
|
||||
HANDLE hWnd;
|
||||
|
||||
id = MAXVIEW; //:abv 29.05.02: cycle for working in console mode
|
||||
while ( id >= MAXVIEW ) {
|
||||
if (wait)
|
||||
Draw_Window::SelectWait(hWnd, X, Y, Button);
|
||||
else
|
||||
Draw_Window::SelectNoWait(hWnd, X, Y, Button);
|
||||
|
||||
// Recherche du numero de la vue grace au HANDLE
|
||||
for(int i=0 ; i<MAXVIEW ; i++)
|
||||
if (myViews[i] && myViews[i]->win == hWnd ) id = i;
|
||||
}
|
||||
X = X - myViews[id]->GetDx();
|
||||
Y = -Y - myViews[id]->GetDy();
|
||||
// not implemented
|
||||
(void )theToWait;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user