mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +03:00
Compare commits
105 Commits
CR26812_2
...
V7_0_winwe
Author | SHA1 | Date | |
---|---|---|---|
|
913295d5dd | ||
|
9c1519c4c5 | ||
|
6f21399c0d | ||
|
9d1bf7ae05 | ||
|
1b9f5d9504 | ||
|
907fb7a5e0 | ||
|
9d671cd1b0 | ||
|
bd80ecfa61 | ||
|
747db83cdd | ||
|
6728599615 | ||
|
f117cc5a81 | ||
|
67e26cc101 | ||
|
77a6c8313f | ||
|
473cddc1d9 | ||
|
854e0d4a27 | ||
|
f84bf635f0 | ||
|
1ec75a485b | ||
|
c1609fbea6 | ||
|
91d9637224 | ||
|
be5c360207 | ||
|
83b0f13a58 | ||
|
52db475165 | ||
|
93dc7934db | ||
|
34e4e9f26e | ||
|
a3d2cb2425 | ||
|
4b445d1848 | ||
|
b819ae67ce | ||
|
c574faecb9 | ||
|
b0fbc5796a | ||
|
625e195819 | ||
|
402cfabc21 | ||
|
1e7ac41bf8 | ||
|
77887d30d8 | ||
|
b94d48585b | ||
|
50d06d8fcf | ||
|
5ae6e53dec | ||
|
41e08b4df8 | ||
|
a002d297f7 | ||
|
f2b6318110 | ||
|
7d46a9ed8b | ||
|
88d533be65 | ||
|
6b52f1253e | ||
|
38c2acd423 | ||
|
55fb31dae4 | ||
|
882e1d11aa | ||
|
871776ea38 | ||
|
09eca2b5b3 | ||
|
5501f9a946 | ||
|
e64622331f | ||
|
264abd72f2 | ||
|
e5260e1dfa | ||
|
e1c1b6b9f4 | ||
|
f02e43eb35 | ||
|
0911d065ff | ||
|
3d370858dd | ||
|
3e6a4cd02a | ||
|
38f24151f6 | ||
|
4613a51fd4 | ||
|
aa1b48c7dd | ||
|
18151f1aa1 | ||
|
15a954deb5 | ||
|
8d0b864941 | ||
|
c9de149dec | ||
|
a1530ab1b8 | ||
|
c59fcd1186 | ||
|
b7b2f85ac1 | ||
|
8e509b0ba1 | ||
|
a9b51f4977 | ||
|
5951a08873 | ||
|
5950d7816e | ||
|
7856b126b0 | ||
|
3a507ddb47 | ||
|
79997052f1 | ||
|
b55bd02353 | ||
|
246c7a7554 | ||
|
4b5857d330 | ||
|
04cd0c6dda | ||
|
e13e5f39c5 | ||
|
a139a35380 | ||
|
eaffb01e7e | ||
|
3e64931da5 | ||
|
92788bf4bb | ||
|
360f800be8 | ||
|
7f56eba8cd | ||
|
299e0ab98f | ||
|
b8f67cc236 | ||
|
8b9a309b48 | ||
|
3f1eb0abf9 | ||
|
016e595986 | ||
|
83da37b115 | ||
|
6143f12f36 | ||
|
9a9a3edfd8 | ||
|
02fd709bbb | ||
|
4680293609 | ||
|
a0bb29e79e | ||
|
46bd680a25 | ||
|
3321f6847d | ||
|
f7ac9097ee | ||
|
601b1c8d56 | ||
|
309bad284d | ||
|
79981d14cc | ||
|
f0bf70e8cc | ||
|
8f8398f6e4 | ||
|
94074ec660 | ||
|
9d034c3730 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -49,6 +49,7 @@ Release
|
||||
/*.m4
|
||||
/*.ac
|
||||
/*.sh
|
||||
/codeblocks.bat
|
||||
/custom.bat
|
||||
/autom4te.cache
|
||||
/build_configure
|
||||
|
@@ -24,8 +24,14 @@ endif()
|
||||
|
||||
if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared")
|
||||
set (BUILD_SHARED_LIBS ON)
|
||||
|
||||
if (NOT DEFINED BUILD_SHARED_LIBRARY_NAME_POSTFIX)
|
||||
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX "" CACHE STRING "${BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR}" FORCE)
|
||||
endif()
|
||||
else()
|
||||
unset (BUILD_SHARED_LIBS)
|
||||
message (STATUS "Info: Only 3rdparty's header files are used for building of static OCCT libraries")
|
||||
unset (BUILD_SHARED_LIBRARY_NAME_POSTFIX)
|
||||
endif()
|
||||
|
||||
# the name of the project
|
||||
@@ -59,9 +65,16 @@ if (DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE) # single-configuration ge
|
||||
endif()
|
||||
|
||||
# enable extended messages of many OCCT algorithms
|
||||
set (BUILD_WITH_DEBUG OFF CACHE BOOL "${BUILD_WITH_DEBUG_DESCR}")
|
||||
if ((SINGLE_GENERATOR AND "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") OR NOT SINGLE_GENERATOR)
|
||||
if (NOT BUILD_WITH_DEBUG)
|
||||
set (BUILD_WITH_DEBUG OFF CACHE BOOL "${BUILD_WITH_DEBUG_DESCR}")
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET (BUILD_WITH_DEBUG)
|
||||
endif()
|
||||
|
||||
if (BUILD_WITH_DEBUG)
|
||||
add_definitions (-DOCCT_DEBUG)
|
||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:DEBUG>:OCCT_DEBUG>)
|
||||
endif()
|
||||
|
||||
# copy samples to install directory
|
||||
@@ -281,6 +294,10 @@ else()
|
||||
OCCT_INSTALL_FILE_OR_DIR ("OCCT_LGPL_EXCEPTION.txt" "${INSTALL_DIR}")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set (INSTALL_NAME_DIR "" CACHE STRING "install_name library suffix on OS X (e.g. @executable_path/../Frameworks)")
|
||||
endif()
|
||||
|
||||
# a directory recognized as a 'patch' for OCCT
|
||||
set (BUILD_PATCH "" CACHE PATH "${BUILD_PATCH_DESCR}")
|
||||
|
||||
@@ -316,7 +333,17 @@ if (ANDROID AND BUILD_MODULE_Draw)
|
||||
endif()
|
||||
|
||||
# Overview
|
||||
set (BUILD_DOC_Overview OFF CACHE BOOL "${BUILD_DOC_Overview_DESCR}")
|
||||
if (NOT DEFINED BUILD_DOC_Overview)
|
||||
set (DO_ONLY_CHECK_FOR_DOXYGEN ON)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/doxygen")
|
||||
set (DO_ONLY_CHECK_FOR_DOXYGEN OFF)
|
||||
|
||||
if (CAN_DOXYGEN_BE_USED)
|
||||
message (STATUS "Info. Overview building is turned on")
|
||||
endif()
|
||||
|
||||
set (BUILD_DOC_Overview ${CAN_DOXYGEN_BE_USED} CACHE BOOL "${BUILD_DOC_Overview_DESCR}")
|
||||
endif()
|
||||
|
||||
if (NOT USE_D3D)
|
||||
list (REMOVE_ITEM Visualization_TOOLKITS TKD3DHost)
|
||||
@@ -569,7 +596,7 @@ endif()
|
||||
# include <cmake binary folder>/inc
|
||||
include_directories (${CMAKE_BINARY_DIR}/inc)
|
||||
|
||||
if (3RDPARTY_LIBRARY_DIRS)
|
||||
if (3RDPARTY_LIBRARY_DIRS AND BUILD_SHARED_LIBS)
|
||||
list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS)
|
||||
string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}")
|
||||
message (STATUS "Info: The directories of 3rdparty libraries: \n\t${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}")
|
||||
@@ -613,7 +640,11 @@ COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}"
|
||||
string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
|
||||
message (STATUS "Info: \(${CURRENT_TIME}\) End the collecting")
|
||||
|
||||
OCCT_INSTALL_FILE_OR_DIR ("data/" "${INSTALL_DIR}/${INSTALL_DIR_DATA}")
|
||||
list (FIND BUILD_TOOLKITS DRAWEXE DRAWEXE_INDEX)
|
||||
if (${DRAWEXE_INDEX} GREATER -1)
|
||||
OCCT_INSTALL_FILE_OR_DIR ("data/" "${INSTALL_DIR}/${INSTALL_DIR_DATA}")
|
||||
OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
set (SCRIPT_EXT bat)
|
||||
@@ -641,8 +672,6 @@ if (INSTALL_SAMPLES)
|
||||
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/qt/Tutorial" RENAME "env.${SCRIPT_EXT}")
|
||||
endif()
|
||||
|
||||
OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}")
|
||||
|
||||
if (INSTALL_TEST_CASES)
|
||||
OCCT_INSTALL_FILE_OR_DIR ("tests/" "${INSTALL_DIR}/${INSTALL_DIR_TESTS}")
|
||||
endif()
|
||||
@@ -713,6 +742,11 @@ foreach(RESOURCE ${RESOURCES})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# patch installed DrawDefault file if BUILD_SHARED_LIBRARY_NAME_POSTFIX is changed
|
||||
if (NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
|
||||
OCCT_UPDATE_DRAW_DEFAULT_FILE()
|
||||
endif()
|
||||
|
||||
# define CSF variable
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
|
||||
|
||||
@@ -770,6 +804,8 @@ endif()
|
||||
set (OCCT_MODULES_ENABLED)
|
||||
set (OCCT_LIBRARIES)
|
||||
set (SET_OpenCASCADE_MODULES_TOOLKITS "\n# List of available OpenCASCADE libraries for each module\n")
|
||||
set (OCCT_COMPILE_DEFINITIONS)
|
||||
|
||||
foreach (OCCT_TOOLKIT ${BUILD_TOOLKITS})
|
||||
if (TARGET ${OCCT_TOOLKIT})
|
||||
|
||||
@@ -782,16 +818,46 @@ foreach (OCCT_TOOLKIT ${BUILD_TOOLKITS})
|
||||
get_target_property (${OCCT_TOOLKIT}_MODULE ${OCCT_TOOLKIT} "MODULE")
|
||||
list (APPEND OCCT_MODULES_ENABLED ${${OCCT_TOOLKIT}_MODULE})
|
||||
list (APPEND OpenCASCADE_${${OCCT_TOOLKIT}_MODULE}_TOOLKITS ${OCCT_TOOLKIT})
|
||||
|
||||
# get compile definitions of target directory
|
||||
get_directory_property (COMPILE_DEFINITIONS DIRECTORY "${${OCCT_TOOLKIT}_SOURCE_DIR}" "COMPILE_DEFINITIONS")
|
||||
list (APPEND OCCT_COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
list (REMOVE_DUPLICATES OCCT_MODULES_ENABLED)
|
||||
list (REMOVE_DUPLICATES OCCT_COMPILE_DEFINITIONS)
|
||||
|
||||
# export compile definitions and C/C++ flags for each configuration to OpenCASCADE config files
|
||||
foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
|
||||
set (SET_OpenCASCADE_COMPILE_DEFINITIONS)
|
||||
string (TOUPPER "${OCCT_CONFIGURATION}" OCCT_CONFIGURATION_UPPER)
|
||||
string (TOLOWER "${OCCT_CONFIGURATION}" OCCT_CONFIGURATION_LOWER)
|
||||
foreach(COMPILE_DEFINITION ${OCCT_COMPILE_DEFINITIONS})
|
||||
string(REPLACE "(" "\\(" COMPILE_DEFINITION "${COMPILE_DEFINITION}")
|
||||
string(REPLACE ")" "\\)" COMPILE_DEFINITION "${COMPILE_DEFINITION}")
|
||||
set (SET_OpenCASCADE_COMPILE_DEFINITIONS "${SET_OpenCASCADE_COMPILE_DEFINITIONS}set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:${OCCT_CONFIGURATION}>:${COMPILE_DEFINITION}>)\n")
|
||||
endforeach()
|
||||
set (SET_OpenCASCADE_CMAKE_C_FLAGS "${CMAKE_C_FLAGS_${OCCT_CONFIGURATION_UPPER}}")
|
||||
set (SET_OpenCASCADE_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_${OCCT_CONFIGURATION_UPPER}}")
|
||||
configure_file("${CMAKE_SOURCE_DIR}/adm/templates/OpenCASCADECompileDefinitionsAndFlags.cmake.in" "OpenCASCADECompileDefinitionsAndFlags-${OCCT_CONFIGURATION_LOWER}.cmake" @ONLY)
|
||||
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)")
|
||||
|
||||
foreach (OCCT_MODULE ${OCCT_MODULES})
|
||||
if (BUILD_MODULE_${OCCT_MODULE})
|
||||
set (SET_OpenCASCADE_MODULES_TOOLKITS "${SET_OpenCASCADE_MODULES_TOOLKITS}set (OpenCASCADE_${OCCT_MODULE}_LIBRARIES ${OpenCASCADE_${OCCT_MODULE}_TOOLKITS})\n")
|
||||
endif()
|
||||
|
||||
# sort enabled modules for correct work of OpenCASCADE config file
|
||||
list(FIND OCCT_MODULES_ENABLED "${OCCT_MODULE}" OCCT_MODULE_INDEX)
|
||||
if (NOT ${OCCT_MODULE_INDEX} EQUAL -1)
|
||||
list (APPEND OCCT_MODULES_ENABLED_SORTED ${OCCT_MODULE})
|
||||
endif()
|
||||
endforeach()
|
||||
set (OCCT_MODULES_ENABLED ${OCCT_MODULES_ENABLED_SORTED})
|
||||
|
||||
# Add all targets to the build-tree export set
|
||||
export (TARGETS ${OCCT_LIBRARIES} FILE "${CMAKE_BINARY_DIR}/OpenCASCADETargets.cmake")
|
||||
@@ -835,10 +901,8 @@ write_basic_package_version_file( ${CMAKE_BINARY_DIR}/OpenCASCADEConfigVersion.c
|
||||
install (FILES "${CMAKE_BINARY_DIR}/OpenCASCADEConfigVersion.cmake" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_CMAKE}")
|
||||
|
||||
# Install the export set for use with the install-tree for each configuration
|
||||
foreach (OCCT_MODULE ${OCCT_MODULES})
|
||||
if (BUILD_MODULE_${OCCT_MODULE})
|
||||
install(EXPORT OpenCASCADE${OCCT_MODULE}Targets DESTINATION "${INSTALL_DIR_CMAKE}")
|
||||
endif()
|
||||
foreach (OCCT_MODULE ${OCCT_MODULES_ENABLED})
|
||||
install(EXPORT OpenCASCADE${OCCT_MODULE}Targets DESTINATION "${INSTALL_DIR_CMAKE}")
|
||||
endforeach()
|
||||
|
||||
# Update generated OpenCASCADETargets-*.cmake files
|
||||
|
@@ -8,7 +8,7 @@ set(3RDPARTY_MACRO_ALREADY_INCLUDED 1)
|
||||
|
||||
macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEBUG)
|
||||
|
||||
if (NOT DEFINED INSTALL_${PRODUCT_NAME})
|
||||
if (NOT DEFINED INSTALL_${PRODUCT_NAME} AND BUILD_SHARED_LIBS)
|
||||
set (INSTALL_${PRODUCT_NAME} OFF CACHE BOOL "${INSTALL_${PRODUCT_NAME}_DESCR}")
|
||||
endif()
|
||||
|
||||
@@ -37,47 +37,50 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEB
|
||||
set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "" CACHE PATH "the path of ${HEADER_NAME}")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} library")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT 3RDPARTY_${PRODUCT_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library")
|
||||
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} library")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT 3RDPARTY_${PRODUCT_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# check 3RDPARTY_${PRODUCT_NAME}_ paths for consistency with specified 3RDPARTY_${PRODUCT_NAME}_DIR
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR PATH "the path to ${PRODUCT_NAME}")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY FILEPATH "the path to ${PRODUCT_NAME} library")
|
||||
if (BUILD_SHARED_LIBS)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY FILEPATH "the path to ${PRODUCT_NAME} library")
|
||||
|
||||
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
|
||||
else()
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR PATH "The directory containing ${PRODUCT_NAME} library")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL FILEPATH "the path to ${PRODUCT_NAME} shared library")
|
||||
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
|
||||
get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
|
||||
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
|
||||
else()
|
||||
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL_DIR PATH "The directory containing ${PRODUCT_NAME} shared library")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR PATH "The directory containing ${PRODUCT_NAME} library")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL FILEPATH "the path to ${PRODUCT_NAME} shared library")
|
||||
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
|
||||
get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
|
||||
else()
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL_DIR PATH "The directory containing ${PRODUCT_NAME} shared library")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -109,156 +112,158 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEB
|
||||
set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "" CACHE FILEPATH "The path to ${HEADER_NAME}" FORCE)
|
||||
endif()
|
||||
|
||||
# library
|
||||
if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# library
|
||||
if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
|
||||
|
||||
set (${PRODUCT_NAME}_PATH_SUFFIXES lib)
|
||||
if (ANDROID)
|
||||
set (${PRODUCT_NAME}_PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES} libs/${ANDROID_ABI})
|
||||
endif()
|
||||
set (${PRODUCT_NAME}_PATH_SUFFIXES lib)
|
||||
if (ANDROID)
|
||||
set (${PRODUCT_NAME}_PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES} libs/${ANDROID_ABI})
|
||||
endif()
|
||||
|
||||
# set 3RDPARTY_${PRODUCT_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_LIBRARY
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
|
||||
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
|
||||
find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY NAMES ${LIBRARY_NAME}
|
||||
PATHS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" "${3RDPARTY_${PRODUCT_NAME}_DIR}"
|
||||
PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY NAMES ${LIBRARY_NAME}
|
||||
PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
|
||||
else()
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
|
||||
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
|
||||
endif()
|
||||
|
||||
# shared library
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
|
||||
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
|
||||
|
||||
# set 3RDPARTY_${PRODUCT_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_DLL
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} shared library" FORCE)
|
||||
# set 3RDPARTY_${PRODUCT_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_LIBRARY
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
|
||||
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
|
||||
find_library (3RDPARTY_${PRODUCT_NAME}_DLL NAMES ${LIBRARY_NAME}
|
||||
PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}"
|
||||
PATH_SUFFIXES bin
|
||||
NO_DEFAULT_PATH)
|
||||
find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY NAMES ${LIBRARY_NAME}
|
||||
PATHS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" "${3RDPARTY_${PRODUCT_NAME}_DIR}"
|
||||
PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library (3RDPARTY_${PRODUCT_NAME}_DLL NAMES ${LIBRARY_NAME} PATH_SUFFIXES bin)
|
||||
find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY NAMES ${LIBRARY_NAME}
|
||||
PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
|
||||
get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
|
||||
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
|
||||
else()
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
|
||||
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DLL_DIR OR EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
|
||||
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
|
||||
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
|
||||
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "")
|
||||
|
||||
if (INSTALL_${PRODUCT_NAME})
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
# shared library
|
||||
if (WIN32)
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
else()
|
||||
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
|
||||
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
|
||||
endif()
|
||||
else()
|
||||
get_filename_component(ABS_PATH ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} REALPATH)
|
||||
if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
|
||||
|
||||
if ("${PRODUCT_NAME}" STREQUAL "FREEIMAGE")
|
||||
get_filename_component(FREEIMLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}" RENAME ${FREEIMLIB}.3)
|
||||
# set 3RDPARTY_${PRODUCT_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_DLL
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} shared library" FORCE)
|
||||
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
|
||||
find_library (3RDPARTY_${PRODUCT_NAME}_DLL NAMES ${LIBRARY_NAME}
|
||||
PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}"
|
||||
PATH_SUFFIXES bin
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
install (FILES "${ABS_PATH}"
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
|
||||
RENAME ${FREEIMLIB}.3)
|
||||
install (FILES "${ABS_PATH}"
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
|
||||
RENAME ${FREEIMLIB}.3)
|
||||
install (FILES "${ABS_PATH}"
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
|
||||
RENAME ${FREEIMLIB}.3)
|
||||
find_library (3RDPARTY_${PRODUCT_NAME}_DLL NAMES ${LIBRARY_NAME} PATH_SUFFIXES bin)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
|
||||
get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
|
||||
else()
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
|
||||
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if("${PRODUCT_NAME}" STREQUAL "GL2PS")
|
||||
get_filename_component(GL2PSLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}" RENAME ${GL2PSLIB}.1)
|
||||
else()
|
||||
install (FILES "${ABS_PATH}"
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
|
||||
RENAME ${GL2PSLIB}.1)
|
||||
install (FILES "${ABS_PATH}"
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
|
||||
RENAME ${GL2PSLIB}.1)
|
||||
install (FILES "${ABS_PATH}"
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
|
||||
RENAME ${GL2PSLIB}.1)
|
||||
endif()
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DLL_DIR OR EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
|
||||
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
|
||||
else()
|
||||
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
|
||||
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "")
|
||||
|
||||
if (INSTALL_${PRODUCT_NAME})
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
if (WIN32)
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
else()
|
||||
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
|
||||
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
|
||||
endif()
|
||||
else()
|
||||
get_filename_component(ABS_PATH ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} REALPATH)
|
||||
|
||||
if ("${PRODUCT_NAME}" STREQUAL "FREEIMAGE")
|
||||
get_filename_component(FREEIMLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}" RENAME ${FREEIMLIB}.3)
|
||||
else()
|
||||
install (FILES "${ABS_PATH}"
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
|
||||
RENAME ${FREEIMLIB}.3)
|
||||
install (FILES "${ABS_PATH}"
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
|
||||
RENAME ${FREEIMLIB}.3)
|
||||
install (FILES "${ABS_PATH}"
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
|
||||
RENAME ${FREEIMLIB}.3)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if("${PRODUCT_NAME}" STREQUAL "GL2PS")
|
||||
get_filename_component(GL2PSLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}" RENAME ${GL2PSLIB}.1)
|
||||
else()
|
||||
install (FILES "${ABS_PATH}"
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
|
||||
RENAME ${GL2PSLIB}.1)
|
||||
install (FILES "${ABS_PATH}"
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
|
||||
RENAME ${GL2PSLIB}.1)
|
||||
install (FILES "${ABS_PATH}"
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
|
||||
RENAME ${GL2PSLIB}.1)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
|
||||
else()
|
||||
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro (COMPLIANCE_PRODUCT_CONSISTENCY LIBNAME)
|
||||
@@ -272,48 +277,52 @@ macro (COMPLIANCE_PRODUCT_CONSISTENCY LIBNAME)
|
||||
set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
|
||||
endif()
|
||||
|
||||
# library dir
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# library dir
|
||||
set (DOES_PATH_CONTAIN FALSE)
|
||||
if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
|
||||
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
|
||||
endif()
|
||||
if (NOT DOES_PATH_CONTAIN)
|
||||
set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
|
||||
endif()
|
||||
|
||||
# shared library dir
|
||||
if (WIN32)
|
||||
set (DOES_PATH_CONTAIN FALSE)
|
||||
if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
|
||||
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL_DIR}")
|
||||
endif()
|
||||
if (NOT DOES_PATH_CONTAIN)
|
||||
set (3RDPARTY_${LIBNAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# check library
|
||||
set (DOES_PATH_CONTAIN FALSE)
|
||||
if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
|
||||
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
|
||||
if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
|
||||
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
if (NOT DOES_PATH_CONTAIN)
|
||||
set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
|
||||
set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
|
||||
endif()
|
||||
|
||||
# shared library dir
|
||||
# check shared library
|
||||
if (WIN32)
|
||||
set (DOES_PATH_CONTAIN FALSE)
|
||||
if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
|
||||
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL_DIR}")
|
||||
if (3RDPARTY_${LIBNAME}_DLL AND EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
|
||||
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DLL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL}")
|
||||
endif()
|
||||
endif()
|
||||
if (NOT DOES_PATH_CONTAIN)
|
||||
set (3RDPARTY_${LIBNAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
|
||||
set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# check library
|
||||
set (DOES_PATH_CONTAIN FALSE)
|
||||
if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
|
||||
if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
|
||||
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
if (NOT DOES_PATH_CONTAIN)
|
||||
set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
|
||||
endif()
|
||||
|
||||
# check shared library
|
||||
if (WIN32)
|
||||
set (DOES_PATH_CONTAIN FALSE)
|
||||
if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
|
||||
if (3RDPARTY_${LIBNAME}_DLL AND EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
|
||||
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DLL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL}")
|
||||
endif()
|
||||
endif()
|
||||
if (NOT DOES_PATH_CONTAIN)
|
||||
set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
@@ -1,45 +1,57 @@
|
||||
# doxygen
|
||||
|
||||
set (3RDPARTY_DOT_EXECUTABLE_DESCR "The path to the 'dot' tool producing layered drawings of directed graphs.\nThis tool used by doxygen")
|
||||
set (3RDPARTY_DOXYGEN_EXECUTABLE_DESCR "The path to the doxygen command")
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DOXYGEN_EXECUTABLE)
|
||||
set (3RDPARTY_DOXYGEN_EXECUTABLE "" CACHE FILEPATH "${3RDPARTY_DOXYGEN_EXECUTABLE_DESCR}")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DOT_EXECUTABLE)
|
||||
set (3RDPARTY_DOT_EXECUTABLE "" CACHE FILEPATH "${3RDPARTY_DOT_EXECUTABLE_DESCR}")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_SKIP_DOT_EXECUTABLE)
|
||||
set (3RDPARTY_SKIP_DOT_EXECUTABLE OFF CACHE BOOL "Skip trying to find Dot")
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_SKIP_DOT_EXECUTABLE)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_DOT_EXECUTABLE)
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE OR (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE AND NOT 3RDPARTY_DOT_EXECUTABLE))
|
||||
|
||||
set (DOXYGEN_SKIP_DOT ${3RDPARTY_SKIP_DOT_EXECUTABLE})
|
||||
if (DO_ONLY_CHECK_FOR_DOXYGEN)
|
||||
message (STATUS "Info. Detecting doxygen")
|
||||
set (DOXYGEN_SKIP_DOT ON)
|
||||
find_package (Doxygen)
|
||||
|
||||
if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE AND DOXYGEN_EXECUTABLE)
|
||||
set (3RDPARTY_DOXYGEN_EXECUTABLE "${DOXYGEN_EXECUTABLE}" CACHE FILEPATH "${3RDPARTY_DOXYGEN_EXECUTABLE_DESCR}" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE AND NOT 3RDPARTY_DOT_EXECUTABLE AND DOXYGEN_DOT_EXECUTABLE)
|
||||
set (3RDPARTY_DOT_EXECUTABLE "${DOXYGEN_DOT_EXECUTABLE}" CACHE FILEPATH "${3RDPARTY_DOT_EXECUTABLE_DESCR}" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE OR NOT EXISTS "${3RDPARTY_DOXYGEN_EXECUTABLE}")
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DOXYGEN_EXECUTABLE)
|
||||
endif()
|
||||
set (CAN_DOXYGEN_BE_USED OFF)
|
||||
if (DOXYGEN_EXECUTABLE)
|
||||
set (CAN_DOXYGEN_BE_USED ON)
|
||||
message (STATUS "Info. Doxygen is found and can be used")
|
||||
endif()
|
||||
else()
|
||||
set (3RDPARTY_DOT_EXECUTABLE_DESCR "The path to the 'dot' tool producing layered drawings of directed graphs.\nThis tool used by doxygen")
|
||||
set (3RDPARTY_DOXYGEN_EXECUTABLE_DESCR "The path to the doxygen command")
|
||||
|
||||
if (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE)
|
||||
if (NOT 3RDPARTY_DOT_EXECUTABLE OR NOT EXISTS "${3RDPARTY_DOT_EXECUTABLE}")
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DOT_EXECUTABLE)
|
||||
if (NOT DEFINED 3RDPARTY_DOXYGEN_EXECUTABLE)
|
||||
set (3RDPARTY_DOXYGEN_EXECUTABLE "" CACHE FILEPATH "${3RDPARTY_DOXYGEN_EXECUTABLE_DESCR}")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DOT_EXECUTABLE)
|
||||
set (3RDPARTY_DOT_EXECUTABLE "" CACHE FILEPATH "${3RDPARTY_DOT_EXECUTABLE_DESCR}")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_SKIP_DOT_EXECUTABLE)
|
||||
set (3RDPARTY_SKIP_DOT_EXECUTABLE ON CACHE BOOL "Skip trying to find Dot")
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_SKIP_DOT_EXECUTABLE)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_DOT_EXECUTABLE)
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE OR (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE AND NOT 3RDPARTY_DOT_EXECUTABLE))
|
||||
|
||||
set (DOXYGEN_SKIP_DOT ${3RDPARTY_SKIP_DOT_EXECUTABLE})
|
||||
find_package (Doxygen)
|
||||
|
||||
if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE AND DOXYGEN_EXECUTABLE)
|
||||
set (3RDPARTY_DOXYGEN_EXECUTABLE "${DOXYGEN_EXECUTABLE}" CACHE FILEPATH "${3RDPARTY_DOXYGEN_EXECUTABLE_DESCR}" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE AND NOT 3RDPARTY_DOT_EXECUTABLE AND DOXYGEN_DOT_EXECUTABLE)
|
||||
set (3RDPARTY_DOT_EXECUTABLE "${DOXYGEN_DOT_EXECUTABLE}" CACHE FILEPATH "${3RDPARTY_DOT_EXECUTABLE_DESCR}" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE OR NOT EXISTS "${3RDPARTY_DOXYGEN_EXECUTABLE}")
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DOXYGEN_EXECUTABLE)
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE)
|
||||
if (NOT 3RDPARTY_DOT_EXECUTABLE OR NOT EXISTS "${3RDPARTY_DOT_EXECUTABLE}")
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DOT_EXECUTABLE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# freetype
|
||||
|
||||
if (NOT DEFINED INSTALL_FREETYPE)
|
||||
if (NOT DEFINED INSTALL_FREETYPE AND BUILD_SHARED_LIBS)
|
||||
set (INSTALL_FREETYPE OFF CACHE BOOL "${INSTALL_FREETYPE_DESCR}")
|
||||
endif()
|
||||
|
||||
@@ -37,23 +37,25 @@ if (NOT DEFINED 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
|
||||
set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "" CACHE FILEPATH "the path of freetype2")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY OR NOT 3RDPARTY_FREETYPE_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
|
||||
set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "freetype library" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY_DIR)
|
||||
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_FREETYPE_DLL OR NOT 3RDPARTY_FREETYPE_DLL_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
|
||||
set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY OR NOT 3RDPARTY_FREETYPE_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
|
||||
set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "freetype library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_FREETYPE_DLL_DIR)
|
||||
set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE PATH "The directory containing freetype shared library")
|
||||
if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY_DIR)
|
||||
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_FREETYPE_DLL OR NOT 3RDPARTY_FREETYPE_DLL_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
|
||||
set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_FREETYPE_DLL_DIR)
|
||||
set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE PATH "The directory containing freetype shared library")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -61,24 +63,25 @@ endif()
|
||||
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build FILEPATH "the path to ft2build.h")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "the path to ftheader.h")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY FILEPATH "the path to freetype library")
|
||||
if (BUILD_SHARED_LIBS)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY FILEPATH "the path to freetype library")
|
||||
|
||||
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
|
||||
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
|
||||
else()
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY_DIR PATH "The directory containing freetype library")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL FILEPATH "the path to freetype shared library")
|
||||
|
||||
if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
|
||||
get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
|
||||
set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype shared library" FORCE)
|
||||
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
|
||||
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
|
||||
else()
|
||||
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL_DIR PATH "The directory containing freetype shared library")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY_DIR PATH "The directory containing freetype library")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL FILEPATH "the path to freetype shared library")
|
||||
|
||||
if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
|
||||
get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
|
||||
set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype shared library" FORCE)
|
||||
else()
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL_DIR PATH "The directory containing freetype shared library")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -118,7 +121,9 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
|
||||
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_ft2build FILEPATH "the path to ft2build.h")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "the path to ftheader.h")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library")
|
||||
if (BUILD_SHARED_LIBS)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# assign the found paths to corresponding 3RDPARTY_FREETYPE_ variables
|
||||
@@ -134,17 +139,19 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}")
|
||||
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY}" CACHE FILEPATH "The path to freetype library" FORCE)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}")
|
||||
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY}" CACHE FILEPATH "The path to freetype library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
|
||||
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
|
||||
else()
|
||||
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
|
||||
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
|
||||
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
|
||||
else()
|
||||
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -211,131 +218,132 @@ else()
|
||||
endif()
|
||||
|
||||
# freetype library
|
||||
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
|
||||
|
||||
set (FREETYPE_PATH_SUFFIXES lib)
|
||||
if (ANDROID)
|
||||
set (FREETYPE_PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES} libs/${ANDROID_ABI})
|
||||
endif()
|
||||
set (FREETYPE_PATH_SUFFIXES lib)
|
||||
if (ANDROID)
|
||||
set (FREETYPE_PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES} libs/${ANDROID_ABI})
|
||||
endif()
|
||||
|
||||
# set 3RDPARTY_FREETYPE_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_LIBRARY
|
||||
set (3RDPARTY_FREETYPE_LIBRARY "3RDPARTY_FREETYPE_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to freetype library" FORCE)
|
||||
|
||||
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
|
||||
find_library (3RDPARTY_FREETYPE_LIBRARY freetype
|
||||
PATHS "${3RDPARTY_FREETYPE_LIBRARY_DIR}" "${3RDPARTY_FREETYPE_DIR}"
|
||||
PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library (3RDPARTY_FREETYPE_LIBRARY freetype
|
||||
PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
|
||||
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
|
||||
else()
|
||||
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_FREETYPE_LIBRARY_DIR AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_LIBRARY_DIR)
|
||||
|
||||
set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "The path to freetype library" FORCE)
|
||||
endif()
|
||||
|
||||
# freetype shared library
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}")
|
||||
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
|
||||
|
||||
# set 3RDPARTY_FREETYPE_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_DLL
|
||||
set (3RDPARTY_FREETYPE_DLL "3RDPARTY_FREETYPE_DLL-NOTFOUND" CACHE FILEPATH "The path to freetype shared library" FORCE)
|
||||
# set 3RDPARTY_FREETYPE_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_LIBRARY
|
||||
set (3RDPARTY_FREETYPE_LIBRARY "3RDPARTY_FREETYPE_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to freetype library" FORCE)
|
||||
|
||||
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
|
||||
find_library (3RDPARTY_FREETYPE_DLL freetype
|
||||
PATHS "${3RDPARTY_FREETYPE_DIR}"
|
||||
PATH_SUFFIXES bin
|
||||
NO_DEFAULT_PATH)
|
||||
find_library (3RDPARTY_FREETYPE_LIBRARY freetype
|
||||
PATHS "${3RDPARTY_FREETYPE_LIBRARY_DIR}" "${3RDPARTY_FREETYPE_DIR}"
|
||||
PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library (3RDPARTY_FREETYPE_DLL freetype
|
||||
PATH_SUFFIXES bin)
|
||||
find_library (3RDPARTY_FREETYPE_LIBRARY freetype
|
||||
PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
|
||||
get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
|
||||
set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
|
||||
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
|
||||
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
|
||||
else()
|
||||
set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE PATH "The directory containing freetype shared library" FORCE)
|
||||
|
||||
set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
|
||||
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_FREETYPE_DLL_DIR OR EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
|
||||
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_FREETYPE_DLL_DIR}")
|
||||
if (3RDPARTY_FREETYPE_LIBRARY_DIR AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_DLL_DIR)
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_LIBRARY_DIR)
|
||||
|
||||
set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "The path to freetype library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# install instructions
|
||||
if (INSTALL_FREETYPE)
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
|
||||
# freetype shared library
|
||||
if (WIN32)
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES "${3RDPARTY_FREETYPE_DLL}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
else()
|
||||
install (FILES "${3RDPARTY_FREETYPE_DLL}"
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
install (FILES "${3RDPARTY_FREETYPE_DLL}"
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
|
||||
install (FILES "${3RDPARTY_FREETYPE_DLL}"
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
|
||||
endif()
|
||||
else()
|
||||
get_filename_component(3RDPARTY_FREETYPE_LIBRARY_ABS ${3RDPARTY_FREETYPE_LIBRARY} REALPATH)
|
||||
get_filename_component(3RDPARTY_FREETYPE_LIBRARY_NAME ${3RDPARTY_FREETYPE_LIBRARY} NAME)
|
||||
if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}")
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
|
||||
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
|
||||
|
||||
# set 3RDPARTY_FREETYPE_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_DLL
|
||||
set (3RDPARTY_FREETYPE_DLL "3RDPARTY_FREETYPE_DLL-NOTFOUND" CACHE FILEPATH "The path to freetype shared library" FORCE)
|
||||
|
||||
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
|
||||
find_library (3RDPARTY_FREETYPE_DLL freetype
|
||||
PATHS "${3RDPARTY_FREETYPE_DIR}"
|
||||
PATH_SUFFIXES bin
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library (3RDPARTY_FREETYPE_DLL freetype
|
||||
PATH_SUFFIXES bin)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
|
||||
get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
|
||||
set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
|
||||
else()
|
||||
set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE PATH "The directory containing freetype shared library" FORCE)
|
||||
|
||||
set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_FREETYPE_DLL_DIR OR EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
|
||||
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_FREETYPE_DLL_DIR}")
|
||||
else()
|
||||
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
|
||||
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
|
||||
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
|
||||
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
|
||||
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
|
||||
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_DLL_DIR)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (USED_3RDPARTY_FREETYPE_DIR "")
|
||||
else()
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_DLL_DIR})
|
||||
# install instructions
|
||||
if (INSTALL_FREETYPE)
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
|
||||
if (WIN32)
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES "${3RDPARTY_FREETYPE_DLL}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
else()
|
||||
install (FILES "${3RDPARTY_FREETYPE_DLL}"
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
install (FILES "${3RDPARTY_FREETYPE_DLL}"
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
|
||||
install (FILES "${3RDPARTY_FREETYPE_DLL}"
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
|
||||
endif()
|
||||
else()
|
||||
get_filename_component(3RDPARTY_FREETYPE_LIBRARY_ABS ${3RDPARTY_FREETYPE_LIBRARY} REALPATH)
|
||||
get_filename_component(3RDPARTY_FREETYPE_LIBRARY_NAME ${3RDPARTY_FREETYPE_LIBRARY} NAME)
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
|
||||
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
|
||||
else()
|
||||
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
|
||||
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
|
||||
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
|
||||
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
|
||||
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
|
||||
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (USED_3RDPARTY_FREETYPE_DIR "")
|
||||
else()
|
||||
set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_LIBRARY_DIR})
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_DLL_DIR})
|
||||
else()
|
||||
set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_LIBRARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -344,4 +352,12 @@ OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_ft2build)
|
||||
OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_freetype2)
|
||||
OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY)
|
||||
|
||||
mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_DLL)
|
||||
OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_DLL_DIR)
|
||||
OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_LIBRARY)
|
||||
OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_LIBRARY_DIR)
|
||||
OCCT_CHECK_AND_UNSET(INSTALL_FREETYPE)
|
||||
endif()
|
||||
|
@@ -10,7 +10,7 @@ if (NOT DEFINED USE_TCL)
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
|
||||
endif()
|
||||
|
||||
if (USE_TCL)
|
||||
if (USE_TCL AND BUILD_SHARED_LIBS)
|
||||
if ("${3RDPARTY_TCL_LIBRARY_VERSION}" STREQUAL "")
|
||||
message (STATUS "Warning: TCL version has not been specified by CSF_TclLibs defining thus it will be used as 8.6")
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION "8.6")
|
||||
@@ -44,6 +44,12 @@ if (WIN32)
|
||||
set (CSF_FREETYPE)
|
||||
endif()
|
||||
|
||||
if (USE_GL2PS)
|
||||
set (CSF_GL2PS "gl2ps.lib")
|
||||
else()
|
||||
set (CSF_GL2PS)
|
||||
endif()
|
||||
|
||||
if (USE_FREEIMAGE)
|
||||
set (CSF_FreeImagePlus "freeimage.lib freeimageplus.lib")
|
||||
else()
|
||||
|
@@ -104,14 +104,20 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMP
|
||||
elseif(NOT WIN32)
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
endif()
|
||||
else()
|
||||
if (NOT ANDROID AND NOT MINGW)
|
||||
set (CMAKE_STATIC_LINKER_FLAGS "-lm ${CMAKE_SHARED_STATIC_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
# Set default release optimization option to O2 instead of O3, since in
|
||||
# some OCCT related examples, this gives significantly smaller binaries
|
||||
# at comparable performace with MinGW-w64.
|
||||
string (REGEX MATCH "-O3" IS_O3_CXX "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
if (IS_O3_CXX)
|
||||
string (REGEX REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
else()
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
|
||||
endif()
|
||||
|
||||
set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
|
||||
add_definitions(-D_WIN32_WINNT=0x0501)
|
||||
# workaround bugs in mingw with vtable export
|
||||
|
@@ -576,3 +576,26 @@ macro (OCCT_INSERT_CODE_FOR_TARGET)
|
||||
set (OCCT_INSTALL_BIN_LETTER \"d\")
|
||||
endif()")
|
||||
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\")
|
||||
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)")
|
||||
endmacro()
|
||||
|
||||
macro (OCCT_CREATE_SYMLINK_TO_FILE LIBRARY_NAME LINK_NAME)
|
||||
if (NOT WIN32)
|
||||
install (CODE "if (EXISTS \"${LIBRARY_NAME}\")
|
||||
execute_process (COMMAND ln -s \"${LIBRARY_NAME}\" \"${LINK_NAME}\")
|
||||
endif()
|
||||
")
|
||||
endif()
|
||||
endmacro()
|
||||
|
@@ -152,16 +152,35 @@ else()
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
|
||||
set (CMAKE_SHARED_LIBRARY_SUFFIX_DEFAULT ${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
set (CMAKE_SHARED_LIBRARY_SUFFIX "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
|
||||
install (TARGETS ${PROJECT_NAME}
|
||||
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}")
|
||||
|
||||
if (NOT WIN32)
|
||||
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
|
||||
set (LINK_NAME "${INSTALL_DIR}/${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}/lib${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX_DEFAULT}")
|
||||
set (LIBRARY_NAME "${INSTALL_DIR}/${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}/lib${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
OCCT_CREATE_SYMLINK_TO_FILE (${LIBRARY_NAME} ${LINK_NAME})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CURRENT_MODULE)
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER "Modules/${CURRENT_MODULE}")
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES MODULE "${CURRENT_MODULE}")
|
||||
if (APPLE)
|
||||
if (NOT "${INSTALL_NAME_DIR}" STREQUAL "")
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "${INSTALL_NAME_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
get_property (OCC_VERSION_MAJOR GLOBAL PROPERTY OCC_VERSION_MAJOR)
|
||||
@@ -216,4 +235,21 @@ if (APPLE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
|
||||
# Update list of used VTK libraries if OpenGL2 Rendering BackEnd is used.
|
||||
# Add VTK_OPENGL2_BACKEND definition.
|
||||
if("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL2")
|
||||
add_definitions(-DVTK_OPENGL2_BACKEND)
|
||||
foreach (VTK_EXCLUDE_LIBRARY vtkRenderingOpenGL vtkRenderingFreeTypeOpenGL)
|
||||
list (FIND USED_TOOLKITS_BY_CURRENT_PROJECT "${VTK_EXCLUDE_LIBRARY}" IS_VTK_OPENGL_FOUND)
|
||||
if (NOT ${IS_VTK_OPENGL_FOUND} EQUAL -1)
|
||||
list (REMOVE_ITEM USED_TOOLKITS_BY_CURRENT_PROJECT ${VTK_EXCLUDE_LIBRARY})
|
||||
if (${VTK_EXCLUDE_LIBRARY} STREQUAL vtkRenderingOpenGL)
|
||||
list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT vtkRenderingOpenGL2)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
|
||||
endif()
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# tbb
|
||||
|
||||
if (NOT DEFINED INSTALL_TBB)
|
||||
if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
|
||||
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
|
||||
endif()
|
||||
|
||||
@@ -9,7 +9,7 @@ if (NOT DEFINED 3RDPARTY_TBB_DIR)
|
||||
set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND BUILD_SHARED_LIBS)
|
||||
add_definitions (-D__TBB_NO_IMPLICIT_LINKAGE)
|
||||
add_definitions (-D__TBBMALLOC_NO_IMPLICIT_LINKAGE)
|
||||
endif()
|
||||
@@ -129,7 +129,7 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_NAME)
|
||||
# tbb/tbbmalloc library
|
||||
if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
|
||||
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
|
||||
set (PRODUCT_PATH_SUFFIXES lib ${lower_PRODUCT_NAME})
|
||||
|
||||
# set 3RDPARTY_${PRODUCT_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_LIBRARY
|
||||
@@ -231,7 +231,7 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_NAME)
|
||||
endif()
|
||||
|
||||
# install tbb/tbbmalloc
|
||||
if (INSTALL_${PRODUCT_NAME})
|
||||
if (INSTALL_TBB)
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
@@ -275,18 +275,18 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_NAME)
|
||||
mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
|
||||
endmacro()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
TBB_PRODUCT_SEARCH (TBB)
|
||||
TBB_PRODUCT_SEARCH (TBBMALLOC)
|
||||
|
||||
TBB_PRODUCT_SEARCH (TBB)
|
||||
TBB_PRODUCT_SEARCH (TBBMALLOC)
|
||||
|
||||
|
||||
if (INSTALL_TBB)
|
||||
set (USED_3RDPARTY_TBB_DIR "")
|
||||
else()
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
|
||||
if (INSTALL_TBB)
|
||||
set (USED_3RDPARTY_TBB_DIR "")
|
||||
else()
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
|
||||
else()
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
@@ -1,6 +1,6 @@
|
||||
# tcl
|
||||
|
||||
if (NOT DEFINED INSTALL_TCL)
|
||||
if (NOT DEFINED INSTALL_TCL AND BUILD_SHARED_LIBS)
|
||||
set (INSTALL_TCL OFF CACHE BOOL "${INSTALL_TCL_DESCR}")
|
||||
endif()
|
||||
|
||||
@@ -14,26 +14,28 @@ if (NOT DEFINED 3RDPARTY_TCL_INCLUDE_DIR)
|
||||
set (3RDPARTY_TCL_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tcl")
|
||||
endif()
|
||||
|
||||
# tcl library file (with absolute path)
|
||||
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR)
|
||||
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library" FORCE)
|
||||
endif()
|
||||
|
||||
# tcl library directory
|
||||
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR)
|
||||
set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library")
|
||||
endif()
|
||||
|
||||
# tcl shared library (with absolute path)
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR)
|
||||
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "tcl shared library" FORCE)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# tcl library file (with absolute path)
|
||||
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR)
|
||||
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# tcl shared library directory
|
||||
if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR)
|
||||
set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library")
|
||||
# tcl library directory
|
||||
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR)
|
||||
set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library")
|
||||
endif()
|
||||
|
||||
# tcl shared library (with absolute path)
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR)
|
||||
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "tcl shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# tcl shared library directory
|
||||
if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR)
|
||||
set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# search for tcl in user defined directory
|
||||
@@ -53,7 +55,7 @@ endif()
|
||||
COMPLIANCE_PRODUCT_CONSISTENCY(TCL)
|
||||
|
||||
# use default (CMake) TCL search
|
||||
find_package(TCL)
|
||||
find_package(TCL QUIET)
|
||||
|
||||
# tcl include dir
|
||||
if (NOT 3RDPARTY_TCL_INCLUDE_DIR)
|
||||
@@ -62,199 +64,203 @@ if (NOT 3RDPARTY_TCL_INCLUDE_DIR)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# tcl dir and library
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY)
|
||||
if (TCL_LIBRARY AND EXISTS "${TCL_LIBRARY}")
|
||||
set (3RDPARTY_TCL_LIBRARY "${TCL_LIBRARY}" CACHE FILEPATH "TCL library" FORCE)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# tcl dir and library
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY)
|
||||
if (TCL_LIBRARY AND EXISTS "${TCL_LIBRARY}")
|
||||
set (3RDPARTY_TCL_LIBRARY "${TCL_LIBRARY}" CACHE FILEPATH "TCL library" FORCE)
|
||||
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY_DIR)
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
|
||||
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY_DIR)
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
|
||||
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_TCL_DLL)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_TCL_DLL)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
|
||||
|
||||
set (DLL_FOLDER_FOR_SEARCH "")
|
||||
if (3RDPARTY_TCL_DLL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
|
||||
elseif (3RDPARTY_TCL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
|
||||
elseif (3RDPARTY_TCL_LIBRARY_DIR)
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
|
||||
set (DLL_FOLDER_FOR_SEARCH "")
|
||||
if (3RDPARTY_TCL_DLL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
|
||||
elseif (3RDPARTY_TCL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
|
||||
elseif (3RDPARTY_TCL_LIBRARY_DIR)
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
|
||||
find_library (3RDPARTY_TCL_DLL NAMES tcl86 tcl85
|
||||
PATHS "${DLL_FOLDER_FOR_SEARCH}"
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
|
||||
find_library (3RDPARTY_TCL_DLL NAMES tcl86 tcl85
|
||||
PATHS "${DLL_FOLDER_FOR_SEARCH}"
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
COMPLIANCE_PRODUCT_CONSISTENCY(TCL)
|
||||
|
||||
# tcl dir and library
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY)
|
||||
set (3RDPARTY_TCL_LIBRARY "3RDPARTY_TCL_LIBRARY-NOTFOUND" CACHE FILEPATH "TCL library" FORCE)
|
||||
find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
|
||||
PATHS "${3RDPARTY_TCL_LIBRARY_DIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# tcl dir and library
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY)
|
||||
set (3RDPARTY_TCL_LIBRARY "3RDPARTY_TCL_LIBRARY-NOTFOUND" CACHE FILEPATH "TCL library" FORCE)
|
||||
find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
|
||||
PATHS "${3RDPARTY_TCL_LIBRARY_DIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
# search in another place if previous search doesn't find anything
|
||||
find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
|
||||
PATHS "${3RDPARTY_TCL_DIR}/lib"
|
||||
NO_DEFAULT_PATH)
|
||||
# search in another place if previous search doesn't find anything
|
||||
find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
|
||||
PATHS "${3RDPARTY_TCL_DIR}/lib"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY OR NOT EXISTS "${3RDPARTY_TCL_LIBRARY}")
|
||||
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "TCL library" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY_DIR AND 3RDPARTY_TCL_LIBRARY)
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
|
||||
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION "")
|
||||
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
|
||||
get_filename_component (TCL_LIBRARY_NAME "${3RDPARTY_TCL_LIBRARY}" NAME)
|
||||
string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY_NAME}")
|
||||
|
||||
if (NOT "${TCL_LIBRARY_VERSION}" STREQUAL "${TCL_LIBRARY_NAME}")
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION "${TCL_LIBRARY_VERSION}")
|
||||
else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
|
||||
message (STATUS "Info: TCL version isn't found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "")
|
||||
if (3RDPARTY_TCL_LIBRARY_VERSION)
|
||||
string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TCL_MAJOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
|
||||
string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TCL_MINOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TCL_MAJOR_VERSION}.${3RDPARTY_TCL_MINOR_VERSION}")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_TCL_DLL)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
|
||||
|
||||
set (DLL_FOLDER_FOR_SEARCH "")
|
||||
if (3RDPARTY_TCL_DLL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
|
||||
elseif (3RDPARTY_TCL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
|
||||
else()
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY OR NOT EXISTS "${3RDPARTY_TCL_LIBRARY}")
|
||||
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "TCL library" FORCE)
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
|
||||
find_library (3RDPARTY_TCL_DLL NAMES tcl${3RDPARTY_TCL_LIBRARY_VERSION}
|
||||
PATHS "${DLL_FOLDER_FOR_SEARCH}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
if (NOT 3RDPARTY_TCL_DLL OR NOT EXISTS "${3RDPARTY_TCL_DLL}")
|
||||
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "TCL shared library" FORCE)
|
||||
if (NOT 3RDPARTY_TCL_LIBRARY_DIR AND 3RDPARTY_TCL_LIBRARY)
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
|
||||
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
if (NOT 3RDPARTY_TCL_DLL_DIR AND 3RDPARTY_TCL_DLL)
|
||||
get_filename_component (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH)
|
||||
set (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL_DIR}" CACHE FILEPATH "The directory containing TCL shared library" FORCE)
|
||||
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION "")
|
||||
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
|
||||
get_filename_component (TCL_LIBRARY_NAME "${3RDPARTY_TCL_LIBRARY}" NAME)
|
||||
string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY_NAME}")
|
||||
|
||||
if (NOT "${TCL_LIBRARY_VERSION}" STREQUAL "${TCL_LIBRARY_NAME}")
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION "${TCL_LIBRARY_VERSION}")
|
||||
else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
|
||||
message (STATUS "Info: TCL version isn't found")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# include found paths to common variables
|
||||
if (3RDPARTY_TCL_INCLUDE_DIR AND EXISTS "${3RDPARTY_TCL_INCLUDE_DIR}")
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TCL_INCLUDE_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_LIBRARY_DIR})
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (3RDPARTY_TCL_DLL OR EXISTS "${3RDPARTY_TCL_DLL}")
|
||||
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TCL_DLL_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_DLL_DIR)
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "")
|
||||
if (3RDPARTY_TCL_LIBRARY_VERSION)
|
||||
string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TCL_MAJOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
|
||||
string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TCL_MINOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
|
||||
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TCL_MAJOR_VERSION}.${3RDPARTY_TCL_MINOR_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# install tcl
|
||||
if (INSTALL_TCL)
|
||||
# include occt macros. compiler_bitness, os_wiht_bit, compiler
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
if (WIN32)
|
||||
# tcl 8.6 requires zlib. install all dlls from tcl bin folder that may contain zlib also
|
||||
if (NOT 3RDPARTY_TCL_DLL)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
|
||||
|
||||
# collect and install all dlls from tcl dll dirs
|
||||
file (GLOB TCL_DLLS "${3RDPARTY_TCL_DLL_DIR}/*.dll")
|
||||
set (DLL_FOLDER_FOR_SEARCH "")
|
||||
if (3RDPARTY_TCL_DLL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
|
||||
elseif (3RDPARTY_TCL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
|
||||
else()
|
||||
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
|
||||
endif()
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${TCL_DLLS} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
else()
|
||||
install (FILES ${TCL_DLLS}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
install (FILES ${TCL_DLLS}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
|
||||
install (FILES ${TCL_DLLS}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
|
||||
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
|
||||
find_library (3RDPARTY_TCL_DLL NAMES tcl${3RDPARTY_TCL_LIBRARY_VERSION}
|
||||
PATHS "${DLL_FOLDER_FOR_SEARCH}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
if (NOT 3RDPARTY_TCL_DLL OR NOT EXISTS "${3RDPARTY_TCL_DLL}")
|
||||
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "TCL shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
get_filename_component(3RDPARTY_TCL_LIBRARY_REALPATH ${3RDPARTY_TCL_LIBRARY} REALPATH)
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i")
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d")
|
||||
if (NOT 3RDPARTY_TCL_DLL_DIR AND 3RDPARTY_TCL_DLL)
|
||||
get_filename_component (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH)
|
||||
set (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL_DIR}" CACHE FILEPATH "The directory containing TCL shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (TCL_TCLSH_VERSION)
|
||||
# tcl is required to install in lib folder (without)
|
||||
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
|
||||
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
|
||||
# include found paths to common variables
|
||||
if (3RDPARTY_TCL_INCLUDE_DIR AND EXISTS "${3RDPARTY_TCL_INCLUDE_DIR}")
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TCL_INCLUDE_DIR}")
|
||||
else()
|
||||
message (STATUS "\nWarning: tclX.X subdir won't be copyied during the installation process.")
|
||||
message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_LIBRARY_DIR})
|
||||
endif()
|
||||
|
||||
set (USED_3RDPARTY_TCL_DIR "")
|
||||
else()
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR})
|
||||
else()
|
||||
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR})
|
||||
if (3RDPARTY_TCL_DLL OR EXISTS "${3RDPARTY_TCL_DLL}")
|
||||
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TCL_DLL_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_DLL_DIR)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TCL_DLL)
|
||||
# install tcl
|
||||
if (INSTALL_TCL)
|
||||
# include occt macros. compiler_bitness, os_wiht_bit, compiler
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
if (WIN32)
|
||||
# tcl 8.6 requires zlib. install all dlls from tcl bin folder that may contain zlib also
|
||||
|
||||
# collect and install all dlls from tcl dll dirs
|
||||
file (GLOB TCL_DLLS "${3RDPARTY_TCL_DLL_DIR}/*.dll")
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${TCL_DLLS} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
else()
|
||||
install (FILES ${TCL_DLLS}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
install (FILES ${TCL_DLLS}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
|
||||
install (FILES ${TCL_DLLS}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
|
||||
endif()
|
||||
else()
|
||||
get_filename_component(3RDPARTY_TCL_LIBRARY_REALPATH ${3RDPARTY_TCL_LIBRARY} REALPATH)
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i")
|
||||
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (TCL_TCLSH_VERSION)
|
||||
# tcl is required to install in lib folder (without)
|
||||
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
|
||||
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
message (STATUS "\nWarning: tclX.X subdir won't be copyied during the installation process.")
|
||||
message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
|
||||
endif()
|
||||
|
||||
set (USED_3RDPARTY_TCL_DIR "")
|
||||
else()
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR})
|
||||
else()
|
||||
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TCL_DLL)
|
||||
endif()
|
||||
|
||||
if (TK_FOUND AND 3RDPARTY_TCL_DIR)
|
||||
|
||||
@@ -278,3 +284,11 @@ OCCT_CHECK_AND_UNSET (TCL_TCLSH)
|
||||
OCCT_CHECK_AND_UNSET (TK_LIBRARY)
|
||||
OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH)
|
||||
OCCT_CHECK_AND_UNSET (TK_WISH)
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_LIBRARY)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_LIBRARY_DIR)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL_DIR)
|
||||
OCCT_CHECK_AND_UNSET (INSTALL_TCL)
|
||||
endif()
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# tk
|
||||
|
||||
if (NOT DEFINED INSTALL_TK)
|
||||
if (NOT DEFINED INSTALL_TK AND BUILD_SHARED_LIBS)
|
||||
set (INSTALL_TK OFF CACHE BOOL "${INSTALL_TK_DESCR}")
|
||||
endif()
|
||||
|
||||
@@ -18,26 +18,28 @@ if (NOT DEFINED 3RDPARTY_TK_INCLUDE_DIR)
|
||||
set (3RDPARTY_TK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tk")
|
||||
endif()
|
||||
|
||||
# tk library file (with absolute path)
|
||||
if (NOT DEFINED 3RDPARTY_TK_LIBRARY OR NOT 3RDPARTY_TK_LIBRARY_DIR)
|
||||
set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "tk library" FORCE)
|
||||
endif()
|
||||
|
||||
# tk library directory
|
||||
if (NOT DEFINED 3RDPARTY_TK_LIBRARY_DIR)
|
||||
set (3RDPARTY_TK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tk library")
|
||||
endif()
|
||||
|
||||
# tk shared library (with absolute path)
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_TK_DLL OR NOT 3RDPARTY_TK_DLL_DIR)
|
||||
set (3RDPARTY_TK_DLL "" CACHE FILEPATH "tk shared library" FORCE)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# tk library file (with absolute path)
|
||||
if (NOT DEFINED 3RDPARTY_TK_LIBRARY OR NOT 3RDPARTY_TK_LIBRARY_DIR)
|
||||
set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "tk library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# tk shared library directory
|
||||
if (WIN32 AND NOT DEFINED 3RDPARTY_TK_DLL_DIR)
|
||||
set (3RDPARTY_TK_DLL_DIR "" CACHE FILEPATH "The directory containing tk shared library")
|
||||
# tk library directory
|
||||
if (NOT DEFINED 3RDPARTY_TK_LIBRARY_DIR)
|
||||
set (3RDPARTY_TK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tk library")
|
||||
endif()
|
||||
|
||||
# tk shared library (with absolute path)
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_TK_DLL OR NOT 3RDPARTY_TK_DLL_DIR)
|
||||
set (3RDPARTY_TK_DLL "" CACHE FILEPATH "tk shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# tk shared library directory
|
||||
if (WIN32 AND NOT DEFINED 3RDPARTY_TK_DLL_DIR)
|
||||
set (3RDPARTY_TK_DLL_DIR "" CACHE FILEPATH "The directory containing tk shared library")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# search for tk in user defined directory
|
||||
@@ -57,7 +59,7 @@ endif()
|
||||
COMPLIANCE_PRODUCT_CONSISTENCY(TK)
|
||||
|
||||
# use default (CMake) TCL search
|
||||
find_package(TCL)
|
||||
find_package(TCL QUIET)
|
||||
|
||||
# tk include dir
|
||||
if (NOT 3RDPARTY_TK_INCLUDE_DIR)
|
||||
@@ -66,21 +68,89 @@ if (NOT 3RDPARTY_TK_INCLUDE_DIR)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# tk dir and library
|
||||
if (NOT 3RDPARTY_TK_LIBRARY)
|
||||
if (TK_LIBRARY AND EXISTS "${TK_LIBRARY}")
|
||||
set (3RDPARTY_TK_LIBRARY "${TK_LIBRARY}" CACHE FILEPATH "TK library" FORCE)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# tk dir and library
|
||||
if (NOT 3RDPARTY_TK_LIBRARY)
|
||||
if (TK_LIBRARY AND EXISTS "${TK_LIBRARY}")
|
||||
set (3RDPARTY_TK_LIBRARY "${TK_LIBRARY}" CACHE FILEPATH "TK library" FORCE)
|
||||
|
||||
if (NOT 3RDPARTY_TK_LIBRARY_DIR)
|
||||
get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
|
||||
set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
|
||||
if (NOT 3RDPARTY_TK_LIBRARY_DIR)
|
||||
get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
|
||||
set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_TK_DLL)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
|
||||
|
||||
set (DLL_FOLDER_FOR_SEARCH "")
|
||||
if (3RDPARTY_TK_DLL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DLL_DIR}")
|
||||
elseif (3RDPARTY_TK_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DIR}/bin")
|
||||
elseif (3RDPARTY_TK_LIBRARY_DIR)
|
||||
get_filename_component (3RDPARTY_TK_LIBRARY_DIR_PARENT "${3RDPARTY_TK_LIBRARY_DIR}" PATH)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_LIBRARY_DIR_PARENT}/bin")
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TK_DLL "3RDPARTY_TK_DLL-NOTFOUND" CACHE FILEPATH "TK shared library" FORCE)
|
||||
find_library (3RDPARTY_TK_DLL NAMES tk86 tk85
|
||||
PATHS "${DLL_FOLDER_FOR_SEARCH}"
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
COMPLIANCE_PRODUCT_CONSISTENCY(TK)
|
||||
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_TK_DLL)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# tk dir and library
|
||||
if (NOT 3RDPARTY_TK_LIBRARY)
|
||||
set (3RDPARTY_TK_LIBRARY "3RDPARTY_TK_LIBRARY-NOTFOUND" CACHE FILEPATH "TK library" FORCE)
|
||||
find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
|
||||
PATHS "${3RDPARTY_TK_LIBRARY_DIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
# search in another place if previous search doesn't find anything
|
||||
find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
|
||||
PATHS "${3RDPARTY_TK_DIR}/lib"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
|
||||
if (NOT 3RDPARTY_TK_LIBRARY OR NOT EXISTS "${3RDPARTY_TK_LIBRARY}")
|
||||
set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "TK library" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_TK_LIBRARY_DIR AND 3RDPARTY_TK_LIBRARY)
|
||||
get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
|
||||
set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TK_LIBRARY_VERSION "")
|
||||
if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
|
||||
get_filename_component (TK_LIBRARY_NAME "${3RDPARTY_TK_LIBRARY}" NAME)
|
||||
string(REGEX REPLACE "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY_NAME}")
|
||||
|
||||
if (NOT "${TK_LIBRARY_VERSION}" STREQUAL "${TK_LIBRARY_NAME}")
|
||||
set (3RDPARTY_TK_LIBRARY_VERSION "${TK_LIBRARY_VERSION}")
|
||||
else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
|
||||
message (STATUS "Info: TK version isn't found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "")
|
||||
if (3RDPARTY_TK_LIBRARY_VERSION)
|
||||
string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TK_MAJOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
|
||||
string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TK_MINOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
|
||||
set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TK_MAJOR_VERSION}.${3RDPARTY_TK_MINOR_VERSION}")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_TK_DLL)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
|
||||
|
||||
set (DLL_FOLDER_FOR_SEARCH "")
|
||||
@@ -88,89 +158,25 @@ if (WIN32)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DLL_DIR}")
|
||||
elseif (3RDPARTY_TK_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DIR}/bin")
|
||||
elseif (3RDPARTY_TK_LIBRARY_DIR)
|
||||
else()
|
||||
get_filename_component (3RDPARTY_TK_LIBRARY_DIR_PARENT "${3RDPARTY_TK_LIBRARY_DIR}" PATH)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_LIBRARY_DIR_PARENT}/bin")
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TK_DLL "3RDPARTY_TK_DLL-NOTFOUND" CACHE FILEPATH "TK shared library" FORCE)
|
||||
find_library (3RDPARTY_TK_DLL NAMES tk86 tk85
|
||||
find_library (3RDPARTY_TK_DLL NAMES tk${3RDPARTY_TK_LIBRARY_VERSION}
|
||||
PATHS "${DLL_FOLDER_FOR_SEARCH}"
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
COMPLIANCE_PRODUCT_CONSISTENCY(TK)
|
||||
|
||||
# tk dir and library
|
||||
if (NOT 3RDPARTY_TK_LIBRARY)
|
||||
set (3RDPARTY_TK_LIBRARY "3RDPARTY_TK_LIBRARY-NOTFOUND" CACHE FILEPATH "TK library" FORCE)
|
||||
find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
|
||||
PATHS "${3RDPARTY_TK_LIBRARY_DIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
# search in another place if previous search doesn't find anything
|
||||
find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
|
||||
PATHS "${3RDPARTY_TK_DIR}/lib"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
|
||||
if (NOT 3RDPARTY_TK_LIBRARY OR NOT EXISTS "${3RDPARTY_TK_LIBRARY}")
|
||||
set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "TK library" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_TK_LIBRARY_DIR AND 3RDPARTY_TK_LIBRARY)
|
||||
get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
|
||||
set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TK_LIBRARY_VERSION "")
|
||||
if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
|
||||
get_filename_component (TK_LIBRARY_NAME "${3RDPARTY_TK_LIBRARY}" NAME)
|
||||
string(REGEX REPLACE "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY_NAME}")
|
||||
|
||||
if (NOT "${TK_LIBRARY_VERSION}" STREQUAL "${TK_LIBRARY_NAME}")
|
||||
set (3RDPARTY_TK_LIBRARY_VERSION "${TK_LIBRARY_VERSION}")
|
||||
else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
|
||||
message (STATUS "Info: TK version isn't found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "")
|
||||
if (3RDPARTY_TK_LIBRARY_VERSION)
|
||||
string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TK_MAJOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
|
||||
string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TK_MINOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
|
||||
set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TK_MAJOR_VERSION}.${3RDPARTY_TK_MINOR_VERSION}")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_TK_DLL)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
|
||||
|
||||
set (DLL_FOLDER_FOR_SEARCH "")
|
||||
if (3RDPARTY_TK_DLL_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DLL_DIR}")
|
||||
elseif (3RDPARTY_TK_DIR)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DIR}/bin")
|
||||
else()
|
||||
get_filename_component (3RDPARTY_TK_LIBRARY_DIR_PARENT "${3RDPARTY_TK_LIBRARY_DIR}" PATH)
|
||||
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_LIBRARY_DIR_PARENT}/bin")
|
||||
if (NOT 3RDPARTY_TK_DLL OR NOT EXISTS "${3RDPARTY_TK_DLL}")
|
||||
set (3RDPARTY_TK_DLL "" CACHE FILEPATH "TK shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (3RDPARTY_TK_DLL "3RDPARTY_TK_DLL-NOTFOUND" CACHE FILEPATH "TK shared library" FORCE)
|
||||
find_library (3RDPARTY_TK_DLL NAMES tk${3RDPARTY_TK_LIBRARY_VERSION}
|
||||
PATHS "${DLL_FOLDER_FOR_SEARCH}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
if (NOT 3RDPARTY_TK_DLL OR NOT EXISTS "${3RDPARTY_TK_DLL}")
|
||||
set (3RDPARTY_TK_DLL "" CACHE FILEPATH "TK shared library" FORCE)
|
||||
if (NOT 3RDPARTY_TK_DLL_DIR AND 3RDPARTY_TK_DLL)
|
||||
get_filename_component (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL}" PATH)
|
||||
set (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL_DIR}" CACHE FILEPATH "The directory containing TK shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
if (NOT 3RDPARTY_TK_DLL_DIR AND 3RDPARTY_TK_DLL)
|
||||
get_filename_component (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL}" PATH)
|
||||
set (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL_DIR}" CACHE FILEPATH "The directory containing TK shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# include found paths to common variables
|
||||
@@ -180,85 +186,87 @@ else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TK_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_LIBRARY_DIR})
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (3RDPARTY_TK_DLL OR EXISTS "${3RDPARTY_TK_DLL}")
|
||||
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TK_DLL_DIR}")
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TK_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_DLL_DIR)
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_LIBRARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# install tk
|
||||
if (INSTALL_TK)
|
||||
# include occt macros. compiler_bitness, os_wiht_bit, compiler
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
if (WIN32)
|
||||
# tk 8.6 requires zlib. install all dlls from tk bin folder that may contain zlib also
|
||||
|
||||
# collect and install all dlls from tk dll dirs
|
||||
file (GLOB TK_DLLS "${3RDPARTY_TK_DLL_DIR}/*.dll")
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${TK_DLLS} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
if (3RDPARTY_TK_DLL OR EXISTS "${3RDPARTY_TK_DLL}")
|
||||
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TK_DLL_DIR}")
|
||||
else()
|
||||
install (FILES ${TK_DLLS}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
install (FILES ${TK_DLLS}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
|
||||
install (FILES ${TK_DLLS}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
|
||||
endif()
|
||||
else()
|
||||
get_filename_component(3RDPARTY_TK_LIBRARY_REALPATH ${3RDPARTY_TK_LIBRARY} REALPATH)
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}/")
|
||||
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}/i")
|
||||
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d")
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_DLL_DIR)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (TCL_TCLSH_VERSION)
|
||||
# tk is required to install in lib folder (without)
|
||||
install (DIRECTORY "${3RDPARTY_TK_LIBRARY_DIR}/tk${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
|
||||
# install tk
|
||||
if (INSTALL_TK)
|
||||
# include occt macros. compiler_bitness, os_wiht_bit, compiler
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
if (WIN32)
|
||||
# tk 8.6 requires zlib. install all dlls from tk bin folder that may contain zlib also
|
||||
|
||||
# collect and install all dlls from tk dll dirs
|
||||
file (GLOB TK_DLLS "${3RDPARTY_TK_DLL_DIR}/*.dll")
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${TK_DLLS} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
else()
|
||||
install (FILES ${TK_DLLS}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
||||
install (FILES ${TK_DLLS}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
|
||||
install (FILES ${TK_DLLS}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
|
||||
endif()
|
||||
else()
|
||||
get_filename_component(3RDPARTY_TK_LIBRARY_REALPATH ${3RDPARTY_TK_LIBRARY} REALPATH)
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}/")
|
||||
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}/i")
|
||||
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (TCL_TCLSH_VERSION)
|
||||
# tk is required to install in lib folder (without)
|
||||
install (DIRECTORY "${3RDPARTY_TK_LIBRARY_DIR}/tk${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
message (STATUS "\nWarning: tkX.X subdir won't be copyied during the installation process.")
|
||||
message (STATUS "Try seeking tk within another folder by changing 3RDPARTY_TK_DIR variable.")
|
||||
endif()
|
||||
|
||||
set (USED_3RDPARTY_TK_DIR "")
|
||||
else()
|
||||
message (STATUS "\nWarning: tkX.X subdir won't be copyied during the installation process.")
|
||||
message (STATUS "Try seeking tk within another folder by changing 3RDPARTY_TK_DIR variable.")
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_DLL_DIR})
|
||||
else()
|
||||
set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_LIBRARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (USED_3RDPARTY_TK_DIR "")
|
||||
else()
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_DLL_DIR})
|
||||
else()
|
||||
set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_LIBRARY_DIR})
|
||||
endif()
|
||||
mark_as_advanced (3RDPARTY_TK_LIBRARY 3RDPARTY_TK_DLL)
|
||||
endif()
|
||||
|
||||
mark_as_advanced (3RDPARTY_TK_LIBRARY 3RDPARTY_TK_DLL)
|
||||
|
||||
# unset all redundant variables
|
||||
#TCL
|
||||
OCCT_CHECK_AND_UNSET (TCL_LIBRARY)
|
||||
@@ -268,3 +276,11 @@ OCCT_CHECK_AND_UNSET (TCL_TCLSH)
|
||||
OCCT_CHECK_AND_UNSET (TK_LIBRARY)
|
||||
OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH)
|
||||
OCCT_CHECK_AND_UNSET (TK_WISH)
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_LIBRARY)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_LIBRARY_DIR)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_DLL)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_DLL_DIR)
|
||||
OCCT_CHECK_AND_UNSET (INSTALL_TK)
|
||||
endif()
|
||||
|
@@ -19,8 +19,12 @@ ExprIntrp functionality are generated automatically with Flex/Bison. Checking th
|
||||
leads to automatic search of Flex/Bison binaries and regeneration of the mentioned files")
|
||||
|
||||
set (BUILD_WITH_DEBUG_DESCR
|
||||
"Enables extended messages of many OCCT algorithms, usually printed to cout.
|
||||
These include messages on internal errors and special cases encountered, timing etc")
|
||||
"Enables extended messages of many OCCT algorithms, usually printed to cout.
|
||||
These include messages on internal errors and special cases encountered, timing etc.
|
||||
Applies only for Debug configuration.")
|
||||
|
||||
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
|
||||
"Append the postfix to names of output libraries")
|
||||
|
||||
# install variables
|
||||
set (INSTALL_DIR_DESCR
|
||||
|
@@ -31,23 +31,27 @@ if (NOT DEFINED 3RDPARTY_VTK_INCLUDE_DIR)
|
||||
set (3RDPARTY_VTK_INCLUDE_DIR "" CACHE PATH "The directory containing headers of VTK")
|
||||
endif()
|
||||
|
||||
# vtk library directory
|
||||
if (NOT DEFINED 3RDPARTY_VTK_LIBRARY_DIR)
|
||||
set (3RDPARTY_VTK_LIBRARY_DIR "" CACHE PATH "The directory containing VTK libraries")
|
||||
endif()
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# vtk library directory
|
||||
if (NOT DEFINED 3RDPARTY_VTK_LIBRARY_DIR)
|
||||
set (3RDPARTY_VTK_LIBRARY_DIR "" CACHE PATH "The directory containing VTK libraries")
|
||||
endif()
|
||||
|
||||
# vtk dll directory
|
||||
if (WIN32 AND NOT DEFINED 3RDPARTY_VTK_DLL_DIR)
|
||||
set (3RDPARTY_VTK_DLL_DIR "" CACHE PATH "The directory containing VTK shared libraries")
|
||||
# vtk dll directory
|
||||
if (WIN32 AND NOT DEFINED 3RDPARTY_VTK_DLL_DIR)
|
||||
set (3RDPARTY_VTK_DLL_DIR "" CACHE PATH "The directory containing VTK shared libraries")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# check 3RDPARTY_VTK_ paths for consistency with specified 3RDPARTY_VTK_DIR
|
||||
if (3RDPARTY_VTK_DIR AND EXISTS "${3RDPARTY_VTK_DIR}")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_INCLUDE_DIR PATH "The directory containing headers of VTK")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_LIBRARY_DIR PATH "The directory containing VTK libraries")
|
||||
if (BUILD_SHARED_LIBS)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_LIBRARY_DIR PATH "The directory containing VTK libraries")
|
||||
|
||||
if (WIN32)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_DLL_DIR PATH "The directory containing VTK shared library")
|
||||
if (WIN32)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_DLL_DIR PATH "The directory containing VTK shared library")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -70,8 +74,11 @@ if (VTK_FOUND)
|
||||
if (VTK_LIBRARIES)
|
||||
|
||||
set (3RDPARTY_VTK_INCLUDE_DIRS)
|
||||
set (3RDPARTY_VTK_LIBRARY_DIRS)
|
||||
set (3RDPARTY_VTK_DLL_DIRS)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set (3RDPARTY_VTK_LIBRARY_DIRS)
|
||||
set (3RDPARTY_VTK_DLL_DIRS)
|
||||
endif()
|
||||
|
||||
foreach (VTK_LIBRARY ${VTK_LIBRARIES})
|
||||
string (REGEX MATCH "^vtk" IS_VTK_LIBRARY ${VTK_LIBRARY})
|
||||
@@ -81,70 +88,71 @@ if (VTK_FOUND)
|
||||
list (APPEND 3RDPARTY_VTK_INCLUDE_DIRS "${${VTK_LIBRARY}_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
if (${VTK_LIBRARY}_LIBRARY_DIRS AND EXISTS "${${VTK_LIBRARY}_LIBRARY_DIRS}")
|
||||
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${${VTK_LIBRARY}_LIBRARY_DIRS}")
|
||||
endif()
|
||||
|
||||
if (${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS AND EXISTS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
|
||||
list (APPEND 3RDPARTY_VTK_DLL_DIRS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
|
||||
if (NOT WIN32)
|
||||
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# get paths from corresponding properties
|
||||
get_target_property (TARGET_VTK_IMPORT_CONFS ${VTK_LIBRARY} IMPORTED_CONFIGURATIONS)
|
||||
|
||||
if (TARGET_VTK_IMPORT_CONFS)
|
||||
list (GET TARGET_VTK_IMPORT_CONFS 0 CHOSEN_IMPORT_CONF)
|
||||
|
||||
# todo: choose configuration in connection with the build type
|
||||
#if (CMAKE_BUILD_TYPE)
|
||||
# foreach (IMPORT_CONF ${TARGET_VTK_IMPORT_CONFS})
|
||||
# endforeach()
|
||||
#endif()
|
||||
|
||||
# Work-around against link failure in case if VTK contains dependency
|
||||
# on DirectX: its run-time is always present on Windows, but SDK can
|
||||
# be absent on current workstation, while not actually needed for
|
||||
# OCCT linking.
|
||||
# VTK 6.1 for VC 10
|
||||
get_target_property (TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${VTK_LIBRARY} IMPORTED_LINK_INTERFACE_LIBRARIES_${CHOSEN_IMPORT_CONF})
|
||||
if(TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES)
|
||||
string (REGEX MATCH "[^;]*d3d[0-9]+[.]lib" HARDCODED_D3D9_LIB "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
|
||||
if (HARDCODED_D3D9_LIB)
|
||||
message (STATUS "Warning: ${HARDCODED_D3D9_LIB} has been removed from imported dependencies of ${VTK_LIBRARY}")
|
||||
|
||||
list (REMOVE_ITEM TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${HARDCODED_D3D9_LIB})
|
||||
set_target_properties (${VTK_LIBRARY} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES_${CHOSEN_IMPORT_CONF} "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
# VTK 6.1 for VC 12, 14
|
||||
get_target_property (TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${VTK_LIBRARY} INTERFACE_LINK_LIBRARIES)
|
||||
if(TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES)
|
||||
string (REGEX MATCH "[^;]*d3d[0-9]+[.]lib" HARDCODED_D3D9_LIB "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
|
||||
if (HARDCODED_D3D9_LIB)
|
||||
message (STATUS "Warning: ${HARDCODED_D3D9_LIB} has been removed from imported dependencies of ${VTK_LIBRARY}")
|
||||
|
||||
list (REMOVE_ITEM TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${HARDCODED_D3D9_LIB})
|
||||
set_target_properties (${VTK_LIBRARY} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
|
||||
endif()
|
||||
if (${VTK_LIBRARY}_LIBRARY_DIRS AND EXISTS "${${VTK_LIBRARY}_LIBRARY_DIRS}")
|
||||
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${${VTK_LIBRARY}_LIBRARY_DIRS}")
|
||||
endif()
|
||||
|
||||
get_target_property (TARGET_PROPERTY_IMP_PATH ${VTK_LIBRARY} IMPORTED_IMPLIB_${CHOSEN_IMPORT_CONF})
|
||||
if(TARGET_PROPERTY_IMP_PATH AND EXISTS "${TARGET_PROPERTY_IMP_PATH}")
|
||||
get_filename_component (TARGET_PROPERTY_IMP_DIR "${TARGET_PROPERTY_IMP_PATH}" PATH)
|
||||
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${TARGET_PROPERTY_IMP_DIR}")
|
||||
if (${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS AND EXISTS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
|
||||
list (APPEND 3RDPARTY_VTK_DLL_DIRS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
|
||||
if (NOT WIN32)
|
||||
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
get_target_property (TARGET_PROPERTY_LOCATION_PATH ${VTK_LIBRARY} IMPORTED_LOCATION_${CHOSEN_IMPORT_CONF})
|
||||
if(TARGET_PROPERTY_LOCATION_PATH AND EXISTS "${TARGET_PROPERTY_LOCATION_PATH}")
|
||||
get_filename_component (TARGET_PROPERTY_LOCATION_DIR "${TARGET_PROPERTY_LOCATION_PATH}" PATH)
|
||||
# get paths from corresponding properties
|
||||
get_target_property (TARGET_VTK_IMPORT_CONFS ${VTK_LIBRARY} IMPORTED_CONFIGURATIONS)
|
||||
|
||||
if (WIN32)
|
||||
list (APPEND 3RDPARTY_VTK_DLL_DIRS "${TARGET_PROPERTY_LOCATION_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${TARGET_PROPERTY_LOCATION_DIR}")
|
||||
if (TARGET_VTK_IMPORT_CONFS)
|
||||
list (GET TARGET_VTK_IMPORT_CONFS 0 CHOSEN_IMPORT_CONF)
|
||||
|
||||
# todo: choose configuration in connection with the build type
|
||||
#if (CMAKE_BUILD_TYPE)
|
||||
# foreach (IMPORT_CONF ${TARGET_VTK_IMPORT_CONFS})
|
||||
# endforeach()
|
||||
#endif()
|
||||
|
||||
# Work-around against link failure in case if VTK contains dependency
|
||||
# on DirectX: its run-time is always present on Windows, but SDK can
|
||||
# be absent on current workstation, while not actually needed for
|
||||
# OCCT linking.
|
||||
# VTK 6.1 for VC 10
|
||||
get_target_property (TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${VTK_LIBRARY} IMPORTED_LINK_INTERFACE_LIBRARIES_${CHOSEN_IMPORT_CONF})
|
||||
if(TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES)
|
||||
string (REGEX MATCH "[^;]*d3d[0-9]+[.]lib" HARDCODED_D3D9_LIB "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
|
||||
if (HARDCODED_D3D9_LIB)
|
||||
message (STATUS "Warning: ${HARDCODED_D3D9_LIB} has been removed from imported dependencies of ${VTK_LIBRARY}")
|
||||
|
||||
list (REMOVE_ITEM TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${HARDCODED_D3D9_LIB})
|
||||
set_target_properties (${VTK_LIBRARY} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES_${CHOSEN_IMPORT_CONF} "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
# VTK 6.1 for VC 12, 14
|
||||
get_target_property (TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${VTK_LIBRARY} INTERFACE_LINK_LIBRARIES)
|
||||
if(TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES)
|
||||
string (REGEX MATCH "[^;]*d3d[0-9]+[.]lib" HARDCODED_D3D9_LIB "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
|
||||
if (HARDCODED_D3D9_LIB)
|
||||
message (STATUS "Warning: ${HARDCODED_D3D9_LIB} has been removed from imported dependencies of ${VTK_LIBRARY}")
|
||||
|
||||
list (REMOVE_ITEM TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${HARDCODED_D3D9_LIB})
|
||||
set_target_properties (${VTK_LIBRARY} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
get_target_property (TARGET_PROPERTY_IMP_PATH ${VTK_LIBRARY} IMPORTED_IMPLIB_${CHOSEN_IMPORT_CONF})
|
||||
if(TARGET_PROPERTY_IMP_PATH AND EXISTS "${TARGET_PROPERTY_IMP_PATH}")
|
||||
get_filename_component (TARGET_PROPERTY_IMP_DIR "${TARGET_PROPERTY_IMP_PATH}" PATH)
|
||||
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${TARGET_PROPERTY_IMP_DIR}")
|
||||
endif()
|
||||
|
||||
get_target_property (TARGET_PROPERTY_LOCATION_PATH ${VTK_LIBRARY} IMPORTED_LOCATION_${CHOSEN_IMPORT_CONF})
|
||||
if(TARGET_PROPERTY_LOCATION_PATH AND EXISTS "${TARGET_PROPERTY_LOCATION_PATH}")
|
||||
get_filename_component (TARGET_PROPERTY_LOCATION_DIR "${TARGET_PROPERTY_LOCATION_PATH}" PATH)
|
||||
|
||||
if (WIN32)
|
||||
list (APPEND 3RDPARTY_VTK_DLL_DIRS "${TARGET_PROPERTY_LOCATION_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${TARGET_PROPERTY_LOCATION_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -160,24 +168,25 @@ if (VTK_FOUND)
|
||||
set (3RDPARTY_VTK_INCLUDE_DIR "${3RDPARTY_VTK_INCLUDE_DIR}" CACHE PATH "The directory containing headers of VTK" FORCE)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_VTK_LIBRARY_DIRS)
|
||||
list (REMOVE_DUPLICATES 3RDPARTY_VTK_LIBRARY_DIRS)
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIRS})
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (3RDPARTY_VTK_LIBRARY_DIRS)
|
||||
list (REMOVE_DUPLICATES 3RDPARTY_VTK_LIBRARY_DIRS)
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIRS})
|
||||
|
||||
list (GET 3RDPARTY_VTK_LIBRARY_DIRS 0 3RDPARTY_VTK_LIBRARY_DIR)
|
||||
set (3RDPARTY_VTK_LIBRARY_DIR "${3RDPARTY_VTK_LIBRARY_DIR}" CACHE PATH "The directory containing VTK libraries" FORCE)
|
||||
endif()
|
||||
list (GET 3RDPARTY_VTK_LIBRARY_DIRS 0 3RDPARTY_VTK_LIBRARY_DIR)
|
||||
set (3RDPARTY_VTK_LIBRARY_DIR "${3RDPARTY_VTK_LIBRARY_DIR}" CACHE PATH "The directory containing VTK libraries" FORCE)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (3RDPARTY_VTK_DLL_DIRS)
|
||||
list (REMOVE_DUPLICATES 3RDPARTY_VTK_DLL_DIRS)
|
||||
list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIRS})
|
||||
if (WIN32)
|
||||
if (3RDPARTY_VTK_DLL_DIRS)
|
||||
list (REMOVE_DUPLICATES 3RDPARTY_VTK_DLL_DIRS)
|
||||
list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIRS})
|
||||
|
||||
list (GET 3RDPARTY_VTK_DLL_DIRS 0 3RDPARTY_VTK_DLL_DIR)
|
||||
set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DLL_DIR}" CACHE PATH "The directory containing VTK shared libraries" FORCE)
|
||||
list (GET 3RDPARTY_VTK_DLL_DIRS 0 3RDPARTY_VTK_DLL_DIR)
|
||||
set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DLL_DIR}" CACHE PATH "The directory containing VTK shared libraries" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_VTK_INCLUDE_DIR AND EXISTS "${3RDPARTY_VTK_INCLUDE_DIR}")
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS ${3RDPARTY_VTK_INCLUDE_DIR})
|
||||
@@ -185,17 +194,19 @@ else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_VTK_LIBRARY_DIR AND EXISTS "${3RDPARTY_VTK_LIBRARY_DIR}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIR})
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_LIBRARY_DIR)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (3RDPARTY_VTK_DLL_DIR OR EXISTS "${3RDPARTY_VTK_DLL_DIR}")
|
||||
list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIR})
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (3RDPARTY_VTK_LIBRARY_DIR AND EXISTS "${3RDPARTY_VTK_LIBRARY_DIR}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIR})
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_DLL_DIR)
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_LIBRARY_DIR)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (3RDPARTY_VTK_DLL_DIR OR EXISTS "${3RDPARTY_VTK_DLL_DIR}")
|
||||
list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIR})
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_DLL_DIR)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@@ -371,8 +371,8 @@ entry .myFrame.myVcVarsEntry -textvariable VCVARS -width 70
|
||||
ttk::button .myFrame.myVcBrowseBtn -text "Browse" -command wokdep:gui:BrowseVcVars
|
||||
|
||||
#
|
||||
checkbutton .myFrame.myHxxChecks.myScutsCheck -offvalue "false" -onvalue "true" -variable SHORTCUT_HEADERS
|
||||
ttk::label .myFrame.myHxxChecks.myScutsLbl -text "Create short-cuts to headers in inc folder instead of copying"
|
||||
ttk::combobox .myFrame.myHxxChecks.myScutsCombo -values { {ShortCut} {Copy} {HardLink} } -textvariable SHORTCUT_HEADERS -state readonly -width 12
|
||||
ttk::label .myFrame.myHxxChecks.myScutsLbl -text "Strategy for filling headers folder inc:"
|
||||
|
||||
#
|
||||
ttk::label .myFrame.mySrchLbl -text "3rd-parties search path:" -padding {5 5 80 5}
|
||||
@@ -384,6 +384,10 @@ checkbutton .myFrame.myChecks.myGl2psCheck -offvalue "false" -onvalue "true
|
||||
ttk::label .myFrame.myChecks.myGl2psLbl -text "Use GL2PS"
|
||||
checkbutton .myFrame.myChecks.myTbbCheck -offvalue "false" -onvalue "true" -variable HAVE_TBB -command wokdep:gui:UpdateList
|
||||
ttk::label .myFrame.myChecks.myTbbLbl -text "Use Intel TBB"
|
||||
if { "$::tcl_platform(platform)" == "windows" } {
|
||||
checkbutton .myFrame.myChecks.myD3dCheck -offvalue "false" -onvalue "true" -variable HAVE_D3D -command wokdep:gui:UpdateList
|
||||
ttk::label .myFrame.myChecks.myD3dLbl -text "Use Direct3D"
|
||||
}
|
||||
#checkbutton .myFrame.myChecks.myOpenClCheck -offvalue "false" -onvalue "true" -variable HAVE_OPENCL -command wokdep:gui:UpdateList
|
||||
#ttk::label .myFrame.myChecks.myOpenClLbl -text "Use OpenCL"
|
||||
checkbutton .myFrame.myChecks.myMacGLXCheck -offvalue "false" -onvalue "true" -variable MACOSX_USE_GLX
|
||||
@@ -465,8 +469,8 @@ if { "$tcl_platform(platform)" == "windows" } {
|
||||
|
||||
#
|
||||
grid .myFrame.myHxxChecks -row $aRowIter -column 0 -columnspan 10 -sticky w
|
||||
grid .myFrame.myHxxChecks.myScutsCheck -row 0 -column 0
|
||||
grid .myFrame.myHxxChecks.myScutsLbl -row 0 -column 1
|
||||
grid .myFrame.myHxxChecks.myScutsLbl -row 0 -column 0
|
||||
grid .myFrame.myHxxChecks.myScutsCombo -row 0 -column 1
|
||||
incr aRowIter
|
||||
#
|
||||
grid .myFrame.mySrchLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
|
||||
@@ -483,6 +487,10 @@ grid .myFrame.myChecks.myTbbCheck -row $aCheckRowIter -column 2 -sticky e
|
||||
grid .myFrame.myChecks.myTbbLbl -row $aCheckRowIter -column 3 -sticky w
|
||||
grid .myFrame.myChecks.myQt4Check -row $aCheckRowIter -column 4 -sticky e
|
||||
grid .myFrame.myChecks.myQt4Lbl -row $aCheckRowIter -column 5 -sticky w
|
||||
if { "$::tcl_platform(platform)" == "windows" } {
|
||||
grid .myFrame.myChecks.myD3dCheck -row $aCheckRowIter -column 6 -sticky e
|
||||
grid .myFrame.myChecks.myD3dLbl -row $aCheckRowIter -column 7 -sticky w
|
||||
}
|
||||
#grid .myFrame.myChecks.myOpenClCheck -row $aCheckRowIter -column 6 -sticky e
|
||||
#grid .myFrame.myChecks.myOpenClLbl -row $aCheckRowIter -column 7 -sticky w
|
||||
incr aCheckRowIter
|
||||
|
@@ -41,11 +41,12 @@ if { "$tcl_platform(platform)" == "unix" } {
|
||||
set VCVARS ""
|
||||
}
|
||||
|
||||
set SHORTCUT_HEADERS "true"
|
||||
set SHORTCUT_HEADERS "ShortCut"
|
||||
|
||||
set HAVE_FREEIMAGE "false"
|
||||
set HAVE_GL2PS "false"
|
||||
set HAVE_TBB "false"
|
||||
set HAVE_D3D "false"
|
||||
set HAVE_OPENCL "false"
|
||||
set HAVE_VTK "false"
|
||||
set MACOSX_USE_GLX "false"
|
||||
@@ -72,6 +73,9 @@ if { [info exists ::env(VCVARS)] } {
|
||||
}
|
||||
if { [info exists ::env(SHORTCUT_HEADERS)] } {
|
||||
set SHORTCUT_HEADERS "$::env(SHORTCUT_HEADERS)"
|
||||
if { $SHORTCUT_HEADERS == "true" } {
|
||||
set SHORTCUT_HEADERS "ShortCut"
|
||||
}
|
||||
}
|
||||
if { [info exists ::env(HAVE_FREEIMAGE)] } {
|
||||
set HAVE_FREEIMAGE "$::env(HAVE_FREEIMAGE)"
|
||||
@@ -82,6 +86,9 @@ if { [info exists ::env(HAVE_GL2PS)] } {
|
||||
if { [info exists ::env(HAVE_TBB)] } {
|
||||
set HAVE_TBB "$::env(HAVE_TBB)"
|
||||
}
|
||||
if { [info exists ::env(HAVE_D3D)] } {
|
||||
set HAVE_D3D "$::env(HAVE_D3D)"
|
||||
}
|
||||
if { [info exists ::env(HAVE_OPENCL)] } {
|
||||
set HAVE_OPENCL "$::env(HAVE_OPENCL)"
|
||||
}
|
||||
@@ -949,6 +956,7 @@ proc wokdep:SaveCustom {} {
|
||||
puts $aFile "set HAVE_FREEIMAGE=$::HAVE_FREEIMAGE"
|
||||
puts $aFile "set HAVE_GL2PS=$::HAVE_GL2PS"
|
||||
puts $aFile "set HAVE_TBB=$::HAVE_TBB"
|
||||
puts $aFile "set HAVE_D3D=$::HAVE_D3D"
|
||||
puts $aFile "set HAVE_OPENCL=$::HAVE_OPENCL"
|
||||
puts $aFile "set HAVE_VTK=$::HAVE_VTK"
|
||||
puts $aFile "set CHECK_QT4=$::CHECK_QT4"
|
||||
|
@@ -639,16 +639,27 @@ proc osutils:collectinc {theModules theIncPath} {
|
||||
}
|
||||
}
|
||||
}
|
||||
lsort -unique $anUsedToolKits
|
||||
set anUsedToolKits [lsort -unique $anUsedToolKits]
|
||||
|
||||
set anUnits {}
|
||||
foreach anUsedToolKit $anUsedToolKits {
|
||||
set anUnits [concat $anUnits [osutils:tk:units $anUsedToolKit]]
|
||||
}
|
||||
lsort -unique $anUnits
|
||||
set anUnits [lsort -unique $anUnits]
|
||||
|
||||
if { [info exists ::env(SHORTCUT_HEADERS)] &&
|
||||
$::env(SHORTCUT_HEADERS) == "true" } {
|
||||
# define copying style
|
||||
set aCopyType "copy"
|
||||
if { [info exists ::env(SHORTCUT_HEADERS)] } {
|
||||
if { [string equal -nocase $::env(SHORTCUT_HEADERS) "hard"]
|
||||
|| [string equal -nocase $::env(SHORTCUT_HEADERS) "hardlink"] } {
|
||||
set aCopyType "hardlink"
|
||||
} elseif { [string equal -nocase $::env(SHORTCUT_HEADERS) "true"]
|
||||
|| [string equal -nocase $::env(SHORTCUT_HEADERS) "shortcut"] } {
|
||||
set aCopyType "shortcut"
|
||||
}
|
||||
}
|
||||
|
||||
if { $aCopyType == "shortcut" } {
|
||||
# template preparation
|
||||
if { ![file exists $::THE_CASROOT/adm/templates/header.in] } {
|
||||
puts "template file does not exist: $::THE_CASROOT/adm/templates/header.in"
|
||||
@@ -683,6 +694,7 @@ proc osutils:collectinc {theModules theIncPath} {
|
||||
continue
|
||||
}
|
||||
}
|
||||
file delete -force "$theIncPath/$aHeaderFileName"
|
||||
}
|
||||
|
||||
set aShortCutHeaderFile [open "$theIncPath/$aHeaderFileName" "w"]
|
||||
@@ -690,7 +702,7 @@ proc osutils:collectinc {theModules theIncPath} {
|
||||
puts $aShortCutHeaderFile $aShortCutHeaderFileContent
|
||||
close $aShortCutHeaderFile
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
set nbcopied 0
|
||||
foreach anUnit $anUnits {
|
||||
@@ -700,14 +712,20 @@ proc osutils:collectinc {theModules theIncPath} {
|
||||
|
||||
# copy file only if target does not exist or is older than original
|
||||
set torig [file mtime $aHeaderFile]
|
||||
if { ! [file isfile $anIncPath/$aHeaderFileName] } {
|
||||
set tcopy 0
|
||||
} else {
|
||||
set tcopy 0
|
||||
if { [file isfile $anIncPath/$aHeaderFileName] } {
|
||||
set tcopy [file mtime $anIncPath/$aHeaderFileName]
|
||||
}
|
||||
if { $tcopy < $torig } {
|
||||
incr nbcopied
|
||||
file copy -force $aHeaderFile $anIncPath/$aHeaderFileName
|
||||
if { $aCopyType == "hardlink" } {
|
||||
if { $tcopy != 0 } {
|
||||
file delete -force "$theIncPath/$aHeaderFileName"
|
||||
}
|
||||
file link -hard $anIncPath/$aHeaderFileName $aHeaderFile
|
||||
} else {
|
||||
file copy -force $aHeaderFile $anIncPath/$aHeaderFileName
|
||||
}
|
||||
} elseif { $tcopy != $torig } {
|
||||
puts "Warning: file $anIncPath/$aHeaderFileName is newer than $aHeaderFile, not changed!"
|
||||
}
|
||||
@@ -2136,6 +2154,9 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
|
||||
}
|
||||
}
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch})\" />"
|
||||
if { "$aWokStation" == "lin" } {
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aWokStation}/cbp/lib\" />"
|
||||
}
|
||||
puts $aFile "\t\t\t\t</Linker>"
|
||||
|
||||
puts $aFile "\t\t\t</Target>"
|
||||
@@ -2183,6 +2204,9 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
|
||||
}
|
||||
}
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch}D)\" />"
|
||||
if { "$aWokStation" == "lin" } {
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aWokStation}/cbp/libd\" />"
|
||||
}
|
||||
puts $aFile "\t\t\t\t</Linker>"
|
||||
|
||||
puts $aFile "\t\t\t</Target>"
|
||||
|
14
adm/templates/OpenCASCADECompileDefinitionsAndFlags.cmake.in
Normal file
14
adm/templates/OpenCASCADECompileDefinitionsAndFlags.cmake.in
Normal file
@@ -0,0 +1,14 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# OpenCASCADECompileDefinitionsAndFlags-@OCCT_CONFIGURATION_LOWER@.cmake - OpenCASCADE CMake file
|
||||
# with compile definitions and C/C++ flags for @OCCT_CONFIGURATION@ configuration.
|
||||
#
|
||||
# This file is configured by OpenCASCADE.
|
||||
#
|
||||
|
||||
# The C and C++ flags added by OpenCASCADE to the cmake-configured flags.
|
||||
set (OpenCASCADE_C_FLAGS_@OCCT_CONFIGURATION_UPPER@ "@SET_OpenCASCADE_CMAKE_C_FLAGS@")
|
||||
set (OpenCASCADE_CXX_FLAGS_@OCCT_CONFIGURATION_UPPER@ "@SET_OpenCASCADE_CMAKE_CXX_FLAGS@")
|
||||
|
||||
# The compile definitions used by OpenCASCADE.
|
||||
@SET_OpenCASCADE_COMPILE_DEFINITIONS@
|
@@ -54,7 +54,7 @@ set (OpenCASCADE_BUILD_WITH_DEBUG @BUILD_WITH_DEBUG@)
|
||||
set (OpenCASCADE_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
|
||||
@SET_OpenCASCADE_BUILD_TYPE@
|
||||
|
||||
# Use of third-party libraries
|
||||
# Use of third-party libraries.
|
||||
set (OpenCASCADE_WITH_TCL @USE_TCL@)
|
||||
set (OpenCASCADE_WITH_FREETYPE @USE_FREETYPE@)
|
||||
set (OpenCASCADE_WITH_FREEIMAGE @USE_FREEIMAGE@)
|
||||
@@ -64,6 +64,12 @@ set (OpenCASCADE_WITH_VTK @USE_VTK@)
|
||||
@SET_OpenCASCADE_WITH_D3D@
|
||||
@SET_OpenCASCADE_WITH_GLX@
|
||||
|
||||
# Import OpenCASCADE compile definitions, C and C++ flags for each installed configuration.
|
||||
file(GLOB CONFIG_FILES "${CMAKE_CURRENT_LIST_DIR}/OpenCASCADECompileDefinitionsAndFlags-*.cmake")
|
||||
foreach(f ${CONFIG_FILES})
|
||||
include(${f})
|
||||
endforeach()
|
||||
|
||||
if (NOT OpenCASCADE_FIND_COMPONENTS)
|
||||
set (OpenCASCADE_FIND_COMPONENTS ${OpenCASCADE_MODULES})
|
||||
endif ()
|
||||
|
@@ -1,5 +1,7 @@
|
||||
[rename]
|
||||
BRepExtrema_OverlappedSubShapes BRepExtrema_MapOfIntegerPackedMapOfInteger
|
||||
ShapeConstruct_CompBezierCurves2dToBSplineCurve2d Convert_CompBezierCurves2dToBSplineCurve2d
|
||||
ShapeConstruct_CompBezierCurves2dToBSplineCurve Convert_CompBezierCurves2dToBSplineCurve
|
||||
|
||||
[tcollection]
|
||||
AdvApp2Var_SequenceOfNode
|
||||
|
521
dox/LICENSE.md
521
dox/LICENSE.md
@@ -1,521 +0,0 @@
|
||||
License {#occt_public_license}
|
||||
=======
|
||||
|
||||
Open CASCADE Technology is available under GNU Lesser General Public License
|
||||
(LGPL) version 2.1 with additional exception.
|
||||
|
||||
@section license_lgpl_21 GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
### Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
- 0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
1. The modified work must itself be a software library.
|
||||
|
||||
2. You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
3. You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
4. If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
1. Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
2. Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
3. Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
4. If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
5. Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
1. Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
2. Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
**NO** **WARRANTY**
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
### END OF TERMS AND CONDITIONS
|
||||
|
||||
### How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
@section occt_lgpl_exception OPEN CASCADE EXCEPTION
|
||||
|
||||
### Open CASCADE Exception (version 1.0) to GNU LGPL version 2.1.
|
||||
|
||||
The object code (i.e. not a source) form of a "work that uses the Library"
|
||||
can incorporate material from a header file that is part of the Library.
|
||||
As a special exception to the GNU Lesser General Public License version 2.1,
|
||||
you may distribute such object code incorporating material from header files
|
||||
provided with the Open CASCADE Technology libraries (including code of CDL
|
||||
generic classes) under terms of your choice, provided that you give
|
||||
prominent notice in supporting documentation to this code that it makes use
|
||||
of or is based on facilities provided by the Open CASCADE Technology software.
|
Binary file not shown.
Before Width: | Height: | Size: 157 KiB After Width: | Height: | Size: 42 KiB |
Binary file not shown.
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 60 KiB |
@@ -20,7 +20,10 @@ The environment is defined in the file *custom.sh* (on Linux and OS X) or *custo
|
||||
|
||||
* Add paths to includes of used third-party libraries in variable *CSF_OPT_INC*.
|
||||
* Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
|
||||
* Set variable *SHORTCUT_HEADERS* to "true" to have folder *inc* populated by short-cut files pointing to actual headers located in *src*; otherwise, header files will be copied to *inc*.
|
||||
* Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
|
||||
* *Copy* - headers will be copied from *src*;
|
||||
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
|
||||
* "HardLink* - hard links to headers located in *src* will be created.
|
||||
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
|
||||
~~~~~
|
||||
export HAVE_GL2PS=false
|
||||
|
@@ -30,13 +30,16 @@ If you have Visual Studio projects already available (pre-installed or generated
|
||||
* *ARCH* -- architecture (32 or 64), affects only *PATH* variable for execution
|
||||
* <i>HAVE_*</i> -- flags to enable or disable use of optional third-party products
|
||||
* <i>CSF_OPT_*</i> -- paths to search for includes and binaries of all used third-party products
|
||||
* *SHORTCUT_HEADERS* -- if set to "true", folder *inc* will be populated by short-cut files pointing to actual headers located in *src*; otherwise, header files will be copied to *inc*.
|
||||
* *SHORTCUT_HEADERS* -- defines method for population of folder *inc* by header files. Supported methods are:
|
||||
* *Copy* - headers will be copied from *src*;
|
||||
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
|
||||
* "HardLink* - hard links to headers located in *src* will be created.
|
||||
|
||||
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:
|
||||
|
||||
* Version of Visual Studio to be used (from the list of installed ones, detected by presence of environment variables like *VS100COMNTOOLS*)
|
||||
* Option to use short-cuts to header files in folder *inc* (enabled by default).
|
||||
* Method to populate folder *inc* (short-cuts by default).
|
||||
* Location of third-party libraries (usually downloaded from OCCT web site, see above).
|
||||
* Path to common directory where third-party libraries are located (optional)
|
||||
* Paths to headers and binaries of the third-party libraries (found automatically basing on previous options; click button "Reset" to update).
|
||||
|
@@ -21,7 +21,10 @@ The environment is defined in the file *custom.sh* which can be edited directly:
|
||||
|
||||
* Add paths to includes of used third-party libraries in variable *CSF_OPT_INC* (use colon ":" as path separator).
|
||||
* Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
|
||||
* Set variable *SHORTCUT_HEADERS* to "true" to have folder *inc* populated by short-cut files pointing to actual headers located in *src*; otherwise, header files will be copied to *inc*.
|
||||
* Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
|
||||
* *Copy* - headers will be copied from *src*;
|
||||
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
|
||||
* "HardLink* - hard links to headers located in *src* will be created.
|
||||
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
|
||||
~~~~~
|
||||
export HAVE_GL2PS=false
|
||||
|
@@ -247,6 +247,10 @@ The class *Select3D_Projector* now supports both orientation and projection tran
|
||||
|
||||
Porting of user applications from an earlier OCCT version to version 6.9.0 requires taking into account the following major changes.
|
||||
|
||||
@subsection upgrade_690_shaders 3D Viewer initialization
|
||||
|
||||
3D Viewer now uses GLSL programs for managing frame buffer and stereoscopic output.
|
||||
For proper initialization, application should configure **CSF_ShadersDirectory** environment variable pointing to a folder with GLSL resources - files from folder **CASROOT**/src/Shaders.
|
||||
|
||||
@subsection upgrade_690_selection Changes in Selection
|
||||
|
||||
@@ -971,3 +975,19 @@ Zoom persistent selection introduces a new structure *Graphic3d_TransformPers* f
|
||||
* Transformation matrix utilities from *OpenGl_Utils* namespace have been moved to *Graphic3d_TransformUtils* and *Graphic3d_TransformUtils.hxx* header respectively.
|
||||
* Matrix stack utilities from *OpenGl_Utils* namespace have been moved to *OpenGl_MatrixStack* class and *OpenGl_MatrixStack.hxx* header respectively.
|
||||
* *OpenGl_View* methods *Begin/EndTransformPersistence* have been removed. Please, use *Graphic3d_TransformPers::Apply()* instead to apply persistence to perspective and world-view projection matrices.
|
||||
|
||||
@subsection upgrade_occt700_correction_of_texture Correction of texture mapping of objects
|
||||
|
||||
Interaction of texture and environment texture is fixed. Textured objects have priority over the environment mapping.
|
||||
Redundant enumerations V3d_TypeOfSurface and Graphic3d_TypeOfSurface, class OpenGl_SurfaceDetailState, corresponding methods from Graphic3d_CView, OpenGl_ShaderManager, OpenGl_View, V3d_View, V3d_Viewer are deleted.
|
||||
Draw command VSetTextureMode is deleted.
|
||||
|
||||
@section upgrade_occt710 Upgrade to OCCT 7.1.0
|
||||
|
||||
@subsection upgrade_occt710_correction_of_Parab2d Correction in gp_Parab2d, gce_MakeParab2d and GCE2d_MakeParabola classes
|
||||
|
||||
1. Constructors GCE2d_MakeParabola(const gp_Ax22d& D, const gp_Pnt2d& F), gce_MakeParab2d(const gp_Ax22d& D, const gp_Pnt2d& F) and gp_Parab2d(const gp_Ax22d& D, const gp_Pnt2d& F) have been deleted.
|
||||
|
||||
2. Objects created with some constructors of gp_Parab2d class may be differ from previous version. Please see updated documentation for gp_Parab2d class (file gp_Parab2d.hxx).
|
||||
|
||||
3. Result returned by gp_Parab2d::Directrix() method has another direction in compare with previous OCCT-version.
|
@@ -84,7 +84,6 @@ void Textures_Presentation::Init()
|
||||
// initialize v3d_view so it displays textures well
|
||||
getViewer()->InitActiveViews();
|
||||
Handle(V3d_View) aView = getViewer()->ActiveView();
|
||||
aView->SetSurfaceDetail(V3d_TEX_ALL);
|
||||
aView->SetSize(ZVIEW_SIZE);
|
||||
|
||||
setResultTitle("Textured Shape");
|
||||
@@ -120,11 +119,7 @@ void Textures_Presentation::Init()
|
||||
" // mode 3 is \"textured\" mode of AIS_TexturedShape, " EOL
|
||||
" // other modes will display the \"normal\", non-textured shape," EOL
|
||||
" // in wireframe(1) or shaded(2) modes correspondingly" EOL
|
||||
" aTShape->SetDisplayMode(3); " EOL
|
||||
"" EOL
|
||||
" // V3d_TEX_ALL constant must be set as surface detail" EOL
|
||||
" // for current view to see AIS_TexturedShape" EOL
|
||||
" myCurrentView->SetSurfaceDetail(V3d_TEX_ALL);" EOL);
|
||||
" aTShape->SetDisplayMode(3); " EOL);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@@ -71,7 +71,6 @@ void TexturesExt_Presentation::Init()
|
||||
// initialize v3d_view so it displays TexturesExt well
|
||||
getViewer()->InitActiveViews();
|
||||
Handle(V3d_View) aView = getViewer()->ActiveView();
|
||||
aView->SetSurfaceDetail(V3d_TEX_ALL);
|
||||
aView->SetSize(ZVIEW_SIZE);
|
||||
|
||||
setResultTitle("Textured Shape");
|
||||
@@ -107,11 +106,7 @@ void TexturesExt_Presentation::Init()
|
||||
" // mode 3 is \"textured\" mode of AIS_TexturedShape, " EOL
|
||||
" // other modes will display the \"normal\", non-textured shape," EOL
|
||||
" // in wireframe(1) or shaded(2) modes correspondingly" EOL
|
||||
" aTShape->SetDisplayMode(3); " EOL
|
||||
"" EOL
|
||||
" // V3d_TEX_ALL constant must be set as surface detail" EOL
|
||||
" // for current view to see AIS_TexturedShape" EOL
|
||||
" myCurrentView->SetSurfaceDetail(V3d_TEX_ALL);" EOL);
|
||||
" aTShape->SetDisplayMode(3); " EOL);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@@ -70,7 +70,6 @@ void TexturesExt_Presentation::Init()
|
||||
// initialize v3d_view so it displays TexturesExt well
|
||||
getViewer()->InitActiveViews();
|
||||
Handle(V3d_View) aView = getViewer()->ActiveView();
|
||||
aView->SetSurfaceDetail(V3d_TEX_ALL);
|
||||
aView->SetSize(ZVIEW_SIZE);
|
||||
|
||||
// getDocument()->UpdateResultMessageDlg("Textured Shape",
|
||||
@@ -106,11 +105,7 @@ void TexturesExt_Presentation::Init()
|
||||
" // mode 3 is \"textured\" mode of AIS_TexturedShape, " EOL
|
||||
" // other modes will display the \"normal\", non-textured shape," EOL
|
||||
" // in wireframe(1) or shaded(2) modes correspondingly" EOL
|
||||
" aTShape->SetDisplayMode(3); " EOL
|
||||
"" EOL
|
||||
" // V3d_TEX_ALL constant must be set as surface detail" EOL
|
||||
" // for current view to see AIS_TexturedShape" EOL
|
||||
" myCurrentView->SetSurfaceDetail(V3d_TEX_ALL);" EOL);
|
||||
" aTShape->SetDisplayMode(3); " EOL);
|
||||
// CString text(Message.ToCString());
|
||||
getDocument()->ClearDialog();
|
||||
getDocument()->SetDialogTitle("Change face color");
|
||||
|
@@ -11,11 +11,9 @@
|
||||
#include "RadiusParamsPage.h"
|
||||
#include "ParamsFacesPage.h"
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <AIS_LocalContext.hxx>
|
||||
#include <AIS_Selection.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
|
||||
BEGIN_MESSAGE_MAP(CDimensionDlg, CDialog)
|
||||
@@ -763,11 +761,3 @@ void CDimensionDlg::OnClose()
|
||||
}
|
||||
CDialog::OnClose();
|
||||
}
|
||||
|
||||
TopoDS_Shape CDimensionDlg::SelectedShape()
|
||||
{
|
||||
Handle(Standard_Transient) aSelection = AIS_Selection::CurrentSelection()->Value();
|
||||
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelection);
|
||||
Handle(StdSelect_BRepOwner) aBrepOwner = Handle(StdSelect_BRepOwner)::DownCast(anOwner);
|
||||
return aBrepOwner->Shape().Located (aBrepOwner->Location() * aBrepOwner->Shape().Location());
|
||||
}
|
||||
|
@@ -37,12 +37,6 @@ public:
|
||||
const TCollection_AsciiString GetUnits() const;
|
||||
const Quantity_Color GetDimensionColor() const;
|
||||
|
||||
public:
|
||||
|
||||
// Workaround: AIS_LocalContext::SelectedShape() doesn't take into account local location of selected TopoDS shape,
|
||||
// and operates with selected interactive object transformation only.
|
||||
static TopoDS_Shape SelectedShape();
|
||||
|
||||
public:
|
||||
// Dialog Data
|
||||
enum { IDD = IDD_Dimension };
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include <VrmlData_ShapeNode.hxx>
|
||||
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <XSControl_TransferReader.hxx>
|
||||
#include <STEPConstruct_Styles.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <STEPConstruct.hxx>
|
||||
@@ -430,7 +431,7 @@ IFSelect_ReturnStatus CImportExport::ReadSTEP(const Standard_CString& aFileName,
|
||||
if (status != IFSelect_RetDone)
|
||||
return status;
|
||||
|
||||
aReader.WS()->MapReader()->SetTraceLevel(2); // increase default trace level
|
||||
aReader.WS()->TransferReader()->TransientProcess()->SetTraceLevel(2); // increase default trace level
|
||||
|
||||
Standard_Boolean failsonly = Standard_False;
|
||||
aReader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity);
|
||||
|
@@ -60,7 +60,6 @@ CButton* CLengthParamsEdgePage::GetButton()
|
||||
return (CButton*)GetDlgItem (IDC_ChooseEdgeBtn);
|
||||
}
|
||||
|
||||
#include <AIS_Selection.hxx>
|
||||
//=======================================================================
|
||||
//function : OnBnClickedChooseEdgeBtn
|
||||
//purpose :
|
||||
@@ -76,9 +75,7 @@ void CLengthParamsEdgePage::OnBnClickedChooseEdgeBtn()
|
||||
return;
|
||||
}
|
||||
|
||||
// Workaround for AIS_LocalContext::SelectedShape()
|
||||
//TopoDS_Shape aSelShape = myAISContext->LocalContext()->SelectedShape();
|
||||
TopoDS_Shape aSelShape = CDimensionDlg::SelectedShape();
|
||||
TopoDS_Shape aSelShape = myAISContext->SelectedShape();
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (aSelShape);
|
||||
|
||||
myAISContext->LocalContext()->ClearSelected();
|
||||
|
@@ -78,9 +78,7 @@ void CLengthParamsEdgesPage::OnBnClickedEdge1Btn()
|
||||
return;
|
||||
}
|
||||
|
||||
// Workaround for AIS_LocalContext::SelectedShape()
|
||||
myFirstEdge = TopoDS::Edge (CDimensionDlg::SelectedShape());
|
||||
//myFirstEdge = TopoDS::Edge (myAISContext->LocalContext()->SelectedShape());
|
||||
myFirstEdge = TopoDS::Edge (myAISContext->SelectedShape());
|
||||
|
||||
myAISContext->LocalContext()->ClearSelected();
|
||||
}
|
||||
@@ -100,9 +98,7 @@ void CLengthParamsEdgesPage::OnBnClickedEdge2Btn()
|
||||
return;
|
||||
}
|
||||
|
||||
// Workaround for AIS_LocalContext::SelectedShape()
|
||||
mySecondEdge = TopoDS::Edge (CDimensionDlg::SelectedShape());
|
||||
//mySecondEdge = TopoDS::Edge (myAISContext->LocalContext()->SelectedShape());
|
||||
mySecondEdge = TopoDS::Edge (myAISContext->SelectedShape());
|
||||
|
||||
myAISContext->LocalContext()->ClearSelected();
|
||||
|
||||
|
@@ -100,7 +100,6 @@ void OCC_2dView::OnInitialUpdate()
|
||||
myV2dView =((OCC_2dDoc*)GetDocument())->GetViewer2D()->CreateView();
|
||||
myV2dView->SetWindow(aWNTWindow);
|
||||
myV2dView->SetZClippingType(V3d_OFF);
|
||||
myV2dView->SetSurfaceDetail(V3d_TEX_ALL);
|
||||
// initialize the grids dialogs
|
||||
TheRectangularGridDialog.Create(CRectangularGrid::IDD, NULL);
|
||||
TheCircularGridDialog.Create(CCircularGrid::IDD, NULL);
|
||||
|
@@ -51,9 +51,7 @@ void CParamsFacesPage::OnBnClickedFacesbtn1()
|
||||
return;
|
||||
}
|
||||
|
||||
// Workaround for AIS_LocalContext::SelectedShape()
|
||||
myFirstFace = TopoDS::Face (CDimensionDlg::SelectedShape());
|
||||
//myFirstFace = TopoDS::Face (myAISContext->LocalContext()->SelectedShape());
|
||||
myFirstFace = TopoDS::Face (myAISContext->SelectedShape());
|
||||
|
||||
myAISContext->LocalContext()->ClearSelected();
|
||||
}
|
||||
@@ -69,9 +67,8 @@ void CParamsFacesPage::OnBnClickedFacesbtn2()
|
||||
return;
|
||||
}
|
||||
|
||||
// Workaround for AIS_LocalContext::SelectedShape()
|
||||
mySecondFace = TopoDS::Face (CDimensionDlg::SelectedShape());
|
||||
//mySecondFace = TopoDS::Face (myAISContext->LocalContext()->SelectedShape());
|
||||
mySecondFace = TopoDS::Face (myAISContext->SelectedShape());
|
||||
|
||||
myAISContext->LocalContext()->ClearSelected();
|
||||
|
||||
CDimensionDlg *aDimDlg = (CDimensionDlg*)(GetParentOwner());
|
||||
|
@@ -69,9 +69,7 @@ void CRadiusParamsPage::OnBnClickedObjectBtn()
|
||||
Standard_Boolean isAttachPoint = Standard_False;
|
||||
Standard_Real aFirstPar = 0, aLastPar = 0;
|
||||
|
||||
// Workaround for AIS_LocalContext::SelectedShape()
|
||||
TopoDS_Shape aSelShape = CDimensionDlg::SelectedShape();
|
||||
//TopoDS_Shape aSelShape = myAISContext->LocalContext()->SelectedShape();
|
||||
TopoDS_Shape aSelShape = myAISContext->SelectedShape();
|
||||
|
||||
if (aSelShape.ShapeType() != TopAbs_EDGE &&
|
||||
aSelShape.ShapeType() != TopAbs_FACE &&
|
||||
|
@@ -47,8 +47,7 @@ Handle(V3d_Viewer) DocumentCommon::Viewer (const Standard_ExtString theName,
|
||||
V3d_GOURAUD,
|
||||
V3d_WAIT,
|
||||
theComputedMode,
|
||||
theDefaultComputedMode,
|
||||
V3d_TEX_NONE);
|
||||
theDefaultComputedMode);
|
||||
}
|
||||
|
||||
DocumentCommon::DocumentCommon( const int theIndex, ApplicationCommonWindow* app )
|
||||
|
@@ -1015,11 +1015,10 @@ void View::onEnvironmentMap()
|
||||
Handle(Graphic3d_TextureEnv) aTexture = new Graphic3d_TextureEnv( fileName.toLatin1().data() );
|
||||
|
||||
myView->SetTextureEnv (aTexture);
|
||||
myView->SetSurfaceDetail (V3d_TEX_ENVIRONMENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
myView->SetSurfaceDetail (V3d_TEX_NONE);
|
||||
myView->SetTextureEnv (Handle(Graphic3d_TextureEnv)());
|
||||
}
|
||||
|
||||
myView->Redraw();
|
||||
|
@@ -86,7 +86,6 @@ vclipplane change pb capping on
|
||||
vclipplane change pb capping color 1.0 0.8 0.0
|
||||
vclipplane set pb object b
|
||||
|
||||
vsettexturemode Driver1/Viewer1/View1 2
|
||||
vclipplane change pa capping texname $aHatch
|
||||
vclipplane change pa capping texscale 0.05 -0.05
|
||||
vclipplane change pb capping texname $aHatch
|
||||
|
@@ -86,7 +86,6 @@ bfuse w w w5
|
||||
shape wsh Sh
|
||||
foreach f [explode w f] {add $f wsh}
|
||||
renamevar wsh w
|
||||
save w w.brep
|
||||
unifysamedom r w
|
||||
|
||||
# keep only wires in compound
|
||||
|
@@ -310,14 +310,8 @@ void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
if (myDrawer->IsAutoTriangulation())
|
||||
{
|
||||
// compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
|
||||
Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
|
||||
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (anAngleNew, anAnglePrev);
|
||||
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew, aCoeffPrev);
|
||||
if ((isOwnDeviationAngle && Abs (anAngleNew - anAnglePrev) > Precision::Angular())
|
||||
|| (isOwnDeviationCoefficient && Abs (aCoeffNew - aCoeffPrev) > Precision::Confusion()))
|
||||
{
|
||||
BRepTools::Clean (myshape);
|
||||
}
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
|
||||
// After this call if type of deflection is relative
|
||||
// computed deflection coefficient is stored as absolute.
|
||||
Standard_Boolean wasRecomputed = StdPrs_ToolTriangulatedShape::Tessellate (myshape, myDrawer);
|
||||
@@ -331,6 +325,8 @@ void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
}
|
||||
else // WireFrame mode
|
||||
{
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
|
||||
// After this call if type of deflection is relative
|
||||
// computed deflection coefficient is stored as absolute.
|
||||
Prs3d::GetDeflection (myshape, myDrawer);
|
||||
|
@@ -27,7 +27,6 @@
|
||||
#include <AIS_LocalStatus.hxx>
|
||||
#include <AIS_MapIteratorOfMapOfInteractive.hxx>
|
||||
#include <AIS_MultipleConnectedInteractive.hxx>
|
||||
#include <AIS_Selection.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <AIS_Trihedron.hxx>
|
||||
#include <Geom_Axis2Placement.hxx>
|
||||
@@ -67,21 +66,6 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_InteractiveContext,MMgt_TShared)
|
||||
//#include <AIS_DataMapIteratorOfDataMapOfInteractiveInteger.hxx>
|
||||
namespace
|
||||
{
|
||||
static volatile Standard_Integer THE_AIS_INDEX_SEL = 0;
|
||||
static volatile Standard_Integer THE_AIS_INDEX_CUR = 0;
|
||||
|
||||
static TCollection_AsciiString AIS_Context_NewSelName()
|
||||
{
|
||||
return TCollection_AsciiString ("AIS_SelContext_")
|
||||
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_AIS_INDEX_SEL));
|
||||
}
|
||||
|
||||
static TCollection_AsciiString AIS_Context_NewCurName()
|
||||
{
|
||||
return TCollection_AsciiString ("AIS_CurContext_")
|
||||
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_AIS_INDEX_CUR));
|
||||
}
|
||||
|
||||
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), Handle(SelectMgr_IndexedMapOfOwner)> AIS_MapOfObjectOwners;
|
||||
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), Handle(SelectMgr_IndexedMapOfOwner)>::Iterator AIS_MapIteratorOfMapOfObjectOwners;
|
||||
}
|
||||
@@ -102,6 +86,7 @@ mySelectedTouched(Standard_False),
|
||||
myToHilightSelected(Standard_True),
|
||||
myFilters(new SelectMgr_OrFilter()),
|
||||
myDefaultDrawer(new Prs3d_Drawer()),
|
||||
mySelection(new AIS_Selection()),
|
||||
myDefaultColor(Quantity_NOC_GOLDENROD),
|
||||
myHilightColor(Quantity_NOC_CYAN1),
|
||||
mySelectionColor(Quantity_NOC_GRAY80),
|
||||
@@ -111,27 +96,15 @@ myDisplayMode(0),
|
||||
myCurLocalIndex(0),
|
||||
myAISCurDetected(0),
|
||||
myZDetectionFlag(0),
|
||||
myIsAutoActivateSelMode( Standard_True )
|
||||
myIsAutoActivateSelMode(Standard_True)
|
||||
{
|
||||
InitAttributes();
|
||||
}
|
||||
|
||||
void AIS_InteractiveContext::Delete() const
|
||||
{
|
||||
// clear the static current selection
|
||||
AIS_Selection::ClearCurrentSelection();
|
||||
|
||||
// to avoid an exception
|
||||
if (AIS_Selection::Find (mySelectionName.ToCString()))
|
||||
{
|
||||
AIS_Selection::Remove (mySelectionName.ToCString());
|
||||
}
|
||||
|
||||
// to avoid an exception
|
||||
if (AIS_Selection::Find (myCurrentName.ToCString()))
|
||||
{
|
||||
AIS_Selection::Remove (myCurrentName.ToCString());
|
||||
}
|
||||
// clear the current selection
|
||||
mySelection->Select();
|
||||
|
||||
// let's remove one reference explicitly. this operation's supposed to
|
||||
// be performed when mgrSelector will be destroyed but anyway...
|
||||
@@ -151,20 +124,6 @@ void AIS_InteractiveContext::Delete() const
|
||||
MMgt_TShared::Delete();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AIS_SelectionName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TCollection_AsciiString& AIS_InteractiveContext::SelectionName() const
|
||||
{
|
||||
if(!HasOpenedContext())
|
||||
return mySelectionName;
|
||||
return myLocalContexts(myCurLocalIndex)->SelectionName();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateCurrentViewer
|
||||
//purpose :
|
||||
@@ -490,7 +449,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
||||
return;
|
||||
}
|
||||
|
||||
// Erase presentations for all display modes different from aDispMode.
|
||||
// Mark the presentation modes hidden of interactive object different from aDispMode.
|
||||
// Then make sure aDispMode is displayed and maybe highlighted.
|
||||
// Finally, activate selection mode <SelMode> if not yet activated.
|
||||
TColStd_ListOfInteger aModesToRemove;
|
||||
@@ -504,7 +463,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
||||
{
|
||||
myMainPM->Unhighlight (theIObj, anOldMode);
|
||||
}
|
||||
myMainPM->Erase (theIObj, anOldMode);
|
||||
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,10 +656,9 @@ void AIS_InteractiveContext::DisplaySelected (const Standard_Boolean theToUpdate
|
||||
}
|
||||
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
Handle(AIS_Selection) aSelIter = AIS_Selection::Selection (myCurrentName.ToCString());
|
||||
for (aSelIter->Init(); aSelIter->More(); aSelIter->Next())
|
||||
for (mySelection->Init(); mySelection->More(); mySelection->Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter->Value());
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (mySelection->Value());
|
||||
Display (anObj, Standard_False);
|
||||
isFound = Standard_True;
|
||||
}
|
||||
@@ -723,18 +681,16 @@ void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateVi
|
||||
}
|
||||
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
Handle(AIS_Selection) aSelIter = AIS_Selection::Selection(myCurrentName.ToCString());
|
||||
|
||||
aSelIter->Init();
|
||||
while (aSelIter->More())
|
||||
mySelection->Init();
|
||||
while (mySelection->More())
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelIter->Value());
|
||||
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||
|
||||
Erase (anObj, Standard_False);
|
||||
isFound = Standard_True;
|
||||
|
||||
aSelIter->Init();
|
||||
mySelection->Init();
|
||||
}
|
||||
|
||||
if (isFound && theToUpdateViewer)
|
||||
@@ -2285,16 +2241,14 @@ void AIS_InteractiveContext::SetSelectedAspect (const Handle(Prs3d_BasicAspect)&
|
||||
}
|
||||
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
Handle(AIS_Selection) aSelIter = AIS_Selection::Selection (myCurrentName.ToCString());
|
||||
for (aSelIter->Init(); aSelIter->More(); aSelIter->Next())
|
||||
for (mySelection->Init(); mySelection->More(); mySelection->Next())
|
||||
{
|
||||
isFound = Standard_True;
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter->Value());
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (mySelection->Value());
|
||||
anObj->SetAspect (theAspect, theIsGlobalChange);
|
||||
}
|
||||
|
||||
if (isFound
|
||||
&& theToUpdateViewer)
|
||||
if (isFound && theToUpdateViewer)
|
||||
{
|
||||
myMainVwr->Update();
|
||||
}
|
||||
@@ -2481,22 +2435,21 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject)
|
||||
{
|
||||
Handle(AIS_Selection) aSel = AIS_Selection::Selection (myCurrentName.ToCString());
|
||||
aSel->Init();
|
||||
while (aSel->More())
|
||||
mySelection->Init();
|
||||
while (mySelection->More())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anOwner =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Value());
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
||||
if (anOwner->Selectable() == theObject)
|
||||
{
|
||||
if (anOwner->IsSelected())
|
||||
{
|
||||
AddOrRemoveSelected (anOwner, Standard_False);
|
||||
aSel->Init();
|
||||
mySelection->Init();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
aSel->Next();
|
||||
mySelection->Next();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2801,11 +2754,6 @@ Standard_Boolean AIS_InteractiveContext::IsInLocal (const Handle(AIS_Interactive
|
||||
void AIS_InteractiveContext::InitAttributes()
|
||||
{
|
||||
mgrSelector->Add (myMainSel);
|
||||
myCurrentName = AIS_Context_NewCurName();
|
||||
mySelectionName = AIS_Context_NewSelName();
|
||||
|
||||
AIS_Selection::CreateSelection (mySelectionName.ToCString());
|
||||
AIS_Selection::CreateSelection (myCurrentName.ToCString());
|
||||
|
||||
myDefaultDrawer->SetShadingAspectGlobal (Standard_False);
|
||||
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_BRASS);
|
||||
@@ -2974,13 +2922,11 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
|
||||
const Standard_Real theMargin,
|
||||
const Standard_Boolean theToUpdate)
|
||||
{
|
||||
Standard_CString aSelName = HasOpenedContext() ?
|
||||
myLocalContexts (myCurLocalIndex)->SelectionName().ToCString()
|
||||
: myCurrentName.ToCString();
|
||||
const Handle(AIS_Selection)& aSelection = HasOpenedContext() ?
|
||||
myLocalContexts(myCurLocalIndex)->Selection() : mySelection;
|
||||
|
||||
Bnd_Box aBndSelected;
|
||||
|
||||
const Handle(AIS_Selection)& aSelection = AIS_Selection::Selection (aSelName);
|
||||
AIS_MapOfObjectOwners anObjectOwnerMap;
|
||||
for (aSelection->Init(); aSelection->More(); aSelection->Next())
|
||||
{
|
||||
|
@@ -49,6 +49,7 @@
|
||||
#include <SelectMgr_ListOfFilter.hxx>
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <AIS_Selection.hxx>
|
||||
class SelectMgr_SelectionManager;
|
||||
class V3d_Viewer;
|
||||
class AIS_InteractiveObject;
|
||||
@@ -60,7 +61,6 @@ class Quantity_Color;
|
||||
class TCollection_ExtendedString;
|
||||
class Prs3d_LineAspect;
|
||||
class Prs3d_BasicAspect;
|
||||
class TopoDS_Shape;
|
||||
class SelectMgr_EntityOwner;
|
||||
class Standard_Transient;
|
||||
class SelectMgr_Filter;
|
||||
@@ -882,6 +882,9 @@ public:
|
||||
//! Same as previous methods in reverse direction...
|
||||
Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
|
||||
|
||||
//! Adds object in the selection.
|
||||
Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(Standard_Transient)& theObject);
|
||||
|
||||
//! Selects everything found in the bounding rectangle
|
||||
//! defined by the pixel minima and maxima, XPMin,
|
||||
//! YPMin, XPMax, and YPMax in the view, aView
|
||||
@@ -1489,21 +1492,6 @@ public:
|
||||
//! Returns true if there is an open context.
|
||||
Standard_Boolean HasOpenedContext() const;
|
||||
|
||||
|
||||
//! Returns the name of the current selected entity in Neutral Point.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
const TCollection_AsciiString& CurrentName() const;
|
||||
|
||||
|
||||
//! Returns the name of the current selected entity in
|
||||
//! open local context.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
Standard_EXPORT const TCollection_AsciiString& SelectionName() const;
|
||||
|
||||
//! Returns the domain name of the main viewer.
|
||||
Standard_EXPORT Standard_CString DomainOfMainViewer() const;
|
||||
|
||||
@@ -1623,8 +1611,6 @@ private:
|
||||
Handle(PrsMgr_PresentationManager3d) myMainPM;
|
||||
Handle(V3d_Viewer) myMainVwr;
|
||||
Handle(StdSelect_ViewerSelector3d) myMainSel;
|
||||
TCollection_AsciiString mySelectionName;
|
||||
TCollection_AsciiString myCurrentName;
|
||||
Handle(SelectMgr_EntityOwner) myLastPicked;
|
||||
Handle(SelectMgr_EntityOwner) myLastinMain;
|
||||
Standard_Boolean myWasLastMain;
|
||||
@@ -1633,6 +1619,7 @@ private:
|
||||
Standard_Boolean myToHilightSelected;
|
||||
Handle(SelectMgr_OrFilter) myFilters;
|
||||
Handle(Prs3d_Drawer) myDefaultDrawer;
|
||||
Handle(AIS_Selection) mySelection;
|
||||
Quantity_NameOfColor myDefaultColor;
|
||||
Quantity_NameOfColor myHilightColor;
|
||||
Quantity_NameOfColor mySelectionColor;
|
||||
|
@@ -79,9 +79,6 @@ inline Standard_Boolean AIS_InteractiveContext::HasOpenedContext() const
|
||||
inline Handle(AIS_LocalContext) AIS_InteractiveContext::LocalContext() const
|
||||
{ return (myCurLocalIndex > 0) ? myLocalContexts(myCurLocalIndex) : NULL; }
|
||||
|
||||
inline const TCollection_AsciiString& AIS_InteractiveContext::CurrentName() const
|
||||
{return myCurrentName;}
|
||||
|
||||
inline Standard_Boolean AIS_InteractiveContext::WasCurrentTouched() const
|
||||
{return myCurrentTouched;}
|
||||
|
||||
|
@@ -44,7 +44,6 @@
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <V3d_AmbientLight.hxx>
|
||||
#include <V3d_DirectionalLight.hxx>
|
||||
#include <V3d_Light.hxx>
|
||||
@@ -55,6 +54,11 @@
|
||||
|
||||
typedef NCollection_DataMap<Handle(AIS_InteractiveObject), NCollection_Handle<SelectMgr_SequenceOfOwner> > AIS_MapOfObjSelectedOwners;
|
||||
|
||||
namespace
|
||||
{
|
||||
TopoDS_Shape AIS_myDummyShape;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : highlightWithColor
|
||||
//purpose :
|
||||
@@ -89,13 +93,11 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn
|
||||
|
||||
if (!theOwner->IsAutoHilight())
|
||||
{
|
||||
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
|
||||
const Handle(AIS_Selection)& aCurSel = AIS_Selection::CurrentSelection();
|
||||
SelectMgr_SequenceOfOwner aSeq;
|
||||
for (aCurSel->Init(); aCurSel->More(); aCurSel->Next())
|
||||
for (mySelection->Init(); mySelection->More(); mySelection->Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) aSelOwnr =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value());
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
||||
if (aSelOwnr->Selectable() != anObj)
|
||||
continue;
|
||||
aSeq.Append (aSelOwnr);
|
||||
@@ -114,13 +116,11 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity)
|
||||
{
|
||||
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
|
||||
Handle(AIS_Selection) aCurSel = AIS_Selection::Selection (myCurrentName.ToCString());
|
||||
NCollection_IndexedMap<Handle(AIS_InteractiveObject)> anObjToClear;
|
||||
for (aCurSel->Init(); aCurSel->More(); aCurSel->Next())
|
||||
for (mySelection->Init(); mySelection->More(); mySelection->Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anOwner =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value());
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable())
|
||||
continue;
|
||||
|
||||
@@ -304,6 +304,24 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
return aStatus;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddSelect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_StatusOfPick AIS_InteractiveContext::AddSelect (const Handle(Standard_Transient)& theObject)
|
||||
{
|
||||
if (HasOpenedContext())
|
||||
{
|
||||
return myLocalContexts(myCurLocalIndex)->AddSelect (theObject);
|
||||
}
|
||||
mySelection->AddSelect (theObject);
|
||||
|
||||
Standard_Integer aSelNum = NbSelected();
|
||||
return (aSelNum == 0) ? AIS_SOP_NothingSelected
|
||||
: (aSelNum == 1) ? AIS_SOP_OneSelected
|
||||
: AIS_SOP_SeveralSelected;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Select
|
||||
//purpose :
|
||||
@@ -336,7 +354,6 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
|
||||
}
|
||||
|
||||
aSelector->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
|
||||
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
|
||||
|
||||
for (aSelector->Init(); aSelector->More(); aSelector->Next())
|
||||
{
|
||||
@@ -344,7 +361,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
|
||||
if (aCurOwner.IsNull() || !aCurOwner->HasSelectable() || !myFilters->IsOk (aCurOwner))
|
||||
continue;
|
||||
|
||||
AIS_Selection::Select (aCurOwner);
|
||||
mySelection->Select (aCurOwner);
|
||||
aCurOwner->State (1);
|
||||
}
|
||||
|
||||
@@ -385,7 +402,6 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
|
||||
}
|
||||
|
||||
aSelector->Pick (thePolyline, theView);
|
||||
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
|
||||
|
||||
for (aSelector->Init(); aSelector->More(); aSelector->Next())
|
||||
{
|
||||
@@ -393,7 +409,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
|
||||
continue;
|
||||
|
||||
AIS_Selection::Select (anOwner);
|
||||
mySelection->Select (anOwner);
|
||||
anOwner->State (1);
|
||||
}
|
||||
|
||||
@@ -442,7 +458,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdate
|
||||
{
|
||||
unhighlightSelected (Standard_True);
|
||||
|
||||
AIS_Selection::Select();
|
||||
mySelection->Select();
|
||||
if (toUpdateViewer && myWasLastMain)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
@@ -523,14 +539,13 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
|
||||
}
|
||||
|
||||
aSelector->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
|
||||
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
|
||||
for (aSelector->Init(); aSelector->More(); aSelector->Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked();
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
|
||||
continue;
|
||||
|
||||
AIS_SelectStatus aSelStatus = AIS_Selection::Select (anOwner);
|
||||
AIS_SelectStatus aSelStatus = mySelection->Select (anOwner);
|
||||
Standard_Integer aState = (aSelStatus == AIS_SS_Added) ? 1 : 0;
|
||||
anOwner->State (aState);
|
||||
}
|
||||
@@ -574,14 +589,13 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d
|
||||
|
||||
aSelector->Pick (thePolyline, theView);
|
||||
|
||||
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
|
||||
for (aSelector->Init(); aSelector->More(); aSelector->Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked();
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
|
||||
continue;
|
||||
|
||||
AIS_SelectStatus aSelStatus = AIS_Selection::Select (anOwner);
|
||||
AIS_SelectStatus aSelStatus = mySelection->Select (anOwner);
|
||||
Standard_Integer aState = (aSelStatus == AIS_SS_Added) ? 1 : 0;
|
||||
anOwner->State (aState);
|
||||
}
|
||||
@@ -751,13 +765,11 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
|
||||
|
||||
// In case of selection without using local context
|
||||
myMainPM->ClearImmediateDraw();
|
||||
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
|
||||
Handle(AIS_Selection) aSel = AIS_Selection::Selection (myCurrentName.ToCString());
|
||||
AIS_MapOfObjSelectedOwners anObjOwnerMap;
|
||||
for (aSel->Init(); aSel->More(); aSel->Next())
|
||||
for (mySelection->Init(); mySelection->More(); mySelection->Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anOwner =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Value());
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
||||
if (!anOwner.IsNull() && anOwner->HasSelectable())
|
||||
{
|
||||
const Handle(AIS_InteractiveObject) anObj =
|
||||
@@ -815,12 +827,10 @@ void AIS_InteractiveContext::UnhilightSelected (const Standard_Boolean theToUpda
|
||||
return myLocalContexts (myCurLocalIndex)->UnhilightPicked (theToUpdateViewer);
|
||||
}
|
||||
|
||||
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
|
||||
Handle(AIS_Selection) aSel = AIS_Selection::Selection (myCurrentName.ToCString());
|
||||
for (aSel->Init(); aSel->More(); aSel->Next())
|
||||
for (mySelection->Init(); mySelection->More(); mySelection->Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anOwner =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Value());
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
||||
if (!anOwner.IsNull() && anOwner->HasSelectable())
|
||||
{
|
||||
const Handle(AIS_InteractiveObject) anObj =
|
||||
@@ -854,7 +864,7 @@ void AIS_InteractiveContext::ClearSelected (const Standard_Boolean theToUpdateVi
|
||||
|
||||
unhighlightSelected();
|
||||
|
||||
AIS_Selection::Select();
|
||||
mySelection->Select();
|
||||
myMainPM->ClearImmediateDraw();
|
||||
|
||||
if (theToUpdateViewer)
|
||||
@@ -908,12 +918,10 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
return;
|
||||
}
|
||||
|
||||
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
|
||||
Handle(AIS_Selection) aCurSel = AIS_Selection::Selection (myCurrentName.ToCString());
|
||||
for (aCurSel->Init(); aCurSel->More(); aCurSel->Next())
|
||||
for (mySelection->Init(); mySelection->More(); mySelection->Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anOwner =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value());
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
|
||||
continue;
|
||||
|
||||
@@ -934,7 +942,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
aSel->Init();
|
||||
Handle(SelectMgr_EntityOwner) anOwner =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Sensitive()->BaseSensitive()->OwnerId());
|
||||
AIS_Selection::ClearAndSelect (anOwner);
|
||||
mySelection->ClearAndSelect (anOwner);
|
||||
anOwner->State (1);
|
||||
if (anOwner == theObject->GlobalSelOwner())
|
||||
{
|
||||
@@ -993,7 +1001,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
|
||||
|
||||
unhighlightSelected();
|
||||
|
||||
AIS_Selection::ClearAndSelect (theOwner);
|
||||
mySelection->ClearAndSelect (theOwner);
|
||||
theOwner->State (1);
|
||||
Quantity_NameOfColor aCustomColor;
|
||||
Standard_Boolean isCustomColorSet;
|
||||
@@ -1076,10 +1084,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
||||
if (theOwner.IsNull() || !theOwner->HasSelectable())
|
||||
return;
|
||||
|
||||
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
|
||||
Handle(AIS_Selection) aCurSel = AIS_Selection::Selection (myCurrentName.ToCString());
|
||||
|
||||
AIS_SelectStatus aSelStat = AIS_Selection::Select (theOwner);
|
||||
AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
|
||||
|
||||
Standard_Integer aState = aSelStat == AIS_SS_Added ? 1 : 0;
|
||||
theOwner->State (aState);
|
||||
@@ -1168,7 +1173,7 @@ void AIS_InteractiveContext::InitSelected()
|
||||
return;
|
||||
}
|
||||
|
||||
AIS_Selection::Selection (myCurrentName.ToCString())->Init();
|
||||
mySelection->Init();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1180,7 +1185,7 @@ Standard_Boolean AIS_InteractiveContext::MoreSelected() const
|
||||
if (HasOpenedContext())
|
||||
return myLocalContexts (myCurLocalIndex)->MoreSelected();
|
||||
|
||||
return AIS_Selection::Selection (myCurrentName.ToCString())->More();
|
||||
return mySelection->More();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1195,7 +1200,7 @@ void AIS_InteractiveContext::NextSelected()
|
||||
return;
|
||||
}
|
||||
|
||||
AIS_Selection::Selection (myCurrentName.ToCString())->Next();
|
||||
mySelection->Next();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1224,11 +1229,11 @@ TopoDS_Shape AIS_InteractiveContext::SelectedShape() const
|
||||
return myLocalContexts (myCurLocalIndex)->SelectedShape();
|
||||
}
|
||||
|
||||
if (AIS_Selection::Selection (myCurrentName.ToCString())->Extent() == 0)
|
||||
if (mySelection->Extent() == 0)
|
||||
return TopoDS_Shape();
|
||||
|
||||
const Handle(StdSelect_BRepOwner) anOwner =
|
||||
Handle(StdSelect_BRepOwner)::DownCast (AIS_Selection::Selection (myCurrentName.ToCString())->Value());
|
||||
Handle(StdSelect_BRepOwner)::DownCast (mySelection->Value());
|
||||
if (!anOwner->HasSelectable())
|
||||
return TopoDS_Shape();
|
||||
|
||||
@@ -1247,7 +1252,7 @@ Handle(AIS_InteractiveObject) AIS_InteractiveContext::SelectedInteractive() cons
|
||||
}
|
||||
|
||||
const Handle(SelectMgr_EntityOwner) anOwner =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (AIS_Selection::Selection (myCurrentName.ToCString())->Value());
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable())
|
||||
return NULL;
|
||||
|
||||
@@ -1264,10 +1269,8 @@ Handle(SelectMgr_EntityOwner) AIS_InteractiveContext::SelectedOwner() const
|
||||
return myLocalContexts(myCurLocalIndex)->SelectedOwner();
|
||||
}
|
||||
|
||||
Handle(AIS_Selection) aCurSel = AIS_Selection::Selection (myCurrentName.ToCString());
|
||||
|
||||
return aCurSel->Extent() > 0 ?
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value()) : NULL;
|
||||
return mySelection->Extent() > 0 ?
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value()) : NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1501,13 +1504,11 @@ const TopoDS_Shape& AIS_InteractiveContext::DetectedCurrentShape() const
|
||||
return myLocalContexts(myCurLocalIndex)->DetectedCurrentShape();
|
||||
}
|
||||
|
||||
static TopoDS_Shape aDummyShape;
|
||||
|
||||
Handle(AIS_Shape) aCurrentShape = Handle(AIS_Shape)::DownCast (DetectedCurrentObject());
|
||||
|
||||
if (aCurrentShape.IsNull())
|
||||
{
|
||||
return aDummyShape;
|
||||
return AIS_myDummyShape;
|
||||
}
|
||||
|
||||
return aCurrentShape->Shape();
|
||||
|
@@ -419,7 +419,7 @@ SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
|
||||
|
||||
Standard_Integer DM,HM,SM;
|
||||
GetDefModes(anIObj,DM,HM,SM);
|
||||
if(AIS_Selection::IsSelected(anIObj))
|
||||
if(mySelection->IsSelected(anIObj))
|
||||
myMainPM->Highlight(anIObj,HM);
|
||||
|
||||
if(updateviewer){
|
||||
|
@@ -349,10 +349,10 @@ public:
|
||||
Standard_Boolean HasWidth() const;
|
||||
|
||||
//! Returns the width setting of the Interactive Object.
|
||||
Standard_EXPORT Standard_Real Width() const;
|
||||
Standard_Real Width() const;
|
||||
|
||||
//! Returns true if the Interactive Object has a setting for material.
|
||||
Standard_EXPORT Standard_Boolean HasMaterial() const;
|
||||
Standard_Boolean HasMaterial() const;
|
||||
|
||||
//! Returns the current material setting.
|
||||
//! This will be on of the following materials:
|
||||
@@ -362,7 +362,7 @@ public:
|
||||
//! - Pewter
|
||||
//! - Silver
|
||||
//! - Stone.
|
||||
Standard_EXPORT virtual Graphic3d_NameOfMaterial Material() const;
|
||||
virtual Graphic3d_NameOfMaterial Material() const;
|
||||
|
||||
//! Sets the name aName for material defining this
|
||||
//! display attribute for the interactive object.
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
#include <AIS_LocalContext.hxx>
|
||||
#include <AIS_LocalStatus.hxx>
|
||||
#include <AIS_Selection.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <Aspect_TypeOfMarker.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
@@ -51,17 +50,6 @@
|
||||
#include <stdio.h>
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_LocalContext,MMgt_TShared)
|
||||
|
||||
static TCollection_AsciiString AIS_Local_SelName(const Standard_Address address,
|
||||
const Standard_Integer anIndex)
|
||||
{
|
||||
// TCollection_AsciiString SelName;
|
||||
char string[100];
|
||||
sprintf(string,"%p_%d", address, anIndex); // works under any system
|
||||
TCollection_AsciiString SelName(string);
|
||||
return SelName;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AIS_LocalContext
|
||||
//purpose :
|
||||
@@ -85,6 +73,7 @@ myMainVS(aCtx->MainSelector()),
|
||||
myFilters(new SelectMgr_OrFilter()),
|
||||
myAutoHilight(Standard_True),
|
||||
myMapOfOwner (new SelectMgr_IndexedMapOfOwner()),
|
||||
mySelection(new AIS_Selection()),
|
||||
mylastindex(0),
|
||||
mylastgood(0),
|
||||
myCurDetected(0),
|
||||
@@ -98,8 +87,6 @@ myAISCurDetected(0)
|
||||
|
||||
myMainVS->ResetSelectionActivationStatus();
|
||||
myMainPM = aCtx->MainPrsMgr();
|
||||
mySelName = AIS_Local_SelName(this, Index);
|
||||
AIS_Selection::CreateSelection(mySelName.ToCString());
|
||||
|
||||
mySM->Add(myMainVS);
|
||||
if(myLoadDisplayed) LoadContextObjects();
|
||||
@@ -626,18 +613,13 @@ void AIS_LocalContext::Terminate (const Standard_Boolean theToUpdate)
|
||||
// clear the selector...
|
||||
myMainVS->Clear();
|
||||
|
||||
|
||||
AIS_Selection::SetCurrentSelection(mySelName.ToCString());
|
||||
Handle(AIS_Selection) S = AIS_Selection::CurrentSelection();
|
||||
Handle(Standard_Transient) Tr;
|
||||
for(S->Init();S->More();S->Next()){
|
||||
Tr = S->Value();
|
||||
for (mySelection->Init(); mySelection->More(); mySelection->Next()){
|
||||
Tr = mySelection->Value();
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (Tr)->SetSelected (Standard_False);
|
||||
}
|
||||
|
||||
|
||||
AIS_Selection::Select();
|
||||
AIS_Selection::Remove(mySelName.ToCString());
|
||||
mySelection->Select();
|
||||
|
||||
Handle(V3d_View) aDummyView;
|
||||
myMainVS->ClearSensitive (aDummyView);
|
||||
|
@@ -40,6 +40,7 @@
|
||||
#include <TColStd_MapOfTransient.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <AIS_Selection.hxx>
|
||||
class AIS_InteractiveContext;
|
||||
class SelectMgr_SelectionManager;
|
||||
class SelectMgr_OrFilter;
|
||||
@@ -91,7 +92,7 @@ public:
|
||||
|
||||
Standard_EXPORT void SetContext (const Handle(AIS_InteractiveContext)& aCtx);
|
||||
|
||||
const TCollection_AsciiString& SelectionName() const;
|
||||
const Handle(AIS_Selection) Selection() const;
|
||||
|
||||
Standard_EXPORT void Terminate (const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
@@ -166,6 +167,8 @@ public:
|
||||
Standard_EXPORT Standard_Boolean UnhilightLastDetected (const Handle(V3d_View)& aView);
|
||||
|
||||
//! returns the number of selected
|
||||
Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(Standard_Transient)& theObject);
|
||||
|
||||
Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Boolean updateviewer = Standard_True);
|
||||
@@ -411,7 +414,6 @@ private:
|
||||
Handle(SelectMgr_SelectionManager) mySM;
|
||||
Handle(StdSelect_ViewerSelector3d) myMainVS;
|
||||
Handle(PrsMgr_PresentationManager3d) myMainPM;
|
||||
TCollection_AsciiString mySelName;
|
||||
Handle(StdSelect_ViewerSelector3d) myCollVS;
|
||||
AIS_DataMapOfSelStat myActiveObjects;
|
||||
Handle(SelectMgr_OrFilter) myFilters;
|
||||
@@ -419,6 +421,7 @@ private:
|
||||
Handle(SelectMgr_Filter) myStdFilters[9];
|
||||
Standard_Boolean myAutoHilight;
|
||||
Handle(SelectMgr_IndexedMapOfOwner) myMapOfOwner;
|
||||
Handle(AIS_Selection) mySelection;
|
||||
Standard_Integer mylastindex;
|
||||
Standard_Integer mylastgood;
|
||||
Standard_Integer myCurrentOwner;
|
||||
|
@@ -18,9 +18,8 @@
|
||||
|
||||
#include <SelectMgr_OrFilter.hxx>
|
||||
|
||||
inline const TCollection_AsciiString& AIS_LocalContext::
|
||||
SelectionName() const
|
||||
{return mySelName;}
|
||||
inline const Handle(AIS_Selection) AIS_LocalContext::Selection() const
|
||||
{return mySelection;}
|
||||
|
||||
inline void AIS_LocalContext::SetAutomaticHilight(const Standard_Boolean aStatus)
|
||||
{myAutoHilight = aStatus;}
|
||||
|
@@ -50,9 +50,13 @@
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <TColStd_MapIteratorOfMapOfTransient.hxx>
|
||||
#include <TColStd_MapOfTransient.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
TopoDS_Shape AIS_myDummyShape;
|
||||
}
|
||||
|
||||
static Standard_Integer GetHiMod(const Handle(AIS_InteractiveObject)& IO)
|
||||
{
|
||||
return IO->HasHilightMode() ? IO->HilightMode():0;
|
||||
@@ -135,6 +139,20 @@ AIS_StatusOfDetection AIS_LocalContext::MoveTo (const Standard_Integer theXpix,
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddSelect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_StatusOfPick AIS_LocalContext::AddSelect (const Handle(Standard_Transient)& theObject)
|
||||
{
|
||||
mySelection->AddSelect (theObject);
|
||||
|
||||
Standard_Integer aSelNum = mySelection->Extent();
|
||||
return (aSelNum == 1) ? AIS_SOP_OneSelected
|
||||
: (aSelNum > 1) ? AIS_SOP_SeveralSelected
|
||||
: AIS_SOP_Error;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Select
|
||||
//purpose :
|
||||
@@ -146,13 +164,11 @@ AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Boolean toUpdateViewer
|
||||
UnhilightPicked (Standard_False);
|
||||
}
|
||||
|
||||
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
|
||||
|
||||
Standard_Integer aDetIndex = DetectedIndex();
|
||||
if (aDetIndex <= 0)
|
||||
{
|
||||
ClearSelected (toUpdateViewer);
|
||||
return (AIS_Selection::Extent() == 0) ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
|
||||
return (mySelection->Extent() == 0) ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
|
||||
}
|
||||
|
||||
const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (aDetIndex);
|
||||
@@ -162,7 +178,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Boolean toUpdateViewer
|
||||
if (!anOwner->IsSelected()) // anOwner is not selected
|
||||
{
|
||||
anOwner->SetSelected (Standard_True);
|
||||
AIS_Selection::Select (anOwner);
|
||||
mySelection->Select (anOwner);
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
@@ -186,7 +202,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Boolean toUpdateViewer
|
||||
}
|
||||
}
|
||||
|
||||
return (AIS_Selection::Extent() == 1) ? AIS_SOP_OneSelected : AIS_SOP_SeveralSelected;
|
||||
return (mySelection->Extent() == 1) ? AIS_SOP_OneSelected : AIS_SOP_SeveralSelected;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -208,8 +224,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Integer theXPMin,
|
||||
UnhilightPicked (Standard_False);
|
||||
}
|
||||
|
||||
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
|
||||
Standard_Integer aSelNum = AIS_Selection::Extent();
|
||||
Standard_Integer aSelNum = mySelection->Extent();
|
||||
|
||||
myMainVS->Init();
|
||||
if (!myMainVS->More())
|
||||
@@ -230,7 +245,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Integer theXPMin,
|
||||
if (!anOwner->IsSelected())
|
||||
{
|
||||
anOwner->SetSelected (Standard_True);
|
||||
AIS_Selection::Select (anOwner);
|
||||
mySelection->Select (anOwner);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,7 +256,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Integer theXPMin,
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer aSelNum = AIS_Selection::Extent();
|
||||
Standard_Integer aSelNum = mySelection->Extent();
|
||||
|
||||
return (aSelNum == 1) ? AIS_SOP_OneSelected
|
||||
: (aSelNum > 1) ? AIS_SOP_SeveralSelected
|
||||
@@ -260,9 +275,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const TColgp_Array1OfPnt2d& thePolyli
|
||||
{
|
||||
myMainVS->Pick (thePolyline, theView);
|
||||
|
||||
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
|
||||
|
||||
Standard_Integer aLastSelNum = AIS_Selection::Extent();
|
||||
Standard_Integer aLastSelNum = mySelection->Extent();
|
||||
myMainVS->Init();
|
||||
if (!myMainVS->More())
|
||||
{
|
||||
@@ -290,7 +303,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const TColgp_Array1OfPnt2d& thePolyli
|
||||
// it can be helpful to classify this owner immediately...
|
||||
if (!anOwner->IsSelected())
|
||||
{
|
||||
AIS_Selection::AddSelect (anOwner);
|
||||
mySelection->AddSelect (anOwner);
|
||||
anOwner->SetSelected (Standard_True);
|
||||
}
|
||||
}
|
||||
@@ -302,7 +315,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const TColgp_Array1OfPnt2d& thePolyli
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer aSelNum = AIS_Selection::Extent();
|
||||
Standard_Integer aSelNum = mySelection->Extent();
|
||||
return (aSelNum == 1) ? AIS_SOP_OneSelected
|
||||
: (aSelNum > 1) ? AIS_SOP_SeveralSelected
|
||||
: AIS_SOP_Error;
|
||||
@@ -315,15 +328,13 @@ AIS_StatusOfPick AIS_LocalContext::Select (const TColgp_Array1OfPnt2d& thePolyli
|
||||
AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const Standard_Boolean toUpdateViewer)
|
||||
{
|
||||
Standard_Integer aDetIndex = DetectedIndex();
|
||||
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
|
||||
|
||||
if(aDetIndex > 0)
|
||||
{
|
||||
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
|
||||
Standard_Integer aSelNum = AIS_Selection::Extent();
|
||||
Standard_Integer aSelNum = mySelection->Extent();
|
||||
const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (aDetIndex);
|
||||
Standard_Boolean toSelect = anOwner->IsSelected() ? Standard_False : Standard_True;
|
||||
AIS_Selection::Select (anOwner);
|
||||
mySelection->Select (anOwner);
|
||||
anOwner->SetSelected (toSelect);
|
||||
|
||||
if(myAutoHilight)
|
||||
@@ -348,7 +359,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const Standard_Boolean toUpdateV
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer NS = AIS_Selection::Extent();
|
||||
Standard_Integer NS = mySelection->Extent();
|
||||
if( NS == 1 ) return AIS_SOP_OneSelected;
|
||||
else if( NS > 1 ) return AIS_SOP_SeveralSelected;
|
||||
return aSelNum == 0 ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
|
||||
@@ -373,8 +384,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const Standard_Integer theXPMin
|
||||
{
|
||||
myMainVS->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
|
||||
|
||||
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
|
||||
Standard_Integer aLastSelNum = AIS_Selection::Extent();
|
||||
Standard_Integer aLastSelNum = mySelection->Extent();
|
||||
|
||||
myMainVS->Init();
|
||||
if (!myMainVS->More())
|
||||
@@ -396,7 +406,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const Standard_Integer theXPMin
|
||||
if(myFilters->IsOk (anOwner))
|
||||
{
|
||||
Standard_Boolean toSelect = anOwner->IsSelected() ? Standard_False : Standard_True;
|
||||
AIS_Selection::Select (anOwner);
|
||||
mySelection->Select (anOwner);
|
||||
anOwner->SetSelected (toSelect);
|
||||
}
|
||||
}
|
||||
@@ -407,7 +417,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const Standard_Integer theXPMin
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer aSelNum = AIS_Selection::Extent();
|
||||
Standard_Integer aSelNum = mySelection->Extent();
|
||||
|
||||
return (aSelNum == 1) ? AIS_SOP_OneSelected
|
||||
: (aSelNum > 1) ? AIS_SOP_SeveralSelected
|
||||
@@ -426,9 +436,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const TColgp_Array1OfPnt2d& theP
|
||||
{
|
||||
myMainVS->Pick (thePolyline, theView);
|
||||
|
||||
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
|
||||
|
||||
Standard_Integer aLastSelNum = AIS_Selection::Extent();
|
||||
Standard_Integer aLastSelNum = mySelection->Extent();
|
||||
myMainVS->Init();
|
||||
if(!myMainVS->More())
|
||||
{
|
||||
@@ -449,7 +457,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const TColgp_Array1OfPnt2d& theP
|
||||
if (myFilters->IsOk (anOwner))
|
||||
{
|
||||
Standard_Boolean toSelect = anOwner->IsSelected() ? Standard_False : Standard_True;
|
||||
AIS_Selection::Select (anOwner);
|
||||
mySelection->Select (anOwner);
|
||||
anOwner->SetSelected (toSelect);
|
||||
}
|
||||
}
|
||||
@@ -459,7 +467,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const TColgp_Array1OfPnt2d& theP
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer aSelNum = AIS_Selection::Extent();
|
||||
Standard_Integer aSelNum = mySelection->Extent();
|
||||
|
||||
return (aSelNum == 1) ? AIS_SOP_OneSelected
|
||||
: (aSelNum > 1) ? AIS_SOP_SeveralSelected
|
||||
@@ -516,16 +524,15 @@ void AIS_LocalContext::Unhilight (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
//=======================================================================
|
||||
void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer)
|
||||
{
|
||||
Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString());
|
||||
if( Sel.IsNull() ) return;
|
||||
|
||||
if( mySelection.IsNull() ) return;
|
||||
|
||||
typedef NCollection_DataMap <Handle(SelectMgr_SelectableObject), NCollection_Handle<SelectMgr_SequenceOfOwner> > SelectMgr_DataMapOfObjectOwners;
|
||||
SelectMgr_DataMapOfObjectOwners aMap;
|
||||
|
||||
Handle (PrsMgr_PresentationManager3d) PM = myMainPM;
|
||||
|
||||
// to avoid problems when there is a loop searching for selected objects...
|
||||
const AIS_NListTransient& Obj = Sel->Objects();
|
||||
const AIS_NListTransient& Obj = mySelection->Objects();
|
||||
AIS_NListTransient::Iterator anIter( Obj );
|
||||
for(; anIter.More(); anIter.Next())
|
||||
{
|
||||
@@ -575,12 +582,11 @@ void AIS_LocalContext::UnhilightPicked (const Standard_Boolean updateviewer)
|
||||
{
|
||||
myMainPM->ClearImmediateDraw();
|
||||
|
||||
Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString());
|
||||
if( Sel.IsNull() ) return;
|
||||
if( mySelection.IsNull() ) return;
|
||||
Handle (PrsMgr_PresentationManager3d) PM = myMainPM;
|
||||
NCollection_Map<Handle(SelectMgr_SelectableObject)> anObjMap;
|
||||
|
||||
const AIS_NListTransient& Obj = Sel->Objects();
|
||||
const AIS_NListTransient& Obj = mySelection->Objects();
|
||||
AIS_NListTransient::Iterator anIter( Obj );
|
||||
for(; anIter.More(); anIter.Next()){
|
||||
const Handle(Standard_Transient)& Tr = anIter.Value();
|
||||
@@ -639,8 +645,7 @@ Standard_Boolean AIS_LocalContext::IsSelected (const Handle(SelectMgr_EntityOwne
|
||||
void AIS_LocalContext::
|
||||
InitSelected()
|
||||
{
|
||||
AIS_Selection::SetCurrentSelection(mySelName.ToCString());
|
||||
AIS_Selection::CurrentSelection()->Init();
|
||||
mySelection->Init();
|
||||
}
|
||||
|
||||
//==================================================
|
||||
@@ -650,7 +655,7 @@ InitSelected()
|
||||
Standard_Boolean AIS_LocalContext::
|
||||
MoreSelected() const
|
||||
{
|
||||
return AIS_Selection::CurrentSelection()->More();
|
||||
return mySelection->More();
|
||||
}
|
||||
|
||||
//==================================================
|
||||
@@ -660,7 +665,7 @@ MoreSelected() const
|
||||
void AIS_LocalContext::
|
||||
NextSelected()
|
||||
{
|
||||
AIS_Selection::CurrentSelection()->Next();
|
||||
mySelection->Next();
|
||||
}
|
||||
|
||||
//==================================================
|
||||
@@ -670,7 +675,7 @@ NextSelected()
|
||||
Standard_Boolean AIS_LocalContext::
|
||||
HasShape() const
|
||||
{
|
||||
Handle(Standard_Transient) Tr = AIS_Selection::CurrentSelection()->Value();
|
||||
Handle(Standard_Transient) Tr = mySelection->Value();
|
||||
if( Tr.IsNull() ) return Standard_False;
|
||||
Handle(SelectMgr_EntityOwner) EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
|
||||
Handle(StdSelect_BRepOwner) BRO = Handle(StdSelect_BRepOwner)::DownCast(EO);
|
||||
@@ -686,10 +691,10 @@ HasShape() const
|
||||
//================================================================
|
||||
Standard_Boolean AIS_LocalContext::HasSelectedShape() const
|
||||
{
|
||||
if (AIS_Selection::CurrentSelection()->Extent() == 0)
|
||||
if (mySelection->Extent() == 0)
|
||||
return Standard_False;
|
||||
|
||||
Handle(Standard_Transient) aCurSelection = AIS_Selection::CurrentSelection()->Value();
|
||||
Handle(Standard_Transient) aCurSelection = mySelection->Value();
|
||||
if (aCurSelection.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
@@ -708,7 +713,7 @@ Standard_Boolean AIS_LocalContext::HasSelectedShape() const
|
||||
//==================================================
|
||||
TopoDS_Shape AIS_LocalContext::SelectedShape() const
|
||||
{
|
||||
Handle(Standard_Transient) aTr = AIS_Selection::CurrentSelection()->Value();
|
||||
Handle(Standard_Transient) aTr = mySelection->Value();
|
||||
Handle(SelectMgr_EntityOwner) anEO = Handle(SelectMgr_EntityOwner)::DownCast (aTr);
|
||||
Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(anEO);
|
||||
if( aBRO.IsNull() )
|
||||
@@ -727,7 +732,7 @@ Handle(AIS_InteractiveObject) AIS_LocalContext::
|
||||
SelectedInteractive() const
|
||||
{
|
||||
Handle(AIS_InteractiveObject) IO;
|
||||
Handle(Standard_Transient) Tr = AIS_Selection::CurrentSelection()->Value();
|
||||
Handle(Standard_Transient) Tr = mySelection->Value();
|
||||
if( !Tr.IsNull() ) {
|
||||
Handle(SelectMgr_EntityOwner) EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
|
||||
Handle(SelectMgr_SelectableObject) SO;
|
||||
@@ -746,7 +751,7 @@ Handle(SelectMgr_EntityOwner) AIS_LocalContext::
|
||||
SelectedOwner() const
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) EO;
|
||||
Handle(Standard_Transient) Tr = AIS_Selection::CurrentSelection()->Value();
|
||||
Handle(Standard_Transient) Tr = mySelection->Value();
|
||||
if( !Tr.IsNull() )
|
||||
EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
|
||||
return EO;
|
||||
@@ -797,12 +802,9 @@ void AIS_LocalContext::UpdateSelected(const Handle(AIS_InteractiveObject)& anobj
|
||||
if (anobj.IsNull() || anobj->IsAutoHilight())
|
||||
return;
|
||||
|
||||
AIS_Selection::SetCurrentSelection(mySelName.ToCString());
|
||||
Handle(AIS_Selection) Sel = AIS_Selection::CurrentSelection();
|
||||
|
||||
SelectMgr_SequenceOfOwner aSeq;
|
||||
for ( Sel->Init(); Sel->More(); Sel->Next() ){
|
||||
Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast(Sel->Value());
|
||||
for (mySelection->Init(); mySelection->More(); mySelection->Next() ){
|
||||
Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast(mySelection->Value());
|
||||
|
||||
if ( !aOwner.IsNull() && aOwner->HasSelectable() && aOwner->Selectable() == anobj )
|
||||
aSeq.Append( aOwner );
|
||||
@@ -825,10 +827,8 @@ void AIS_LocalContext::UpdateSelected(const Handle(AIS_InteractiveObject)& anobj
|
||||
void AIS_LocalContext::ClearSelected (const Standard_Boolean updateviewer)
|
||||
{
|
||||
UnhilightPicked(updateviewer);
|
||||
AIS_Selection::SetCurrentSelection(mySelName.ToCString());
|
||||
|
||||
Handle(AIS_Selection) Sel = AIS_Selection::CurrentSelection();
|
||||
const AIS_NListTransient& Obj = Sel->Objects();
|
||||
const AIS_NListTransient& Obj = mySelection->Objects();
|
||||
AIS_NListTransient::Iterator anIter( Obj );
|
||||
for(; anIter.More(); anIter.Next()){
|
||||
const Handle(Standard_Transient)& Tr = anIter.Value();
|
||||
@@ -837,7 +837,7 @@ void AIS_LocalContext::ClearSelected (const Standard_Boolean updateviewer)
|
||||
(*((const Handle(SelectMgr_EntityOwner)*)&Tr))->SetSelected (Standard_False);
|
||||
}
|
||||
}
|
||||
AIS_Selection::Select();
|
||||
mySelection->Select();
|
||||
mylastindex = 0;
|
||||
}
|
||||
|
||||
@@ -918,8 +918,7 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
|
||||
|
||||
// 3. AIS_Selection : remove entity owners from AIS_Selection
|
||||
const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
|
||||
Handle(AIS_Selection) aSelection = AIS_Selection::Selection (mySelName.ToCString());
|
||||
AIS_NListTransient::Iterator anIter (aSelection->Objects());
|
||||
AIS_NListTransient::Iterator anIter (mySelection->Objects());
|
||||
AIS_NListTransient aRemoveEntites;
|
||||
for (; anIter.More(); anIter.Next())
|
||||
{
|
||||
@@ -946,7 +945,7 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
|
||||
AIS_NListTransient::Iterator anIterRemove (aRemoveEntites);
|
||||
for (; anIterRemove.More(); anIterRemove.Next())
|
||||
{
|
||||
aSelection->Select (anIterRemove.Value());
|
||||
mySelection->Select (anIterRemove.Value());
|
||||
}
|
||||
|
||||
// 4. AIS_LocalContext - myMapOfOwner : remove entity owners from myMapOfOwner
|
||||
@@ -1045,8 +1044,6 @@ void AIS_LocalContext::SetSelected(const Handle(AIS_InteractiveObject)& anIObj,
|
||||
//1st case, owner already <anIObj> as owner
|
||||
// and not separated is found...
|
||||
|
||||
Handle(AIS_Selection) sel = AIS_Selection::Selection(mySelName.ToCString());
|
||||
//Standard_Boolean found(Standard_False);
|
||||
Handle(Standard_Transient) Tr;
|
||||
Handle(SelectMgr_EntityOwner) EO = FindSelectedOwnerFromIO(anIObj);
|
||||
if(EO.IsNull()){
|
||||
@@ -1065,7 +1062,7 @@ void AIS_LocalContext::SetSelected(const Handle(AIS_InteractiveObject)& anIObj,
|
||||
|
||||
ClearSelected(Standard_False);
|
||||
|
||||
AIS_Selection::Select(EO);
|
||||
mySelection->Select(EO);
|
||||
EO->SetSelected (Standard_True);
|
||||
|
||||
HilightPicked(updateviewer);
|
||||
@@ -1102,13 +1099,10 @@ void AIS_LocalContext::AddOrRemoveSelected(const Handle(AIS_InteractiveObject)&
|
||||
EO = new SelectMgr_EntityOwner((const Handle(SelectMgr_SelectableObject)&)anIObj);
|
||||
}
|
||||
}
|
||||
|
||||
// cout<<"AIS_LocalContext::AddOrRemoveSelected : Selection = "<<mySelName<<endl;
|
||||
const Handle(AIS_Selection)& S = AIS_Selection::Selection(mySelName.ToCString());
|
||||
|
||||
if (!S.IsNull())
|
||||
|
||||
if (!mySelection.IsNull())
|
||||
{
|
||||
AIS_SelectStatus aStatus = S->Select(EO);
|
||||
AIS_SelectStatus aStatus = mySelection->Select(EO);
|
||||
EO->SetSelected (aStatus == AIS_SS_Added);
|
||||
}
|
||||
|
||||
@@ -1126,7 +1120,7 @@ void AIS_LocalContext::AddOrRemoveSelected(const TopoDS_Shape& Sh,
|
||||
Handle(SelectMgr_EntityOwner) EO = FindSelectedOwnerFromShape(Sh);
|
||||
if (!EO.IsNull())
|
||||
{
|
||||
AIS_Selection::Selection(mySelName.ToCString())->Select(EO);
|
||||
mySelection->Select(EO);
|
||||
EO->SetSelected (Standard_True);
|
||||
}
|
||||
HilightPicked (updateviewer);
|
||||
@@ -1142,7 +1136,7 @@ void AIS_LocalContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)&
|
||||
|
||||
Standard_Boolean toSelect = theOwner->IsSelected() ? Standard_False : Standard_True;
|
||||
|
||||
AIS_Selection::Selection (mySelName.ToCString())->Select (theOwner);
|
||||
mySelection->Select(theOwner);
|
||||
theOwner->SetSelected (toSelect);
|
||||
|
||||
if(myAutoHilight)
|
||||
@@ -1261,14 +1255,13 @@ Standard_Boolean AIS_LocalContext::HasDetectedShape() const
|
||||
const TopoDS_Shape&
|
||||
AIS_LocalContext::DetectedShape() const
|
||||
{
|
||||
static TopoDS_Shape bidsh;
|
||||
if(mylastindex != 0)
|
||||
{
|
||||
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(myMapOfOwner->FindKey (mylastindex));
|
||||
if(BROwnr.IsNull()) return bidsh;
|
||||
if(BROwnr.IsNull()) return AIS_myDummyShape;
|
||||
return BROwnr->Shape();
|
||||
}
|
||||
return bidsh;
|
||||
return AIS_myDummyShape;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1446,16 +1439,11 @@ Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromIO
|
||||
Handle(SelectMgr_EntityOwner) EO,bid;
|
||||
if (anIObj.IsNull()) return EO;
|
||||
|
||||
Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString());
|
||||
if(Sel.IsNull()) {
|
||||
#ifdef OCCT_DEBUG
|
||||
cout<<"\t\tAIS_LocalCOntext::FindSelectedOwnerFromShape : Selection "
|
||||
<<mySelName<<" Nulle "<<endl;
|
||||
#endif
|
||||
if(mySelection.IsNull()) {
|
||||
return EO;
|
||||
}
|
||||
Standard_Boolean found(Standard_False);
|
||||
const AIS_NListTransient& Obj = Sel->Objects();
|
||||
const AIS_NListTransient& Obj = mySelection->Objects();
|
||||
AIS_NListTransient::Iterator anIter( Obj );
|
||||
for(; anIter.More(); anIter.Next()){
|
||||
const Handle(Standard_Transient)& Tr = anIter.Value();
|
||||
@@ -1485,11 +1473,7 @@ Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromShape(const
|
||||
Handle(SelectMgr_EntityOwner) EO, bid;
|
||||
if (sh.IsNull()) return EO;
|
||||
|
||||
Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString());
|
||||
if(Sel.IsNull()) {
|
||||
#ifdef OCCT_DEBUG
|
||||
cout<<"\t\tAIS_LocalCOntext::FindSelectedOwnerFromShape : Selection "<<mySelName<<" Nulle "<<endl;
|
||||
#endif
|
||||
if(mySelection.IsNull()) {
|
||||
return EO;
|
||||
}
|
||||
|
||||
@@ -1546,13 +1530,11 @@ void AIS_LocalContext::NextDetected()
|
||||
//=======================================================================
|
||||
const TopoDS_Shape& AIS_LocalContext::DetectedCurrentShape() const
|
||||
{
|
||||
static TopoDS_Shape aDummyShape;
|
||||
|
||||
Handle(AIS_Shape) aCurrentShape = Handle(AIS_Shape)::DownCast (DetectedCurrentObject());
|
||||
|
||||
if (aCurrentShape.IsNull())
|
||||
{
|
||||
return aDummyShape;
|
||||
return AIS_myDummyShape;
|
||||
}
|
||||
|
||||
return aCurrentShape->Shape();
|
||||
|
1219
src/AIS/AIS_Manipulator.cxx
Normal file
1219
src/AIS/AIS_Manipulator.cxx
Normal file
File diff suppressed because it is too large
Load Diff
670
src/AIS/AIS_Manipulator.hxx
Normal file
670
src/AIS/AIS_Manipulator.hxx
Normal file
@@ -0,0 +1,670 @@
|
||||
// Created on: 2015-12-23
|
||||
// Created by: Anastasia BORISOVA
|
||||
// Copyright (c) 2015 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_Manipulator_HeaderFile
|
||||
#define _AIS_Manipulator_HeaderFile
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <AIS_ManipulatorMode.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_ArrayOfQuadrangles.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <NCollection_HSequence.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <Standard_Version.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
NCOLLECTION_HSEQUENCE(AIS_ManipulatorObjectSequence, Handle(AIS_InteractiveObject));
|
||||
|
||||
DEFINE_STANDARD_HANDLE (AIS_Manipulator, AIS_InteractiveObject)
|
||||
|
||||
//! Interactive object class to manipulate local transformation of another interactive
|
||||
//! object or a group of objects via mouse.
|
||||
//! It manages three types of manipulations in 3D space:
|
||||
//! - translation through axis
|
||||
//! - scaling within axis
|
||||
//! - rotation around axis
|
||||
//! To enable one of this modes, selection mode (from 1 to 3) is to be activated.
|
||||
//! There are three orthogonal transformation axes defined by position property of
|
||||
//! the manipulator. Particular transformation mode can be disabled for each
|
||||
//! of the axes or all of them. Furthermore each of the axes can be hidden or
|
||||
//! made visible.
|
||||
//! The following steps demonstrate how to attach, configure and use manipulator
|
||||
//! for an interactive object:
|
||||
//! Step 1. Create manipulator object and adjust it appearance:
|
||||
//! @code
|
||||
//! Handle(AIS_Manipulator) aManipulator = new AIS_Manipulator();
|
||||
//! aManipulator->SetPart (0, AIS_Manipulator::Scaling, Standard_False);
|
||||
//! aManipulator->SetPart (1, AIS_Manipulator::Rotation, Standard_False);
|
||||
//! // Attach manipulator to already displayed object and manage manipulation modes
|
||||
//! aManipulator->AttachToObject (anAISObject);
|
||||
//! aManipulator->EnableMode (AIS_Manipulator::Translation);
|
||||
//! aManipulator->EnableMode (AIS_Manipulator::Rotation);
|
||||
//! aManipulator->EnableMode (AIS_Manipulator::Scaling);
|
||||
//! @endcode
|
||||
//! Note that you can enable only one manipulation mode but have all visual parts displayed.
|
||||
//! This code allows you to view manipulator and select its manipulation parts.
|
||||
//! Note that manipulator activates mode on part selection.
|
||||
//! If this mode is activated, no selection will be performed for manipulator.
|
||||
//! It can be activated with highlighting. To enable this:
|
||||
//! @code
|
||||
//! aManipulator->SetModeActivationOnDetection (Standard_True);
|
||||
//! @endcode
|
||||
//! Step 2. To perform transformation of object use next code in your event processing chain:
|
||||
//! @code
|
||||
//! // catch mouse button down event
|
||||
//! if (aManipulator->HasActiveMode())
|
||||
//! {
|
||||
//! aManipulator->StartTransform (anXPix, anYPix, aV3dView);
|
||||
//! }
|
||||
//! ...
|
||||
//! // or track mouse move event
|
||||
//! if (aManipulator->HasActiveMode())
|
||||
//! {
|
||||
//! aManipulator->Transform (anXPix, anYPix, aV3dView);
|
||||
//! aV3dView->Redraw();
|
||||
//! }
|
||||
//! ...
|
||||
//! // or catch mouse button up event (apply) or escape event (cancel)
|
||||
//! aManipulator->StopTransform(/*Standard_Boolean toApply*/);
|
||||
//! @endcode
|
||||
//! Step 3. To deactivate current manipulation mode use:
|
||||
//! @code aManipulator->DeactivateCurrentMode();
|
||||
//! @endcode
|
||||
//! Step 4. To detach manipulator from object use:
|
||||
//! @code
|
||||
//! aManipulator->Detach();
|
||||
//! @endcode
|
||||
//! The last method erases manipulator object.
|
||||
//! @warning
|
||||
//! On construction an instance of AIS_Manipulator object is bound to Graphic3d_ZLayerId_Topmost layer,
|
||||
//! so make sure to call for your AIS_InteractiveContext the method MainSelector()->SetPickClosest (Standard_False)
|
||||
//! otherwise you may notice issues with activation of modes.
|
||||
class AIS_Manipulator : public AIS_InteractiveObject
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructs a manipulator object with default placement and all parts to be displayed.
|
||||
Standard_EXPORT AIS_Manipulator();
|
||||
|
||||
//! Constructs a manipulator object with input location and positions of axes and all parts to be displayed.
|
||||
Standard_EXPORT AIS_Manipulator (const gp_Ax2& thePosition);
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~AIS_Manipulator() {}
|
||||
|
||||
//! Disable or enable visual parts for translation, rotation or scaling for some axis.
|
||||
//! By default all parts are enabled (will be displayed).
|
||||
//! @warning Enabling or disabling of visual parts of manipulator does not manage the manipulation (selection) mode.
|
||||
//! @warning Raises program error if axis index is < 0 or > 2.
|
||||
Standard_EXPORT void SetPart (const Standard_Integer theAxisIndex, const AIS_ManipulatorMode theMode, const Standard_Boolean theIsEnabled);
|
||||
|
||||
//! Behavior settings to be applied when performing transformation:
|
||||
//! - FollowTranslation - whether the manipulator will be moved together with an object.
|
||||
//! - FollowRotation - whether the manipulator will be rotated together with an object.
|
||||
struct OptionsForAttach {
|
||||
|
||||
OptionsForAttach() : AdjustPosition (Standard_True), AdjustSize (Standard_False), EnableModes (Standard_True) {}
|
||||
OptionsForAttach& SetAdjustPosition (const Standard_Boolean theApply) { AdjustPosition = theApply; return *this; }
|
||||
OptionsForAttach& SetAdjustSize (const Standard_Boolean theApply) { AdjustSize = theApply; return *this; }
|
||||
OptionsForAttach& SetEnableModes (const Standard_Boolean theApply) { EnableModes = theApply; return *this; }
|
||||
|
||||
Standard_Boolean AdjustPosition;
|
||||
Standard_Boolean AdjustSize;
|
||||
Standard_Boolean EnableModes;
|
||||
};
|
||||
|
||||
//! Attaches himself to the input interactive object and become displayed in the same context.
|
||||
//! It is placed in the center of object bounding box, and its size is adjusted to the object bounding box.
|
||||
Standard_EXPORT void Attach (const Handle(AIS_InteractiveObject)& theObject, const OptionsForAttach& theOptions = OptionsForAttach());
|
||||
|
||||
//! Attaches himself to the input interactive object group and become displayed in the same context.
|
||||
//! It become attached to the first object, baut manage manipulation of the whole group.
|
||||
//! It is placed in the center of object bounding box, and its size is adjusted to the object bounding box.
|
||||
Standard_EXPORT void Attach (const Handle(AIS_ManipulatorObjectSequence)& theObject, const OptionsForAttach& theOptions = OptionsForAttach());
|
||||
|
||||
//! Enable manipualtion mode.
|
||||
//! @warning It activates selection mode in the current context.
|
||||
//! If manipulator is not displayed, no mode will be activated.
|
||||
Standard_EXPORT void EnableMode (const AIS_ManipulatorMode theMode);
|
||||
|
||||
//! Enables mode activation on detection (highlighting).
|
||||
//! By default, mode is activated on selection of manipulator part.
|
||||
//! @warning If this mode is enabled, selection of parts does nothing.
|
||||
void SetModeActivationOnDetection (const Standard_Boolean theToEnable)
|
||||
{
|
||||
myIsActivationOnDetection = theToEnable;
|
||||
}
|
||||
|
||||
//! @return true if manual mode activation is enabled.
|
||||
Standard_Boolean IsModeActivationOnDetection() const
|
||||
{
|
||||
return myIsActivationOnDetection;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Init start (reference) transformation.
|
||||
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform
|
||||
//! and is used only for custom transform set. If Transform(const Standard_Integer, const Standard_Integer) is used,
|
||||
//! initial data is set automatically, and it is reset on DeactivateCurrentMode call if it is not reset yet.
|
||||
Standard_EXPORT void StartTransform (const Standard_Integer theX, const Standard_Integer theY, const Handle(V3d_View)& theView);
|
||||
|
||||
//! Apply to the owning objects the input transformation.
|
||||
//! @remark The transformation is set using SetLocalTransformation for owning objects.
|
||||
//! The location of the manipulator is stored also in Local Transformation,
|
||||
//! so that there's no need to redisplay objects.
|
||||
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform
|
||||
//! and is used only for custom transform set.
|
||||
//! @warning It will does nothing if transformation is not initiated (with StartTransform() call).
|
||||
Standard_EXPORT void Transform (const gp_Trsf& aTrsf);
|
||||
|
||||
//! Reset start (reference) transformation.
|
||||
//! @param theToApply [in] option to apply or to cancel the started transformation.
|
||||
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform
|
||||
//! and is used only for custom transform set.
|
||||
Standard_EXPORT void StopTransform (const Standard_Boolean theToApply = Standard_True);
|
||||
|
||||
//! Apply transformation made from mouse moving from start position
|
||||
//! (save on the first Tranform() call and reset on DeactivateCurrentMode() call.)
|
||||
//! to the in/out mouse position (theX, theY)
|
||||
Standard_EXPORT gp_Trsf Transform (const Standard_Integer theX, const Standard_Integer theY,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Computes transformation of parent object according to the active mode and input motion vector.
|
||||
//! You can use this method to get object transformation according to current mode or use own algorithm
|
||||
//! to implement any other tranformation for modes.
|
||||
//! @return transformation of parent object.
|
||||
Standard_EXPORT Standard_Boolean ObjectTransformation (const Standard_Integer theX, const Standard_Integer theY,
|
||||
const Handle(V3d_View)& theView, gp_Trsf& theTrsf);
|
||||
|
||||
//! Make inactive the current selected manipulator part and reset current axis index and current mode.
|
||||
//! After its call HasActiveMode() returns false.
|
||||
//! @sa HasActiveMode()
|
||||
Standard_EXPORT void DeactivateCurrentMode();
|
||||
|
||||
//! Detaches himself from the owner object, and removes itself from context.
|
||||
Standard_EXPORT void Detach();
|
||||
|
||||
//! @return all owning objects.
|
||||
Standard_EXPORT Handle(AIS_ManipulatorObjectSequence) Objects() const;
|
||||
|
||||
//! @return the first (leading) object of the owning objects.
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) Object() const;
|
||||
|
||||
//! @return one of the owning objects.
|
||||
//! @warning raises program error if theIndex is more than owning objects count or less than 1.
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) Object (const Standard_Integer theIndex) const;
|
||||
|
||||
//! @return true if manipulator is attached to some interactive object (has owning object).
|
||||
Standard_Boolean IsAttached() const { return HasOwner(); }
|
||||
|
||||
//! @return true if some part of manipulator is selected (tranformation mode is active, and owning object can be rtansformated).
|
||||
Standard_Boolean HasActiveMode() const { return IsAttached() && myCurrentMode != AIS_MM_None; }
|
||||
|
||||
Standard_Boolean HasActiveTransformation() { return myHasStartedTransformation; }
|
||||
|
||||
gp_Trsf StartTransformation() const { return myStartTrsfs.Size() < 1 ? gp_Trsf() : myStartTrsfs(1); }
|
||||
|
||||
gp_Trsf StartTransformation (const Standard_Integer theIndex) const
|
||||
{
|
||||
Standard_ProgramError_Raise_if (theIndex < 1 || theIndex > Objects()->Upper(),
|
||||
"AIS_Manipulator::StartTransformation(): theIndex is out of bounds");
|
||||
return myStartTrsfs.Size() < 1 ? gp_Trsf() : myStartTrsfs (theIndex);
|
||||
}
|
||||
|
||||
public: //! @name Configuration of graphical transformations
|
||||
|
||||
//! Enable or disable zoom persistence mode for the manipulator. With
|
||||
//! this mode turned on the presentation will keep fixed screen size.
|
||||
//! @warning when turned on this option overrides transform persistence
|
||||
//! properties and local transformation to achieve necessary visual effect.
|
||||
//! @warning revise use of AdjustSize argument of of \sa AttachToObjects method
|
||||
//! when enabling zoom persistence.
|
||||
Standard_EXPORT void SetZoomPersistence (const Standard_Boolean theToEnable);
|
||||
|
||||
//! Returns state of zoom persistence mode, whether it turned on or off.
|
||||
Standard_Boolean ZoomPersistence() const { return myIsZoomPersistentMode; }
|
||||
|
||||
//! Redefines transform persistence management to setup transformation for sub-presentation of axes.
|
||||
//! @warning this interactive object does not support custom transformation persistence when
|
||||
//! using \sa ZoomPersistence mode. In this mode the transformation persistence flags for
|
||||
//! presentations are overriden by this class.
|
||||
//! @warning Invokes debug assertion to catch incompatible usage of the method with \sa ZoomPersistence mode,
|
||||
//! silently does nothing in release mode.
|
||||
//! @warning revise use of AdjustSize argument of of \sa AttachToObjects method
|
||||
//! when enabling zoom persistence.
|
||||
Standard_EXPORT virtual void SetTransformPersistence (const Graphic3d_TransModeFlags& theFlag, const gp_Pnt& thePoint) Standard_OVERRIDE;
|
||||
|
||||
//! Redefines local transformation management method to inform user of inproper use.
|
||||
//! @warning this interactive object does not support setting custom local transformation,
|
||||
//! this class solely uses this property to implement visual positioning of the manipulator
|
||||
//! without need for recomputing presentation.
|
||||
//! @warning Invokes debug assertion in debug to catch incompatible usage of the
|
||||
//! method, silently does nothing in release mode.
|
||||
Standard_EXPORT virtual void SetLocalTransformation (const gp_Trsf& theTransformation) Standard_OVERRIDE;
|
||||
|
||||
public: //! @name Setters for parameters
|
||||
|
||||
AIS_ManipulatorMode ActiveMode() const { return myCurrentMode; }
|
||||
|
||||
//! @return poition of manipulator interactive object.
|
||||
const gp_Ax2& Position() const { return myPosition; }
|
||||
|
||||
//! Sets position of the manipulator object.
|
||||
Standard_EXPORT void SetPosition (const gp_Ax2& thePosition);
|
||||
|
||||
Standard_ShortReal Size() const { return myAxes[0].Size(); }
|
||||
|
||||
//! Sets size (length of side of the manipulator cubic bounding box.
|
||||
Standard_EXPORT void SetSize (const Standard_ShortReal theSideLength);
|
||||
|
||||
//! Sets gaps between translator, scaler and rotator sub-presentations.
|
||||
Standard_EXPORT void SetGap (const Standard_ShortReal theValue);
|
||||
|
||||
public:
|
||||
|
||||
//! Behavior settings to be applied when performing transformation:
|
||||
//! - FollowTranslation - whether the manipulator will be moved together with an object.
|
||||
//! - FollowRotation - whether the manipulator will be rotated together with an object.
|
||||
struct BehaviorOnTransform {
|
||||
|
||||
BehaviorOnTransform() : FollowTranslation (Standard_True), FollowRotation (Standard_True) {}
|
||||
BehaviorOnTransform& SetFollowTranslation (const Standard_Boolean theApply) { FollowTranslation = theApply; return *this; }
|
||||
BehaviorOnTransform& SetFollowRotation (const Standard_Boolean theApply) { FollowRotation = theApply; return *this; }
|
||||
|
||||
Standard_Boolean FollowTranslation;
|
||||
Standard_Boolean FollowRotation;
|
||||
};
|
||||
|
||||
//! Sets behavior settings for transformation action carried on the manipulator,
|
||||
//! whether it translates, rotates together with the transformed object or not.
|
||||
void SetTransformBehavior (const BehaviorOnTransform& theSettings) { myBehaviorOnTransform = theSettings; }
|
||||
|
||||
//! @return behavior settings for transformation action of the manipulator.
|
||||
BehaviorOnTransform& ChangeTransformBehavior() { return myBehaviorOnTransform; }
|
||||
|
||||
//! @return behavior settings for transformation action of the manipulator.
|
||||
const BehaviorOnTransform& TransformBehavior() const { return myBehaviorOnTransform; }
|
||||
|
||||
public: //! @name Presentation computation
|
||||
|
||||
//! Fills presentation.
|
||||
//! @note Manipulator presentation does not use display mode and for all modes has the same presenatation.
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode = 0) Standard_OVERRIDE;
|
||||
|
||||
//! Computes selection sensitive zones (triangulation) for manipulator.
|
||||
//! @param theNode [in] Seldction mode that is treated as transformation mode.
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overriden methods.
|
||||
Standard_EXPORT virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//! Method which clear all selected owners belonging
|
||||
//! to this selectable object ( for fast presentation draw ).
|
||||
Standard_EXPORT virtual void ClearSelected() Standard_OVERRIDE;
|
||||
|
||||
//! Method which draws selected owners ( for fast presentation draw ).
|
||||
Standard_EXPORT virtual void HilightSelected (const Handle(PrsMgr_PresentationManager3d)& thePM, const SelectMgr_SequenceOfOwner& theSeq) Standard_OVERRIDE;
|
||||
|
||||
//! Method which hilight an owner belonging to
|
||||
//! this selectable object ( for fast presentation draw ).
|
||||
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM, const Quantity_NameOfColor theColor, const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT void init();
|
||||
|
||||
Standard_EXPORT void updateTransformation();
|
||||
|
||||
Standard_EXPORT Handle(Prs3d_Presentation) getHighlightPresentation (const Handle(SelectMgr_EntityOwner)& theOwner) const;
|
||||
|
||||
Standard_EXPORT Handle(Graphic3d_Group) getGroup (const Standard_Integer theIndex, const AIS_ManipulatorMode theMode) const;
|
||||
|
||||
Standard_EXPORT void attachToBox (const Bnd_Box& theBox);
|
||||
|
||||
Standard_EXPORT void adjustSize (const Bnd_Box& theBox);
|
||||
|
||||
Standard_EXPORT void setTransformPersistence (const Graphic3d_TransModeFlags& theFlag, const gp_Pnt& thePoint);
|
||||
|
||||
protected: //! @name Auxilliary classes to fill presentation with proper primitives
|
||||
|
||||
class Quadric
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~Quadric()
|
||||
{
|
||||
myTriangulation.Nullify();
|
||||
myArray.Nullify();
|
||||
}
|
||||
|
||||
|
||||
const Handle(Poly_Triangulation)& Triangulation() const { return myTriangulation; }
|
||||
|
||||
const Handle(Graphic3d_ArrayOfTriangles)& Array() const { return myArray; }
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Poly_Triangulation) myTriangulation;
|
||||
Handle(Graphic3d_ArrayOfTriangles) myArray;
|
||||
};
|
||||
|
||||
class Cylinder : public Quadric
|
||||
{
|
||||
public:
|
||||
|
||||
Cylinder()
|
||||
: Quadric(),
|
||||
myBottomRad(1.0f),
|
||||
myTopRad(1.0f),
|
||||
myHeight(1.0f)
|
||||
{ }
|
||||
|
||||
virtual ~Cylinder() {}
|
||||
|
||||
void Init (const Standard_ShortReal theBotRad, const Standard_ShortReal theTopRad,
|
||||
const Standard_ShortReal theHeight,
|
||||
const Standard_Integer theSlicesNb, const Standard_Integer theStacksNb,
|
||||
const gp_Ax1& thePosition);
|
||||
|
||||
protected:
|
||||
|
||||
gp_Ax1 myPosition;
|
||||
Standard_ShortReal myBottomRad;
|
||||
Standard_ShortReal myTopRad;
|
||||
Standard_ShortReal myHeight;
|
||||
};
|
||||
|
||||
class Disk : public Quadric
|
||||
{
|
||||
public:
|
||||
|
||||
Disk()
|
||||
: Quadric(),
|
||||
myInnerRad(0.0f),
|
||||
myOuterRad(1.0f)
|
||||
{ }
|
||||
|
||||
~Disk() { }
|
||||
|
||||
void Init (const Standard_ShortReal theInnerRadius,
|
||||
const Standard_ShortReal theOuterRadius,
|
||||
const gp_Ax1& thePosition,
|
||||
const Standard_Integer theSlicesNb = 20,
|
||||
const Standard_Integer theStacksNb = 20);
|
||||
|
||||
protected:
|
||||
|
||||
gp_Ax1 myPosition;
|
||||
Standard_ShortReal myInnerRad;
|
||||
Standard_ShortReal myOuterRad;
|
||||
};
|
||||
|
||||
class Sphere : public Quadric
|
||||
{
|
||||
public:
|
||||
Sphere()
|
||||
: Quadric(),
|
||||
myRadius(1.0f)
|
||||
{}
|
||||
|
||||
void Init (const Standard_ShortReal theRadius,
|
||||
const gp_Pnt& thePosition,
|
||||
const Standard_Integer theSlicesNb = 20,
|
||||
const Standard_Integer theStacksNb = 20);
|
||||
|
||||
protected:
|
||||
|
||||
gp_Pnt myPosition;
|
||||
Standard_ShortReal myRadius;
|
||||
};
|
||||
|
||||
class Cube
|
||||
{
|
||||
public:
|
||||
|
||||
Cube() { }
|
||||
~Cube() { }
|
||||
|
||||
void Init (const gp_Ax1& thePosition, const Standard_ShortReal myBoxSize);
|
||||
|
||||
const Handle(Poly_Triangulation)& Triangulation() const { return myTriangulation; }
|
||||
|
||||
const Handle(Graphic3d_ArrayOfTriangles)& Array() const { return myArray; }
|
||||
|
||||
private:
|
||||
|
||||
void addTriangle (const Standard_Integer theIndex, const gp_Pnt& theP1, const gp_Pnt& theP2, const gp_Pnt& theP3,
|
||||
const gp_Dir& theNormal);
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Poly_Triangulation) myTriangulation;
|
||||
Handle(Graphic3d_ArrayOfTriangles) myArray;
|
||||
};
|
||||
|
||||
//! The class describes on axis sub-object.
|
||||
//! It includes sub-objects itself:
|
||||
//! -rotator
|
||||
//! -translator
|
||||
//! -scaler
|
||||
class Axis
|
||||
{
|
||||
public:
|
||||
|
||||
Axis (const gp_Ax1& theAxis = gp_Ax1(),
|
||||
const Quantity_Color& theColor = Quantity_Color(),
|
||||
const Standard_ShortReal theLength = 10.0f);
|
||||
|
||||
void Compute (const Handle_PrsMgr_PresentationManager3d& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Handle(Prs3d_ShadingAspect)& theAspect);
|
||||
|
||||
const gp_Ax1& ReferenceAxis() const { return myReferenceAxis; }
|
||||
|
||||
void SetPosition (const gp_Ax1& thePosition) { myPosition = thePosition; }
|
||||
|
||||
const gp_Ax1& Position() const { return myPosition; }
|
||||
|
||||
void SetTransformPersistence (const Graphic3d_TransModeFlags& theFlags, const gp_Pnt& thePoint)
|
||||
{
|
||||
if (!myHighlightTranslator.IsNull())
|
||||
{
|
||||
myHighlightTranslator->SetTransformPersistence (theFlags, thePoint);
|
||||
}
|
||||
|
||||
if (!myHighlightScaler.IsNull())
|
||||
{
|
||||
myHighlightScaler->SetTransformPersistence (theFlags, thePoint);
|
||||
}
|
||||
|
||||
if (!myHighlightRotator.IsNull())
|
||||
{
|
||||
myHighlightRotator->SetTransformPersistence (theFlags, thePoint);
|
||||
}
|
||||
}
|
||||
|
||||
Graphic3d_TransModeFlags GetTransformPersistenceMode() const { return myHighlightTranslator->TransformPersistenceMode(); }
|
||||
|
||||
gp_Pnt GetTransformPersistencePoint() const { return myHighlightTranslator->TransformPersistencePoint(); }
|
||||
|
||||
void Transform (const Handle(Geom_Transformation)& theTransformation)
|
||||
{
|
||||
if (!myHighlightTranslator.IsNull())
|
||||
{
|
||||
myHighlightTranslator->Transform (theTransformation);
|
||||
}
|
||||
|
||||
if (!myHighlightScaler.IsNull())
|
||||
{
|
||||
myHighlightScaler->Transform (theTransformation);
|
||||
}
|
||||
|
||||
if (!myHighlightRotator.IsNull())
|
||||
{
|
||||
myHighlightRotator->Transform (theTransformation);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean HasTranslation() const { return myHasTranslation; }
|
||||
|
||||
Standard_Boolean HasRotation() const { return myHasRotation; }
|
||||
|
||||
Standard_Boolean HasScaling() const { return myHasScaling; }
|
||||
|
||||
void SetTranslation (const Standard_Boolean theIsEnabled) { myHasTranslation = theIsEnabled; }
|
||||
|
||||
void SetRotation (const Standard_Boolean theIsEnabled) { myHasRotation = theIsEnabled; }
|
||||
|
||||
void SetScaling (const Standard_Boolean theIsEnabled) { myHasScaling = theIsEnabled; }
|
||||
|
||||
Quantity_Color Color() const { return myColor; }
|
||||
|
||||
Standard_ShortReal AxisLength() const { return myLength; }
|
||||
|
||||
Standard_ShortReal AxisRadius() const { return myAxisRadius; }
|
||||
|
||||
void SetAxisRadius (const Standard_ShortReal theValue) { myAxisRadius = theValue; }
|
||||
|
||||
const Handle(Prs3d_Presentation)& TranslatorHighlightPrs() const { return myHighlightTranslator; }
|
||||
|
||||
const Handle(Prs3d_Presentation)& RotatorHighlightPrs() const { return myHighlightRotator; }
|
||||
|
||||
const Handle(Prs3d_Presentation)& ScalerHighlightPrs() const { return myHighlightScaler; }
|
||||
|
||||
const Handle(Graphic3d_Group)& TranslatorGroup() const { return myTranslatorGroup; }
|
||||
|
||||
const Handle(Graphic3d_Group)& RotatorGroup() const { return myRotatorGroup; }
|
||||
|
||||
const Handle(Graphic3d_Group)& ScalerGroup() const { return myScalerGroup; }
|
||||
|
||||
void SetIndent (const Standard_ShortReal theValue) { myIndent = theValue; }
|
||||
|
||||
Standard_ShortReal Size() const { return myLength + myBoxSize + myDiskThickness + myIndent * 2.0f; }
|
||||
|
||||
gp_Pnt ScalerCenter (const gp_Pnt& theLocation) const { return theLocation.XYZ() + myPosition.Direction().XYZ() * (myLength + myIndent + myBoxSize * 0.5f); }
|
||||
|
||||
void SetSize (const Standard_ShortReal theValue)
|
||||
{
|
||||
if (myIndent > theValue * 0.1f)
|
||||
{
|
||||
myLength = theValue * 0.7f;
|
||||
myBoxSize = theValue * 0.15f;
|
||||
myDiskThickness = theValue * 0.05f;
|
||||
myIndent = theValue * 0.05f;
|
||||
}
|
||||
else // use pre-set value of predent
|
||||
{
|
||||
Standard_ShortReal aLength = theValue - 2 * myIndent;
|
||||
myLength = aLength * 0.8f;
|
||||
myBoxSize = aLength * 0.15f;
|
||||
myDiskThickness = aLength * 0.05f;
|
||||
}
|
||||
myInnerRadius = myIndent * 2 + myBoxSize + myLength;
|
||||
myAxisRadius = myBoxSize / 4.0f;
|
||||
}
|
||||
|
||||
Standard_Integer FacettesNumber() const { return myFacettesNumber; }
|
||||
|
||||
public:
|
||||
|
||||
const Cylinder& TranslatorCylinder() const { return myCylinder; }
|
||||
const Cylinder& TranslatorArrow() const { return myArrow; }
|
||||
const gp_Pnt& TranslatorTipPosition() const { return myArrowTipPos; }
|
||||
const Disk& TranslatorArrowBottom() const { return myArrowBottom; }
|
||||
const Disk& RotatorDisk() const { return myCircle; }
|
||||
float RotatorDiskRadius() const { return myCircleRadius; }
|
||||
const Cube& ScalerCube() const { return myCube; }
|
||||
const gp_Pnt& ScalerCubePosition() const { return myCubePos; }
|
||||
|
||||
protected:
|
||||
|
||||
gp_Ax1 myReferenceAxis; //!< Returns reference axis assignment.
|
||||
gp_Ax1 myPosition; //!< Position of the axis including local transformation.
|
||||
Quantity_Color myColor;
|
||||
|
||||
Standard_Boolean myHasTranslation;
|
||||
Standard_ShortReal myLength; //!< Length of translation axis.
|
||||
Standard_ShortReal myAxisRadius;
|
||||
|
||||
Standard_Boolean myHasScaling;
|
||||
Standard_ShortReal myBoxSize; //!< Size of scaling cube.
|
||||
|
||||
Standard_Boolean myHasRotation;
|
||||
Standard_ShortReal myInnerRadius; //!< Radius of rotation circle.
|
||||
Standard_ShortReal myDiskThickness;
|
||||
Standard_ShortReal myIndent; //!< Gap between visual part of the manipulator.
|
||||
|
||||
protected:
|
||||
|
||||
Standard_Integer myFacettesNumber;
|
||||
|
||||
Cylinder myCylinder;
|
||||
Cylinder myArrow;
|
||||
gp_Pnt myArrowTipPos;
|
||||
Disk myArrowBottom;
|
||||
Disk myCircle;
|
||||
float myCircleRadius;
|
||||
Cube myCube;
|
||||
gp_Pnt myCubePos;
|
||||
|
||||
Handle(Graphic3d_Group) myTranslatorGroup;
|
||||
Handle(Graphic3d_Group) myScalerGroup;
|
||||
Handle(Graphic3d_Group) myRotatorGroup;
|
||||
|
||||
Handle(Prs3d_Presentation) myHighlightTranslator;
|
||||
Handle(Prs3d_Presentation) myHighlightScaler;
|
||||
Handle(Prs3d_Presentation) myHighlightRotator;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
Axis myAxes[3]; //!< Tree axes of the manipulator.
|
||||
Sphere myCenter; //!< Visual part displaying the center sphere of the manipulator.
|
||||
gp_Ax2 myPosition; //!< Position of the manipualtor object. it displayes its location and position of its axes.
|
||||
|
||||
Standard_Integer myCurrentIndex; //!< Index of active axis.
|
||||
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipualtion mode.
|
||||
|
||||
Standard_Boolean myIsActivationOnDetection; //!< Manual activation of modes (not on parts selection).
|
||||
Standard_Boolean myIsZoomPersistentMode; //!< Zoom persistence mode activation.
|
||||
BehaviorOnTransform myBehaviorOnTransform; //!< Behavior settings applied on manipulator when transforming an object.
|
||||
|
||||
protected: //! @name Fields for interactive trnasformation. Fields only for internal needs. They do not have public interface.
|
||||
|
||||
NCollection_Sequence<gp_Trsf> myStartTrsfs; //!< Owning object transformation for start. It is used internally.
|
||||
Standard_Boolean myHasStartedTransformation; //!< Shows if transformation is processed (sequential calls of Transform()).
|
||||
gp_Ax2 myStartPosition; //! Start position of manipulator.
|
||||
gp_Pnt myStartPick; //! 3d point corresponding to start mouse pick.
|
||||
Standard_Real myPrevState; //! Previous value of angle during rotation.
|
||||
|
||||
//! Aspect used to colour current detected part and current selected part.
|
||||
Handle(Prs3d_ShadingAspect) myHighlightAspect;
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_Manipulator, AIS_InteractiveObject)
|
||||
};
|
||||
#endif // _AIS_Manipulator_HeaderFile
|
@@ -1,7 +1,6 @@
|
||||
// Created on: 1992-11-13
|
||||
// Created by: GG
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
// Created on: 2015-02-05
|
||||
// Created by: Anastasia BORISOVA
|
||||
// Copyright (c) 2015 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
@@ -14,18 +13,16 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _V3d_TypeOfSurfaceDetail_HeaderFile
|
||||
#define _V3d_TypeOfSurfaceDetail_HeaderFile
|
||||
#ifndef _AIS_ManipulatorMode_HeaderFile
|
||||
#define _AIS_ManipulatorMode_HeaderFile
|
||||
|
||||
//! Modes of visualization for objects in a view
|
||||
//! - V3d_TEX_NONE: no texture mapping,
|
||||
//! - V3d_TEX_ENVIRONMENT: environment mapping only,
|
||||
//! - V3d_TEX_ALL: environment and texture mapping.
|
||||
enum V3d_TypeOfSurfaceDetail
|
||||
//! Mode to make definite kind of transformations with AIS_Manipulator object.
|
||||
enum AIS_ManipulatorMode
|
||||
{
|
||||
V3d_TEX_NONE,
|
||||
V3d_TEX_ENVIRONMENT,
|
||||
V3d_TEX_ALL
|
||||
AIS_MM_None = 0,
|
||||
AIS_MM_Translation = 1,
|
||||
AIS_MM_Rotation,
|
||||
AIS_MM_Scaling
|
||||
};
|
||||
|
||||
#endif // _V3d_TypeOfSurfaceDetail_HeaderFile
|
||||
#endif
|
94
src/AIS/AIS_ManipulatorOwner.cxx
Normal file
94
src/AIS/AIS_ManipulatorOwner.cxx
Normal file
@@ -0,0 +1,94 @@
|
||||
// Created on: 2015-12-23
|
||||
// Created by: Anastasia BORISOVA
|
||||
// Copyright (c) 2015 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <AIS_ManipulatorOwner.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_ManipulatorOwner,SelectMgr_EntityOwner)
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_ManipulatorOwner::AIS_ManipulatorOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
|
||||
const Standard_Integer theIndex,
|
||||
const AIS_ManipulatorMode theMode,
|
||||
const Standard_Integer thePriority)
|
||||
: SelectMgr_EntityOwner(theSelObject, thePriority),
|
||||
myIndex (theIndex),
|
||||
myMode (theMode)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HilightWithColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ManipulatorOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const Quantity_NameOfColor theColor,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (theMode == 0)
|
||||
{
|
||||
SelectMgr_EntityOwner::HilightWithColor (thePM, theColor, theMode);
|
||||
return;
|
||||
}
|
||||
|
||||
Selectable()->HilightOwnerWithColor (thePM, theColor, this);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsHilighted
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_ManipulatorOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer /*theMode*/) const
|
||||
{
|
||||
if (!HasSelectable())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return thePM->IsHighlighted (Selectable(), myMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Hilight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ManipulatorOwner::Hilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
if (!HasSelectable())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
thePM->Highlight (Selectable(), myMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Unhilight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ManipulatorOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
if (!HasSelectable())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
thePM->Unhighlight (Selectable(), myMode);
|
||||
}
|
60
src/AIS/AIS_ManipulatorOwner.hxx
Normal file
60
src/AIS/AIS_ManipulatorOwner.hxx
Normal file
@@ -0,0 +1,60 @@
|
||||
// Created on: 2015-12-23
|
||||
// Created by: Anastasia BORISOVA
|
||||
// Copyright (c) 2015 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_ManipulatorOwner_HeaderFile
|
||||
#define _AIS_ManipulatorOwner_HeaderFile
|
||||
|
||||
#include <AIS_Manipulator.hxx>
|
||||
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_SelectableObject.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_ManipulatorOwner, SelectMgr_EntityOwner)
|
||||
|
||||
//! Entity owner for selection management of AIS_Manipulator object.
|
||||
class AIS_ManipulatorOwner : public SelectMgr_EntityOwner
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_ManipulatorOwner, SelectMgr_EntityOwner)
|
||||
|
||||
Standard_EXPORT AIS_ManipulatorOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
|
||||
const Standard_Integer theIndex,
|
||||
const AIS_ManipulatorMode theMode,
|
||||
const Standard_Integer thePriority = 0);
|
||||
|
||||
Standard_EXPORT virtual ~AIS_ManipulatorOwner() {}
|
||||
|
||||
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM, const Quantity_NameOfColor theColor, const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Hilight (const Handle(PrsMgr_PresentationManager)& thePM, const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePM, const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT AIS_ManipulatorMode Mode() const { return myMode; }
|
||||
|
||||
//! @return index of manipulator axis.
|
||||
Standard_EXPORT Standard_Integer Index() const { return myIndex; }
|
||||
|
||||
protected:
|
||||
|
||||
Standard_Integer myIndex; //!< index of manipulator axis.
|
||||
AIS_ManipulatorMode myMode;//!< manipulation (highlight) mode.
|
||||
};
|
||||
|
||||
#endif // _AIS_ManipulatorOwner_HeaderFile
|
@@ -87,9 +87,7 @@ void AIS_Point::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
StdPrs_Point::Add(aPresentation,myComponent,myDrawer);
|
||||
else if (aMode== -99)
|
||||
{
|
||||
// Beeurk.. a revoir - rob-25/04/97
|
||||
static Handle(Graphic3d_AspectMarker3d) PtA =
|
||||
new Graphic3d_AspectMarker3d ();
|
||||
Handle(Graphic3d_AspectMarker3d) PtA = new Graphic3d_AspectMarker3d ();
|
||||
PtA->SetType(Aspect_TOM_PLUS);
|
||||
PtA->SetScale(3.);
|
||||
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include <PrsMgr_ModedPresentation.hxx>
|
||||
#include <PrsMgr_Presentations.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <StdPrs_BndBox.hxx>
|
||||
@@ -461,15 +462,41 @@ void AIS_PointCloud::Compute (const Handle(PrsMgr_PresentationManager3d)& /*theP
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_PointCloud::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer /*theMode*/)
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
|
||||
switch (theMode)
|
||||
{
|
||||
case SM_Points:
|
||||
{
|
||||
const Handle(Graphic3d_ArrayOfPoints) aPoints = GetPoints();
|
||||
if (!aPoints.IsNull()
|
||||
&& !aPoints->Attributes().IsNull())
|
||||
{
|
||||
Handle(Select3D_SensitivePrimitiveArray) aSensitive = new Select3D_SensitivePrimitiveArray (anOwner);
|
||||
aSensitive->SetSensitivityFactor (8);
|
||||
aSensitive->InitPoints (aPoints->Attributes(), aPoints->Indices(), TopLoc_Location());
|
||||
aSensitive->BVH();
|
||||
theSelection->Add (aSensitive);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SM_BndBox:
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Bnd_Box aBndBox = GetBoundingBox();
|
||||
if (aBndBox.IsVoid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
|
||||
Handle(Select3D_SensitiveBox) aSensBox = new Select3D_SensitiveBox (anOwner, aBndBox);
|
||||
theSelection->Add (aSensBox);
|
||||
}
|
||||
|
@@ -53,6 +53,13 @@ public:
|
||||
DM_BndBox = 2 //!< display as bounding box, default for highlighting
|
||||
};
|
||||
|
||||
//! Selection modes supported by this Point Cloud object
|
||||
enum SelectionMode
|
||||
{
|
||||
SM_Points = 0, //!< detected by points
|
||||
SM_BndBox = 2 //!< detected by bounding box
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
|
@@ -324,7 +324,7 @@ Standard_Boolean AIS_RubberBand::fillTriangles()
|
||||
|
||||
|
||||
Standard_Boolean toFill = Standard_False;
|
||||
if (myTriangles.IsNull() || myTriangles->VertexNumber() != myPoints.Length() + 1)
|
||||
if (myTriangles.IsNull() || myTriangles->VertexNumber() != aTriangles.Extent() * 3)
|
||||
{
|
||||
toFill = Standard_True;
|
||||
myTriangles = new Graphic3d_ArrayOfTriangles (aTriangles.Extent() * 3, 0, Standard_True);
|
||||
|
@@ -22,6 +22,8 @@
|
||||
#include <Graphic3d_Vec2.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_RubberBand, AIS_InteractiveObject)
|
||||
|
||||
//! Presentation for drawing rubber band selection.
|
||||
//! It supports rectangle and polygonal selection.
|
||||
//! It is constructed in 2d overlay.
|
||||
@@ -130,8 +132,8 @@ protected:
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Does not fill selection primitives for rubber band.
|
||||
void virtual ComputeSelection (const Handle(SelectMgr_Selection)& /*aSelection*/,
|
||||
const Standard_Integer /*aMode*/) Standard_OVERRIDE { };
|
||||
virtual void ComputeSelection (const Handle(SelectMgr_Selection)& /*aSelection*/,
|
||||
const Standard_Integer /*aMode*/) Standard_OVERRIDE { };
|
||||
|
||||
//! Fills triangles primitive array for rubber band filling.
|
||||
//! It uses Delaunay triangulation.
|
||||
|
@@ -21,147 +21,50 @@
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TColStd_SequenceOfTransient.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_Selection,MMgt_TShared)
|
||||
|
||||
#define MaxSizeOfResult 100000
|
||||
|
||||
//current selection (handle)
|
||||
static Handle(AIS_Selection) theCurrentSelection;
|
||||
static void AIS_Sel_CurrentSelection (Handle(AIS_Selection)& InputSel)
|
||||
{
|
||||
if(!InputSel.IsNull())
|
||||
theCurrentSelection = InputSel;
|
||||
else
|
||||
InputSel = theCurrentSelection;
|
||||
}
|
||||
|
||||
static TColStd_SequenceOfTransient& AIS_Sel_GetSelections()
|
||||
{
|
||||
static TColStd_SequenceOfTransient Selections;
|
||||
return Selections;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AIS_Selection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_Selection::AIS_Selection(const Standard_CString aName) :
|
||||
myName(TCollection_AsciiString(aName)),
|
||||
AIS_Selection::AIS_Selection() :
|
||||
myNb(0)
|
||||
{
|
||||
myResultMap.ReSize( MaxSizeOfResult ); // for maximum performnace on medium selections ( < 100000 objects )
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CreateSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_Selection::CreateSelection(const Standard_CString aName)
|
||||
{
|
||||
Handle(AIS_Selection) S = AIS_Selection::Selection(aName);
|
||||
if(!S.IsNull())
|
||||
return Standard_False;
|
||||
S = new AIS_Selection(aName);
|
||||
AIS_Sel_GetSelections().Prepend(S);
|
||||
AIS_Sel_CurrentSelection(S);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Selection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(AIS_Selection) AIS_Selection::Selection(const Standard_CString aName)
|
||||
{
|
||||
Handle(AIS_Selection) S;
|
||||
if(AIS_Sel_GetSelections().IsEmpty()) return S;
|
||||
|
||||
Handle(Standard_Transient) curobj;
|
||||
Handle(AIS_Selection) Sel;
|
||||
// Standard_Boolean found(Standard_False);
|
||||
for(Standard_Integer I =1; I<= AIS_Sel_GetSelections().Length();I++){
|
||||
curobj = AIS_Sel_GetSelections().Value(I);
|
||||
Sel = Handle(AIS_Selection)::DownCast (curobj);
|
||||
if(Sel->myName.IsEqual(aName))
|
||||
return Sel;
|
||||
}
|
||||
|
||||
return S;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Find
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_Selection::Find(const Standard_CString aName)
|
||||
{
|
||||
Handle(AIS_Selection) S = AIS_Selection::Selection(aName);
|
||||
return !S.IsNull();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetCurrentSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_Selection::SetCurrentSelection (const Standard_CString aName)
|
||||
{
|
||||
AIS_Selection::CreateSelection(aName);
|
||||
|
||||
|
||||
Handle(AIS_Selection) anAISSelection = AIS_Selection::Selection(aName) ;
|
||||
AIS_Sel_CurrentSelection ( anAISSelection ) ;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Select
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Selection::Select()
|
||||
{
|
||||
Handle(AIS_Selection) S;
|
||||
AIS_Sel_CurrentSelection (S);
|
||||
if(!S.IsNull()){
|
||||
S->myNb=0;
|
||||
S->myresult.Clear();
|
||||
S->myResultMap.Clear();
|
||||
}
|
||||
myNb=0;
|
||||
myresult.Clear();
|
||||
myResultMap.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CurrentSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(AIS_Selection) AIS_Selection::CurrentSelection() {
|
||||
Handle(AIS_Selection) S;
|
||||
AIS_Sel_CurrentSelection (S);
|
||||
return S;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Select
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_SelectStatus AIS_Selection::Select(const Handle(Standard_Transient)& anObject)
|
||||
{
|
||||
Handle(AIS_Selection) S;
|
||||
AIS_Sel_CurrentSelection (S);
|
||||
if(S.IsNull()) return AIS_SS_NotDone;
|
||||
Handle(AIS_InteractiveObject) anAISObj;
|
||||
Handle(SelectMgr_EntityOwner) owner = Handle(SelectMgr_EntityOwner)::DownCast( anObject );
|
||||
if ( owner.IsNull() )
|
||||
anAISObj = Handle(AIS_InteractiveObject)::DownCast( anObject );
|
||||
if ( S->myResultMap.IsBound( anObject ) ){
|
||||
AIS_NListTransient::Iterator aListIter = S->myResultMap.Find( anObject );
|
||||
if ( myResultMap.IsBound( anObject ) ){
|
||||
AIS_NListTransient::Iterator aListIter = myResultMap.Find( anObject );
|
||||
//skt-----------------------------------------------------------------
|
||||
if( S->myIterator == aListIter ) {
|
||||
if( S->myIterator.More() )
|
||||
S->myIterator.Next();
|
||||
if( myIterator == aListIter ) {
|
||||
if( myIterator.More() )
|
||||
myIterator.Next();
|
||||
else
|
||||
S->myIterator = AIS_NListTransient::Iterator();
|
||||
myIterator = AIS_NListTransient::Iterator();
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
// In the mode of advanced mesh selection only one owner is created
|
||||
@@ -170,16 +73,16 @@ AIS_SelectStatus AIS_Selection::Select(const Handle(Standard_Transient)& anObjec
|
||||
// the same as previous selected (IsForcedHilight call)
|
||||
if( !anAISObj.IsNull() || ( !owner.IsNull() && !owner->IsForcedHilight() ) )
|
||||
{
|
||||
S->myresult.Remove( aListIter );
|
||||
S->myResultMap.UnBind( anObject );
|
||||
myresult.Remove( aListIter );
|
||||
myResultMap.UnBind( anObject );
|
||||
|
||||
// update list iterator for next object in <myresult> list if any
|
||||
if ( aListIter.More() ){
|
||||
const Handle(Standard_Transient)& aNextObject = aListIter.Value();
|
||||
if ( S->myResultMap.IsBound( aNextObject ) )
|
||||
S->myResultMap( aNextObject ) = aListIter;
|
||||
if ( myResultMap.IsBound( aNextObject ) )
|
||||
myResultMap( aNextObject ) = aListIter;
|
||||
else
|
||||
S->myResultMap.Bind( aNextObject, aListIter );
|
||||
myResultMap.Bind( aNextObject, aListIter );
|
||||
}
|
||||
return AIS_SS_Removed;
|
||||
}
|
||||
@@ -188,8 +91,8 @@ AIS_SelectStatus AIS_Selection::Select(const Handle(Standard_Transient)& anObjec
|
||||
}
|
||||
|
||||
AIS_NListTransient::Iterator aListIter;
|
||||
S->myresult.Append( anObject, aListIter );
|
||||
S->myResultMap.Bind( anObject, aListIter );
|
||||
myresult.Append( anObject, aListIter );
|
||||
myResultMap.Bind( anObject, aListIter );
|
||||
return AIS_SS_Added;
|
||||
}
|
||||
|
||||
@@ -199,16 +102,12 @@ AIS_SelectStatus AIS_Selection::Select(const Handle(Standard_Transient)& anObjec
|
||||
//=======================================================================
|
||||
AIS_SelectStatus AIS_Selection::AddSelect(const Handle(Standard_Transient)& anObject)
|
||||
{
|
||||
Handle(AIS_Selection) S;
|
||||
AIS_Sel_CurrentSelection (S);
|
||||
if(S.IsNull()) return AIS_SS_NotDone;
|
||||
|
||||
if ( S->myResultMap.IsBound( anObject ) )
|
||||
if ( myResultMap.IsBound( anObject ) )
|
||||
return AIS_SS_NotDone;
|
||||
|
||||
AIS_NListTransient::Iterator aListIter;
|
||||
S->myresult.Append( anObject, aListIter );
|
||||
S->myResultMap.Bind( anObject, aListIter );
|
||||
myresult.Append( anObject, aListIter );
|
||||
myResultMap.Bind( anObject, aListIter );
|
||||
return AIS_SS_Added;
|
||||
}
|
||||
|
||||
@@ -218,14 +117,10 @@ AIS_SelectStatus AIS_Selection::AddSelect(const Handle(Standard_Transient)& anOb
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_Selection::ClearAndSelect(const Handle(Standard_Transient)& anObject) {
|
||||
Handle(AIS_Selection) S;
|
||||
AIS_Sel_CurrentSelection (S);
|
||||
if(S.IsNull()) return;
|
||||
|
||||
void AIS_Selection::ClearAndSelect(const Handle(Standard_Transient)& anObject)
|
||||
{
|
||||
Select();
|
||||
Select(anObject);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -233,14 +128,9 @@ void AIS_Selection::ClearAndSelect(const Handle(Standard_Transient)& anObject) {
|
||||
//function : Extent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer AIS_Selection::Extent() {
|
||||
Handle(AIS_Selection) S;
|
||||
AIS_Sel_CurrentSelection (S);
|
||||
|
||||
if (S.IsNull())
|
||||
return 0;
|
||||
|
||||
return S->myresult.Extent();
|
||||
Standard_Integer AIS_Selection::Extent() const
|
||||
{
|
||||
return myresult.Extent();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -249,63 +139,16 @@ Standard_Integer AIS_Selection::Extent() {
|
||||
//=======================================================================
|
||||
Handle(Standard_Transient) AIS_Selection::Single()
|
||||
{
|
||||
Handle(AIS_Selection) S;
|
||||
AIS_Sel_CurrentSelection (S);
|
||||
|
||||
if (S.IsNull())
|
||||
return Handle(Standard_Transient)();
|
||||
|
||||
S->Init();
|
||||
return S->Value();
|
||||
Init();
|
||||
return Value();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsSelected
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_Selection::IsSelected(const Handle(Standard_Transient)& anObject)
|
||||
Standard_Boolean AIS_Selection::IsSelected(const Handle(Standard_Transient)& anObject) const
|
||||
{
|
||||
Handle(AIS_Selection) S;
|
||||
AIS_Sel_CurrentSelection (S);
|
||||
if(S.IsNull()) return Standard_False;
|
||||
return S->myResultMap.IsBound( anObject );
|
||||
return myResultMap.IsBound( anObject );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Index
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer AIS_Selection::Index(const Standard_CString aName)
|
||||
{
|
||||
Handle (Standard_Transient) curobj;
|
||||
for(Standard_Integer I =1; I<= AIS_Sel_GetSelections().Length();I++){
|
||||
curobj = AIS_Sel_GetSelections().Value(I);
|
||||
if(Handle(AIS_Selection)::DownCast (curobj)->myName.IsEqual(aName))
|
||||
return I;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Remove
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_Selection::Remove(const Standard_CString aName)
|
||||
{
|
||||
Standard_Integer I = AIS_Selection::Index(aName);
|
||||
if(I!=0) {
|
||||
Handle(AIS_Selection) selection = Handle(AIS_Selection)::DownCast( AIS_Sel_GetSelections().Value(I) );
|
||||
Standard_Integer stored = selection->NbStored();
|
||||
if ( stored )
|
||||
selection->Select();
|
||||
AIS_Sel_GetSelections().Remove(I);
|
||||
}
|
||||
}
|
||||
|
||||
// clean the static current selection handle
|
||||
void AIS_Selection::ClearCurrentSelection()
|
||||
{
|
||||
theCurrentSelection.Nullify();
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,6 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <AIS_NListTransient.hxx>
|
||||
#include <AIS_NListIteratorOfListTransient.hxx>
|
||||
#include <AIS_NDataMapOfTransientIteratorOfListTransient.hxx>
|
||||
@@ -45,80 +44,45 @@ class AIS_Selection : public MMgt_TShared
|
||||
public:
|
||||
|
||||
|
||||
//! creates a new selection and make it current in the session.
|
||||
//! the selection will be accessible later through its name
|
||||
//! to make it again current.
|
||||
//!
|
||||
//! Note that if a session has been created, a session with
|
||||
//! the name "default" is created.
|
||||
//!
|
||||
//! In this case, the is always a current selection which
|
||||
//! is the last one created until SetCurrentSelection is used.
|
||||
//!
|
||||
//! The class methods deals with the current selection.
|
||||
//!
|
||||
//! Warning : Better Call AIS_Selection::CreateSelection.
|
||||
Standard_EXPORT AIS_Selection(const Standard_CString aName);
|
||||
//! creates a new selection.
|
||||
|
||||
Standard_EXPORT AIS_Selection();
|
||||
|
||||
Standard_EXPORT static void Remove (const Standard_CString aName);
|
||||
//! removes all the object of the selection.
|
||||
Standard_EXPORT void Select();
|
||||
|
||||
//! returns True if a selection having this name exsits.
|
||||
Standard_EXPORT static Standard_Boolean Find (const Standard_CString aName);
|
||||
|
||||
//! calls the private constructor and puts the new Selection
|
||||
//! in the list of existing selections.
|
||||
//! returns False if the selection exists.
|
||||
Standard_EXPORT static Standard_Boolean CreateSelection (const Standard_CString aName);
|
||||
|
||||
Standard_EXPORT static Handle(AIS_Selection) Selection (const Standard_CString aName);
|
||||
|
||||
//! returns False if There is no selection of name <aName>
|
||||
Standard_EXPORT static Standard_Boolean SetCurrentSelection (const Standard_CString aName);
|
||||
|
||||
Standard_EXPORT static Handle(AIS_Selection) CurrentSelection();
|
||||
|
||||
//! Clears selection.
|
||||
Standard_EXPORT static void ClearCurrentSelection();
|
||||
|
||||
//! removes all the object of the currentselection.
|
||||
Standard_EXPORT static void Select();
|
||||
|
||||
//! if the object is not yet in the current selection, it will be added.
|
||||
//! if the object is already in the current selection, it will be removed.
|
||||
Standard_EXPORT static AIS_SelectStatus Select (const Handle(Standard_Transient)& anObject);
|
||||
//! if the object is not yet in the selection, it will be added.
|
||||
//! if the object is already in the selection, it will be removed.
|
||||
Standard_EXPORT AIS_SelectStatus Select (const Handle(Standard_Transient)& anObject);
|
||||
|
||||
//! the object is always add int the selection.
|
||||
//! faster when the number of objects selected is great.
|
||||
Standard_EXPORT static AIS_SelectStatus AddSelect (const Handle(Standard_Transient)& anObject);
|
||||
Standard_EXPORT AIS_SelectStatus AddSelect (const Handle(Standard_Transient)& anObject);
|
||||
|
||||
//! clears the selection and adds the object in the selection.
|
||||
Standard_EXPORT static void ClearAndSelect (const Handle(Standard_Transient)& anObject);
|
||||
|
||||
Standard_EXPORT static Standard_Boolean IsSelected (const Handle(Standard_Transient)& anObject);
|
||||
Standard_EXPORT void ClearAndSelect (const Handle(Standard_Transient)& anObject);
|
||||
|
||||
//! checks if the object is in the selection.
|
||||
Standard_EXPORT Standard_Boolean IsSelected (const Handle(Standard_Transient)& anObject) const;
|
||||
|
||||
//! returns the number of objects selected.
|
||||
Standard_EXPORT static Standard_Integer Extent();
|
||||
Standard_EXPORT Standard_Integer Extent() const;
|
||||
|
||||
//! returns the single object selected.
|
||||
//! Warning: raises TypeMismatch from Standard if Extent is not equal to 1.
|
||||
Standard_EXPORT static Handle(Standard_Transient) Single();
|
||||
Standard_EXPORT Handle(Standard_Transient) Single();
|
||||
|
||||
void Init();
|
||||
void Init();
|
||||
|
||||
Standard_Boolean More() const;
|
||||
Standard_Boolean More() const;
|
||||
|
||||
void Next();
|
||||
void Next();
|
||||
|
||||
const Handle(Standard_Transient)& Value() const;
|
||||
const Handle(Standard_Transient)& Value() const;
|
||||
|
||||
Standard_Integer NbStored() const;
|
||||
Standard_Integer NbStored() const;
|
||||
|
||||
const AIS_NListTransient& Objects() const;
|
||||
|
||||
Standard_EXPORT static Standard_Integer Index (const Standard_CString aName);
|
||||
|
||||
|
||||
|
||||
const AIS_NListTransient& Objects() const;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_Selection,MMgt_TShared)
|
||||
|
||||
@@ -129,8 +93,6 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
|
||||
TCollection_AsciiString myName;
|
||||
AIS_NListTransient myresult;
|
||||
AIS_NListIteratorOfListTransient myIterator;
|
||||
AIS_NDataMapOfTransientIteratorOfListTransient myResultMap;
|
||||
|
@@ -70,8 +70,6 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_Shape,AIS_InteractiveObject)
|
||||
|
||||
static Standard_Boolean myFirstCompute;
|
||||
|
||||
static Standard_Boolean IsInList(const TColStd_ListOfInteger& LL, const Standard_Integer aMode)
|
||||
{
|
||||
TColStd_ListIteratorOfListOfInteger It(LL);
|
||||
@@ -92,7 +90,6 @@ AIS_InteractiveObject(PrsMgr_TOP_ProjectorDependant),
|
||||
myInitAng(0.)
|
||||
{
|
||||
Set (shap);
|
||||
myFirstCompute = Standard_True;
|
||||
SetHilightMode(0);
|
||||
myDrawer->SetShadingAspectGlobal(Standard_False);
|
||||
}
|
||||
@@ -125,7 +122,7 @@ Standard_Boolean AIS_Shape::AcceptShapeDecomposition() const
|
||||
//=======================================================================
|
||||
void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& aPrs,
|
||||
const Standard_Integer aMode)
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
aPrs->Clear();
|
||||
if(myshape.IsNull()) return;
|
||||
@@ -147,13 +144,14 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
|
||||
if (IsInfinite())
|
||||
{
|
||||
aPrs->SetInfiniteState (Standard_True); //not taken in account duting FITALL
|
||||
aPrs->SetInfiniteState (Standard_True); //not taken in account during FITALL
|
||||
}
|
||||
|
||||
switch (aMode)
|
||||
switch (theMode)
|
||||
{
|
||||
case AIS_WireFrame:
|
||||
{
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
@@ -172,18 +170,7 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
}
|
||||
case AIS_Shaded:
|
||||
{
|
||||
if (myDrawer->IsAutoTriangulation())
|
||||
{
|
||||
Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
|
||||
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (anAngleNew, anAnglePrev);
|
||||
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew, aCoeffPrev);
|
||||
if ((isOwnDeviationAngle && Abs (anAngleNew - anAnglePrev) > Precision::Angular())
|
||||
|| (isOwnDeviationCoefficient && Abs (aCoeffNew - aCoeffPrev) > Precision::Confusion()))
|
||||
{
|
||||
BRepTools::Clean (myshape);
|
||||
}
|
||||
}
|
||||
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
if ((Standard_Integer) myshape.ShapeType() > 4)
|
||||
{
|
||||
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
|
||||
@@ -398,8 +385,7 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
|
||||
return;
|
||||
}
|
||||
|
||||
static TopAbs_ShapeEnum TypOfSel;
|
||||
TypOfSel = AIS_Shape::SelectionType(aMode);
|
||||
TopAbs_ShapeEnum TypOfSel = AIS_Shape::SelectionType(aMode);
|
||||
TopoDS_Shape shape = myshape;
|
||||
|
||||
// POP protection against crash in low layers
|
||||
|
@@ -14,7 +14,12 @@
|
||||
|
||||
#include <AIS_TextLabel.hxx>
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Font_FTFont.hxx>
|
||||
#include <Font_FontMgr.hxx>
|
||||
#include <Font_Rect.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Graphic3d_RenderingParams.hxx>
|
||||
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
@@ -23,6 +28,8 @@
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
|
||||
#include <V3d_Viewer.hxx>
|
||||
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_TextLabel,AIS_InteractiveObject)
|
||||
|
||||
@@ -34,7 +41,8 @@ AIS_TextLabel::AIS_TextLabel()
|
||||
: myText ("?"),
|
||||
myFont ("Courier"),
|
||||
myFontAspect (Font_FA_Regular),
|
||||
myHasOrientation3D (Standard_False)
|
||||
myHasOrientation3D (Standard_False),
|
||||
myHasFlipping (Standard_False)
|
||||
{
|
||||
myDrawer->SetTextAspect (new Prs3d_TextAspect());
|
||||
|
||||
@@ -181,7 +189,7 @@ const gp_Ax2& AIS_TextLabel::Orientation3D() const
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasOrientation3D()
|
||||
//function : HasOrientation3D
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_TextLabel::HasOrientation3D() const
|
||||
@@ -189,6 +197,24 @@ Standard_Boolean AIS_TextLabel::HasOrientation3D() const
|
||||
return myHasOrientation3D;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetFlipping
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_TextLabel::SetFlipping (const Standard_Boolean theIsFlipping)
|
||||
{
|
||||
myHasFlipping = theIsFlipping;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasFlipping
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_TextLabel::HasFlipping() const
|
||||
{
|
||||
return myHasFlipping;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDisplayType
|
||||
//purpose :
|
||||
@@ -207,6 +233,7 @@ void AIS_TextLabel::SetColorSubTitle (const Quantity_Color& theColor)
|
||||
myDrawer->TextAspect()->Aspect()->SetColorSubTitle(theColor);
|
||||
}
|
||||
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
@@ -220,10 +247,67 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
|
||||
case 0:
|
||||
{
|
||||
Handle(Prs3d_TextAspect) anAsp = myDrawer->TextAspect();
|
||||
gp_Pnt aPosition = Position();
|
||||
|
||||
if (myHasOrientation3D)
|
||||
{
|
||||
Prs3d_Text::Draw (thePrs, anAsp, myText, myOrientation3D);
|
||||
Standard_Boolean isInit = Standard_False;
|
||||
if (myHasFlipping)
|
||||
{
|
||||
// Get width and height of text
|
||||
Font_FTFont aFont;
|
||||
Quantity_Color aColor;
|
||||
Standard_CString aName;
|
||||
Standard_Real anExpFactor;
|
||||
Standard_Real aSpace;
|
||||
|
||||
anAsp->Aspect()->Values (aColor, aName, anExpFactor, aSpace);
|
||||
unsigned int aResolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
|
||||
if (aFont.Init (aName, anAsp->Aspect()->GetTextFontAspect(), (unsigned int)anAsp->Height(), aResolution))
|
||||
{
|
||||
isInit = Standard_True;
|
||||
const NCollection_String aText ((Standard_Utf16Char* )myText.ToExtString());
|
||||
Font_Rect aBndBox = aFont.BoundingBox (aText, anAsp->HorizontalJustification(), anAsp->VerticalJustification());
|
||||
Standard_Real aWidth = Abs (aBndBox.Width());
|
||||
Standard_Real aHeight = Abs (aBndBox.Height());
|
||||
gp_Pnt aCenterOfLabel = aPosition;
|
||||
|
||||
if (anAsp->VerticalJustification() == Graphic3d_VTA_BOTTOM)
|
||||
{
|
||||
aCenterOfLabel.ChangeCoord() += myOrientation3D.YDirection().XYZ() * aHeight * 0.5;
|
||||
}
|
||||
else if (anAsp->VerticalJustification() == Graphic3d_VTA_TOP)
|
||||
{
|
||||
aCenterOfLabel.ChangeCoord() -= myOrientation3D.YDirection().XYZ() * aHeight * 0.5;
|
||||
}
|
||||
if (anAsp->HorizontalJustification() == Graphic3d_HTA_LEFT)
|
||||
{
|
||||
aCenterOfLabel.ChangeCoord() += myOrientation3D.XDirection().XYZ() * aWidth * 0.5;
|
||||
}
|
||||
else if (anAsp->HorizontalJustification() == Graphic3d_HTA_RIGHT)
|
||||
{
|
||||
aCenterOfLabel.ChangeCoord() -= myOrientation3D.XDirection().XYZ() * aWidth * 0.5;
|
||||
}
|
||||
|
||||
if (!anAsp->Aspect()->GetTextZoomable())
|
||||
{
|
||||
anAsp->Aspect()->SetTextZoomable (Standard_True);
|
||||
SetTransformPersistence (GetTransformPersistenceMode() | Graphic3d_TMF_ZoomPers, aPosition);
|
||||
aPosition = gp::Origin();
|
||||
}
|
||||
|
||||
gp_Ax2 aFlippingAxes (aCenterOfLabel, myOrientation3D.Direction(), myOrientation3D.XDirection());
|
||||
Prs3d_Root::CurrentGroup (thePrs)->SetFlippingOptions (Standard_True, aFlippingAxes);
|
||||
}
|
||||
}
|
||||
|
||||
gp_Ax2 anOrientation = myOrientation3D;
|
||||
anOrientation.SetLocation (aPosition);
|
||||
Prs3d_Text::Draw (thePrs, anAsp, myText, myOrientation3D, !myHasFlipping);
|
||||
if (myHasFlipping && isInit)
|
||||
{
|
||||
Prs3d_Root::CurrentGroup (thePrs)->SetFlippingOptions (Standard_False, gp_Ax2());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -80,6 +80,10 @@ public:
|
||||
//! Returns true if the current text placement mode uses text orientation in the model 3D space.
|
||||
Standard_EXPORT Standard_Boolean HasOrientation3D() const;
|
||||
|
||||
Standard_EXPORT void SetFlipping (const Standard_Boolean theIsFlipping);
|
||||
|
||||
Standard_EXPORT Standard_Boolean HasFlipping() const;
|
||||
|
||||
//! Define the display type of the text.
|
||||
//!
|
||||
//! TODT_NORMAL Default display. Text only.
|
||||
@@ -111,6 +115,7 @@ protected:
|
||||
Font_FontAspect myFontAspect;
|
||||
gp_Ax2 myOrientation3D;
|
||||
Standard_Boolean myHasOrientation3D;
|
||||
Standard_Boolean myHasFlipping;
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -440,28 +440,14 @@ void AIS_TexturedShape::Compute (const Handle(PrsMgr_PresentationManager3d)& /*t
|
||||
{
|
||||
case AIS_WireFrame:
|
||||
{
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
StdPrs_WFShape::Add (thePrs, myshape, myDrawer);
|
||||
break;
|
||||
}
|
||||
case AIS_Shaded:
|
||||
case 3: // texture mapping on triangulation
|
||||
{
|
||||
if (myDrawer->IsAutoTriangulation())
|
||||
{
|
||||
Standard_Real aPrevAngle;
|
||||
Standard_Real aNewAngle;
|
||||
Standard_Real aPrevCoeff;
|
||||
Standard_Real aNewCoeff;
|
||||
|
||||
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (aNewAngle, aPrevAngle);
|
||||
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient (aNewCoeff,aPrevCoeff);
|
||||
if (((Abs (aNewAngle - aPrevAngle) > Precision::Angular()) && isOwnDeviationAngle) ||
|
||||
((Abs (aNewCoeff - aPrevCoeff) > Precision::Confusion()) && isOwnDeviationCoefficient))
|
||||
{
|
||||
BRepTools::Clean (myshape);
|
||||
}
|
||||
}
|
||||
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
if (myshape.ShapeType() > TopAbs_FACE)
|
||||
{
|
||||
StdPrs_WFShape::Add (thePrs, myshape, myDrawer);
|
||||
|
@@ -99,6 +99,11 @@ AIS_LocalContext_1.cxx
|
||||
AIS_LocalStatus.cxx
|
||||
AIS_LocalStatus.hxx
|
||||
AIS_LocalStatus.lxx
|
||||
AIS_Manipulator.hxx
|
||||
AIS_Manipulator.cxx
|
||||
AIS_ManipulatorMode.hxx
|
||||
AIS_ManipulatorOwner.hxx
|
||||
AIS_ManipulatorOwner.cxx
|
||||
AIS_MapIteratorOfMapOfInteractive.hxx
|
||||
AIS_MapOfInteractive.hxx
|
||||
AIS_MaxRadiusDimension.cxx
|
||||
|
@@ -49,6 +49,10 @@ class Geom2d_BSplineCurve;
|
||||
//! the curve by algorithms, which use it.
|
||||
//! A derived concrete class is provided:
|
||||
//! Geom2dAdaptor_Curve for a curve from the Geom2d package.
|
||||
//!
|
||||
//! Polynomial coefficients of BSpline curves used for their evaluation are
|
||||
//! cached for better performance. Therefore these evaluations are not
|
||||
//! thread-safe and parallel evaluations need to be prevented.
|
||||
class Adaptor2d_Curve2d
|
||||
{
|
||||
public:
|
||||
|
@@ -51,6 +51,10 @@ class Geom_BSplineCurve;
|
||||
//! - GeomAdaptor_Curve for a curve from the Geom package
|
||||
//! - Adaptor3d_CurveOnSurface for a curve lying on
|
||||
//! a surface from the Geom package.
|
||||
//!
|
||||
//! Polynomial coefficients of BSpline curves used for their evaluation are
|
||||
//! cached for better performance. Therefore these evaluations are not
|
||||
//! thread-safe and parallel evaluations need to be prevented.
|
||||
class Adaptor3d_Curve
|
||||
{
|
||||
public:
|
||||
|
@@ -846,16 +846,19 @@ Standard_Integer Adaptor3d_CurveOnSurface::NbIntervals (const GeomAbs_Shape S) c
|
||||
Standard_Integer nu,nv,nc;
|
||||
nu=mySurface->NbUIntervals(S);
|
||||
nv=mySurface->NbVIntervals(S);
|
||||
nc=myCurve->NbIntervals(S);
|
||||
|
||||
// Allocate the memory for arrays TabU, TabV, TabC only once using the buffer TabBuf.
|
||||
TColStd_Array1OfReal TabBuf(1, nu + nv + nc + 3);
|
||||
TColStd_Array1OfReal TabU(TabBuf(1), 1, nu+1);
|
||||
TColStd_Array1OfReal TabV(TabBuf(nu + 2), 1, nv+1);
|
||||
TColStd_Array1OfReal TabC(TabBuf(nu + nv + 3), 1, nc+1);
|
||||
|
||||
TColStd_Array1OfReal TabU(1,nu+1);
|
||||
TColStd_Array1OfReal TabV(1,nv+1);
|
||||
Standard_Integer NbSample = 20;
|
||||
Standard_Real U,V,Tdeb,Tfin;
|
||||
Tdeb=myCurve->FirstParameter();
|
||||
Tfin=myCurve->LastParameter();
|
||||
|
||||
nc=myCurve->NbIntervals(S);
|
||||
TColStd_Array1OfReal TabC(1,nc+1);
|
||||
myCurve->Intervals(TabC,S);
|
||||
|
||||
Standard_Real Tol= Precision::PConfusion()/10;
|
||||
|
@@ -61,6 +61,10 @@ class Adaptor3d_HCurve;
|
||||
//! Warning: All the methods are virtual and implemented with a
|
||||
//! raise to allow to redefined only the methods realy
|
||||
//! used.
|
||||
//!
|
||||
//! Polynomial coefficients of BSpline surfaces used for their evaluation are
|
||||
//! cached for better performance. Therefore these evaluations are not
|
||||
//! thread-safe and parallel evaluations need to be prevented.
|
||||
class Adaptor3d_Surface
|
||||
{
|
||||
public:
|
||||
|
@@ -42,92 +42,26 @@
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
#ifdef OCCT_DEBUG
|
||||
#ifdef DRAW
|
||||
#include <DrawTrSurf.hxx>
|
||||
#endif
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <stdio.h>
|
||||
static Standard_Boolean Voir = Standard_False;
|
||||
static Standard_Boolean AffichFw = Standard_False;
|
||||
static Standard_Integer NbCurve = 0;
|
||||
#endif
|
||||
//
|
||||
// allows testing if Extrema produces correct results/
|
||||
|
||||
|
||||
static void ProjectPointOnCurve(const Standard_Real InitValue,
|
||||
const gp_Pnt APoint,
|
||||
const Standard_Real Tolerance,
|
||||
const Standard_Integer NumIteration,
|
||||
const Adaptor3d_Curve& Curve,
|
||||
Standard_Boolean& Status,
|
||||
Standard_Real& Result)
|
||||
{
|
||||
Standard_Integer num_iter = 0,
|
||||
not_done = 1,
|
||||
ii ;
|
||||
|
||||
gp_Pnt a_point ;
|
||||
gp_Vec vector,
|
||||
d1,
|
||||
d2 ;
|
||||
Standard_Real func,
|
||||
func_derivative,
|
||||
param = InitValue ;
|
||||
Status = Standard_False ;
|
||||
Standard_Real Toler = 1.0e-12;
|
||||
do {
|
||||
num_iter += 1 ;
|
||||
Curve.D2(param,
|
||||
a_point,
|
||||
d1,
|
||||
d2) ;
|
||||
for (ii = 1 ; ii <= 3 ; ii++) {
|
||||
vector.SetCoord(ii, APoint.Coord(ii) - a_point.Coord(ii)) ;
|
||||
}
|
||||
func = vector.Dot(d1) ;
|
||||
func_derivative = vector.Dot(d2) ;
|
||||
func_derivative -= d1.Dot(d1) ;
|
||||
if ( Abs(func) < Tolerance * d1.Magnitude()) {
|
||||
not_done = 0 ;
|
||||
Status = Standard_True ;
|
||||
}
|
||||
else
|
||||
{ // fixing a bug PRO18577 : avoid divizion by zero
|
||||
if( Abs(func_derivative) > Toler ) {
|
||||
param -= func / func_derivative ;
|
||||
}
|
||||
param = Max(param,Curve.FirstParameter()) ;
|
||||
param = Min(param,Curve.LastParameter()) ;
|
||||
//Status = Standard_True ;
|
||||
}
|
||||
}
|
||||
while (not_done && num_iter <= NumIteration) ;
|
||||
Result = param ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//class : Approx_SameParameter_Evaluator
|
||||
//purpose :
|
||||
//class : Approx_SameParameter_Evaluator
|
||||
//purpose : Used in same parameterization curve approximation.
|
||||
//=======================================================================
|
||||
|
||||
class Approx_SameParameter_Evaluator : public AdvApprox_EvaluatorFunction
|
||||
{
|
||||
public:
|
||||
Approx_SameParameter_Evaluator (const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColStd_Array1OfReal& thePoles,
|
||||
const Handle(Adaptor2d_HCurve2d)& theHCurve2d)
|
||||
: FlatKnots(theFlatKnots), Poles(thePoles), HCurve2d(theHCurve2d) {}
|
||||
Approx_SameParameter_Evaluator (const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColStd_Array1OfReal& thePoles,
|
||||
const Handle(Adaptor2d_HCurve2d)& theHCurve2d)
|
||||
: FlatKnots(theFlatKnots),
|
||||
Poles(thePoles),
|
||||
HCurve2d(theHCurve2d) {}
|
||||
|
||||
virtual void Evaluate (Standard_Integer *Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real *Parameter,
|
||||
Standard_Integer *DerivativeRequest,
|
||||
Standard_Real *Result, // [Dimension]
|
||||
Standard_Integer *ErrorCode);
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real *Parameter,
|
||||
Standard_Integer *DerivativeRequest,
|
||||
Standard_Real *Result, // [Dimension]
|
||||
Standard_Integer *ErrorCode);
|
||||
|
||||
private:
|
||||
const TColStd_Array1OfReal& FlatKnots;
|
||||
@@ -135,166 +69,183 @@ private:
|
||||
Handle(Adaptor2d_HCurve2d) HCurve2d;
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : Evaluate
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Approx_SameParameter_Evaluator::Evaluate (Standard_Integer *,/*Dimension*/
|
||||
Standard_Real /*StartEnd*/[2],
|
||||
Standard_Real *Parameter,
|
||||
Standard_Integer *DerivativeRequest,
|
||||
Standard_Real *Result,
|
||||
Standard_Integer *ReturnCode)
|
||||
{
|
||||
gp_Pnt2d Point ;
|
||||
gp_Vec2d Vector ;
|
||||
Standard_Integer extrap_mode[2] ;
|
||||
extrap_mode[0] = extrap_mode[1] = 3;
|
||||
Standard_Real eval_result[2] ;
|
||||
Standard_Real *PolesArray =
|
||||
(Standard_Real *) &Poles(Poles.Lower()) ;
|
||||
//
|
||||
// evaluate the 1D bspline that represents the change in parameterization
|
||||
//
|
||||
Standard_Real /*StartEnd*/[2],
|
||||
Standard_Real *Parameter,
|
||||
Standard_Integer *DerivativeRequest,
|
||||
Standard_Real *Result,
|
||||
Standard_Integer *ReturnCode)
|
||||
{
|
||||
const Standard_Integer aDegree = 3;
|
||||
Standard_Integer extrap_mode[2] = {aDegree, aDegree};
|
||||
Standard_Real eval_result[2];
|
||||
Standard_Real *PolesArray = (Standard_Real *) &Poles(Poles.Lower()) ;
|
||||
|
||||
// Evaluate the 1D B-Spline that represents the change in parameterization.
|
||||
BSplCLib::Eval(*Parameter,
|
||||
Standard_False,
|
||||
*DerivativeRequest,
|
||||
extrap_mode[0],
|
||||
3,
|
||||
FlatKnots,
|
||||
1,
|
||||
PolesArray[0],
|
||||
eval_result[0]) ;
|
||||
Standard_False,
|
||||
*DerivativeRequest,
|
||||
extrap_mode[0],
|
||||
aDegree,
|
||||
FlatKnots,
|
||||
1,
|
||||
PolesArray[0],
|
||||
eval_result[0]);
|
||||
|
||||
gp_Pnt2d aPoint;
|
||||
gp_Vec2d aVector;
|
||||
if (*DerivativeRequest == 0)
|
||||
{
|
||||
HCurve2d->D0(eval_result[0], aPoint);
|
||||
aPoint.Coord(Result[0],Result[1]);
|
||||
}
|
||||
else if (*DerivativeRequest == 1)
|
||||
{
|
||||
HCurve2d->D1(eval_result[0], aPoint, aVector);
|
||||
aVector.Multiply(eval_result[1]);
|
||||
aVector.Coord(Result[0],Result[1]);
|
||||
}
|
||||
|
||||
if (*DerivativeRequest == 0){
|
||||
HCurve2d->D0(eval_result[0],Point);
|
||||
Point.Coord(Result[0],Result[1]);
|
||||
}
|
||||
else if (*DerivativeRequest == 1){
|
||||
HCurve2d->D1(eval_result[0], Point, Vector);
|
||||
Vector.Multiply(eval_result[1]);
|
||||
Vector.Coord(Result[0],Result[1]);
|
||||
}
|
||||
ReturnCode[0] = 0 ;
|
||||
ReturnCode[0] = 0;
|
||||
}
|
||||
|
||||
static Standard_Real ComputeTolReached(const Handle(Adaptor3d_HCurve)& c3d,
|
||||
const Adaptor3d_CurveOnSurface& cons,
|
||||
const Standard_Integer nbp)
|
||||
//=======================================================================
|
||||
//function : ProjectPointOnCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void ProjectPointOnCurve(const Standard_Real InitValue,
|
||||
const gp_Pnt APoint,
|
||||
const Standard_Real Tolerance,
|
||||
const Standard_Integer NumIteration,
|
||||
const Adaptor3d_Curve& Curve,
|
||||
Standard_Boolean& Status,
|
||||
Standard_Real& Result)
|
||||
{
|
||||
Standard_Real d2 = 0.;
|
||||
Standard_Integer num_iter = 0, not_done = 1, ii;
|
||||
|
||||
gp_Pnt a_point;
|
||||
gp_Vec vector, d1, d2;
|
||||
Standard_Real func, func_derivative,
|
||||
param = InitValue;
|
||||
Status = Standard_False;
|
||||
do
|
||||
{
|
||||
num_iter++;
|
||||
Curve.D2(param, a_point, d1, d2);
|
||||
for (ii = 1 ; ii <= 3 ; ii++)
|
||||
vector.SetCoord(ii, APoint.Coord(ii) - a_point.Coord(ii));
|
||||
|
||||
func = vector.Dot(d1);
|
||||
if ( Abs(func) < Tolerance * d1.Magnitude())
|
||||
{
|
||||
not_done = 0;
|
||||
Status = Standard_True;
|
||||
}
|
||||
else
|
||||
{
|
||||
func_derivative = vector.Dot(d2) - d1.Dot(d1);
|
||||
|
||||
// Avoid division by zero.
|
||||
const Standard_Real Toler = 1.0e-12;
|
||||
if( Abs(func_derivative) > Toler )
|
||||
param -= func / func_derivative;
|
||||
|
||||
param = Max(param,Curve.FirstParameter());
|
||||
param = Min(param,Curve.LastParameter());
|
||||
}
|
||||
} while (not_done && num_iter <= NumIteration);
|
||||
|
||||
Result = param;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeTolReached
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Real ComputeTolReached(const Handle(Adaptor3d_HCurve)& c3d,
|
||||
const Adaptor3d_CurveOnSurface& cons,
|
||||
const Standard_Integer nbp)
|
||||
{
|
||||
Standard_Real d2 = 0.0; // Square max discrete deviation.
|
||||
const Standard_Real first = c3d->FirstParameter();
|
||||
const Standard_Real last = c3d->LastParameter();
|
||||
for(Standard_Integer i = 0; i <= nbp; i++){
|
||||
Standard_Real t = IntToReal(i)/IntToReal(nbp);
|
||||
Standard_Real u = first*(1.-t) + last*t;
|
||||
for(Standard_Integer i = 0; i <= nbp; i++)
|
||||
{
|
||||
Standard_Real t = IntToReal(i) / IntToReal(nbp);
|
||||
Standard_Real u = first * (1.0 - t) + last * t;
|
||||
gp_Pnt Pc3d = c3d->Value(u);
|
||||
gp_Pnt Pcons = cons.Value(u);
|
||||
if (Precision::IsInfinite(Pcons.X()) ||
|
||||
Precision::IsInfinite(Pcons.Y()) ||
|
||||
Precision::IsInfinite(Pcons.Z())) {
|
||||
Precision::IsInfinite(Pcons.Y()) ||
|
||||
Precision::IsInfinite(Pcons.Z()))
|
||||
{
|
||||
d2=Precision::Infinite();
|
||||
break;
|
||||
}
|
||||
Standard_Real temp = Pc3d.SquareDistance(Pcons);
|
||||
if(temp > d2) d2 = temp;
|
||||
d2 = Max(d2, Pc3d.SquareDistance(Pcons));
|
||||
}
|
||||
d2 = 1.5*sqrt(d2);
|
||||
if(d2<1.e-7) d2 = 1.e-7;
|
||||
return d2;
|
||||
|
||||
const Standard_Real aMult = 1.5; // To be tolerant to discrete tolerance computing.
|
||||
Standard_Real aDeviation = aMult * sqrt(d2);
|
||||
aDeviation = Max(aDeviation, Precision::Confusion()); // Tolerance in modeling space.
|
||||
return aDeviation;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Check
|
||||
//purpose : Check current interpolation for validity.
|
||||
//=======================================================================
|
||||
static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
|
||||
const TColStd_Array1OfReal& Poles,
|
||||
const Standard_Integer nbp,
|
||||
const TColStd_Array1OfReal& pc3d,
|
||||
// const TColStd_Array1OfReal& pcons,
|
||||
const TColStd_Array1OfReal& ,
|
||||
const Handle(Adaptor3d_HCurve)& c3d,
|
||||
const Adaptor3d_CurveOnSurface& cons,
|
||||
Standard_Real& tol,
|
||||
const Standard_Real oldtol)
|
||||
const TColStd_Array1OfReal& Poles,
|
||||
const Standard_Integer nbp,
|
||||
const TColStd_Array1OfReal& pc3d,
|
||||
const TColStd_Array1OfReal& ,
|
||||
const Handle(Adaptor3d_HCurve)& c3d,
|
||||
const Adaptor3d_CurveOnSurface& cons,
|
||||
Standard_Real& tol,
|
||||
const Standard_Real oldtol)
|
||||
{
|
||||
Standard_Real d = tol;
|
||||
Standard_Integer extrap_mode[2] ;
|
||||
extrap_mode[0] = extrap_mode[1] = 3;
|
||||
Standard_Integer i;
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Voir) {
|
||||
cout<<endl;
|
||||
cout<<"Control the change of variable : "<<endl;
|
||||
cout<<"yawn mesured by projection : "<<d<<endl;
|
||||
cout<<"Number of points : "<<nbp<<endl;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
Standard_Real glis = 0., dglis = 0.;
|
||||
for(i = 1; i <= nbp; i++){
|
||||
Standard_Real tc3d = pc3d(i);
|
||||
gp_Pnt Pc3d = c3d->Value(tc3d);
|
||||
Standard_Real tcons;
|
||||
BSplCLib::Eval(tc3d,Standard_False,0,extrap_mode[0],
|
||||
3,FlatKnots,1, (Standard_Real&)Poles(1),tcons);
|
||||
gp_Pnt Pcons = cons.Value(tcons);
|
||||
Standard_Real temp = Pc3d.SquareDistance(Pcons);
|
||||
if(temp >= dglis) dglis = temp;
|
||||
temp = Abs(tcons-pcons(i));
|
||||
if(temp >= glis) glis = temp;
|
||||
}
|
||||
dglis = sqrt(dglis);
|
||||
#ifdef OCCT_DEBUG
|
||||
if ( Voir) {
|
||||
cout<<"shift of parameter to the imposed points : "<<glis<<endl;
|
||||
cout<<"shift distance at the imposed points : "<<dglis<<endl;
|
||||
}
|
||||
#endif
|
||||
dglis = 0.;
|
||||
for(i = 1; i < nbp; i++){
|
||||
Standard_Real tc3d = 0.5*(pc3d(i)+pc3d(i+1));
|
||||
gp_Pnt Pc3d = c3d->Value(tc3d);
|
||||
Standard_Real tcons;
|
||||
BSplCLib::Eval(tc3d,Standard_False,0,extrap_mode[0],
|
||||
3,FlatKnots,1, (Standard_Real&)Poles(1),tcons);
|
||||
gp_Pnt Pcons = cons.Value(tcons);
|
||||
Standard_Real temp = Pc3d.SquareDistance(Pcons);
|
||||
if(temp >= dglis) dglis = temp;
|
||||
}
|
||||
dglis = sqrt(dglis);
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Voir)
|
||||
cout<<"distance de glissement en milieu d intervals : "<<dglis<<endl;
|
||||
#endif
|
||||
#endif
|
||||
const Standard_Integer aDegree = 3;
|
||||
Standard_Integer extrap_mode[2] = {aDegree, aDegree};
|
||||
|
||||
Standard_Real d2 = 0.;
|
||||
Standard_Integer nn = 2*nbp;
|
||||
Standard_Real unsurnn = 1./nn;
|
||||
// Modified by skv - Wed Jun 2 11:49:59 2004 OCC5898 Begin
|
||||
// Correction of the interval of valid values. This condition has no sensible
|
||||
// grounds. But it is better then the old one (which is commented out) because
|
||||
// it fixes the bug OCC5898. To develop more or less sensible criterion it is
|
||||
// necessary to deeply investigate this problem which is not possible in frames
|
||||
// of debugging.
|
||||
Standard_Real aParamFirst = 3.0 * pc3d(1) - 2.0 * pc3d(nbp);
|
||||
Standard_Real aParamLast = 3.0 * pc3d(nbp) - 2.0 * pc3d(1);
|
||||
|
||||
// Standard_Real firstborne= 2*pc3d(1)-pc3d(nbp);
|
||||
// Standard_Real lastborne= 2*pc3d(nbp)-pc3d(1);
|
||||
Standard_Real firstborne= 3.*pc3d(1) - 2.*pc3d(nbp);
|
||||
Standard_Real lastborne = 3.*pc3d(nbp) - 2.*pc3d(1);
|
||||
// Modified by skv - Wed Jun 2 11:50:03 2004 OCC5898 End
|
||||
//jgv
|
||||
Standard_Real FirstPar = cons.FirstParameter();
|
||||
Standard_Real LastPar = cons.LastParameter();
|
||||
if (firstborne < FirstPar)
|
||||
firstborne = FirstPar;
|
||||
if (lastborne > LastPar)
|
||||
lastborne = LastPar;
|
||||
/////
|
||||
for(i = 0; i <= nn; i++){
|
||||
if (aParamFirst < FirstPar)
|
||||
aParamFirst = FirstPar;
|
||||
if (aParamLast > LastPar)
|
||||
aParamLast = LastPar;
|
||||
|
||||
|
||||
Standard_Real d2 = 0.0; // Maximum square deviation on the samples.
|
||||
const Standard_Real d = tol;
|
||||
const Standard_Integer nn = 2 * nbp;
|
||||
const Standard_Real unsurnn = 1.0/nn;
|
||||
for(Standard_Integer i = 0; i <= nn; i++)
|
||||
{
|
||||
// Compute corresponding parameter on 2d curve.
|
||||
// It should be inside of 3d curve parameter space.
|
||||
Standard_Real t = unsurnn*i;
|
||||
Standard_Real tc3d = pc3d(1)*(1.-t) + pc3d(nbp)*t;
|
||||
gp_Pnt Pc3d = c3d->Value(tc3d);
|
||||
Standard_Real tcons;
|
||||
BSplCLib::Eval(tc3d,Standard_False,0,extrap_mode[0],
|
||||
3,FlatKnots,1, (Standard_Real&)Poles(1),tcons);
|
||||
if (tcons < firstborne || tcons > lastborne) {
|
||||
tol=Precision::Infinite();
|
||||
aDegree,FlatKnots,1, (Standard_Real&)Poles(1),tcons);
|
||||
if (tcons < aParamFirst ||
|
||||
tcons > aParamLast)
|
||||
{
|
||||
tol = Precision::Infinite();
|
||||
return Standard_False;
|
||||
}
|
||||
gp_Pnt Pcons = cons.Value(tcons);
|
||||
@@ -302,24 +253,30 @@ static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
|
||||
if(temp > d2) d2 = temp;
|
||||
}
|
||||
tol = sqrt(d2);
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Voir)
|
||||
cout<<"distance max on "<<nn<<" points : "<<tol<<endl<<endl;
|
||||
#endif
|
||||
return ((tol <= d) || (tol > 0.8 * oldtol));
|
||||
}
|
||||
|
||||
// Check poles parameters to be ordered.
|
||||
for(Standard_Integer i = Poles.Lower() + 1; i <= Poles.Upper(); ++i)
|
||||
{
|
||||
const Standard_Real aPreviousParam = Poles(i - 1);
|
||||
const Standard_Real aCurrentParam = Poles(i);
|
||||
|
||||
if (aPreviousParam > aCurrentParam)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return (tol <= d || tol > 0.8 * oldtol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Approx_SameParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Approx_SameParameter::Approx_SameParameter(const Handle(Geom_Curve)& C3D,
|
||||
const Handle(Geom2d_Curve)& C2D,
|
||||
const Handle(Geom_Surface)& S,
|
||||
const Standard_Real Tol):
|
||||
mySameParameter(Standard_True), myDone(Standard_False)
|
||||
const Handle(Geom2d_Curve)& C2D,
|
||||
const Handle(Geom_Surface)& S,
|
||||
const Standard_Real Tol)
|
||||
: mySameParameter(Standard_True),
|
||||
myDone(Standard_False)
|
||||
{
|
||||
myHCurve2d = new Geom2dAdaptor_HCurve(C2D);
|
||||
myC3d = new GeomAdaptor_HCurve(C3D);
|
||||
@@ -327,17 +284,16 @@ mySameParameter(Standard_True), myDone(Standard_False)
|
||||
Build(Tol);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Approx_SameParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Approx_SameParameter::Approx_SameParameter(const Handle(Adaptor3d_HCurve)& C3D,
|
||||
const Handle(Geom2d_Curve)& C2D,
|
||||
const Handle(Adaptor3d_HSurface)& S,
|
||||
const Standard_Real Tol):
|
||||
mySameParameter(Standard_True), myDone(Standard_False)
|
||||
const Handle(Geom2d_Curve)& C2D,
|
||||
const Handle(Adaptor3d_HSurface)& S,
|
||||
const Standard_Real Tol)
|
||||
: mySameParameter(Standard_True),
|
||||
myDone(Standard_False)
|
||||
{
|
||||
myC3d = C3D;
|
||||
mySurf = S;
|
||||
@@ -345,17 +301,16 @@ mySameParameter(Standard_True), myDone(Standard_False)
|
||||
Build(Tol);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Approx_SameParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Approx_SameParameter::Approx_SameParameter(const Handle(Adaptor3d_HCurve)& C3D,
|
||||
const Handle(Adaptor2d_HCurve2d)& C2D,
|
||||
const Handle(Adaptor3d_HSurface)& S,
|
||||
const Standard_Real Tol):
|
||||
mySameParameter(Standard_True), myDone(Standard_False)
|
||||
const Handle(Adaptor2d_HCurve2d)& C2D,
|
||||
const Handle(Adaptor3d_HSurface)& S,
|
||||
const Standard_Real Tol)
|
||||
: mySameParameter(Standard_True),
|
||||
myDone(Standard_False)
|
||||
{
|
||||
myC3d = C3D;
|
||||
mySurf = S;
|
||||
@@ -363,7 +318,6 @@ mySameParameter(Standard_True), myDone(Standard_False)
|
||||
Build(Tol);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Build
|
||||
//purpose :
|
||||
@@ -381,10 +335,6 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
Standard_Real fc3d = myC3d->FirstParameter();
|
||||
Standard_Real lc3d = myC3d->LastParameter();
|
||||
|
||||
GeomAbs_Shape Continuity = myHCurve2d->Continuity();
|
||||
|
||||
if(Continuity > GeomAbs_C1) Continuity = GeomAbs_C1;
|
||||
|
||||
//Control tangents at the extremities to know if the
|
||||
//reparametring is possible and calculate the tangents
|
||||
//at the extremities of the function of change of variable.
|
||||
@@ -392,46 +342,38 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
gp_Pnt Pcons,Pc3d;
|
||||
gp_Vec Vcons,Vc3d;
|
||||
|
||||
Standard_Real Tol = Tolerance;
|
||||
Standard_Real Tol2 = Tol * Tol;
|
||||
Standard_Real deltamin = Precision::PConfusion();//50*Tolp;
|
||||
const Standard_Real Tol = Tolerance;
|
||||
const Standard_Real Tol2 = Tol * Tol;
|
||||
Standard_Real deltamin = Precision::PConfusion();
|
||||
|
||||
Standard_Real besttol2 = Tol2;
|
||||
Standard_Boolean extrok = 0;
|
||||
|
||||
extrok = 1;
|
||||
// Check tangency on curve border.
|
||||
Standard_Boolean extrok = 1;
|
||||
CurveOnSurface.D1(fcons,Pcons,Vcons);
|
||||
myC3d->D1(fc3d,Pc3d,Vc3d);
|
||||
Standard_Real dist2 = Pcons.SquareDistance(Pc3d);
|
||||
Standard_Real dmax2 = dist2;
|
||||
|
||||
Standard_Real magVcons = Vcons.Magnitude();
|
||||
if (magVcons > 1.e-12){
|
||||
if (magVcons > 1.e-12)
|
||||
tangent[0] = Vc3d.Magnitude() / magVcons;
|
||||
}
|
||||
else extrok = 0;
|
||||
|
||||
CurveOnSurface.D1(lcons,Pcons,Vcons);
|
||||
myC3d->D1(lc3d,Pc3d,Vc3d);
|
||||
dist2 = Pcons.SquareDistance(Pc3d);
|
||||
|
||||
if(dist2 > dmax2) dmax2 = dist2;
|
||||
dmax2 = Max(dmax2, dist2);
|
||||
magVcons = Vcons.Magnitude();
|
||||
if (magVcons > 1.e-12){
|
||||
if (magVcons > 1.e-12)
|
||||
tangent[1] = Vc3d.Magnitude() / magVcons;
|
||||
}
|
||||
else extrok = 0;
|
||||
|
||||
|
||||
//if(dmax2 > besttol2) besttol2 = dmax2;
|
||||
|
||||
//Take a multiple of the sample pof CheckShape,
|
||||
//at least the control points will be correct. No comment!!!
|
||||
|
||||
#ifdef OCCT_DEBUG
|
||||
Standard_Integer nbcoups = 0;
|
||||
#endif
|
||||
|
||||
Standard_Boolean interpolok = 0;
|
||||
Standard_Real tolsov = 1.e200;
|
||||
//Take parameters with constant step on the curve on surface
|
||||
@@ -445,7 +387,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
Standard_Real wc3d = fc3d;
|
||||
|
||||
Standard_Real qpcons[aMaxArraySize], qnewpcons[aMaxArraySize],
|
||||
qpc3d[aMaxArraySize], qnewpc3d[aMaxArraySize];
|
||||
qpc3d[aMaxArraySize], qnewpc3d[aMaxArraySize];
|
||||
Standard_Real * pcons = qpcons; Standard_Real * newpcons = qnewpcons;
|
||||
Standard_Real * pc3d = qpc3d; Standard_Real * newpc3d = qnewpc3d;
|
||||
|
||||
@@ -458,8 +400,12 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
pcons[NCONTROL] = lcons;
|
||||
pc3d[NCONTROL] = lc3d;
|
||||
|
||||
// Change number of points in case of C0 continuity.
|
||||
Standard_Integer New_NCONTROL = NCONTROL;
|
||||
if(Continuity < GeomAbs_C1) {
|
||||
GeomAbs_Shape Continuity = myHCurve2d->Continuity();
|
||||
if(Continuity > GeomAbs_C1) Continuity = GeomAbs_C1;
|
||||
if(Continuity < GeomAbs_C1)
|
||||
{
|
||||
Standard_Integer NbInt = myHCurve2d->NbIntervals(GeomAbs_C1) + 1;
|
||||
TColStd_Array1OfReal Param_de_decoupeC1 (1, NbInt);
|
||||
myHCurve2d->Intervals(Param_de_decoupeC1, GeomAbs_C1);
|
||||
@@ -502,12 +448,12 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
pc3d[New_NCONTROL] = lc3d;
|
||||
}
|
||||
|
||||
|
||||
// Check existing same parameter state.
|
||||
Extrema_LocateExtPC Projector;
|
||||
Projector.Initialize(myC3d->Curve(),fc3d,lc3d,Tol);
|
||||
|
||||
Standard_Integer count = 1;
|
||||
Standard_Real previousp = fc3d, initp=0, curp;//, deltamin = 50*Tolp;
|
||||
Standard_Real previousp = fc3d, initp=0, curp;
|
||||
Standard_Real bornesup = lc3d - deltamin;
|
||||
Standard_Boolean projok = 0,
|
||||
use_parameter ;
|
||||
@@ -596,7 +542,6 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
{
|
||||
//Projector
|
||||
#ifdef OCCT_DEBUG
|
||||
// JAG
|
||||
cout << "Projection not done" << endl;
|
||||
#endif
|
||||
}
|
||||
@@ -608,7 +553,9 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
return;
|
||||
}
|
||||
|
||||
if(!extrok) { // If not already SameP and tangent to mill, abandon.
|
||||
if(!extrok)
|
||||
{
|
||||
// If not already SameP and tangent to mill, abandon.
|
||||
mySameParameter = Standard_False;
|
||||
#ifdef OCCT_DEBUG
|
||||
cout<<"SameParameter problem : zero tangent to extremities"<<endl;
|
||||
@@ -619,30 +566,11 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
pcons[count] = lcons;
|
||||
pc3d[count] = lc3d;
|
||||
|
||||
#ifdef OCCT_DEBUG
|
||||
if (AffichFw) {
|
||||
char Name[17];
|
||||
Name[0]='\0';
|
||||
TColgp_Array1OfPnt2d DEBP2d (0,count);
|
||||
TColStd_Array1OfInteger DEBMults(0,count);
|
||||
DEBMults.Init(1); DEBMults(0) = 2; DEBMults(count) = 2;
|
||||
TColStd_Array1OfReal DEBKnots(0,count);
|
||||
for (Standard_Integer DEBi = 0; DEBi <= count; DEBi++) {
|
||||
DEBKnots(DEBi) = DEBi;
|
||||
DEBP2d (DEBi) = gp_Pnt2d(pc3d[DEBi],pcons[DEBi]);
|
||||
}
|
||||
Handle(Geom2d_BSplineCurve) DEBBS =
|
||||
new Geom2d_BSplineCurve(DEBP2d,DEBKnots,DEBMults,1);
|
||||
Sprintf(Name,"DEBC2d_%d",++NbCurve);
|
||||
#ifdef DRAW
|
||||
DrawTrSurf::Set(Name,DEBBS);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// There is at least one point where same parameter is broken.
|
||||
// Try to build B-spline interpolation curve with degree 3.
|
||||
// The loop is organized over number of poles.
|
||||
Standard_Boolean hasCountChanged = Standard_False;
|
||||
|
||||
while(!interpolok)
|
||||
do
|
||||
{
|
||||
// The tables and their limits for the interpolation.
|
||||
Standard_Integer num_knots = count + 7;
|
||||
@@ -679,53 +607,6 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
Standard_ConstructionError::Raise();
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
#ifdef OCCT_DEBUG
|
||||
if (AffichFw) {
|
||||
nbcoups ++;
|
||||
char Name[17];
|
||||
Name[0] = '\0';
|
||||
Standard_Integer nnn = 100;
|
||||
TColgp_Array1OfPnt2d DEBP2d (0,nnn);
|
||||
TColStd_Array1OfInteger DEBMults(0,nnn);
|
||||
DEBMults.Init(1); DEBMults(0) = 2; DEBMults(nnn) = 2;
|
||||
TColStd_Array1OfReal DEBKnots(0,nnn);
|
||||
Standard_Real du = (lc3d - fc3d) / nnn;
|
||||
Standard_Real u3d = fc3d;
|
||||
Standard_Integer extrap_mode[2] ;
|
||||
extrap_mode[0] = extrap_mode[1] = 3;
|
||||
Standard_Real eval_result[2] ;
|
||||
Standard_Integer DerivativeRequest = 0;
|
||||
Standard_Real *PolesArray =
|
||||
(Standard_Real *) &Poles(Poles.Lower()) ;
|
||||
|
||||
for (Standard_Integer DEBi = 0; DEBi <= nnn; DEBi++) {
|
||||
DEBKnots(DEBi) = DEBi;
|
||||
BSplCLib::Eval(u3d,
|
||||
Standard_False,
|
||||
DerivativeRequest,
|
||||
extrap_mode[0],
|
||||
3,
|
||||
FlatKnots,
|
||||
1,
|
||||
PolesArray[0],
|
||||
eval_result[0]) ;
|
||||
|
||||
DEBP2d (DEBi) = gp_Pnt2d(u3d,eval_result[0]);
|
||||
u3d += du;
|
||||
}
|
||||
|
||||
Handle(Geom2d_BSplineCurve) DEBBS =
|
||||
new Geom2d_BSplineCurve(DEBP2d,DEBKnots,DEBMults,1);
|
||||
Sprintf(Name,"DEBC2d_%d_%d",NbCurve,nbcoups );
|
||||
#ifdef DRAW
|
||||
DrawTrSurf::Set(Name,DEBBS);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
//-------------------------------------------
|
||||
|
||||
//-------------------------------------------
|
||||
// Test if par2d(par3d) is monotonous function or not ----- IFV, Jan 2000
|
||||
// and try to insert new point to improve BSpline interpolation
|
||||
|
||||
@@ -772,7 +653,6 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
}
|
||||
else {
|
||||
#ifdef OCCT_DEBUG
|
||||
// JAG
|
||||
cout << "Projection not done" << endl;
|
||||
#endif
|
||||
}
|
||||
@@ -790,14 +670,19 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
pcons = newpcons;
|
||||
newpcons = temp;
|
||||
|
||||
if((count != newcount) && newcount < aMaxArraySize) { count = newcount; continue;}
|
||||
if((count != newcount) && newcount < aMaxArraySize)
|
||||
{
|
||||
hasCountChanged = Standard_True;
|
||||
count = newcount;
|
||||
continue;
|
||||
}
|
||||
|
||||
count = newcount;
|
||||
|
||||
Standard_Real algtol = sqrt(besttol2);
|
||||
|
||||
interpolok = Check (FlatKnots, Poles, count+1, Paramc3d, Paramcons,
|
||||
myC3d, CurveOnSurface, algtol, tolsov);
|
||||
myC3d, CurveOnSurface, algtol, tolsov);
|
||||
|
||||
if (Precision::IsInfinite(algtol)) {
|
||||
mySameParameter = Standard_False;
|
||||
@@ -809,17 +694,12 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
|
||||
tolsov = algtol;
|
||||
|
||||
interpolok = (interpolok || count >= aMaxArraySize);
|
||||
interpolok = (interpolok || // Good result.
|
||||
count >= aMaxArraySize - 1 ); // Number of points.
|
||||
|
||||
if(interpolok) {
|
||||
Standard_Real besttol = sqrt(besttol2);
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Voir) {
|
||||
if(algtol > besttol){
|
||||
cout<<"SameParameter : Tol can't be reached before approx"<<endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Handle(TColStd_HArray1OfReal) tol1d,tol2d,tol3d;
|
||||
tol1d = new TColStd_HArray1OfReal(1,2) ;
|
||||
tol1d->SetValue(1, mySurf->UResolution(besttol));
|
||||
@@ -840,7 +720,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
|
||||
if(myTolReached > anErrorMAX)
|
||||
{
|
||||
//This tolerance is too big. Probably, we will not can get
|
||||
//This tolerance is too big. Probably, we will not be able to get
|
||||
//edge with sameparameter in this case.
|
||||
|
||||
myDone = Standard_False;
|
||||
@@ -853,7 +733,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
//(else we can have circularity)
|
||||
{
|
||||
myCurve2d = aC2d;
|
||||
myHCurve2d = new Geom2dAdaptor_HCurve(myCurve2d);
|
||||
myHCurve2d = aHCurve2d;
|
||||
myDone = Standard_True;
|
||||
}
|
||||
else
|
||||
@@ -866,10 +746,6 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
|
||||
if(!interpolok)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Voir)
|
||||
cout<<"SameParameter : Not enough points, enrich"<<endl;
|
||||
#endif
|
||||
|
||||
newcount = 0;
|
||||
for(Standard_Integer n = 0; n < count; n++){
|
||||
@@ -902,7 +778,6 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
}
|
||||
else {
|
||||
#ifdef OCCT_DEBUG
|
||||
// JAG
|
||||
cout << "Projection not done" << endl;
|
||||
#endif
|
||||
}
|
||||
@@ -927,5 +802,82 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
hasCountChanged = Standard_False;
|
||||
}
|
||||
}
|
||||
} while(!interpolok && hasCountChanged);
|
||||
|
||||
if (!myDone)
|
||||
{
|
||||
// Loop is finished unsuccessfully. Fix tolerance by maximal deviation,
|
||||
// using data from the last loop iteration.
|
||||
Standard_Integer num_knots = count + 7;
|
||||
Standard_Integer num_poles = count + 3;
|
||||
TColStd_Array1OfReal Paramc3d(*pc3d,1,count + 1);
|
||||
TColStd_Array1OfReal Paramcons(*pcons,1,count + 1);
|
||||
TColStd_Array1OfInteger ContactOrder(1,num_poles) ;
|
||||
TColStd_Array1OfReal Poles(1,num_poles) ;
|
||||
TColStd_Array1OfReal InterpolationParameters(1,num_poles) ;
|
||||
TColStd_Array1OfReal FlatKnots(1,num_knots) ;
|
||||
|
||||
// Fill tables taking attention to end values.
|
||||
ContactOrder.Init(0);
|
||||
ContactOrder(2) = ContactOrder(num_poles - 1) = 1;
|
||||
|
||||
FlatKnots(1) = FlatKnots(2) = FlatKnots(3) = FlatKnots(4) = fc3d;
|
||||
FlatKnots(num_poles + 1) = FlatKnots(num_poles + 2) =
|
||||
FlatKnots(num_poles + 3) = FlatKnots(num_poles + 4) = lc3d;
|
||||
|
||||
Poles(1) = fcons; Poles(num_poles) = lcons;
|
||||
Poles(2) = tangent[0]; Poles(num_poles - 1) = tangent[1];
|
||||
|
||||
InterpolationParameters(1) = InterpolationParameters(2) = fc3d;
|
||||
InterpolationParameters(num_poles - 1) = InterpolationParameters(num_poles) = lc3d;
|
||||
|
||||
for (ii = 3; ii <= num_poles - 2; ii++)
|
||||
{
|
||||
Poles(ii) = Paramcons(ii - 1);
|
||||
InterpolationParameters(ii) = FlatKnots(ii+2) = Paramc3d(ii - 1);
|
||||
}
|
||||
Standard_Integer inversion_problem;
|
||||
BSplCLib::Interpolate(3,FlatKnots,InterpolationParameters,ContactOrder,
|
||||
1,Poles(1),inversion_problem);
|
||||
if(inversion_problem)
|
||||
{
|
||||
Standard_ConstructionError::Raise();
|
||||
}
|
||||
|
||||
Standard_Real besttol = sqrt(besttol2);
|
||||
Handle(TColStd_HArray1OfReal) tol1d,tol2d,tol3d;
|
||||
tol1d = new TColStd_HArray1OfReal(1,2) ;
|
||||
tol1d->SetValue(1, mySurf->UResolution(besttol));
|
||||
tol1d->SetValue(2, mySurf->VResolution(besttol));
|
||||
|
||||
Approx_SameParameter_Evaluator ev (FlatKnots, Poles, myHCurve2d);
|
||||
AdvApprox_ApproxAFunction anApproximator(2,0,0,tol1d,tol2d,tol3d,fc3d,lc3d,
|
||||
Continuity,11,40,ev);
|
||||
|
||||
if (!anApproximator.IsDone() &&
|
||||
!anApproximator.HasResult() )
|
||||
{
|
||||
myDone = Standard_False;
|
||||
return;
|
||||
}
|
||||
|
||||
GeomLib_MakeCurvefromApprox aCurveBuilder(anApproximator) ;
|
||||
Handle(Geom2d_BSplineCurve) aC2d = aCurveBuilder.Curve2dFromTwo1d(1,2) ;
|
||||
Handle(Adaptor2d_HCurve2d) aHCurve2d = new Geom2dAdaptor_HCurve(aC2d);
|
||||
CurveOnSurface.Load(aHCurve2d);
|
||||
|
||||
myTolReached = ComputeTolReached(myC3d,CurveOnSurface,NCONTROL);
|
||||
|
||||
if(myTolReached > anErrorMAX)
|
||||
{
|
||||
//This tolerance is too big. Probably, we will not be able to get
|
||||
//edge with sameparameter in this case.
|
||||
myDone = Standard_False;
|
||||
return;
|
||||
}
|
||||
|
||||
myCurve2d = aC2d;
|
||||
myHCurve2d = aHCurve2d;
|
||||
myDone = Standard_True;
|
||||
}
|
||||
}
|
||||
|
@@ -81,7 +81,7 @@ protected:
|
||||
|
||||
|
||||
|
||||
private:
|
||||
protected:
|
||||
|
||||
|
||||
Quantity_Color MyColor;
|
||||
|
@@ -63,17 +63,9 @@
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <algorithm>
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
static
|
||||
Standard_Real AngleWithRef(const gp_Dir& theD1,
|
||||
@@ -115,6 +107,25 @@ static
|
||||
const BOPTools_ListOfCoupleOfShape& theLCS,
|
||||
const gp_Pnt& aP);
|
||||
|
||||
//=======================================================================
|
||||
// function: BOPTools_AlgoTools_ComparePoints
|
||||
// purpose: implementation of IsLess() function for two points
|
||||
//=======================================================================
|
||||
struct BOPTools_AlgoTools_ComparePoints {
|
||||
bool operator()(const gp_Pnt& theP1, const gp_Pnt& theP2)
|
||||
{
|
||||
for (Standard_Integer i = 1; i <= 3; ++i) {
|
||||
if (theP1.Coord(i) < theP2.Coord(i)) {
|
||||
return Standard_True;
|
||||
}
|
||||
else if (theP1.Coord(i) > theP2.Coord(i)) {
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
// function: MakeConnexityBlocks
|
||||
// purpose:
|
||||
@@ -1525,8 +1536,8 @@ void BOPTools_AlgoTools::MakeVertex(const BOPCol_ListOfShape& aLV,
|
||||
aEps=RealEpsilon();
|
||||
for (m=0; m<aNb; ++m) {
|
||||
aV[m]=(!m)?
|
||||
*((TopoDS_Vertex*)(&aLV.First())):
|
||||
*((TopoDS_Vertex*)(&aLV.Last()));
|
||||
*((TopoDS_Vertex*)(&aLV.First())):
|
||||
*((TopoDS_Vertex*)(&aLV.Last()));
|
||||
aP[m]=BRep_Tool::Pnt(aV[m]);
|
||||
aR[m]=BRep_Tool::Tolerance(aV[m]);
|
||||
}
|
||||
@@ -1559,28 +1570,38 @@ void BOPTools_AlgoTools::MakeVertex(const BOPCol_ListOfShape& aLV,
|
||||
return;
|
||||
}// else if (aNb==2) {
|
||||
//
|
||||
else { // if (aNb>2)
|
||||
Standard_Real aTi, aDi, aDmax;
|
||||
gp_Pnt aPi, aP;
|
||||
gp_XYZ aXYZ(0.,0.,0.), aXYZi;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
else { // if (aNb>2)
|
||||
// compute the point
|
||||
//
|
||||
aIt.Initialize(aLV);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Vertex& aVi=*((TopoDS_Vertex*)(&aIt.Value()));
|
||||
aPi=BRep_Tool::Pnt(aVi);
|
||||
aXYZi=aPi.XYZ();
|
||||
aXYZ=aXYZ+aXYZi;
|
||||
// issue 0027540 - sum of doubles may depend on the order
|
||||
// of addition, thus sort the coordinates for stable result
|
||||
Standard_Integer i;
|
||||
NCollection_Array1<gp_Pnt> aPoints(0, aNb-1);
|
||||
BOPCol_ListIteratorOfListOfShape aIt(aLV);
|
||||
for (i = 0; aIt.More(); aIt.Next(), ++i) {
|
||||
const TopoDS_Vertex& aVi = *((TopoDS_Vertex*)(&aIt.Value()));
|
||||
gp_Pnt aPi = BRep_Tool::Pnt(aVi);
|
||||
aPoints(i) = aPi;
|
||||
}
|
||||
//
|
||||
std::sort(aPoints.begin(), aPoints.end(), BOPTools_AlgoTools_ComparePoints());
|
||||
//
|
||||
gp_XYZ aXYZ(0., 0., 0.);
|
||||
for (i = 0; i < aNb; ++i) {
|
||||
aXYZ += aPoints(i).XYZ();
|
||||
}
|
||||
aXYZ.Divide((Standard_Real)aNb);
|
||||
aP.SetXYZ(aXYZ);
|
||||
//
|
||||
gp_Pnt aP(aXYZ);
|
||||
//
|
||||
// compute the tolerance for the new vertex
|
||||
Standard_Real aTi, aDi, aDmax;
|
||||
//
|
||||
aDmax=-1.;
|
||||
aIt.Initialize(aLV);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Vertex& aVi=*((TopoDS_Vertex*)(&aIt.Value()));
|
||||
aPi=BRep_Tool::Pnt(aVi);
|
||||
gp_Pnt aPi=BRep_Tool::Pnt(aVi);
|
||||
aTi=BRep_Tool::Tolerance(aVi);
|
||||
aDi=aP.SquareDistance(aPi);
|
||||
aDi=sqrt(aDi);
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_MapOfOrientedShape.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepAlgo_AsDes,MMgt_TShared)
|
||||
|
||||
@@ -149,12 +150,18 @@ static void ReplaceInList(const TopoDS_Shape& OldS,
|
||||
const TopoDS_Shape& NewS,
|
||||
TopTools_ListOfShape& L)
|
||||
{
|
||||
TopTools_MapOfOrientedShape aMS;
|
||||
TopTools_ListIteratorOfListOfShape it(L);
|
||||
|
||||
for (; it.More(); it.Next()) {
|
||||
aMS.Add(it.Value());
|
||||
}
|
||||
it.Initialize(L);
|
||||
while(it.More()) {
|
||||
if (it.Value().IsSame(OldS)) {
|
||||
TopAbs_Orientation O = it.Value().Orientation();
|
||||
L.InsertBefore(NewS.Oriented(O),it);
|
||||
if (aMS.Add(NewS.Oriented(O))) {
|
||||
L.InsertBefore(NewS.Oriented(O),it);
|
||||
}
|
||||
L.Remove(it);
|
||||
}
|
||||
else it.Next();
|
||||
@@ -235,34 +242,52 @@ void BRepAlgo_AsDes::BackReplace(const TopoDS_Shape& OldS,
|
||||
//function : Replace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAlgo_AsDes::Replace(const TopoDS_Shape& OldS,
|
||||
const TopoDS_Shape& NewS)
|
||||
const TopoDS_Shape& NewS)
|
||||
{
|
||||
Standard_Boolean InUp;
|
||||
|
||||
if (up.IsBound(OldS)) {
|
||||
InUp = Standard_False;
|
||||
BackReplace (OldS,NewS,up(OldS),InUp);
|
||||
if (up.IsBound(NewS)) {
|
||||
up(NewS).Append(up(OldS));
|
||||
for (Standard_Integer i = 0; i < 2; ++i) {
|
||||
TopTools_DataMapOfShapeListOfShape& aMap = !i ? up : down;
|
||||
TopTools_ListOfShape* pLSOld = aMap.ChangeSeek(OldS);
|
||||
if (!pLSOld) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
Standard_Boolean InUp = !i ? Standard_False : Standard_True;
|
||||
BackReplace(OldS, NewS, *pLSOld, InUp);
|
||||
//
|
||||
TopTools_ListOfShape* pLSNew = aMap.ChangeSeek(NewS);
|
||||
if (!pLSNew) {
|
||||
// filter the list
|
||||
TopTools_MapOfOrientedShape aMS;
|
||||
TopTools_ListIteratorOfListOfShape aIt(*pLSOld);
|
||||
for (; aIt.More(); ) {
|
||||
if (!aMS.Add(aIt.Value())) {
|
||||
pLSOld->Remove(aIt);
|
||||
}
|
||||
else {
|
||||
aIt.Next();
|
||||
}
|
||||
}
|
||||
aMap.Bind(NewS, *pLSOld);
|
||||
}
|
||||
else {
|
||||
up.Bind(NewS,up(OldS));
|
||||
// avoid duplicates
|
||||
TopTools_MapOfOrientedShape aMS;
|
||||
TopTools_ListIteratorOfListOfShape aIt(*pLSNew);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
aMS.Add(aIt.Value());
|
||||
}
|
||||
//
|
||||
aIt.Initialize(*pLSOld);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS = aIt.Value();
|
||||
if (aMS.Add(aS)) {
|
||||
pLSNew->Append(aS);
|
||||
}
|
||||
}
|
||||
}
|
||||
up.UnBind(OldS);
|
||||
}
|
||||
|
||||
if (down.IsBound(OldS)) {
|
||||
InUp = Standard_True;
|
||||
BackReplace(OldS,NewS,down (OldS),InUp);
|
||||
if (down.IsBound(NewS)) {
|
||||
down(NewS).Append(down(OldS));
|
||||
}
|
||||
else {
|
||||
down.Bind(NewS,down(OldS));
|
||||
}
|
||||
down.UnBind(OldS);
|
||||
//
|
||||
aMap.UnBind(OldS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -43,7 +43,7 @@ class BRepExtrema_DistShapeShape
|
||||
//! create tool and load both shapes into it <br>
|
||||
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
|
||||
|
||||
Standard_EXPORT void SetDeflection(const Standard_Real theDeflection)
|
||||
void SetDeflection(const Standard_Real theDeflection)
|
||||
{
|
||||
myEps = theDeflection;
|
||||
}
|
||||
@@ -58,12 +58,12 @@ class BRepExtrema_DistShapeShape
|
||||
//! Returns IsDone status. <br>
|
||||
Standard_EXPORT Standard_Boolean Perform();
|
||||
//! True if the minimum distance is found. <br>
|
||||
Standard_EXPORT Standard_Boolean IsDone() const
|
||||
Standard_Boolean IsDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
}
|
||||
//! Returns the number of solutions satisfying the minimum distance. <br>
|
||||
Standard_EXPORT Standard_Integer NbSolution() const
|
||||
Standard_Integer NbSolution() const
|
||||
{
|
||||
return mySolutionsShape1.Length();
|
||||
}
|
||||
@@ -71,17 +71,17 @@ class BRepExtrema_DistShapeShape
|
||||
Standard_EXPORT Standard_Real Value() const;
|
||||
//! True if one of the shapes is a solid and the other shape <br>
|
||||
//! is completely or partially inside the solid. <br>
|
||||
Standard_EXPORT Standard_Boolean InnerSolution() const
|
||||
Standard_Boolean InnerSolution() const
|
||||
{
|
||||
return myInnerSol;
|
||||
}
|
||||
//! Returns the Point corresponding to the <N>th solution on the first Shape <br>
|
||||
Standard_EXPORT const gp_Pnt & PointOnShape1(const Standard_Integer N) const
|
||||
const gp_Pnt & PointOnShape1(const Standard_Integer N) const
|
||||
{
|
||||
return mySolutionsShape1.Value(N).Point();
|
||||
}
|
||||
//! Returns the Point corresponding to the <N>th solution on the second Shape <br>
|
||||
Standard_EXPORT const gp_Pnt & PointOnShape2(const Standard_Integer N) const
|
||||
const gp_Pnt & PointOnShape2(const Standard_Integer N) const
|
||||
{
|
||||
return mySolutionsShape2.Value(N).Point();
|
||||
}
|
||||
@@ -90,7 +90,7 @@ class BRepExtrema_DistShapeShape
|
||||
//! IsOnEdge => the Nth soluion on the first shape is on a Edge <br>
|
||||
//! IsInFace => the Nth solution on the first shape is inside a face <br>
|
||||
//! the corresponding support is obtained by the method SupportOnShape1 <br>
|
||||
Standard_EXPORT BRepExtrema_SupportType SupportTypeShape1(const Standard_Integer N) const
|
||||
BRepExtrema_SupportType SupportTypeShape1(const Standard_Integer N) const
|
||||
{
|
||||
return mySolutionsShape1.Value(N).SupportKind();
|
||||
}
|
||||
@@ -99,7 +99,7 @@ class BRepExtrema_DistShapeShape
|
||||
//! IsOnEdge => the Nth soluion on the secondt shape is on a Edge <br>
|
||||
//! IsInFace => the Nth solution on the second shape is inside a face <br>
|
||||
//! the corresponding support is obtained by the method SupportOnShape2 <br>
|
||||
Standard_EXPORT BRepExtrema_SupportType SupportTypeShape2(const Standard_Integer N) const
|
||||
BRepExtrema_SupportType SupportTypeShape2(const Standard_Integer N) const
|
||||
{
|
||||
return mySolutionsShape2.Value(N).SupportKind();
|
||||
}
|
||||
@@ -124,12 +124,12 @@ class BRepExtrema_DistShapeShape
|
||||
//! Prints on the stream o information on the current state of the object. <br>
|
||||
Standard_EXPORT void Dump(Standard_OStream& o) const;
|
||||
|
||||
Standard_EXPORT void SetFlag(const Extrema_ExtFlag F)
|
||||
void SetFlag(const Extrema_ExtFlag F)
|
||||
{
|
||||
myFlag = F;
|
||||
}
|
||||
|
||||
Standard_EXPORT void SetAlgo(const Extrema_ExtAlgo A)
|
||||
void SetAlgo(const Extrema_ExtAlgo A)
|
||||
{
|
||||
myAlgo = A;
|
||||
}
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#include <BRepBuilderAPI.hxx>
|
||||
#include <BRepFeat.hxx>
|
||||
#include <BRepLib_MakeFace.hxx>
|
||||
#include <BRepLProp.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepTopAdaptor_FClass2d.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
@@ -25,6 +25,8 @@
|
||||
#include <BRepBuilderAPI_MakeShape.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
|
||||
class LocOpe_WiresOnShape;
|
||||
class StdFail_NotDone;
|
||||
class Standard_ConstructionError;
|
||||
@@ -60,7 +62,12 @@ public:
|
||||
BRepFeat_SplitShape();
|
||||
|
||||
//! Creates the process with the shape <S>.
|
||||
BRepFeat_SplitShape(const TopoDS_Shape& S);
|
||||
BRepFeat_SplitShape(const TopoDS_Shape& S);
|
||||
|
||||
//! Add splitting edges or wires for whole initial shape
|
||||
//! withot additional specification edge->face, edge->edge
|
||||
//! This method puts edge on the corresponding faces from initial shape
|
||||
Standard_EXPORT Standard_Boolean Add(const TopTools_SequenceOfShape& theEdges);
|
||||
|
||||
//! Initializes the process on the shape <S>.
|
||||
void Init (const TopoDS_Shape& S);
|
||||
|
@@ -38,6 +38,14 @@ inline BRepFeat_SplitShape::BRepFeat_SplitShape (const TopoDS_Shape& S) :
|
||||
myWOnShape = new LocOpe_WiresOnShape(S);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Boolean BRepFeat_SplitShape::Add(const TopTools_SequenceOfShape& theEdges)
|
||||
{
|
||||
return myWOnShape->Add(theEdges);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
|
@@ -88,6 +88,7 @@
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TShort_HArray1OfShortReal.hxx>
|
||||
#include <TColgp_Array1OfXY.hxx>
|
||||
|
||||
// TODO - not thread-safe static variables
|
||||
static Standard_Real thePrecision = Precision::Confusion();
|
||||
@@ -1246,7 +1247,7 @@ void BRepLib::SameParameter(const TopoDS_Edge& AnEdge,
|
||||
}
|
||||
else if (SameP.IsDone()) {
|
||||
Standard_Real tolreached = SameP.TolReached();
|
||||
if(tolreached < error) {
|
||||
if(tolreached <= error) {
|
||||
curPC = SameP.Curve2d();
|
||||
updatepc = Standard_True;
|
||||
maxdist = Max(maxdist,tolreached);
|
||||
@@ -1279,7 +1280,7 @@ void BRepLib::SameParameter(const TopoDS_Edge& AnEdge,
|
||||
|
||||
// Modified by skv - Thu Jun 3 12:39:19 2004 OCC5898 Begin
|
||||
if (!IsSameP) {
|
||||
if (anEdgeTol > error) {
|
||||
if (anEdgeTol >= error) {
|
||||
maxdist = Max(maxdist, anEdgeTol);
|
||||
IsSameP = Standard_True;
|
||||
}
|
||||
@@ -1580,17 +1581,15 @@ Standard_Boolean BRepLib::OrientClosedSolid(TopoDS_Solid& solid)
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : tgtfaces
|
||||
//purpose : check the angle at the border between two squares.
|
||||
// Two shares should have a shared front edge.
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Boolean tgtfaces(const TopoDS_Edge& Ed,
|
||||
static GeomAbs_Shape tgtfaces(const TopoDS_Edge& Ed,
|
||||
const TopoDS_Face& F1,
|
||||
const TopoDS_Face& F2,
|
||||
const Standard_Real ta,
|
||||
const Standard_Real theAngleTol,
|
||||
const Standard_Boolean couture)
|
||||
{
|
||||
// Check if pcurves exist on both faces of edge
|
||||
@@ -1598,20 +1597,31 @@ static Standard_Boolean tgtfaces(const TopoDS_Edge& Ed,
|
||||
Handle(Geom2d_Curve) aCurve;
|
||||
aCurve = BRep_Tool::CurveOnSurface(Ed,F1,aFirst,aLast);
|
||||
if(aCurve.IsNull())
|
||||
return Standard_False;
|
||||
return GeomAbs_C0;
|
||||
aCurve = BRep_Tool::CurveOnSurface(Ed,F2,aFirst,aLast);
|
||||
if(aCurve.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
return GeomAbs_C0;
|
||||
|
||||
Standard_Real u;
|
||||
TopoDS_Edge E = Ed;
|
||||
BRepAdaptor_Surface aBAS1(F1,Standard_False);
|
||||
BRepAdaptor_Surface aBAS2(F2,Standard_False);
|
||||
Handle(BRepAdaptor_HSurface) HS1 = new BRepAdaptor_HSurface(aBAS1);
|
||||
|
||||
// seam edge on elementary surface is always CN
|
||||
Standard_Boolean isElementary =
|
||||
(aBAS1.Surface().Surface()->IsKind(STANDARD_TYPE(Geom_ElementarySurface)) &&
|
||||
aBAS1.Surface().Surface()->IsKind(STANDARD_TYPE(Geom_ElementarySurface)));
|
||||
if (couture && isElementary)
|
||||
{
|
||||
return GeomAbs_CN;
|
||||
}
|
||||
|
||||
Handle(BRepAdaptor_HSurface) HS1 = new BRepAdaptor_HSurface (aBAS1);
|
||||
Handle(BRepAdaptor_HSurface) HS2;
|
||||
if(couture) HS2 = HS1;
|
||||
else HS2 = new BRepAdaptor_HSurface(aBAS2);
|
||||
|
||||
//case when edge lies on the one face
|
||||
|
||||
E.Orientation(TopAbs_FORWARD);
|
||||
Handle(BRepAdaptor_HCurve2d) HC2d1 = new BRepAdaptor_HCurve2d();
|
||||
HC2d1->ChangeCurve2d().Initialize(E,F1);
|
||||
@@ -1623,8 +1633,7 @@ static Standard_Boolean tgtfaces(const TopoDS_Edge& Ed,
|
||||
|
||||
Standard_Boolean rev1 = (F1.Orientation() == TopAbs_REVERSED);
|
||||
Standard_Boolean rev2 = (F2.Orientation() == TopAbs_REVERSED);
|
||||
Standard_Real f,l,eps, angmax = -M_PI;
|
||||
Standard_Real ang =0.;
|
||||
Standard_Real f,l,eps;
|
||||
BRep_Tool::Range(E,f,l);
|
||||
Extrema_LocateExtPC ext;
|
||||
Standard_Boolean IsInitialized = Standard_False;
|
||||
@@ -1634,34 +1643,55 @@ static Standard_Boolean tgtfaces(const TopoDS_Edge& Ed,
|
||||
l -= eps; // points of pointed squares.
|
||||
gp_Pnt2d p;
|
||||
gp_Pnt pp1,pp2;//,PP;
|
||||
gp_Vec du,dv;
|
||||
gp_Vec du1, dv1, d2u1, d2v1, d2uv1;
|
||||
gp_Vec du2, dv2, d2u2, d2v2, d2uv2;
|
||||
gp_Vec d1,d2;
|
||||
Standard_Real uu, vv, norm;
|
||||
|
||||
Standard_Integer i;
|
||||
Standard_Boolean Nok;
|
||||
for(i = 0; (i<= 20) && (angmax<=ta) ; i++){
|
||||
GeomAbs_Shape aCont = (isElementary ? GeomAbs_CN : GeomAbs_C2);
|
||||
for(i = 0; i<= 20 && aCont > GeomAbs_C0; i++)
|
||||
{
|
||||
// First suppose that this is sameParameter
|
||||
Nok = Standard_True;
|
||||
u = f + (l-f)*i/20;
|
||||
|
||||
// take derivatives of surfaces at the same u, and compute normals
|
||||
HC2d1->D0(u,p);
|
||||
HS1->D1(p.X(),p.Y(),pp1,du,dv);
|
||||
d1 = (du.Crossed(dv));
|
||||
HS1->D2 (p.X(), p.Y(), pp1, du1, dv1, d2u1, d2v1, d2uv1);
|
||||
d1 = (du1.Crossed(dv1));
|
||||
norm = d1.Magnitude();
|
||||
if (norm > 1.e-12) d1 /= norm;
|
||||
else Nok=Standard_False;
|
||||
else continue; // skip degenerated point
|
||||
if(rev1) d1.Reverse();
|
||||
|
||||
HC2d2->D0(u,p);
|
||||
HS2->D1(p.X(), p.Y(), pp2, du, dv);
|
||||
d2 = (du.Crossed(dv));
|
||||
HS2->D2 (p.X(), p.Y(), pp2, du2, dv2, d2u2, d2v2, d2uv2);
|
||||
d2 = (du2.Crossed(dv2));
|
||||
norm = d2.Magnitude();
|
||||
if (norm> 1.e-12) d2 /= norm;
|
||||
else Nok=Standard_False;
|
||||
if (norm > 1.e-12) d2 /= norm;
|
||||
else continue; // skip degenerated point
|
||||
if(rev2) d2.Reverse();
|
||||
if (Nok) ang = d1.Angle(d2);
|
||||
|
||||
if (Nok &&(ang > ta)) { // Refine by projection
|
||||
// check
|
||||
Standard_Real ang = d1.Angle(d2);
|
||||
|
||||
// check special case of precise equality of derivatives,
|
||||
// occurring when edge connects two faces built on equally
|
||||
// defined surfaces (e.g. seam-like edges on periodic surfaces,
|
||||
// or planar faces on the same plane)
|
||||
if (aCont >= GeomAbs_C2 && ang < Precision::Angular() &&
|
||||
d2u1 .IsEqual (d2u2, Precision::PConfusion(), Precision::Angular()) &&
|
||||
d2v1 .IsEqual (d2v2, Precision::PConfusion(), Precision::Angular()) &&
|
||||
d2uv1.IsEqual (d2uv2, Precision::PConfusion(), Precision::Angular()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
aCont = GeomAbs_G1;
|
||||
|
||||
// Refine by projection
|
||||
if (ang > theAngleTol)
|
||||
{
|
||||
if (! IsInitialized ) {
|
||||
ext.Initialize(C2,f,l,Precision::PConfusion());
|
||||
IsInitialized = Standard_True;
|
||||
@@ -1673,20 +1703,20 @@ static Standard_Boolean tgtfaces(const TopoDS_Edge& Ed,
|
||||
|
||||
HC2d2->D0(v,p);
|
||||
p.Coord(uu,vv);
|
||||
HS2->D1(p.X(), p.Y(), pp2, du, dv);
|
||||
d2 = (du.Crossed(dv));
|
||||
HS2->D1(p.X(), p.Y(), pp2, du2, dv2);
|
||||
d2 = (du2.Crossed(dv2));
|
||||
norm = d2.Magnitude();
|
||||
if (norm> 1.e-12) d2 /= norm;
|
||||
else Nok = Standard_False;
|
||||
else continue; // degenerated point
|
||||
if(rev2) d2.Reverse();
|
||||
if (Nok) ang = d1.Angle(d2);
|
||||
ang = d1.Angle(d2);
|
||||
}
|
||||
if (ang > theAngleTol)
|
||||
return GeomAbs_C0;
|
||||
}
|
||||
if(ang >= angmax) angmax = ang;
|
||||
}
|
||||
|
||||
return (angmax<=ta);
|
||||
|
||||
return aCont;
|
||||
}
|
||||
|
||||
|
||||
@@ -1735,9 +1765,8 @@ void BRepLib::EncodeRegularity(const TopoDS_Shape& S,
|
||||
if(BRep_Tool::Continuity(E,F1,F2)<=GeomAbs_C0){
|
||||
|
||||
try {
|
||||
if(tgtfaces(E, F1, F2, TolAng, couture)){
|
||||
B.Continuity(E,F1,F2,GeomAbs_G1);
|
||||
}
|
||||
GeomAbs_Shape aCont = tgtfaces(E, F1, F2, TolAng, couture);
|
||||
B.Continuity(E,F1,F2,aCont);
|
||||
}
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
@@ -1760,9 +1789,9 @@ void BRepLib::EncodeRegularity(TopoDS_Edge& E,
|
||||
BRep_Builder B;
|
||||
if(BRep_Tool::Continuity(E,F1,F2)<=GeomAbs_C0){
|
||||
try {
|
||||
if( tgtfaces(E, F1, F2, TolAng, F1.IsEqual(F2))) {
|
||||
B.Continuity(E,F1,F2,GeomAbs_G1);
|
||||
}
|
||||
GeomAbs_Shape aCont = tgtfaces(E, F1, F2, TolAng, F1.IsEqual(F2));
|
||||
B.Continuity(E,F1,F2,aCont);
|
||||
|
||||
}
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
@@ -1870,6 +1899,10 @@ Standard_Boolean BRepLib::
|
||||
TShort_Array1OfShortReal& aNormArr1 = aPT1->ChangeNormals();
|
||||
TShort_Array1OfShortReal& aNormArr2 = aPT2->ChangeNormals();
|
||||
|
||||
if (aPTEF1->Nodes().Lower() != aPTEF2->Nodes().Lower() ||
|
||||
aPTEF1->Nodes().Upper() != aPTEF2->Nodes().Upper())
|
||||
continue;
|
||||
|
||||
for(Standard_Integer anEdgNode = aPTEF1->Nodes().Lower();
|
||||
anEdgNode <= aPTEF1->Nodes().Upper(); anEdgNode++)
|
||||
{
|
||||
@@ -1977,18 +2010,17 @@ void BRepLib::ReverseSortFaces (const TopoDS_Shape& Sh,
|
||||
TopTools_ListOfShape& LF)
|
||||
{
|
||||
LF.Clear();
|
||||
TopTools_ListOfShape LTri,LPlan,LCyl,LCon,LSphere,LTor,LOther;
|
||||
// Use the allocator of the result LF for intermediate results
|
||||
TopTools_ListOfShape LTri(LF.Allocator()), LPlan(LF.Allocator()),
|
||||
LCyl(LF.Allocator()), LCon(LF.Allocator()), LSphere(LF.Allocator()),
|
||||
LTor(LF.Allocator()), LOther(LF.Allocator());
|
||||
TopExp_Explorer exp(Sh,TopAbs_FACE);
|
||||
TopLoc_Location l;
|
||||
Handle(Geom_Surface) S;
|
||||
|
||||
for (; exp.More(); exp.Next()) {
|
||||
const TopoDS_Face& F = TopoDS::Face(exp.Current());
|
||||
S = BRep_Tool::Surface(F, l);
|
||||
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F, l);
|
||||
if (!S.IsNull()) {
|
||||
if (S->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
|
||||
S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface();
|
||||
}
|
||||
GeomAdaptor_Surface AS(S);
|
||||
switch (AS.GetType()) {
|
||||
case GeomAbs_Plane:
|
||||
|
@@ -56,8 +56,16 @@ class BRepMesh_VertexTool;
|
||||
|
||||
namespace BRepMesh
|
||||
{
|
||||
//! Default size for memory block allocated by IncAllocator.
|
||||
//! Default size for memory block allocated by IncAllocator.
|
||||
/**
|
||||
* The idea here is that blocks of the given size are returned to the system
|
||||
* rather than retained in the malloc heap, at least on WIN32 and WIN64 platforms.
|
||||
*/
|
||||
#ifdef _WIN64
|
||||
const size_t MEMORY_BLOCK_SIZE_HUGE = 1024 * 1024;
|
||||
#else
|
||||
const size_t MEMORY_BLOCK_SIZE_HUGE = 512 * 1024;
|
||||
#endif
|
||||
|
||||
//! Structure keeping parameters of segment.
|
||||
struct Segment
|
||||
@@ -92,6 +100,7 @@ namespace BRepMesh
|
||||
typedef NCollection_List<Standard_Integer> ListOfInteger;
|
||||
|
||||
//! Maps
|
||||
typedef NCollection_Map<Standard_Real> MapOfReal;
|
||||
typedef NCollection_Map<Standard_Integer> MapOfInteger;
|
||||
typedef NCollection_DataMap<Handle(Poly_Triangulation), Standard_Boolean> DMapOfTriangulationBool;
|
||||
typedef NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> MapOfShape;
|
||||
|
@@ -33,7 +33,7 @@ public:
|
||||
//! @param theTolerance tolerance to be used for identification of shot circles.
|
||||
//! @param theReservedSize size to be reserved for vector of circles.
|
||||
//! @param theAllocator memory allocator to be used by internal collections.
|
||||
Standard_EXPORT BRepMesh_CircleInspector(
|
||||
BRepMesh_CircleInspector(
|
||||
const Standard_Real theTolerance,
|
||||
const Standard_Integer theReservedSize,
|
||||
const Handle(NCollection_IncAllocator)& theAllocator)
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
const Standard_Integer theTargetIndex);
|
||||
|
||||
//! Checks indices for equlity.
|
||||
Standard_EXPORT static Standard_Boolean IsEqual(
|
||||
static Standard_Boolean IsEqual(
|
||||
const Standard_Integer theIndex,
|
||||
const Standard_Integer theTargetIndex)
|
||||
{
|
||||
|
@@ -35,7 +35,8 @@ BRepMesh_DataStructureOfDelaun::BRepMesh_DataStructureOfDelaun(
|
||||
const Handle(NCollection_IncAllocator)& theAllocator,
|
||||
const Standard_Integer theReservedNodeSize)
|
||||
: myAllocator (theAllocator),
|
||||
myNodes (new BRepMesh_VertexTool(theReservedNodeSize, myAllocator)),
|
||||
myNodes (new BRepMesh_VertexTool(myAllocator)),
|
||||
myNodeLinks (theReservedNodeSize * 3, myAllocator),
|
||||
myLinks (theReservedNodeSize * 3, myAllocator),
|
||||
myDelLinks (myAllocator),
|
||||
myElements (theReservedNodeSize * 2, myAllocator),
|
||||
|
@@ -63,7 +63,7 @@ public: //! @name API for accessing mesh nodes.
|
||||
//! Finds the index of the given node.
|
||||
//! @param theNode node to find.
|
||||
//! @return index of the given element of zero if node is not in the mesh.
|
||||
Standard_EXPORT Standard_Integer IndexOf(const BRepMesh_Vertex& theNode)
|
||||
Standard_Integer IndexOf(const BRepMesh_Vertex& theNode)
|
||||
{
|
||||
return myNodes->FindIndex(theNode);
|
||||
}
|
||||
@@ -95,8 +95,8 @@ public: //! @name API for accessing mesh nodes.
|
||||
//! @param theIndex index of node to be removed.
|
||||
//! @param isForce if TRUE node will be removed even if movability
|
||||
//! is not Free.
|
||||
Standard_EXPORT void RemoveNode(const Standard_Integer theIndex,
|
||||
const Standard_Boolean isForce = Standard_False)
|
||||
void RemoveNode(const Standard_Integer theIndex,
|
||||
const Standard_Boolean isForce = Standard_False)
|
||||
{
|
||||
if (isForce || myNodes->FindKey(theIndex).Movability() == BRepMesh_Free)
|
||||
{
|
||||
@@ -131,7 +131,7 @@ public: //! @name API for accessing mesh links.
|
||||
//! Finds the index of the given link.
|
||||
//! @param theLink link to find.
|
||||
//! @return index of the given element of zero if link is not in the mesh.
|
||||
Standard_EXPORT Standard_Integer IndexOf(const BRepMesh_Edge& theLink) const
|
||||
Standard_Integer IndexOf(const BRepMesh_Edge& theLink) const
|
||||
{
|
||||
return myLinks.FindIndex(theLink);
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public: //! @name API for accessing mesh links.
|
||||
//! Get link by the index.
|
||||
//! @param theIndex index of a link.
|
||||
//! @return link with the given index.
|
||||
Standard_EXPORT const BRepMesh_Edge& GetLink(const Standard_Integer theIndex)
|
||||
const BRepMesh_Edge& GetLink(const Standard_Integer theIndex)
|
||||
{
|
||||
return myLinks.FindKey(theIndex);
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public: //! @name API for accessing mesh links.
|
||||
//! Returns indices of elements conected to the link with the given index.
|
||||
//! @param theLinkIndex index of link whose data should be retrieved.
|
||||
//! @return indices of elements conected to the link.
|
||||
Standard_EXPORT const BRepMesh_PairOfIndex& ElementsConnectedTo(
|
||||
const BRepMesh_PairOfIndex& ElementsConnectedTo(
|
||||
const Standard_Integer theLinkIndex) const
|
||||
{
|
||||
return myLinks.FindFromIndex(theLinkIndex);
|
||||
@@ -192,7 +192,7 @@ public: //! @name API for accessing mesh elements.
|
||||
//! Finds the index of the given element.
|
||||
//! @param theElement element to find.
|
||||
//! @return index of the given element of zero if element is not in the mesh.
|
||||
Standard_EXPORT Standard_Integer IndexOf(const BRepMesh_Triangle& theElement) const
|
||||
Standard_Integer IndexOf(const BRepMesh_Triangle& theElement) const
|
||||
{
|
||||
return myElements.FindIndex(theElement);
|
||||
}
|
||||
@@ -200,7 +200,7 @@ public: //! @name API for accessing mesh elements.
|
||||
//! Get element by the index.
|
||||
//! @param theIndex index of an element.
|
||||
//! @return element with the given index.
|
||||
Standard_EXPORT const BRepMesh_Triangle& GetElement(const Standard_Integer theIndex)
|
||||
const BRepMesh_Triangle& GetElement(const Standard_Integer theIndex)
|
||||
{
|
||||
return myElements.FindKey(theIndex);
|
||||
}
|
||||
@@ -254,7 +254,7 @@ public: //! @name Auxilary API
|
||||
|
||||
//! Substitutes deleted items by the last one from corresponding map
|
||||
//! to have only non-deleted elements, links or nodes in the structure.
|
||||
Standard_EXPORT void ClearDeleted()
|
||||
void ClearDeleted()
|
||||
{
|
||||
clearDeletedLinks();
|
||||
clearDeletedNodes();
|
||||
|
@@ -429,8 +429,6 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
Handle(NCollection_IncAllocator) aAllocator =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
|
||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
|
||||
Standard_Real aTolU, aTolV;
|
||||
myMeshData->Data()->GetTolerance(aTolU, aTolV);
|
||||
const Standard_Real aSqTol = aTolU * aTolU + aTolV * aTolV;
|
||||
@@ -442,8 +440,8 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
Standard_Integer anUpper = theVertexIndexes.Upper();
|
||||
for( ; anIndex <= anUpper; ++anIndex )
|
||||
{
|
||||
aLoopEdges.Clear();
|
||||
aAllocator->Reset(Standard_False);
|
||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
|
||||
Standard_Integer aVertexIdx = theVertexIndexes( anIndex );
|
||||
const BRepMesh_Vertex& aVertex = GetVertex( aVertexIdx );
|
||||
@@ -598,6 +596,7 @@ void BRepMesh_Delaun::cleanupMesh()
|
||||
|
||||
for(;;)
|
||||
{
|
||||
aAllocator->Reset(Standard_False);
|
||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
BRepMesh::MapOfInteger aDelTriangles(10, aAllocator);
|
||||
|
||||
@@ -679,7 +678,6 @@ void BRepMesh_Delaun::cleanupMesh()
|
||||
myMeshData->RemoveLink( aLoopEdgesIt.Key() );
|
||||
}
|
||||
|
||||
aAllocator->Reset(Standard_False);
|
||||
if ( aDeletedTrianglesNb == 0 )
|
||||
break;
|
||||
}
|
||||
@@ -2173,7 +2171,8 @@ Standard_Boolean BRepMesh_Delaun::UseEdge( const Standard_Integer /*theIndex*/ )
|
||||
BRepMesh::HMapOfInteger BRepMesh_Delaun::getEdgesByType(
|
||||
const BRepMesh_DegreeOfFreedom theEdgeType ) const
|
||||
{
|
||||
BRepMesh::HMapOfInteger aResult = new BRepMesh::MapOfInteger;
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
BRepMesh::HMapOfInteger aResult = new BRepMesh::MapOfInteger(1, anAlloc);
|
||||
BRepMesh::MapOfInteger::Iterator anEdgeIt( myMeshData->LinksOfDomain() );
|
||||
|
||||
for ( ; anEdgeIt.More(); anEdgeIt.Next() )
|
||||
|
@@ -26,14 +26,14 @@ class BRepMesh_Edge : public BRepMesh_OrientedEdge
|
||||
public:
|
||||
|
||||
//! Default constructor.
|
||||
Standard_EXPORT BRepMesh_Edge()
|
||||
BRepMesh_Edge()
|
||||
: BRepMesh_OrientedEdge(),
|
||||
myMovability(BRepMesh_Deleted)
|
||||
{
|
||||
}
|
||||
|
||||
//! Constructs a link between two vertices.
|
||||
Standard_EXPORT BRepMesh_Edge(
|
||||
BRepMesh_Edge(
|
||||
const Standard_Integer theFirstNode,
|
||||
const Standard_Integer theLastNode,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FaceAttribute,Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
@@ -141,14 +140,12 @@ void BRepMesh_FaceAttribute::init()
|
||||
// between vertices
|
||||
|
||||
myMinStep = RealLast();
|
||||
for (TopExp_Explorer anExp(myFace, TopAbs_WIRE); anExp.More(); anExp.Next())
|
||||
for (TopoDS_Iterator aFaceIt(myFace); aFaceIt.More(); aFaceIt.Next())
|
||||
{
|
||||
TopoDS_Wire aWire = TopoDS::Wire(anExp.Current());
|
||||
|
||||
for (TopoDS_Iterator aWireExp(aWire); aWireExp.More(); aWireExp.Next())
|
||||
for (TopoDS_Iterator aWireIt(aFaceIt.Value()); aWireIt.More(); aWireIt.Next())
|
||||
{
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(aWireExp.Value());
|
||||
if (BRep_Tool::IsClosed(anEdge))
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(aWireIt.Value());
|
||||
if (anEdge.IsNull() || BRep_Tool::IsClosed(anEdge))
|
||||
continue;
|
||||
|
||||
// Get end points on 2d curve
|
||||
|
@@ -47,6 +47,7 @@
|
||||
#include <Extrema_LocateExtPC.hxx>
|
||||
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfCharacter.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColGeom2d_SequenceOfCurve.hxx>
|
||||
@@ -82,6 +83,7 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FastDiscret,Standard_Transient)
|
||||
BRepMesh_FastDiscret::BRepMesh_FastDiscret( const Bnd_Box& theBox,
|
||||
const BRepMesh_FastDiscret::Parameters& theParams)
|
||||
:
|
||||
myMapdefle(1000, new NCollection_IncAllocator()),
|
||||
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
|
||||
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
|
||||
myParameters(theParams),
|
||||
@@ -195,7 +197,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
||||
|
||||
resetDataStructure();
|
||||
|
||||
Standard_Real defedge;
|
||||
Standard_Real defedge = myParameters.Deflection;
|
||||
Standard_Integer nbEdge = 0;
|
||||
Standard_Real savangle = myParameters.Angle;
|
||||
Standard_Real cdef;
|
||||
@@ -205,18 +207,14 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
||||
if (!myParameters.Relative)
|
||||
defface = Max(myParameters.Deflection, maxdef);
|
||||
|
||||
NCollection_Sequence<EdgePCurve> aPCurves;
|
||||
NCollection_Sequence<TopoDS_Edge> aFaceEdges;
|
||||
|
||||
const TopoDS_Face& aFace = myAttribute->Face();
|
||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||
TopExp_Explorer aWireIt(aFace, TopAbs_WIRE);
|
||||
for (; aWireIt.More(); aWireIt.Next())
|
||||
for (TopoDS_Iterator aWireIt(aFace); aWireIt.More(); aWireIt.Next())
|
||||
{
|
||||
TopExp_Explorer aEdgeIt(aWireIt.Current(), TopAbs_EDGE);
|
||||
for (; aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
|
||||
for (TopoDS_Iterator aEdgeIt(aWireIt.Value()); aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
|
||||
{
|
||||
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
|
||||
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Value());
|
||||
if (aEdge.IsNull())
|
||||
continue;
|
||||
if (!myMapdefle.IsBound(aEdge))
|
||||
{
|
||||
if (myParameters.Relative)
|
||||
@@ -265,8 +263,6 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
||||
continue;
|
||||
|
||||
EdgePCurve aPCurve = { aCurve2d, aFirstParam, aLastParam };
|
||||
aPCurves.Append(aPCurve);
|
||||
aFaceEdges.Append(aEdge);
|
||||
|
||||
add(aEdge, aPCurve, defedge);
|
||||
myParameters.Angle = savangle;
|
||||
@@ -293,6 +289,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(aFace, aLoc);
|
||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||
|
||||
if ( aTriangulation.IsNull() )
|
||||
{
|
||||
@@ -401,16 +398,29 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
||||
++nbmaill;
|
||||
|
||||
resetDataStructure();
|
||||
for (Standard_Integer j = 1; j <= aFaceEdges.Length(); ++j)
|
||||
|
||||
for (TopoDS_Iterator aWireIt(aFace); aWireIt.More(); aWireIt.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = aFaceEdges(j);
|
||||
if (myEdges.IsBound(anEdge))
|
||||
myEdges.UnBind(anEdge);
|
||||
for (TopoDS_Iterator aEdgeIt(aWireIt.Value()); aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(aEdgeIt.Value());
|
||||
if (anEdge.IsNull())
|
||||
continue;
|
||||
if (myEdges.IsBound(anEdge))
|
||||
myEdges.UnBind(anEdge);
|
||||
|
||||
defedge = Max(myMapdefle(anEdge) / 3.0, eps);
|
||||
myMapdefle.Bind(anEdge, defedge);
|
||||
defedge = Max(myMapdefle(anEdge) / 3.0, eps);
|
||||
myMapdefle.Bind(anEdge, defedge);
|
||||
|
||||
add(anEdge, aPCurves(j), defedge);
|
||||
Standard_Real aFirstParam, aLastParam;
|
||||
Handle(Geom2d_Curve) aCurve2d =
|
||||
BRep_Tool::CurveOnSurface(anEdge, aFace, aFirstParam, aLastParam);
|
||||
if (aCurve2d.IsNull())
|
||||
continue;
|
||||
|
||||
EdgePCurve aPCurve = { aCurve2d, aFirstParam, aLastParam };
|
||||
add(anEdge, aPCurve, defedge);
|
||||
}
|
||||
}
|
||||
|
||||
aDFaceChecker.ReCompute(aClassifier);
|
||||
@@ -806,18 +816,13 @@ void BRepMesh_FastDiscret::update(
|
||||
Handle(Poly_PolygonOnTriangulation) P1, P2;
|
||||
if (BRepMesh_ShapeTool::IsDegenerated(theEdge, aFace))
|
||||
{
|
||||
const Standard_Integer aNodesNb = 2;
|
||||
TColStd_Array1OfInteger aNewNodes (1, aNodesNb);
|
||||
TColStd_Array1OfInteger aNewNodInStruct(1, aNodesNb);
|
||||
TColStd_Array1OfReal aNewParams (1, aNodesNb);
|
||||
|
||||
aNewNodInStruct(1) = ipf;
|
||||
aNewNodes (1) = isvf;
|
||||
aNewParams (1) = aEAttr.FirstParam;
|
||||
|
||||
aNewNodInStruct(aNodesNb) = ipl;
|
||||
aNewNodes (aNodesNb) = isvl;
|
||||
aNewParams (aNodesNb) = aEAttr.LastParam;
|
||||
// two nodes
|
||||
Standard_Integer aNewNodesArr[] = {isvf, isvl};
|
||||
Standard_Integer aNewNodInStructArr[] = {ipf, ipl};
|
||||
Standard_Real aNewParamsArr[] = {aEAttr.FirstParam, aEAttr.LastParam};
|
||||
TColStd_Array1OfInteger aNewNodes (aNewNodesArr[0], 1, 2);
|
||||
TColStd_Array1OfInteger aNewNodInStruct(aNewNodInStructArr[0], 1, 2);
|
||||
TColStd_Array1OfReal aNewParams (aNewParamsArr[0], 1, 2);
|
||||
|
||||
P1 = new Poly_PolygonOnTriangulation(aNewNodes, aNewParams);
|
||||
P2 = new Poly_PolygonOnTriangulation(aNewNodInStruct, aNewParams);
|
||||
@@ -825,9 +830,15 @@ void BRepMesh_FastDiscret::update(
|
||||
else
|
||||
{
|
||||
const Standard_Integer aNodesNb = aEdgeTool->NbPoints();
|
||||
TColStd_Array1OfInteger aNewNodesVec (1, aNodesNb);
|
||||
TColStd_Array1OfInteger aNewNodesInStructVec(1, aNodesNb);
|
||||
TColStd_Array1OfReal aNewParamsVec (1, aNodesNb);
|
||||
// Allocate the memory for arrays aNewNodesVec, aNewNodesInStructVec, aNewParamsVec
|
||||
// only once using the buffer aBuf.
|
||||
TColStd_Array1OfCharacter aBuf(1, aNodesNb * (2*sizeof(Standard_Integer) + sizeof(Standard_Real)));
|
||||
TColStd_Array1OfInteger aNewNodesVec(*reinterpret_cast<const Standard_Integer*>
|
||||
(&aBuf(1)), 1, aNodesNb);
|
||||
TColStd_Array1OfInteger aNewNodesInStructVec(*reinterpret_cast<const Standard_Integer*>
|
||||
(&aBuf(1 + aNodesNb*sizeof(Standard_Integer))), 1, aNodesNb);
|
||||
TColStd_Array1OfReal aNewParamsVec(*reinterpret_cast<const Standard_Real*>
|
||||
(&aBuf(1 + aNodesNb*2*sizeof(Standard_Integer))), 1, aNodesNb);
|
||||
|
||||
Standard_Integer aNodesCount = 1;
|
||||
aNewNodesInStructVec(aNodesCount) = ipf;
|
||||
|
@@ -92,6 +92,29 @@ static Standard_Real FUN_CalcAverageDUV(TColStd_Array1OfReal& P, const Standard_
|
||||
|
||||
namespace
|
||||
{
|
||||
Standard_Real deflectionOfSegment (
|
||||
const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theLastPoint,
|
||||
const gp_Pnt& theMidPoint)
|
||||
{
|
||||
// 23.03.2010 skl for OCC21645 - change precision for comparison
|
||||
if (theFirstPoint.SquareDistance (theLastPoint) > Precision::SquareConfusion ())
|
||||
{
|
||||
gp_Lin aLin (theFirstPoint, gp_Dir (gp_Vec (theFirstPoint, theLastPoint)));
|
||||
return aLin.Distance (theMidPoint);
|
||||
}
|
||||
|
||||
return theFirstPoint.Distance (theMidPoint);
|
||||
}
|
||||
|
||||
Standard_Boolean IsCompexSurface (const GeomAbs_SurfaceType theType)
|
||||
{
|
||||
return (
|
||||
theType != GeomAbs_Sphere &&
|
||||
theType != GeomAbs_Cylinder &&
|
||||
theType != GeomAbs_Cone &&
|
||||
theType != GeomAbs_Torus);
|
||||
}
|
||||
|
||||
//! Auxiliary class used to extract geometrical parameters of fixed TopoDS_Vertex.
|
||||
class FixedVExplorer
|
||||
@@ -184,18 +207,18 @@ void BRepMesh_FastDiscretFace::initDataStructure()
|
||||
myStructure->Data()->SetTolerance( aTolU / deltaX, aTolV / deltaY);
|
||||
|
||||
myAttribute->ChangeStructure() = myStructure;
|
||||
myAttribute->ChangeSurfacePoints() = new BRepMesh::DMapOfIntegerPnt;
|
||||
myAttribute->ChangeSurfaceVertices()= new BRepMesh::DMapOfVertexInteger;
|
||||
myAttribute->ChangeSurfacePoints() = new BRepMesh::DMapOfIntegerPnt(1, aAllocator);
|
||||
myAttribute->ChangeSurfaceVertices()= new BRepMesh::DMapOfVertexInteger(1, aAllocator);
|
||||
|
||||
// Check the necessity to fill the map of parameters
|
||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||
GeomAbs_SurfaceType thetype = gFace->GetType();
|
||||
const Standard_Boolean isBSpline = (thetype == GeomAbs_BezierSurface ||
|
||||
thetype == GeomAbs_BSplineSurface);
|
||||
const Standard_Boolean useUVParam = (thetype == GeomAbs_Torus ||isBSpline);
|
||||
const Standard_Boolean useUVParam = (thetype == GeomAbs_Torus || IsCompexSurface (thetype));
|
||||
|
||||
myUParam.Clear();
|
||||
myVParam.Clear();
|
||||
myUParam.Clear(aAllocator);
|
||||
myVParam.Clear(aAllocator);
|
||||
|
||||
// essai de determination de la longueur vraie:
|
||||
// akm (bug OCC16) : We must calculate these measures in non-singular
|
||||
@@ -370,7 +393,8 @@ void BRepMesh_FastDiscretFace::add(const Handle(BRepMesh_FaceAttribute)& theAttr
|
||||
Standard_Real aDef = -1;
|
||||
if ( !isaline && myStructure->ElementsOfDomain().Extent() > 0 )
|
||||
{
|
||||
BRepMesh::ListOfVertex aNewVertices;
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
BRepMesh::ListOfVertex aNewVertices(anAlloc);
|
||||
if (!rajout)
|
||||
{
|
||||
aDef = control(aNewVertices, trigu, Standard_True);
|
||||
@@ -440,8 +464,6 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
|
||||
BRepMesh::SequenceOfReal& theResult)
|
||||
{
|
||||
// Sort sequence of parameters
|
||||
BRepMesh::SequenceOfReal aParamTmp;
|
||||
Standard_Integer aParamLength = 1;
|
||||
const Standard_Integer anInitLen = theParams.Extent();
|
||||
|
||||
TColStd_Array1OfReal aParamArray(1, anInitLen);
|
||||
@@ -452,37 +474,26 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
|
||||
std::sort (aParamArray.begin(), aParamArray.end());
|
||||
|
||||
// mandatory pre-filtering using the first (minimal) filter value
|
||||
Standard_Real aP1, aP2;
|
||||
aP1 = aParamArray(1);
|
||||
aParamTmp.Append(aP1);
|
||||
Standard_Integer aParamLength = 1;
|
||||
for (j = 2; j <= anInitLen; j++)
|
||||
{
|
||||
aP2 = aParamArray(j);
|
||||
if ((aP2-aP1) > theMinDist)
|
||||
if ((aParamArray(j)-aParamArray(aParamLength)) > theMinDist)
|
||||
{
|
||||
aParamTmp.Append(aP2);
|
||||
aP1 = aP2;
|
||||
aParamLength++;
|
||||
if (++aParamLength < j)
|
||||
aParamArray(aParamLength) = aParamArray(j);
|
||||
}
|
||||
}
|
||||
|
||||
//add last point if required
|
||||
if(aParamArray(anInitLen)-theParams(aParamLength) > theMinDist)
|
||||
{
|
||||
aParamTmp.Append(aParamArray(anInitLen));
|
||||
aParamLength++;
|
||||
}
|
||||
|
||||
//perform filtering on series
|
||||
Standard_Real aLastAdded, aLastCandidate;
|
||||
Standard_Boolean isCandidateDefined = Standard_False;
|
||||
aLastAdded = aParamTmp.First();
|
||||
aLastAdded = aParamArray(1);
|
||||
aLastCandidate = aLastAdded;
|
||||
theResult.Append(aParamTmp.First());
|
||||
theResult.Append(aLastAdded);
|
||||
|
||||
for(j=2;j<aParamTmp.Length();j++)
|
||||
for(j=2; j < aParamLength; j++)
|
||||
{
|
||||
Standard_Real aVal = aParamTmp.Value(j);
|
||||
Standard_Real aVal = aParamArray(j);
|
||||
if(aVal-aLastAdded > theFilterDist)
|
||||
{
|
||||
//adds the parameter
|
||||
@@ -502,29 +513,7 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
|
||||
aLastCandidate = aVal;
|
||||
isCandidateDefined = Standard_True;
|
||||
}
|
||||
theResult.Append(aParamTmp.Last());
|
||||
|
||||
if( theResult.Length() == 2 )
|
||||
{
|
||||
Standard_Real dist = theResult.Last() - theResult.First();
|
||||
Standard_Integer nbint = (Standard_Integer)((dist / theFilterDist) + 0.5);
|
||||
|
||||
if( nbint > 1 )
|
||||
{
|
||||
//Five points more is maximum
|
||||
if( nbint > 5 )
|
||||
{
|
||||
nbint = 5;
|
||||
}
|
||||
|
||||
Standard_Integer i;
|
||||
Standard_Real dU = dist / nbint;
|
||||
for( i = 1; i < nbint; i++ )
|
||||
{
|
||||
theResult.InsertAfter(i, theResult.First()+i*dU);
|
||||
}
|
||||
}
|
||||
}
|
||||
theResult.Append(aParamArray(aParamLength));
|
||||
}
|
||||
|
||||
void BRepMesh_FastDiscretFace::insertInternalVertices(
|
||||
@@ -550,11 +539,6 @@ void BRepMesh_FastDiscretFace::insertInternalVertices(
|
||||
insertInternalVerticesTorus(theNewVertices);
|
||||
break;
|
||||
|
||||
case GeomAbs_BezierSurface:
|
||||
case GeomAbs_BSplineSurface:
|
||||
insertInternalVerticesBSpline(theNewVertices);
|
||||
break;
|
||||
|
||||
default:
|
||||
insertInternalVerticesOther(theNewVertices);
|
||||
break;
|
||||
@@ -621,19 +605,29 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesCylinder(
|
||||
gp_Cylinder aCylinder = myAttribute->Surface()->Cylinder();
|
||||
const Standard_Real aRadius = aCylinder.Radius();
|
||||
|
||||
// Calculate parameters for iteration in U direction
|
||||
Standard_Real Du = GCPnts_TangentialDeflection::ArcAngularStep(
|
||||
aRadius, myAttribute->GetDefFace(), myAngle, myMinSize);
|
||||
|
||||
Standard_Integer nbU = 0;
|
||||
Standard_Integer nbV = 0;
|
||||
const Standard_Real su = umax - umin;
|
||||
const Standard_Integer nbU = (Standard_Integer)(su / Du);
|
||||
Du = su / (nbU + 1);
|
||||
|
||||
// Calculate parameters for iteration in V direction
|
||||
const Standard_Real sv = vmax - vmin;
|
||||
Standard_Integer nbV = (Standard_Integer)(nbU*sv / (su*aRadius));
|
||||
nbV = Min(nbV, 100 * nbU);
|
||||
Standard_Real Dv = sv / (nbV + 1);
|
||||
const Standard_Real aArcLen = su * aRadius;
|
||||
if (aArcLen > myAttribute->GetDefFace ())
|
||||
{
|
||||
// Calculate parameters for iteration in U direction
|
||||
const Standard_Real Du = GCPnts_TangentialDeflection::ArcAngularStep (
|
||||
aRadius, myAttribute->GetDefFace (), myAngle, myMinSize);
|
||||
nbU = (Standard_Integer)(su / Du);
|
||||
|
||||
// Calculate parameters for iteration in V direction
|
||||
const Standard_Real aDv = nbU*sv / aArcLen;
|
||||
// Protection against overflow during casting to int in case
|
||||
// of long cylinder with small radius.
|
||||
nbV = aDv > static_cast<Standard_Real> (IntegerLast ()) ?
|
||||
0 : (Standard_Integer)(aDv);
|
||||
nbV = Min (nbV, 100 * nbU);
|
||||
}
|
||||
|
||||
const Standard_Real Du = su / (nbU + 1);
|
||||
const Standard_Real Dv = sv / (nbV + 1);
|
||||
|
||||
Standard_Real pasu, pasv, pasvmax = vmax - Dv*0.5, pasumax = umax - Du*0.5;
|
||||
for (pasv = vmin + Dv; pasv < pasvmax; pasv += Dv)
|
||||
@@ -817,10 +811,10 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesTorus(
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : insertInternalVerticesBSpline
|
||||
//function : insertInternalVerticesOther
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
|
||||
void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
|
||||
BRepMesh::ListOfVertex& theNewVertices)
|
||||
{
|
||||
const Standard_Real aRange[2][2] = {
|
||||
@@ -836,7 +830,9 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
|
||||
const Standard_Real aDefFace = myAttribute->GetDefFace();
|
||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||
|
||||
BRepMesh::SequenceOfReal aParams[2];
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
BRepMesh::SequenceOfReal aParams[2] = { BRepMesh::SequenceOfReal(anAlloc),
|
||||
BRepMesh::SequenceOfReal(anAlloc) };
|
||||
for (Standard_Integer i = 0; i < 2; ++i)
|
||||
{
|
||||
Standard_Boolean isU = (i == 0);
|
||||
@@ -859,22 +855,21 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
|
||||
}
|
||||
|
||||
// check intermediate isolines
|
||||
Handle(Geom_Surface) aBSpline;
|
||||
GeomAbs_SurfaceType aSurfType = gFace->GetType();
|
||||
if (aSurfType == GeomAbs_BezierSurface)
|
||||
aBSpline = gFace->Bezier();
|
||||
else if (aSurfType == GeomAbs_BSplineSurface)
|
||||
aBSpline = gFace->BSpline();
|
||||
|
||||
Handle (Geom_Surface) aSurface = gFace->ChangeSurface ().Surface ().Surface ();
|
||||
const BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
|
||||
|
||||
BRepMesh::MapOfReal aParamsToRemove[2] = { BRepMesh::MapOfReal(1, anAlloc),
|
||||
BRepMesh::MapOfReal(1, anAlloc) };
|
||||
BRepMesh::MapOfReal aParamsForbiddenToRemove[2] = { BRepMesh::MapOfReal(1, anAlloc),
|
||||
BRepMesh::MapOfReal(1, anAlloc) };
|
||||
|
||||
// precision for compare square distances
|
||||
const Standard_Real aPrecision = Precision::Confusion();
|
||||
const Standard_Real aSqPrecision = aPrecision * aPrecision;
|
||||
const Standard_Real aPrecision = Precision::Confusion();
|
||||
for (Standard_Integer k = 0; k < 2; ++k)
|
||||
{
|
||||
const Standard_Integer aOtherIndex = (k + 1) % 2;
|
||||
BRepMesh::SequenceOfReal& aParams1 = aParams[k];
|
||||
BRepMesh::SequenceOfReal& aParams2 = aParams[(k + 1) % 2];
|
||||
BRepMesh::SequenceOfReal& aParams2 = aParams[aOtherIndex];
|
||||
const Standard_Boolean isU = (k == 0);
|
||||
Standard_Integer aStartIndex, aEndIndex;
|
||||
if (isU)
|
||||
@@ -888,31 +883,30 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
|
||||
aEndIndex = aParams1.Length() - 1;
|
||||
}
|
||||
|
||||
BRepMesh::MapOfReal& aToRemove2 = aParamsToRemove[aOtherIndex];
|
||||
BRepMesh::MapOfReal& aForbiddenToRemove1 = aParamsForbiddenToRemove[k];
|
||||
BRepMesh::MapOfReal& aForbiddenToRemove2 = aParamsForbiddenToRemove[aOtherIndex];
|
||||
for (Standard_Integer i = aStartIndex; i <= aEndIndex; ++i)
|
||||
{
|
||||
const Standard_Real aParam1 = aParams1(i);
|
||||
GeomAdaptor_Curve aIso(isU ?
|
||||
aBSpline->UIso(aParam1) : aBSpline->VIso(aParam1));
|
||||
aSurface->UIso (aParam1) : aSurface->VIso (aParam1));
|
||||
|
||||
Standard_Real aPrevParam2 = aParams2(1);
|
||||
gp_Pnt aPrevPnt2 = aIso.Value(aPrevParam2);
|
||||
gp_Pnt aPrevPnt2;
|
||||
gp_Vec aPrevVec2;
|
||||
aIso.D1 (aPrevParam2, aPrevPnt2, aPrevVec2);
|
||||
for (Standard_Integer j = 2; j <= aParams2.Length();)
|
||||
{
|
||||
Standard_Real aParam2 = aParams2(j);
|
||||
gp_Pnt aPnt2 = aIso.Value(aParam2);
|
||||
gp_Pnt aPnt2;
|
||||
gp_Vec aVec2;
|
||||
aIso.D1 (aParam2, aPnt2, aVec2);
|
||||
|
||||
Standard_Real aMidParam = 0.5 * (aPrevParam2 + aParam2);
|
||||
gp_Pnt aMidPnt = aIso.Value(aMidParam);
|
||||
|
||||
// 23.03.2010 skl for OCC21645 - change precision for comparison
|
||||
Standard_Real aDist;
|
||||
if (aPrevPnt2.SquareDistance(aPnt2) > aSqPrecision)
|
||||
{
|
||||
gp_Lin aLin(aPrevPnt2, gp_Dir(gp_Vec(aPrevPnt2, aPnt2)));
|
||||
aDist = aLin.Distance(aMidPnt);
|
||||
}
|
||||
else
|
||||
aDist = aPrevPnt2.Distance(aMidPnt);
|
||||
|
||||
Standard_Real aDist = deflectionOfSegment (aPrevPnt2, aPnt2, aMidPnt);
|
||||
if (aDist > aDefFace && aDist > myMinSize)
|
||||
{
|
||||
// insertion
|
||||
@@ -934,14 +928,14 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
|
||||
}
|
||||
|
||||
gp_Dir N1(0, 0, 1), N2(0, 0, 1);
|
||||
Standard_Boolean aSt1 = GeomLib::NormEstim(aBSpline, aStPnt1, aPrecision, N1);
|
||||
Standard_Boolean aSt2 = GeomLib::NormEstim(aBSpline, aStPnt2, aPrecision, N2);
|
||||
Standard_Boolean aSt1 = GeomLib::NormEstim (aSurface, aStPnt1, aPrecision, N1);
|
||||
Standard_Boolean aSt2 = GeomLib::NormEstim (aSurface, aStPnt2, aPrecision, N2);
|
||||
|
||||
Standard_Real aAngle = N2.Angle(N1);
|
||||
const Standard_Real aAngle = N2.Angle(N1);
|
||||
if (aSt1 < 1 && aSt2 < 1 && aAngle > myAngle)
|
||||
{
|
||||
Standard_Real aLen = GCPnts_AbscissaPoint::Length(aIso,
|
||||
aPrevParam2, aMidParam, aDefFace);
|
||||
const Standard_Real aLen = GCPnts_AbscissaPoint::Length (
|
||||
aIso, aPrevParam2, aMidParam, aDefFace);
|
||||
|
||||
if (aLen > myMinSize)
|
||||
{
|
||||
@@ -951,8 +945,51 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
|
||||
}
|
||||
}
|
||||
|
||||
// Here we should leave at least 3 parameters as far as
|
||||
// we must have at least one parameter related to surface
|
||||
// internals in order to prevent movement of triangle body
|
||||
// outside the surface in case of highly curved ones, e.g.
|
||||
// BSpline springs.
|
||||
if (aDist < aDefFace &&
|
||||
aParams2.Length () > 3 &&
|
||||
j < aParams2.Length ())
|
||||
{
|
||||
// Remove too dense points
|
||||
const Standard_Real aTmpParam = aParams2 (j + 1);
|
||||
gp_Pnt aTmpPnt;
|
||||
gp_Vec aTmpVec;
|
||||
aIso.D1 (aTmpParam, aTmpPnt, aTmpVec);
|
||||
|
||||
Standard_Real aTmpMidParam = 0.5 * (aPrevParam2 + aTmpParam);
|
||||
gp_Pnt aTmpMidPnt = aIso.Value (aTmpMidParam);
|
||||
|
||||
// Lets check next parameter.
|
||||
// If it also fits deflection, we can remove previous parameter.
|
||||
aDist = deflectionOfSegment (aPrevPnt2, aTmpPnt, aTmpMidPnt);
|
||||
if (aDist < aDefFace)
|
||||
{
|
||||
// Lets check parameters for angular deflection.
|
||||
if (aPrevVec2.Angle (aTmpVec) < myAngle)
|
||||
{
|
||||
// For current Iso line we can remove this parameter.
|
||||
aToRemove2.Add (aParam2);
|
||||
aParam2 = aTmpParam;
|
||||
aPnt2 = aTmpPnt;
|
||||
aVec2 = aTmpVec;
|
||||
++j;
|
||||
}
|
||||
else {
|
||||
// We have found a place on the surface refusing
|
||||
// removement of this parameter.
|
||||
aForbiddenToRemove1.Add (aParam1);
|
||||
aForbiddenToRemove2.Add (aParam2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aPrevParam2 = aParam2;
|
||||
aPrevPnt2 = aPnt2;
|
||||
aPrevVec2 = aVec2;
|
||||
|
||||
++j;
|
||||
}
|
||||
@@ -963,10 +1000,17 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
|
||||
// insert nodes of the regular grid
|
||||
for (Standard_Integer i = 1; i <= aParams[0].Length(); ++i)
|
||||
{
|
||||
const Standard_Real aParam1 = aParams[0].Value(i);
|
||||
const Standard_Real aParam1 = aParams[0].Value (i);
|
||||
if (aParamsToRemove[0].Contains (aParam1) && !aParamsForbiddenToRemove[0].Contains (aParam1))
|
||||
continue;
|
||||
|
||||
for (Standard_Integer j = 1; j <= aParams[1].Length(); ++j)
|
||||
{
|
||||
gp_Pnt2d aPnt2d(aParam1, aParams[1].Value(j));
|
||||
const Standard_Real aParam2 = aParams[1].Value (j);
|
||||
if (aParamsToRemove[1].Contains (aParam2) && !aParamsForbiddenToRemove[1].Contains (aParam2))
|
||||
continue;
|
||||
|
||||
gp_Pnt2d aPnt2d(aParam1, aParam2);
|
||||
|
||||
// Classify intersection point
|
||||
if (aClassifier->Perform(aPnt2d) == TopAbs_IN)
|
||||
@@ -979,87 +1023,6 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : insertInternalVerticesOther
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
|
||||
BRepMesh::ListOfVertex& theNewVertices)
|
||||
{
|
||||
const Standard_Real aAngle = myAngle;//0.35;
|
||||
const Standard_Real aRange[2][2] = {
|
||||
{ myAttribute->GetUMax(), myAttribute->GetUMin() },
|
||||
{ myAttribute->GetVMax(), myAttribute->GetVMin() }
|
||||
};
|
||||
|
||||
const Standard_Real aDefFace = myAttribute->GetDefFace();
|
||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||
|
||||
BRepMesh::SequenceOfReal aParams[2];
|
||||
const Standard_Integer aIsoPointsNb = 11;
|
||||
for (Standard_Integer k = 0; k < 2; ++k)
|
||||
{
|
||||
const Standard_Boolean isU = (k == 0);
|
||||
const GeomAbs_IsoType aIsoType = isU ? GeomAbs_IsoU : GeomAbs_IsoV;
|
||||
const Standard_Integer aOtherParamsIndex = (k + 1) % 2;
|
||||
const Standard_Real (&aRange1)[2] = aRange[k];
|
||||
const Standard_Real (&aRange2)[2] = aRange[aOtherParamsIndex];
|
||||
|
||||
GCPnts_TangentialDeflection aDiscretIso[aIsoPointsNb];
|
||||
const Standard_Real aStepWidth = (aRange1[0] - aRange1[1]) / aIsoPointsNb;
|
||||
|
||||
// Find the most curved Iso.
|
||||
Standard_Integer aMaxIndex = 1, aMaxPointsNb = 0;
|
||||
for (Standard_Integer aIsoIt = 0; aIsoIt < aIsoPointsNb; ++aIsoIt)
|
||||
{
|
||||
Standard_Real aParam = aRange1[1] + aIsoIt * aStepWidth;
|
||||
Adaptor3d_IsoCurve aIso(gFace, aIsoType, aParam);
|
||||
|
||||
Standard_Real aFirstParam = Max(aRange2[1], aIso.FirstParameter());
|
||||
Standard_Real aLastParam = Min(aRange2[0], aIso.LastParameter());
|
||||
|
||||
aDiscretIso[aIsoIt].Initialize(aIso, aFirstParam, aLastParam,
|
||||
aAngle, 0.7 * aDefFace, 2, Precision::PConfusion(), myMinSize);
|
||||
|
||||
const Standard_Integer aPointsNb = aDiscretIso[aIsoIt].NbPoints();
|
||||
if (aPointsNb > aMaxPointsNb)
|
||||
{
|
||||
aMaxPointsNb = aPointsNb;
|
||||
aMaxIndex = aIsoIt;
|
||||
}
|
||||
}
|
||||
|
||||
BRepMesh::SequenceOfReal& aParams2 = aParams[aOtherParamsIndex];
|
||||
GCPnts_TangentialDeflection& aDIso = aDiscretIso[aMaxIndex];
|
||||
for (Standard_Integer i = 1; i <= aMaxPointsNb; ++i)
|
||||
aParams2.Append(aDIso.Parameter(i));
|
||||
|
||||
if (aParams2.Length() == 2)
|
||||
aParams2.InsertAfter(1, 0.5 * (aRange2[1] + aRange2[0]));
|
||||
}
|
||||
|
||||
Adaptor3d_IsoCurve aIsoV;
|
||||
aIsoV.Load(gFace);
|
||||
|
||||
const BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
|
||||
const Standard_Integer aUPointsNb = aParams[0].Length();
|
||||
const Standard_Integer aVPointsNb = aParams[1].Length();
|
||||
for (Standard_Integer i = 2; i < aVPointsNb; ++i)
|
||||
{
|
||||
const Standard_Real aV = aParams[1].Value(i);
|
||||
aIsoV.Load(GeomAbs_IsoV, aV);
|
||||
|
||||
for (Standard_Integer j = 2; j < aUPointsNb; ++j)
|
||||
{
|
||||
const Standard_Real aU = aParams[0].Value(j);
|
||||
|
||||
const gp_Pnt2d aNewPoint(aU, aV);
|
||||
if (aClassifier->Perform(aNewPoint) == TopAbs_IN)
|
||||
insertVertex(aIsoV.Value(aU), aNewPoint.Coord(), theNewVertices);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : checkDeflectionAndInsert
|
||||
//purpose :
|
||||
@@ -1072,7 +1035,8 @@ Standard_Boolean BRepMesh_FastDiscretFace::checkDeflectionAndInsert(
|
||||
const Standard_Real theFaceDeflection,
|
||||
const BRepMesh_CircleTool& theCircleTool,
|
||||
BRepMesh::ListOfVertex& theVertices,
|
||||
Standard_Real& theMaxTriangleDeflection)
|
||||
Standard_Real& theMaxTriangleDeflection,
|
||||
const Handle(NCollection_IncAllocator)& theTempAlloc)
|
||||
{
|
||||
if (theTriangleDeflection > theMaxTriangleDeflection)
|
||||
theMaxTriangleDeflection = theTriangleDeflection;
|
||||
@@ -1087,9 +1051,7 @@ Standard_Boolean BRepMesh_FastDiscretFace::checkDeflectionAndInsert(
|
||||
const_cast<BRepMesh_CircleTool&>(theCircleTool).Select(
|
||||
myAttribute->Scale(theUV, Standard_True));
|
||||
|
||||
Handle(NCollection_IncAllocator) aAllocator =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
BRepMesh::MapOfInteger aUsedNodes(10, aAllocator);
|
||||
BRepMesh::MapOfInteger aUsedNodes(10, theTempAlloc);
|
||||
BRepMesh::ListOfInteger::Iterator aCircleIt(aCirclesList);
|
||||
for (; aCircleIt.More(); aCircleIt.Next())
|
||||
{
|
||||
@@ -1143,15 +1105,15 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||
|
||||
Handle(Geom_Surface) aBSpline;
|
||||
GeomAbs_SurfaceType aSurfType = gFace->GetType();
|
||||
if (aSurfType == GeomAbs_BezierSurface)
|
||||
aBSpline = gFace->Bezier();
|
||||
else if (aSurfType == GeomAbs_BSplineSurface)
|
||||
aBSpline = gFace->BSpline();
|
||||
const GeomAbs_SurfaceType aSurfType = gFace->GetType ();
|
||||
if (IsCompexSurface (aSurfType) && aSurfType != GeomAbs_SurfaceOfExtrusion)
|
||||
aBSpline = gFace->ChangeSurface ().Surface().Surface();
|
||||
|
||||
NCollection_DataMap<Standard_Integer, gp_Dir> aNorMap;
|
||||
BRepMesh::MapOfIntegerInteger aStatMap;
|
||||
NCollection_Map<BRepMesh_OrientedEdge> aCouples(3 * aTrianglesNb);
|
||||
Handle(NCollection_IncAllocator) anAlloc =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
NCollection_DataMap<Standard_Integer, gp_Dir> aNorMap(1, anAlloc);
|
||||
BRepMesh::MapOfIntegerInteger aStatMap(1, anAlloc);
|
||||
NCollection_Map<BRepMesh_OrientedEdge> aCouples(3 * aTrianglesNb, anAlloc);
|
||||
const BRepMesh_CircleTool& aCircles = theTrigu.Circles();
|
||||
|
||||
// Perform refinement passes
|
||||
@@ -1162,8 +1124,11 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
||||
Standard_Real aMaxSqDef = -1.;
|
||||
Standard_Integer aPass = 1, aInsertedNb = 1;
|
||||
Standard_Boolean isAllDegenerated = Standard_False;
|
||||
Handle(NCollection_IncAllocator) aTempAlloc =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
for (; aPass <= aPassesNb && aInsertedNb && !isAllDegenerated; ++aPass)
|
||||
{
|
||||
aTempAlloc->Reset(Standard_False);
|
||||
theNewVertices.Clear();
|
||||
|
||||
// Reset stop condition
|
||||
@@ -1239,7 +1204,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
||||
aSqDef *= aSqDef;
|
||||
|
||||
isSkipped = !checkDeflectionAndInsert(pDef, aCenter2d, theIsFirst,
|
||||
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef);
|
||||
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef, aTempAlloc);
|
||||
|
||||
if (isSkipped)
|
||||
break;
|
||||
@@ -1273,7 +1238,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
||||
aSqDef = aLin.SquareDistance(pDef);
|
||||
|
||||
isSkipped = !checkDeflectionAndInsert(pDef, mi2d, theIsFirst,
|
||||
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef);
|
||||
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef, aTempAlloc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1440,6 +1405,8 @@ void BRepMesh_FastDiscretFace::commitSurfaceTriangulation()
|
||||
BRepMesh_ShapeTool::AddInFace(aFace, aNewTriangulation);
|
||||
|
||||
// Delete unused data
|
||||
myUParam.Clear(0L);
|
||||
myVParam.Clear(0L);
|
||||
myAttribute->ChangeStructure().Nullify();
|
||||
myAttribute->ChangeSurfacePoints().Nullify();
|
||||
myAttribute->ChangeSurfaceVertices().Nullify();
|
||||
|
@@ -106,10 +106,6 @@ private:
|
||||
//! @param theNewVertices list of vertices to be extended and added to mesh.
|
||||
void insertInternalVerticesTorus(BRepMesh::ListOfVertex& theNewVertices);
|
||||
|
||||
//! Calculates nodes lying on Bezier/BSpline surface.
|
||||
//! @param theNewVertices list of vertices to be extended and added to mesh.
|
||||
void insertInternalVerticesBSpline(BRepMesh::ListOfVertex& theNewVertices);
|
||||
|
||||
//! Calculates nodes lying on custom-type surface.
|
||||
//! @param theNewVertices list of vertices to be extended and added to mesh.
|
||||
void insertInternalVerticesOther(BRepMesh::ListOfVertex& theNewVertices);
|
||||
@@ -178,7 +174,8 @@ private:
|
||||
const Standard_Real theFaceDeflection,
|
||||
const BRepMesh_CircleTool& theCircleTool,
|
||||
BRepMesh::ListOfVertex& theVertices,
|
||||
Standard_Real& theMaxTriangleDeflection);
|
||||
Standard_Real& theMaxTriangleDeflection,
|
||||
const Handle(NCollection_IncAllocator)& theTempAlloc);
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -48,6 +48,7 @@
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_MapOfTransient.hxx>
|
||||
#include <TopTools_HArray1OfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
|
||||
@@ -125,8 +126,11 @@ BRepMesh_IncrementalMesh::~BRepMesh_IncrementalMesh()
|
||||
//=======================================================================
|
||||
void BRepMesh_IncrementalMesh::clear()
|
||||
{
|
||||
myEdges.Clear();
|
||||
myEdgeDeflection.Clear();
|
||||
// the allocator will be alive while the structures are alive
|
||||
Handle(NCollection_IncAllocator) anAlloc =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
myEdges.Clear(anAlloc);
|
||||
myEdgeDeflection.Clear(anAlloc);
|
||||
myFaces.Clear();
|
||||
myMesh.Nullify();
|
||||
}
|
||||
@@ -146,15 +150,18 @@ void BRepMesh_IncrementalMesh::init()
|
||||
collectFaces();
|
||||
|
||||
Bnd_Box aBox;
|
||||
BRepBndLib::Add(myShape, aBox, Standard_False);
|
||||
|
||||
if (aBox.IsVoid())
|
||||
if ( myParameters.Relative )
|
||||
{
|
||||
// Nothing to mesh.
|
||||
return;
|
||||
}
|
||||
BRepBndLib::Add(myShape, aBox, Standard_False);
|
||||
|
||||
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
|
||||
if (aBox.IsVoid())
|
||||
{
|
||||
// Nothing to mesh.
|
||||
return;
|
||||
}
|
||||
|
||||
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
|
||||
}
|
||||
|
||||
myMesh = new BRepMesh_FastDiscret (aBox, myParameters);
|
||||
|
||||
@@ -167,22 +174,21 @@ void BRepMesh_IncrementalMesh::init()
|
||||
//=======================================================================
|
||||
void BRepMesh_IncrementalMesh::collectFaces()
|
||||
{
|
||||
TopTools_ListOfShape aFaceList;
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
TopTools_ListOfShape aFaceList(anAlloc);
|
||||
BRepLib::ReverseSortFaces(myShape, aFaceList);
|
||||
TopTools_MapOfShape aFaceMap;
|
||||
TColStd_MapOfTransient aTFaceMap(1, anAlloc);
|
||||
|
||||
// make array of faces suitable for processing (excluding faces without surface)
|
||||
TopLoc_Location aDummyLoc;
|
||||
const TopLoc_Location aEmptyLoc;
|
||||
TopTools_ListIteratorOfListOfShape aFaceIter(aFaceList);
|
||||
for (; aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
TopoDS_Shape aFaceNoLoc = aFaceIter.Value();
|
||||
aFaceNoLoc.Location(aEmptyLoc);
|
||||
if (!aFaceMap.Add (aFaceNoLoc))
|
||||
const TopoDS_Face& aFace = TopoDS::Face(aFaceIter.Value());
|
||||
const Handle(TopoDS_TShape)& aTFace = aFace.TShape();
|
||||
if (!aTFaceMap.Add (aTFace))
|
||||
continue; // already processed
|
||||
|
||||
TopoDS_Face aFace = TopoDS::Face(aFaceIter.Value());
|
||||
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(aFace, aDummyLoc);
|
||||
if (aSurf.IsNull())
|
||||
continue;
|
||||
@@ -282,8 +288,9 @@ void BRepMesh_IncrementalMesh::discretizeFreeEdges()
|
||||
Standard_Real BRepMesh_IncrementalMesh::edgeDeflection(
|
||||
const TopoDS_Edge& theEdge)
|
||||
{
|
||||
if (myEdgeDeflection.IsBound(theEdge))
|
||||
return myEdgeDeflection(theEdge);
|
||||
const Standard_Real* pDef = myEdgeDeflection.Seek(theEdge);
|
||||
if (pDef)
|
||||
return *pDef;
|
||||
|
||||
Standard_Real aEdgeDeflection;
|
||||
if ( myParameters.Relative )
|
||||
@@ -329,7 +336,7 @@ Standard_Real BRepMesh_IncrementalMesh::faceDeflection(
|
||||
void BRepMesh_IncrementalMesh::update(const TopoDS_Edge& theEdge)
|
||||
{
|
||||
if (!myEdges.IsBound(theEdge))
|
||||
myEdges.Bind(theEdge, BRepMesh::DMapOfTriangulationBool());
|
||||
myEdges.Bind(theEdge, BRepMesh::DMapOfTriangulationBool(3, myEdges.Allocator()));
|
||||
|
||||
Standard_Real aEdgeDeflection = edgeDeflection(theEdge);
|
||||
// Check that triangulation relies to face of the given shape.
|
||||
|
@@ -27,14 +27,14 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Default constructor.
|
||||
Standard_EXPORT BRepMesh_OrientedEdge()
|
||||
BRepMesh_OrientedEdge()
|
||||
: myFirstNode(-1),
|
||||
myLastNode(-1)
|
||||
{
|
||||
}
|
||||
|
||||
//! Constructs a link between two vertices.
|
||||
Standard_EXPORT BRepMesh_OrientedEdge(
|
||||
BRepMesh_OrientedEdge(
|
||||
const Standard_Integer theFirstNode,
|
||||
const Standard_Integer theLastNode)
|
||||
: myFirstNode(theFirstNode),
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
//! Returns hash code for this edge.
|
||||
//! @param theUpper upper index in the container.
|
||||
//! @return hash code.
|
||||
Standard_EXPORT Standard_Integer HashCode(const Standard_Integer theUpper) const
|
||||
Standard_Integer HashCode(const Standard_Integer theUpper) const
|
||||
{
|
||||
return ::HashCode(myFirstNode + myLastNode, theUpper);
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ class BRepMesh_PairOfIndex
|
||||
public:
|
||||
|
||||
//! Default constructor
|
||||
Standard_EXPORT BRepMesh_PairOfIndex()
|
||||
BRepMesh_PairOfIndex()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructor. Creates empty pair with null fileds.
|
||||
Standard_EXPORT BRepMesh_PairOfPolygon()
|
||||
BRepMesh_PairOfPolygon()
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,7 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Default constructor.
|
||||
Standard_EXPORT BRepMesh_Triangle()
|
||||
BRepMesh_Triangle()
|
||||
: myEdge1(0),
|
||||
myEdge2(0),
|
||||
myEdge3(0),
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
//! @param theEdges array of edges of triangle.
|
||||
//! @param theOrientations array of edge's orientations.
|
||||
//! @param theMovability movability of triangle.
|
||||
Standard_EXPORT BRepMesh_Triangle(
|
||||
BRepMesh_Triangle(
|
||||
const Standard_Integer (&theEdges)[3],
|
||||
const Standard_Boolean (&theOrientations)[3],
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
//! Returns hash code for this triangle.
|
||||
//! @param theUpper upper index in the container.
|
||||
//! @return hash code.
|
||||
Standard_EXPORT Standard_Integer HashCode(const Standard_Integer theUpper) const
|
||||
Standard_Integer HashCode(const Standard_Integer theUpper) const
|
||||
{
|
||||
return ::HashCode(myEdge1 + myEdge2 + myEdge3, theUpper);
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
//! Checks for equality with another triangle.
|
||||
//! @param theOther triangle to be checked against this one.
|
||||
//! @return TRUE if equal, FALSE if not.
|
||||
Standard_EXPORT Standard_Boolean IsEqual(const BRepMesh_Triangle& theOther) const
|
||||
Standard_Boolean IsEqual(const BRepMesh_Triangle& theOther) const
|
||||
{
|
||||
if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
|
||||
return Standard_False;
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
}
|
||||
|
||||
//! Alias for IsEqual.
|
||||
Standard_EXPORT Standard_Boolean operator ==(const BRepMesh_Triangle& theOther) const
|
||||
Standard_Boolean operator ==(const BRepMesh_Triangle& theOther) const
|
||||
{
|
||||
return IsEqual(theOther);
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Default constructor
|
||||
Standard_EXPORT BRepMesh_Vertex()
|
||||
BRepMesh_Vertex()
|
||||
: myLocation3d(0),
|
||||
myMovability(BRepMesh_Free)
|
||||
{
|
||||
@@ -41,9 +41,9 @@ public:
|
||||
//! @param theUV position of vertex in parametric space.
|
||||
//! @param theLocation3d index of 3d point to be associated with vertex.
|
||||
//! @param theMovability movability of the vertex.
|
||||
Standard_EXPORT BRepMesh_Vertex(const gp_XY& theUV,
|
||||
const Standard_Integer theLocation3d,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
BRepMesh_Vertex(const gp_XY& theUV,
|
||||
const Standard_Integer theLocation3d,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
{
|
||||
Initialize(theUV, theLocation3d, theMovability);
|
||||
}
|
||||
@@ -52,9 +52,9 @@ public:
|
||||
//! @param theU U position of vertex in parametric space.
|
||||
//! @param theV V position of vertex in parametric space.
|
||||
//! @param theMovability movability of the vertex.
|
||||
Standard_EXPORT BRepMesh_Vertex(const Standard_Real theU,
|
||||
const Standard_Real theV,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
BRepMesh_Vertex(const Standard_Real theU,
|
||||
const Standard_Real theV,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
: myUV(theU, theV),
|
||||
myLocation3d(0),
|
||||
myMovability(theMovability)
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
//! Returns hash code for this vertex.
|
||||
//! @param theUpper upper index in the container.
|
||||
//! @return hash code.
|
||||
Standard_EXPORT Standard_Integer HashCode(const Standard_Integer Upper) const
|
||||
Standard_Integer HashCode(const Standard_Integer Upper) const
|
||||
{
|
||||
return ::HashCode(Floor(1e5 * myUV.X()) * Floor(1e5 * myUV.Y()), Upper);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
//! Checks for equality with another vertex.
|
||||
//! @param theOther vertex to be checked against this one.
|
||||
//! @return TRUE if equal, FALSE if not.
|
||||
Standard_EXPORT Standard_Boolean IsEqual(const BRepMesh_Vertex& theOther) const
|
||||
Standard_Boolean IsEqual(const BRepMesh_Vertex& theOther) const
|
||||
{
|
||||
if (myMovability == BRepMesh_Deleted ||
|
||||
theOther.myMovability == BRepMesh_Deleted)
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
}
|
||||
|
||||
//! Alias for IsEqual.
|
||||
Standard_EXPORT Standard_Boolean operator ==(const BRepMesh_Vertex& Other) const
|
||||
Standard_Boolean operator ==(const BRepMesh_Vertex& Other) const
|
||||
{
|
||||
return IsEqual(Other);
|
||||
}
|
||||
|
@@ -30,13 +30,11 @@ public:
|
||||
typedef Standard_Integer Target;
|
||||
|
||||
//! Constructor.
|
||||
//! @param theReservedSize size to be reserved for vector of vertices.
|
||||
//! @param theAllocator memory allocator to be used by internal collections.
|
||||
Standard_EXPORT BRepMesh_VertexInspector (
|
||||
const Standard_Integer theReservedSize,
|
||||
BRepMesh_VertexInspector (
|
||||
const Handle(NCollection_IncAllocator)& theAllocator)
|
||||
: myResIndices(theAllocator),
|
||||
myVertices (new BRepMesh::VectorOfVertex(theReservedSize)),
|
||||
myVertices (new BRepMesh::VectorOfVertex),
|
||||
myDelNodes (theAllocator)
|
||||
{
|
||||
SetTolerance( Precision::Confusion() );
|
||||
@@ -44,7 +42,7 @@ public:
|
||||
|
||||
//! Registers the given vertex.
|
||||
//! @param theVertex vertex to be registered.
|
||||
Standard_EXPORT Standard_Integer Add(const BRepMesh_Vertex& theVertex)
|
||||
Standard_Integer Add(const BRepMesh_Vertex& theVertex)
|
||||
{
|
||||
if( myDelNodes.IsEmpty() )
|
||||
{
|
||||
@@ -147,7 +145,7 @@ public:
|
||||
Standard_EXPORT NCollection_CellFilter_Action Inspect(const Standard_Integer theTargetIndex);
|
||||
|
||||
//! Checks indices for equlity.
|
||||
Standard_EXPORT static Standard_Boolean IsEqual(const Standard_Integer theIndex,
|
||||
static Standard_Boolean IsEqual(const Standard_Integer theIndex,
|
||||
const Standard_Integer theTargetIndex)
|
||||
{
|
||||
return (theIndex == theTargetIndex);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user