mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
Compare commits
156 Commits
CR32811_1
...
IR-2022-09
Author | SHA1 | Date | |
---|---|---|---|
|
526c506cb0 | ||
|
2949b238c1 | ||
|
dfb5aebd35 | ||
|
8da2801496 | ||
|
e92d322d40 | ||
|
b71cb85f67 | ||
|
05cfce4d83 | ||
|
d7eefb11bf | ||
|
80d4753574 | ||
|
ed6a17ef6c | ||
|
2182812a5b | ||
|
92915edda8 | ||
|
06aa200142 | ||
|
acac44d571 | ||
|
7aaed2ce3b | ||
|
da76ea432b | ||
|
53152e6dd9 | ||
|
1a1739b200 | ||
|
fd5c113a03 | ||
|
f74f684b16 | ||
|
621ed3bc36 | ||
|
81d569625e | ||
|
6072d3093c | ||
|
e1b097eb67 | ||
|
92d22d7d62 | ||
|
1b423e3287 | ||
|
cb8519be19 | ||
|
617a2905a9 | ||
|
18559e93cf | ||
|
c2e01cc5cc | ||
|
0acc1ab47c | ||
|
b315a85dd7 | ||
|
411ad1a819 | ||
|
bbf49a300c | ||
|
0bab2704ae | ||
|
33c8a72788 | ||
|
315ed0be41 | ||
|
d74b1e9dd3 | ||
|
b47b075ac5 | ||
|
7a52478f16 | ||
|
9db675b3d6 | ||
|
e1d576bf31 | ||
|
e1f7382910 | ||
|
dee5eb82b5 | ||
|
c2eed2a326 | ||
|
3a2ca49b6d | ||
|
4f53e7b37c | ||
|
e01ce0cd52 | ||
|
34c407eb34 | ||
|
ef4e5e3bf1 | ||
|
ca1491f88b | ||
|
b284dc42dc | ||
|
a0ffd4a521 | ||
|
07e803dee1 | ||
|
ec2d883e53 | ||
|
1593d38b13 | ||
|
aaa03c1efb | ||
|
b2bce1d928 | ||
|
581016faeb | ||
|
6bf38f219b | ||
|
63fa56bc83 | ||
|
a29bae45f9 | ||
|
6d1a049be7 | ||
|
b1970c8a47 | ||
|
f8c45c2f0d | ||
|
94748ad20e | ||
|
2e0b684df3 | ||
|
a1f027b66e | ||
|
88ff1a3834 | ||
|
fb30026cf1 | ||
|
714fb6b516 | ||
|
bf8b7e08f1 | ||
|
24e4b3c83b | ||
|
10a19b2a75 | ||
|
d30f25e6b1 | ||
|
cec41bb93d | ||
|
e9c43fee29 | ||
|
812afe4edb | ||
|
48e4aad412 | ||
|
23c56fc66a | ||
|
795c0d5d73 | ||
|
fbf9efb8d5 | ||
|
9b9aac4a7b | ||
|
86d6c284c2 | ||
|
84d39c06fa | ||
|
df69c26472 | ||
|
b56df3a60a | ||
|
dcbd679c8b | ||
|
b9280b8b27 | ||
|
2052b04e5b | ||
|
6036998511 | ||
|
33463eef63 | ||
|
84f42008b7 | ||
|
cb6c7c458c | ||
|
d2c11b791c | ||
|
73035770f6 | ||
|
1966e6af07 | ||
|
5dd4cb6e60 | ||
|
034d1403b1 | ||
|
267738fc40 | ||
|
e976df2329 | ||
|
82598ec0f2 | ||
|
7b3f255f23 | ||
|
4e1b5fcbf0 | ||
|
9416ba5fb0 | ||
|
e9a13cf123 | ||
|
a0b4fff17a | ||
|
51db8cab7b | ||
|
8af9bbd59a | ||
|
1f45f21358 | ||
|
d7f5072158 | ||
|
7090725e2b | ||
|
d8bfee7b03 | ||
|
879768fbf2 | ||
|
179fb34661 | ||
|
1caf5fd317 | ||
|
fc41d3b1c0 | ||
|
08d9c0ae45 | ||
|
7021de2fe7 | ||
|
e455c54bf0 | ||
|
d31e5dbbb4 | ||
|
878ea8cd2b | ||
|
ee6581adbe | ||
|
1fff4ad5a7 | ||
|
a793b75e21 | ||
|
5078d0d84e | ||
|
ad3825f821 | ||
|
fe12f15cb4 | ||
|
b2ec2f5d42 | ||
|
e3fd3d83da | ||
|
1f37f1d50a | ||
|
1f000e5974 | ||
|
2491eec38b | ||
|
ab279b126b | ||
|
e4753a7d16 | ||
|
5ae6f08cc6 | ||
|
9b337ad8e5 | ||
|
3425e83f4b | ||
|
e720157864 | ||
|
452ba192d5 | ||
|
9140163ba8 | ||
|
7573a45deb | ||
|
802180e1a5 | ||
|
8ca58a51a7 | ||
|
acce2c1448 | ||
|
633084b809 | ||
|
a9e5f65041 | ||
|
b9a372bbcd | ||
|
b5204c6c37 | ||
|
75e2ba1695 | ||
|
5c48956f8e | ||
|
b9184c2714 | ||
|
e61aa824db | ||
|
5a846a5d2c | ||
|
b91e601442 | ||
|
cfde7eebb3 |
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/adm/cmake")
|
||||
|
||||
@@ -6,6 +6,26 @@ set (CMAKE_SUPPRESS_REGENERATION TRUE)
|
||||
|
||||
set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
|
||||
|
||||
# set using C++ standard
|
||||
set (BUILD_CPP_STANDARD "C++11" CACHE STRING "Select using c++ standard.")
|
||||
set_property(CACHE BUILD_CPP_STANDARD PROPERTY STRINGS "C++11" "C++14" "C++17" "C++20" "C++23")
|
||||
|
||||
# Set desired C++ standard
|
||||
if ("${BUILD_CPP_STANDARD}" STREQUAL "C++11")
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++14")
|
||||
set (CMAKE_CXX_STANDARD 14)
|
||||
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++17")
|
||||
set (CMAKE_CXX_STANDARD 17)
|
||||
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++20")
|
||||
set (CMAKE_CXX_STANDARD 20)
|
||||
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++23")
|
||||
set (CMAKE_CXX_STANDARD 23)
|
||||
else ()
|
||||
message (FATAL_ERROR, "misprint in c++ standard name")
|
||||
endif()
|
||||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# macro: include patched file if it exists
|
||||
macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
|
||||
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake")
|
||||
@@ -56,6 +76,20 @@ set_property (GLOBAL PROPERTY OCC_VERSION_MAJOR ${OCC_VERSION_MAJOR})
|
||||
set_property (GLOBAL PROPERTY OCC_VERSION_MINOR ${OCC_VERSION_MINOR})
|
||||
set_property (GLOBAL PROPERTY OCC_VERSION_MAINTENANCE ${OCC_VERSION_MAINTENANCE})
|
||||
|
||||
# set soversion variable determining compatibility version on platforms with symlinks
|
||||
# 0 - for empty, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance
|
||||
if (NOT BUILD_SOVERSION_NUMBERS)
|
||||
set (BUILD_SOVERSION_NUMBERS "0" CACHE STRING "${BUILD_SOVERSION_NUMBERS_DESCR}" FORCE)
|
||||
SET_PROPERTY(CACHE BUILD_SOVERSION_NUMBERS PROPERTY STRINGS 0 1 2 3)
|
||||
|
||||
# update default state of soversion on different platforms
|
||||
if (WIN32 OR ANDROID OR EMSCRIPTEN)
|
||||
set (BUILD_SOVERSION_NUMBERS 0)
|
||||
else()
|
||||
set (BUILD_SOVERSION_NUMBERS 2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}")
|
||||
|
||||
# Regeneration of OCCT resource files
|
||||
@@ -786,6 +820,12 @@ else()
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_DOT_EXECUTABLE")
|
||||
endif()
|
||||
|
||||
# ExpToCasExe
|
||||
if (EMSCRIPTEN)
|
||||
list (REMOVE_ITEM BUILD_TOOLKITS TKExpress)
|
||||
list (REMOVE_ITEM BUILD_TOOLKITS ExpToCasExe)
|
||||
endif()
|
||||
|
||||
# bison
|
||||
if (BUILD_YACCLEX)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/bison")
|
||||
@@ -1225,7 +1265,7 @@ foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
|
||||
endforeach()
|
||||
# install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration
|
||||
install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)")
|
||||
install (CODE "configure_file(\"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" COPYONLY)")
|
||||
install (CODE "file(INSTALL FILES \"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" DESTINATION \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/\" TYPE FILE)")
|
||||
|
||||
foreach (OCCT_MODULE ${OCCT_MODULES})
|
||||
if (BUILD_MODULE_${OCCT_MODULE})
|
||||
|
@@ -3,5 +3,5 @@ ModelingData TKG2d TKG3d TKGeomBase TKBRep
|
||||
ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
|
||||
Visualization TKService TKV3d TKOpenGl TKOpenGles TKMeshVS TKIVtk TKD3DHost
|
||||
ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF
|
||||
DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh
|
||||
DataExchange TKXDE TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh TKXDECascade TKExpress ExpToCasExe
|
||||
Draw TKDraw TKTopTest TKOpenGlTest TKOpenGlesTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
|
||||
|
@@ -384,6 +384,8 @@ t TKSTEPBase
|
||||
t TKSTL
|
||||
t TKVRML
|
||||
t TKXCAF
|
||||
t TKXDE
|
||||
t TKXDECascade
|
||||
t TKXDEIGES
|
||||
t TKXDESTEP
|
||||
t TKXSBase
|
||||
@@ -394,6 +396,9 @@ n DBRep
|
||||
n DDF
|
||||
n DDataStd
|
||||
n DDocStd
|
||||
n DE
|
||||
n DEXCAFCascade
|
||||
n DEBRepCascade
|
||||
n DNaming
|
||||
n DPrsStd
|
||||
n Draw
|
||||
@@ -475,3 +480,6 @@ n TreeModel
|
||||
n View
|
||||
n ViewControl
|
||||
n VInspector
|
||||
n Express
|
||||
t TKExpress
|
||||
x ExpToCasExe
|
||||
|
@@ -22,6 +22,4 @@ if (3RDPARTY_DIR)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# bison 3.2 is required because it provides options to avoid generation of redundant header
|
||||
# files and embedding of local paths in the generated code
|
||||
find_package (BISON 3.2)
|
||||
find_package (BISON 3.7.4)
|
||||
|
@@ -32,15 +32,13 @@ if(__COTIRE_INCLUDED)
|
||||
endif()
|
||||
set(__COTIRE_INCLUDED TRUE)
|
||||
|
||||
# call cmake_minimum_required, but prevent modification of the CMake policy stack in include mode
|
||||
# cmake_minimum_required also sets the policy version as a side effect, which we have to avoid
|
||||
if (NOT CMAKE_SCRIPT_MODE_FILE)
|
||||
cmake_policy(PUSH)
|
||||
endif()
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
if (NOT CMAKE_SCRIPT_MODE_FILE)
|
||||
cmake_policy(POP)
|
||||
endif()
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
|
||||
set (COTIRE_CMAKE_MODULE_VERSION "1.7.9")
|
||||
|
@@ -1,4 +1,96 @@
|
||||
# Draco - a library for a lossy vertex data compression, used as extension to glTF format.
|
||||
# https://github.com/google/draco
|
||||
|
||||
THIRDPARTY_PRODUCT("DRACO" "draco/compression/decode.h" "CSF_Draco" "")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
if (NOT DEFINED INSTALL_DRACO)
|
||||
set (INSTALL_DRACO OFF CACHE BOOL "${INSTALL_DRACO_DESCR}")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_DIR)
|
||||
set (3RDPARTY_DRACO_DIR "" CACHE PATH "The directory containing Draco")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_INCLUDE_DIR)
|
||||
set (3RDPARTY_DRACO_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the Draco")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY OR NOT 3RDPARTY_DRACO_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
|
||||
set (3RDPARTY_DRACO_LIBRARY "" CACHE FILEPATH "Draco library" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DIR)
|
||||
set (3RDPARTY_DRACO_LIBRARY_DIR "" CACHE PATH "The directory containing Draco library")
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
|
||||
if (NOT 3RDPARTY_DRACO_DIR OR NOT EXISTS "${3RDPARTY_DRACO_DIR}")
|
||||
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" draco DRACO_DIR_NAME)
|
||||
if (DRACO_DIR_NAME)
|
||||
set (3RDPARTY_DRACO_DIR "${3RDPARTY_DIR}/${DRACO_DIR_NAME}" CACHE PATH "The directory containing Draco" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
|
||||
set (DRACO_INCLUDE_PATH "${3RDPARTY_DRACO_DIR}/include")
|
||||
set (DRACO_LIBRARY_PATH "${3RDPARTY_DRACO_DIR}/lib")
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_DRACO_INCLUDE_DIR)
|
||||
if (DRACO_INCLUDE_PATH AND EXISTS "${DRACO_INCLUDE_PATH}")
|
||||
set (3RDPARTY_DRACO_INCLUDE_DIR "${DRACO_INCLUDE_PATH}" CACHE FILEPATH "The directory containing headers of DRACO" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_DRACO_LIBRARY_DIR)
|
||||
if (DRACO_LIBRARY_PATH AND EXISTS "${DRACO_LIBRARY_PATH}")
|
||||
set (3RDPARTY_DRACO_LIBRARY_DIR "${DRACO_LIBRARY_PATH}" CACHE FILEPATH "The directory containing DRACO library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_DRACO_INCLUDE_DIR AND EXISTS "${3RDPARTY_DRACO_INCLUDE_DIR}")
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_DRACO_INCLUDE_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DRACO_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
|
||||
if (NOT 3RDPARTY_DRACO_LIBRARY OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY}")
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
|
||||
set (3RDPARTY_DRACO_LIBRARY "3RDPARTY_DRACO_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to Draco library" FORCE)
|
||||
|
||||
find_library (3RDPARTY_DRACO_LIBRARY NAMES ${CSF_Draco}
|
||||
PATHS "${3RDPARTY_DRACO_LIBRARY_DIR}"
|
||||
PATH_SUFFIXES lib
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
if (3RDPARTY_DRACO_LIBRARY AND EXISTS "${3RDPARTY_DRACO_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY}" PATH)
|
||||
set (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY_DIR}" CACHE FILEPATH "The directory containing Draco library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_DRACO_LIBRARY_DIR AND EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_DRACO_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_DRACO_LIBRARY_DIR)
|
||||
endif()
|
||||
|
||||
if (INSTALL_DRACO)
|
||||
get_filename_component(3RDPARTY_DRACO_LIBRARY_REALPATH ${3RDPARTY_DRACO_LIBRARY} REALPATH)
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR_LIB}")
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR_LIB}i")
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR_LIB}d")
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -26,9 +26,7 @@ if (3RDPARTY_DIR)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# flex 2.5.37 is required because closest known lower version, 2.5.3 from WOK 6.8.0,
|
||||
# generates code which is unusable on Windows (includes unistd.h without any way to avoid this)
|
||||
find_package (FLEX 2.5.37)
|
||||
find_package (FLEX 2.6.4)
|
||||
|
||||
if (NOT FLEX_FOUND OR NOT FLEX_INCLUDE_DIR OR NOT EXISTS "${FLEX_INCLUDE_DIR}/FlexLexer.h")
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED FLEX_INCLUDE_DIR)
|
||||
|
@@ -25,6 +25,9 @@ if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
# suppress C26812 on VS2019/C++20 (prefer 'enum class' over 'enum')
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise /wd\"26812\"")
|
||||
# suppress warning on using portable non-secure functions in favor of non-portable secure ones
|
||||
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
else()
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")
|
||||
@@ -113,9 +116,9 @@ if (MSVC)
|
||||
else()
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
||||
endif()
|
||||
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]"))
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshorten-64-to-32")
|
||||
endif()
|
||||
if (BUILD_SHARED_LIBS)
|
||||
@@ -127,14 +130,10 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMP
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
if (APPLE)
|
||||
# CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated.
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
|
||||
elseif(NOT WIN32)
|
||||
# CLang for Windows (at least CLang 8.0 distributed with VS 2019)
|
||||
# does not support option "-std=c++0x"
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||
set (CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
# Optimize size of binaries
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,-s ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
@@ -145,14 +144,10 @@ elseif(MINGW)
|
||||
# workaround bugs in mingw with vtable export
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols")
|
||||
|
||||
# Require C++11
|
||||
set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
|
||||
# Optimize size of binaries
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Require C++11
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||
# Optimize size of binaries
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
|
||||
|
@@ -80,9 +80,9 @@ macro (OCCT_MAKE_COMPILER_SHORT_NAME)
|
||||
set (COMPILER gcc)
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (COMPILER gxx)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
set (COMPILER clang)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
|
||||
set (COMPILER icc)
|
||||
else()
|
||||
set (COMPILER ${CMAKE_GENERATOR})
|
||||
@@ -589,9 +589,7 @@ macro (OCCT_UPDATE_TARGET_FILE)
|
||||
endif()
|
||||
|
||||
install (CODE
|
||||
"cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0007 NEW)
|
||||
string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWERCASE)
|
||||
"string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWERCASE)
|
||||
file (GLOB ALL_OCCT_TARGET_FILES \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADE*Targets-\${CMAKE_INSTALL_CONFIG_NAME_LOWERCASE}.cmake\")
|
||||
foreach(TARGET_FILENAME \${ALL_OCCT_TARGET_FILES})
|
||||
file (STRINGS \"\${TARGET_FILENAME}\" TARGET_FILE_CONTENT)
|
||||
@@ -600,8 +598,7 @@ macro (OCCT_UPDATE_TARGET_FILE)
|
||||
string (REGEX REPLACE \"[\\\\]?[\\\$]{OCCT_INSTALL_BIN_LETTER}\" \"\${OCCT_INSTALL_BIN_LETTER}\" line \"\${line}\")
|
||||
file (APPEND \"\${TARGET_FILENAME}\" \"\${line}\\n\")
|
||||
endforeach()
|
||||
endforeach()
|
||||
cmake_policy(POP)")
|
||||
endforeach()")
|
||||
endmacro()
|
||||
|
||||
macro (OCCT_INSERT_CODE_FOR_TARGET)
|
||||
@@ -615,17 +612,14 @@ macro (OCCT_INSERT_CODE_FOR_TARGET)
|
||||
endmacro()
|
||||
|
||||
macro (OCCT_UPDATE_DRAW_DEFAULT_FILE)
|
||||
install(CODE "cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0007 NEW)
|
||||
set (DRAW_DEFAULT_FILE_NAME \"${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/DrawResources/DrawPlugin\")
|
||||
install(CODE "set (DRAW_DEFAULT_FILE_NAME \"${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/DrawResources/DrawPlugin\")
|
||||
file (STRINGS \"\${DRAW_DEFAULT_FILE_NAME}\" DRAW_DEFAULT_CONTENT)
|
||||
file (REMOVE \"\${DRAW_DEFAULT_FILE_NAME}\")
|
||||
foreach (line IN LISTS DRAW_DEFAULT_CONTENT)
|
||||
string (REGEX MATCH \": TK\([a-zA-Z]+\)$\" IS_TK_LINE \"\${line}\")
|
||||
string (REGEX REPLACE \": TK\([a-zA-Z]+\)$\" \": TK\${CMAKE_MATCH_1}${BUILD_SHARED_LIBRARY_NAME_POSTFIX}\" line \"\${line}\")
|
||||
file (APPEND \"\${DRAW_DEFAULT_FILE_NAME}\" \"\${line}\\n\")
|
||||
endforeach()
|
||||
cmake_policy(POP)")
|
||||
endforeach()")
|
||||
endmacro()
|
||||
|
||||
macro (OCCT_CREATE_SYMLINK_TO_FILE LIBRARY_NAME LINK_NAME)
|
||||
|
@@ -106,6 +106,12 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
|
||||
set (BISON_OUTPUT_FILE_EXT "cxx")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (EXISTS ${FLEX_BISON_TARGET_DIR}/FlexLexer.h)
|
||||
message (STATUS "Info: remove old FLEX header file: ${FLEX_BISON_TARGET_DIR}/FlexLexer.h")
|
||||
file(REMOVE ${FLEX_BISON_TARGET_DIR}/FlexLexer.h)
|
||||
endif()
|
||||
|
||||
file (STRINGS "${CURRENT_FLEX_FILE}" FILE_FLEX_CONTENT)
|
||||
foreach (FILE_FLEX_CONTENT_LINE ${FILE_FLEX_CONTENT})
|
||||
string (REGEX MATCH "%option c\\+\\+" CXX_FLEX_LANGUAGE_FOUND ${FILE_FLEX_CONTENT_LINE})
|
||||
@@ -121,6 +127,19 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
|
||||
set (BISON_OUTPUT_FILE ${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
|
||||
set (FLEX_OUTPUT_FILE lex.${CURRENT_FLEX_FILE_NAME}.${FLEX_OUTPUT_FILE_EXT})
|
||||
|
||||
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
|
||||
message (STATUS "Info: remove old output BISON file: ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT}")
|
||||
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
|
||||
endif()
|
||||
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx)
|
||||
message (STATUS "Info: remove old output BISON file: ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx")
|
||||
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx)
|
||||
endif()
|
||||
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE})
|
||||
message (STATUS "Info: remove old output FLEX file: ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE}")
|
||||
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE})
|
||||
endif()
|
||||
|
||||
BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} "${FLEX_BISON_TARGET_DIR}/${BISON_OUTPUT_FILE}"
|
||||
COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME} -l -M ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/=")
|
||||
FLEX_TARGET (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} "${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE}"
|
||||
@@ -255,7 +274,8 @@ else()
|
||||
EXPORT OpenCASCADE${CURRENT_MODULE}Targets
|
||||
RUNTIME DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}"
|
||||
ARCHIVE DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
|
||||
LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}")
|
||||
LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
|
||||
INCLUDES DESTINATION ${INSTALL_DIR_INCLUDE})
|
||||
|
||||
if (NOT WIN32)
|
||||
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
|
||||
@@ -280,14 +300,17 @@ get_property (OCC_VERSION_MAJOR GLOBAL PROPERTY OCC_VERSION_MAJOR)
|
||||
get_property (OCC_VERSION_MINOR GLOBAL PROPERTY OCC_VERSION_MINOR)
|
||||
get_property (OCC_VERSION_MAINTENANCE GLOBAL PROPERTY OCC_VERSION_MAINTENANCE)
|
||||
|
||||
if (ANDROID)
|
||||
# do not append version to the filename
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}")
|
||||
else()
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
|
||||
SOVERSION "${OCC_VERSION_MAJOR}"
|
||||
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
|
||||
set (OCC_SOVERSION "")
|
||||
if (BUILD_SOVERSION_NUMBERS GREATER 2)
|
||||
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
|
||||
elseif (BUILD_SOVERSION_NUMBERS GREATER 1)
|
||||
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}")
|
||||
elseif (BUILD_SOVERSION_NUMBERS GREATER 0)
|
||||
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}")
|
||||
endif()
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
|
||||
SOVERSION "${OCC_SOVERSION}"
|
||||
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
|
||||
|
||||
set (USED_TOOLKITS_BY_CURRENT_PROJECT)
|
||||
set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT)
|
||||
@@ -316,10 +339,10 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
|
||||
else() # get CSF_ value
|
||||
set (CURRENT_CSF ${${USED_ITEM}})
|
||||
if (NOT "x${CURRENT_CSF}" STREQUAL "x")
|
||||
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlLibs")
|
||||
if ("${CURRENT_CSF}" STREQUAL "${CSF_OpenGlLibs}")
|
||||
add_definitions (-DHAVE_OPENGL)
|
||||
endif()
|
||||
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlesLibs")
|
||||
if ("${CURRENT_CSF}" STREQUAL "${CSF_OpenGlesLibs}")
|
||||
add_definitions (-DHAVE_GLES2)
|
||||
endif()
|
||||
|
||||
|
@@ -28,6 +28,9 @@ Applies only for Debug configuration.")
|
||||
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
|
||||
"Append the postfix to names of output libraries")
|
||||
|
||||
set (BUILD_SOVERSION_NUMBERS_DESCR
|
||||
"Version numbers to put into SONAME: 0 - for empty, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance")
|
||||
|
||||
set (BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR
|
||||
"Disables exceptions like Standard_OutOfRange in Release builds.
|
||||
Defines No_Exception macros for Release builds when enabled (default).
|
||||
|
@@ -119,6 +119,8 @@ android-g++ {
|
||||
# VS2015, vc141
|
||||
} else:equals(aMsvcVer, 16.0){
|
||||
# VS2019, vc142
|
||||
} else:equals(aMsvcVer, 17.0){
|
||||
# VS2022, vc143
|
||||
} else {
|
||||
warning (Unknown msvc version. "$$MY_COMPILER" is used)
|
||||
}
|
||||
|
@@ -132,21 +132,31 @@ for (aPackage, aPackages) {
|
||||
}
|
||||
}
|
||||
|
||||
# extend clean with versioned .so files
|
||||
!win32 {
|
||||
aVerList = $$split(VERSION, ".")
|
||||
aVerMaj = $$member(aVerList, 0)
|
||||
aVerMin = $$member(aVerList, 1)
|
||||
aVerMic = $$member(aVerList, 2)
|
||||
|
||||
equals(TEMPLATE, app) {
|
||||
QMAKE_CLEAN += $$DESTDIR/$${TARGET}
|
||||
} else {
|
||||
mac {
|
||||
# override qmake soname versionong logic
|
||||
QMAKE_LFLAGS_SONAME =
|
||||
QMAKE_LFLAGS += -Wl,-soname=lib$${TARGET}.dylib.$${aVerMaj}.$${aVerMin}
|
||||
|
||||
# extend clean with versioned .dylib files
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.dylib
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.dylib
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.dylib
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.$${aVerMic}.dylib
|
||||
} else {
|
||||
# override qmake soname versionong logic
|
||||
QMAKE_LFLAGS_SONAME =
|
||||
QMAKE_LFLAGS += -Wl,-soname=lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}
|
||||
|
||||
# extend clean with versioned .so files
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}
|
||||
|
@@ -23,6 +23,8 @@ if "%VCVER%" == "vc8" (
|
||||
call "%VS141COMNTOOLS%/vsvars32.bat" > nul
|
||||
) else if "%VCVER%" == "vc142" (
|
||||
call "%VS142COMNTOOLS%/vsvars32.bat" > nul
|
||||
) else if "%VCVER%" == "vc143" (
|
||||
call "%VS143COMNTOOLS%/vsvars32.bat" > nul
|
||||
) else (
|
||||
echo Error: wrong VS identifier
|
||||
exit /B
|
||||
|
@@ -74,6 +74,10 @@ if not "%DevEnvDir%" == "" (
|
||||
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
||||
set "DevEnvDir=%%i\Common7\IDE\"
|
||||
)
|
||||
) else if /I "%VCFMT%" == "vc143" (
|
||||
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
||||
set "DevEnvDir=%%i\Common7\IDE\"
|
||||
)
|
||||
) else if /I "%VCFMT%" == "gcc" (
|
||||
rem MinGW
|
||||
) else (
|
||||
@@ -107,6 +111,11 @@ if /I "%VCFMT%" == "vc9" (
|
||||
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
|
||||
)
|
||||
set "VCPlatformToolSet=v142"
|
||||
) else if /I "%VCFMT%" == "vc143" (
|
||||
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
||||
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
|
||||
)
|
||||
set "VCPlatformToolSet=v142"
|
||||
) else if /I "%VCFMT%" == "gcc" (
|
||||
rem MinGW
|
||||
) else (
|
||||
@@ -126,6 +135,7 @@ if ["%ARCH%"] == ["64"] set VCARCH=amd64
|
||||
|
||||
if /I ["%1"] == ["vc141"] set "VCVER=vc14"
|
||||
if /I ["%1"] == ["vc142"] set "VCVER=vc14"
|
||||
if /I ["%1"] == ["vc143"] set "VCVER=vc14"
|
||||
|
||||
if exist "%CASROOT%\custom.bat" (
|
||||
call "%CASROOT%\custom.bat" %VCVER% %ARCH% %CASDEB%
|
||||
|
@@ -7,6 +7,7 @@ if exist "%~dp0custom.bat" (
|
||||
call "@INSTALL_DIR_ABSOLUTE@\@INSTALL_DIR_SCRIPT@\env.bat" %1 %2 %3
|
||||
if /I ["%1"] == ["vc141"] set "VCVER=vc141"
|
||||
if /I ["%1"] == ["vc142"] set "VCVER=vc142"
|
||||
if /I ["%1"] == ["vc143"] set "VCVER=vc143"
|
||||
set "BIN_DIR=win%ARCH%\%VCVER%\bind"
|
||||
set "LIB_DIR=win%ARCH%\%VCVER%\libd"
|
||||
|
||||
|
@@ -23,6 +23,8 @@ if "%VCVER%" == "vc8" (
|
||||
call "%VS141COMNTOOLS%/vsvars32.bat" > nul
|
||||
) else if "%VCVER%" == "vc142" (
|
||||
call "%VS142COMNTOOLS%/vsvars32.bat" > nul
|
||||
) else if "%VCVER%" == "vc143" (
|
||||
call "%VS143COMNTOOLS%/vsvars32.bat" > nul
|
||||
) else (
|
||||
echo Error: wrong VS identifier
|
||||
exit /B
|
||||
|
@@ -100,7 +100,7 @@
|
||||
<ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
__VCMPL32__
|
||||
@@ -148,7 +148,7 @@
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
@@ -196,7 +196,7 @@
|
||||
<ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
__VCMPL64__
|
||||
@@ -244,7 +244,7 @@
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
|
@@ -95,7 +95,7 @@
|
||||
<ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
@@ -140,7 +140,7 @@
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
|
||||
</ClCompile>
|
||||
@@ -185,7 +185,7 @@
|
||||
<ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
@@ -229,7 +229,7 @@
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
|
||||
</ClCompile>
|
||||
|
@@ -17,7 +17,7 @@ On Linux and macOS we recommend to use libraries maintained by distributive deve
|
||||
@section build_occt_win_cmake Building with CMake tool
|
||||
|
||||
This chapter describes the [CMake](https://cmake.org/download/)-based build process, which is now suggested as a standard way to produce the binaries of Open CASCADE Technology from sources.
|
||||
OCCT requires CMake version 2.8.12 or later.
|
||||
OCCT requires CMake version 3.1 or later.
|
||||
|
||||
CMake is a tool that generates the actual project files for the selected target build system (e.g. Unix makefiles) or IDE (e.g. Visual Studio 2010).
|
||||
Here we describe the build procedure on the example of Windows platform with Visual Studio 2010.
|
||||
@@ -113,6 +113,7 @@ The following table gives the full list of environment variables used at the con
|
||||
| BUILD_PATCH | Path | Points to the directory recognized as a "patch" for OCCT. If specified, the files from this directory take precedence over the corresponding native OCCT sources. This way you are able to introduce patches to Open CASCADE Technology not affecting the original source distribution |
|
||||
| BUILD_WITH_DEBUG | Boolean | Enables extended messages of many OCCT algorithms, usually printed to cout. These include messages on internal errors and special cases encountered, timing, etc. |
|
||||
| BUILD_ENABLE_FPE_SIGNAL_HANDLER | Boolean | Enable/Disable the floating point exceptions (FPE) during DRAW execution only. Corresponding environment variable (CSF_FPE) can be changed manually in custom.bat/sh scripts without regeneration by CMake. |
|
||||
| BUILD_CPP_STANDARD | String | Employ corresponding c++ standard (C++11, C++14, ..C++23) for building OCCT |
|
||||
| CMAKE_CONFIGURATION_TYPES | String | Semicolon-separated CMake configurations |
|
||||
| INSTALL_DIR | Path | Points to the installation directory. *INSTALL_DIR* is a synonym of *CMAKE_INSTALL_PREFIX*. The user can specify both *INSTALL_DIR* or *CMAKE_INSTALL_PREFIX* |
|
||||
| INSTALL_DIR_BIN | Path | Relative path to the binaries installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_BIN}) |
|
||||
@@ -324,6 +325,7 @@ The environment is defined in the file *custom.sh* (on Linux and macOS) or *cust
|
||||
| vc141-uwp | 2017 (15) | UWP (Universal Windows Platform) | vc14-uwp |
|
||||
| vc142 | 2019 (16) | Desktop (Windows API) | vc14 |
|
||||
| vc142-uwp | 2019 (16) | UWP (Universal Windows Platform) | vc14-uwp |
|
||||
| vc143 | 2022 (17) | Desktop (Windows API) | vc14 |
|
||||
|
||||
Alternatively, you can launch **genconf**, a GUI tool allowing to configure build options interactively.
|
||||
That tool will analyze your environment and propose you to choose available options:
|
||||
|
@@ -341,7 +341,7 @@ The tables below describe the recommended software configurations for which OCCT
|
||||
|
||||
| OS | Compiler |
|
||||
| --------- | ----------- |
|
||||
| Windows | Microsoft Visual Studio: 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019, 2022 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
|
||||
| Windows | Microsoft Visual Studio: 2015 Update 3, 2017 <sup>1</sup>, 2019, 2022 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
|
||||
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
|
||||
| OS X / macOS | XCode 6 or newer |
|
||||
| Android | NDK r12, GNU gcc 4.9 or newer |
|
||||
@@ -359,7 +359,7 @@ https://dev.opencascade.org/resources/download/3rd-party-components
|
||||
|
||||
| Component | Where to find | Used for | Purpose |
|
||||
| --------- | ------------- | -------- | -------------------- |
|
||||
| CMake 2.8+ | https://cmake.org/ | Configuration | Build from sources |
|
||||
| CMake 3.1+ | https://cmake.org/ | Configuration | Build from sources |
|
||||
| Intel TBB 4.x or later | https://oneapi-src.github.io/oneTBB/ | All | Parallelization of algorithms (alternative to built-in thread pool) |
|
||||
| OpenGL 3.3+, OpenGL ES 2.0+ | System | Visualization | Required for using 3D Viewer |
|
||||
| OpenVR 1.10+ | https://github.com/ValveSoftware/openvr | Visualization | VR (Virtual Reality) support in 3D Viewer |
|
||||
@@ -462,7 +462,7 @@ To run any Open CASCADE Technology application you need to set the environment v
|
||||
|
||||
You can define the environment variables with env.bat script located in the
|
||||
$CASROOT folder. This script accepts two arguments to be used:
|
||||
the version of Visual Studio (vc12 -- vc142) and the architecture (win32 or win64).
|
||||
the version of Visual Studio (vc12 -- vc143) and the architecture (win32 or win64).
|
||||
|
||||
The additional environment settings necessary for compiling OCCT libraries and samples
|
||||
by Microsoft Visual Studio can be set using script custom.bat located in the same folder.
|
||||
|
@@ -2333,3 +2333,8 @@ Applications extending OCCT 3D Viewer and calling OpenGL functions directly (lik
|
||||
This header, as well as `OpenGl_GlCore20.hxx` and similar, no more include system OpenGL / OpenGL ES headers to define function table.
|
||||
Application code calling OpenGL functions directly should be changed to either use `OpenGl_Context::core11fwd` (as designed)
|
||||
or to include system OpenGL headers in advance (with help of `OpenGl_GlNative.hxx`).
|
||||
|
||||
@subsection upgrade_occt770_tooltriangulatedshape StdPrs_ToolTriangulatedShape
|
||||
|
||||
Method `StdPrs_ToolTriangulatedShape::Normal()` has been removed.
|
||||
Please use `BRepLib_ToolTriangulatedShape::ComputeNormals()` to fill in normal attributes in triangulation and fetch them directly using `Poly_Triangulation::Normal()`.
|
||||
|
@@ -2044,43 +2044,47 @@ Creates a *MeshVS_Mesh* object based on STL file data. The object will be displa
|
||||
meshfromstl mesh myfile.stl
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_draw_4_5_2 meshdispmode
|
||||
@subsubsection occt_draw_4_5_2 vsetdispmode
|
||||
|
||||
Syntax:
|
||||
~~~~{.php}
|
||||
meshdispmode meshname displaymode
|
||||
vsetdispmode meshname displaymode
|
||||
~~~~
|
||||
|
||||
Changes the display mode of object **meshname**. The **displaymode** is integer, which can be:
|
||||
* *1* for *wireframe*,
|
||||
Changes the display mode of object **meshname**. The **displaymode** is integer (`MeshVS_DisplayModeFlags`), which can be:
|
||||
* *1* for *wireframe*,
|
||||
* *2* for *shading* mode, or
|
||||
* *3* for *shrink* mode.
|
||||
* *3* for *shrink* mode.
|
||||
|
||||
**Example:**
|
||||
**Example:**
|
||||
~~~~{.php}
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
meshdispmode mesh 2
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
vsetdispmode mesh 2
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_draw_4_5_3 meshselmode
|
||||
@subsubsection occt_draw_4_5_3 vselmode
|
||||
|
||||
Syntax:
|
||||
~~~~{.php}
|
||||
meshselmode meshname selectionmode
|
||||
vselmode meshname selectionmode {on|off}
|
||||
~~~~
|
||||
|
||||
Changes the selection mode of object **meshname**. The *selectionmode* is integer OR-combination of mode flags. The basic flags are the following:
|
||||
Changes the selection mode of object **meshname**.
|
||||
The *selectionmode* is integer OR-combination of mode flags (`MeshVS_SelectionModeFlags`). The basic flags are the following:
|
||||
* *0* -- selection of mesh as whole;
|
||||
* *1* -- node selection;
|
||||
* *2* -- 0D elements (not supported in STL);
|
||||
* *4* -- links (not supported in STL);
|
||||
* *8* -- faces.
|
||||
|
||||
**Example:**
|
||||
* *2* -- 0D elements (not supported in STL);
|
||||
* *4* -- links (not supported in STL);
|
||||
* *8* -- faces;
|
||||
* *16* -- volumes (not supported in STL);
|
||||
* *256* -- groups (not supported in STL).
|
||||
|
||||
**Example:**
|
||||
~~~~{.php}
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
meshselmode mesh 1
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
vselmode mesh 1
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_draw_4_5_4 meshshadcolor
|
||||
@@ -2091,11 +2095,11 @@ meshshadcolor meshname red green blue
|
||||
~~~~
|
||||
|
||||
Changes the face interior color of object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*.
|
||||
|
||||
**Example:**
|
||||
|
||||
**Example:**
|
||||
~~~~{.php}
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
meshshadcolormode mesh 0.5 0.5 0.5
|
||||
~~~~
|
||||
|
||||
@@ -2107,11 +2111,11 @@ meshlinkcolor meshname red green blue
|
||||
~~~~
|
||||
|
||||
Changes the color of face borders for object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*.
|
||||
|
||||
**Example:**
|
||||
|
||||
**Example:**
|
||||
~~~~{.php}
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
meshlinkcolormode mesh 0.5 0.5 0.5
|
||||
~~~~
|
||||
|
||||
@@ -2119,39 +2123,37 @@ meshlinkcolormode mesh 0.5 0.5 0.5
|
||||
|
||||
Syntax:
|
||||
~~~~{.php}
|
||||
meshmat meshname material
|
||||
meshmat meshname material [transparency]
|
||||
~~~~
|
||||
|
||||
Changes the material of object **meshname**.
|
||||
|
||||
*material* is represented with an integer value as follows (equivalent to enumeration *Graphic3d_NameOfMaterial*):
|
||||
* *0 -- BRASS,*
|
||||
* *1 -- BRONZE,*
|
||||
* *2 -- COPPER,*
|
||||
* *3 -- GOLD,*
|
||||
* *4 -- PEWTER,*
|
||||
* *5 -- PLASTER,*
|
||||
* *6 -- PLASTIC,*
|
||||
* *7 -- SILVER,*
|
||||
* *8 -- STEEL,*
|
||||
* *9 -- STONE,*
|
||||
* *10 -- SHINY_PLASTIC,*
|
||||
* *11 -- SATIN,*
|
||||
* *12 -- METALIZED,*
|
||||
* *13 -- NEON_GNC,*
|
||||
* *14 -- CHROME,*
|
||||
* *15 -- ALUMINIUM,*
|
||||
* *16 -- OBSIDIAN,*
|
||||
* *17 -- NEON_PHC,*
|
||||
* *18 -- JADE,*
|
||||
* *19 -- DEFAULT,*
|
||||
* *20 -- UserDefined*
|
||||
*material* is represented with an integer value as follows (equivalent to enumeration *Graphic3d_NameOfMaterial*):
|
||||
* *0 -- BRASS*,
|
||||
* *1 -- BRONZE*,
|
||||
* *2 -- COPPER*,
|
||||
* *3 -- GOLD*,
|
||||
* *4 -- PEWTER*,
|
||||
* *5 -- PLASTER*,
|
||||
* *6 -- PLASTIC*,
|
||||
* *7 -- SILVER*,
|
||||
* *8 -- STEEL*,
|
||||
* *9 -- STONE*,
|
||||
* *10 -- SHINY_PLASTIC*,
|
||||
* *11 -- SATIN*,
|
||||
* *12 -- METALIZED*,
|
||||
* *13 -- NEON_GNC*,
|
||||
* *14 -- CHROME*,
|
||||
* *15 -- ALUMINIUM*,
|
||||
* *16 -- OBSIDIAN*,
|
||||
* *17 -- NEON_PHC*,
|
||||
* *18 -- JADE*.
|
||||
|
||||
**Example:**
|
||||
**Example:**
|
||||
~~~~{.php}
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
meshmat mesh JADE
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
meshmat mesh 18
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_draw_4_5_7 meshshrcoef
|
||||
@@ -2161,12 +2163,14 @@ Syntax:
|
||||
meshshrcoef meshname shrinkcoefficient
|
||||
~~~~
|
||||
|
||||
Changes the value of shrink coefficient used in the shrink mode. In the shrink mode the face is shown as a congruent part of a usual face, so that *shrinkcoefficient* controls the value of this part. The *shrinkcoefficient* is a positive real number.
|
||||
|
||||
**Example:**
|
||||
Changes the value of shrink coefficient used in the shrink mode.
|
||||
In the shrink mode the face is shown as a congruent part of a usual face, so that *shrinkcoefficient* controls the value of this part.
|
||||
The *shrinkcoefficient* is a positive real number.
|
||||
|
||||
**Example:**
|
||||
~~~~{.php}
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
meshshrcoef mesh 0.05
|
||||
~~~~
|
||||
|
||||
@@ -2178,11 +2182,12 @@ meshshow meshname
|
||||
~~~~
|
||||
|
||||
Displays **meshname** in the viewer (if it is erased).
|
||||
The same as calling `vdisplay`.
|
||||
|
||||
**Example:**
|
||||
~~~~{.php}
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
meshshow mesh
|
||||
~~~~
|
||||
|
||||
@@ -2193,12 +2198,13 @@ Syntax:
|
||||
meshhide meshname
|
||||
~~~~
|
||||
|
||||
Hides **meshname** in the viewer.
|
||||
Hides **meshname** in the viewer.
|
||||
The same as calling `verase`.
|
||||
|
||||
**Example:**
|
||||
**Example:**
|
||||
~~~~{.php}
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
meshhide mesh
|
||||
~~~~
|
||||
|
||||
@@ -2209,7 +2215,7 @@ Syntax:
|
||||
meshhidesel meshname
|
||||
~~~~
|
||||
|
||||
Hides only selected entities. The other part of **meshname** remains visible.
|
||||
Hides only selected entities. The other part of **meshname** remains visible.
|
||||
|
||||
@subsubsection occt_draw_4_5_11 meshshowsel
|
||||
|
||||
@@ -2218,7 +2224,7 @@ Syntax:
|
||||
meshshowsel meshname
|
||||
~~~~
|
||||
|
||||
Shows only selected entities. The other part of **meshname** becomes invisible.
|
||||
Shows only selected entities. The other part of **meshname** becomes invisible.
|
||||
|
||||
@subsubsection occt_draw_4_5_12 meshshowall
|
||||
|
||||
@@ -2227,22 +2233,22 @@ Syntax:
|
||||
meshshowall meshname
|
||||
~~~~
|
||||
|
||||
Changes the state of all entities to visible for **meshname**.
|
||||
Changes the state of all entities to visible for **meshname**.
|
||||
|
||||
@subsubsection occt_draw_4_5_13 meshdelete
|
||||
@subsubsection occt_draw_4_5_13 vremove
|
||||
|
||||
Syntax:
|
||||
~~~~{.php}
|
||||
meshdelete meshname
|
||||
vremove meshname
|
||||
~~~~
|
||||
|
||||
Deletes MeshVS_Mesh object **meshname**.
|
||||
Deletes MeshVS_Mesh object **meshname**.
|
||||
|
||||
**Example:**
|
||||
**Example:**
|
||||
~~~~{.php}
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
meshdelete mesh
|
||||
vinit
|
||||
meshfromstl mesh myfile.stl
|
||||
vremove mesh
|
||||
~~~~
|
||||
|
||||
@subsection occt_draw_4_6 VIS Viewer commands
|
||||
|
@@ -326,7 +326,8 @@ The <i>Geom2dConvert</i> package provides the following:
|
||||
* a global function which is used to construct a BSpline curve from a bounded curve based on a 2D curve from the Geom2d package,
|
||||
* a splitting algorithm which computes the points at which a 2D BSpline curve should be cut in order to obtain arcs with the same degree of continuity,
|
||||
* global functions used to construct the BSpline curves created by this splitting algorithm, or by other types of segmentation of the BSpline curve,
|
||||
* an algorithm which converts a 2D BSpline curve into a series of adjacent Bezier curves.
|
||||
* an algorithm which converts a 2D BSpline curve into a series of adjacent Bezier curves,
|
||||
* an algorithm which converts an arbitrary 2D curve into a series of adjacent 2D circular arcs and 2D linear segments.
|
||||
|
||||
The <i>GeomConvert</i> package also provides the following:
|
||||
|
||||
@@ -338,7 +339,8 @@ The <i>GeomConvert</i> package also provides the following:
|
||||
* a splitting algorithm, which determines the curves along which a BSpline surface should be cut in order to obtain patches with the same degree of continuity,
|
||||
* global functions to construct BSpline surfaces created by this splitting algorithm, or by other types of BSpline surface segmentation,
|
||||
* an algorithm, which converts a BSpline surface into a series of adjacent Bezier surfaces,
|
||||
* an algorithm, which converts a grid of adjacent Bezier surfaces into a BSpline surface.
|
||||
* an algorithm, which converts a grid of adjacent Bezier surfaces into a BSpline surface.
|
||||
* algorithms that converts NURBS, Bezier and other general parametrized curves and surface into anaytical curves and surfaces.
|
||||
|
||||
@subsection occt_modat_1_4 Points on Curves
|
||||
|
||||
|
@@ -1007,6 +1007,25 @@ Standard_Integer aNbOffsetSurfaces = aCheckContents.NbOffsetSurf();
|
||||
Handle(TopTools_HSequenceOfShape) aSeqFaces = aCheckContents.OffsetSurfaceSec();
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_shg_3_2_4 Analysis of shape underlined geometry
|
||||
|
||||
Class *ShapeAnalysis_CanonicalRecognition* provides tools that analyze geometry of shape and explore the possibility of converting geometry into a canonical form.
|
||||
Canonical forms for curves are lines, circles and ellipses.
|
||||
Canonical forms for surfaces are planar, cylindrical, conical and spherical surfaces.
|
||||
|
||||
Recognition and converting into canonical form is performed according to maximal deviation criterium: maximal distance between initial and canonical geometrical objects must be less, than given value.
|
||||
|
||||
Analysis of curves is allowed for following shapes:
|
||||
* edge - algorithm checks 3d curve of edge
|
||||
* wire - algorithm checks 3d curves of all edges in order to convert them in the same analytical curve
|
||||
|
||||
Analysis of surfaces is allowed for following shapes:
|
||||
* face - algorithm checks surface of face
|
||||
* shell - algorithm checks surfaces of all faces in order to convert them in the same analytical surface
|
||||
* edge - algorithm checks all surfaces that are shared by given edge in order convert one of them in analytical surface, which most close to the input sample surface.
|
||||
* wire - the same as for edge, but algorithm checks all edges of wire in order to find analytical surface, which most close to the input sample surface.
|
||||
|
||||
|
||||
@section occt_shg_4 Upgrading
|
||||
|
||||
Upgrading tools are intended for adaptation of shapes for better use by Open CASCADE Technology or for customization to particular needs, i.e. for export to another system.
|
||||
|
@@ -94,6 +94,7 @@ The types of STEP representation entities that are recognized are:
|
||||
* geometrically_bounded_wireframe_shape_representation
|
||||
* geometrically_bounded_surface_shape_representation
|
||||
* hybrid representations (shape_representation containing models of different type)
|
||||
* tessellated_shape_representation
|
||||
|
||||
@subsubsection occt_step_2_2_3 Topological entities
|
||||
The types of STEP topological entities that can be translated are:
|
||||
@@ -112,6 +113,7 @@ The types of STEP geometrical entities that can be translated are:
|
||||
* directions
|
||||
* curves
|
||||
* surfaces
|
||||
* triangulations
|
||||
|
||||
For further information see 2.4 Mapping STEP entities to Open CASCADE Technology shapes.
|
||||
|
||||
@@ -337,7 +339,7 @@ Specifies preferred type of representation of the shape of the product, in case
|
||||
* 4 (GBSSR) -- Prefer GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION
|
||||
* 5 (FBSR) -- Prefer FACETTED_BREP_SHAPE_REPRESENTATION
|
||||
* 6 (EBWSR) -- Prefer EDGE_BASED_WIREFRAME_SHAPE_REPRESENTATION
|
||||
* 7 (GBWSR) -- Prefer GEOMETRICALLY_BOUNDED_WIREFRAME _SHAPE_REPRESENTATION
|
||||
* 7 (GBWSR) -- Prefer GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION
|
||||
|
||||
When this option is not equal to 1, for products with multiple representations the representation having a type closest to the selected one in this list will be translated.
|
||||
|
||||
@@ -447,6 +449,34 @@ of for each of the two "AXIS2_PLACEMENT_3D" entities referenced by it. as follow
|
||||
}
|
||||
~~~~
|
||||
|
||||
<h4>read.step.tessellated:</h4>
|
||||
|
||||
Boolean flag regulating translation of entities that define tessellated geometry:
|
||||
|
||||
* TESSELLATED_SHAPE_REPRESENTATION
|
||||
* TESSELLATED_SHELL
|
||||
* TESSELLATED_SOLID
|
||||
* TRIANGULATED_FACE
|
||||
* COMPLEX_TRIANGULATED_FACE
|
||||
|
||||
Tesselated geometry is attached to shapes as objects of <i>Poly_Triangulation</i> type using STEP links.
|
||||
|
||||
* 0 (Off) -- do not translate
|
||||
* 1 (On) -- translate
|
||||
* 2 (OnNoBRep) - tessellation is read only for entities for which there is no BRep representation
|
||||
|
||||
Read this parameter with:
|
||||
~~~~{.cpp}
|
||||
Standard_Integer ic = Interface_Static::IVal("read.step.tessellated");
|
||||
~~~~
|
||||
|
||||
Modify this parameter with:
|
||||
~~~~{.cpp}
|
||||
if(!Interface_Static::SetIVal("read.step.tessellated",1))
|
||||
.. error ..
|
||||
~~~~
|
||||
Default value is 0 (On).
|
||||
|
||||
@subsubsection occt_step_2_3_4 Performing the STEP file translation
|
||||
|
||||
Perform the translation according to what you want to translate. You can choose either root entities (all or selected by the number of root), or select any entity by its number in the STEP file. There is a limited set of types of entities that can be used as starting entities for translation. Only the following entities are recognized as transferable:
|
||||
@@ -464,6 +494,11 @@ Perform the translation according to what you want to translate. You can choose
|
||||
* subtypes of face_surface (including advanced_face)
|
||||
* subtypes of shape_representation_relationship
|
||||
* context_dependent_shape_representation
|
||||
* tessellated_shape_representation
|
||||
* tessellated_shell
|
||||
* tessellated_solid
|
||||
* triangulated_face
|
||||
* complex_triangulated_face
|
||||
|
||||
The following methods are used for translation:
|
||||
|
||||
@@ -683,6 +718,10 @@ Not all entities defining the assembly structure in the STEP file are translated
|
||||
| | quasi_uniform_surface | Geom_BSplineSurface | |
|
||||
| | rectangular_composite_surface | TopoDS_Compound | Contains *TopoDS_Faces* |
|
||||
| | curve_bounded_surface | TopoDS_Face | |
|
||||
| Tessellations | tessellated_shell | TopoDS_Shell | |
|
||||
| | tessellated_solid | TopoDS_Solid | |
|
||||
| | triangulated_face | TopoDS_Face | Contains *Poly_Triangulation* |
|
||||
| | complex_triangulated_face | TopoDS_Face | Contains *Poly_Triangulation* |
|
||||
|
||||
|
||||
@subsection occt_step_2_5 Tolerance management
|
||||
@@ -745,6 +784,7 @@ The following default tolerances are used when creating shapes and how they are
|
||||
* *StepToTopoDS_TranslatePolyLoop* constructs *TopoDS_Edges* in *TopoDS_Wire* with help of class *StepToTopoDS_TranslateEdge*. Their tolerances are not modified inside this method.
|
||||
* *StepToTopoDS_TranslateFace* constructs *TopoDS_Face* with the initial value of tolerance. *TopoDS_Wire* on *TopoDS_Face* is constructed with the help of classes *StepToTopoDS_TranslatePolyLoop, StepToTopoDS_TranslateEdgeLoop* or *StepToTopoDS_TranslateVertexLoop*.
|
||||
* *StepToTopoDS_TranslateShell* calls *StepToTopoDS_TranslateFace::Init* for each face. This class does not modify the tolerance value.
|
||||
* *StepToTopoDS_TranslateSolid* calls *StepToTopoDS_TranslateFace::Init* for each face. This class does not modify the tolerance value.
|
||||
* *StepToTopoDS_TranslateCompositeCurve* constructs *TopoDS_Edges* in *TopoDS_Wire* with help of class *BRepAPI_MakeEdge* and have a tolerance 10-7. Pcurves from a STEP file are translated if they are present and if *read.surfacecurve.mode* is not -3. The connection between segments of a composite curve (edges in the wire) is provided by calling method *ShapeFix_Wire::FixConnected()\** with a precision equal to the initial value of tolerance.
|
||||
* *StepToTopoDS_TranslateCurveBoundedSurface* constructs *TopoDS_Face* with tolerance *Precision::Confusion()*. *TopoDS_Wire* on *TopoDS_Face* is constructed with the help of class *StepToTopoDS_TranslateCompositeCurve*. Missing pcurves are computed using projection algorithm with the help of method *ShapeFix_Face::FixPcurves()*. For resulting face method *ShapeFix::SameParameter()* is called. It calls standard *BRepLib::SameParameter* for each edge in each wire, which can either increase or decrease the tolerances of the edges and vertices. *SameParameter* writes the tolerance corresponding to the real deviation of pcurves from 3D curve which can be less or greater than the tolerance in a STEP file.
|
||||
* *StepToTopoDS_Builder* a high level class. Its methods perform translation with the help of the classes listed above. If the value of *read.maxprecision.mode* is set to 1 then the tolerance of subshapes of the resulting shape is limited by 0 and *read.maxprecision.val*. Else this class does not change the tolerance value.
|
||||
@@ -971,6 +1011,34 @@ if(!Interface_Static::SetIVal("write.step.vertex.mode",1))
|
||||
~~~~
|
||||
Default value is 0.
|
||||
|
||||
<h4>write.step.tessellated:</h4>
|
||||
|
||||
Boolean flag regulating writing of entities that define tessellated geometry:
|
||||
|
||||
* TESSELLATED_SHAPE_REPRESENTATION
|
||||
* TESSELLATED_SHELL
|
||||
* TESSELLATED_SOLID
|
||||
* TRIANGULATED_FACE
|
||||
|
||||
Tesselated geometry is taken as objects of <i>Poly_Triangulation type</i> from the active <i>TopoDS_Face</i> triangulation.
|
||||
|
||||
* 0 (Off) -- do not write
|
||||
* 1 (On) -- write
|
||||
* 2 (OnNoBRep) - tessellation is written only for entities for which there is no BRep representation
|
||||
|
||||
Read this parameter with:
|
||||
~~~~{.cpp}
|
||||
Standard_Integer ic = Interface_Static::IVal("write.step.tessellated");
|
||||
~~~~
|
||||
|
||||
Modify this parameter with:
|
||||
~~~~{.cpp}
|
||||
if(!Interface_Static::SetIVal("write.step.tessellated",1))
|
||||
.. error ..
|
||||
~~~~
|
||||
|
||||
Default value is 2 (OnNoBep).
|
||||
|
||||
@subsubsection occt_step_3_3_3 Performing the Open CASCADE Technology shape translation
|
||||
An OCCT shape can be translated to STEP using one of the following models (shape_representations):
|
||||
* manifold_solid_brep (advanced_brep_shape_representation)
|
||||
@@ -1094,6 +1162,7 @@ The table below describes STEP entities, which are created when the assembly str
|
||||
| | Geom_ToroidalSurface | toroidal_surface or degenerate_toroidal_surface | *degenerate_toroidal_surface* is produced if the minor radius is greater then the major one |
|
||||
| | Geom_BezierSurface | b_spline_surface_with_knots | |
|
||||
| | Geom_BsplineSurface | b_spline_surface_with_knots or rational_b_spline_surface | *rational_b_spline_surface* is produced if *Geom_BSplineSurface* is a rational Bspline |
|
||||
| Triangulations | Poly_Triangulation | *triangulated_face* is produced for face active triangulation | |
|
||||
|
||||
|
||||
@subsection occt_step_3_5 Tolerance management
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IE_WPF_D3D</RootNamespace>
|
||||
<AssemblyName>IE_WPF_D3D</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
|
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IE_WPF_WinForms</RootNamespace>
|
||||
<AssemblyName>IE_WPF_WinForms</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
|
@@ -27,7 +27,7 @@
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
|
@@ -35,4 +35,4 @@
|
||||
</providers>
|
||||
</roleManager>
|
||||
</system.web>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TColGeom_SequenceOfCurve.hxx>
|
||||
|
||||
|
@@ -26,9 +26,7 @@
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_Texture1D.hxx>
|
||||
#include <Graphic3d_Texture1Dsegment.hxx>
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Graphic3d_Texture2D.hxx>
|
||||
#include <Image_AlienPixMap.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
@@ -81,7 +79,7 @@ void Sample2D_Image::SetContext (const Handle(AIS_InteractiveContext)& theContex
|
||||
this->Set(TopoDS_Shape(myFace));
|
||||
|
||||
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
|
||||
Handle(Graphic3d_Texture2Dmanual) aTexture = new Graphic3d_Texture2Dmanual(myFilename);
|
||||
Handle(Graphic3d_Texture2D) aTexture = new Graphic3d_Texture2D (myFilename);
|
||||
aTexture->DisableModulate();
|
||||
myDrawer->ShadingAspect()->Aspect()->SetTextureMap (aTexture);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetTextureMapOn();
|
||||
|
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
|
||||
//! AIS AIS interactive object for sample 2D marker
|
||||
class Sample2D_Markers : public AIS_InteractiveObject
|
||||
|
@@ -4,7 +4,6 @@ project(glfw-occt-demo)
|
||||
|
||||
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/adm/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(APP_VERSION_MAJOR 1)
|
||||
set(APP_VERSION_MINOR 0)
|
||||
set(APP_TARGET glfwocct)
|
||||
|
@@ -39,9 +39,9 @@ elseif (DEFINED CMAKE_COMPILER_IS_GNUCC)
|
||||
set (MY_COMPILER gcc)
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (MY_COMPILER gcc)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
set (MY_COMPILER clang)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
|
||||
set (MY_COMPILER icc)
|
||||
else()
|
||||
set (MY_COMPILER ${CMAKE_GENERATOR})
|
||||
|
@@ -37,7 +37,7 @@ list(APPEND aLibDeps lib_FreeType)
|
||||
# system libraries
|
||||
list(APPEND aLibDeps EGL GLESv2 log android)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -frtti -fexceptions -fpermissive")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -frtti -fexceptions -fpermissive")
|
||||
|
||||
add_library(TKJniSample SHARED ${SOURCE_FILES})
|
||||
target_link_libraries(TKJniSample ${aLibDeps})
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (Geometry)
|
||||
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (Modeling)
|
||||
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (ImportExport)
|
||||
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (HLR)
|
||||
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (mfcsample)
|
||||
|
||||
|
@@ -7,6 +7,7 @@ if exist "%~dp0custom.bat" (
|
||||
call "%CASROOT%\env.bat" %1 %2 %3
|
||||
if /I ["%1"] == ["vc141"] set "VCVER=vc141"
|
||||
if /I ["%1"] == ["vc142"] set "VCVER=vc142"
|
||||
if /I ["%1"] == ["vc143"] set "VCVER=vc143"
|
||||
set "BIN_DIR=win%ARCH%\%VCVER%\bind"
|
||||
set "LIB_DIR=win%ARCH%\%VCVER%\libd"
|
||||
|
||||
|
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
project(occt-webgl-sample)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(APP_VERSION_MAJOR 1)
|
||||
set(APP_VERSION_MINOR 0)
|
||||
set(APP_TARGET occt-webgl-sample)
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Select3D_SensitiveCircle.hxx>
|
||||
#include <Select3D_SensitivePoly.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
@@ -41,9 +42,9 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_Circle,AIS_InteractiveObject)
|
||||
AIS_Circle::AIS_Circle(const Handle(Geom_Circle)& aComponent):
|
||||
AIS_InteractiveObject(PrsMgr_TOP_AllView),
|
||||
myComponent(aComponent),
|
||||
myUStart(0.),
|
||||
myUEnd(2*M_PI),
|
||||
myCircleIsArc(Standard_False),
|
||||
myUStart (0.0),
|
||||
myUEnd (2.0 * M_PI),
|
||||
myCircleIsArc (Standard_False),
|
||||
myIsFilledCircleSens (Standard_False)
|
||||
{
|
||||
}
|
||||
@@ -60,7 +61,7 @@ AIS_Circle::AIS_Circle(const Handle(Geom_Circle)& theComponent,
|
||||
myComponent (theComponent),
|
||||
myUStart (theUStart),
|
||||
myUEnd (theUEnd),
|
||||
myCircleIsArc (Standard_True),
|
||||
myCircleIsArc (Abs (Abs (theUEnd - theUStart) - 2.0 * M_PI) > gp::Resolution()),
|
||||
myIsFilledCircleSens (theIsFilledCircleSens)
|
||||
{
|
||||
}
|
||||
@@ -207,14 +208,14 @@ void AIS_Circle::UnsetWidth()
|
||||
//function : ComputeCircle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Circle::ComputeCircle( const Handle(Prs3d_Presentation)& aPresentation)
|
||||
void AIS_Circle::ComputeCircle (const Handle(Prs3d_Presentation)& thePresentation)
|
||||
{
|
||||
|
||||
GeomAdaptor_Curve curv(myComponent);
|
||||
Standard_Real prevdev = myDrawer->DeviationCoefficient();
|
||||
myDrawer->SetDeviationCoefficient(1.e-5);
|
||||
StdPrs_DeflectionCurve::Add(aPresentation,curv,myDrawer);
|
||||
myDrawer->SetDeviationCoefficient(prevdev);
|
||||
myDrawer->SetDeviationCoefficient (1.e-5);
|
||||
StdPrs_DeflectionCurve::Add (thePresentation, curv, myDrawer);
|
||||
myDrawer->SetDeviationCoefficient (prevdev);
|
||||
|
||||
}
|
||||
|
||||
@@ -223,13 +224,13 @@ void AIS_Circle::ComputeCircle( const Handle(Prs3d_Presentation)& aPresentation)
|
||||
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Circle::ComputeArc( const Handle(Prs3d_Presentation)& aPresentation)
|
||||
void AIS_Circle::ComputeArc (const Handle(Prs3d_Presentation)& thePresentation)
|
||||
{
|
||||
GeomAdaptor_Curve curv(myComponent,myUStart,myUEnd);
|
||||
GeomAdaptor_Curve curv(myComponent, myUStart, myUEnd);
|
||||
Standard_Real prevdev = myDrawer->DeviationCoefficient();
|
||||
myDrawer->SetDeviationCoefficient(1.e-5);
|
||||
StdPrs_DeflectionCurve::Add(aPresentation,curv,myDrawer);
|
||||
myDrawer->SetDeviationCoefficient(prevdev);
|
||||
myDrawer->SetDeviationCoefficient (1.e-5);
|
||||
StdPrs_DeflectionCurve::Add (thePresentation, curv, myDrawer);
|
||||
myDrawer->SetDeviationCoefficient (prevdev);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -237,27 +238,25 @@ void AIS_Circle::ComputeArc( const Handle(Prs3d_Presentation)& aPresentation)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_Circle::ComputeCircleSelection(const Handle(SelectMgr_Selection)& aSelection)
|
||||
void AIS_Circle::ComputeCircleSelection (const Handle(SelectMgr_Selection)& theSelection)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this);
|
||||
Handle(Select3D_SensitiveCircle) seg = new Select3D_SensitiveCircle (eown,
|
||||
myComponent->Circ(),
|
||||
myIsFilledCircleSens);
|
||||
aSelection->Add(seg);
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner(this);
|
||||
Handle(Select3D_SensitiveCircle) aCirc = new Select3D_SensitiveCircle (anOwner,
|
||||
myComponent->Circ(),
|
||||
myIsFilledCircleSens);
|
||||
theSelection->Add (aCirc);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ComputeArcSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_Circle::ComputeArcSelection(const Handle(SelectMgr_Selection)& aSelection)
|
||||
void AIS_Circle::ComputeArcSelection (const Handle(SelectMgr_Selection)& theSelection)
|
||||
{
|
||||
|
||||
|
||||
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this);
|
||||
Handle(Select3D_SensitiveCircle) seg = new Select3D_SensitiveCircle (eown,
|
||||
myComponent->Circ(),
|
||||
myUStart, myUEnd,
|
||||
myIsFilledCircleSens);
|
||||
aSelection->Add(seg);
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner(this);
|
||||
Handle(Select3D_SensitivePoly) aSeg = new Select3D_SensitivePoly (anOwner,
|
||||
myComponent->Circ(),
|
||||
myUStart, myUEnd,
|
||||
myIsFilledCircleSens);
|
||||
theSelection->Add (aSeg);
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Created on: 1997-01-17
|
||||
// Created on: 1997-01-17
|
||||
// Created by: Robert COUBLANC
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
@@ -362,7 +362,7 @@ void AIS_InteractiveContext::ObjectsForView (AIS_ListOfInteractive& theListOfIO
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->StructureManager()->ObjectAffinity (anObjIter.Key());
|
||||
Handle(Graphic3d_ViewAffinity) anAffinity = anObjIter.Key()->ViewAffinity();
|
||||
const Standard_Boolean isVisible = anAffinity->IsVisible (aViewId);
|
||||
if (isVisible == theIsVisibleInView)
|
||||
{
|
||||
@@ -402,17 +402,9 @@ void AIS_InteractiveContext::SetViewAffinity (const Handle(AIS_InteractiveObject
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->StructureManager()->ObjectAffinity (theIObj);
|
||||
Handle(Graphic3d_ViewAffinity) anAffinity = theIObj->ViewAffinity();
|
||||
Handle(Graphic3d_CView) aViewImpl = theView->View();
|
||||
anAffinity->SetVisible (aViewImpl->Identification(), theIsVisible == Standard_True);
|
||||
if (theIsVisible)
|
||||
{
|
||||
theView->View()->ChangeHiddenObjects()->Remove (theIObj.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
theView->View()->ChangeHiddenObjects()->Add (theIObj.get());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -445,7 +437,8 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
||||
if (!myObjects.IsBound (theIObj))
|
||||
{
|
||||
setObjectStatus (theIObj, PrsMgr_DisplayStatus_Displayed, theDispMode, theSelectionMode);
|
||||
myMainVwr->StructureManager()->RegisterObject (theIObj);
|
||||
theIObj->ViewAffinity()->SetVisible (true); // reset view affinity mask
|
||||
myMainVwr->StructureManager()->RegisterObject (theIObj, theIObj->ViewAffinity());
|
||||
myMainPM->Display(theIObj, theDispMode);
|
||||
if (theSelectionMode != -1)
|
||||
{
|
||||
@@ -521,7 +514,8 @@ void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
Standard_Integer aDispMode, aHiMod, aSelModeDef;
|
||||
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
|
||||
setObjectStatus (theIObj, PrsMgr_DisplayStatus_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
|
||||
myMainVwr->StructureManager()->RegisterObject (theIObj);
|
||||
theIObj->ViewAffinity()->SetVisible (true); // reset view affinity mask
|
||||
myMainVwr->StructureManager()->RegisterObject (theIObj, theIObj->ViewAffinity());
|
||||
}
|
||||
|
||||
// Register theIObj in the selection manager to prepare further activation of selection
|
||||
@@ -1007,6 +1001,14 @@ void AIS_InteractiveContext::RecomputeSelectionOnly (const Handle(AIS_Interactiv
|
||||
return;
|
||||
}
|
||||
|
||||
TColStd_ListOfInteger aModes;
|
||||
ActivatedModes (theIO, aModes);
|
||||
|
||||
for (TColStd_ListIteratorOfListOfInteger aModesIter (aModes); aModesIter.More(); aModesIter.Next())
|
||||
{
|
||||
mgrSelector->Deactivate (theIO, aModesIter.Value());
|
||||
}
|
||||
|
||||
mgrSelector->RecomputeSelection (theIO);
|
||||
|
||||
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIO);
|
||||
@@ -1016,10 +1018,7 @@ void AIS_InteractiveContext::RecomputeSelectionOnly (const Handle(AIS_Interactiv
|
||||
return;
|
||||
}
|
||||
|
||||
TColStd_ListOfInteger aModes;
|
||||
ActivatedModes (theIO, aModes);
|
||||
TColStd_ListIteratorOfListOfInteger aModesIter (aModes);
|
||||
for (; aModesIter.More(); aModesIter.Next())
|
||||
for (TColStd_ListIteratorOfListOfInteger aModesIter (aModes); aModesIter.More(); aModesIter.Next())
|
||||
{
|
||||
mgrSelector->Activate (theIO, aModesIter.Value());
|
||||
}
|
||||
@@ -1900,13 +1899,9 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
mgrSelector->Remove (anObj);
|
||||
|
||||
setObjectStatus (theIObj, PrsMgr_DisplayStatus_None, -1, -1);
|
||||
theIObj->ViewAffinity()->SetVisible (true); // reset view affinity mask
|
||||
myMainVwr->StructureManager()->UnregisterObject (theIObj);
|
||||
|
||||
for (V3d_ListOfViewIterator aDefViewIter (myMainVwr->DefinedViewIterator()); aDefViewIter.More(); aDefViewIter.Next())
|
||||
{
|
||||
aDefViewIter.Value()->View()->ChangeHiddenObjects()->Remove (theIObj.get());
|
||||
}
|
||||
|
||||
if (!myLastPicked.IsNull())
|
||||
{
|
||||
if (myLastPicked->IsSameSelectable (theIObj))
|
||||
@@ -2214,10 +2209,11 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView)
|
||||
//function : BoundingBoxOfSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Bnd_Box AIS_InteractiveContext::BoundingBoxOfSelection() const
|
||||
Bnd_Box AIS_InteractiveContext::BoundingBoxOfSelection (const Handle(V3d_View)& theView) const
|
||||
{
|
||||
Bnd_Box aBndSelected;
|
||||
AIS_MapOfObjectOwners anObjectOwnerMap;
|
||||
const Standard_Integer aViewId = !theView.IsNull() ? theView->View()->Identification() : -1;
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
|
||||
@@ -2227,6 +2223,13 @@ Bnd_Box AIS_InteractiveContext::BoundingBoxOfSelection() const
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_ViewAffinity) anAffinity = anObj->ViewAffinity();
|
||||
const Standard_Boolean isVisible = aViewId == -1 || anAffinity->IsVisible (aViewId);
|
||||
if (!isVisible)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (anOwner == anObj->GlobalSelOwner())
|
||||
{
|
||||
Bnd_Box aTmpBnd;
|
||||
@@ -2264,7 +2267,7 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
|
||||
const Standard_Real theMargin,
|
||||
const Standard_Boolean theToUpdate)
|
||||
{
|
||||
Bnd_Box aBndSelected = BoundingBoxOfSelection();
|
||||
Bnd_Box aBndSelected = BoundingBoxOfSelection (theView);
|
||||
if (!aBndSelected.IsVoid())
|
||||
{
|
||||
theView->FitAll (aBndSelected, theMargin, theToUpdate);
|
||||
@@ -2674,12 +2677,10 @@ AIS_StatusOfDetection AIS_InteractiveContext::moveTo (const Handle(V3d_View)& th
|
||||
myDetectedSeq.Clear();
|
||||
myLastActiveView = theView.get();
|
||||
|
||||
// preliminaires
|
||||
// preliminaries
|
||||
AIS_StatusOfDetection aStatus = AIS_SOD_Nothing;
|
||||
Standard_Boolean toUpdateViewer = Standard_False;
|
||||
|
||||
myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
|
||||
|
||||
// filling of myAISDetectedSeq sequence storing information about detected AIS objects
|
||||
// (the objects must be AIS_Shapes)
|
||||
const Standard_Integer aDetectedNb = MainSelector()->NbPicked();
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
|
||||
class V3d_Viewer;
|
||||
@@ -502,7 +503,10 @@ public: //! @name Selection management
|
||||
Standard_EXPORT AIS_StatusOfPick SelectDetected (const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace);
|
||||
|
||||
//! Returns bounding box of selected objects.
|
||||
Standard_EXPORT Bnd_Box BoundingBoxOfSelection() const;
|
||||
Standard_EXPORT Bnd_Box BoundingBoxOfSelection (const Handle(V3d_View)& theView) const;
|
||||
|
||||
Standard_DEPRECATED ("BoundingBoxOfSelection() should be called with View argument")
|
||||
Bnd_Box BoundingBoxOfSelection() const { return BoundingBoxOfSelection (Handle(V3d_View)()); }
|
||||
|
||||
//! Sets list of owner selected/deselected using specified selection scheme.
|
||||
//! @param theOwners owners to change selection state
|
||||
|
@@ -17,6 +17,8 @@
|
||||
#define _AIS_LightSource_HeaderFile
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
|
||||
class Select3D_SensitiveSphere;
|
||||
|
@@ -84,9 +84,8 @@ namespace
|
||||
public:
|
||||
//! Main constructor.
|
||||
ManipSensCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const gp_Circ& theCircle,
|
||||
const Standard_Integer theNbPnts)
|
||||
: Select3D_SensitiveCircle (theOwnerId, theCircle, Standard_False, theNbPnts),
|
||||
const gp_Circ& theCircle)
|
||||
: Select3D_SensitiveCircle (theOwnerId, theCircle, Standard_False),
|
||||
ManipSensRotation (theCircle.Position().Direction()) {}
|
||||
|
||||
//! Checks whether the circle overlaps current selecting volume
|
||||
@@ -1071,7 +1070,7 @@ void AIS_Manipulator::HilightOwnerWithColor (const Handle(PrsMgr_PresentationMan
|
||||
return;
|
||||
}
|
||||
|
||||
aPresentation->CStructure()->ViewAffinity = thePM->StructureManager()->ObjectAffinity (Handle(Standard_Transient) (this));
|
||||
aPresentation->CStructure()->ViewAffinity = myViewAffinity;
|
||||
|
||||
if (anOwner->Mode() == AIS_MM_TranslationPlane)
|
||||
{
|
||||
@@ -1168,7 +1167,7 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
}
|
||||
// define sensitivity by circle
|
||||
const gp_Circ aGeomCircle (gp_Ax2 (gp::Origin(), anAxis.ReferenceAxis().Direction()), anAxis.RotatorDiskRadius());
|
||||
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle (anOwner, aGeomCircle, anAxis.FacettesNumber());
|
||||
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle (anOwner, aGeomCircle);
|
||||
aCircle->SetSensitivityFactor (15);
|
||||
theSelection->Add (aCircle);
|
||||
// enlarge sensitivity by triangulation
|
||||
|
@@ -34,6 +34,8 @@ enum AIS_MouseGesture
|
||||
AIS_MouseGesture_Pan, //!< view panning gesture
|
||||
AIS_MouseGesture_RotateOrbit, //!< orbit rotation gesture
|
||||
AIS_MouseGesture_RotateView, //!< view rotation gesture
|
||||
AIS_MouseGesture_Drag, //!< object dragging;
|
||||
//! press button to start, move mouse to define rectangle, release to finish
|
||||
};
|
||||
|
||||
//! Map defining mouse gestures.
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_StructureManager.hxx>
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Graphic3d_Texture2D.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
@@ -278,17 +278,17 @@ void AIS_TexturedShape::updateAttributes (const Handle(Prs3d_Presentation)& theP
|
||||
TCollection_AsciiString aTextureDesc;
|
||||
if (!myTexturePixMap.IsNull())
|
||||
{
|
||||
myTexture = new Graphic3d_Texture2Dmanual (myTexturePixMap);
|
||||
myTexture = new Graphic3d_Texture2D (myTexturePixMap);
|
||||
aTextureDesc = " (custom image)";
|
||||
}
|
||||
else if (myPredefTexture != Graphic3d_NOT_2D_UNKNOWN)
|
||||
{
|
||||
myTexture = new Graphic3d_Texture2Dmanual (myPredefTexture);
|
||||
myTexture = new Graphic3d_Texture2D (myPredefTexture);
|
||||
aTextureDesc = TCollection_AsciiString(" (predefined texture ") + myTexture->GetId() + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
myTexture = new Graphic3d_Texture2Dmanual (myTextureFile.ToCString());
|
||||
myTexture = new Graphic3d_Texture2D (myTextureFile.ToCString());
|
||||
aTextureDesc = TCollection_AsciiString(" (") + myTextureFile + ")";
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Graphic3d_NameOfTexture2D.hxx>
|
||||
#include <Image_PixMap.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
@@ -26,7 +27,7 @@
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
|
||||
class Graphic3d_AspectFillArea3d;
|
||||
class Graphic3d_Texture2Dmanual;
|
||||
class Graphic3d_Texture2D;
|
||||
|
||||
//! This class allows to map textures on shapes.
|
||||
//! Presentations modes AIS_WireFrame (0) and AIS_Shaded (1) behave in the same manner as in AIS_Shape,
|
||||
@@ -184,7 +185,7 @@ protected: //! @name overridden methods
|
||||
|
||||
protected: //! @name presentation fields
|
||||
|
||||
Handle(Graphic3d_Texture2Dmanual) myTexture;
|
||||
Handle(Graphic3d_Texture2D) myTexture;
|
||||
Handle(Graphic3d_AspectFillArea3d) myAspect;
|
||||
|
||||
protected: //! @name texture source fields
|
||||
|
@@ -92,6 +92,7 @@ AIS_ViewController::AIS_ViewController()
|
||||
myTouchPanThresholdPx (4.0f),
|
||||
myTouchZoomThresholdPx (6.0f),
|
||||
myTouchZoomRatio (0.13f),
|
||||
myTouchDraggingThresholdPx (6.0f),
|
||||
//
|
||||
myNbTouchesLast (0),
|
||||
myUpdateStartPointPan (true),
|
||||
@@ -116,22 +117,37 @@ AIS_ViewController::AIS_ViewController()
|
||||
myRubberBand->SetDisplayMode (0);
|
||||
myRubberBand->SetMutable (true);
|
||||
|
||||
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_RotateOrbit);
|
||||
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_CTRL, AIS_MouseGesture_Zoom);
|
||||
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_SHIFT, AIS_MouseGesture_Pan);
|
||||
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_ALT, AIS_MouseGesture_SelectRectangle);
|
||||
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_ALT | Aspect_VKeyFlags_SHIFT, AIS_MouseGesture_SelectRectangle);
|
||||
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton,
|
||||
AIS_MouseGesture_RotateOrbit);
|
||||
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_CTRL,
|
||||
AIS_MouseGesture_Zoom);
|
||||
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_SHIFT,
|
||||
AIS_MouseGesture_Pan);
|
||||
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_ALT,
|
||||
AIS_MouseGesture_SelectRectangle);
|
||||
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_ALT | (Standard_UInteger )Aspect_VKeyFlags_SHIFT,
|
||||
AIS_MouseGesture_SelectRectangle);
|
||||
|
||||
myMouseSelectionSchemes.Bind (Aspect_VKeyMouse_LeftButton, AIS_SelectionScheme_Replace);
|
||||
myMouseSelectionSchemes.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_ALT, AIS_SelectionScheme_Replace);
|
||||
myMouseSelectionSchemes.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_SHIFT, AIS_SelectionScheme_XOR);
|
||||
myMouseSelectionSchemes.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_ALT | Aspect_VKeyFlags_SHIFT, AIS_SelectionScheme_XOR);
|
||||
myMouseSelectionSchemes.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton,
|
||||
AIS_SelectionScheme_Replace);
|
||||
myMouseSelectionSchemes.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_ALT,
|
||||
AIS_SelectionScheme_Replace);
|
||||
myMouseSelectionSchemes.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_SHIFT,
|
||||
AIS_SelectionScheme_XOR);
|
||||
myMouseSelectionSchemes.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_ALT | (Standard_UInteger )Aspect_VKeyFlags_SHIFT,
|
||||
AIS_SelectionScheme_XOR);
|
||||
|
||||
myMouseGestureMap.Bind (Aspect_VKeyMouse_RightButton, AIS_MouseGesture_Zoom);
|
||||
myMouseGestureMap.Bind (Aspect_VKeyMouse_RightButton | Aspect_VKeyFlags_CTRL, AIS_MouseGesture_RotateOrbit);
|
||||
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_RightButton,
|
||||
AIS_MouseGesture_Zoom);
|
||||
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_RightButton | (Standard_UInteger )Aspect_VKeyFlags_CTRL,
|
||||
AIS_MouseGesture_RotateOrbit);
|
||||
|
||||
myMouseGestureMap.Bind (Aspect_VKeyMouse_MiddleButton, AIS_MouseGesture_Pan);
|
||||
myMouseGestureMap.Bind (Aspect_VKeyMouse_MiddleButton | Aspect_VKeyFlags_CTRL, AIS_MouseGesture_Pan);
|
||||
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_MiddleButton,
|
||||
AIS_MouseGesture_Pan);
|
||||
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_MiddleButton | (Standard_UInteger )Aspect_VKeyFlags_CTRL,
|
||||
AIS_MouseGesture_Pan);
|
||||
|
||||
myMouseGestureMapDrag.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Drag);
|
||||
|
||||
myXRTeleportHaptic.Duration = 3600.0f;
|
||||
myXRTeleportHaptic.Frequency = 0.1f;
|
||||
@@ -181,6 +197,53 @@ void AIS_ViewController::FlushViewEvents (const Handle(AIS_InteractiveContext)&
|
||||
{
|
||||
flushBuffers (theCtx, theView);
|
||||
flushGestures(theCtx, theView);
|
||||
|
||||
if (theView->IsSubview())
|
||||
{
|
||||
// move input coordinates inside the view
|
||||
const Graphic3d_Vec2i aDelta = theView->View()->SubviewTopLeft();
|
||||
if (myGL.MoveTo.ToHilight || myGL.Dragging.ToStart)
|
||||
{
|
||||
myGL.MoveTo.Point -= aDelta;
|
||||
}
|
||||
if (myGL.Panning.ToStart)
|
||||
{
|
||||
myGL.Panning.PointStart -= aDelta;
|
||||
}
|
||||
if (myGL.Dragging.ToStart)
|
||||
{
|
||||
myGL.Dragging.PointStart -= aDelta;
|
||||
}
|
||||
if (myGL.Dragging.ToMove)
|
||||
{
|
||||
myGL.Dragging.PointTo -= aDelta;
|
||||
}
|
||||
if (myGL.OrbitRotation.ToStart)
|
||||
{
|
||||
myGL.OrbitRotation.PointStart -= Graphic3d_Vec2d (aDelta);
|
||||
}
|
||||
if (myGL.OrbitRotation.ToRotate)
|
||||
{
|
||||
myGL.OrbitRotation.PointTo -= Graphic3d_Vec2d (aDelta);
|
||||
}
|
||||
if (myGL.ViewRotation.ToStart)
|
||||
{
|
||||
myGL.ViewRotation.PointStart -= Graphic3d_Vec2d (aDelta);
|
||||
}
|
||||
if (myGL.ViewRotation.ToRotate)
|
||||
{
|
||||
myGL.ViewRotation.PointTo -= Graphic3d_Vec2d (aDelta);
|
||||
}
|
||||
for (Graphic3d_Vec2i& aPntIter : myGL.Selection.Points)
|
||||
{
|
||||
aPntIter -= aDelta;
|
||||
}
|
||||
for (Aspect_ScrollDelta& aZoomIter : myGL.ZoomActions)
|
||||
{
|
||||
aZoomIter.Point -= aDelta;
|
||||
}
|
||||
}
|
||||
|
||||
if (theToHandle)
|
||||
{
|
||||
HandleViewEvents (theCtx, theView);
|
||||
@@ -261,12 +324,21 @@ void AIS_ViewController::flushBuffers (const Handle(AIS_InteractiveContext)& ,
|
||||
myUI.Dragging.ToStop = false;
|
||||
myGL.Dragging.ToStop = true;
|
||||
}
|
||||
else if (myUI.Dragging.ToStart)
|
||||
else
|
||||
{
|
||||
myUI.Dragging.ToStart = false;
|
||||
myGL.Dragging.ToStart = true;
|
||||
myGL.Dragging.PointStart = myUI.Dragging.PointStart;
|
||||
if (myUI.Dragging.ToStart)
|
||||
{
|
||||
myUI.Dragging.ToStart = false;
|
||||
myGL.Dragging.ToStart = true;
|
||||
myGL.Dragging.PointStart = myUI.Dragging.PointStart;
|
||||
}
|
||||
if (myUI.Dragging.ToMove)
|
||||
{
|
||||
myUI.Dragging.ToMove = false;
|
||||
myGL.Dragging.ToMove = true;
|
||||
}
|
||||
}
|
||||
|
||||
myGL.Dragging.PointTo = myUI.Dragging.PointTo;
|
||||
|
||||
if (myUI.OrbitRotation.ToStart)
|
||||
@@ -351,6 +423,7 @@ void AIS_ViewController::flushGestures (const Handle(AIS_InteractiveContext)& ,
|
||||
const Graphic3d_Vec2d aRotDelta = aTouch.To - myGL.OrbitRotation.PointStart;
|
||||
myGL.OrbitRotation.ToRotate = true;
|
||||
myGL.OrbitRotation.PointTo = myGL.OrbitRotation.PointStart + aRotDelta * aRotAccel;
|
||||
myGL.Dragging.ToMove = true;
|
||||
myGL.Dragging.PointTo.SetValues ((int )aTouch.To.x(), (int )aTouch.To.y());
|
||||
}
|
||||
else
|
||||
@@ -358,6 +431,7 @@ void AIS_ViewController::flushGestures (const Handle(AIS_InteractiveContext)& ,
|
||||
const Graphic3d_Vec2d aRotDelta = aTouch.To - myGL.ViewRotation.PointStart;
|
||||
myGL.ViewRotation.ToRotate = true;
|
||||
myGL.ViewRotation.PointTo = myGL.ViewRotation.PointStart + aRotDelta * aRotAccel;
|
||||
myGL.Dragging.ToMove = true;
|
||||
myGL.Dragging.PointTo.SetValues ((int )aTouch.To.x(), (int )aTouch.To.y());
|
||||
}
|
||||
|
||||
@@ -780,6 +854,19 @@ bool AIS_ViewController::UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
|
||||
UpdatePolySelection (thePoint, true);
|
||||
break;
|
||||
}
|
||||
case AIS_MouseGesture_Drag:
|
||||
{
|
||||
if (myToAllowDragging)
|
||||
{
|
||||
myUI.Dragging.ToStart = true;
|
||||
myUI.Dragging.PointStart = thePoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
myMouseActiveGesture = AIS_MouseGesture_NONE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AIS_MouseGesture_NONE:
|
||||
{
|
||||
break;
|
||||
@@ -787,12 +874,19 @@ bool AIS_ViewController::UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
|
||||
}
|
||||
}
|
||||
|
||||
if (theButtons == Aspect_VKeyMouse_LeftButton
|
||||
&& theModifiers == Aspect_VKeyFlags_NONE
|
||||
&& myToAllowDragging)
|
||||
AIS_MouseGesture aSecGesture = AIS_MouseGesture_NONE;
|
||||
if (myMouseGestureMapDrag.Find (theButtons | theModifiers, aSecGesture))
|
||||
{
|
||||
myUI.Dragging.ToStart = true;
|
||||
myUI.Dragging.PointStart = thePoint;
|
||||
if (aSecGesture == AIS_MouseGesture_Drag
|
||||
&& myToAllowDragging)
|
||||
{
|
||||
myUI.Dragging.ToStart = true;
|
||||
myUI.Dragging.PointStart = thePoint;
|
||||
if (myMouseActiveGesture == AIS_MouseGesture_NONE)
|
||||
{
|
||||
myMouseActiveGesture = aSecGesture;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -916,7 +1010,8 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
|
||||
const double aRotTol = theIsEmulated
|
||||
? double(myTouchToleranceScale) * myTouchRotationThresholdPx
|
||||
: 0.0;
|
||||
if (double (Abs (aDelta.x()) + Abs (aDelta.y())) > aRotTol)
|
||||
const Graphic3d_Vec2d aDeltaF (aDelta);
|
||||
if (Abs (aDeltaF.x()) + Abs (aDeltaF.y()) > aRotTol)
|
||||
{
|
||||
const double aRotAccel = myNavigationMode == AIS_NavigationMode_FirstPersonWalk ? myMouseAccel : myOrbitAccel;
|
||||
const Graphic3d_Vec2i aRotDelta = thePoint - myMousePressPoint;
|
||||
@@ -932,6 +1027,8 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
|
||||
myUI.ViewRotation.PointTo = Graphic3d_Vec2d (myMousePressPoint.x(), myMousePressPoint.y())
|
||||
+ Graphic3d_Vec2d (aRotDelta.x(), aRotDelta.y()) * aRotAccel;
|
||||
}
|
||||
|
||||
myUI.Dragging.ToMove = true;
|
||||
myUI.Dragging.PointTo = thePoint;
|
||||
|
||||
myMouseProgressPoint = thePoint;
|
||||
@@ -967,7 +1064,8 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
|
||||
const double aPanTol = theIsEmulated
|
||||
? double(myTouchToleranceScale) * myTouchPanThresholdPx
|
||||
: 0.0;
|
||||
if (double (Abs (aDelta.x()) + Abs (aDelta.y())) > aPanTol)
|
||||
const Graphic3d_Vec2d aDeltaF (aDelta);
|
||||
if (Abs (aDeltaF.x()) + Abs (aDeltaF.y()) > aPanTol)
|
||||
{
|
||||
if (myUpdateStartPointPan)
|
||||
{
|
||||
@@ -991,6 +1089,31 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AIS_MouseGesture_Drag:
|
||||
{
|
||||
if (!myToAllowDragging)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
const double aDragTol = theIsEmulated
|
||||
? double(myTouchToleranceScale) * myTouchDraggingThresholdPx
|
||||
: 0.0;
|
||||
if (double (Abs (aDelta.x()) + Abs (aDelta.y())) > aDragTol)
|
||||
{
|
||||
const double aRotAccel = myNavigationMode == AIS_NavigationMode_FirstPersonWalk ? myMouseAccel : myOrbitAccel;
|
||||
const Graphic3d_Vec2i aRotDelta = thePoint - myMousePressPoint;
|
||||
myUI.ViewRotation.ToRotate = true;
|
||||
myUI.ViewRotation.PointTo = Graphic3d_Vec2d (myMousePressPoint.x(), myMousePressPoint.y())
|
||||
+ Graphic3d_Vec2d (aRotDelta.x(), aRotDelta.y()) * aRotAccel;
|
||||
myUI.Dragging.ToMove = true;
|
||||
myUI.Dragging.PointTo = thePoint;
|
||||
|
||||
myMouseProgressPoint = thePoint;
|
||||
toUpdateView = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
@@ -1508,10 +1631,11 @@ void AIS_ViewController::handleZoom (const Handle(V3d_View)& theView,
|
||||
|
||||
Graphic3d_Vec2i aWinSize;
|
||||
theView->Window()->Size (aWinSize.x(), aWinSize.y());
|
||||
const Graphic3d_Vec2d aPanFromCenterPx (double(theParams.Point.x()) - 0.5 * double(aWinSize.x()),
|
||||
double(aWinSize.y() - theParams.Point.y() - 1) - 0.5 * double(aWinSize.y()));
|
||||
aDxy.x() += -aViewDims1.X() * aPanFromCenterPx.x() / double(aWinSize.x());
|
||||
aDxy.y() += -aViewDims1.Y() * aPanFromCenterPx.y() / double(aWinSize.y());
|
||||
const Graphic3d_Vec2d aWinSizeF (aWinSize);
|
||||
const Graphic3d_Vec2d aPanFromCenterPx (double(theParams.Point.x()) - 0.5 * aWinSizeF.x(),
|
||||
aWinSizeF.y() - double(theParams.Point.y()) - 1.0 - 0.5 * aWinSizeF.y());
|
||||
aDxy.x() += -aViewDims1.X() * aPanFromCenterPx.x() / aWinSizeF.x();
|
||||
aDxy.y() += -aViewDims1.Y() * aPanFromCenterPx.y() / aWinSizeF.y();
|
||||
}
|
||||
|
||||
//theView->Translate (aCam, aDxy.x(), aDxy.y());
|
||||
@@ -1845,7 +1969,7 @@ gp_Pnt AIS_ViewController::GravityPoint (const Handle(AIS_InteractiveContext)& t
|
||||
void AIS_ViewController::FitAllAuto (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView)
|
||||
{
|
||||
const Bnd_Box aBoxSel = theCtx->BoundingBoxOfSelection();
|
||||
const Bnd_Box aBoxSel = theCtx->BoundingBoxOfSelection (theView);
|
||||
const double aFitMargin = 0.01;
|
||||
if (aBoxSel.IsVoid())
|
||||
{
|
||||
@@ -2566,6 +2690,17 @@ void AIS_ViewController::OnSelectionChanged (const Handle(AIS_InteractiveContext
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OnSubviewChanged
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_ViewController::OnSubviewChanged (const Handle(AIS_InteractiveContext)& ,
|
||||
const Handle(V3d_View)& ,
|
||||
const Handle(V3d_View)& )
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OnObjectDragged
|
||||
// purpose :
|
||||
@@ -2913,8 +3048,7 @@ void AIS_ViewController::handleDynamicHighlight (const Handle(AIS_InteractiveCon
|
||||
myGL.OrbitRotation.ToRotate = false;
|
||||
myGL.ViewRotation .ToRotate = false;
|
||||
}
|
||||
else if (myGL.OrbitRotation.ToRotate
|
||||
|| myGL.ViewRotation.ToRotate)
|
||||
else if (myGL.Dragging.ToMove)
|
||||
{
|
||||
OnObjectDragged (theCtx, theView, AIS_DragAction_Update);
|
||||
myGL.OrbitRotation.ToRotate = false;
|
||||
@@ -2942,6 +3076,8 @@ void AIS_ViewController::handleMoveTo (const Handle(AIS_InteractiveContext)& the
|
||||
void AIS_ViewController::handleViewRedraw (const Handle(AIS_InteractiveContext)& ,
|
||||
const Handle(V3d_View)& theView)
|
||||
{
|
||||
Handle(V3d_View) aParentView = theView->IsSubview() ? theView->ParentView() : theView;
|
||||
|
||||
// manage animation state
|
||||
if (!myViewAnimation.IsNull()
|
||||
&& !myViewAnimation->IsStopped())
|
||||
@@ -2969,31 +3105,82 @@ void AIS_ViewController::handleViewRedraw (const Handle(AIS_InteractiveContext)&
|
||||
myToAskNextFrame = true;
|
||||
}
|
||||
|
||||
for (V3d_ListOfViewIterator aViewIter (theView->Viewer()->ActiveViewIterator()); aViewIter.More(); aViewIter.Next())
|
||||
for (int aSubViewPass = 0; aSubViewPass < 2; ++aSubViewPass)
|
||||
{
|
||||
const Handle(V3d_View)& aView = aViewIter.Value();
|
||||
if (aView->IsInvalidated()
|
||||
|| (myToAskNextFrame && aView == theView))
|
||||
const bool isSubViewPass = (aSubViewPass == 0);
|
||||
for (V3d_ListOfViewIterator aViewIter (theView->Viewer()->ActiveViewIterator()); aViewIter.More(); aViewIter.Next())
|
||||
{
|
||||
if (aView->ComputedMode())
|
||||
const Handle(V3d_View)& aView = aViewIter.Value();
|
||||
if (isSubViewPass
|
||||
&& !aView->IsSubview())
|
||||
{
|
||||
aView->Update();
|
||||
for (const Handle(V3d_View)& aSubviewIter : aView->Subviews())
|
||||
{
|
||||
if (aSubviewIter->Viewer() != theView->Viewer())
|
||||
{
|
||||
if (aSubviewIter->IsInvalidated())
|
||||
{
|
||||
if (aSubviewIter->ComputedMode())
|
||||
{
|
||||
aSubviewIter->Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
aSubviewIter->Redraw();
|
||||
}
|
||||
}
|
||||
else if (aSubviewIter->IsInvalidatedImmediate())
|
||||
{
|
||||
aSubviewIter->RedrawImmediate();
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else
|
||||
else if (!isSubViewPass
|
||||
&& aView->IsSubview())
|
||||
{
|
||||
aView->Redraw();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (aView->IsInvalidated()
|
||||
|| (myToAskNextFrame && aView == theView))
|
||||
{
|
||||
if (aView->ComputedMode())
|
||||
{
|
||||
aView->Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
aView->Redraw();
|
||||
}
|
||||
|
||||
if (aView->IsSubview())
|
||||
{
|
||||
aView->ParentView()->InvalidateImmediate();
|
||||
}
|
||||
}
|
||||
else if (aView->IsInvalidatedImmediate())
|
||||
{
|
||||
if (aView->IsSubview())
|
||||
{
|
||||
aView->ParentView()->InvalidateImmediate();
|
||||
}
|
||||
|
||||
aView->RedrawImmediate();
|
||||
}
|
||||
}
|
||||
else if (aView->IsInvalidatedImmediate())
|
||||
{
|
||||
aView->RedrawImmediate();
|
||||
}
|
||||
}
|
||||
if (theView->IsSubview()
|
||||
&& theView->Viewer() != aParentView->Viewer())
|
||||
{
|
||||
aParentView->RedrawImmediate();
|
||||
}
|
||||
|
||||
if (myToAskNextFrame)
|
||||
{
|
||||
// ask more frames
|
||||
theView->Window()->InvalidateContent (Handle(Aspect_DisplayConnection)());
|
||||
aParentView->Window()->InvalidateContent (Handle(Aspect_DisplayConnection)());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3238,6 +3425,36 @@ void AIS_ViewController::HandleViewEvents (const Handle(AIS_InteractiveContext)&
|
||||
{
|
||||
const bool wasImmediateUpdate = theView->SetImmediateUpdate (false);
|
||||
|
||||
Handle(V3d_View) aPickedView;
|
||||
if (theView->IsSubview()
|
||||
|| !theView->Subviews().IsEmpty())
|
||||
{
|
||||
// activate another subview on mouse click
|
||||
bool toPickSubview = false;
|
||||
Graphic3d_Vec2i aClickPoint;
|
||||
if (myGL.Selection.Tool == AIS_ViewSelectionTool_Picking
|
||||
&& !myGL.Selection.Points.IsEmpty())
|
||||
{
|
||||
aClickPoint = myGL.Selection.Points.Last();
|
||||
toPickSubview = true;
|
||||
}
|
||||
else if (!myGL.ZoomActions.IsEmpty())
|
||||
{
|
||||
//aClickPoint = myGL.ZoomActions.Last().Point;
|
||||
//toPickSubview = true;
|
||||
}
|
||||
|
||||
if (toPickSubview)
|
||||
{
|
||||
if (theView->IsSubview())
|
||||
{
|
||||
aClickPoint += theView->View()->SubviewTopLeft();
|
||||
}
|
||||
Handle(V3d_View) aParent = !theView->IsSubview() ? theView : theView->ParentView();
|
||||
aPickedView = aParent->PickSubview (aClickPoint);
|
||||
}
|
||||
}
|
||||
|
||||
handleViewOrientationKeys (theCtx, theView);
|
||||
const AIS_WalkDelta aWalk = handleNavigationKeys (theCtx, theView);
|
||||
handleXRInput (theCtx, theView, aWalk);
|
||||
@@ -3255,6 +3472,12 @@ void AIS_ViewController::HandleViewEvents (const Handle(AIS_InteractiveContext)&
|
||||
|
||||
theView->SetImmediateUpdate (wasImmediateUpdate);
|
||||
|
||||
if (!aPickedView.IsNull()
|
||||
&& aPickedView != theView)
|
||||
{
|
||||
OnSubviewChanged (theCtx, theView, aPickedView);
|
||||
}
|
||||
|
||||
// make sure to not process the same events twice
|
||||
myGL.Reset();
|
||||
myToAskNextFrame = false;
|
||||
|
@@ -492,6 +492,12 @@ public:
|
||||
const Handle(V3d_View)& theView,
|
||||
AIS_DragAction theAction);
|
||||
|
||||
//! Callback called by HandleViewEvents() on Selection of another (sub)view.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void OnSubviewChanged (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theOldView,
|
||||
const Handle(V3d_View)& theNewView);
|
||||
|
||||
//! Pick closest point under mouse cursor.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
//! @param thePnt [out] result point
|
||||
@@ -757,6 +763,7 @@ protected: //! @name mouse input variables
|
||||
Standard_ShortReal myScrollZoomRatio; //!< distance ratio for mapping mouse scroll event to zoom; 15.0 by default
|
||||
|
||||
AIS_MouseGestureMap myMouseGestureMap; //!< map defining mouse gestures
|
||||
AIS_MouseGestureMap myMouseGestureMapDrag; //!< secondary map defining mouse gestures for dragging
|
||||
AIS_MouseGesture myMouseActiveGesture; //!< initiated mouse gesture (by pressing mouse button)
|
||||
AIS_MouseSelectionSchemeMap
|
||||
myMouseSelectionSchemes; //!< map defining selection schemes bound to mouse + modifiers
|
||||
@@ -777,6 +784,7 @@ protected: //! @name multi-touch input variables
|
||||
Standard_ShortReal myTouchPanThresholdPx; //!< threshold for starting two-touch panning gesture in pixels; 4 by default
|
||||
Standard_ShortReal myTouchZoomThresholdPx; //!< threshold for starting two-touch zoom (pitch) gesture in pixels; 6 by default
|
||||
Standard_ShortReal myTouchZoomRatio; //!< distance ratio for mapping two-touch zoom (pitch) gesture from pixels to zoom; 0.13 by default
|
||||
Standard_ShortReal myTouchDraggingThresholdPx; //!< distance for starting one-touch dragging gesture in pixels; 6 by default
|
||||
|
||||
Aspect_Touch myTouchClick; //!< single touch position for handling clicks
|
||||
OSD_Timer myTouchDoubleTapTimer; //!< timer for handling double tap
|
||||
|
@@ -859,7 +859,7 @@ Standard_Boolean AIS_ViewCube::HasAnimation() const
|
||||
void AIS_ViewCube::viewFitAll (const Handle(V3d_View)& theView,
|
||||
const Handle(Graphic3d_Camera)& theCamera)
|
||||
{
|
||||
Bnd_Box aBndBox = myToFitSelected ? GetContext()->BoundingBoxOfSelection() : theView->View()->MinMaxValues();
|
||||
Bnd_Box aBndBox = myToFitSelected ? GetContext()->BoundingBoxOfSelection (theView) : theView->View()->MinMaxValues();
|
||||
if (aBndBox.IsVoid()
|
||||
&& myToFitSelected)
|
||||
{
|
||||
@@ -1016,7 +1016,7 @@ void AIS_ViewCube::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManage
|
||||
|
||||
Handle(Prs3d_Presentation) aHiPrs = GetHilightPresentation (thePrsMgr);
|
||||
aHiPrs->Clear();
|
||||
aHiPrs->CStructure()->ViewAffinity = thePrsMgr->StructureManager()->ObjectAffinity (Handle(Standard_Transient)(this));
|
||||
aHiPrs->CStructure()->ViewAffinity = myViewAffinity;
|
||||
aHiPrs->SetTransformPersistence (TransformPersistence());
|
||||
aHiPrs->SetZLayer (aLayer);
|
||||
|
||||
|
@@ -87,12 +87,13 @@ public:
|
||||
struct _draggingParams
|
||||
{
|
||||
bool ToStart; //!< start dragging
|
||||
bool ToMove; //!< perform dragging
|
||||
bool ToStop; //!< stop dragging
|
||||
bool ToAbort; //!< abort dragging (restore previous position)
|
||||
Graphic3d_Vec2i PointStart; //!< drag start point
|
||||
Graphic3d_Vec2i PointTo; //!< drag end point
|
||||
|
||||
_draggingParams() : ToStart (false), ToStop (false), ToAbort (false) {}
|
||||
_draggingParams() : ToStart (false), ToMove (false), ToStop (false), ToAbort (false) {}
|
||||
} Dragging;
|
||||
|
||||
struct _orbitRotation
|
||||
@@ -141,6 +142,7 @@ public:
|
||||
Panning.ToStart = false;
|
||||
Panning.ToPan = false;
|
||||
Dragging.ToStart = false;
|
||||
Dragging.ToMove = false;
|
||||
Dragging.ToStop = false;
|
||||
Dragging.ToAbort = false;
|
||||
OrbitRotation.ToStart = false;
|
||||
|
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Image_Texture.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
@@ -23,14 +24,14 @@
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
|
||||
//! Texture holder.
|
||||
class AIS_XRTrackedDevice::XRTexture : public Graphic3d_Texture2Dmanual
|
||||
class AIS_XRTrackedDevice::XRTexture : public Graphic3d_Texture2D
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
XRTexture (const Handle(Image_Texture)& theImageSource,
|
||||
const Graphic3d_TextureUnit theUnit = Graphic3d_TextureUnit_BaseColor)
|
||||
: Graphic3d_Texture2Dmanual (""), myImageSource (theImageSource)
|
||||
: Graphic3d_Texture2D (""), myImageSource (theImageSource)
|
||||
{
|
||||
if (!theImageSource->TextureId().IsEmpty())
|
||||
{
|
||||
|
@@ -99,10 +99,10 @@ static gp_Parab to3d(const gp_Pln& Pl, const gp_Parab2d& P)
|
||||
return gp_Parab(to3d(Pl,P.Axis()),P.Focal());
|
||||
}
|
||||
|
||||
static gp_Vec SetLinearForm(const gp_Vec2d DW, const gp_Vec2d D2W,const gp_Vec2d D3W,
|
||||
const gp_Vec D1U, const gp_Vec D1V, const gp_Vec D2U,
|
||||
const gp_Vec D2V, const gp_Vec D2UV, const gp_Vec D3U,
|
||||
const gp_Vec D3V, const gp_Vec D3UUV,const gp_Vec D3UVV)
|
||||
static gp_Vec SetLinearForm(const gp_Vec2d& DW, const gp_Vec2d& D2W, const gp_Vec2d& D3W,
|
||||
const gp_Vec& D1U, const gp_Vec& D1V, const gp_Vec& D2U,
|
||||
const gp_Vec& D2V, const gp_Vec& D2UV, const gp_Vec& D3U,
|
||||
const gp_Vec& D3V, const gp_Vec& D3UUV,const gp_Vec& D3UVV)
|
||||
{gp_Vec V31, V32, V33, V34,V3 ;
|
||||
V31.SetLinearForm(DW.X(),D1U,
|
||||
D2W.X()*DW.X(),D2U,
|
||||
|
@@ -114,19 +114,20 @@ public:
|
||||
Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const;
|
||||
|
||||
Standard_EXPORT virtual Standard_Real VPeriod() const;
|
||||
|
||||
|
||||
//! Computes the point of parameters U,V on the surface.
|
||||
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
|
||||
Standard_EXPORT virtual gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
|
||||
|
||||
|
||||
//! Computes the point of parameters U,V on the surface.
|
||||
Standard_EXPORT virtual void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const;
|
||||
|
||||
//! Computes the point and the first derivatives on
|
||||
//! the surface.
|
||||
//! Raised if the continuity of the current
|
||||
//! intervals is not C1.
|
||||
//! Computes the point and the first derivatives on the surface.
|
||||
//! Raised if the continuity of the current intervals is not C1.
|
||||
//!
|
||||
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
|
||||
Standard_EXPORT virtual void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
|
||||
|
||||
|
||||
//! Computes the point, the first and second
|
||||
//! derivatives on the surface.
|
||||
//! Raised if the continuity of the current
|
||||
|
@@ -30,34 +30,6 @@ IMPLEMENT_STANDARD_RTTIEXT(Adaptor3d_TopolTool,Standard_Transient)
|
||||
|
||||
#define myInfinite Precision::Infinite()
|
||||
|
||||
static void GetConeApexParam(const gp_Cone& C, Standard_Real& U, Standard_Real& V)
|
||||
{
|
||||
const gp_Ax3& Pos = C.Position();
|
||||
Standard_Real Radius = C.RefRadius();
|
||||
Standard_Real SAngle = C.SemiAngle();
|
||||
const gp_Pnt& P = C.Apex();
|
||||
|
||||
gp_Trsf T;
|
||||
T.SetTransformation (Pos);
|
||||
gp_Pnt Ploc = P.Transformed (T);
|
||||
|
||||
if(Ploc.X() ==0.0 && Ploc.Y()==0.0 ) {
|
||||
U = 0.0;
|
||||
}
|
||||
else if ( -Radius > Ploc.Z()* Tan(SAngle) ) {
|
||||
// the point is at the `wrong` side of the apex
|
||||
U = atan2(-Ploc.Y(), -Ploc.X());
|
||||
}
|
||||
else {
|
||||
U = atan2(Ploc.Y(),Ploc.X());
|
||||
}
|
||||
if (U < -1.e-16) U += (M_PI+M_PI);
|
||||
else if (U < 0) U = 0;
|
||||
|
||||
V = sin(SAngle) * ( Ploc.X() * cos(U) + Ploc.Y() * sin(U) - Radius)
|
||||
+ cos(SAngle) * Ploc.Z();
|
||||
}
|
||||
|
||||
|
||||
Adaptor3d_TopolTool::Adaptor3d_TopolTool ()
|
||||
: myNbSamplesU(-1),
|
||||
@@ -1376,3 +1348,39 @@ Standard_Boolean Adaptor3d_TopolTool::IsUniformSampling() const
|
||||
return Standard_False;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetConeApexParam
|
||||
//purpose : Computes the cone's apex parameters
|
||||
//=======================================================================
|
||||
void Adaptor3d_TopolTool::GetConeApexParam (const gp_Cone& theC, Standard_Real& theU, Standard_Real& theV)
|
||||
{
|
||||
const gp_Ax3& Pos = theC.Position();
|
||||
Standard_Real Radius = theC.RefRadius();
|
||||
Standard_Real SAngle = theC.SemiAngle();
|
||||
const gp_Pnt& P = theC.Apex();
|
||||
|
||||
gp_Trsf T;
|
||||
T.SetTransformation(Pos);
|
||||
gp_Pnt Ploc = P.Transformed(T);
|
||||
|
||||
if (Ploc.X() == 0.0 && Ploc.Y() == 0.0)
|
||||
{
|
||||
theU = 0.0;
|
||||
}
|
||||
else if (-Radius > Ploc.Z() * Tan(SAngle))
|
||||
{
|
||||
// the point is at the `wrong` side of the apex
|
||||
theU = atan2(-Ploc.Y(), -Ploc.X());
|
||||
}
|
||||
else
|
||||
{
|
||||
theU = atan2(Ploc.Y(), Ploc.X());
|
||||
}
|
||||
|
||||
if (theU < -1.e-16) theU += (M_PI + M_PI);
|
||||
else if (theU < 0) theU = 0;
|
||||
|
||||
theV = sin(SAngle) * (Ploc.X() * cos(theU) + Ploc.Y() * sin(theU) - Radius)
|
||||
+ cos(SAngle) * Ploc.Z();
|
||||
}
|
||||
|
@@ -146,6 +146,12 @@ public:
|
||||
//! Returns true if provide uniform sampling of points.
|
||||
Standard_EXPORT virtual Standard_Boolean IsUniformSampling() const;
|
||||
|
||||
//! Computes the cone's apex parameters.
|
||||
//! @param[in] theC conical surface
|
||||
//! @param[in] theU U parameter of cone's apex
|
||||
//! @param[in] theV V parameter of cone's apex
|
||||
Standard_EXPORT static void GetConeApexParam (const gp_Cone& theC, Standard_Real& theU, Standard_Real& theV);
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Adaptor3d_TopolTool,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
@@ -108,7 +108,7 @@ void Approx_SameParameter_Evaluator::Evaluate (Standard_Integer *,/*Dimension*/
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void ProjectPointOnCurve(const Standard_Real InitValue,
|
||||
const gp_Pnt APoint,
|
||||
const gp_Pnt& APoint,
|
||||
const Standard_Real Tolerance,
|
||||
const Standard_Integer NumIteration,
|
||||
const Adaptor3d_Curve& Curve,
|
||||
@@ -526,6 +526,8 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
}
|
||||
myDone = Standard_True;
|
||||
}
|
||||
|
||||
myCurveOnSurface = Handle(Adaptor3d_CurveOnSurface)::DownCast(aData.myCOnS.ShallowCopy());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -81,6 +81,21 @@ public:
|
||||
return myCurve2d;
|
||||
}
|
||||
|
||||
//! Returns the 3D curve that has the same parameter as
|
||||
//! the 3D curve once evaluated on the surface up to the
|
||||
//! specified tolerance.
|
||||
Handle(Adaptor3d_Curve) Curve3d() const
|
||||
{
|
||||
return myC3d;
|
||||
}
|
||||
|
||||
//! Returns the 3D curve on surface that has the same parameter as
|
||||
//! the 3D curve up to the specified tolerance.
|
||||
Handle(Adaptor3d_CurveOnSurface) CurveOnSurface() const
|
||||
{
|
||||
return myCurveOnSurface;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! Internal data structure to unify access to the most actively used data.
|
||||
@@ -176,6 +191,7 @@ private:
|
||||
Handle(Adaptor2d_Curve2d) myHCurve2d;
|
||||
Handle(Adaptor3d_Curve) myC3d;
|
||||
Handle(Adaptor3d_Surface) mySurf;
|
||||
Handle(Adaptor3d_CurveOnSurface) myCurveOnSurface;
|
||||
};
|
||||
|
||||
#endif // _Approx_SameParameter_HeaderFile
|
||||
|
@@ -40,18 +40,58 @@ class Aspect_Window : public Standard_Transient
|
||||
DEFINE_STANDARD_RTTIEXT(Aspect_Window, Standard_Transient)
|
||||
public:
|
||||
|
||||
//! Modifies the window background.
|
||||
Standard_EXPORT void SetBackground (const Aspect_Background& ABack);
|
||||
//! Returns True if the window <me> is virtual
|
||||
Standard_EXPORT Standard_Boolean IsVirtual() const;
|
||||
|
||||
//! Setup the virtual state
|
||||
Standard_EXPORT void SetVirtual (const Standard_Boolean theVirtual);
|
||||
|
||||
//! Returns window top-left corner.
|
||||
Graphic3d_Vec2i TopLeft() const
|
||||
{
|
||||
Graphic3d_Vec2i aTopLeft, aBotRight;
|
||||
Position (aTopLeft.x(), aTopLeft.y(), aBotRight.x(), aBotRight.y());
|
||||
return aTopLeft;
|
||||
}
|
||||
|
||||
//! Returns window dimensions.
|
||||
Graphic3d_Vec2i Dimensions() const
|
||||
{
|
||||
Graphic3d_Vec2i aSize;
|
||||
Size (aSize.x(), aSize.y());
|
||||
return aSize;
|
||||
}
|
||||
|
||||
//! Returns connection to Display or NULL.
|
||||
const Handle(Aspect_DisplayConnection)& DisplayConnection() const { return myDisplay; }
|
||||
|
||||
//! Returns the window background.
|
||||
Standard_EXPORT Aspect_Background Background() const;
|
||||
|
||||
//! Returns the current image background fill mode.
|
||||
Standard_EXPORT Aspect_FillMethod BackgroundFillMethod() const;
|
||||
|
||||
//! Returns the window gradient background.
|
||||
Standard_EXPORT Aspect_GradientBackground GradientBackground() const;
|
||||
|
||||
//! Modifies the window background.
|
||||
Standard_EXPORT void SetBackground (const Quantity_Color& color);
|
||||
Standard_EXPORT void SetBackground (const Aspect_Background& theBack);
|
||||
|
||||
//! Modifies the window background.
|
||||
Standard_EXPORT void SetBackground (const Quantity_Color& theColor);
|
||||
|
||||
//! Modifies the window gradient background.
|
||||
Standard_EXPORT void SetBackground (const Aspect_GradientBackground& ABackground);
|
||||
Standard_EXPORT void SetBackground (const Aspect_GradientBackground& theBackground);
|
||||
|
||||
//! Modifies the window gradient background.
|
||||
Standard_EXPORT void SetBackground (const Quantity_Color& theFirstColor, const Quantity_Color& theSecondColor, const Aspect_GradientFillMethod theFillMethod);
|
||||
|
||||
public:
|
||||
|
||||
//! Returns True if the window <me> is opened
|
||||
//! and False if the window is closed.
|
||||
Standard_EXPORT virtual Standard_Boolean IsMapped() const = 0;
|
||||
|
||||
//! Opens the window <me>.
|
||||
Standard_EXPORT virtual void Map() const = 0;
|
||||
|
||||
@@ -65,25 +105,6 @@ public:
|
||||
//! and returns TRUE if the window is mapped at screen.
|
||||
Standard_EXPORT virtual Standard_Boolean DoMapping() const = 0;
|
||||
|
||||
//! Returns the window background.
|
||||
Standard_EXPORT Aspect_Background Background() const;
|
||||
|
||||
//! Returns the current image background fill mode.
|
||||
Standard_EXPORT Aspect_FillMethod BackgroundFillMethod() const;
|
||||
|
||||
//! Returns the window gradient background.
|
||||
Standard_EXPORT Aspect_GradientBackground GradientBackground() const;
|
||||
|
||||
//! Returns True if the window <me> is opened
|
||||
//! and False if the window is closed.
|
||||
Standard_EXPORT virtual Standard_Boolean IsMapped() const = 0;
|
||||
|
||||
//! Returns True if the window <me> is virtual
|
||||
Standard_EXPORT Standard_Boolean IsVirtual() const;
|
||||
|
||||
//! Setup the virtual state
|
||||
Standard_EXPORT void SetVirtual (const Standard_Boolean theVirtual);
|
||||
|
||||
//! Returns The Window RATIO equal to the physical
|
||||
//! WIDTH/HEIGHT dimensions
|
||||
Standard_EXPORT virtual Standard_Real Ratio() const = 0;
|
||||
@@ -103,9 +124,6 @@ public:
|
||||
//! Returns native Window FB config (GLXFBConfig on Xlib)
|
||||
Standard_EXPORT virtual Aspect_FBConfig NativeFBConfig() const = 0;
|
||||
|
||||
//! Returns connection to Display or NULL.
|
||||
const Handle(Aspect_DisplayConnection)& DisplayConnection() const { return myDisplay; }
|
||||
|
||||
//! Sets window title.
|
||||
virtual void SetTitle (const TCollection_AsciiString& theTitle) { (void )theTitle; }
|
||||
|
||||
|
@@ -525,7 +525,7 @@ protected:
|
||||
Standard_EXPORT void UpdateEdgeTolerance(const Standard_Integer nE,
|
||||
const Standard_Real aTolNew);
|
||||
|
||||
Standard_EXPORT void RemovePaveBlocks(const TColStd_MapOfInteger theEdges);
|
||||
Standard_EXPORT void RemovePaveBlocks(const TColStd_MapOfInteger& theEdges);
|
||||
|
||||
Standard_EXPORT void CorrectToleranceOfSE();
|
||||
|
||||
|
@@ -3394,7 +3394,7 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
|
||||
//function : RemovePaveBlocks
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::RemovePaveBlocks(const TColStd_MapOfInteger theEdges)
|
||||
void BOPAlgo_PaveFiller::RemovePaveBlocks(const TColStd_MapOfInteger& theEdges)
|
||||
{
|
||||
// Remove all pave blocks referring to input edges:
|
||||
//
|
||||
|
@@ -141,17 +141,18 @@ public:
|
||||
virtual Standard_Real VPeriod() const Standard_OVERRIDE { return mySurf.VPeriod(); }
|
||||
|
||||
//! Computes the point of parameters U,V on the surface.
|
||||
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
|
||||
Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Computes the point of parameters U,V on the surface.
|
||||
Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
|
||||
|
||||
//! Computes the point and the first derivatives on
|
||||
//! the surface.
|
||||
//! Raised if the continuity of the current
|
||||
//! intervals is not C1.
|
||||
|
||||
//! Computes the point and the first derivatives on the surface.
|
||||
//! Raised if the continuity of the current intervals is not C1.
|
||||
//!
|
||||
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
|
||||
Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Computes the point, the first and second
|
||||
//! derivatives on the surface.
|
||||
//! Raised if the continuity of the current
|
||||
|
@@ -15,8 +15,13 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepAdaptor_Curve2d.hxx>
|
||||
#include <BRepAlgo.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
#include <BRepLib_MakeEdge.hxx>
|
||||
@@ -25,10 +30,13 @@
|
||||
#include <ElCLib.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Geom2dConvert_ApproxArcsSegments.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <GeomConvert.hxx>
|
||||
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
|
||||
#include <GeomLProp.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <ShapeFix_Shape.hxx>
|
||||
@@ -40,6 +48,7 @@
|
||||
#include <TColStd_SequenceOfBoolean.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
@@ -47,6 +56,166 @@
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
|
||||
// The minimal tolerance of approximation (edges can be defined with yet smaller tolerance)
|
||||
static const Standard_Real MINIMAL_TOLERANCE = 0.0001;
|
||||
|
||||
namespace {
|
||||
|
||||
struct OrientedCurve
|
||||
{
|
||||
Handle(Geom2d_TrimmedCurve) Curve;
|
||||
Standard_Boolean IsReverse;
|
||||
inline gp_Pnt2d Point (const Standard_Boolean isEnd) const
|
||||
{
|
||||
if (isEnd == IsReverse)
|
||||
return Curve->StartPoint();
|
||||
return Curve->EndPoint();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ConvertWire
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Wire BRepAlgo::ConvertWire(const TopoDS_Wire& theWire,
|
||||
const Standard_Real theAngleTol,
|
||||
const TopoDS_Face& theFace)
|
||||
{
|
||||
TopoDS_Wire aResult;
|
||||
Standard_Real aMaxTol(0.);
|
||||
const Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace);
|
||||
NCollection_Vector<OrientedCurve> vecCurve;
|
||||
|
||||
BRepTools_WireExplorer anExpE(theWire, theFace);
|
||||
// Explore the edges in the current wire, in their connection order
|
||||
for (; anExpE.More(); anExpE.Next()) {
|
||||
const TopoDS_Edge& anEdge = anExpE.Current();
|
||||
BRepAdaptor_Curve2d aCurve(anEdge, theFace);
|
||||
Standard_Real aTol = BRep_Tool::Tolerance(anEdge);
|
||||
if (aTol < MINIMAL_TOLERANCE)
|
||||
aTol = MINIMAL_TOLERANCE;
|
||||
if (aTol > aMaxTol)
|
||||
aMaxTol = aTol;
|
||||
Geom2dConvert_ApproxArcsSegments anAlgo(aCurve, aTol, theAngleTol);
|
||||
const TColGeom2d_SequenceOfCurve& aResultApprox = anAlgo.GetResult();
|
||||
|
||||
// Form the array of approximated elementary curves
|
||||
if (anEdge.Orientation() == TopAbs_REVERSED) {
|
||||
for (Standard_Integer iCrv = aResultApprox.Length(); iCrv > 0 ; iCrv--) {
|
||||
const Handle(Geom2d_Curve)& aCrv = aResultApprox(iCrv);
|
||||
if (aCrv.IsNull() == Standard_False) {
|
||||
OrientedCurve& anOCurve = vecCurve.Append(OrientedCurve());
|
||||
anOCurve.Curve = Handle(Geom2d_TrimmedCurve)::DownCast(aCrv);
|
||||
anOCurve.IsReverse = Standard_True;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Standard_Integer iCrv = 1; iCrv <= aResultApprox.Length(); iCrv++) {
|
||||
const Handle(Geom2d_Curve)& aCrv = aResultApprox(iCrv);
|
||||
if (aCrv.IsNull() == Standard_False) {
|
||||
OrientedCurve& anOCurve = vecCurve.Append(OrientedCurve());
|
||||
anOCurve.Curve = Handle(Geom2d_TrimmedCurve)::DownCast(aCrv);
|
||||
anOCurve.IsReverse = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vecCurve.Length() > 0)
|
||||
{
|
||||
// Build the first vertex
|
||||
BRep_Builder aVBuilder;
|
||||
gp_Pnt2d aPnt[2] = {
|
||||
vecCurve(0).Point(Standard_False),
|
||||
vecCurve(vecCurve.Length() - 1).Point(Standard_True)
|
||||
};
|
||||
Standard_Real aDist = aPnt[0].Distance(aPnt[1]);
|
||||
if (aDist > aMaxTol + Precision::Confusion())
|
||||
aDist = Precision::Confusion();
|
||||
else {
|
||||
aDist = 0.5 * aDist + Precision::Confusion();
|
||||
aPnt[0] = 0.5 * (aPnt[0].XY() + aPnt[1].XY());
|
||||
}
|
||||
gp_Pnt aPnt3d;
|
||||
aSurf->D0(aPnt[0].X(), aPnt[0].Y(), aPnt3d);
|
||||
TopoDS_Vertex aFirstVertex;
|
||||
aVBuilder.MakeVertex(aFirstVertex, aPnt3d, aDist);
|
||||
|
||||
// Loop creating edges
|
||||
BRepBuilderAPI_MakeWire aMkWire;
|
||||
TopoDS_Edge anEdgeRes;
|
||||
TopoDS_Vertex aVertex = aFirstVertex;
|
||||
for (Standard_Integer iCrv = 0; iCrv < vecCurve.Length(); iCrv++) {
|
||||
const OrientedCurve& anOCurve = vecCurve(iCrv);
|
||||
TopoDS_Vertex aNextVertex;
|
||||
aPnt[0] = anOCurve.Point(Standard_True);
|
||||
if (iCrv == vecCurve.Length() - 1) {
|
||||
aPnt[1] = vecCurve(0).Point(Standard_False);
|
||||
aDist = aPnt[0].Distance(aPnt[1]);
|
||||
if (aDist > aMaxTol + Precision::Confusion()) {
|
||||
aSurf->D0(aPnt[0].X(), aPnt[0].Y(), aPnt3d);
|
||||
aVBuilder.MakeVertex(aNextVertex, aPnt3d, Precision::Confusion());
|
||||
} else {
|
||||
aNextVertex = aFirstVertex;
|
||||
}
|
||||
} else {
|
||||
aPnt[1] = vecCurve(iCrv + 1).Point(Standard_False);
|
||||
aDist = 0.5 * (aPnt[0].Distance(aPnt[1])) + Precision::Confusion();
|
||||
aPnt[0] = 0.5 * (aPnt[0].XY() + aPnt[1].XY());
|
||||
aSurf->D0(aPnt[0].X(), aPnt[0].Y(), aPnt3d);
|
||||
aVBuilder.MakeVertex(aNextVertex, aPnt3d, aDist);
|
||||
}
|
||||
const Standard_Real aParam[2] = {
|
||||
anOCurve.Curve->FirstParameter(),
|
||||
anOCurve.Curve->LastParameter()
|
||||
};
|
||||
if (anOCurve.IsReverse) {
|
||||
BRepBuilderAPI_MakeEdge aMkEdge(anOCurve.Curve, aSurf, aNextVertex,
|
||||
aVertex, aParam[0], aParam[1]);
|
||||
anEdgeRes = aMkEdge.Edge();
|
||||
anEdgeRes.Orientation(TopAbs_REVERSED);
|
||||
} else {
|
||||
BRepBuilderAPI_MakeEdge aMkEdge(anOCurve.Curve, aSurf, aVertex,
|
||||
aNextVertex, aParam[0], aParam[1]);
|
||||
anEdgeRes = aMkEdge.Edge();
|
||||
}
|
||||
aVertex = aNextVertex;
|
||||
aMkWire.Add(anEdgeRes);
|
||||
}
|
||||
|
||||
if (aMkWire.IsDone())
|
||||
aResult = aMkWire.Wire();
|
||||
}
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ConvertFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Face BRepAlgo::ConvertFace (const TopoDS_Face& theFace,
|
||||
const Standard_Real theAngleTolerance)
|
||||
{
|
||||
TopoDS_Face aResult;
|
||||
const Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace);
|
||||
BRepBuilderAPI_MakeFace aMkFace(aSurf,Precision::Confusion());
|
||||
|
||||
TopExp_Explorer anExp(theFace, TopAbs_WIRE);
|
||||
for (; anExp.More(); anExp.Next()) {
|
||||
const TopoDS_Wire& aWire = TopoDS::Wire(anExp.Current());
|
||||
const TopoDS_Wire aNewWire = ConvertWire(aWire, theAngleTolerance, theFace);
|
||||
aMkFace.Add(aNewWire);
|
||||
}
|
||||
if (aMkFace.IsDone()) {
|
||||
aResult = aMkFace.Face();
|
||||
}
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ConcatenateWire
|
||||
//purpose :
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
class TopoDS_Wire;
|
||||
class TopoDS_Edge;
|
||||
class TopoDS_Face;
|
||||
class TopoDS_Shape;
|
||||
|
||||
|
||||
@@ -43,6 +44,28 @@ public:
|
||||
//! Junction points between edges of wire may be sharp,
|
||||
//! resulting curve of the resulting edge may be C0.
|
||||
Standard_EXPORT static TopoDS_Edge ConcatenateWireC0 (const TopoDS_Wire& Wire);
|
||||
|
||||
//! Method of wire conversion, calls BRepAlgo_Approx internally.
|
||||
//! @param theWire
|
||||
//! Input Wire object.
|
||||
//! @param theAngleTolerance
|
||||
//! Angle (in radians) defining the continuity of the wire: if two vectors
|
||||
//! differ by less than this angle, the result will be smooth (zero angle of
|
||||
//! tangent lines between curve elements).
|
||||
//! @return
|
||||
//! The new TopoDS_Wire object consisting of edges each representing an arc
|
||||
//! of circle or a linear segment. The accuracy of conversion is defined
|
||||
//! as the maximal tolerance of edges in theWire.
|
||||
static Standard_EXPORT TopoDS_Wire ConvertWire
|
||||
(const TopoDS_Wire& theWire,
|
||||
const Standard_Real theAngleTolerance,
|
||||
const TopoDS_Face& theFace);
|
||||
|
||||
//! Method of face conversion. The API corresponds to the method ConvertWire.
|
||||
//! This is a shortcut for calling ConvertWire() for each wire in theFace.
|
||||
static Standard_EXPORT TopoDS_Face ConvertFace
|
||||
(const TopoDS_Face& theFace,
|
||||
const Standard_Real theAngleTolerance);
|
||||
|
||||
//! Checks if the shape is "correct". If not, returns
|
||||
//! <Standard_False>, else returns <Standard_True>.
|
||||
|
@@ -334,7 +334,7 @@ void BRepAlgo_NormalProjection::SetDefaultParams()
|
||||
|
||||
if(Only2d && Only3d) {
|
||||
BRepLib_MakeEdge MKed(GeomAdaptor::MakeCurve(hcur->Curve()),
|
||||
Ufin, Udeb);
|
||||
Udeb, Ufin);
|
||||
prj = MKed.Edge();
|
||||
BB.UpdateEdge(TopoDS::Edge(prj),
|
||||
PCur2d,
|
||||
|
@@ -15,186 +15,8 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <BRepTools_Modification.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
|
||||
namespace {
|
||||
|
||||
//! Tool class implementing necessary functionality for copying geometry
|
||||
class BRepBuilderAPI_Copy_Modification : public BRepTools_Modification
|
||||
{
|
||||
public:
|
||||
BRepBuilderAPI_Copy_Modification (const Standard_Boolean copyGeom,
|
||||
const Standard_Boolean copyMesh)
|
||||
: myCopyGeom(copyGeom),
|
||||
myCopyMesh(copyMesh)
|
||||
{
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy face;
|
||||
//! copies surface if requested
|
||||
Standard_Boolean NewSurface (const TopoDS_Face& F, Handle(Geom_Surface)& S,
|
||||
TopLoc_Location& L, Standard_Real& Tol,
|
||||
Standard_Boolean& RevWires, Standard_Boolean& RevFace) Standard_OVERRIDE
|
||||
{
|
||||
S = BRep_Tool::Surface(F,L);
|
||||
Tol = BRep_Tool::Tolerance(F);
|
||||
RevWires = RevFace = Standard_False;
|
||||
|
||||
if ( ! S.IsNull() && myCopyGeom )
|
||||
S = Handle(Geom_Surface)::DownCast(S->Copy());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy triangulation;
|
||||
//! copies it if required
|
||||
Standard_Boolean NewTriangulation(const TopoDS_Face& F, Handle(Poly_Triangulation)& T) Standard_OVERRIDE
|
||||
{
|
||||
if (!myCopyMesh
|
||||
&& BRep_Tool::IsGeometric (F))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location L;
|
||||
T = BRep_Tool::Triangulation(F, L);
|
||||
|
||||
if (T.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
// mesh is copied if and only if the geometry need to be copied too
|
||||
if (myCopyGeom)
|
||||
T = T->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy edge;
|
||||
//! copies curves if requested
|
||||
Standard_Boolean NewCurve (const TopoDS_Edge& E, Handle(Geom_Curve)& C,
|
||||
TopLoc_Location& L, Standard_Real& Tol) Standard_OVERRIDE
|
||||
{
|
||||
Standard_Real f,l;
|
||||
C = BRep_Tool::Curve (E, L, f, l);
|
||||
Tol = BRep_Tool::Tolerance(E);
|
||||
|
||||
if ( ! C.IsNull() && myCopyGeom )
|
||||
C = Handle(Geom_Curve)::DownCast(C->Copy());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy polygon;
|
||||
//! copies it if required
|
||||
Standard_Boolean NewPolygon(const TopoDS_Edge& E, Handle(Poly_Polygon3D)& P) Standard_OVERRIDE
|
||||
{
|
||||
if (!myCopyMesh
|
||||
&& BRep_Tool::IsGeometric (E))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
P = BRep_Tool::Polygon3D(E, aLoc);
|
||||
|
||||
if (P.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
// polygon is copied if and only if the geometry need to be copied too
|
||||
if (myCopyGeom)
|
||||
P = P->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy polygon;
|
||||
//! copies it if required
|
||||
Standard_Boolean NewPolygonOnTriangulation(const TopoDS_Edge& E, const TopoDS_Face& F,
|
||||
Handle(Poly_PolygonOnTriangulation)& P) Standard_OVERRIDE
|
||||
{
|
||||
if (!myCopyMesh
|
||||
&& BRep_Tool::IsGeometric (E))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Poly_Triangulation) aTria = BRep_Tool::Triangulation(F, aLoc);
|
||||
P = BRep_Tool::PolygonOnTriangulation(E, aTria, aLoc);
|
||||
|
||||
if (P.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
// polygon is copied if and only if the geometry need to be copied too
|
||||
if (myCopyGeom)
|
||||
P = P->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy vertex
|
||||
Standard_Boolean NewPoint (const TopoDS_Vertex& V, gp_Pnt& P,
|
||||
Standard_Real& Tol) Standard_OVERRIDE
|
||||
{
|
||||
P = BRep_Tool::Pnt(V);
|
||||
Tol = BRep_Tool::Tolerance(V);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy edge;
|
||||
//! copies pcurve if requested
|
||||
Standard_Boolean NewCurve2d (const TopoDS_Edge& E,
|
||||
const TopoDS_Face& F,
|
||||
const TopoDS_Edge& /*NewE*/,
|
||||
const TopoDS_Face& /*NewF*/,
|
||||
Handle(Geom2d_Curve)& C,
|
||||
Standard_Real& Tol) Standard_OVERRIDE
|
||||
{
|
||||
Tol = BRep_Tool::Tolerance(E);
|
||||
Standard_Real f, l;
|
||||
C = BRep_Tool::CurveOnSurface (E, F, f, l);
|
||||
|
||||
if ( ! C.IsNull() && myCopyGeom )
|
||||
C = Handle(Geom2d_Curve)::DownCast (C->Copy());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy vertex
|
||||
Standard_Boolean NewParameter (const TopoDS_Vertex& V, const TopoDS_Edge& E,
|
||||
Standard_Real& P, Standard_Real& Tol) Standard_OVERRIDE
|
||||
{
|
||||
if (V.IsNull()) return Standard_False; // infinite edge may have Null vertex
|
||||
|
||||
Tol = BRep_Tool::Tolerance(V);
|
||||
P = BRep_Tool::Parameter (V, E);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns the continuity of E between F1 and F2
|
||||
GeomAbs_Shape Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1,
|
||||
const TopoDS_Face& F2, const TopoDS_Edge&,
|
||||
const TopoDS_Face&, const TopoDS_Face&) Standard_OVERRIDE
|
||||
{
|
||||
return BRep_Tool::Continuity (E, F1, F2);
|
||||
}
|
||||
|
||||
public:
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepBuilderAPI_Copy_Modification,BRepTools_Modification)
|
||||
|
||||
private:
|
||||
Standard_Boolean myCopyGeom;
|
||||
Standard_Boolean myCopyMesh;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
#include <BRepTools_CopyModification.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepBuilderAPI_Copy
|
||||
@@ -203,7 +25,7 @@ private:
|
||||
|
||||
BRepBuilderAPI_Copy::BRepBuilderAPI_Copy ()
|
||||
{
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(Standard_True, Standard_False);
|
||||
myModification = new BRepTools_CopyModification(Standard_True, Standard_False);
|
||||
}
|
||||
|
||||
|
||||
@@ -214,7 +36,7 @@ BRepBuilderAPI_Copy::BRepBuilderAPI_Copy ()
|
||||
|
||||
BRepBuilderAPI_Copy::BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_Boolean copyGeom, const Standard_Boolean copyMesh)
|
||||
{
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(copyGeom, copyMesh);
|
||||
myModification = new BRepTools_CopyModification(copyGeom, copyMesh);
|
||||
DoModif(S);
|
||||
}
|
||||
|
||||
@@ -226,7 +48,7 @@ BRepBuilderAPI_Copy::BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_B
|
||||
|
||||
void BRepBuilderAPI_Copy::Perform(const TopoDS_Shape& S, const Standard_Boolean copyGeom, const Standard_Boolean copyMesh)
|
||||
{
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(copyGeom, copyMesh);
|
||||
myModification = new BRepTools_CopyModification(copyGeom, copyMesh);
|
||||
NotDone(); // on force la copie si on vient deja d`en faire une
|
||||
DoModif(S);
|
||||
}
|
||||
|
247
src/BRepBuilderAPI/BRepBuilderAPI_MakeShapeOnMesh.cxx
Normal file
247
src/BRepBuilderAPI/BRepBuilderAPI_MakeShapeOnMesh.cxx
Normal file
@@ -0,0 +1,247 @@
|
||||
// Created on: 2022-06-30
|
||||
// Created by: Alexander MALYSHEV
|
||||
// Copyright (c) 2022-2022 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 <BRepBuilderAPI_MakeShapeOnMesh.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <NCollection_IndexedDataMap.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Structure representing mesh edge.
|
||||
struct Edge
|
||||
{
|
||||
//! Constructor. Sets edge nodes.
|
||||
Edge(const Standard_Integer TheIdx1,
|
||||
const Standard_Integer TheIdx2)
|
||||
: Idx1(Min(TheIdx1, TheIdx2)),
|
||||
Idx2(Max(TheIdx1, TheIdx2))
|
||||
{}
|
||||
|
||||
//! Comparison operator.
|
||||
Standard_Boolean operator<(const Edge& other) const
|
||||
{
|
||||
if (Idx1 < other.Idx1 ||
|
||||
(Idx1 == other.Idx1 && Idx2 < other.Idx2))
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//! First index. It is lower or equal than the second.
|
||||
Standard_Integer Idx1;
|
||||
|
||||
//! Second index.
|
||||
Standard_Integer Idx2;
|
||||
};
|
||||
|
||||
//! Hasher of Edge structure.
|
||||
struct EdgeHasher
|
||||
{
|
||||
|
||||
//! Returns hash code for the given edge.
|
||||
static Standard_Integer HashCode(const Edge& theEdge,
|
||||
const Standard_Integer theUpperBound)
|
||||
{
|
||||
// Circle-based collisions.
|
||||
return ::HashCode(theEdge.Idx1 * theEdge.Idx1 + theEdge.Idx2 * theEdge.Idx2, theUpperBound);
|
||||
}
|
||||
|
||||
//! Returns true if two edges are equal.
|
||||
static Standard_Boolean IsEqual(const Edge& theEdge1,
|
||||
const Edge& theEdge2)
|
||||
{
|
||||
return theEdge1.Idx1 == theEdge2.Idx1 && theEdge1.Idx2 == theEdge2.Idx2;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Build
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepBuilderAPI_MakeShapeOnMesh::Build(const Message_ProgressRange& theRange)
|
||||
{
|
||||
// Generally, this method guarantees topology sharing by mapping mesh primitives
|
||||
// into topological counterparts.
|
||||
// mesh points -> topological vertices
|
||||
// mesh edges -> topological edges
|
||||
|
||||
// Cannot reconstruct anything from null or empty mesh.
|
||||
if (myMesh.IsNull() || myMesh->NbNodes() == 0 || myMesh->NbTriangles() == 0)
|
||||
return;
|
||||
|
||||
const Standard_Integer aNbNodes = myMesh->NbNodes();
|
||||
const Standard_Integer aNbTriangles = myMesh->NbTriangles();
|
||||
|
||||
// We are going to have three loops: iterate once over nodes and iterate twice
|
||||
// over triangles of input mesh.
|
||||
Message_ProgressScope aPS(theRange,
|
||||
"Per-facet shape construction",
|
||||
Standard_Real(aNbNodes + 2 * aNbTriangles));
|
||||
|
||||
// Build shared vertices.
|
||||
NCollection_IndexedDataMap<Standard_Integer, TopoDS_Vertex> aPnt2VertexMap;
|
||||
|
||||
for (Standard_Integer i = 1; i <= aNbNodes; ++i)
|
||||
{
|
||||
aPS.Next();
|
||||
if (aPS.UserBreak())
|
||||
return;
|
||||
|
||||
const gp_Pnt aP = myMesh->Node(i);
|
||||
const TopoDS_Vertex aV = BRepBuilderAPI_MakeVertex(aP);
|
||||
aPnt2VertexMap.Add(i, aV);
|
||||
}
|
||||
|
||||
// Build shared edges.
|
||||
NCollection_IndexedDataMap<Edge, TopoDS_Edge, EdgeHasher> anEdgeToTEgeMap;
|
||||
for (Standard_Integer i = 1; i <= aNbTriangles; ++i)
|
||||
{
|
||||
aPS.Next();
|
||||
if (aPS.UserBreak())
|
||||
return;
|
||||
|
||||
Standard_Integer anIdx[3];
|
||||
const Poly_Triangle& aTriangle = myMesh->Triangle(i);
|
||||
aTriangle.Get(anIdx[0], anIdx[1], anIdx[2]);
|
||||
|
||||
// Skip degenerated triangles.
|
||||
if (anIdx[0] == anIdx[1] || anIdx[0] == anIdx[2] || anIdx[1] == anIdx[2])
|
||||
continue;
|
||||
|
||||
const gp_Pnt aP1 = myMesh->Node(anIdx[0]);
|
||||
const gp_Pnt aP2 = myMesh->Node(anIdx[1]);
|
||||
const gp_Pnt aP3 = myMesh->Node(anIdx[2]);
|
||||
const Standard_Real aD1 = aP1.SquareDistance(aP2);
|
||||
const Standard_Real aD2 = aP1.SquareDistance(aP3);
|
||||
const Standard_Real aD3 = aP2.SquareDistance(aP3);
|
||||
if (aD1 < gp::Resolution() ||
|
||||
aD2 < gp::Resolution() ||
|
||||
aD3 < gp::Resolution())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Edges are constructed in forward order for the existing normals orientation.
|
||||
// In Poly_Triangulation, positive direction is defined as cross product:
|
||||
// (aV1, aV2) x (aV1, aV3).
|
||||
const TopoDS_Vertex& aV1 = aPnt2VertexMap.FindFromKey(anIdx[0]);
|
||||
const TopoDS_Vertex& aV2 = aPnt2VertexMap.FindFromKey(anIdx[1]);
|
||||
const TopoDS_Vertex& aV3 = aPnt2VertexMap.FindFromKey(anIdx[2]);
|
||||
|
||||
const Edge aMeshEdge1(anIdx[0], anIdx[1]);
|
||||
const Edge aMeshEdge2(anIdx[1], anIdx[2]);
|
||||
const Edge aMeshEdge3(anIdx[2], anIdx[0]);
|
||||
|
||||
BRepBuilderAPI_MakeEdge aMaker1(aV1, aV2);
|
||||
BRepBuilderAPI_MakeEdge aMaker2(aV2, aV3);
|
||||
BRepBuilderAPI_MakeEdge aMaker3(aV3, aV1);
|
||||
|
||||
TopoDS_Edge aTE1 = aMaker1.Edge();
|
||||
if (anIdx[1] < anIdx[0])
|
||||
aTE1.Reverse();
|
||||
|
||||
TopoDS_Edge aTE2 = aMaker2.Edge();
|
||||
if (anIdx[2] < anIdx[1])
|
||||
aTE2.Reverse();
|
||||
|
||||
TopoDS_Edge aTE3 = aMaker3.Edge();
|
||||
if (anIdx[0] < anIdx[2])
|
||||
aTE3.Reverse();
|
||||
|
||||
anEdgeToTEgeMap.Add(aMeshEdge1, aTE1);
|
||||
anEdgeToTEgeMap.Add(aMeshEdge2, aTE2);
|
||||
anEdgeToTEgeMap.Add(aMeshEdge3, aTE3);
|
||||
}
|
||||
|
||||
// Construct planar faces using shared topology.
|
||||
TopoDS_Compound aResult;
|
||||
BRep_Builder aBB;
|
||||
aBB.MakeCompound(aResult);
|
||||
for (Standard_Integer i = 1; i <= aNbTriangles; ++i)
|
||||
{
|
||||
aPS.Next();
|
||||
if (aPS.UserBreak())
|
||||
return;
|
||||
|
||||
Standard_Integer anIdx[3];
|
||||
const Poly_Triangle& aTriangle = myMesh->Triangle(i);
|
||||
aTriangle.Get(anIdx[0], anIdx[1], anIdx[2]);
|
||||
|
||||
const Edge aMeshEdge1(anIdx[0], anIdx[1]);
|
||||
const Edge aMeshEdge2(anIdx[1], anIdx[2]);
|
||||
const Edge aMeshEdge3(anIdx[2], anIdx[0]);
|
||||
const Standard_Boolean isReversed1 = anIdx[1] < anIdx[0];
|
||||
const Standard_Boolean isReversed2 = anIdx[2] < anIdx[1];
|
||||
const Standard_Boolean isReversed3 = anIdx[0] < anIdx[2];
|
||||
|
||||
// Edges can be skipped in case of mesh defects - topologically or geometrically
|
||||
// degenerated triangles.
|
||||
const Standard_Boolean aHasAllEdges = anEdgeToTEgeMap.Contains(aMeshEdge1) &&
|
||||
anEdgeToTEgeMap.Contains(aMeshEdge2) &&
|
||||
anEdgeToTEgeMap.Contains(aMeshEdge3) ;
|
||||
if (!aHasAllEdges)
|
||||
continue;
|
||||
|
||||
TopoDS_Edge aTEdge1 = anEdgeToTEgeMap.FindFromKey(aMeshEdge1);
|
||||
if (isReversed1)
|
||||
aTEdge1.Reverse();
|
||||
TopoDS_Edge aTEdge2 = anEdgeToTEgeMap.FindFromKey(aMeshEdge2);
|
||||
if (isReversed2)
|
||||
aTEdge2.Reverse();
|
||||
TopoDS_Edge aTEdge3 = anEdgeToTEgeMap.FindFromKey(aMeshEdge3);
|
||||
if (isReversed3)
|
||||
aTEdge3.Reverse();
|
||||
|
||||
BRepBuilderAPI_MakeWire aWireMaker;
|
||||
aWireMaker.Add(aTEdge1);
|
||||
aWireMaker.Add(aTEdge2);
|
||||
aWireMaker.Add(aTEdge3);
|
||||
const TopoDS_Wire aWire = aWireMaker.Wire();
|
||||
|
||||
// Construct plane explicitly since it is faster than automatic construction
|
||||
// within BRepBuilderAPI_MakeFace.
|
||||
BRepAdaptor_Curve aC1(aTEdge1);
|
||||
BRepAdaptor_Curve aC2(aTEdge2);
|
||||
const gp_Dir aD1 = aC1.Line().Direction();
|
||||
const gp_Dir aD2 = aC2.Line().Direction();
|
||||
gp_XYZ aN = aD1.XYZ().Crossed(aD2.XYZ());
|
||||
if (aN.SquareModulus() < Precision::SquareConfusion())
|
||||
continue;
|
||||
if (aTEdge1.Orientation() == TopAbs_REVERSED)
|
||||
aN.Reverse();
|
||||
if (aTEdge2.Orientation() == TopAbs_REVERSED)
|
||||
aN.Reverse();
|
||||
const gp_Dir aNorm(aN);
|
||||
gp_Pln aPln(myMesh->Node(anIdx[0]), aNorm);
|
||||
|
||||
BRepBuilderAPI_MakeFace aFaceMaker(aPln, aWire);
|
||||
const TopoDS_Face aFace = aFaceMaker.Face();
|
||||
|
||||
aBB.Add(aResult, aFace);
|
||||
}
|
||||
|
||||
this->Done();
|
||||
myShape = aResult;
|
||||
}
|
46
src/BRepBuilderAPI/BRepBuilderAPI_MakeShapeOnMesh.hxx
Normal file
46
src/BRepBuilderAPI/BRepBuilderAPI_MakeShapeOnMesh.hxx
Normal file
@@ -0,0 +1,46 @@
|
||||
// Created on: 2022-06-30
|
||||
// Created by: Alexander MALYSHEV
|
||||
// Copyright (c) 2022-2022 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 _BRepBuilderAPI_MakeShapeOnMesh_HeaderFile
|
||||
#define _BRepBuilderAPI_MakeShapeOnMesh_HeaderFile
|
||||
|
||||
#include <BRepBuilderAPI_MakeShape.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
|
||||
//! Builds shape on per-facet basis on the input mesh. Resulting shape has shared
|
||||
//! edges by construction, but no maximization (unify same domain) is applied.
|
||||
//! No generation history is provided.
|
||||
class BRepBuilderAPI_MakeShapeOnMesh : public BRepBuilderAPI_MakeShape
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Ctor. Sets mesh to process.
|
||||
//! @param theMesh [in] - Mesh to construct shape for.
|
||||
BRepBuilderAPI_MakeShapeOnMesh(const Handle(Poly_Triangulation)& theMesh)
|
||||
: myMesh(theMesh)
|
||||
{}
|
||||
|
||||
//! Builds shape on mesh.
|
||||
Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
Handle(Poly_Triangulation) myMesh;
|
||||
|
||||
};
|
||||
|
||||
#endif // _BRepBuilderAPI_MakeShapeOnMesh_HeaderFile
|
@@ -36,13 +36,14 @@ BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const gp_Trsf& T) :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const TopoDS_Shape& S,
|
||||
const gp_Trsf& T,
|
||||
const Standard_Boolean Copy) :
|
||||
myTrsf(T)
|
||||
BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const TopoDS_Shape& theShape,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theCopyGeom,
|
||||
const Standard_Boolean theCopyMesh)
|
||||
: myTrsf(theTrsf)
|
||||
{
|
||||
myModification = new BRepTools_TrsfModification(T);
|
||||
Perform(S,Copy);
|
||||
myModification = new BRepTools_TrsfModification(theTrsf);
|
||||
Perform(theShape, theCopyGeom, theCopyMesh);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,19 +53,21 @@ BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const TopoDS_Shape& S,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepBuilderAPI_Transform::Perform(const TopoDS_Shape& S,
|
||||
const Standard_Boolean Copy)
|
||||
void BRepBuilderAPI_Transform::Perform(const TopoDS_Shape& theShape,
|
||||
const Standard_Boolean theCopyGeom,
|
||||
const Standard_Boolean theCopyMesh)
|
||||
{
|
||||
myUseModif = Copy || myTrsf.IsNegative() || (Abs(Abs(myTrsf.ScaleFactor()) - 1.) > TopLoc_Location::ScalePrec());
|
||||
myUseModif = theCopyGeom || myTrsf.IsNegative() || (Abs(Abs(myTrsf.ScaleFactor()) - 1.) > TopLoc_Location::ScalePrec());
|
||||
if (myUseModif) {
|
||||
Handle(BRepTools_TrsfModification) theModif =
|
||||
Handle(BRepTools_TrsfModification)::DownCast(myModification);
|
||||
theModif->Trsf() = myTrsf;
|
||||
DoModif(S,myModification);
|
||||
theModif->IsCopyMesh() = theCopyMesh;
|
||||
DoModif(theShape, myModification);
|
||||
}
|
||||
else {
|
||||
myLocation = myTrsf;
|
||||
myShape = S.Moved(myLocation);
|
||||
myShape = theShape.Moved(myLocation);
|
||||
Done();
|
||||
}
|
||||
|
||||
|
@@ -50,28 +50,37 @@ public:
|
||||
//! to define the shape to transform.
|
||||
Standard_EXPORT BRepBuilderAPI_Transform(const gp_Trsf& T);
|
||||
|
||||
//! Creates a transformation from the gp_Trsf <T>, and
|
||||
//! applies it to the shape <S>. If the transformation
|
||||
//! Creates a transformation from the gp_Trsf <theTrsf>, and
|
||||
//! applies it to the shape <theShape>. If the transformation
|
||||
//! is direct and isometric (determinant = 1) and
|
||||
//! <Copy> = Standard_False, the resulting shape is
|
||||
//! <S> on which a new location has been set.
|
||||
//! <theCopyGeom> = Standard_False, the resulting shape is
|
||||
//! <theShape> on which a new location has been set.
|
||||
//! Otherwise, the transformation is applied on a
|
||||
//! duplication of <S>.
|
||||
Standard_EXPORT BRepBuilderAPI_Transform(const TopoDS_Shape& S, const gp_Trsf& T, const Standard_Boolean Copy = Standard_False);
|
||||
//! duplication of <theShape>.
|
||||
//! If <theCopyMesh> is true, the triangulation will be copied,
|
||||
//! and the copy will be assigned to the result shape.
|
||||
Standard_EXPORT BRepBuilderAPI_Transform(const TopoDS_Shape& theShape,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theCopyGeom = Standard_False,
|
||||
const Standard_Boolean theCopyMesh = Standard_False);
|
||||
|
||||
//! pplies the geometric transformation defined at the
|
||||
//! Applies the geometric transformation defined at the
|
||||
//! time of construction of this framework to the shape S.
|
||||
//! - If the transformation T is direct and isometric, in
|
||||
//! other words, if the determinant of the vectorial part
|
||||
//! of T is equal to 1., and if Copy equals false (the
|
||||
//! of T is equal to 1., and if theCopyGeom equals false (the
|
||||
//! default value), the resulting shape is the same as
|
||||
//! the original but with a new location assigned to it.
|
||||
//! - In all other cases, the transformation is applied to a duplicate of S.
|
||||
//! - In all other cases, the transformation is applied to a duplicate of theShape.
|
||||
//! - If theCopyMesh is true, the triangulation will be copied,
|
||||
//! and the copy will be assigned to the result shape.
|
||||
//! Use the function Shape to access the result.
|
||||
//! Note: this framework can be reused to apply the same
|
||||
//! geometric transformation to other shapes. You only
|
||||
//! need to specify them by calling the function Perform again.
|
||||
Standard_EXPORT void Perform (const TopoDS_Shape& S, const Standard_Boolean Copy = Standard_False);
|
||||
Standard_EXPORT void Perform (const TopoDS_Shape& theShape,
|
||||
const Standard_Boolean theCopyGeom = Standard_False,
|
||||
const Standard_Boolean theCopyMesh = Standard_False);
|
||||
|
||||
//! Returns the modified shape corresponding to <S>.
|
||||
Standard_EXPORT virtual TopoDS_Shape ModifiedShape (const TopoDS_Shape& S) const Standard_OVERRIDE;
|
||||
|
@@ -26,6 +26,8 @@ BRepBuilderAPI_MakePolygon.cxx
|
||||
BRepBuilderAPI_MakePolygon.hxx
|
||||
BRepBuilderAPI_MakeShape.cxx
|
||||
BRepBuilderAPI_MakeShape.hxx
|
||||
BRepBuilderAPI_MakeShapeOnMesh.cxx
|
||||
BRepBuilderAPI_MakeShapeOnMesh.hxx
|
||||
BRepBuilderAPI_MakeShell.cxx
|
||||
BRepBuilderAPI_MakeShell.hxx
|
||||
BRepBuilderAPI_MakeSolid.cxx
|
||||
|
@@ -197,10 +197,12 @@ Standard_Boolean CheckOn(IntRes2d_IntersectionPoint& thePntInter,
|
||||
if (aMinDist <= theTolZ) {
|
||||
IntRes2d_Transition aTrOnLin(IntRes2d_Head);
|
||||
IntRes2d_Position aPosOnCurve = IntRes2d_Middle;
|
||||
if (Abs(aPar - theDeb) <= Precision::Confusion()) {
|
||||
if ((Abs(aPar - theDeb) <= Precision::Confusion())
|
||||
|| (aPar < theDeb)) {
|
||||
aPosOnCurve = IntRes2d_Head;
|
||||
}
|
||||
else if (Abs(aPar - theFin) <= Precision::Confusion()) {
|
||||
else if ((Abs(aPar - theFin) <= Precision::Confusion())
|
||||
|| (aPar > theFin)) {
|
||||
aPosOnCurve = IntRes2d_End;
|
||||
}
|
||||
//
|
||||
@@ -381,8 +383,16 @@ void BRepClass_Intersector::Perform(const gp_Lin2d& L,
|
||||
{
|
||||
Standard_Boolean aStatusOn = Standard_False;
|
||||
IntRes2d_IntersectionPoint aPntInter;
|
||||
Standard_Real aDebTol = deb;
|
||||
Standard_Real aFinTol = fin;
|
||||
if (aTolZ > Precision::Confusion())
|
||||
{
|
||||
aDebTol = deb - aTolZ;
|
||||
aFinTol = fin + aTolZ;
|
||||
}
|
||||
Geom2dAdaptor_Curve aCurAdaptor(aC2D, aDebTol, aFinTol);
|
||||
|
||||
aStatusOn = CheckOn(aPntInter, F, L, C, aTolZ, fin, deb);
|
||||
aStatusOn = CheckOn(aPntInter, F, L, aCurAdaptor, aTolZ, fin, deb);
|
||||
if (aStatusOn)
|
||||
{
|
||||
Append(aPntInter);
|
||||
|
@@ -30,7 +30,6 @@
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Bnd_SeqOfBox.hxx>
|
||||
#include <BRepExtrema_UnCompatibleShape.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
|
@@ -81,7 +81,7 @@ void BRepExtrema_ExtCF::Perform(const TopoDS_Edge& E, const TopoDS_Face& F2)
|
||||
|
||||
BRepAdaptor_Curve Curv(E);
|
||||
Handle(BRepAdaptor_Curve) HC = new BRepAdaptor_Curve(Curv);
|
||||
myExtCS.Perform(HC->Curve(), U1, U2);
|
||||
myExtCS.Perform(*HC, U1, U2);
|
||||
|
||||
if(!myExtCS.IsDone())
|
||||
return;
|
||||
|
@@ -987,8 +987,8 @@ Standard_Integer SensOfPrism(const Handle(Geom_Curve) C,
|
||||
ASI1.Perform(scur);
|
||||
Standard_Integer sens = 1;
|
||||
if(ASI1.IsDone() && ASI1.NbPoints(1) >= 1) {
|
||||
if(ASI1.Point(1, 1).Parameter() < 0. &&
|
||||
ASI1.Point(1, ASI1.NbPoints(1)).Parameter() < 0.) {
|
||||
if(ASI1.Point(1, 1).Parameter() + Precision::Confusion() < 0. &&
|
||||
ASI1.Point(1, ASI1.NbPoints(1)).Parameter() + Precision::Confusion() < 0.) {
|
||||
sens = -1;
|
||||
}
|
||||
}
|
||||
|
@@ -1585,7 +1585,7 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
NbSamples = 4;
|
||||
gp_Pln FirstPlane;
|
||||
PlaneOfWire(TopoDS::Wire(myWork(ideb)), FirstPlane);
|
||||
gp_Pnt FirstBary = FirstPlane.Location();
|
||||
gp_Pnt PrevBary = FirstPlane.Location();
|
||||
gp_Vec NormalOfFirstPlane = FirstPlane.Axis().Direction();
|
||||
for (i = ideb+1; i <= ifin; i++)
|
||||
{
|
||||
@@ -1596,10 +1596,10 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
gp_Pln CurPlane;
|
||||
PlaneOfWire(aWire, CurPlane);
|
||||
gp_Pnt CurBary = CurPlane.Location();
|
||||
gp_Vec aVec(FirstBary, CurBary);
|
||||
gp_Vec aVec(PrevBary, CurBary);
|
||||
gp_Vec anOffsetProj = (aVec * NormalOfFirstPlane) * NormalOfFirstPlane;
|
||||
CurBary.Translate(-anOffsetProj); //projected current bary center
|
||||
gp_Vec Offset(CurBary, FirstBary);
|
||||
gp_Vec Offset(CurBary, PrevBary);
|
||||
|
||||
TopoDS_Wire newwire;
|
||||
BRep_Builder BB;
|
||||
@@ -1804,6 +1804,8 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
newwire.Closed( Standard_True );
|
||||
newwire.Orientation( TopAbs_FORWARD );
|
||||
myWork(i) = newwire;
|
||||
|
||||
PrevBary = CurBary;
|
||||
}
|
||||
#ifdef OCCT_DEBUG_EFV
|
||||
|
||||
|
@@ -85,6 +85,7 @@
|
||||
#include <TopTools_HArray2OfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <GeomLib_CheckCurveOnSurface.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
//#include <BRepFill_TrimCorner.hxx>
|
||||
@@ -289,6 +290,34 @@ static Standard_Boolean CheckSameParameter
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckSameParameterExact
|
||||
//purpose : Check a posteriori that sameparameter has worked correctly
|
||||
// with exact calculation method of edge tolerance
|
||||
//=======================================================================
|
||||
static Standard_Boolean CheckSameParameterExact
|
||||
(const Handle(Adaptor3d_Curve)& C3d,
|
||||
const Handle(Adaptor3d_CurveOnSurface)& curveOnSurface,
|
||||
const Standard_Real tol3d,
|
||||
Standard_Real& tolreached)
|
||||
{
|
||||
GeomLib_CheckCurveOnSurface aCheckCurveOnSurface(C3d);
|
||||
aCheckCurveOnSurface.SetParallel(Standard_False);
|
||||
aCheckCurveOnSurface.Perform(curveOnSurface);
|
||||
|
||||
tolreached = aCheckCurveOnSurface.MaxDistance();
|
||||
|
||||
if (tolreached > tol3d) {
|
||||
return Standard_False;
|
||||
}
|
||||
else
|
||||
{
|
||||
tolreached = Max(tolreached, Precision::Confusion());
|
||||
tolreached *= 1.05;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SameParameter
|
||||
//purpose : Encapsulation of Sameparameter
|
||||
@@ -340,8 +369,10 @@ static Standard_Boolean SameParameter(TopoDS_Edge& E,
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
ResTol = sp.TolReached();
|
||||
if(ResTol > tolreached ){
|
||||
Handle(Adaptor3d_Curve) curve3d = sp.Curve3d();
|
||||
Handle(Adaptor3d_CurveOnSurface) curveOnSurface = sp.CurveOnSurface();
|
||||
|
||||
if (!CheckSameParameterExact(curve3d, curveOnSurface, tol3d, ResTol) && ResTol > tolreached) {
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout<<"SameParameter : Tolerance not reached!"<<std::endl;
|
||||
std::cout<<"tol visee : "<<tol3d<<" tol obtained : "<<ResTol<<std::endl;
|
||||
@@ -861,7 +892,8 @@ static Standard_Boolean Filling(const TopoDS_Shape& EF,
|
||||
Prof2 = BRep_Tool::Curve(E2, f2, l2);
|
||||
|
||||
// Indeed, both Prof1 and Prof2 are the same curves but in different positions
|
||||
|
||||
// Prof1's param domain may equals to Prof2's param domain *(-1), which means EF.Orientation() == EL.Orientation()
|
||||
Standard_Boolean bSameCurveDomain = EF.Orientation() != EL.Orientation();
|
||||
gp_Pnt P1, P2, P;
|
||||
|
||||
// Choose the angle of opening
|
||||
@@ -887,7 +919,8 @@ static Standard_Boolean Filling(const TopoDS_Shape& EF,
|
||||
}
|
||||
}
|
||||
|
||||
const gp_Pnt aP2 = Prof2->Value(aPrm[aMaxIdx]).Transformed(aTf);
|
||||
const Standard_Real aPrm2[] = { f2, 0.5*(f2 + l2), l2 };
|
||||
const gp_Pnt aP2 = Prof2->Value(aPrm2[bSameCurveDomain ? aMaxIdx : 2 - aMaxIdx]).Transformed(aTf);
|
||||
const gp_Vec2d aV1(aP1[aMaxIdx].Z(), aP1[aMaxIdx].X());
|
||||
const gp_Vec2d aV2(aP2.Z(), aP2.X());
|
||||
if (aV1.SquareMagnitude() <= gp::Resolution() ||
|
||||
@@ -3251,7 +3284,7 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
|
||||
|
||||
Tang = T1 + T2; //Average direction
|
||||
gp_Dir NormalOfBisPlane = Tang;
|
||||
|
||||
gp_Vec anIntersectPointCrossDirection = T1.Crossed(T2);
|
||||
if (isTangent) {
|
||||
Sortant -= Tang.Dot(Tang)*Tang;
|
||||
}
|
||||
@@ -3298,7 +3331,7 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
|
||||
}
|
||||
}
|
||||
|
||||
BRepFill_TrimShellCorner aTrim(aFaces, Transition, AxeOfBisPlane);
|
||||
BRepFill_TrimShellCorner aTrim(aFaces, Transition, AxeOfBisPlane, anIntersectPointCrossDirection);
|
||||
aTrim.AddBounds(Bounds);
|
||||
aTrim.AddUEdges(aUEdges);
|
||||
aTrim.AddVEdges(myVEdges, Index);
|
||||
|
@@ -76,12 +76,14 @@ static Standard_Boolean FindCommonVertex(const TopoDS_Edge& theFirstEdge,
|
||||
static Standard_Boolean FindCommonVertex(const BOPDS_PDS& theDS,
|
||||
const Standard_Integer theEIndex1,
|
||||
const Standard_Integer theEIndex2,
|
||||
const gp_Vec& theCrossDirection,
|
||||
TopoDS_Vertex& theCommonVertex,
|
||||
Standard_Real& theParamOnE1,
|
||||
Standard_Real& theParamOnE2);
|
||||
|
||||
static Standard_Boolean SplitUEdges(const Handle(TopTools_HArray2OfShape)& theUEdges,
|
||||
const BOPDS_PDS& theDS,
|
||||
const gp_Vec& theCrossDirection,
|
||||
TopTools_DataMapOfShapeListOfShape& theHistMap);
|
||||
|
||||
static void StoreVedgeInHistMap(const Handle(TopTools_HArray1OfShape)& theVEdges,
|
||||
@@ -194,9 +196,11 @@ static void UpdateSectionEdge(TopoDS_Edge& theEdge,
|
||||
// ===========================================================================================
|
||||
BRepFill_TrimShellCorner::BRepFill_TrimShellCorner(const Handle(TopTools_HArray2OfShape)& theFaces,
|
||||
const BRepFill_TransitionStyle theTransition,
|
||||
const gp_Ax2& theAxeOfBisPlane) :
|
||||
const gp_Ax2& theAxeOfBisPlane,
|
||||
const gp_Vec& theIntPointCrossDir) :
|
||||
myTransition(theTransition),
|
||||
myAxeOfBisPlane(theAxeOfBisPlane),
|
||||
myIntPointCrossDir(theIntPointCrossDir),
|
||||
myDone(Standard_False),
|
||||
myHasSection(Standard_False)
|
||||
{
|
||||
@@ -309,7 +313,7 @@ void BRepFill_TrimShellCorner::Perform()
|
||||
BOPDS_VectorOfInterfFF& aFFs = theDS->InterfFF();
|
||||
Standard_Integer aNbFFs = aFFs.Length();
|
||||
|
||||
if(!SplitUEdges(myUEdges, theDS, myHistMap)) {
|
||||
if(!SplitUEdges(myUEdges, theDS, myIntPointCrossDir, myHistMap)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -425,7 +429,7 @@ BRepFill_TrimShellCorner::MakeFacesNonSec(const Standard_Integer
|
||||
Standard_Real apar1 = 0., apar2 = 0.;
|
||||
|
||||
Standard_Boolean bvertexfound =
|
||||
FindCommonVertex(theDS, anIndex1, anIndex2, aCommonVertex, apar1, apar2);
|
||||
FindCommonVertex(theDS, anIndex1, anIndex2, myIntPointCrossDir, aCommonVertex, apar1, apar2);
|
||||
// search common vertex between bounds. end
|
||||
|
||||
Handle(BRepTools_ReShape) aSubstitutor = new BRepTools_ReShape();
|
||||
@@ -697,9 +701,9 @@ BRepFill_TrimShellCorner::MakeFacesSec(const Standard_Integer
|
||||
|
||||
TopoDS_Vertex FirstVertex, LastVertex;
|
||||
Standard_Real ParamOnLeftE1, ParamOnLeftE2, ParamOnRightE1, ParamOnRightE2;
|
||||
FindCommonVertex(theDS, IndexOfLeftE1, IndexOfLeftE2,
|
||||
FindCommonVertex(theDS, IndexOfLeftE1, IndexOfLeftE2, myIntPointCrossDir,
|
||||
FirstVertex, ParamOnLeftE1, ParamOnLeftE2);
|
||||
FindCommonVertex(theDS, IndexOfRightE1, IndexOfRightE2,
|
||||
FindCommonVertex(theDS, IndexOfRightE1, IndexOfRightE2, myIntPointCrossDir,
|
||||
LastVertex, ParamOnRightE1, ParamOnRightE2);
|
||||
|
||||
TopoDS_Shape SecWire;
|
||||
@@ -1079,7 +1083,8 @@ Standard_Boolean BRepFill_TrimShellCorner::ChooseSection(const TopoDS_Shape& Com
|
||||
// purpose:
|
||||
// ------------------------------------------------------------------------------------------
|
||||
Standard_Boolean SplitUEdges(const Handle(TopTools_HArray2OfShape)& theUEdges,
|
||||
const BOPDS_PDS& theDS,
|
||||
const BOPDS_PDS& theDS,
|
||||
const gp_Vec& theCrossDirection,
|
||||
TopTools_DataMapOfShapeListOfShape& theHistMap) {
|
||||
|
||||
const BOPDS_VectorOfInterfVV& aVVs = theDS->InterfVV();
|
||||
@@ -1105,7 +1110,7 @@ Standard_Boolean SplitUEdges(const Handle(TopTools_HArray2OfShape)& theUEdge
|
||||
TopoDS_Vertex aCommonVertex;
|
||||
Standard_Real apar1 = 0., apar2 = 0.;
|
||||
Standard_Boolean bvertexfound =
|
||||
FindCommonVertex(theDS, anEIndex1, anEIndex2, aCommonVertex, apar1, apar2);
|
||||
FindCommonVertex(theDS, anEIndex1, anEIndex2, theCrossDirection, aCommonVertex, apar1, apar2);
|
||||
//
|
||||
if(!bvertexfound) {
|
||||
TopoDS_Vertex V1 = TopExp::LastVertex(TopoDS::Edge(aE1));
|
||||
@@ -1217,6 +1222,7 @@ void FindFreeVertices(const TopoDS_Shape& theShape,
|
||||
Standard_Boolean FindCommonVertex(const BOPDS_PDS& theDS,
|
||||
const Standard_Integer theEIndex1,
|
||||
const Standard_Integer theEIndex2,
|
||||
const gp_Vec& theCrossDirection,
|
||||
TopoDS_Vertex& theCommonVertex,
|
||||
Standard_Real& theParamOnE1,
|
||||
Standard_Real& theParamOnE2) {
|
||||
@@ -1227,6 +1233,10 @@ Standard_Boolean FindCommonVertex(const BOPDS_PDS& theDS,
|
||||
TopoDS_Vertex aCommonVertex;
|
||||
Standard_Integer eeit = 0;
|
||||
|
||||
TopoDS_Edge theE1 = TopoDS::Edge(theDS->Shape(theEIndex1));
|
||||
TopoDS_Edge theE2 = TopoDS::Edge(theDS->Shape(theEIndex2));
|
||||
BRepAdaptor_Curve aBC1(theE1), aBC2(theE2);
|
||||
|
||||
Standard_Integer aNbEEs;
|
||||
aNbEEs = aEEs.Length();
|
||||
for(eeit = 0; eeit < aNbEEs; ++eeit) {
|
||||
@@ -1247,10 +1257,21 @@ Standard_Boolean FindCommonVertex(const BOPDS_PDS& theDS,
|
||||
IntTools_Tools::VertexParameters(aCP, theParamOnE1, theParamOnE2);
|
||||
else
|
||||
IntTools_Tools::VertexParameters(aCP, theParamOnE2, theParamOnE1);
|
||||
|
||||
//
|
||||
bvertexfound = Standard_True;
|
||||
break;
|
||||
|
||||
gp_Pnt aPt;
|
||||
gp_Vec aDirOnE1, aDirOnE2;
|
||||
gp_Dir aIntersectPointCrossDir;
|
||||
|
||||
// intersect point aDirOnE1.cross(aDirOnE2) should same direction with path theCrossDirection
|
||||
aBC1.D1(theParamOnE1, aPt, aDirOnE1);
|
||||
aBC2.D1(theParamOnE2, aPt, aDirOnE2);
|
||||
aIntersectPointCrossDir = aDirOnE1.Crossed(aDirOnE2);
|
||||
|
||||
if (aIntersectPointCrossDir.Dot(theCrossDirection) > Precision::SquareConfusion())
|
||||
{
|
||||
bvertexfound = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -41,9 +41,12 @@ public:
|
||||
//! Constructor: takes faces to intersect,
|
||||
//! type of transition (it can be RightCorner or RoundCorner)
|
||||
//! and axis of bisector plane
|
||||
//! theIntersectPointCrossDirection : prev path direction at the origin point of theAxeOfBisPlane
|
||||
//! cross next path direction at the origin point of theAxeOfBisPlane. used when EE has more than one vertices
|
||||
Standard_EXPORT BRepFill_TrimShellCorner(const Handle(TopTools_HArray2OfShape)& theFaces,
|
||||
const BRepFill_TransitionStyle theTransition,
|
||||
const gp_Ax2& theAxeOfBisPlane);
|
||||
const gp_Ax2& theAxeOfBisPlane,
|
||||
const gp_Vec& theIntPointCrossDir);
|
||||
|
||||
Standard_EXPORT void AddBounds (const Handle(TopTools_HArray2OfShape)& Bounds);
|
||||
|
||||
@@ -92,6 +95,7 @@ private:
|
||||
|
||||
BRepFill_TransitionStyle myTransition;
|
||||
gp_Ax2 myAxeOfBisPlane;
|
||||
gp_Vec myIntPointCrossDir;
|
||||
TopoDS_Shape myShape1;
|
||||
TopoDS_Shape myShape2;
|
||||
Handle(TopTools_HArray2OfShape) myBounds;
|
||||
|
@@ -205,10 +205,10 @@ static void fillParams (const TColStd_Array1OfReal& theKnots,
|
||||
theParams.Append (theParMax);
|
||||
}
|
||||
|
||||
static void fillPoints (const BRepAdaptor_Curve& theCurve,
|
||||
const NCollection_Vector<Standard_Real> theParams,
|
||||
TColgp_SequenceOfPnt& thePoints,
|
||||
TColStd_SequenceOfReal& theWeights)
|
||||
static void fillPoints (const BRepAdaptor_Curve& theCurve,
|
||||
const NCollection_Vector<Standard_Real>& theParams,
|
||||
TColgp_SequenceOfPnt& thePoints,
|
||||
TColStd_SequenceOfReal& theWeights)
|
||||
{
|
||||
Standard_Real aDistPrev = 0., aDistNext;
|
||||
gp_Pnt aPPrev (theCurve.Value (theParams (0))), aPNext;
|
||||
@@ -506,7 +506,14 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
|
||||
|
||||
if (!isSolved)
|
||||
return;
|
||||
|
||||
//Removing very small values
|
||||
Standard_Real aMaxV = Max(Abs(aVec(1)), Max(Abs(aVec(2)), Abs(aVec(3))));
|
||||
Standard_Real eps = Epsilon(aMaxV);
|
||||
for (i = 1; i <= 3; ++i)
|
||||
{
|
||||
if (Abs(aVec(i)) <= eps)
|
||||
aVec(i) = 0.;
|
||||
}
|
||||
gp_Vec aN (aVec (1), aVec (2), aVec (3));
|
||||
Handle(Geom_Plane) aPlane = new Geom_Plane (aBaryCenter, aN);
|
||||
myTolReached = Controle (aPoints, aPlane);
|
||||
|
@@ -41,10 +41,13 @@ std::pair<Standard_Real, Standard_Real> BRepMesh_ConeRangeSplitter::GetSplitStep
|
||||
|
||||
const Standard_Real aDiffU = aRangeU.second - aRangeU.first;
|
||||
const Standard_Real aDiffV = aRangeV.second - aRangeV.first;
|
||||
Standard_Integer nbU = (Standard_Integer) (aDiffU / Du);
|
||||
Standard_Integer nbV = (Standard_Integer) (nbU * (aDiffV) / (aDiffU * aRadius));
|
||||
const Standard_Real aScale = (Du * aRadius);
|
||||
const Standard_Real aRatio = Max(1., Log(aDiffV / aScale));
|
||||
const Standard_Integer nbU = (Standard_Integer)(aDiffU / Du);
|
||||
const Standard_Integer nbV = (Standard_Integer)(aDiffV / aScale / aRatio);
|
||||
|
||||
Du = aDiffU / (nbU + 1);
|
||||
Dv = aDiffV / (nbV + 1);
|
||||
Dv = aDiffV / (nbV + static_cast<Standard_Integer>(aRatio));
|
||||
|
||||
theStepsNb.first = nbU;
|
||||
theStepsNb.second = nbV;
|
||||
|
@@ -124,10 +124,12 @@ void BRepMesh_DefaultRangeSplitter::computeTolerance(
|
||||
const Standard_Real aDiffU = myRangeU.second - myRangeU.first;
|
||||
const Standard_Real aDiffV = myRangeV.second - myRangeV.first;
|
||||
|
||||
// Slightly increase exact resolution so to cover links with approximate
|
||||
// length equal to resolution itself on sub-resolution differences.
|
||||
const Standard_Real aTolerance = BRep_Tool::Tolerance (myDFace->GetFace());
|
||||
const Adaptor3d_Surface& aSurface = GetSurface()->Surface();
|
||||
const Standard_Real aResU = aSurface.UResolution (aTolerance);
|
||||
const Standard_Real aResV = aSurface.VResolution (aTolerance);
|
||||
const Standard_Real aResU = aSurface.UResolution (aTolerance) * 1.1;
|
||||
const Standard_Real aResV = aSurface.VResolution (aTolerance) * 1.1;
|
||||
|
||||
const Standard_Real aDeflectionUV = 1.e-05;
|
||||
myTolerance.first = Max(Min(aDeflectionUV, aResU), 1e-7 * aDiffU);
|
||||
|
@@ -46,7 +46,8 @@ namespace
|
||||
void operator()(const Standard_Integer theFaceIndex) const
|
||||
{
|
||||
const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
|
||||
if (aDFace->IsSet(IMeshData_Outdated))
|
||||
if (aDFace->IsSet(IMeshData_Outdated) ||
|
||||
aDFace->GetFace().IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -119,7 +120,7 @@ namespace
|
||||
void operator()(const Standard_Integer theFaceIndex) const
|
||||
{
|
||||
const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
|
||||
if (aDFace->GetSurface()->GetType() != GeomAbs_Cone)
|
||||
if (aDFace->GetSurface()->GetType() != GeomAbs_Cone || aDFace->IsSet(IMeshData_Failure))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -128,7 +129,7 @@ namespace
|
||||
for (Standard_Integer aEdgeIdx = 0; aEdgeIdx < aDWire->EdgesNb() - 1; ++aEdgeIdx)
|
||||
{
|
||||
const IMeshData::IEdgePtr& aDEdge = aDWire->GetEdge (aEdgeIdx);
|
||||
|
||||
|
||||
if (aDEdge->GetPCurve(aDFace.get(), TopAbs_FORWARD) != aDEdge->GetPCurve(aDFace.get(), TopAbs_REVERSED))
|
||||
{
|
||||
if (aDEdge->GetCurve()->ParametersNb() == 2)
|
||||
@@ -146,7 +147,7 @@ namespace
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,9 +17,12 @@
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepAlgo.hxx>
|
||||
#include <BRepAlgo_FaceRestrictor.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
#include <BRepOffsetAPI_MakeOffset.hxx>
|
||||
#include <BRepTopAdaptor_FClass2d.hxx>
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
@@ -41,6 +44,49 @@
|
||||
static Standard_Boolean AffichSpine = Standard_False;
|
||||
#endif
|
||||
|
||||
static Standard_Boolean NeedsConvertion (const TopoDS_Wire& theWire)
|
||||
{
|
||||
TopoDS_Iterator anIter (theWire);
|
||||
for (; anIter.More(); anIter.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (anIter.Value());
|
||||
BRepAdaptor_Curve aBAcurve (anEdge);
|
||||
GeomAbs_CurveType aType = aBAcurve.GetType();
|
||||
if (aType != GeomAbs_Line &&
|
||||
aType != GeomAbs_Circle)
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
static TopoDS_Face ConvertFace (const TopoDS_Face& theFace,
|
||||
const Standard_Real theAngleTolerance)
|
||||
{
|
||||
TopAbs_Orientation anOr = theFace.Orientation();
|
||||
TopoDS_Face aFace = theFace;
|
||||
aFace.Orientation (TopAbs_FORWARD);
|
||||
|
||||
TopoDS_Face aNewFace = TopoDS::Face (aFace.EmptyCopied());
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Iterator anIter (aFace);
|
||||
for (; anIter.More(); anIter.Next())
|
||||
{
|
||||
TopoDS_Wire aWire = TopoDS::Wire (anIter.Value());
|
||||
if (NeedsConvertion (aWire))
|
||||
{
|
||||
TopAbs_Orientation anOrOfWire = aWire.Orientation();
|
||||
aWire = BRepAlgo::ConvertWire (aWire, theAngleTolerance, aFace);
|
||||
BRepLib::BuildCurves3d (aWire);
|
||||
aWire.Orientation (anOrOfWire);
|
||||
}
|
||||
aBB.Add (aNewFace, aWire);
|
||||
}
|
||||
aNewFace.Orientation (anOr);
|
||||
|
||||
return aNewFace;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepOffsetAPI_MakeOffset
|
||||
//purpose :
|
||||
@@ -49,7 +95,8 @@ static Standard_Boolean AffichSpine = Standard_False;
|
||||
BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset()
|
||||
: myIsInitialized( Standard_False),
|
||||
myJoin(GeomAbs_Arc),
|
||||
myIsOpenResult(Standard_False)
|
||||
myIsOpenResult(Standard_False),
|
||||
myIsToApprox(Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -80,6 +127,7 @@ void BRepOffsetAPI_MakeOffset::Init(const TopoDS_Face& Spine,
|
||||
myIsInitialized = Standard_True;
|
||||
myJoin = Join;
|
||||
myIsOpenResult = IsOpenResult;
|
||||
myIsToApprox = Standard_False;
|
||||
TopExp_Explorer exp;
|
||||
for (exp.Init(myFace,TopAbs_WIRE); exp.More();exp.Next()) {
|
||||
myWires.Append(exp.Current());
|
||||
@@ -99,6 +147,7 @@ BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Wire& Spine,
|
||||
myIsInitialized = Standard_True;
|
||||
myJoin = Join;
|
||||
myIsOpenResult = IsOpenResult;
|
||||
myIsToApprox = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -113,6 +162,18 @@ void BRepOffsetAPI_MakeOffset::Init(const GeomAbs_JoinType Join,
|
||||
myIsOpenResult = IsOpenResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetApprox
|
||||
//purpose : Set approximation flag
|
||||
// for convertion input contours into ones consisting of
|
||||
// 2D circular arcs and 2D linear segments only
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffsetAPI_MakeOffset::SetApprox(const Standard_Boolean ToApprox)
|
||||
{
|
||||
myIsToApprox = ToApprox;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepOffsetAPI_MakeOffset
|
||||
//purpose :
|
||||
@@ -289,6 +350,46 @@ void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset,
|
||||
|
||||
try
|
||||
{
|
||||
if (myIsToApprox)
|
||||
{
|
||||
Standard_Real aTol = 0.01;
|
||||
if (myFace.IsNull())
|
||||
{
|
||||
TopoDS_Face aFace;
|
||||
Standard_Boolean OnlyPlane = Standard_True;
|
||||
TopTools_ListIteratorOfListOfShape anItl (myWires);
|
||||
for (; anItl.More(); anItl.Next())
|
||||
{
|
||||
BRepBuilderAPI_MakeFace aFaceMaker (TopoDS::Wire(anItl.Value()), OnlyPlane);
|
||||
if (aFaceMaker.Error() == BRepBuilderAPI_FaceDone)
|
||||
{
|
||||
aFace = aFaceMaker.Face();
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (anItl.Initialize(myWires); anItl.More(); anItl.Next())
|
||||
{
|
||||
const TopoDS_Wire& aWire = TopoDS::Wire(anItl.Value());
|
||||
if (NeedsConvertion (aWire))
|
||||
{
|
||||
TopoDS_Wire aNewWire = BRepAlgo::ConvertWire (aWire, aTol, aFace);
|
||||
BRepLib::BuildCurves3d (aNewWire);
|
||||
aNewWire.Orientation (aWire.Orientation());
|
||||
anItl.ChangeValue() = aNewWire;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myFace = ConvertFace (myFace, aTol);
|
||||
BRepLib::BuildCurves3d (myFace);
|
||||
myWires.Clear();
|
||||
TopoDS_Iterator anIter (myFace);
|
||||
for (; anIter.More(); anIter.Next())
|
||||
myWires.Append (anIter.Value());
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer i = 1;
|
||||
BRepFill_ListIteratorOfListOfOffsetWire itOW;
|
||||
TopoDS_Compound Res;
|
||||
|
@@ -63,6 +63,11 @@ public:
|
||||
//! Initialize the evaluation of Offsetting.
|
||||
Standard_EXPORT void Init (const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean IsOpenResult = Standard_False);
|
||||
|
||||
//! Set approximation flag
|
||||
//! for convertion input contours into ones consisting of
|
||||
//! 2D circular arcs and 2D linear segments only.
|
||||
Standard_EXPORT void SetApprox (const Standard_Boolean ToApprox);
|
||||
|
||||
//! Initializes the algorithm to construct parallels to the wire Spine.
|
||||
Standard_EXPORT void AddWire (const TopoDS_Wire& Spine);
|
||||
|
||||
@@ -96,6 +101,7 @@ private:
|
||||
Standard_Boolean myLastIsLeft;
|
||||
GeomAbs_JoinType myJoin;
|
||||
Standard_Boolean myIsOpenResult;
|
||||
Standard_Boolean myIsToApprox;
|
||||
TopoDS_Face myFace;
|
||||
TopTools_ListOfShape myWires;
|
||||
BRepFill_ListOfOffsetWire myLeft;
|
||||
|
@@ -29,7 +29,7 @@
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Handle(Geom2d_Curve) Project(const Handle(Geom_Curve)& M,
|
||||
const gp_Ax3 Axis)
|
||||
const gp_Ax3& Axis)
|
||||
{
|
||||
Handle(Geom2d_Curve) C;
|
||||
C = GeomProjLib::Curve2d(M,new Geom_Plane(Axis));
|
||||
|
@@ -124,7 +124,14 @@ static Standard_Integer transform(Draw_Interpretor&,Standard_Integer n,const cha
|
||||
Standard_Boolean isBasic = Standard_False;
|
||||
Standard_Boolean isForced = Standard_False;
|
||||
Standard_Boolean isCopy = Standard_False;
|
||||
Standard_Boolean isCopyMesh = Standard_False;
|
||||
|
||||
// Check "copymesh" flag.
|
||||
if (!strcmp(a[n - 1], "-copymesh"))
|
||||
{
|
||||
isCopyMesh = Standard_True;
|
||||
last = --n;
|
||||
}
|
||||
// Check "copy" flag.
|
||||
if (!strcmp(a[n-1], "-copy")) {
|
||||
isCopy = Standard_True;
|
||||
@@ -218,7 +225,7 @@ static Standard_Integer transform(Draw_Interpretor&,Standard_Integer n,const cha
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
trf.Perform(S, isCopy);
|
||||
trf.Perform(S, isCopy, isCopyMesh);
|
||||
if (!trf.IsDone())
|
||||
return 1;
|
||||
DBRep::Set(a[i],trf.Shape());
|
||||
@@ -1487,27 +1494,27 @@ void BRepTest::BasicCommands(Draw_Interpretor& theCommands)
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("tmove",
|
||||
"tmove name1 name2 ... name, set location from name [-copy]",
|
||||
"tmove name1 name2 ... name, set location from name [-copy] [-copymesh]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("ttranslate",
|
||||
"ttranslate name1 name2 ... dx dy dz [-copy]",
|
||||
"ttranslate name1 name2 ... dx dy dz [-copy [-copymesh]]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("trotate",
|
||||
"trotate name1 name2 ... x y z dx dy dz angle [-copy]",
|
||||
"trotate name1 name2 ... x y z dx dy dz angle [-copy [-copymesh]]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("tmirror",
|
||||
"tmirror name x y z dx dy dz [-copy]",
|
||||
"tmirror name x y z dx dy dz [-copy] [-copymesh]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("tscale",
|
||||
"tscale name x y z scale [-copy]",
|
||||
"tscale name x y z scale [-copy] [-copymesh]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
|
@@ -1530,10 +1530,23 @@ Standard_Integer mkoffset(Draw_Interpretor& di,
|
||||
char name[100];
|
||||
|
||||
BRepOffsetAPI_MakeOffset Paral;
|
||||
|
||||
Standard_Boolean ToApprox = Standard_False;
|
||||
GeomAbs_JoinType theJoinType = GeomAbs_Arc;
|
||||
if (n >= 6 && strcmp(a[5], "i") == 0)
|
||||
theJoinType = GeomAbs_Intersection;
|
||||
Paral.Init(theJoinType);
|
||||
|
||||
Standard_Integer anIndArg = 6;
|
||||
if (n >= 6)
|
||||
{
|
||||
if (strcmp(a[5], "-approx") == 0)
|
||||
{
|
||||
ToApprox = Standard_True;
|
||||
anIndArg++;
|
||||
}
|
||||
|
||||
if (n >= anIndArg && strcmp(a[anIndArg-1], "i") == 0)
|
||||
theJoinType = GeomAbs_Intersection;
|
||||
}
|
||||
|
||||
TopoDS_Shape Base = DBRep::Get(a[2],TopAbs_FACE);
|
||||
|
||||
if ( Base.IsNull())
|
||||
@@ -1553,6 +1566,7 @@ Standard_Integer mkoffset(Draw_Interpretor& di,
|
||||
Base.Orientation(TopAbs_FORWARD);
|
||||
Paral.Init(TopoDS::Face(Base), theJoinType);
|
||||
}
|
||||
Paral.SetApprox (ToApprox);
|
||||
|
||||
Standard_Real U, dU;
|
||||
Standard_Integer Nb;
|
||||
@@ -1560,8 +1574,8 @@ Standard_Integer mkoffset(Draw_Interpretor& di,
|
||||
Nb = Draw::Atoi(a[3]);
|
||||
|
||||
Standard_Real Alt = 0.;
|
||||
if ( n == 7)
|
||||
Alt = Draw::Atof(a[6]);
|
||||
if (n > anIndArg)
|
||||
Alt = Draw::Atof(a[anIndArg]);
|
||||
|
||||
Standard_Integer Compt = 1;
|
||||
|
||||
@@ -1598,16 +1612,30 @@ Standard_Integer openoffset(Draw_Interpretor& di,
|
||||
char name[100];
|
||||
|
||||
BRepOffsetAPI_MakeOffset Paral;
|
||||
|
||||
Standard_Boolean ToApprox = Standard_False;
|
||||
GeomAbs_JoinType theJoinType = GeomAbs_Arc;
|
||||
if (n == 6 && strcmp(a[5], "i") == 0)
|
||||
theJoinType = GeomAbs_Intersection;
|
||||
Paral.Init(theJoinType, Standard_True);
|
||||
|
||||
Standard_Integer anIndArg = 6;
|
||||
if (n >= 6)
|
||||
{
|
||||
if (strcmp(a[5], "-approx") == 0)
|
||||
{
|
||||
ToApprox = Standard_True;
|
||||
anIndArg++;
|
||||
}
|
||||
|
||||
if (n >= anIndArg && strcmp(a[anIndArg-1], "i") == 0)
|
||||
theJoinType = GeomAbs_Intersection;
|
||||
}
|
||||
|
||||
TopoDS_Shape Base = DBRep::Get(a[2] ,TopAbs_FACE);
|
||||
|
||||
if ( Base.IsNull())
|
||||
{
|
||||
Base = DBRep::Get(a[2], TopAbs_WIRE);
|
||||
if (Base.IsNull()) return 1;
|
||||
Paral.Init(theJoinType, Standard_True);
|
||||
Paral.AddWire(TopoDS::Wire(Base));
|
||||
}
|
||||
else
|
||||
@@ -1615,6 +1643,7 @@ Standard_Integer openoffset(Draw_Interpretor& di,
|
||||
Base.Orientation(TopAbs_FORWARD);
|
||||
Paral.Init(TopoDS::Face(Base), theJoinType, Standard_True);
|
||||
}
|
||||
Paral.SetApprox (ToApprox);
|
||||
|
||||
Standard_Real U, dU;
|
||||
Standard_Integer Nb;
|
||||
@@ -1755,6 +1784,72 @@ Standard_Integer edgeintersector(Draw_Interpretor& di,
|
||||
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
//function : arclinconvert
|
||||
//purpose : Convert a single face to a face with contour made of arcs and segments
|
||||
//=================================================================================
|
||||
|
||||
static Standard_Integer arclinconvert (Draw_Interpretor& /*dout*/, Standard_Integer n, const char** a)
|
||||
{
|
||||
// Check the command arguments
|
||||
if (n < 3) {
|
||||
std::cout<<"Error: "<<a[0]<<" - invalid number of arguments"<<std::endl;
|
||||
std::cout<<"Usage: type help "<<a[0]<<std::endl;
|
||||
return 1; //TCL_ERROR
|
||||
}
|
||||
|
||||
//read shape
|
||||
const TopoDS_Shape aShape = DBRep::Get(a[2]);
|
||||
if (aShape.IsNull()) {
|
||||
std::cout<<"Error: "<<a[2]<<" is null"<<std::endl;
|
||||
return 1; //TCL_ERROR
|
||||
}
|
||||
|
||||
TopAbs_ShapeEnum aType = aShape.ShapeType();
|
||||
if (aType != TopAbs_WIRE &&
|
||||
aType != TopAbs_FACE)
|
||||
{
|
||||
std::cout<<"Error: "<<a[2]<<" is neither wire no face"<<std::endl;
|
||||
return 1; //TCL_ERROR
|
||||
}
|
||||
|
||||
//read tolerance
|
||||
Standard_Real aTol = 0.01;
|
||||
if (n > 3)
|
||||
aTol = Draw::Atof(a[3]);
|
||||
std::cout<<"Info: tolerance is set to "<<aTol<<std::endl;
|
||||
|
||||
TopoDS_Shape aResult;
|
||||
|
||||
if (aType == TopAbs_WIRE)
|
||||
{
|
||||
Standard_Boolean OnlyPlane = Standard_False;
|
||||
BRepBuilderAPI_MakeFace aFaceMaker (TopoDS::Wire(aShape), OnlyPlane);
|
||||
if (aFaceMaker.Error() != BRepBuilderAPI_FaceDone)
|
||||
{
|
||||
std::cout<<"Error: failed to find a face for the wire "<<a[2]<<std::endl;
|
||||
return 1; //TCL_ERROR
|
||||
}
|
||||
TopoDS_Face aFace = aFaceMaker.Face();
|
||||
TopoDS_Iterator anIter (aFace);
|
||||
TopoDS_Wire aWire = TopoDS::Wire (anIter.Value());
|
||||
aResult = BRepAlgo::ConvertWire (aWire, aTol, aFace);
|
||||
}
|
||||
else if (aType == TopAbs_FACE)
|
||||
{
|
||||
TopoDS_Face aFace = TopoDS::Face(aShape);
|
||||
aResult = BRepAlgo::ConvertFace (aFace, aTol);
|
||||
}
|
||||
|
||||
if (aResult.IsNull()) {
|
||||
std::cout<<"Error: could not convert "<<a[2]<<std::endl;
|
||||
return 1; //TCL_ERROR
|
||||
}
|
||||
|
||||
DBRep::Set(a[1], aResult);
|
||||
return 0; //TCL_OK
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : concatC0wire
|
||||
//purpose :
|
||||
@@ -1908,11 +2003,11 @@ void BRepTest::CurveCommands(Draw_Interpretor& theCommands)
|
||||
profile2d,g);
|
||||
|
||||
theCommands.Add("mkoffset",
|
||||
"mkoffset result face/compound of wires nboffset stepoffset [jointype(a/i) [alt]]",__FILE__,
|
||||
"mkoffset result face/compound of wires nboffset stepoffset [-approx] [jointype(a/i) [alt]]",__FILE__,
|
||||
mkoffset,g);
|
||||
|
||||
theCommands.Add("openoffset",
|
||||
"openoffset result face/wire nboffset stepoffset [jointype(a/i)]",__FILE__,
|
||||
"openoffset result face/wire nboffset stepoffset [-approx] [jointype(a/i)]",__FILE__,
|
||||
openoffset,g);
|
||||
|
||||
theCommands.Add("mkedge",
|
||||
@@ -1968,6 +2063,12 @@ void BRepTest::CurveCommands(Draw_Interpretor& theCommands)
|
||||
"reducepcurves shape1 shape2 ...",__FILE__,
|
||||
reducepcurves, g);
|
||||
|
||||
theCommands.Add("arclinconvert",
|
||||
"arclinconvert result wire/face [tol]",
|
||||
__FILE__,
|
||||
arclinconvert,
|
||||
g);
|
||||
|
||||
theCommands.Add("concatC0wire",
|
||||
"concatC0wire result wire",
|
||||
__FILE__,
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include <LocOpe_FindEdgesInFace.hxx>
|
||||
|
||||
#include <BRepOffset_MakeOffset.hxx>
|
||||
#include <BRepOffsetAPI_MakeOffsetShape.hxx>
|
||||
#include <BRepOffset_MakeSimpleOffset.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <DBRep.hxx>
|
||||
@@ -976,6 +977,81 @@ Standard_Integer thickshell(Draw_Interpretor& theCommands,
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : mkoffsetshape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Integer mkoffsetshape(Draw_Interpretor& theDI,
|
||||
Standard_Integer theArgNb,
|
||||
const char** theArgVec)
|
||||
{
|
||||
if (theArgNb < 4)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
TopoDS_Shape aShape = DBRep::Get(theArgVec[2]);
|
||||
if (aShape.IsNull())
|
||||
{
|
||||
theDI << "Shape is null";
|
||||
return 1;
|
||||
}
|
||||
Standard_Real anOffVal = Draw::Atof(theArgVec[3]);
|
||||
BRepOffsetAPI_MakeOffsetShape aMaker;
|
||||
if (theArgNb == 4)
|
||||
{
|
||||
aMaker.PerformBySimple(aShape, anOffVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real aTol = Draw::Atof(theArgVec[4]);
|
||||
|
||||
Standard_Boolean anInt = Standard_False;
|
||||
if (theArgNb > 5)
|
||||
{
|
||||
if ((Draw::Atof(theArgVec[5]) == 1))
|
||||
{
|
||||
anInt = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean aSelfInt = Standard_False;
|
||||
if (theArgNb > 6)
|
||||
{
|
||||
if (Draw::Atof(theArgVec[6]) == 1)
|
||||
{
|
||||
aSelfInt = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
GeomAbs_JoinType aJoin = GeomAbs_Arc;
|
||||
if (theArgNb > 7)
|
||||
{
|
||||
if (!strcmp(theArgVec[7], "i"))
|
||||
{
|
||||
aJoin = GeomAbs_Intersection;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean aRemIntEdges = Standard_False;
|
||||
if (theArgNb > 8)
|
||||
{
|
||||
if (Draw::Atof(theArgVec[8]) == 1)
|
||||
{
|
||||
aRemIntEdges = Standard_True;
|
||||
}
|
||||
}
|
||||
aMaker.PerformByJoin(aShape, anOffVal, aTol, BRepOffset_Skin, anInt, aSelfInt, aJoin, aRemIntEdges);
|
||||
}
|
||||
|
||||
if (!aMaker.IsDone())
|
||||
{
|
||||
theDI << " Error: Offset is not done.\n";
|
||||
return 1;
|
||||
}
|
||||
DBRep::Set(theArgVec[1], aMaker.Shape());
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : offsetshape
|
||||
//purpose :
|
||||
@@ -2477,6 +2553,10 @@ void BRepTest::FeatureCommands(Draw_Interpretor& theCommands)
|
||||
"thickshell r shape offset [jointype [tol] ]",
|
||||
__FILE__, thickshell, g);
|
||||
|
||||
theCommands.Add("mkoffsetshape",
|
||||
"mkoffsetshape r shape offset [Tol] [Intersection(0/1)] [SelfInter(0/1)] [JoinType(a/i)] [RemoveInternalEdges(0/1)]",
|
||||
__FILE__, mkoffsetshape, g);
|
||||
|
||||
theCommands.Add("offsetshape",
|
||||
"offsetshape r shape offset [tol] [face ...]",
|
||||
__FILE__, offsetshape, g);
|
||||
|
@@ -57,6 +57,7 @@ static BRepOffsetAPI_ThruSections* Generator = 0;
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <ShapeUpgrade_UnifySameDomain.hxx>
|
||||
|
||||
//=======================================================================
|
||||
// prism
|
||||
@@ -533,16 +534,50 @@ Standard_Integer thrusections(Draw_Interpretor&, Standard_Integer n, const char*
|
||||
//=======================================================================
|
||||
// mksweep
|
||||
//=======================================================================
|
||||
static Standard_Integer mksweep(Draw_Interpretor&,
|
||||
static Standard_Integer mksweep(Draw_Interpretor& di,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n != 2) return 1;
|
||||
if (n != 2 && n != 5) return 1;
|
||||
TopoDS_Shape Spine = DBRep::Get(a[1], TopAbs_WIRE);
|
||||
if (Spine.IsNull()) return 1;
|
||||
if (Sweep != 0) {
|
||||
delete Sweep;
|
||||
Sweep = 0;
|
||||
}
|
||||
|
||||
if (n > 2 && n <= 5)
|
||||
{
|
||||
if (!strcmp(a[2], "-C"))
|
||||
{
|
||||
ShapeUpgrade_UnifySameDomain aUnif(Spine, Standard_True, Standard_False, Standard_True);
|
||||
|
||||
Standard_Real anAngTol = 5.;
|
||||
Standard_Real aLinTol = 0.1;
|
||||
|
||||
if (n == 5)
|
||||
{
|
||||
anAngTol = Draw::Atof(a[3]);
|
||||
aLinTol = Draw::Atof(a[4]);
|
||||
}
|
||||
|
||||
aUnif.SetAngularTolerance(anAngTol * M_PI / 180.);
|
||||
aUnif.SetLinearTolerance(aLinTol);
|
||||
aUnif.Build();
|
||||
Spine = aUnif.Shape();
|
||||
if (BRepTest_Objects::IsHistoryNeeded())
|
||||
{
|
||||
BRepTest_Objects::SetHistory(aUnif.History());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
di << "To correct input spine use 'mksweep wire -C [AngTol LinTol]'\n";
|
||||
di << "By default, AngTol = 5, LinTol = 0.1";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Sweep = new BRepOffsetAPI_MakePipeShell(TopoDS::Wire(Spine));
|
||||
return 0;
|
||||
}
|
||||
@@ -1010,7 +1045,9 @@ void BRepTest::SweepCommands(Draw_Interpretor& theCommands)
|
||||
"\t\t-safe option allows to prevent the modifying of input shapes",
|
||||
__FILE__, thrusections, g);
|
||||
|
||||
theCommands.Add("mksweep", "mksweep wire",
|
||||
theCommands.Add("mksweep", "mksweep wire [-C [AngTol LinTol]]\n"
|
||||
"\t\tthe option -C correct input spine by merging smooth connected neighboring edges\n"
|
||||
"\t\tthe AngTol is in degrees",
|
||||
__FILE__, mksweep, g);
|
||||
|
||||
theCommands.Add("setsweep", "setsweep no args to get help",
|
||||
|
@@ -695,7 +695,7 @@ Standard_Boolean BRepTools::Write (const TopoDS_Shape& theShape,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (theFile, std::ios::out);
|
||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (theFile, std::ios::out | std::ios::binary);
|
||||
if (aStream.get() == NULL || !aStream->good())
|
||||
{
|
||||
return Standard_False;
|
||||
@@ -893,6 +893,8 @@ void BRepTools::CleanGeometry(const TopoDS_Shape& theShape)
|
||||
aBuilder.UpdateEdge(anEdge, Handle(Geom_Curve)(),
|
||||
TopLoc_Location(), BRep_Tool::Tolerance(anEdge));
|
||||
}
|
||||
|
||||
RemoveUnusedPCurves(theShape);
|
||||
}
|
||||
|
||||
|
||||
|
215
src/BRepTools/BRepTools_CopyModification.cxx
Normal file
215
src/BRepTools/BRepTools_CopyModification.cxx
Normal file
@@ -0,0 +1,215 @@
|
||||
// Copyright (c) 1999-2022 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 <BRepTools_CopyModification.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepTools_CopyModification, BRepTools_Modification)
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepTools_CopyModification
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepTools_CopyModification::BRepTools_CopyModification(const Standard_Boolean copyGeom,
|
||||
const Standard_Boolean copyMesh)
|
||||
: myCopyGeom(copyGeom),
|
||||
myCopyMesh(copyMesh)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewSurface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewSurface(const TopoDS_Face& theFace,
|
||||
Handle(Geom_Surface)& theSurf,
|
||||
TopLoc_Location& theLoc,
|
||||
Standard_Real& theTol,
|
||||
Standard_Boolean& theRevWires,
|
||||
Standard_Boolean& theRevFace)
|
||||
{
|
||||
theSurf = BRep_Tool::Surface(theFace, theLoc);
|
||||
theTol = BRep_Tool::Tolerance(theFace);
|
||||
theRevWires = theRevFace = Standard_False;
|
||||
|
||||
if (!theSurf.IsNull() && myCopyGeom)
|
||||
theSurf = Handle(Geom_Surface)::DownCast(theSurf->Copy());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewTriangulation(const TopoDS_Face& theFace,
|
||||
Handle(Poly_Triangulation)& theTri)
|
||||
{
|
||||
if (!myCopyMesh && BRep_Tool::IsGeometric(theFace))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
theTri = BRep_Tool::Triangulation(theFace, aLoc);
|
||||
|
||||
if (theTri.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
// mesh is copied if and only if the geometry need to be copied too
|
||||
if (myCopyGeom)
|
||||
theTri = theTri->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewCurve(const TopoDS_Edge& theEdge,
|
||||
Handle(Geom_Curve)& theCurve,
|
||||
TopLoc_Location& theLoc,
|
||||
Standard_Real& theTol)
|
||||
{
|
||||
Standard_Real aFirst, aLast;
|
||||
theCurve = BRep_Tool::Curve(theEdge, theLoc, aFirst, aLast);
|
||||
theTol = BRep_Tool::Tolerance(theEdge);
|
||||
|
||||
if (!theCurve.IsNull() && myCopyGeom)
|
||||
theCurve = Handle(Geom_Curve)::DownCast(theCurve->Copy());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewPolygon
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewPolygon(const TopoDS_Edge& theEdge,
|
||||
Handle(Poly_Polygon3D)& thePoly)
|
||||
{
|
||||
if (!myCopyMesh && BRep_Tool::IsGeometric(theEdge))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
thePoly = BRep_Tool::Polygon3D(theEdge, aLoc);
|
||||
|
||||
if (thePoly.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
// polygon is copied if and only if the geometry need to be copied too
|
||||
if (myCopyGeom)
|
||||
thePoly = thePoly->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewPolygonOnTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewPolygonOnTriangulation(
|
||||
const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
Handle(Poly_PolygonOnTriangulation)& thePoly)
|
||||
{
|
||||
if (!myCopyMesh && BRep_Tool::IsGeometric(theEdge))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Poly_Triangulation) aTria = BRep_Tool::Triangulation(theFace, aLoc);
|
||||
thePoly = BRep_Tool::PolygonOnTriangulation(theEdge, aTria, aLoc);
|
||||
|
||||
if (thePoly.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
// polygon is copied if and only if the geometry need to be copied too
|
||||
if (myCopyGeom)
|
||||
thePoly = thePoly->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewPoint(const TopoDS_Vertex& theVertex,
|
||||
gp_Pnt& thePnt,
|
||||
Standard_Real& theTol)
|
||||
{
|
||||
thePnt = BRep_Tool::Pnt(theVertex);
|
||||
theTol = BRep_Tool::Tolerance(theVertex);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewCurve2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewCurve2d(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
const TopoDS_Edge&,
|
||||
const TopoDS_Face&,
|
||||
Handle(Geom2d_Curve)& theCurve,
|
||||
Standard_Real& theTol)
|
||||
{
|
||||
theTol = BRep_Tool::Tolerance(theEdge);
|
||||
Standard_Real aFirst, aLast;
|
||||
theCurve = BRep_Tool::CurveOnSurface(theEdge, theFace, aFirst, aLast);
|
||||
|
||||
if (!theCurve.IsNull() && myCopyGeom)
|
||||
theCurve = Handle(Geom2d_Curve)::DownCast(theCurve->Copy());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewParameter(const TopoDS_Vertex& theVertex,
|
||||
const TopoDS_Edge& theEdge,
|
||||
Standard_Real& thePnt,
|
||||
Standard_Real& theTol)
|
||||
{
|
||||
if (theVertex.IsNull())
|
||||
return Standard_False; // infinite edge may have Null vertex
|
||||
|
||||
theTol = BRep_Tool::Tolerance(theVertex);
|
||||
thePnt = BRep_Tool::Parameter(theVertex, theEdge);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Continuity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomAbs_Shape BRepTools_CopyModification::Continuity(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace1,
|
||||
const TopoDS_Face& theFace2,
|
||||
const TopoDS_Edge&,
|
||||
const TopoDS_Face&,
|
||||
const TopoDS_Face&)
|
||||
{
|
||||
return BRep_Tool::Continuity(theEdge, theFace1, theFace2);
|
||||
}
|
||||
|
||||
|
124
src/BRepTools/BRepTools_CopyModification.hxx
Normal file
124
src/BRepTools/BRepTools_CopyModification.hxx
Normal file
@@ -0,0 +1,124 @@
|
||||
// Copyright (c) 1999-2022 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 _BRepTools_CopyModification_HeaderFile
|
||||
#define _BRepTools_CopyModification_HeaderFile
|
||||
|
||||
#include <BRepTools_Modification.hxx>
|
||||
|
||||
class BRepTools_CopyModification;
|
||||
DEFINE_STANDARD_HANDLE(BRepTools_CopyModification, BRepTools_Modification)
|
||||
|
||||
//! Tool class implementing necessary functionality for copying geometry and triangulation.
|
||||
class BRepTools_CopyModification : public BRepTools_Modification
|
||||
{
|
||||
public:
|
||||
//! Constructor.
|
||||
//! \param[in] theCopyGeom indicates that the geomtery (surfaces and curves) should be copied
|
||||
//! \param[in] theCopyMesh indicates that the triangulation should be copied
|
||||
Standard_EXPORT explicit BRepTools_CopyModification(const Standard_Boolean theCopyGeom = Standard_True,
|
||||
const Standard_Boolean theCopyMesh = Standard_True);
|
||||
|
||||
//! Returns true if theFace has been modified.
|
||||
//! If the face has been modified:
|
||||
//! - theSurf is the new geometry of the face,
|
||||
//! - theLoc is its new location, and
|
||||
//! - theTol is the new tolerance.
|
||||
//! theRevWires, theRevFace are always set to false, because the orientaion is not changed.
|
||||
Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& theFace,
|
||||
Handle(Geom_Surface)& theSurf,
|
||||
TopLoc_Location& theLoc,
|
||||
Standard_Real& theTol,
|
||||
Standard_Boolean& theRevWires,
|
||||
Standard_Boolean& theRevFace) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if theEdge has been modified.
|
||||
//! If the edge has been modified:
|
||||
//! - theCurve is the new geometric support of the edge,
|
||||
//! - theLoc is the new location, and
|
||||
//! - theTol is the new tolerance.
|
||||
//! If the edge has not been modified, this function
|
||||
//! returns false, and the values of theCurve, theLoc and theTol are not significant.
|
||||
Standard_EXPORT Standard_Boolean NewCurve(const TopoDS_Edge& theEdge,
|
||||
Handle(Geom_Curve)& theCurve,
|
||||
TopLoc_Location& theLoc,
|
||||
Standard_Real& theTol) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if theVertex has been modified.
|
||||
//! If the vertex has been modified:
|
||||
//! - thePnt is the new geometry of the vertex, and
|
||||
//! - theTol is the new tolerance.
|
||||
//! If the vertex has not been modified this function
|
||||
//! returns false, and the values of thePnt and theTol are not significant.
|
||||
Standard_EXPORT Standard_Boolean NewPoint(const TopoDS_Vertex& theVertex, gp_Pnt& thePnt, Standard_Real& theTol) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if theEdge has a new curve on surface on theFace.
|
||||
//! If a new curve exists:
|
||||
//! - theCurve is the new geometric support of the edge,
|
||||
//! - theTol the new tolerance.
|
||||
//! If no new curve exists, this function returns false, and
|
||||
//! the values of theCurve and theTol are not significant.
|
||||
Standard_EXPORT Standard_Boolean NewCurve2d(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
const TopoDS_Edge& theNewEdge,
|
||||
const TopoDS_Face& theNewFace,
|
||||
Handle(Geom2d_Curve)& theCurve,
|
||||
Standard_Real& theTol) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if theVertex has a new parameter on theEdge.
|
||||
//! If a new parameter exists:
|
||||
//! - thePnt is the parameter, and
|
||||
//! - theTol is the new tolerance.
|
||||
//! If no new parameter exists, this function returns false,
|
||||
//! and the values of thePnt and theTol are not significant.
|
||||
Standard_EXPORT Standard_Boolean NewParameter(const TopoDS_Vertex& theVertex,
|
||||
const TopoDS_Edge& theEdge,
|
||||
Standard_Real& thePnt,
|
||||
Standard_Real& theTol) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the continuity of theNewEdge between theNewFace1 and theNewFace2.
|
||||
//!
|
||||
//! theNewEdge is the new edge created from theEdge. theNewFace1
|
||||
//! (resp. theNewFace2) is the new face created from theFace1 (resp. theFace2).
|
||||
Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace1,
|
||||
const TopoDS_Face& theFace2,
|
||||
const TopoDS_Edge& theNewEdge,
|
||||
const TopoDS_Face& theNewFace1,
|
||||
const TopoDS_Face& theNewFace2) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the face has been modified according to changed triangulation.
|
||||
//! If the face has been modified:
|
||||
//! - theTri is a new triangulation on the face
|
||||
Standard_EXPORT Standard_Boolean NewTriangulation(const TopoDS_Face& theFace, Handle(Poly_Triangulation)& theTri) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the edge has been modified according to changed polygon.
|
||||
//! If the edge has been modified:
|
||||
//! - thePoly is a new polygon
|
||||
Standard_EXPORT Standard_Boolean NewPolygon(const TopoDS_Edge& theEdge, Handle(Poly_Polygon3D)& thePoly) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the edge has been modified according to changed polygon on triangulation.
|
||||
//! If the edge has been modified:
|
||||
//! - thePoly is a new polygon on triangulation
|
||||
Standard_EXPORT Standard_Boolean NewPolygonOnTriangulation(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
Handle(Poly_PolygonOnTriangulation)& thePoly) Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BRepTools_CopyModification, BRepTools_Modification)
|
||||
|
||||
private:
|
||||
Standard_Boolean myCopyGeom;
|
||||
Standard_Boolean myCopyMesh;
|
||||
};
|
||||
|
||||
#endif // _BRepTools_CopyModification_HeaderFile
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user